diff options
| author | Nathan Rossi <nathan.rossi@xilinx.com> | 2015-01-29 13:54:58 +1000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2015-02-20 21:17:04 -0500 |
| commit | 3b1ef55b44cd4aa4cb330f173d3dde61ebfb254f (patch) | |
| tree | 763d3d77fd849997a9a9416d8b339d6656d649f8 | |
| parent | e01dd91f779b398f4b8f293a00aba28e53bb942d (diff) | |
| download | meta-virtualization-3b1ef55b44cd4aa4cb330f173d3dde61ebfb254f.tar.gz | |
xen: Add support for systemd
* Refactor volatiles so that it generates sysvinit/populate-volatiles as
well as tmpfiles.d configs
* Add systemd PACKAGECONFIG for enabling systemd support
* Setup SYSTEMD_SERVICE variables
* Add FILES values for systemd .service/.mount/etc files
* sed patterns to the 4.5.0 recipe to fix some issues with the source
around qemu-system-i386 and libsystemd-daemon
Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
| -rw-r--r-- | recipes-extended/xen/xen.inc | 81 | ||||
| -rw-r--r-- | recipes-extended/xen/xen_4.5.0.bb | 8 |
2 files changed, 70 insertions, 19 deletions
diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc index 82bb3d28..3f703ce4 100644 --- a/recipes-extended/xen/xen.inc +++ b/recipes-extended/xen/xen.inc | |||
| @@ -8,16 +8,18 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=e0f0f3ac55608719a82394cc353928df" | |||
| 8 | 8 | ||
| 9 | COMPATIBLE_HOST = '(x86_64.*).*-linux|aarch64.*-linux' | 9 | COMPATIBLE_HOST = '(x86_64.*).*-linux|aarch64.*-linux' |
| 10 | 10 | ||
| 11 | inherit autotools-brokensep gettext setuptools update-rc.d | 11 | inherit autotools-brokensep gettext setuptools update-rc.d systemd |
| 12 | 12 | ||
| 13 | require xen-arch.inc | 13 | require xen-arch.inc |
| 14 | 14 | ||
| 15 | PACKAGECONFIG ??= " \ | 15 | PACKAGECONFIG ??= " \ |
| 16 | sdl \ | 16 | sdl \ |
| 17 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \ | ||
| 17 | " | 18 | " |
| 18 | 19 | ||
| 19 | PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,virtual/libsdl," | 20 | PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,virtual/libsdl," |
| 20 | PACKAGECONFIG[xsm] = "--enable-xsmpolicy,--disable-xsmpolicy,checkpolicy-native," | 21 | PACKAGECONFIG[xsm] = "--enable-xsmpolicy,--disable-xsmpolicy,checkpolicy-native," |
| 22 | PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd,systemd," | ||
| 21 | 23 | ||
| 22 | DEPENDS = " \ | 24 | DEPENDS = " \ |
| 23 | bison-native \ | 25 | bison-native \ |
| @@ -111,6 +113,7 @@ RDEPENDS_${PN}-xencommons = "\ | |||
| 111 | ${PN}-console \ | 113 | ${PN}-console \ |
| 112 | ${PN}-xenstore \ | 114 | ${PN}-xenstore \ |
| 113 | ${PN}-xenstored \ | 115 | ${PN}-xenstored \ |
| 116 | ${PN}-xl \ | ||
| 114 | ${PN}-scripts-common \ | 117 | ${PN}-scripts-common \ |
| 115 | " | 118 | " |
| 116 | 119 | ||
| @@ -499,6 +502,7 @@ FILES_${PN}-udev = "\ | |||
| 499 | 502 | ||
| 500 | FILES_${PN}-volatiles = "\ | 503 | FILES_${PN}-volatiles = "\ |
| 501 | ${sysconfdir}/default/volatiles/99_xen \ | 504 | ${sysconfdir}/default/volatiles/99_xen \ |
| 505 | ${sysconfdir}/tmpfiles.d/xen.conf \ | ||
| 502 | " | 506 | " |
| 503 | 507 | ||
| 504 | FILES_${PN}-xcutils = "\ | 508 | FILES_${PN}-xcutils = "\ |
| @@ -555,6 +559,7 @@ FILES_${PN}-xentrace = "\ | |||
| 555 | FILES_${PN}-xen-watchdog = "\ | 559 | FILES_${PN}-xen-watchdog = "\ |
| 556 | ${sbindir}/xenwatchdogd \ | 560 | ${sbindir}/xenwatchdogd \ |
| 557 | ${sysconfdir}/init.d/xen-watchdog \ | 561 | ${sysconfdir}/init.d/xen-watchdog \ |
| 562 | ${systemd_unitdir}/system/xen-watchdog.service \ | ||
| 558 | " | 563 | " |
| 559 | 564 | ||
| 560 | FILES_${PN}-xl = "\ | 565 | FILES_${PN}-xl = "\ |
| @@ -596,6 +601,15 @@ FILES_${PN}-xm = "\ | |||
| 596 | FILES_${PN}-xencommons += "\ | 601 | FILES_${PN}-xencommons += "\ |
| 597 | ${sysconfdir}/default/xencommons \ | 602 | ${sysconfdir}/default/xencommons \ |
| 598 | ${sysconfdir}/init.d/xencommons \ | 603 | ${sysconfdir}/init.d/xencommons \ |
| 604 | ${systemd_unitdir}/modules-load.d/xen.conf \ | ||
| 605 | ${systemd_unitdir}/system/proc-xen.mount \ | ||
| 606 | ${systemd_unitdir}/system/xen-qemu-dom0-disk-backend.service \ | ||
| 607 | ${systemd_unitdir}/system/xenconsoled.service \ | ||
| 608 | ${systemd_unitdir}/system/xen-init-dom0.service \ | ||
| 609 | ${systemd_unitdir}/system/xenstored.service \ | ||
| 610 | ${systemd_unitdir}/system/xenstored.socket \ | ||
| 611 | ${systemd_unitdir}/system/xenstored_ro.socket \ | ||
| 612 | ${systemd_unitdir}/system/var-lib-xenstored.mount \ | ||
| 599 | " | 613 | " |
| 600 | 614 | ||
| 601 | FILES_${PN}-xend += " \ | 615 | FILES_${PN}-xend += " \ |
| @@ -608,6 +622,7 @@ FILES_${PN}-xendomains += "\ | |||
| 608 | ${sysconfdir}/default/xendomains \ | 622 | ${sysconfdir}/default/xendomains \ |
| 609 | ${sysconfdir}/init.d/xendomains \ | 623 | ${sysconfdir}/init.d/xendomains \ |
| 610 | ${sysconfdir}/sysconfig/xendomains \ | 624 | ${sysconfdir}/sysconfig/xendomains \ |
| 625 | ${systemd_unitdir}/system/xendomains.service \ | ||
| 611 | " | 626 | " |
| 612 | 627 | ||
| 613 | # configure init.d scripts | 628 | # configure init.d scripts |
| @@ -621,6 +636,21 @@ INITSCRIPT_PARAMS_${PN}-xend = "defaults 82" | |||
| 621 | INITSCRIPT_NAME_${PN}-xendomains = "xendomains" | 636 | INITSCRIPT_NAME_${PN}-xendomains = "xendomains" |
| 622 | INITSCRIPT_PARAMS_${PN}-xendomains = "defaults 83" | 637 | INITSCRIPT_PARAMS_${PN}-xendomains = "defaults 83" |
| 623 | 638 | ||
| 639 | # systemd packages | ||
| 640 | SYSTEMD_PACKAGES = "${PN}-xen-watchdog ${PN}-xencommons ${PN}-xendomains" | ||
| 641 | SYSTEMD_SERVICE_${PN}-watchdog = "xen-watchdog.service" | ||
| 642 | SYSTEMD_SERVICE_${PN}-xencommons = " \ | ||
| 643 | proc-xen.mount \ | ||
| 644 | var-lib-xenstored.mount \ | ||
| 645 | xen-qemu-dom0-disk-backend.service \ | ||
| 646 | xenconsoled.service \ | ||
| 647 | xen-init-dom0.service \ | ||
| 648 | xenstored.service \ | ||
| 649 | xenstored.socket \ | ||
| 650 | xenstored_ro.socket \ | ||
| 651 | " | ||
| 652 | SYSTEMD_SERVICE_${PN}-xendomains = "xendomains.service" | ||
| 653 | |||
| 624 | #### REQUIRED ENVIRONMENT VARIABLES #### | 654 | #### REQUIRED ENVIRONMENT VARIABLES #### |
| 625 | export BUILD_SYS | 655 | export BUILD_SYS |
| 626 | export HOST_SYS | 656 | export HOST_SYS |
| @@ -650,6 +680,8 @@ EXTRA_OECONF += " \ | |||
| 650 | --exec-prefix=/usr \ | 680 | --exec-prefix=/usr \ |
| 651 | --prefix=/usr \ | 681 | --prefix=/usr \ |
| 652 | --host=${HOST_SYS} \ | 682 | --host=${HOST_SYS} \ |
| 683 | --with-systemd=${systemd_unitdir}/system \ | ||
| 684 | --with-systemd-modules-load=${systemd_unitdir}/modules-load.d \ | ||
| 653 | --disable-stubdom \ | 685 | --disable-stubdom \ |
| 654 | --disable-ioemu-stubdom \ | 686 | --disable-ioemu-stubdom \ |
| 655 | --disable-pv-grub \ | 687 | --disable-pv-grub \ |
| @@ -686,33 +718,44 @@ do_install() { | |||
| 686 | ${D}${localstatedir}/volatile \ | 718 | ${D}${localstatedir}/volatile \ |
| 687 | ${D}${localstatedir}/lib/xen | 719 | ${D}${localstatedir}/lib/xen |
| 688 | 720 | ||
| 721 | VOLATILE_DIRS=" \ | ||
| 722 | ${localstatedir}/run/xenstored \ | ||
| 723 | ${localstatedir}/run/xend \ | ||
| 724 | ${localstatedir}/run/xend/boot \ | ||
| 725 | ${localstatedir}/run/xen \ | ||
| 726 | ${localstatedir}/log/xen \ | ||
| 727 | ${localstatedir}/lock/xen \ | ||
| 728 | ${localstatedir}/lock/subsys \ | ||
| 729 | ${localstatedir}/lib/xen \ | ||
| 730 | " | ||
| 731 | |||
| 689 | # install volatiles using populate_volatiles mechanism | 732 | # install volatiles using populate_volatiles mechanism |
| 690 | install -d ${D}${sysconfdir}/default/volatiles | 733 | install -d ${D}${sysconfdir}/default/volatiles |
| 691 | echo "d root root 0755 ${localstatedir}/run/xenstored none" \ | 734 | for i in $VOLATILE_DIRS; do |
| 692 | > ${D}${sysconfdir}/default/volatiles/99_xen | 735 | echo "d root root 0755 $i none" >> ${D}${sysconfdir}/default/volatiles/99_xen |
| 693 | echo "d root root 0755 ${localstatedir}/run/xend none" \ | 736 | done |
| 694 | >> ${D}${sysconfdir}/default/volatiles/99_xen | ||
| 695 | echo "d root root 0755 ${localstatedir}/run/xend/boot none" \ | ||
| 696 | >> ${D}${sysconfdir}/default/volatiles/99_xen | ||
| 697 | echo "d root root 0755 ${localstatedir}/run/xen none" \ | ||
| 698 | >> ${D}${sysconfdir}/default/volatiles/99_xen | ||
| 699 | echo "d root root 0755 ${localstatedir}/log/xen none" \ | ||
| 700 | >> ${D}${sysconfdir}/default/volatiles/99_xen | ||
| 701 | echo "d root root 0755 ${localstatedir}/lock/xen none" \ | ||
| 702 | >> ${D}${sysconfdir}/default/volatiles/99_xen | ||
| 703 | echo "d root root 0755 ${localstatedir}/lock/subsys none" \ | ||
| 704 | >> ${D}${sysconfdir}/default/volatiles/99_xen | ||
| 705 | echo "d root root 0755 ${localstatedir}/lib/xen none" \ | ||
| 706 | >> ${D}${sysconfdir}/default/volatiles/99_xen | ||
| 707 | 737 | ||
| 708 | # workaround for xendomains script which searchs sysconfig if directory exists | 738 | # workaround for xendomains script which searchs sysconfig if directory exists |
| 709 | install -d ${D}${sysconfdir}/sysconfig | 739 | install -d ${D}${sysconfdir}/sysconfig |
| 710 | ln -sf ${sysconfdir}/default/xendomains ${D}${sysconfdir}/sysconfig/xendomains | 740 | ln -sf ${sysconfdir}/default/xendomains ${D}${sysconfdir}/sysconfig/xendomains |
| 741 | |||
| 742 | # systemd | ||
| 743 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
| 744 | # install volatiles using systemd tmpfiles.d | ||
| 745 | install -d ${D}${sysconfdir}/tmpfiles.d | ||
| 746 | for i in $VOLATILE_DIRS; do | ||
| 747 | echo "d $i 0755 root root - -" >> ${D}${sysconfdir}/tmpfiles.d/xen.conf | ||
| 748 | done | ||
| 749 | fi | ||
| 711 | } | 750 | } |
| 712 | 751 | ||
| 713 | pkg_postinst_${PN}-volatiles() { | 752 | pkg_postinst_${PN}-volatiles() { |
| 714 | if [ -z "$D" ] && [ -e ${sysconfdir}/init.d/populate-volatile.sh ] ; then | 753 | if [ -z "$D" ]; then |
| 715 | ${sysconfdir}/init.d/populate-volatile.sh update | 754 | if command -v systemd-tmpfiles >/dev/null; then |
| 755 | systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/xen.conf | ||
| 756 | elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then | ||
| 757 | ${sysconfdir}/init.d/populate-volatile.sh update | ||
| 758 | fi | ||
| 716 | fi | 759 | fi |
| 717 | } | 760 | } |
| 718 | 761 | ||
diff --git a/recipes-extended/xen/xen_4.5.0.bb b/recipes-extended/xen/xen_4.5.0.bb index 62d1d87a..5f8c087c 100644 --- a/recipes-extended/xen/xen_4.5.0.bb +++ b/recipes-extended/xen/xen_4.5.0.bb | |||
| @@ -28,9 +28,17 @@ do_configure_prepend() { | |||
| 28 | done | 28 | done |
| 29 | # fixup environment passing in some makefiles | 29 | # fixup environment passing in some makefiles |
| 30 | sed -i 's#\(\w*\)=\(\$.\w*.\)#\1="\2"#' ${S}/tools/firmware/Makefile | 30 | sed -i 's#\(\w*\)=\(\$.\w*.\)#\1="\2"#' ${S}/tools/firmware/Makefile |
| 31 | |||
| 32 | # libsystemd-daemon -> libsystemd for newer systemd versions | ||
| 33 | sed -i 's#libsystemd-daemon#libsystemd#' ${S}/tools/configure | ||
| 31 | } | 34 | } |
| 32 | 35 | ||
| 33 | do_install_append() { | 36 | do_install_append() { |
| 34 | # fixup default path to qemu-system-i386 | 37 | # fixup default path to qemu-system-i386 |
| 35 | sed -i 's#\(test -z "$QEMU_XEN" && QEMU_XEN=\).*$#\1"/usr/bin/qemu-system-i386"#' ${D}/etc/init.d/xencommons | 38 | sed -i 's#\(test -z "$QEMU_XEN" && QEMU_XEN=\).*$#\1"/usr/bin/qemu-system-i386"#' ${D}/etc/init.d/xencommons |
| 39 | |||
| 40 | if [ -e ${D}${systemd_unitdir}/system/xen-qemu-dom0-disk-backend.service ]; then | ||
| 41 | sed -i 's#ExecStart=.*qemu-system-i386\(.*\)$#ExecStart=/usr/bin/qemu-system-i386\1#' \ | ||
| 42 | ${D}${systemd_unitdir}/system/xen-qemu-dom0-disk-backend.service | ||
| 43 | fi | ||
| 36 | } | 44 | } |
