Skip to contentSkip to conversation

xen-tools: Load xen related kernel modules during system boot

PATCH Superseded Kamil Dziezyk 3 participants 9 messages Dec 8, 2021 – Dec 9, 2021 1 message not in the archive

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 xen-tools: Load xen related kernel modules during system boot

This patch changes the location of xen.conf file, that contains list of kernel modules to be loaded during system boot, to "${nonarch_libdir}". This is done by removing '--with-systemd-modules-load=' flag from EXTRA_OECONF variable.

Previous path based on "${systemd_unitdir}" was not considered by default by systemd-modules-load.service.

---
 recipes-extended/xen/xen-tools.inc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
recipes-extended/xen/xen-tools.inc +1 -2
index d831941..6b99040 100644
@@ -653,10 +653,10 @@ FILES:${PN}-xm = "\
     "
 
 FILES:${PN}-xencommons += "\
+    ${nonarch_libdir}/modules-load.d/xen.conf \
     ${sysconfdir}/default/xencommons \
     ${sysconfdir}/init.d/xencommons \
     ${sysconfdir}/xen/scripts/launch-xenstore \
-    ${systemd_unitdir}/modules-load.d/xen.conf \
     ${systemd_unitdir}/system/proc-xen.mount \
     ${systemd_unitdir}/system/xen-qemu-dom0-disk-backend.service \
     ${systemd_unitdir}/system/xenconsoled.service \
@@ -744,7 +744,6 @@ SYSTEMD_SERVICE:${PN}-xendomains = "xendomains.service"
 
 EXTRA_OECONF += " \
     --with-systemd=${systemd_unitdir}/system \
-    --with-systemd-modules-load=${systemd_unitdir}/modules-load.d \
     --with-initddir=${INIT_D_DIR} \
     --with-sysconfig-leaf-dir=default \
     --with-system-qemu=${bindir}/qemu-system-i386 \
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/3 xen: Clear TUNE_CCARGS for Xen build for aarch64 machines

Xen build may fail for arm machines that have enabled extra flags, that can be enabled only for specific architecture version, e.g. armv8-2a.

---
 recipes-extended/xen/xen.inc | 5 +++++
 1 file changed, 5 insertions(+)
recipes-extended/xen/xen.inc +5 -0
index d3c7a7d..9ac82ef 100644
@@ -102,6 +102,11 @@ EXTRA_CFLAGS_XEN_CORE="${DEBUG_PREFIX_MAP}"
 #   EXTRA_CFLAGS_XEN_TOOLS: so clear TUNE_CCARGS on x86 to prevent that.
 TUNE_CCARGS:x86-64=""
 
+# - The Xen build for aarch64 systems with HVM-mode enabled may include
+#   architecture specific flags '-march=*' which causes build failure, so clear
+#   TUNE_CCARGS on aarch64 to prevent that.
+TUNE_CCARGS:aarch64=""
+
 # - 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
Signature · 1 line
2.17.1
Reviewed-by on v1 2/3
#2 lore raw

Re: [meta-virtualization][PATCH 2/3] xen: Clear TUNE_CCARGS for Xen build for aarch64 machines

Hi Kamil,

Quoted 6 lines · Kamil Dziezyk via lists.yoctoproject.org

Xen build may fail for arm machines that have enabled extra flags, that can be enabled only for specific architecture version, e.g. armv8-2a.

Cheers
Bertrand

Quoted 26 lines

---
recipes-extended/xen/xen.inc | 5 +++++

1 file changed, 5 insertions(+)
recipes-extended/xen/xen.inc +0 -0
index d3c7a7d..9ac82ef 100644
@@ -102,6 +102,11 @@ EXTRA_CFLAGS_XEN_CORE="${DEBUG_PREFIX_MAP}"
 #   EXTRA_CFLAGS_XEN_TOOLS: so clear TUNE_CCARGS on x86 to prevent that.

TUNE_CCARGS:x86-64=""

recipes-extended/xen/xen.inc +5 -0
+# - The Xen build for aarch64 systems with HVM-mode enabled may include
+#   architecture specific flags '-march=*' which causes build failure, so clear
+#   TUNE_CCARGS on aarch64 to prevent that.
+TUNE_CCARGS:aarch64=""
+

# - 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

Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/3 grub-efi: Add xen_boot support when 'xen' is in DISTRO_FEATURES for aarch64

In reply to Kamil Dziezyk
---
 recipes-bsp/grub/grub-efi_%.bbappend | 1 +
 recipes-bsp/grub/grub-efi_xen.inc    | 1 +
 2 files changed, 2 insertions(+)
 create mode 100644 recipes-bsp/grub/grub-efi_%.bbappend
 create mode 100644 recipes-bsp/grub/grub-efi_xen.inc
recipes-bsp/grub/grub-efi_%.bbappend new file +1 -0
new file mode 100644
index 0000000..df2b688
@@ -0,0 +1 @@
+require ${@bb.utils.contains('DISTRO_FEATURES', 'xen', '${BPN}_xen.inc', '', d)}
recipes-bsp/grub/grub-efi_xen.inc new file +1 -0
new file mode 100644
index 0000000..5aa0958
@@ -0,0 +1 @@
+GRUB_BUILDIN:append:aarch64 = "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' xen_boot', '', d)}"
Signature · 1 line
2.17.1
Reviewed-by on v1 3/3
#4 lore raw

Re: [meta-virtualization][PATCH 3/3] grub-efi: Add xen_boot support when 'xen' is in DISTRO_FEATURES for aarch64

Hi Kamil,

Quoted 3 lines · Kamil Dziezyk via lists.yoctoproject.org

But an empty commit message is not something that I like (more for next time, no need to change this patch).

Cheers
Bertrand

Quoted 27 lines

---
recipes-bsp/grub/grub-efi_%.bbappend | 1 +
recipes-bsp/grub/grub-efi_xen.inc | 1 +

2 files changed, 2 insertions(+)

create mode 100644 recipes-bsp/grub/grub-efi_%.bbappend create mode 100644 recipes-bsp/grub/grub-efi_xen.inc

recipes-bsp/grub/grub-efi_%.bbappend new file +1 -0
new file mode 100644
index 0000000..df2b688
@@ -0,0 +1 @@
+require ${@bb.utils.contains('DISTRO_FEATURES', 'xen', '${BPN}_xen.inc', '', d)}
recipes-bsp/grub/grub-efi_xen.inc new file +1 -0
new file mode 100644
index 0000000..5aa0958
@@ -0,0 +1 @@
+GRUB_BUILDIN:append:aarch64 = "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' xen_boot', '', d)}"
Signature · 1 line
2.17.1
Reviewed-by on v1 1/3
#5 lore raw
In reply to Kamil Dziezyk

Hi Kamil,

Quoted 10 lines · Kamil Dziezyk via lists.yoctoproject.org

This patch changes the location of xen.conf file, that contains list of kernel modules to be loaded during system boot, to "${nonarch_libdir}". This is done by removing '--with-systemd-modules-load=' flag from EXTRA_OECONF variable.

Previous path based on "${systemd_unitdir}" was not considered by default by systemd-modules-load.service.

Cheers
Bertrand

Quoted 34 lines

---
recipes-extended/xen/xen-tools.inc | 3 +--

1 file changed, 1 insertion(+), 2 deletions(-)
recipes-extended/xen/xen-tools.inc +1 -2
index d831941..6b99040 100644
@@ -653,10 +653,10 @@ FILES:${PN}-xm = "\
    "
 
 FILES:${PN}-xencommons += "\
+    ${nonarch_libdir}/modules-load.d/xen.conf \
    ${sysconfdir}/default/xencommons \
    ${sysconfdir}/init.d/xencommons \
    ${sysconfdir}/xen/scripts/launch-xenstore \
-    ${systemd_unitdir}/modules-load.d/xen.conf \
    ${systemd_unitdir}/system/proc-xen.mount \
    ${systemd_unitdir}/system/xen-qemu-dom0-disk-backend.service \
    ${systemd_unitdir}/system/xenconsoled.service \
@@ -744,7 +744,6 @@ SYSTEMD_SERVICE:${PN}-xendomains = "xendomains.service"
 
 EXTRA_OECONF += " \
    --with-systemd=${systemd_unitdir}/system \
-    --with-systemd-modules-load=${systemd_unitdir}/modules-load.d \
    --with-initddir=${INIT_D_DIR} \
    --with-sysconfig-leaf-dir=default \
    --with-system-qemu=${bindir}/qemu-system-i386 \
Signature · 1 line
2.17.1
#6 lore raw
Quoted 6 lines · Bertrand Marquis

Hi Kamil,

Quoted 1 line

On 8 Dec 2021, at 10:44, Kamil Dziezyk via lists.yoctoproject.org

Quoted 2 lines · <[email protected]> wrote:

This patch changes the location of xen.conf file, that contains list of

Quoted 10 lines

kernel

Quoted 1 line

modules to be loaded during system boot, to "${nonarch_libdir}". This is

done

Quoted 1 line

by removing '--with-systemd-modules-load=' flag from EXTRA_OECONF

variable.

Quoted 2 lines

Previous path based on "${systemd_unitdir}" was not considered by

default by

Quoted 1 line

systemd-modules-load.service.

ok, it does look like there's a fix that should be made here, thanks. It took a bit of following to see what's involved, so:

There are two recipes in meta-openembedded that do use ${nonarch_libdir} for this, but the systemd package itself doesn't: the recipe has ${exec_prefix}/lib/modules-load.d instead, and there's a systemd patch that applies ${exec_prefix}/lib/modules-load.d too; but then in oe-core, bitbake.conf defines: nonarch_libdir = "${exec_prefix}/lib"
so the end result should work in the default configuration.

Khem: should the OE Core systemd recipe and patch be using ${nonarch_libdir} too? Or should the recipes that package modules.d config files place them via ${exec_prefix}/lib ?

thanks

Christopher

Quoted 48 lines
Quoted 2 lines

Cheers
Bertrand

Review

Quoted 5 lines

---
recipes-extended/xen/xen-tools.inc | 3 +--

1 file changed, 1 insertion(+), 2 deletions(-)
(quoted diff) +0 -0

b/recipes-extended/xen/xen-tools.inc

recipes-extended/xen/xen-tools.inc SYSTEMD_SERVICE:${PN}-xendomains =

Quoted 16 lines

index d831941..6b99040 100644

recipes-extended/xen/xen-tools.inc +1 -1
@@ -653,10 +653,10 @@ FILES:${PN}-xm = "\
    "
 
 FILES:${PN}-xencommons += "\
+    ${nonarch_libdir}/modules-load.d/xen.conf \
    ${sysconfdir}/default/xencommons \
    ${sysconfdir}/init.d/xencommons \
    ${sysconfdir}/xen/scripts/launch-xenstore \
-    ${systemd_unitdir}/modules-load.d/xen.conf \
    ${systemd_unitdir}/system/proc-xen.mount \
    ${systemd_unitdir}/system/xen-qemu-dom0-disk-backend.service \
    ${systemd_unitdir}/system/xenconsoled.service \
@@ -744,7 +744,6 @@ SYSTEMD_SERVICE:${PN}-xendomains =

"xendomains.service"

Quoted 13 lines
recipes-extended/xen/xen-tools.inc +0 -2
 EXTRA_OECONF += " \
    --with-systemd=${systemd_unitdir}/system \
-    --with-systemd-modules-load=${systemd_unitdir}/modules-load.d \
    --with-initddir=${INIT_D_DIR} \
    --with-sysconfig-leaf-dir=default \
    --with-system-qemu=${bindir}/qemu-system-i386 \
--

2.17.1

A message that is not in the archive (sent off-list or not yet received): CAMKF1so7v3mW3AOh-zmU-zcQxYaMHgbuPs+wpLwif25VJEtDeA@mail.gmail.com

#8 lore raw
Quoted 34 lines · Khem Raj
Quoted 30 lines · Christopher Clark
Quoted 6 lines · Bertrand Marquis

Hi Kamil,

Quoted 1 line

On 8 Dec 2021, at 10:44, Kamil Dziezyk via lists.yoctoproject.org

Quoted 2 lines · <[email protected]> wrote:

This patch changes the location of xen.conf file, that contains list

Quoted 10 lines

of kernel

Quoted 1 line

modules to be loaded during system boot, to "${nonarch_libdir}". This

is done

Quoted 1 line

by removing '--with-systemd-modules-load=' flag from EXTRA_OECONF

variable.

Quoted 2 lines

Previous path based on "${systemd_unitdir}" was not considered by

default by

Quoted 1 line

systemd-modules-load.service.

ok, it does look like there's a fix that should be made here, thanks. It took a bit of following to see what's involved, so:

There are two recipes in meta-openembedded that do use ${nonarch_libdir} for this, but the systemd package itself doesn't: the recipe has ${exec_prefix}/lib/modules-load.d instead, and there's a systemd patch that applies ${exec_prefix}/lib/modules-load.d too; but then in oe-core, bitbake.conf defines: nonarch_libdir = "${exec_prefix}/lib"
so the end result should work in the default configuration.

Quoted 7 lines
Quoted 4 lines

Khem: should the OE Core systemd recipe and patch be using ${nonarch_libdir} too? Or should the recipes that package modules.d config files place them via ${exec_prefix}/lib ?

I think nonarch_libdir is right option here

Thanks, Khem.

Kamil: Is there any reason that you chose to drop specifying the install directory via the flags passed to EXTRA_OECONF?
ie. An alternative would be: rather than remove the "--with-systemd-modules-load" flag, you could update it to use the correct location:

    ${nonarch_libdir}/modules-load.d

so that if exec_prefix or nonarch_libdir are ever overridden to a non-default value, the config file will still be placed correctly.

Christopher

Quoted 55 lines
Quoted 55 lines

thanks

Christopher

Quoted 48 lines
Quoted 2 lines

Cheers
Bertrand

Review

Quoted 5 lines

---
recipes-extended/xen/xen-tools.inc | 3 +--

1 file changed, 1 insertion(+), 2 deletions(-)
(quoted diff) +0 -0

b/recipes-extended/xen/xen-tools.inc

recipes-extended/xen/xen-tools.inc SYSTEMD_SERVICE:${PN}-xendomains =

Quoted 16 lines

index d831941..6b99040 100644

recipes-extended/xen/xen-tools.inc +1 -1
@@ -653,10 +653,10 @@ FILES:${PN}-xm = "\
    "
 
 FILES:${PN}-xencommons += "\
+    ${nonarch_libdir}/modules-load.d/xen.conf \
    ${sysconfdir}/default/xencommons \
    ${sysconfdir}/init.d/xencommons \
    ${sysconfdir}/xen/scripts/launch-xenstore \
-    ${systemd_unitdir}/modules-load.d/xen.conf \
    ${systemd_unitdir}/system/proc-xen.mount \
    ${systemd_unitdir}/system/xen-qemu-dom0-disk-backend.service \
    ${systemd_unitdir}/system/xenconsoled.service \
@@ -744,7 +744,6 @@ SYSTEMD_SERVICE:${PN}-xendomains =

"xendomains.service"

Quoted 13 lines
recipes-extended/xen/xen-tools.inc +0 -2
 EXTRA_OECONF += " \
    --with-systemd=${systemd_unitdir}/system \
-    --with-systemd-modules-load=${systemd_unitdir}/modules-load.d \
    --with-initddir=${INIT_D_DIR} \
    --with-sysconfig-leaf-dir=default \
    --with-system-qemu=${bindir}/qemu-system-i386 \
--

2.17.1

#9 lore raw

Hi Christopher,

Quoted 7 lines

Is there any reason that you chose to drop specifying the install directory via the flags passed to EXTRA_OECONF?

I have dropped setting install directory, because it seemed for me to be redundant,

but I missed the case, when user customize exec_prefix or nonarch_libdir, so I will apply your suggestion.

Thanks, Kamil