Skip to contentSkip to conversation

Xen: python3, wic, 4.12.2, tools separation

PATCH Superseded Christopher Clark 1 participant 23 messages Feb 24, 2020

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Xen: python3, wic, 4.12.2, tools separation

From: Christopher Clark <[email protected]>

Update the Xen recipes for python3 compatibility and separate recipes for the hypervisor, the tools and legacy python2 scripts. Refresh ipxe and seabios.

Changes since v1 of this series:
- use multilib to satisfy the requirement for 32-bit glibc for x86-64 builds with HVM guest support
- update the deploy tasks to ensure that tools are staged prior to deploy of the hypervisor binaries
- add menuconfig instructions to the README
- keep the patch files in a directory named 'files' rather than 'xen-tools' to assist downstream layer support
- improve commenting in .inc files and commit messages

Upgrade Xen to latest point release of the same version and switch to git branch tracking for easier incorporation of security fixes. Multiple recipe fixes.

Separate recipes for the hypervisor and tools enables targetting different architectures and build configurations (ref: multiconfig) and improvements to build efficiency downstream.

Add wic support for building bootable images with Xen and dom0.

Remove the stubs task by satisfying the 32-bit dependencies when necessary using multilib.

This change renames many of the packages produced: most packages that had a "xen-" prefix now have a "xen-tools-" prefix instead, indicating the recipe that now produces them, so dependent recipes will need to update package references:
eg. xen-tools-hvmloader replaces xen-hvmloader
eg. xen-tools replaces xen-base
and recipe DEPENDS statements:
eg. DEPENDS="xen" changes to DEPENDS="xen-tools"
A temporary append is provided for qemu to handle the renaming while its recipe is updated in openembedded-core.

Christopher Clark (22):
seabios: upgrade to version 1.13.0 at official URI and switch to
python3
ipxe: fix build with uprev to the latest git revision linux-yocto/xen.cfg: update Xen KConfig fragment entries
xen: pass compiler flags via Xen-provided variables
xen: upgrade to 4.12.2
wic: add support for bootable pcbios partition with Xen hypervisor
xen: package the EFI hypervisor binary /boot/xen.efi
xen: add RDEPENDS for xen-pygrub and xen-python packages
xen: retire Qemu packaging from the Xen recipe
xen: separate recipes for hypervisor and tools; switch to git as
source
xen-tools: move xentrace_setmask into the xentrace package
xen: add seabios to RRECOMMENDS of xen-tools when HVM-enabled
xen-image-minimal: add kernel-module-tun for HVM guest networking
xen-tools: change globbing to fix syntax highlighting xen, xen-tools: update recipes for python3
xen, xen-tools: separate COMPATIBLE_HOST for hypervisor and tools xen, xen-tools: remove stubs task and use multilib when necessary xen, xen-tools: bug fix to post_patch task
xen: add contact to recipe README file
xen-image-minimal: add a build dependency on the xen hypervisor
xen: add menuconfig instructions to the README
xen, xen-tools: updates to the deploy task

 .gitignore                                    |   1 +
 recipes-devtools/qemu/qemu_%.bbappend         |   1 +
 recipes-extended/images/xen-image-minimal.bb  |  10 +-
 .../files/ipxe-fix-hostcc-nopie-cflags.patch  |  58 +-
 recipes-extended/ipxe/ipxe_git.bb             |   2 +-
 .../seabios/seabios/python3.patch             |  13 +
 .../{seabios_1.11.2.bb => seabios_1.13.0.bb}  |  13 +-
 recipes-extended/xen/README                   |  13 +-
 ...ython-pygrub-pass-DISTUTILS-xen.4.12.patch |   7 +-
 .../files/xen-tools-libxl-gentypes-py3.patch  | 140 +++
 ...tools-pygrub-change-tabs-into-spaces.patch |  40 +
 ...-python-scripts-work-with-2.6-and-up.patch | 529 ++++++++++
 .../xen/files/xen-tools-pygrub-py3.patch      | 233 +++++
 ...ls-python-fix-Wsign-compare-warnings.patch | 136 +++
 ...n-tools-update-python-scripts-to-py3.patch | 140 +++
 recipes-extended/xen/xen-blktap.inc           |  76 ++
 recipes-extended/xen/xen-hypervisor.inc       | 105 ++
 recipes-extended/xen/xen-python2.bb           |  66 ++
 recipes-extended/xen/xen-tools.inc            | 787 ++++++++++++++
 recipes-extended/xen/xen-tools_git.bb         |  24 +
 recipes-extended/xen/xen.inc                  | 970 +-----------------
 recipes-extended/xen/xen_4.12.0.bb            |  12 -
 recipes-extended/xen/xen_git.bb               |  19 +-
 recipes-kernel/linux/linux-yocto/xen.cfg      |   3 +-
 .../lib/wic/plugins/source/bootimg-biosxen.py | 212 ++++
 wic/directdisk-bootloader-xen.cfg             |  17 +
 wic/directdisk-bootloader-xen.wks             |  12 +
 wic/directdisk-xen.wks                        |  10 +
 28 files changed, 2629 insertions(+), 1020 deletions(-)
 create mode 100644 recipes-devtools/qemu/qemu_%.bbappend
 create mode 100644 recipes-extended/seabios/seabios/python3.patch
 rename recipes-extended/seabios/{seabios_1.11.2.bb => seabios_1.13.0.bb} (67%)
 create mode 100644 recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch
 create mode 100644 recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch
 create mode 100644 recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch
 create mode 100644 recipes-extended/xen/files/xen-tools-pygrub-py3.patch
 create mode 100644 recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch
 create mode 100644 recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch
 create mode 100644 recipes-extended/xen/xen-blktap.inc
 create mode 100644 recipes-extended/xen/xen-hypervisor.inc
 create mode 100644 recipes-extended/xen/xen-python2.bb
 create mode 100644 recipes-extended/xen/xen-tools.inc
 create mode 100644 recipes-extended/xen/xen-tools_git.bb
 delete mode 100644 recipes-extended/xen/xen_4.12.0.bb
 create mode 100644 scripts/lib/wic/plugins/source/bootimg-biosxen.py
 create mode 100644 wic/directdisk-bootloader-xen.cfg
 create mode 100644 wic/directdisk-bootloader-xen.wks
 create mode 100644 wic/directdisk-xen.wks
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/22 seabios: upgrade to version 1.13.0 at official URI and switch to python3

From: Christopher Clark <[email protected]>

Use native python3 for the build as python2 no longer available. Official seabios release SRC_URI fixes QA warning about using GitHub archives.

---
 recipes-extended/seabios/seabios/python3.patch      | 13 +++++++++++++
 .../{seabios_1.11.2.bb => seabios_1.13.0.bb}        | 13 ++++++++-----
 2 files changed, 21 insertions(+), 5 deletions(-)
 create mode 100644 recipes-extended/seabios/seabios/python3.patch
 rename recipes-extended/seabios/{seabios_1.11.2.bb => seabios_1.13.0.bb} (67%)
recipes-extended/seabios/seabios/python3.patch new file +13 -0
new file mode 100644
index 0000000..a2786fd
@@ -0,0 +1,13 @@
+diff --git a/Makefile b/Makefile
+index 516cb38..7f6acaa 100644
+--- a/Makefile
++++ b/Makefile
+@@ -22,7 +22,7 @@ LD=$(CROSS_PREFIX)ld
+ OBJCOPY=$(CROSS_PREFIX)objcopy
+ OBJDUMP=$(CROSS_PREFIX)objdump
+ STRIP=$(CROSS_PREFIX)strip
+-PYTHON=python
++PYTHON=python3
+ CPP=$(CROSS_PREFIX)cpp
+ IASL:=iasl
+ LD32BIT_FLAG:=-melf_i386
recipes-extended/seabios/seabios_1.13.0.bb renamed from recipes-extended/seabios/seabios_1.11.2.bb +8 -5
similarity index 67%
rename from recipes-extended/seabios/seabios_1.11.2.bb
rename to recipes-extended/seabios/seabios_1.13.0.bb
index 81eaec9..4cf4420 100644
@@ -3,22 +3,25 @@ HOMEPAGE = "http://www.coreboot.org/SeaBIOS"
 LICENSE = "LGPLv3"
 SECTION = "firmware"
 
+inherit python3native
+
 SRC_URI = " \
-    https://github.com/qemu/seabios/archive/rel-${PV}.tar.gz \
+    https://www.seabios.org/downloads/seabios-${PV}.tar.gz \
     file://hostcc.patch \
+    file://python3.patch \
     "
-S = "${WORKDIR}/${PN}-rel-${PV}"
+S = "${WORKDIR}/${PN}-${PV}"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504         \
                     file://COPYING.LESSER;md5=6a6a8e020838b23406c81b19c1d46df6  \
                     "
 
-SRC_URI[md5sum] = "3f78065837dbd8873513a1b7d5276e78"
-SRC_URI[sha256sum] = "73e73c8e406d97265782f6c942b3c1d178ed4f4afc9f381b22336c3968291693"
+SRC_URI[md5sum] = "1dc1725bac1d230bfd6b3204eed4f2f7"
+SRC_URI[sha256sum] = "37673dc2d6308591b15bdb94e5bcc3e99bdb40198d2247733c43f50b55dbe703"
 
 FILES_${PN} = "/usr/share/firmware"
 
-DEPENDS = "util-linux-native file-native bison-native flex-native gettext-native acpica-native python-native"
+DEPENDS += "util-linux-native file-native bison-native flex-native gettext-native acpica-native"
 
 TUNE_CCARGS = ""
 EXTRA_OEMAKE += "HOSTCC='${BUILD_CC}'"
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/22 ipxe: fix build with uprev to the latest git revision

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

Newer version allows for a simpler version of the cross-compile patch, which is updated in this change.

---
 .../files/ipxe-fix-hostcc-nopie-cflags.patch  | 58 ++-----------------
 recipes-extended/ipxe/ipxe_git.bb             |  2 +-
 2 files changed, 7 insertions(+), 53 deletions(-)
recipes-extended/ipxe/files/ipxe-fix-hostcc-nopie-cflags.patch +6 -52
index da154a6..865e9bb 100644
@@ -1,34 +1,17 @@
-Fix detection of host compiler "no-pie"/"nopie" and link flags.
-
-Detection of the "no-pie" vs "nopie" flag needs to be performed for both
-the host and target compilers; cannot assume that one works for the other.
-
-Use EXTRA_HOST_CFLAGS and EXTRA_HOST_LDFLAGS variables for passing
-host tool parameters if required. Removes previous hardcoded "-O2 -g".
-
-Signed-off-by: Christopher Clark <[email protected]>
-diff --git a/Makefile.housekeeping b/Makefile.housekeeping
-index f833492..5451c39 100644
+diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
+index 1dd1479..13f44dd 100644
 --- a/Makefile.housekeeping
 +++ b/Makefile.housekeeping
-@@ -133,6 +133,7 @@ eval :
- WORKAROUND_CFLAGS :=
- WORKAROUND_ASFLAGS :=
- WORKAROUND_LDFLAGS :=
-+WORKAROUND_HOST_CFLAGS :=
- 
- # Make syntax does not allow use of comma or space in certain places.
- # This ugly workaround is suggested in the manual.
-@@ -445,7 +446,7 @@ endif
+@@ -454,7 +454,7 @@ endif
  CFLAGS		+= $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS)
  ASFLAGS		+= $(WORKAROUND_ASFLAGS) $(EXTRA_ASFLAGS)
  LDFLAGS		+= $(WORKAROUND_LDFLAGS) $(EXTRA_LDFLAGS)
--HOST_CFLAGS	+= $(WORKAROUND_CFLAGS) -O2 -g
-+HOST_CFLAGS	+= $(WORKAROUND_HOST_CFLAGS) $(EXTRA_HOST_CFLAGS)
+-HOST_CFLAGS	+= -O2 -g
++HOST_CFLAGS	+= -O2 -g $(EXTRA_HOST_CFLAGS)
  
  # Inhibit -Werror if NO_WERROR is specified on make command line
  #
-@@ -1375,7 +1376,7 @@ endif # defined(BIN)
+@@ -1379,7 +1379,7 @@ endif # defined(BIN)
  # The compression utilities
  #
  
@@ -37,32 +20,3 @@ index f833492..5451c39 100644
  
  $(ZBIN) : util/zbin.c $(MAKEDEPS)
  	$(QM)$(ECHO) "  [HOSTCC] $@"
-diff --git a/arch/i386/Makefile b/arch/i386/Makefile
-index b7c2792..4a637ad 100644
---- a/arch/i386/Makefile
-+++ b/arch/i386/Makefile
-@@ -78,11 +78,20 @@ CFLAGS			+= -Ui386
- # -nopie.  We therefore test for both.
- #
- ifeq ($(CCTYPE),gcc)
--PIE_TEST = [ -z "`$(CC) -fno-PIE -no-pie -x c -c /dev/null -o /dev/null 2>&1`" ]
--PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE -no-pie')
--PIE_TEST2 = [ -z "`$(CC) -fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1`" ]
-+PIE_TEST1_FLAGS = "-fno-PIE -no-pie -x c -c /dev/null -o /dev/null 2>&1"
-+PIE_TEST2_FLAGS = "-fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1"
-+
-+PIE_TEST1 = [ -z "`$(CC) "$(PIE_TEST1_FLAGS)"`" ]
-+PIE_TEST2 = [ -z "`$(CC) "$(PIE_TEST2_FLAGS)"`" ]
-+PIE_FLAGS1 := $(shell $(PIE_TEST1) && $(ECHO) '-fno-PIE -no-pie')
- PIE_FLAGS2 := $(shell $(PIE_TEST2) && $(ECHO) '-fno-PIE -nopie')
--WORKAROUND_CFLAGS += $(PIE_FLAGS) $(PIE_FLAGS2)
-+WORKAROUND_CFLAGS += $(PIE_FLAGS1) $(PIE_FLAGS2)
-+
-+HOST_PIE_TEST1 = [ -z "`$(HOSTCC) "$(PIE_TEST1_FLAGS)"`" ]
-+HOST_PIE_TEST2 = [ -z "`$(HOSTCC) "$(PIE_TEST2_FLAGS)"`" ]
-+HOST_PIE_FLAGS1 := $(shell $(HOST_PIE_TEST1) && $(ECHO) '-fno-PIE -no-pie')
-+HOST_PIE_FLAGS2 := $(shell $(HOST_PIE_TEST2) && $(ECHO) '-fno-PIE -nopie')
-+WORKAROUND_HOST_CFLAGS += $(HOST_PIE_FLAGS1) $(HOST_PIE_FLAGS2)
- endif
- 
- # i386-specific directories containing source files
recipes-extended/ipxe/ipxe_git.bb +1 -1
index 1de0f21..47c5b7a 100644
@@ -4,7 +4,7 @@ LICENSE = "GPLv2"
 DEPENDS = "binutils-native perl-native syslinux mtools-native cdrtools-native xz"
 LIC_FILES_CHKSUM = "file://../COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
-SRCREV = "64b4452bca04af433f1c98ab782c0e93cd5c88c0"
+SRCREV = "18dc73d27edb55ebe9cb13c58d59af3da3bd374b"
 PV = "gitr${SRCPV}"
 PR = "r0"
 
Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 3/22 linux-yocto/xen.cfg: update Xen KConfig fragment entries

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

CONFIG_XEN_MAX_DOMAIN_MEMORY has been retired since kernel commit:
197ecb3802c04499d8ff4f8cb28f6efa008067db
xen/balloon: add runtime control for scrubbing ballooned out pages

CONFIG_XEN_SCRUB_PAGES has been replaced with CONFIG_XEN_SCRUB_PAGES_DEFAULT since kernel commit: c70727a5bc18a5a233fddc6056d1de9144d7a293
xen: allow more than 512 GB of RAM for 64 bit pv-domains

---
 recipes-kernel/linux/linux-yocto/xen.cfg | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
recipes-kernel/linux/linux-yocto/xen.cfg +1 -2
index 4780311..af821d2 100644
@@ -3,7 +3,6 @@ CONFIG_PARAVIRT=y
 CONFIG_XEN=y
 CONFIG_XEN_DOM0=y
 CONFIG_XEN_PVHVM=y
-CONFIG_XEN_MAX_DOMAIN_MEMORY=500
 CONFIG_XEN_SAVE_RESTORE=y
 # CONFIG_XEN_DEBUG_FS is not set
 CONFIG_XEN_PVH=y
@@ -30,7 +29,7 @@ CONFIG_FB_SYS_FOPS=y
 CONFIG_FB_DEFERRED_IO=y
 CONFIG_XEN_FBDEV_FRONTEND=y
 CONFIG_XEN_BALLOON=y
-CONFIG_XEN_SCRUB_PAGES=y
+CONFIG_XEN_SCRUB_PAGES_DEFAULT=y
 CONFIG_XEN_DEV_EVTCHN=y
 CONFIG_XEN_BACKEND=y
 CONFIG_XENFS=y
Signature · 1 line
2.17.1
#4 lore raw

PATCH v2 4/22 xen: pass compiler flags via Xen-provided variables

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

Fix the method of passing compiler flags into the Xen build, which is needed to fix compilation of hvmloader, a 32-bit firmware binary that is required for Xen to be able to run HVM-mode guest VMs. It must not be compiled with SSE compiler options enabled, so the Xen build clears CFLAGS, which is a problem with _FORTIFY_SOURCE present in CC because it must be paired with a compiler optimization flag that was in CFLAGS. This change fixes the compilation failure that stated
"_FORTIFY_SOURCE requires compiling with optimization (-O)".

32-bit ARM needs the TUNE_CCARGS to be retained as passed via CC to ensure that configure is able to generate binaries for the correct ABI, so is handled as a separate case.

---
 recipes-extended/xen/xen.inc | 35 +++++++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 10 deletions(-)
recipes-extended/xen/xen.inc +25 -10
index 36ab78e..4ac954e 100644
@@ -867,15 +867,27 @@ export CROSS_COMPILE="${TARGET_PREFIX}"
 # overide LDFLAGS to allow xen to build without: "x86_64-oe-linux-ld: unrecognized option '-Wl,-O1'"
 export LDFLAGS=""
 
-# Yocto injects -mfpmath=sse for some machine types into the CFLAGS which
-# conflicts with -mno-sse so instead we strip -mfpmath=sse instead of
-# patching the build to be ok with this
-TUNE_CCARGS := "${@oe.utils.str_filter_out('-mfpmath=sse', '${TUNE_CCARGS}', d)}"
-TUNE_CCARGS := "${@oe.utils.str_filter_out('-msse4.2', '${TUNE_CCARGS}', d)}"
-
-# Supply the full set of compiler flags via the tool variables
-# Yocto supplys _FORTIFY_SOURCE via CC/CPP/CXX but optimization -O via C*FLAGS
-CC_append = " ${CFLAGS}"
+# Pass through the Yocto distro compiler flags via the Xen-provided variables.
+# Special handling:
+# - Yocto supplies the _FORTIFY_SOURCE flag via CC/CPP/CXX but then passes the
+#   optimization -O via C*FLAGS which is problematic when the CFLAGS are cleared
+#   within the build because compilation fails with the compiler stating
+#   "_FORTIFY_SOURCE requires compiling with optimization (-O)".
+# - Move HOST_CC_ARCH into the Xen-provided CFLAGS variables and keep
+#   TOOLCHAIN_OPTIONS set via CC: this enables hvmloader to be built correctly.
+#   It must not be compiled with SSE compiler options enabled and the Xen build
+#   explicitly clears CFLAGS to ensure that, so such options must not be passed
+#   in via the tool variable. hvmloader is required to run HVM-mode guest VMs.
+CC="${CCACHE}${HOST_PREFIX}gcc ${TOOLCHAIN_OPTIONS}"
+EXTRA_CFLAGS_XEN_CORE="${HOST_CC_ARCH} ${CFLAGS}"
+EXTRA_CFLAGS_XEN_TOOLS="${HOST_CC_ARCH} ${CFLAGS}"
+# 32-bit ARM needs the TUNE_CCARGS component of HOST_CC_ARCH to be passed
+# in CC to ensure that configure can compile binaries for the right arch.
+CC_arm="${CCACHE}${HOST_PREFIX}gcc ${TUNE_CCARGS} ${TOOLCHAIN_OPTIONS}"
+EXTRA_CFLAGS_XEN_CORE_arm="${SECURITY_CFLAGS} ${CFLAGS}"
+EXTRA_CFLAGS_XEN_TOOLS_arm="${SECURITY_CFLAGS} ${CFLAGS}"
+
+# There are no Xen-provided variables for C++, so append to the tool variables:
 CPP_append = " ${CPPFLAGS}"
 CXX_append = " ${CXXFLAGS}"
 
@@ -996,8 +1008,11 @@ do_configure() {
         bbfatal "Unable to copy defconfig to .config"
     fi
 
+    unset CFLAGS
+
     # do configure
-    oe_runconf
+    oe_runconf EXTRA_CFLAGS_XEN_CORE="${EXTRA_CFLAGS_XEN_CORE}" \
+               EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}"
     if [ ! -e ${STAGING_INCDIR}/bits/long-double-32.h ]; then
         cp ${STAGING_INCDIR}/bits/long-double-64.h ${STAGING_INCDIR}/bits/long-double-32.h
     fi
Signature · 1 line
2.17.1
#5 lore raw

PATCH v2 5/22 xen: upgrade to 4.12.2

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

Fixes the build failure with 4.12.0 seen with the newer OE compiler.

---
 recipes-extended/xen/{xen_4.12.0.bb => xen_4.12.2.bb} | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename recipes-extended/xen/{xen_4.12.0.bb => xen_4.12.2.bb} (63%)
recipes-extended/xen/xen_4.12.2.bb renamed from recipes-extended/xen/xen_4.12.0.bb +2 -2
similarity index 63%
rename from recipes-extended/xen/xen_4.12.0.bb
rename to recipes-extended/xen/xen_4.12.2.bb
index 246be7a..affeb4a 100644
@@ -6,7 +6,7 @@ SRC_URI = " \
     file://0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch \
     "
 
-SRC_URI[md5sum] = "7d24d4541e3025421e02384cabc3528b"
-SRC_URI[sha256sum] = "6e5455e4a58dcb2339bfcd2a89842728068b530aa62501843793f7cf743c4d64"
+SRC_URI[md5sum] = "57084e3f55bbec063d38b464e1b7e4f2"
+SRC_URI[sha256sum] = "1c75cbe728dfabf02b7f9a17ce96ee7d202d2fd4b4689490018d3a28b63f9fa3"
 
 S = "${WORKDIR}/xen-${PV}"
Signature · 1 line
2.17.1
#6 lore raw

PATCH v2 6/22 wic: add support for bootable pcbios partition with Xen hypervisor

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

New bootimg-biosxen wic plugin to populate a boot partition for launching Xen and dom0.

Includes example kickstart wks files to generate disk images to boot into Xen from PC BIOS.

eg: wic create directdisk-xen -e xen-image-minimal

and write the resulting image file to a disk for boot.

---
 .gitignore                                    |   1 +
 .../lib/wic/plugins/source/bootimg-biosxen.py | 212 ++++++++++++++++++
 wic/directdisk-bootloader-xen.cfg             |  17 ++
 wic/directdisk-bootloader-xen.wks             |  12 +
 wic/directdisk-xen.wks                        |  10 +
 5 files changed, 252 insertions(+)
 create mode 100644 scripts/lib/wic/plugins/source/bootimg-biosxen.py
 create mode 100644 wic/directdisk-bootloader-xen.cfg
 create mode 100644 wic/directdisk-bootloader-xen.wks
 create mode 100644 wic/directdisk-xen.wks
.gitignore +1 -0
index 45b1106..357aefe 100644
@@ -5,3 +5,4 @@ pyshtables.py
 *.rej
 /*.patch
 *~
+scripts/lib/wic/plugins/source/__pycache__
scripts/lib/wic/plugins/source/bootimg-biosxen.py new file +212 -0

212 lines not on this page · raw message

wic/directdisk-bootloader-xen.cfg new file +17 -0
new file mode 100644
index 0000000..3ad76d6
@@ -0,0 +1,17 @@
+ALLOWOPTIONS 1
+DEFAULT boot
+TIMEOUT 10
+PROMPT 1
+SERIAL 0 115200
+
+UI vesamenu.c32
+menu title Select boot options
+menu tabmsg Press [Tab] to edit, [Return] to select
+
+LABEL boot
+  KERNEL mboot.c32
+  APPEND /xen.gz console=com1,vga com1=115200,8n1 --- /vmlinuz quiet console=hvc0 root=LABEL=root rw rootwait panic=10
+
+LABEL verbose
+  KERNEL mboot.c32
+  APPEND /xen.gz console=com1,vga com1=115200,8n1 loglvl=all guest_loglvl=all --- /vmlinuz quiet console=hvc0 earlyprintk=xen root=LABEL=root rw rootwait panic=10
wic/directdisk-bootloader-xen.wks new file +12 -0
new file mode 100644
index 0000000..c34120a
@@ -0,0 +1,12 @@
+# short-description: Create a 'pcbios' direct disk image with Xen hypervisor and bootloader config
+# long-description: Creates a partitioned legacy BIOS disk image to boot Xen
+# with a bootloader config that the user can directly dd to boot media.
+# Boot files are located on the first vfat partition.
+
+part /boot --source bootimg-biosxen --ondisk sda --label boot --active --align 1024
+
+# For the main partition, it can be useful to add additional space for VMs;
+# eg. increase partition size by appending: --size 10G
+part / --source rootfs --ondisk sda --use-uuid --fstype=ext4 --label root --align 1024
+
+bootloader --configfile="directdisk-bootloader-xen.cfg"
wic/directdisk-xen.wks new file +10 -0
new file mode 100644
index 0000000..d6ca46a
@@ -0,0 +1,10 @@
+# short-description: Create a 'pcbios' direct disk image with Xen hypervisor
+# long-description: Creates a partitioned legacy BIOS disk image to boot Xen
+# that the user can directly dd to boot media. Boot files are located on the
+# first vfat partition.
+
+part /boot --source bootimg-biosxen --ondisk sda --label boot --active --align 1024
+
+# For the main partition, it can be useful to add additional space for VMs:
+# eg. increase partition size by appending: --size 10G
+part / --source rootfs --ondisk sda --use-uuid --fstype=ext4 --label root --align 1024
Signature · 1 line
2.17.1
#7 lore raw

PATCH v2 7/22 xen: package the EFI hypervisor binary /boot/xen.efi

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

---
 recipes-extended/xen/xen.inc | 1 +
 1 file changed, 1 insertion(+)
recipes-extended/xen/xen.inc +1 -0
index 4ac954e..380b193 100644
@@ -429,6 +429,7 @@ FILES_${PN}-hypervisor = "\
 FILES_${PN}-init-xenstore-dom = "${libdir}/xen/bin/init-xenstore-domain"
 
 FILES_${PN}-efi = "\
+    /boot/xen.efi \
     ${exec_prefix}/lib64/efi/xen* \
     "
 
Signature · 1 line
2.17.1
#8 lore raw

PATCH v2 8/22 xen: add RDEPENDS for xen-pygrub and xen-python packages

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

---
 recipes-extended/xen/xen.inc | 8 ++++++++
 1 file changed, 8 insertions(+)
recipes-extended/xen/xen.inc +8 -0
index 380b193..7b1397f 100644
@@ -108,6 +108,14 @@ RDEPENDS_${PN}-misc = " \
     python \
     "
 
+RDEPENDS_${PN}-python = " \
+    python \
+    "
+
+RDEPENDS_${PN}-pygrub = " \
+    ${PN}-python \
+    "
+
 RDEPENDS_${PN}-remus = " \
     bash \
     python \
Signature · 1 line
2.17.1
#9 lore raw

PATCH v2 9/22 xen: retire Qemu packaging from the Xen recipe

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

Modern Qemu supports Xen and the qemu binary to be used with Xen should be built with the Qemu recipe.

---
 recipes-extended/xen/xen.inc | 87 ------------------------------------
 1 file changed, 87 deletions(-)
recipes-extended/xen/xen.inc +0 -87
index 7b1397f..2aed677 100644
@@ -217,7 +217,6 @@ PACKAGES = "\
     ${PN}-misc \
     ${PN}-pygrub \
     ${PN}-python \
-    ${PN}-qemu \
     ${PN}-remus \
     ${PN}-scripts-block \
     ${PN}-scripts-common \
@@ -546,92 +545,6 @@ FILES_${PN}-python = "\
     "
 
 INSANE_SKIP_${PN} = "already-stripped"
-INSANE_SKIP_${PN}-qemu = "arch"
-FILES_${PN}-qemu = " \
-    ${datadir}/xen/qemu \
-    ${libdir}/xen/bin/qemu-system-i386 \
-    ${libdir}/xen/bin/qemu-system-x86_64 \
-    ${libdir}/xen/bin/qemu-img \
-    ${libdir}/xen/bin/qemu-nbd \
-    ${libdir}/xen/bin/qemu-ga \
-    ${libdir}/xen/bin/qemu-io \
-    ${libdir}/xen/bin/qemu-dm \
-    ${libdir}/xen/bin/virtfs-proxy-helper \
-    /usr/libexec/qemu-bridge-helper \
-    ${libdir}/xen/libexec/qemu-bridge-helper \
-    /usr/etc/qemu \
-    /usr/etc/qemu/target-x86_64.conf \
-    ${libdir}/xen/etc/qemu/target-x86_64.conf \
-    ${datadir}/qemu-xen \
-    ${datadir}/qemu-xen/qemu \
-    ${datadir}/qemu-xen/qemu/bamboo.dtb \
-    ${datadir}/qemu-xen/qemu/pxe-pcnet.rom \
-    ${datadir}/qemu-xen/qemu/vgabios-vmware.bin \
-    ${datadir}/qemu-xen/qemu/pxe-eepro100.rom \
-    ${datadir}/qemu-xen/qemu/pxe-e1000.rom \
-    ${datadir}/qemu-xen/qemu/openbios-ppc \
-    ${datadir}/qemu-xen/qemu/multiboot.bin \
-    ${datadir}/qemu-xen/qemu/vgabios-cirrus.bin \
-    ${datadir}/qemu-xen/qemu/bios.bin \
-    ${datadir}/qemu-xen/qemu/vgabios-stdvga.bin \
-    ${datadir}/qemu-xen/qemu/palcode-clipper \
-    ${datadir}/qemu-xen/qemu/pxe-ne2k_pci.rom \
-    ${datadir}/qemu-xen/qemu/spapr-rtas.bin \
-    ${datadir}/qemu-xen/qemu/slof.bin \
-    ${datadir}/qemu-xen/qemu/vgabios-qxl.bin \
-    ${datadir}/qemu-xen/qemu/pxe-rtl8139.rom \
-    ${datadir}/qemu-xen/qemu/openbios-sparc64 \
-    ${datadir}/qemu-xen/qemu/pxe-virtio.rom \
-    ${datadir}/qemu-xen/qemu/kvmvapic.bin \
-    ${datadir}/qemu-xen/qemu/openbios-sparc32 \
-    ${datadir}/qemu-xen/qemu/petalogix-s3adsp1800.dtb \
-    ${datadir}/qemu-xen/qemu/sgabios.bin \
-    ${datadir}/qemu-xen/qemu/linuxboot.bin \
-    ${datadir}/qemu-xen/qemu/qemu-icon.bmp \
-    ${datadir}/qemu-xen/qemu/ppc_rom.bin \
-    ${datadir}/qemu-xen/qemu/vgabios.bin \
-    ${datadir}/qemu-xen/qemu/s390-zipl.rom \
-    ${datadir}/qemu-xen/qemu/petalogix-ml605.dtb \
-    ${datadir}/qemu-xen/qemu/keymaps \
-    ${datadir}/qemu-xen/qemu/keymaps/common \
-    ${datadir}/qemu-xen/qemu/keymaps/th \
-    ${datadir}/qemu-xen/qemu/keymaps/is \
-    ${datadir}/qemu-xen/qemu/keymaps/en-gb \
-    ${datadir}/qemu-xen/qemu/keymaps/ar \
-    ${datadir}/qemu-xen/qemu/keymaps/fr-be \
-    ${datadir}/qemu-xen/qemu/keymaps/ru \
-    ${datadir}/qemu-xen/qemu/keymaps/hu \
-    ${datadir}/qemu-xen/qemu/keymaps/de-ch \
-    ${datadir}/qemu-xen/qemu/keymaps/no \
-    ${datadir}/qemu-xen/qemu/keymaps/fr \
-    ${datadir}/qemu-xen/qemu/keymaps/pl \
-    ${datadir}/qemu-xen/qemu/keymaps/fr-ca \
-    ${datadir}/qemu-xen/qemu/keymaps/de \
-    ${datadir}/qemu-xen/qemu/keymaps/fr-ch \
-    ${datadir}/qemu-xen/qemu/keymaps/bepo \
-    ${datadir}/qemu-xen/qemu/keymaps/lv \
-    ${datadir}/qemu-xen/qemu/keymaps/ja \
-    ${datadir}/qemu-xen/qemu/keymaps/da \
-    ${datadir}/qemu-xen/qemu/keymaps/lt \
-    ${datadir}/qemu-xen/qemu/keymaps/hr \
-    ${datadir}/qemu-xen/qemu/keymaps/es \
-    ${datadir}/qemu-xen/qemu/keymaps/modifiers \
-    ${datadir}/qemu-xen/qemu/keymaps/sl \
-    ${datadir}/qemu-xen/qemu/keymaps/it \
-    ${datadir}/qemu-xen/qemu/keymaps/nl \
-    ${datadir}/qemu-xen/qemu/keymaps/fo \
-    ${datadir}/qemu-xen/qemu/keymaps/mk \
-    ${datadir}/qemu-xen/qemu/keymaps/pt-br \
-    ${datadir}/qemu-xen/qemu/keymaps/tr \
-    ${datadir}/qemu-xen/qemu/keymaps/sv \
-    ${datadir}/qemu-xen/qemu/keymaps/fi \
-    ${datadir}/qemu-xen/qemu/keymaps/en-us \
-    ${datadir}/qemu-xen/qemu/keymaps/et \
-    ${datadir}/qemu-xen/qemu/keymaps/nl-be \
-    ${datadir}/qemu-xen/qemu/keymaps/pt \
-    ${bindir}/qemu-nbd-xen \
-    ${bindir}/qemu-img-xen \
-    "
 
 FILES_${PN}-remus = "\
     ${bindir}/remus \
Signature · 1 line
2.17.1
#11 lore raw

PATCH v2 11/22 xen-tools: move xentrace_setmask into the xentrace package

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

---
 recipes-extended/xen/xen-tools.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-extended/xen/xen-tools.inc +1 -1
index f37968b..e012020 100644
@@ -544,6 +544,7 @@ FILES_${PN}-xentrace = "\
     ${bindir}/xenalyze \
     ${sbindir}/xentrace \
     ${sbindir}/xentrace_setsize \
+    ${sbindir}/xentrace_setmask \
     "
 
 FILES_${PN}-xen-watchdog = "\
@@ -578,7 +579,6 @@ FILES_${PN}-xm-examples = "\
 
 FILES_${PN}-xenmon = "\
     ${sbindir}/xenbaked \
-    ${sbindir}/xentrace_setmask \
     ${sbindir}/xenmon.py \
     ${sbindir}/xenmon \
     "
Signature · 1 line
2.17.1
#12 lore raw

PATCH v2 12/22 xen: add seabios to RRECOMMENDS of xen-tools when HVM-enabled

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

Launching HVM guest VMs requires a BIOS firmware binary.

---
 recipes-extended/xen/xen-tools.inc | 1 +
 1 file changed, 1 insertion(+)
recipes-extended/xen/xen-tools.inc +1 -0
index e012020..5b0a339 100644
@@ -29,6 +29,7 @@ RDEPENDS_${PN} = "\
 RDEPENDS_${PN}-dev = ""
 
 RRECOMMENDS_${PN} = " \
+    ${@bb.utils.contains('PACKAGECONFIG', 'hvm', 'seabios', '', d)} \
     ${@bb.utils.contains('PACKAGECONFIG', 'externalblktap', '', '${BLKTAP_RRECOMMENDS}', d)} \
     ${PN}-flask \
     ${PN}-hvmloader \
Signature · 1 line
2.17.1
#13 lore raw

PATCH v2 13/22 xen-image-minimal: add kernel-module-tun for HVM guest networking

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

Xen HVM guests are only on x86 platforms so add the module via overrides.

---
 recipes-extended/images/xen-image-minimal.bb | 4 ++++
 1 file changed, 4 insertions(+)
recipes-extended/images/xen-image-minimal.bb +4 -0
index 63a1086..c98314e 100644
@@ -16,6 +16,10 @@ IMAGE_INSTALL += " \
     qemu \
     "
 
+# Networking for HVM-mode guests (x86/64 only) requires the tun kernel module
+IMAGE_INSTALL_append_x86    = "kernel-module-tun"
+IMAGE_INSTALL_append_x86-64 = "kernel-module-tun"
+
 # Linux kernel option CONFIG_XEN_PCIDEV_BACKEND depends on X86
 XEN_PCIBACK_MODULE = ""
 XEN_PCIBACK_MODULE_x86    = "kernel-module-xen-pciback"
Signature · 1 line
2.17.1
#10 lore raw

PATCH v2 10/22 xen: separate recipes for hypervisor and tools; switch to git as source

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

This change changes the names of many packages produced: the xen-tools recipe now builds packages previous built by the xen recipe, so the package prefix changes from "xen-" to "xen-tools-". A temporary bbappend is provided for qemu to ease the transition.

Multiple motivations for recipe separation:
- improves efficiency of incremental build and development
- supports building the hypervisor and tools with different toolchains and for different architectures

Switch to using a git recipe on the Xen stable branch:
- enables easier tracking of critical XSA security updates applied upstream by just advancing SRCREV along the branch
Revision has been set to the tip of the stable-4.12 branch, which has the one XSA-312 patch applied on top of RELEASE-4.12.2.

The recipe refactor externalizes the block tap components, to enable optional building of blktap in a separate recipe outside xen-tools, needed by OpenXT.

xenstored is made a virtual package to support switching between alternative implementations (several exist).

Update xen-image-minimal to install the xen-tools package, which replaces what was previously xen-base.

Determine the flask policy filename, which is Xen-version specific, using the same method as the Xen build system.

qemu: update PACKAGECONFIG[xen] for xen package renaming: allows builds to continue correctly in the meantime while openembedded core and poky are updated.

OpenXT ticket reference: OXT-1694

---
 recipes-devtools/qemu/qemu_%.bbappend        |   1 +
 recipes-extended/images/xen-image-minimal.bb |   2 +-
 recipes-extended/xen/xen-blktap.inc          |  76 ++
 recipes-extended/xen/xen-hypervisor.inc      |  94 +++
 recipes-extended/xen/xen-tools.inc           | 743 ++++++++++++++++
 recipes-extended/xen/xen-tools_git.bb        |  18 +
 recipes-extended/xen/xen.inc                 | 842 +------------------
 recipes-extended/xen/xen_4.12.2.bb           |  12 -
 recipes-extended/xen/xen_git.bb              |  19 +-
 9 files changed, 946 insertions(+), 861 deletions(-)
 create mode 100644 recipes-devtools/qemu/qemu_%.bbappend
 create mode 100644 recipes-extended/xen/xen-blktap.inc
 create mode 100644 recipes-extended/xen/xen-hypervisor.inc
 create mode 100644 recipes-extended/xen/xen-tools.inc
 create mode 100644 recipes-extended/xen/xen-tools_git.bb
 delete mode 100644 recipes-extended/xen/xen_4.12.2.bb
recipes-devtools/qemu/qemu_%.bbappend new file +1 -0
new file mode 100644
index 0000000..150f92b
@@ -0,0 +1 @@
+PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen-tools,xen-tools-libxenstore xen-tools-libxenctrl xen-tools-libxenguest"
recipes-extended/images/xen-image-minimal.bb +1 -1
index c39d378..63a1086 100644
@@ -12,7 +12,7 @@ IMAGE_INSTALL += " \
     kernel-module-xen-netback \
     ${@bb.utils.contains('MACHINE_FEATURES', 'pci', "${XEN_PCIBACK_MODULE}", '', d)} \
     kernel-module-xen-wdt \
-    xen-base \
+    xen-tools \
     qemu \
     "
 
recipes-extended/xen/xen-blktap.inc new file +76 -0

76 lines not on this page · raw message

recipes-extended/xen/xen-hypervisor.inc new file +94 -0

94 lines not on this page · raw message

recipes-extended/xen/xen-tools.inc new file +743 -0

743 lines not on this page · raw message

recipes-extended/xen/xen-tools_git.bb new file +18 -0
new file mode 100644
index 0000000..7042c53
@@ -0,0 +1,18 @@
+SRCREV ?= "a5fcafbfbee55261853fba07149c1c795f2baf58"
+
+XEN_REL ?= "4.12"
+XEN_BRANCH ?= "stable-${XEN_REL}"
+
+SRC_URI = " \
+    git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
+    file://0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch \
+    "
+
+LIC_FILES_CHKSUM ?= "file://COPYING;md5=bbb4b1bdc2c3b6743da3c39d03249095"
+
+PV = "${XEN_REL}+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+require xen.inc
+require xen-tools.inc
recipes-extended/xen/xen.inc +5 -837

891 lines not on this page · raw message

recipes-extended/xen/xen_4.12.2.bb deleted +0 -12
deleted file mode 100644
index affeb4a..0000000
@@ -1,12 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
-require xen.inc
-
-SRC_URI = " \
-    https://downloads.xenproject.org/release/xen/${PV}/xen-${PV}.tar.gz \
-    file://0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch \
-    "
-
-SRC_URI[md5sum] = "57084e3f55bbec063d38b464e1b7e4f2"
-SRC_URI[sha256sum] = "1c75cbe728dfabf02b7f9a17ce96ee7d202d2fd4b4689490018d3a28b63f9fa3"
-
-S = "${WORKDIR}/xen-${PV}"
recipes-extended/xen/xen_git.bb +8 -11
index 5f950e6..a7475ac 100644
@@ -1,18 +1,15 @@
-require xen.inc
+SRCREV ?= "a5fcafbfbee55261853fba07149c1c795f2baf58"
+
+XEN_REL ?= "4.12"
+XEN_BRANCH ?= "stable-${XEN_REL}"
 
-SRCREV ?= "cb70a26f78848fe45f593f7ebc9cfaac760a791b"
+SRC_URI = "git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH}"
 
-XEN_REL = "4.13"
-XEN_BRANCH = "staging"
-FLASK_POLICY_FILE = "xenpolicy-${XEN_REL}-unstable"
+LIC_FILES_CHKSUM ?= "file://COPYING;md5=bbb4b1bdc2c3b6743da3c39d03249095"
 
 PV = "${XEN_REL}+git${SRCPV}"
 
 S = "${WORKDIR}/git"
 
-SRC_URI = " \
-    git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
-    file://0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch \
-    "
-
-DEFAULT_PREFERENCE = "-1"
+require xen.inc
+require xen-hypervisor.inc
Signature · 1 line
2.17.1
#14 lore raw

PATCH v2 14/22 xen-tools: change globbing to fix syntax highlighting

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

A text editor can interpret /* as the beginning of a comment and then fail to find the matching */ it expects as a terminator. This causes it to mishighlight the rest of the file. Avoid this by using a different matching pattern.

Fixes an annoyance when editing the file. No functional change intended.

---
 recipes-extended/xen/xen-tools.inc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
recipes-extended/xen/xen-tools.inc +3 -3
index 5b0a339..e166c74 100644
@@ -197,7 +197,7 @@ FILES_${PN}-dbg += "\
     ${libdir}/fs/zfs/.debug \
     ${libdir}/fs/reiserfs/.debug \
     ${libdir}/fs/iso9660/.debug \
-    ${libdir}/fs/*/.debug \
+    ${libdir}/fs/**/.debug \
     ${sbindir}/.debug \
     ${libdir}exec/.debug \
     ${libdir}/xen/libexec/.debug \
@@ -346,8 +346,8 @@ FILES_${PN}-libfsimage-dev = " \
     "
 
 FILES_${PN}-fsimage = " \
-    ${libdir}/fs/*/*fsimage.so \
-    ${libdir}/xenfsimage/*/fsimage.so \
+    ${libdir}/fs/**/[a-z]*fsimage.so \
+    ${libdir}/xenfsimage/**/fsimage.so \
     "
 
 FILES_${PN}-init-xenstore-dom = "${libdir}/xen/bin/init-xenstore-domain"
Signature · 1 line
2.17.1
#16 lore raw

PATCH v2 16/22 xen, xen-tools: separate COMPATIBLE_HOST for hypervisor and tools

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

The tools have broader platform compatibility than the hypervisor.

---
 recipes-extended/xen/xen-hypervisor.inc | 3 +++
 recipes-extended/xen/xen-tools.inc      | 2 ++
 recipes-extended/xen/xen.inc            | 2 --
 3 files changed, 5 insertions(+), 2 deletions(-)
recipes-extended/xen/xen-hypervisor.inc +3 -0
index 79fafd2..41de9b6 100644
@@ -6,6 +6,9 @@ DESCRIPTION = "The Xen hypervisor"
 # this allows for varying the target architecture or toolchain used
 # to build the different components. eg. 32-bit tools and a 64-bit hypervisor.
 
+# The Xen hypervisor has a narrower compatible platform range than the Xen tools
+COMPATIBLE_HOST = '(x86_64.*).*-linux|aarch64.*-linux|arm-.*-linux-gnueabi'
+
 inherit deploy python3native
 
 PACKAGES = " \
recipes-extended/xen/xen-tools.inc +2 -0
index a6f1209..00843ca 100644
@@ -1,6 +1,8 @@
 SUMMARY = "Xen hypervisor tools"
 DESCRIPTION = "Tools and utility software for the Xen hypervisor"
 
+COMPATIBLE_HOST = 'i686-oe-linux|(x86_64.*).*-linux|aarch64.*-linux|arm-.*-linux-gnueabi'
+
 inherit setuptools3 update-rc.d systemd deploy
 require xen-blktap.inc
 
recipes-extended/xen/xen.inc +0 -2
index 0bfe72d..1ac131e 100644
@@ -2,8 +2,6 @@ HOMEPAGE = "http://xen.org"
 LICENSE = "GPLv2"
 SECTION = "console/tools"
 
-COMPATIBLE_HOST = '(x86_64.*).*-linux|aarch64.*-linux|arm-.*-linux-gnueabi'
-
 inherit autotools-brokensep
 
 require xen-arch.inc
Signature · 1 line
2.17.1
#17 lore raw

PATCH v2 17/22 xen, xen-tools: remove stubs task and use multilib when necessary

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

The stubs task was MACHINE-specific due to the OE variables it accessed which had forced unnecessary rebuild work in OpenXT's multi-MACHINE builds.

The stubs task was generating a 32-bit header file to satisfy the Xen tools firmware build to generate the hvmloader binary, which is only needed on x86-64 targets where HVM-mode guests are enabled.

Remove this header file generation logic and similar in the configure task, and in the cases where hvmloader is to be built use multilib to provide a 32-bit sysroot and allow the build to obtain the needed 32-bit materials from their source: glibc.

Building Xen tools for x86-64 with HVM-guest support enabled now requires the following to be added to a build conf file (eg. distro.conf, or local.conf) :

require conf/multilib.conf
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "x86"

---
 recipes-extended/xen/xen-tools.inc | 48 ++++++++++++++++++++++--------
 recipes-extended/xen/xen.inc       |  4 ---
 2 files changed, 35 insertions(+), 17 deletions(-)
recipes-extended/xen/xen-tools.inc +35 -13
index 00843ca..864c40c 100644
@@ -6,6 +6,29 @@ COMPATIBLE_HOST = 'i686-oe-linux|(x86_64.*).*-linux|aarch64.*-linux|arm-.*-linux
 inherit setuptools3 update-rc.d systemd deploy
 require xen-blktap.inc
 
+# To build hvmloader, which is needed on x86-64 targets when 'hvm' is enabled
+# in PACKAGECONFIG, to support running HVM-mode guest VMs, some files from
+# 32-bit glibc are needed.
+# Add the multilib 32-bit glibc to DEPENDS only when necessary.
+#
+# To enable multilib, please add the following to your local.conf -:
+#
+#    require conf/multilib.conf
+#    MULTILIBS = "multilib:lib32"
+#    DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
+
+# Use this multilib prefix for x86 32-bit to match local.conf:
+MLPREFIX32 = "lib32-"
+
+# The DEPENDS on a multilib 32-bit glibc is only added when target is x86-64
+# and 'hvm' is enabled in PACKAGECONFIG.
+# This x86-64 override is never intended for native use, so clear that.
+GLIBC32 = ""
+GLIBC32_x86-64 = \
+    "${@bb.utils.contains('PACKAGECONFIG', 'hvm', '${MLPREFIX32}glibc', '', d)}"
+GLIBC32_class-native = ""
+DEPENDS += "${GLIBC32}"
+
 RDEPENDS_${PN} = "\
     bash perl xz \
     ${PN}-console \
@@ -656,25 +679,24 @@ SYSTEMD_SERVICE_${PN}-xencommons = " \
     "
 SYSTEMD_SERVICE_${PN}-xendomains = "xendomains.service"
 
+# To build hvmloader, which is needed on x86-64 targets when 'hvm' is enabled
+# in PACKAGECONFIG, additional CFLAGS are needed to set the 32-bit sysroot.
+RECIPE_SYSROOT32 = "${WORKDIR}/${MLPREFIX32}recipe-sysroot"
+ADD_SYSROOT32_CFLAGS = ""
+ADD_SYSROOT32_CFLAGS_x86-64 = \
+    "${@bb.utils.contains('PACKAGECONFIG', 'hvm', \
+        'CFLAGS += "--sysroot=${RECIPE_SYSROOT32}"', '', d)}"
+# This x86-64 override is never intended for native use, so clear that.
+ADD_SYSROOT32_CFLAGS_class-native = ""
+
 do_configure() {
     do_configure_common
-}
 
-do_stubs() {
-    # no stubs-32.h in our 64-bit sysroot - hack it into tools/include/gnu
-    if ! test -f ${STAGING_DIR_TARGET}/usr/include/gnu/stubs-32.h ; then
-        if test -f ${STAGING_DIR_TARGET}/usr/include/gnu/stubs-64.h ; then
-            test -d ${S}/tools/include/gnu || mkdir ${S}/tools/include/gnu
-            cat ${STAGING_DIR_TARGET}/usr/include/gnu/stubs-64.h | grep -v stub_bdflush | grep -v stub_getmsg | grep -v stub_putmsg > ${S}/tools/include/gnu/stubs-32.h
-            echo \#define __stub___kernel_cosl >> ${S}/tools/include/gnu/stubs-32.h
-            echo \#define __stub___kernel_sinl >> ${S}/tools/include/gnu/stubs-32.h
-            echo \#define __stub___kernel_tanl >> ${S}/tools/include/gnu/stubs-32.h
-        fi
+    if [ -n '${ADD_SYSROOT32_CFLAGS}' ] ; then
+        echo '${ADD_SYSROOT32_CFLAGS}' >>"${S}/tools/firmware/Rules.mk"
     fi
 }
 
-addtask stubs after do_configure before do_compile
-
 do_compile() {
     cd ${S}
     oe_runmake tools PYTHON="${PYTHON}"
recipes-extended/xen/xen.inc +0 -4
index 1ac131e..32e836a 100644
@@ -223,10 +223,6 @@ do_configure_common() {
     oe_runconf EXTRA_CFLAGS_XEN_CORE="${EXTRA_CFLAGS_XEN_CORE}" \
                EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}" \
                PYTHON="${PYTHON}"
-
-    if [ ! -e ${STAGING_INCDIR}/bits/long-double-32.h ]; then
-        cp ${STAGING_INCDIR}/bits/long-double-64.h ${STAGING_INCDIR}/bits/long-double-32.h
-    fi
 }
 
 do_compile_prepend() {
Signature · 1 line
2.17.1
#15 lore raw

PATCH v2 15/22 xen, xen-tools: update recipes for python3

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

Adds patches for packaged scripts to enable deployment with python3 where they have been ported to python 3 upstream.

setuptools3 inherits distutils3 which modifies ${B}, so cd ${S} is needed in the do_configure, do_compile and do_install steps.

Remove python 2 dependency from the Xen recipes by adding a new separate recipe, xen-python2, for packaging the remaining optional scripts which are yet to be ported to python 3. Package naming in the separate recipe is chosen to support transition back into the xen-tools recipe if the scripts are ported later.

Use RSUGGESTS to support inclusion of the xen-python2 scripts in images that include python 2.

Drop the remus package python dependency since the script was removed in 2014: commit 5b66f84e37a45038f9e5dae7a5768a5525d1e6ba

Add python3 RDEPENDS needed to run xenmon.

---
 ...ython-pygrub-pass-DISTUTILS-xen.4.12.patch |   7 +-
 .../files/xen-tools-libxl-gentypes-py3.patch  | 140 +++++
 ...tools-pygrub-change-tabs-into-spaces.patch |  40 ++
 ...-python-scripts-work-with-2.6-and-up.patch | 529 ++++++++++++++++++
 .../xen/files/xen-tools-pygrub-py3.patch      | 233 ++++++++
 ...ls-python-fix-Wsign-compare-warnings.patch | 136 +++++
 ...n-tools-update-python-scripts-to-py3.patch | 140 +++++
 recipes-extended/xen/xen-hypervisor.inc       |   4 +-
 recipes-extended/xen/xen-python2.bb           |  66 +++
 recipes-extended/xen/xen-tools.inc            |  57 +-
 recipes-extended/xen/xen-tools_git.bb         |   6 +
 recipes-extended/xen/xen.inc                  |  11 +-
 12 files changed, 1342 insertions(+), 27 deletions(-)
 create mode 100644 recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch
 create mode 100644 recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch
 create mode 100644 recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch
 create mode 100644 recipes-extended/xen/files/xen-tools-pygrub-py3.patch
 create mode 100644 recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch
 create mode 100644 recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch
 create mode 100644 recipes-extended/xen/xen-python2.bb
recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch +6 -1
index 6504d86..96e907d 100644
@@ -13,11 +13,14 @@ Signed-off-by: Maciej Pijanowski <[email protected]>
 Forward-ported to Xen 4.12.0
 Signed-off-by: Christopher Clark <[email protected]>
 
+Modified to support pygrub installation with python 3
+Signed-off-by: Christopher Clark <[email protected]>
+
 diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile
 index 3063c49..513314b 100644
 --- a/tools/pygrub/Makefile
 +++ b/tools/pygrub/Makefile
-@@ -10,14 +10,15 @@ INSTALL_LOG = build/installed_files.txt
+@@ -10,14 +10,17 @@ INSTALL_LOG = build/installed_files.txt
  all: build
  .PHONY: build
  build:
@@ -32,6 +35,8 @@ index 3063c49..513314b 100644
 -		 --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force
 +		 --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force \
 +		 $(DISTUTILS_INSTALL_ARGS)
++	rm -f $(DESTDIR)/$(LIBEXEC_BIN)/pygrub
++	$(INSTALL_PYTHON_PROG) src/pygrub $(DESTDIR)/$(LIBEXEC_BIN)/pygrub
  	set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \
  	             "`readlink -f $(DESTDIR)/$(bindir)`" != \
  	             "`readlink -f $(LIBEXEC_BIN)`" ]; then \
recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch new file +140 -0

140 lines not on this page · raw message

recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch new file +40 -0
new file mode 100644
index 0000000..d913be2
@@ -0,0 +1,40 @@
+From b9e1368af14ded6aee3bdf64e8329628b16291ff Mon Sep 17 00:00:00 2001
+From: Wei Liu <[email protected]>
+Date: Mon, 11 Mar 2019 12:55:29 +0000
+Subject: [PATCH] pygrub: change tabs into spaces
+
+Not sure why Python 2 never complained, but Python 3 does.
+
+Change tabs to spaces.
+
+Signed-off-by: Wei Liu <[email protected]>
+Reviewed-by: Andrew Cooper <[email protected]>
+---
+ tools/pygrub/src/pygrub | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
+index 52a8965ad9..1189b1ca48 100755
+--- a/tools/pygrub/src/pygrub
++++ b/tools/pygrub/src/pygrub
+@@ -858,7 +858,7 @@ if __name__ == "__main__":
+             output_directory = a
+ 
+     if debug:
+-	logging.basicConfig(level=logging.DEBUG)
++        logging.basicConfig(level=logging.DEBUG)
+ 
+ 
+     try:
+@@ -917,7 +917,7 @@ if __name__ == "__main__":
+             # IOErrors raised by fsimage.open
+             # RuntimeErrors raised by run_grub if no menu.lst present
+             if debug:
+-		traceback.print_exc()
++                traceback.print_exc()
+             fs = None
+             continue
+ 
+-- 
+2.17.1
+
recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch new file +529 -0

529 lines not on this page · raw message

recipes-extended/xen/files/xen-tools-pygrub-py3.patch new file +233 -0

233 lines not on this page · raw message

recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch new file +136 -0

136 lines not on this page · raw message

recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch new file +140 -0

140 lines not on this page · raw message

recipes-extended/xen/xen-hypervisor.inc +2 -2
index c0df158..79fafd2 100644
@@ -6,7 +6,7 @@ DESCRIPTION = "The Xen hypervisor"
 # this allows for varying the target architecture or toolchain used
 # to build the different components. eg. 32-bit tools and a 64-bit hypervisor.
 
-inherit deploy
+inherit deploy python3native
 
 PACKAGES = " \
     ${PN} \
@@ -34,7 +34,7 @@ do_configure() {
 }
 
 do_compile() {
-    oe_runmake xen
+    oe_runmake xen PYTHON="${PYTHON}"
 }
 
 do_install() {
recipes-extended/xen/xen-python2.bb new file +66 -0

66 lines not on this page · raw message

recipes-extended/xen/xen-tools.inc +37 -20

151 lines not on this page · raw message

recipes-extended/xen/xen-tools_git.bb +6 -0
index 7042c53..00060df 100644
@@ -6,6 +6,12 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch \
+    file://xen-tools-update-python-scripts-to-py3.patch \
+    file://xen-tools-libxl-gentypes-py3.patch \
+    file://xen-tools-python-fix-Wsign-compare-warnings.patch \
+    file://xen-tools-pygrub-change-tabs-into-spaces.patch \
+    file://xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch \
+    file://xen-tools-pygrub-py3.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=bbb4b1bdc2c3b6743da3c39d03249095"
recipes-extended/xen/xen.inc +7 -4
index b2af8aa..0bfe72d 100644
@@ -43,7 +43,7 @@ DEPENDS = " \
     pciutils \
     pixman \
     procps \
-    python \
+    python3 \
     libaio \
     lzo \
     util-linux \
@@ -77,8 +77,8 @@ libexecdir = "${libdir}"
 export XEN_OS = "Linux"
 
 # this is used for the header (#!${bindir}/python) of the install python scripts
-export PYTHONPATH="${bindir}/python"
-export ac_cv_path_PYTHONPATH="${bindir}/python"
+export PYTHONPATH="${bindir}/env python3"
+export ac_cv_path_PYTHONPATH="${bindir}/env python3"
 export DISTUTILS_BUILD_ARGS
 export DISTUTILS_INSTALL_ARGS
 
@@ -207,6 +207,7 @@ EXTRA_OEMAKE += "XEN_CONFIG_EXPERT=y"
 EXTRA_OEMAKE += "debug=n"
 
 do_configure_common() {
+    cd ${S}
 
     #./configure --enable-xsmpolicy does not set XSM_ENABLE must be done manually
     if [ "${XSM_ENABLED}" = "1" ]; then
@@ -222,7 +223,9 @@ do_configure_common() {
 
     # do configure
     oe_runconf EXTRA_CFLAGS_XEN_CORE="${EXTRA_CFLAGS_XEN_CORE}" \
-               EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}"
+               EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}" \
+               PYTHON="${PYTHON}"
+
     if [ ! -e ${STAGING_INCDIR}/bits/long-double-32.h ]; then
         cp ${STAGING_INCDIR}/bits/long-double-64.h ${STAGING_INCDIR}/bits/long-double-32.h
     fi
Signature · 1 line
2.17.1
#18 lore raw

PATCH v2 18/22 xen, xen-tools: bug fix to post_patch task

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

Patch needs to be applied to tree in ${S}.

---
 recipes-extended/xen/xen.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-extended/xen/xen.inc +1 -1
index 32e836a..d863c8f 100644
@@ -192,7 +192,7 @@ do_post_patch() {
 
 do_post_patch_append_arm()  {
     # The hypervisor binary must not be built with the hard floating point ABI.
-    echo "CC := \$(filter-out ${TUNE_CCARGS},\$(CC))" >> ${B}/xen/arch/arm/Rules.mk
+    echo "CC := \$(filter-out ${TUNE_CCARGS},\$(CC))" >> ${S}/xen/arch/arm/Rules.mk
 }
 
 addtask post_patch after do_patch before do_configure
Signature · 1 line
2.17.1
#19 lore raw

PATCH v2 19/22 xen: add contact to recipe README file

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

Add myself as a contact for the Xen recipes.

---
 recipes-extended/xen/README | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
recipes-extended/xen/README +3 -1
index 3686530..5592b48 100644
@@ -1,7 +1,9 @@
 Xen
 ---
 
-For any issues with the xen recipes please make sure you CC [email protected]
+For any issues with the Xen recipes please make sure you CC:
+ [email protected]
+ [email protected]
 
 configuring the hypervisor
 --------------------------
Signature · 1 line
2.17.1
#20 lore raw

PATCH v2 20/22 xen-image-minimal: add a build dependency on the xen hypervisor

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

The hypervisor may not be within the dom0 filesystem image itself, so add a task dependency to ensure that it is deployable:

    do_build[depends] += "xen:do_deploy"
---
 recipes-extended/images/xen-image-minimal.bb | 4 ++++
 1 file changed, 4 insertions(+)
recipes-extended/images/xen-image-minimal.bb +4 -0
index c98314e..dcdc864 100644
@@ -16,6 +16,10 @@ IMAGE_INSTALL += " \
     qemu \
     "
 
+# The hypervisor may not be within the dom0 filesystem image but at least
+# ensure that it is deployable:
+do_build[depends] += "xen:do_deploy"
+
 # Networking for HVM-mode guests (x86/64 only) requires the tun kernel module
 IMAGE_INSTALL_append_x86    = "kernel-module-tun"
 IMAGE_INSTALL_append_x86-64 = "kernel-module-tun"
Signature · 1 line
2.17.1
#21 lore raw

PATCH v2 21/22 xen: add menuconfig instructions to the README

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

bitbake xen -c menuconfig

---
 recipes-extended/xen/README | 9 +++++++++
 1 file changed, 9 insertions(+)
recipes-extended/xen/README +9 -0
index 5592b48..34e7977 100644
@@ -16,6 +16,15 @@ copy it to your Yocto layer as 'defconfig' inside of
 'recipes-extended/xen/files/' and then create a bbappend adding
 'file://defconfig' to your SRC_URI.
 
+To generate your own .config file for Xen, you can use the interactive
+menuconfig via bitbake:
+
+    bitbake xen -c menuconfig
+
+Select the config settings that you want and Save the file. If you save it to
+the default ".config" file when prompted by menuconfig, you can find it in the
+'xen' subdirectory of the build tree.
+
 security patches
 ----------------
 
Signature · 1 line
2.17.1
#22 lore raw

PATCH v2 22/22 xen, xen-tools: updates to the deploy task

In reply to Christopher Clark

From: Christopher Clark <[email protected]>

Amend addtask for deploy in both recipes: add deploy before do_build to ensure that it completes before the build step stamp is written.

Add comments explaining the scheduling of the deploy task to both the hypervisor and tools recipes.

In the hypervisor build, change deploy to obtain files from ${B} rather than ${D}, since it allows a bbappend to modify boot binary file destinations in do_install without breaking do_deploy. do_deploy can then be scheduled to run after do_compile.

To ensure that a deployed hypervisor has matching tools in any image being built, add a dependency to make sure that the tools have built and been staged first:

    do_deploy[depends] += "xen-tools:do_populate_sysroot"

Also add a dependency to ensure that anything that the tools recipe deploys, such as a XSM policy file, has been deployed first:

    do_deploy[depends] += "xen-tools:do_deploy"
---
 recipes-extended/xen/xen-hypervisor.inc | 24 ++++++++++++++++--------
 recipes-extended/xen/xen-tools.inc      |  6 ++++--
 2 files changed, 20 insertions(+), 10 deletions(-)
recipes-extended/xen/xen-hypervisor.inc +16 -8
index 41de9b6..45d2057 100644
@@ -47,20 +47,28 @@ do_install() {
 do_deploy() {
     install -d ${DEPLOYDIR}
 
-    if [ -f ${D}/boot/xen ]; then
-        install -m 0644 ${D}/boot/xen ${DEPLOYDIR}/xen-${MACHINE}
+    if [ -f ${B}/xen/xen.gz ]; then
+        install -m 0644 ${B}/xen/xen ${DEPLOYDIR}/xen-${MACHINE}
     fi
 
-    if [ -f ${D}/boot/xen.gz ]; then
-        install -m 0644 ${D}/boot/xen.gz ${DEPLOYDIR}/xen-${MACHINE}.gz
+    if [ -f ${B}/xen/xen.gz ]; then
+        install -m 0644 ${B}/xen/xen.gz ${DEPLOYDIR}/xen-${MACHINE}.gz
     fi
 
-    if [ -f ${D}/usr/lib64/efi/xen.efi ]; then
-        install -m 0644 ${D}/usr/lib64/efi/xen.efi ${DEPLOYDIR}/xen-${MACHINE}.efi
+    if [ -f ${B}/xen/xen.efi ]; then
+        install -m 0644 ${B}/xen/xen.efi ${DEPLOYDIR}/xen-${MACHINE}.efi
     fi
 }
-
-addtask deploy after do_populate_sysroot
+# Deploy copies files from ${B} that are written during do_compile so must
+# run afer that task; and add the task before do_build to ensure that deployment
+# has completed when the recipe build done stamp is written.
+addtask deploy after do_compile before do_build
+# To ensure that a deployed hypervisor has matching tools, add a dependency to
+# make sure that the tools have built and been staged:
+do_deploy[depends] += "xen-tools:do_populate_sysroot"
+# Also ensure anything that the tools recipe needs to deploy, such as a
+# XSM policy file, has been deployed first:
+do_deploy[depends] += "xen-tools:do_deploy"
 
 # Enable use of menuconfig directly from bitbake and also within the devshell
 OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO"
recipes-extended/xen/xen-tools.inc +4 -2
index 864c40c..a033f39 100644
@@ -781,5 +781,7 @@ do_deploy() {
         ln -sf ${FLASK_POLICY_FILE} ${DEPLOYDIR}/xenpolicy-${MACHINE}
     fi
 }
-
-addtask deploy after do_populate_sysroot
+# Deploy copies files from ${D} that are written during do_install so must run
+# after that task; and add the task before do_build to ensure that deployment
+# has completed when the recipe build done stamp is written.
+addtask deploy after do_install before do_build
Signature · 1 line
2.17.1