Fixes for grub-efi.bbclass (live + vm)
cover Fixes for grub-efi.bbclass (live + vm)
The following changes since commit 34e7292fb40635cee1f1237ac3156530f8dfce37:
parselogs: add new whitelist entries to address 4.4.3 issues (2016-03-22 08:53:49 +0000)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib rbt/efi
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/efi
Robert Yang (3):
bootimg.bbclass: fix settings for grub-efi.bbclass grub-efi.bbclass: make it can build vm and live together bootimg.bbclass: only inherit syslinux when pcbios
meta/classes/boot-directdisk.bbclass | 5 ++--- meta/classes/bootimg.bbclass | 13 ++++++++----- meta/classes/grub-efi.bbclass | 10 ++++++---- meta/classes/image-live.bbclass | 6 ++---- meta/classes/image-vm.bbclass | 3 +-- meta/classes/image.bbclass | 13 +++++++++++++ meta/classes/syslinux.bbclass | 20 ++++---------------- 7 files changed, 36 insertions(+), 34 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/3 bootimg.bbclass: fix settings for grub-efi.bbclass
Fixed:
- Found potential conflicted var LABELS ...
Set LABELS to "boot install" would build out broken images when build vm + live together, use set_live_vm_vars() to fix the problem.
- Use ROOT and LABEL in boot-directdisk.bbclass and image-foo.bbclass, they are not only used by syslinux.bbclass, but also grub-efi.bbclass, add "SYSLINUX_" prefix would mislead users.
--- meta/classes/boot-directdisk.bbclass | 6 +++--- meta/classes/bootimg.bbclass | 4 +--- meta/classes/grub-efi.bbclass | 1 + meta/classes/image-live.bbclass | 5 ++--- meta/classes/image-vm.bbclass | 3 +-- meta/classes/image.bbclass | 13 +++++++++++++ meta/classes/syslinux.bbclass | 13 +------------ 7 files changed, 22 insertions(+), 23 deletions(-)
meta/classes/boot-directdisk.bbclass +3 -3
@@ -58,8 +58,8 @@ inherit ${PCBIOS_CLASS} inherit ${EFI_CLASS} DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}" -SYSLINUX_ROOT_VM ?= "root=/dev/sda2" -SYSLINUX_CFG_VM ?= "${S}/syslinux_hdd.cfg" +ROOT_VM ?= "root=/dev/sda2" +SYSLINUX_CFG_VM ?= "${S}/syslinux_vm.cfg" boot_direct_populate() { dest=$1
@@ -160,8 +160,8 @@ build_boot_dd() { python do_bootdirectdisk() { validate_disk_signature(d) + set_live_vm_vars(d, 'VM') if d.getVar("PCBIOS", True) == "1": - syslinux_set_vars(d, 'VM') bb.build.exec_func('build_syslinux_cfg', d) if d.getVar("EFI", True) == "1": bb.build.exec_func('build_efi_cfg', d)
meta/classes/bootimg.bbclass +1 -3
@@ -49,8 +49,6 @@ EFI_CLASS = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER}", KERNEL_IMAGETYPE ??= "bzImage" -LABELS ?= "boot install" - # Include legacy boot if MACHINE_FEATURES includes "pcbios" or if it does not # contain "efi". This way legacy is supported by default if neither is # specified, maintaining the original behavior.
@@ -282,8 +280,8 @@ build_hddimg() { } python do_bootimg() { + set_live_vm_vars(d, 'LIVE') if d.getVar("PCBIOS", True) == "1": - syslinux_set_vars(d, 'LIVE') bb.build.exec_func('build_syslinux_cfg', d) if d.getVar("EFI", True) == "1": bb.build.exec_func('build_efi_cfg', d)
meta/classes/grub-efi.bbclass +1 -0
@@ -25,6 +25,7 @@ GRUB_TIMEOUT ?= "10" GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1" EFIDIR = "/EFI/BOOT" +APPEND_prepend = " ${ROOT} " # Need UUID utility code. inherit fs-uuid
meta/classes/image-live.bbclass +2 -3
@@ -1,9 +1,8 @@ INITRD_IMAGE_LIVE ?= "core-image-minimal-initramfs" INITRD_LIVE ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE_LIVE}-${MACHINE}.cpio.gz" -SYSLINUX_ROOT_LIVE ?= "root=/dev/ram0" -SYSLINUX_LABELS_LIVE ?= "boot install" -LABELS_LIVE ?= "${SYSLINUX_LABELS_LIVE}" +ROOT_LIVE ?= "root=/dev/ram0" +LABELS_LIVE ?= "boot install" SYSLINUX_CFG_LIVE ?= "${S}/syslinux_live.cfg" ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.ext4"
meta/classes/image-vm.bbclass +1 -2
@@ -1,6 +1,5 @@ -SYSLINUX_LABELS_VM ?= "boot" -LABELS_VM ?= "${SYSLINUX_LABELS_VM}" +LABELS_VM ?= "boot" # Using an initramfs is optional. Enable it by setting INITRD_IMAGE_VM. INITRD_IMAGE_VM ?= ""
meta/classes/image.bbclass +13 -0
@@ -539,3 +539,16 @@ do_bundle_initramfs () { : } addtask bundle_initramfs after do_image_complete + +# Some of the vars for vm and live image are conflicted, this function +# is used for fixing the problem. +def set_live_vm_vars(d, suffix): + vars = ['SYSLINUX_CFG', 'ROOT', 'LABELS', 'INITRD'] + for var in vars: + var_with_suffix = var + '_' + suffix + if d.getVar(var, True): + bb.warn('Found potential conflicted var %s, please use %s rather than %s' % \ + (var, var_with_suffix, var)) + elif d.getVar(var_with_suffix, True): + d.setVar(var, d.getVar(var_with_suffix, True)) +
meta/classes/syslinux.bbclass +1 -12
@@ -33,23 +33,12 @@ AUTO_SYSLINUXMENU ?= "1" ISO_BOOTIMG = "isolinux/isolinux.bin" ISO_BOOTCAT = "isolinux/boot.cat" MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table" +SYSLINUX_ROOT ?= "${ROOT}" APPEND_prepend = " ${SYSLINUX_ROOT} " # Need UUID utility code. inherit fs-uuid -# Some of the vars for vm and live image are conflicted, this function -# is used for fixing the problem. -def syslinux_set_vars(d, suffix): - vars = ['SYSLINUX_ROOT', 'SYSLINUX_CFG', 'LABELS', 'INITRD'] - for var in vars: - var_with_suffix = var + '_' + suffix - if d.getVar(var, True): - bb.warn('Found potential conflicted var %s, please use %s rather than %s' % \ - (var, var_with_suffix, var)) - elif d.getVar(var_with_suffix, True): - d.setVar(var, d.getVar(var_with_suffix, True)) - syslinux_populate() { DEST=$1 BOOTDIR=$2
Signature · 1 line
1.7.9.5
PATCH 2/3 grub-efi.bbclass: make it can build vm and live together
In reply to Robert Yang* Make it can build vm and live (e.g., iso + vmdk) together as we did for syslinux.
* GRUBCFG -> GRUB_CFG as other GRUB_FOO vars
--- meta/classes/grub-efi.bbclass | 9 +++++---- meta/classes/image.bbclass | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-)
meta/classes/grub-efi.bbclass +5 -4
@@ -19,7 +19,8 @@ do_bootimg[depends] += "${MLPREFIX}grub-efi:do_deploy" do_bootdirectdisk[depends] += "${MLPREFIX}grub-efi:do_deploy" GRUB_SERIAL ?= "console=ttyS0,115200" -GRUBCFG = "${S}/grub.cfg" +GRUB_CFG_VM = "${S}/grub_vm.cfg" +GRUB_CFG_LIVE = "${S}/grub_live.cfg" GRUB_TIMEOUT ?= "10" #FIXME: build this from the machine config GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
@@ -43,7 +44,7 @@ efi_populate() { fi install -m 0644 ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST}${EFIDIR} - install -m 0644 ${GRUBCFG} ${DEST}${EFIDIR}/grub.cfg + install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg } efi_iso_populate() {
@@ -83,9 +84,9 @@ python build_efi_cfg() { bb.debug(1, "No labels, nothing to do") return - cfile = d.getVar('GRUBCFG', True) + cfile = d.getVar('GRUB_CFG', True) if not cfile: - raise bb.build.FuncFailed('Unable to read GRUBCFG') + raise bb.build.FuncFailed('Unable to read GRUB_CFG') try: cfgfile = file(cfile, 'w')
meta/classes/image.bbclass +1 -1
@@ -543,7 +543,7 @@ addtask bundle_initramfs after do_image_complete # Some of the vars for vm and live image are conflicted, this function # is used for fixing the problem. def set_live_vm_vars(d, suffix): - vars = ['SYSLINUX_CFG', 'ROOT', 'LABELS', 'INITRD'] + vars = ['GRUB_CFG', 'SYSLINUX_CFG', 'ROOT', 'LABELS', 'INITRD'] for var in vars: var_with_suffix = var + '_' + suffix if d.getVar(var, True):
Signature · 1 line
1.7.9.5
PATCH 3/3 bootimg.bbclass: only inherit syslinux when pcbios
In reply to Robert Yangsyslinux.bbclass should not be seen when use efi.
--- meta/classes/boot-directdisk.bbclass | 1 - meta/classes/bootimg.bbclass | 9 +++++++-- meta/classes/image-live.bbclass | 1 - meta/classes/syslinux.bbclass | 7 +++---- 4 files changed, 10 insertions(+), 8 deletions(-)
meta/classes/boot-directdisk.bbclass +0 -1
@@ -59,7 +59,6 @@ inherit ${EFI_CLASS} DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}" ROOT_VM ?= "root=/dev/sda2" -SYSLINUX_CFG_VM ?= "${S}/syslinux_vm.cfg" boot_direct_populate() { dest=$1
meta/classes/bootimg.bbclass +7 -2
@@ -40,6 +40,11 @@ EFIIMGDIR = "${S}/efi_img" COMPACT_ISODIR = "${S}/iso.z" COMPRESSISO ?= "0" +ISOLINUXDIR ?= "/isolinux" +ISO_BOOTIMG = "isolinux/isolinux.bin" +ISO_BOOTCAT = "isolinux/boot.cat" +MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table" + BOOTIMG_VOLUME_ID ?= "boot" BOOTIMG_EXTRA_SPACE ?= "512"
@@ -59,10 +64,10 @@ def pcbios(d): return pcbios PCBIOS = "${@pcbios(d)}" +PCBIOS_CLASS = "${@['','syslinux'][d.getVar('PCBIOS', True) == '1']}" -# The syslinux is required for the isohybrid command and boot catalog -inherit syslinux inherit ${EFI_CLASS} +inherit ${PCBIOS_CLASS} populate() { DEST=$1
meta/classes/image-live.bbclass +0 -1
@@ -3,7 +3,6 @@ INITRD_IMAGE_LIVE ?= "core-image-minimal-initramfs" INITRD_LIVE ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE_LIVE}-${MACHINE}.cpio.gz" ROOT_LIVE ?= "root=/dev/ram0" LABELS_LIVE ?= "boot install" -SYSLINUX_CFG_LIVE ?= "${S}/syslinux_live.cfg" ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.ext4"
meta/classes/syslinux.bbclass +3 -4
@@ -20,7 +20,7 @@ do_bootimg[depends] += "${MLPREFIX}syslinux:do_populate_sysroot \ syslinux-native:do_populate_sysroot" -ISOLINUXDIR = "/isolinux" +ISOLINUXDIR ?= "/isolinux" SYSLINUXDIR = "/" # The kernel has an internal default console, which you can override with # a console=...some_tty...
@@ -30,10 +30,9 @@ SYSLINUX_SERIAL_TTY ?= "console=ttyS0,115200" SYSLINUX_PROMPT ?= "0" SYSLINUX_TIMEOUT ?= "50" AUTO_SYSLINUXMENU ?= "1" -ISO_BOOTIMG = "isolinux/isolinux.bin" -ISO_BOOTCAT = "isolinux/boot.cat" -MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table" SYSLINUX_ROOT ?= "${ROOT}" +SYSLINUX_CFG_VM ?= "${S}/syslinux_vm.cfg" +SYSLINUX_CFG_LIVE ?= "${S}/syslinux_live.cfg" APPEND_prepend = " ${SYSLINUX_ROOT} " # Need UUID utility code.
Signature · 1 line
1.7.9.5
Re: [PATCH 3/3] bootimg.bbclass: only inherit syslinux when pcbios
Quoted 2 lines · Robert Yang
syslinux.bbclass should not be seen when use efi.
That's not completely true, there is a case which still requires the ioslinux.bin binary when EFI is used. In the build_iso() function there is a workaround that is still required and uses isolinux.bin
This change breaks building EFI only machines (intel-quark for example)
Please check into this.
Thanks
Sau!
Quoted 98 lines
Signed-off-by Robert Yang <[email protected]>---
meta/classes/boot-directdisk.bbclass | 1 - meta/classes/bootimg.bbclass | 9 +++++++-- meta/classes/image-live.bbclass | 1 - meta/classes/syslinux.bbclass | 7 +++----4 files changed, 10 insertions(+), 8 deletions(-)meta/classes/boot-directdisk.bbclass +0
-0@@ -59,7 +59,6 @@ inherit ${EFI_CLASS}
DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}"
ROOT_VM ?= "root=/dev/sda2"
-SYSLINUX_CFG_VM ?= "${S}/syslinux_vm.cfg"
boot_direct_populate() {
dest=$1meta/classes/bootimg.bbclass +0
-0@@ -40,6 +40,11 @@ EFIIMGDIR = "${S}/efi_img"COMPACT_ISODIR = "${S}/iso.z"
COMPRESSISO ?= "0"meta/classes/bootimg.bbclass +5
-0+ISOLINUXDIR ?= "/isolinux" +ISO_BOOTIMG = "isolinux/isolinux.bin" +ISO_BOOTCAT = "isolinux/boot.cat" +MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table" +BOOTIMG_VOLUME_ID ?= "boot"
BOOTIMG_EXTRA_SPACE ?= "512"meta/classes/bootimg.bbclass +0
-0@@ -59,10 +64,10 @@ def pcbios(d):return pcbios
PCBIOS = "${@pcbios(d)}"
+PCBIOS_CLASS = "${@['','syslinux'][d.getVar('PCBIOS', True) == '1']}"
-# The syslinux is required for the isohybrid command and boot catalog
-inherit syslinux
inherit ${EFI_CLASS}
+inherit ${PCBIOS_CLASS}
populate() {
DEST=$1meta/classes/image- renamed from meta/classes/image-live.bbclass +0
-0live.bbclass
index 504725d..05e416a 100644meta/classes/image-live.bbclass +0
-0@@ -3,7 +3,6 @@ INITRD_IMAGE_LIVE ?= "core-image-minimal-initramfs"INITRD_LIVE ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE_LIVE}- ${MACHINE}.cpio.gz"
ROOT_LIVE ?= "root=/dev/ram0"
LABELS_LIVE ?= "boot install"
-SYSLINUX_CFG_LIVE ?= "${S}/syslinux_live.cfg"
ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.ext4"meta/classes/syslinux.bbclass +0
-0@@ -20,7 +20,7 @@ do_bootimg[depends] += "${MLPREFIX}syslinux:do_populate_sysroot \syslinux-native:do_populate_sysroot"
meta/classes/syslinux.bbclass +1
-1-ISOLINUXDIR = "/isolinux" +ISOLINUXDIR ?= "/isolinux"SYSLINUXDIR = "/"
# The kernel has an internal default console, which you can override with# a console=...some_tty...meta/classes/syslinux.bbclass +0
-0@@ -30,10 +30,9 @@ SYSLINUX_SERIAL_TTY ?= "console=ttyS0,115200"SYSLINUX_PROMPT ?= "0"
SYSLINUX_TIMEOUT ?= "50"
AUTO_SYSLINUXMENU ?= "1"meta/classes/syslinux.bbclass +0
-3-ISO_BOOTIMG = "isolinux/isolinux.bin" -ISO_BOOTCAT = "isolinux/boot.cat" -MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table"SYSLINUX_ROOT ?= "${ROOT}"
meta/classes/syslinux.bbclass +2
-0+SYSLINUX_CFG_VM ?= "${S}/syslinux_vm.cfg" +SYSLINUX_CFG_LIVE ?= "${S}/syslinux_live.cfg"APPEND_prepend = " ${SYSLINUX_ROOT} "
# Need UUID utility code.
--
1.7.9.5
Re: [PATCH 3/3] bootimg.bbclass: only inherit syslinux when pcbios
Quoted 10 lines · Saul Wold
Quoted 2 lines · Robert Yang
syslinux.bbclass should not be seen when use efi.
That's not completely true, there is a case which still requires the ioslinux.bin binary when EFI is used. In the
build_iso()function there is a workaround that is still required and uses isolinux.binThis change breaks building EFI only machines (intel-quark for example)
Please check into this.
I had built EFI only boards before send this, it worked well. I will check meta-intel's intel-quark .
// Robert
Quoted 103 lines
Thanks
Sau!
Quoted 98 lines
Signed-off-by Robert Yang <[email protected]>--- meta/classes/boot-directdisk.bbclass | 1 - meta/classes/bootimg.bbclass | 9 +++++++-- meta/classes/image-live.bbclass | 1 - meta/classes/syslinux.bbclass | 7 +++---- 4 files changed, 10 insertions(+), 8 deletions(-)meta/classes/boot-directdisk.bbclass +0
-1@@ -59,7 +59,6 @@ inherit ${EFI_CLASS} DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}" ROOT_VM ?= "root=/dev/sda2" -SYSLINUX_CFG_VM ?= "${S}/syslinux_vm.cfg" boot_direct_populate() { dest=$1meta/classes/bootimg.bbclass +6
-0@@ -40,6 +40,11 @@ EFIIMGDIR = "${S}/efi_img" COMPACT_ISODIR = "${S}/iso.z" COMPRESSISO ?= "0" +ISOLINUXDIR ?= "/isolinux" +ISO_BOOTIMG = "isolinux/isolinux.bin" +ISO_BOOTCAT = "isolinux/boot.cat" +MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table" + BOOTIMG_VOLUME_ID ?= "boot" BOOTIMG_EXTRA_SPACE ?= "512"@@ -59,10 +64,10 @@ def pcbios(d): return pcbios PCBIOS = "${@pcbios(d)}" +PCBIOS_CLASS = "${@['','syslinux'][d.getVar('PCBIOS', True) =='1']}"
-# The syslinux is required for the isohybrid command and boot catalog
meta/classes/bootimg.bbclass +1
-1-inherit syslinux inherit ${EFI_CLASS} +inherit ${PCBIOS_CLASS} populate() { DEST=$1meta/classes/image- renamed from meta/classes/image-live.bbclass +0
-0live.bbclass
index 504725d..05e416a 100644meta/classes/image-live.bbclass +0
-0@@ -3,7 +3,6 @@ INITRD_IMAGE_LIVE ?= "core-image-minimal-initramfs" INITRD_LIVE ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE_LIVE}-${MACHINE}.cpio.gz"
ROOT_LIVE?= "root=/dev/ram0"
LABELS_LIVE?= "boot install"meta/classes/image-live.bbclass +0
-1-SYSLINUX_CFG_LIVE ?= "${S}/syslinux_live.cfg" ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.ext4"meta/classes/syslinux.bbclass +1
-1@@ -20,7 +20,7 @@ do_bootimg[depends] += "${MLPREFIX}syslinux:do_populate_sysroot \ syslinux-native:do_populate_sysroot" -ISOLINUXDIR = "/isolinux" +ISOLINUXDIR ?= "/isolinux" SYSLINUXDIR = "/" # The kernel has an internal default console, which you can overridewith
# a console=...some_tty...meta/classes/syslinux.bbclass +2
-4@@ -30,10 +30,9 @@ SYSLINUX_SERIAL_TTY ?= "console=ttyS0,115200" SYSLINUX_PROMPT ?= "0" SYSLINUX_TIMEOUT ?= "50" AUTO_SYSLINUXMENU ?= "1" -ISO_BOOTIMG = "isolinux/isolinux.bin" -ISO_BOOTCAT = "isolinux/boot.cat" -MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table" SYSLINUX_ROOT ?= "${ROOT}" +SYSLINUX_CFG_VM ?= "${S}/syslinux_vm.cfg" +SYSLINUX_CFG_LIVE ?= "${S}/syslinux_live.cfg" APPEND_prepend = " ${SYSLINUX_ROOT} " # Need UUID utility code. --1.7.9.5