conf/image-uefi: fix building images for multilib case
PATCH v3 1/5 conf/image-uefi: fix building images for multilib case
From: Dmitry Eremin-Solenikov <[email protected]>
Building live images for lib32-core-minimal-image will fail because image target override won't match grub's override. Fix this by introducing anonymous python function. A proper fix should be to introduce multilib overrides, but it will be more intrusive.
--- meta/conf/image-uefi.conf | 11 +++++------ meta/conf/image-uefi.inc | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 meta/conf/image-uefi.inc
meta/conf/image-uefi.conf +5 -6
@@ -8,9 +8,8 @@ EFI_PREFIX ?= "/boot" # Location inside rootfs. EFI_FILES_PATH = "${EFI_PREFIX}${EFIDIR}" -# Determine name of bootloader image -EFI_BOOT_IMAGE ?= "bootINVALID.efi" -EFI_BOOT_IMAGE_x86-64 = "bootx64.efi" -EFI_BOOT_IMAGE_x86 = "bootia32.efi" -EFI_BOOT_IMAGE_aarch64 = "bootaa64.efi" -EFI_BOOT_IMAGE_arm = "bootarm.efi" +# Parsing python anonymous functions in .conf files does not work, so move it +# to .inc file +require conf/image-uefi.inc + +EFI_BOOT_IMAGE ?= "boot${EFI_ARCH}.efi"
meta/conf/image-uefi.inc new file +23 -0
@@ -0,0 +1,23 @@ +# Determine name of bootloader image +python () { + import re + if d.getVar("MLPREFIX") != "": + target = d.getVar("TARGET_ARCH_MULTILIB_ORIGINAL") + else: + target = d.getVar("TARGET_ARCH") + + if target == "x86_64": + arch = "x64" + elif re.match('i.86', target): + arch = "ia32" + elif re.match('aarch64', target): + arch = "aa64" + elif re.match('arm', target): + arch = "arm" + else: + raise bb.parse.SkipRecipe("image-uefi is incompatible with target %s" % target) + + d.setVar("EFI_ARCH", arch) +} + +
Signature · 1 line
2.23.0
PATCH v3 2/5 multilib.conf: add systemd-boot to non-multilib recipes list
From: Dmitry Eremin-Solenikov <[email protected]>
Add systemd-boot to NON_MULTILIB_RECIPES so that it won't be built for multilib targets.
--- meta/conf/multilib.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/multilib.conf +1 -1
@@ -29,4 +29,4 @@ PKG_CONFIG_PATH[vardepvalueexclude] = ":${WORKDIR}/recipe-sysroot/${datadir}/pkg # These recipes don't need multilib variants, the ${BPN} PROVDES/RPROVDES # ${MLPREFIX}${BPN} -NON_MULTILIB_RECIPES = "grub grub-efi make-mod-scripts ovmf" +NON_MULTILIB_RECIPES = "grub grub-efi systemd-boot make-mod-scripts ovmf"
Signature · 1 line
2.23.0
PATCH v3 3/5 grub-efi: replace anonymous function with static configuration
In reply to [email protected]From: Dmitry Eremin-Solenikov <[email protected]>
Replace anonymous function setting GRUB_* variables with static configuration, since grub-efi.bbclass will use fixed names for grub bootloader.
--- meta/recipes-bsp/grub/grub-efi_2.04.bb | 40 ++++++++++---------------- 1 file changed, 15 insertions(+), 25 deletions(-)
meta/recipes-bsp/grub/grub-efi_2.04.bb +15 -25
@@ -13,27 +13,13 @@ SRC_URI += " \ S = "${WORKDIR}/grub-${PV}" -# Determine the target arch for the grub modules -python __anonymous () { - import re - target = d.getVar('TARGET_ARCH') - prefix = "" if d.getVar('EFI_PROVIDER') == "grub-efi" else "grub-efi-" - if target == "x86_64": - grubtarget = 'x86_64' - elif re.match('i.86', target): - grubtarget = 'i386' - elif re.match('aarch64', target): - grubtarget = 'arm64' - elif re.match('arm', target): - grubtarget = 'arm' - else: - raise bb.parse.SkipRecipe("grub-efi is incompatible with target %s" % target) - grubimage = prefix + d.getVar("EFI_BOOT_IMAGE") - d.setVar("GRUB_TARGET", grubtarget) - d.setVar("GRUB_IMAGE", grubimage) - prefix = "grub-efi-" if prefix == "" else "" - d.setVar("GRUB_IMAGE_PREFIX", prefix) -} +GRUB_TARGET = "UNSUPPORTED" +GRUB_TARGET_x86-64 = "x86_64" +GRUB_TARGET_x86 = "i386" +GRUB_TARGET_aarch64 = "arm64" +GRUB_TARGET_arm = "arm" + +GRUB_IMAGE = "grub-efi-${EFI_BOOT_IMAGE}" inherit deploy
@@ -45,7 +31,7 @@ do_mkimage() { # Search for the grub.cfg on the local boot media by using the # built in cfg file provided via this recipe grub-mkimage -c ../cfg -p ${EFIDIR} -d ./grub-core/ \ - -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} \ + -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \ ${GRUB_BUILDIN} }
@@ -57,7 +43,11 @@ do_mkimage_class-native() { do_install_append_class-target() { install -d ${D}${EFI_FILES_PATH} - install -m 644 ${B}/${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} ${D}${EFI_FILES_PATH}/${GRUB_IMAGE} + if [ "${EFI_PROVIDER}" = "${BPN}" ] ; then + install -m 644 ${B}/${GRUB_IMAGE} ${D}${EFI_FILES_PATH}/${EFI_BOOT_IMAGE} + else + install -m 644 ${B}/${GRUB_IMAGE} ${D}${EFI_FILES_PATH}/${GRUB_IMAGE} + fi } do_install_class-native() {
@@ -86,7 +76,7 @@ GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal \ efi_gop iso9660 configfile search loadenv test" do_deploy() { - install -m 644 ${B}/${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} ${DEPLOYDIR} + install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR} } do_deploy_class-native() {
@@ -97,7 +87,7 @@ addtask deploy after do_install before do_build FILES_${PN} = "${libdir}/grub/${GRUB_TARGET}-efi \ ${datadir}/grub \ - ${EFI_FILES_PATH}/${GRUB_IMAGE} \ + ${EFI_FILES_PATH} \ " FILES_${PN}_remove_aarch64 = "${libdir}/grub/${GRUB_TARGET}-efi"
Signature · 1 line
2.23.0
PATCH v3 4/5 systemd-boot: replace anonymous function with static configuration
In reply to [email protected]From: Dmitry Eremin-Solenikov <[email protected]>
Replace anonymous function setting GRUB_* variables with static configuration, since systemd-boot.bbclass will use fixed names for systemd bootloader.
--- meta/recipes-core/systemd/systemd-boot_243.bb | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-)
meta/recipes-core/systemd/systemd-boot_243.bb +8 -15
@@ -28,20 +28,9 @@ EXTRA_OEMESON += "-Defi=true \ -Defi-objcopy='${OBJCOPY}' \ " -# install to the image as boot*.efi if its the EFI_PROVIDER, -# otherwise install as the full name. -# This allows multiple bootloaders to coexist in a single image. -python __anonymous () { - import re - target = d.getVar('TARGET_ARCH') - prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-" - systemdimage = prefix + d.getVar("EFI_BOOT_IMAGE") - d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage) - prefix = "systemd-" if prefix == "" else "" - d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix) -} +SYSTEMD_BOOT_IMAGE = "systemd-${EFI_BOOT_IMAGE}" -FILES_${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}" +FILES_${PN} = "${EFI_FILES_PATH}" RDEPENDS_${PN} += "virtual/systemd-bootconf"
@@ -56,12 +45,16 @@ do_compile() { SYSTEMD_BOOT_EFI_ARCH="x64" fi - ninja src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE} + ninja src/boot/efi/${SYSTEMD_BOOT_IMAGE} } do_install() { install -d ${D}${EFI_FILES_PATH} - install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE} + if [ "${EFI_PROVIDER}" = "${BPN}" ] ; then + install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${EFI_BOOT_IMAGE} + else + install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE} + fi } do_deploy () {
Signature · 1 line
2.23.0
PATCH v3 5/5 image-uefi.conf: define generic EFI_COMPATIBLE_HOST
In reply to [email protected]From: Dmitry Eremin-Solenikov <[email protected]>
--- meta/conf/image-uefi.conf | 2 ++ 1 file changed, 2 insertions(+)
meta/conf/image-uefi.conf +2 -0
@@ -13,3 +13,5 @@ EFI_FILES_PATH = "${EFI_PREFIX}${EFIDIR}" require conf/image-uefi.inc EFI_BOOT_IMAGE ?= "boot${EFI_ARCH}.efi" + +EFI_COMPATIBLE_HOST = "(x86_64.*|i.86.*|arm.*|aarch64.*)-linux.*"
Signature · 1 line
2.23.0
Hello,
вт, 15 окт. 2019 г. в 00:50, <[email protected]>:
Quoted 7 lines
From: Dmitry Eremin-Solenikov <[email protected]>
Building live images for lib32-core-minimal-image will fail because image target override won't match grub's override. Fix this by introducing anonymous python function. A proper fix should be to introduce multilib overrides, but it will be more intrusive.
Any updates on these patches? I think all build issues should be fixed now.
Signature · 2 lines
With best wishes Dmitry