From 00fadc772481ece9000fbb2510309a3ac00aa113 Mon Sep 17 00:00:00 2001 From: Jason Andryuk Date: Thu, 12 Oct 2023 16:01:16 -0400 Subject: [PATCH 1/2] xen: Build ocaml stuff in xen-tools Remove the xen-ocaml-libs recipe - it's not needed. This depends on a meta-openxt-ocaml-platform change to change the findlib.class FILES_ definitions. While doings this, get rid of the xenstored alternatives stuff. Just create two parallel packages and make them RCONFLICT. Signed-off-by: Jason Andryuk --- conf/distro/openxt-main.conf | 3 - recipes-core/images/xenclient-dom0-image.bb | 7 -- .../xen/files/oxenstored.initscript | 64 ++++++++++ recipes-extended/xen/xen-ocaml-libs.bb | 112 ------------------ recipes-extended/xen/xen-tools-openxt.inc | 68 ++++++++--- recipes-openxt/manager/dbd_git.bb | 2 +- recipes-openxt/uid/uid_git.bb | 2 +- .../patches/policy.modules.system.xen.diff | 2 +- 8 files changed, 119 insertions(+), 141 deletions(-) create mode 100755 recipes-extended/xen/files/oxenstored.initscript delete mode 100644 recipes-extended/xen/xen-ocaml-libs.bb diff --git a/conf/distro/openxt-main.conf b/conf/distro/openxt-main.conf index 88ed53bcb1..3ead4296cb 100644 --- a/conf/distro/openxt-main.conf +++ b/conf/distro/openxt-main.conf @@ -63,9 +63,6 @@ PREFERRED_PROVIDER_jpeg-native = "jpeg-native" # Set the preferred version to C xenstored from xen-tools PREFERRED_PROVIDER_virtual/xenstored = "xen-tools" PREFERRED_RPROVIDER_virtual/xenstored = "xen-tools-xenstored" -# Force exclusion of the OCaml xenstored since the above preferences -# are not sufficient to override that as the default selection: -PACKAGE_EXCLUDE += " xen-ocaml-libs-xenstored" # The C and OCaml xenstored packages can be installed together # and this whitelisting is necessary to allow both to be built diff --git a/recipes-core/images/xenclient-dom0-image.bb b/recipes-core/images/xenclient-dom0-image.bb index 05faa7030c..e9681059af 100644 --- a/recipes-core/images/xenclient-dom0-image.bb +++ b/recipes-core/images/xenclient-dom0-image.bb @@ -93,13 +93,6 @@ remove_initscripts() { } ROOTFS_POSTPROCESS_COMMAND += "remove_initscripts; " -# After ensuring that the correct number of xenstored daemon(s) are installed, -# enforce that the init script is active: -activate_xenstored_initscript() { - update-rc.d -r ${IMAGE_ROOTFS} xenstored defaults 05 -} -ROOTFS_POSTPROCESS_COMMAND += "activate_xenstored_initscript; " - # Handle required configuration of the rootfs to store persistent files on # encripted /config partition. rw_config_partition() { diff --git a/recipes-extended/xen/files/oxenstored.initscript b/recipes-extended/xen/files/oxenstored.initscript new file mode 100755 index 0000000000..2f26bc33c5 --- /dev/null +++ b/recipes-extended/xen/files/oxenstored.initscript @@ -0,0 +1,64 @@ +#!/bin/sh +# +# Copyright (c) 2013 Citrix Systems, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + + +PIDFILE=/var/run/xenstored.pid +EXECUTABLE=/usr/sbin/oxenstored + +[ -f "${EXECUTABLE}" ] || exit 0 + +start() { + echo -n "Starting xenstored: " + # Allow 55MB for core dumps + ulimit -c 112640 + $EXECUTABLE --pid-file $PIDFILE 2> /dev/null 2>&1 + for i in /usr/share/xenclient/xenstore-init*; + do + $i > /dev/null 2>&1; + done + echo "OK" +} + +stop() { + echo -n "Stopping xenstored: " + while kill `pidof -o %PPID oxenstored` 2>/dev/null ; do sleep 1 ; done + echo "OK" +} + +restart() { + stop + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? diff --git a/recipes-extended/xen/xen-ocaml-libs.bb b/recipes-extended/xen/xen-ocaml-libs.bb deleted file mode 100644 index 2c8560066c..0000000000 --- a/recipes-extended/xen/xen-ocaml-libs.bb +++ /dev/null @@ -1,112 +0,0 @@ -DESCRIPTION = "Xen hypervisor ocaml libs and xenstore components" - -XEN_REL = "4.18" -XEN_BRANCH ?= "stable-${XEN_REL}" -SRCREV ?= "${AUTOREV}" - -SRC_URI = " \ - git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ - file://xenstored.initscript \ - file://oxenstored.conf \ - " - -LIC_FILES_CHKSUM ?= "file://COPYING;md5=d1a1e216f80b6d8da95fec897d0dbec9" - -PV = "${XEN_REL}+git${SRCPV}" - -S = "${WORKDIR}/git" - -require recipes-extended/xen/xen.inc -require xen-common.inc - -inherit ocaml findlib python3native update-rc.d - -PACKAGES = " \ - ${PN}-xenstored \ - ${PN}-dev \ - ${PN}-dbg \ - ${PN}-staticdev \ - ${PN} \ - " - -PROVIDES =+ "virtual/xenstored" - -DEPENDS += " \ - util-linux \ - xen \ - libnl \ - xen-tools \ - " - -# OpenXT packages both the C and OCaml versions of XenStored. -# This recipe packages the OCaml daemon; xen.bb packages the C one. -FILES_${PN}-xenstored = " \ - ${sbindir}/xenstored.${PN}-xenstored \ - ${localstatedir}/lib/xenstored \ - ${INIT_D_DIR}/xenstored.${PN}-xenstored \ - ${sysconfdir}/xen/oxenstored.conf \ - " -RPROVIDES_${PN}-xenstored = "virtual/xenstored" - -EXTRA_OECONF_remove = "--disable-ocamltools" - -# OCAMLDESTDIR is set to $DESTDIR/$(ocamlfind printconf destdir), yet DESTDIR -# is required for other binaries installation, so override OCAMLDESTDIR. -EXTRA_OEMAKE += " \ - CROSS_SYS_ROOT=${STAGING_DIR_HOST} \ - CROSS_COMPILE=${HOST_PREFIX} \ - CONFIG_IOEMU=n \ - DESTDIR=${D} \ - OCAMLDESTDIR=${D}${sitelibdir} \ - " - -TARGET_CC_ARCH += "${LDFLAGS}" -CC_FOR_OCAML="${TARGET_PREFIX}gcc" - -INITSCRIPT_PACKAGES = "${PN}-xenstored" -INITSCRIPT_NAME_${PN}-xenstored = "xenstored" -INITSCRIPT_PARAMS_${PN}-xenstored = "defaults 05 95" - -pkg_postinst_${PN}-xenstored () { - update-alternatives --install ${sbindir}/xenstored xenstored xenstored.${PN}-xenstored 100 - update-alternatives --install ${INIT_D_DIR}/xenstored xenstored-initscript xenstored.${PN}-xenstored 100 -} - -pkg_prerm_${PN}-xenstored () { - update-alternatives --remove xenstored xenstored.${PN}-xenstored - update-alternatives --remove xenstored-initscript xenstored.${PN}-xenstored -} - -do_configure() { - do_configure_common -} - -do_compile() { - oe_runmake -C tools/libs subdir-all-toolcore - oe_runmake -C tools/libs subdir-all-toollog - oe_runmake -C tools/libs subdir-all-call - oe_runmake -C tools/libs subdir-all-hypfs - oe_runmake -C tools subdir-all-include - - oe_runmake V=1 \ - LDLIBS_libxenctrl='-lxenctrl' \ - LDLIBS_libxenstore='-lxenstore' \ - LDLIBS_libxenguest='-lxenguest' \ - LDLIBS_libxentoollog='-lxentoollog' \ - LDLIBS_libxenevtchn='-lxenevtchn' \ - -C tools subdir-all-ocaml -} - -do_install() { - oe_runmake -C tools/ocaml install - - mv ${D}/usr/sbin/oxenstored ${D}/${sbindir}/xenstored.${PN}-xenstored - install -d ${D}${INIT_D_DIR} - install -m 0755 ${WORKDIR}/xenstored.initscript \ - ${D}${INIT_D_DIR}/xenstored.${PN}-xenstored - rm ${D}${sysconfdir}/xen/oxenstored.conf - install -m 0644 ${WORKDIR}/oxenstored.conf \ - ${D}${sysconfdir}/xen/oxenstored.conf -} - -INSANE_SKIP_${PN}-dev = "file-rdeps" diff --git a/recipes-extended/xen/xen-tools-openxt.inc b/recipes-extended/xen/xen-tools-openxt.inc index 0498b1e451..8ad2dea03c 100644 --- a/recipes-extended/xen/xen-tools-openxt.inc +++ b/recipes-extended/xen/xen-tools-openxt.inc @@ -3,14 +3,29 @@ XEN_TARGET_ARCH = "x86_64" SRC_URI_append = "\ file://xenconsoled.initscript \ file://xenstored.initscript \ + file://oxenstored.initscript \ + file://oxenstored.conf \ file://xen-init-dom0.initscript \ file://xl.conf \ " +inherit ocaml findlib + +EXTRA_OECONF_remove = "--disable-ocamltools" + +# OCAMLDESTDIR is set to $DESTDIR/$(ocamlfind printconf destdir), yet DESTDIR +# is required for other binaries installation, so override OCAMLDESTDIR. +EXTRA_OEMAKE += " \ + OCAMLDESTDIR=${D}${sitelibdir} \ +" + +#TARGET_CC_ARCH += "${LDFLAGS}" +#CC_FOR_OCAML="${TARGET_PREFIX}gcc" + RDEPENDS_${PN}-xl += " ${PN}-scripts-block" RDEPENDS_${PN}-libxenlight += " varstored-watch" -PACKAGES += " \ +PACKAGES =+ " \ ${PN}-libxenhypfs \ ${PN}-libxenhypfs-dev \ " @@ -21,11 +36,23 @@ PROVIDES =+ "virtual/xenstored" FILES_${PN}-console += "${INIT_D_DIR}/xenconsoled" FILES_${PN}-xenstored = " \ - ${sbindir}/xenstored.${PN}-xenstored \ + ${sbindir}/xenstored \ ${localstatedir}/lib/xenstored \ - ${INIT_D_DIR}/xenstored.${PN}-xenstored \ + ${INIT_D_DIR}/xenstored \ ${sysconfdir}/xen/xenstored.conf \ - " +" +RCONFLICTS_${PN}-xenstored = "${PN}-oxenstored" +RPROVIDES_${PN}-xenstored = "virtual/xenstored" + +FILES_${PN}-oxenstored = " \ + ${sbindir}/oxenstored \ + ${localstatedir}/lib/xenstored \ + ${INIT_D_DIR}/oxenstored \ + ${sysconfdir}/xen/oxenstored.conf \ +" +PACKAGES =+ "${PN}-oxenstored" +RCONFLICTS_${PN}-oxenstored = "${PN}-xenstored" +RPROVIDES_${PN}-oxenstored = "virtual/xenstored" FILES_${PN}-libxenhypfs = " \ ${libdir}/libxenhypfs.so.* \ @@ -59,6 +86,11 @@ FILES_${PN}-misc += " \ ${sbindir}/xen-vmtrace \ " +FILES_${PN}-ocaml = " \ + ${sitelibdir}/*/*${SOLIBSDEV} \ +" +PACKAGES =+ "${PN}-ocaml" + # Python programs we don't want inby default, but they are # actually libxl runtime dependencies. FILES_${PN}-migration-helpers = " \ @@ -83,12 +115,15 @@ FILES_${PN}-xl += " ${INIT_D_DIR}/xen-init-dom0" INITSCRIPT_PACKAGES =+ " \ ${PN}-console \ ${PN}-xenstored \ + ${PN}-oxenstored \ ${PN}-xl \ " INITSCRIPT_NAME_${PN}-console = "xenconsoled" INITSCRIPT_PARAMS_${PN}-console = "defaults 20 80" INITSCRIPT_NAME_${PN}-xenstored = "xenstored" INITSCRIPT_PARAMS_${PN}-xenstored = "defaults 05 95" +INITSCRIPT_NAME_${PN}-oxenstored = "oxenstored" +INITSCRIPT_PARAMS_${PN}-oxenstored = "defaults 05 95" INITSCRIPT_NAME_${PN}-xl = "xen-init-dom0" INITSCRIPT_PARAMS_${PN}-xl = "defaults 21 79" INITSCRIPT_NAME_${PN}-xl = "xen-init-dom0" @@ -96,15 +131,6 @@ INITSCRIPT_PARAMS_${PN}-xl = "defaults 21 79" EXTRA_OEMAKE += "ETHERBOOT_ROMS=${STAGING_DIR_HOST}/usr/share/firmware/intel.rom" -pkg_postinst_${PN}-xenstored () { - update-alternatives --install ${sbindir}/xenstored xenstored xenstored.${PN}-xenstored 200 - update-alternatives --install ${INIT_D_DIR}/xenstored xenstored-initscript xenstored.${PN}-xenstored 200 -} -pkg_prerm_${PN}-xenstored () { - update-alternatives --remove xenstored xenstored.${PN}-xenstored - update-alternatives --remove xenstored-initscript xenstored.${PN}-xenstored -} - do_install_append() { install -d ${D}${datadir}/pkgconfig @@ -118,13 +144,19 @@ do_install_append() { install -m 0644 ${WORKDIR}/xl.conf \ ${D}${sysconfdir}/xen/xl.conf - mv ${D}${sbindir}/xenstored ${D}${sbindir}/xenstored.${PN}-xenstored install -m 0755 ${WORKDIR}/xenstored.initscript \ - ${D}${INIT_D_DIR}/xenstored.${PN}-xenstored + ${D}${INIT_D_DIR}/xenstored + + install -d ${D}${INIT_D_DIR} + install -m 0755 ${WORKDIR}/xenstored.initscript \ + ${D}${INIT_D_DIR}/oxenstored + rm ${D}${sysconfdir}/xen/oxenstored.conf + install -m 0644 ${WORKDIR}/oxenstored.conf \ + ${D}${sysconfdir}/xen/oxenstored.conf # The C xenstored uses one additional command line argument: sed 's/EXECUTABLE --/EXECUTABLE --internal-db --/' \ - -i ${D}${INIT_D_DIR}/xenstored.${PN}-xenstored + -i ${D}${INIT_D_DIR}/xenstored # Since we don't have a xenstore stubdomain, remove the # xenstore stubdomain init program (libdir == /usr/lib) @@ -137,3 +169,7 @@ do_install_append() { rm -rf ${D}/${sysconfdir}/xen/scripts/block-dummy rm -rf ${D}/${sysconfdir}/default/xencommons } + +# Ocaml files, /usr/lib/ocaml/site-lib/xen*/xen*.cm{a,o}, reference ocaml +# shared libraries, but we don't have a runtime. +INSANE_SKIP_${PN}-dev = "file-rdeps" diff --git a/recipes-openxt/manager/dbd_git.bb b/recipes-openxt/manager/dbd_git.bb index 82781bb6bf..1a8eb191cc 100644 --- a/recipes-openxt/manager/dbd_git.bb +++ b/recipes-openxt/manager/dbd_git.bb @@ -4,7 +4,7 @@ LIC_FILES_CHKSUM = "file://../COPYING;md5=4641e94ec96f98fabc56ff9cc48be14b" DEPENDS = " \ ocaml-dbus \ - xen-ocaml-libs \ + xen-tools \ openxt-ocaml-libs \ " diff --git a/recipes-openxt/uid/uid_git.bb b/recipes-openxt/uid/uid_git.bb index b8d749bb94..de0412d004 100644 --- a/recipes-openxt/uid/uid_git.bb +++ b/recipes-openxt/uid/uid_git.bb @@ -4,7 +4,7 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425 DEPENDS = " \ dbus-native \ ocaml-dbus \ - xen-ocaml-libs \ + xen-tools \ openxt-ocaml-libs \ " diff --git a/recipes-security/refpolicy/refpolicy-mcs/patches/policy.modules.system.xen.diff b/recipes-security/refpolicy/refpolicy-mcs/patches/policy.modules.system.xen.diff index 2f3af33e43..0e2f29a8f1 100644 --- a/recipes-security/refpolicy/refpolicy-mcs/patches/policy.modules.system.xen.diff +++ b/recipes-security/refpolicy/refpolicy-mcs/patches/policy.modules.system.xen.diff @@ -12,7 +12,7 @@ +/usr/bin/xenmgr -- gen_context(system_u:object_r:xend_exec_t,s0) /usr/sbin/xenstored -- gen_context(system_u:object_r:xenstored_exec_t,s0) +/usr/sbin/xenstored\.xen-tools-xenstored -- gen_context(system_u:object_r:xenstored_exec_t,s0) -+/usr/sbin/xenstored\.xen-ocaml-libs-xenstored -- gen_context(system_u:object_r:xenstored_exec_t,s0) ++/usr/sbin/oxenstored -- gen_context(system_u:object_r:xenstored_exec_t,s0) /usr/sbin/xl -- gen_context(system_u:object_r:xm_exec_t,s0) /usr/sbin/xm -- gen_context(system_u:object_r:xm_exec_t,s0) From 7ffa08ddfe680fe20693596a02e8f90a616a4aa6 Mon Sep 17 00:00:00 2001 From: Jason Andryuk Date: Thu, 12 Oct 2023 16:05:14 -0400 Subject: [PATCH 2/2] Remove virtual/xenstore It doesn't work. The virtual stuff is broken for RDEPENDS, so it's not taking affect properly. No one uses oxenstore, so just switch to hardcoding the C version. --- conf/distro/openxt-main.conf | 8 -------- recipes-core/packagegroups/packagegroup-xenclient-dom0.bb | 2 +- recipes-extended/xen/xen-tools-openxt.inc | 3 --- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/conf/distro/openxt-main.conf b/conf/distro/openxt-main.conf index 3ead4296cb..aa217e7429 100644 --- a/conf/distro/openxt-main.conf +++ b/conf/distro/openxt-main.conf @@ -60,14 +60,6 @@ PREFERRED_PROVIDER_virtual/java-native = "jamvm-native" PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native" PREFERRED_PROVIDER_jpeg-native = "jpeg-native" -# Set the preferred version to C xenstored from xen-tools -PREFERRED_PROVIDER_virtual/xenstored = "xen-tools" -PREFERRED_RPROVIDER_virtual/xenstored = "xen-tools-xenstored" - -# The C and OCaml xenstored packages can be installed together -# and this whitelisting is necessary to allow both to be built -MULTI_PROVIDER_WHITELIST += " virtual/xenstored" - # Default to rsyslog recipe which RPROVIDES rsyslog-conf # Dom0 and Installer install rsyslog-conf-dom0 instead. PREFERRED_RPROVIDER_rsyslog-conf = "rsyslog" diff --git a/recipes-core/packagegroups/packagegroup-xenclient-dom0.bb b/recipes-core/packagegroups/packagegroup-xenclient-dom0.bb index d86e8c306c..717e0c664e 100644 --- a/recipes-core/packagegroups/packagegroup-xenclient-dom0.bb +++ b/recipes-core/packagegroups/packagegroup-xenclient-dom0.bb @@ -20,7 +20,7 @@ RDEPENDS_${PN} = " \ xen-tools-libxenstat \ xen-tools-libxlutil \ xen-tools-xenstat \ - virtual/xenstored \ + xen-tools-xenstored \ xen-tools-xl \ xen-xsm-policy \ grub \ diff --git a/recipes-extended/xen/xen-tools-openxt.inc b/recipes-extended/xen/xen-tools-openxt.inc index 8ad2dea03c..f76a3834cb 100644 --- a/recipes-extended/xen/xen-tools-openxt.inc +++ b/recipes-extended/xen/xen-tools-openxt.inc @@ -30,8 +30,6 @@ PACKAGES =+ " \ ${PN}-libxenhypfs-dev \ " -PROVIDES =+ "virtual/xenstored" - # OpenXT uses init scripts rather than systemd FILES_${PN}-console += "${INIT_D_DIR}/xenconsoled" @@ -42,7 +40,6 @@ FILES_${PN}-xenstored = " \ ${sysconfdir}/xen/xenstored.conf \ " RCONFLICTS_${PN}-xenstored = "${PN}-oxenstored" -RPROVIDES_${PN}-xenstored = "virtual/xenstored" FILES_${PN}-oxenstored = " \ ${sbindir}/oxenstored \