From 67cfa7474449987f1f0c5232e19783ee79e3883d Mon Sep 17 00:00:00 2001 From: Darren Hart Date: Wed, 1 Feb 2012 16:15:04 -0800 Subject: bootimg: Use the same OS files for each boot method Fixes [YOCTO #1951] The do_bootimg code can generate hybrid efi+pcbios images (syslinux and grub-efi) to boot on platforms with both EFI and legacy BIOS options. The current implementation copies the kernel, initrd, and rootfs twice, unnecessarily bloating the image size. This is an especially egregious bug on -sato images. Update the classes to use a common install of the kernel, initrd, and rootfs to the root of the boot media. Grub-efi, syslinux, and isolinux can all reference this location explicitly with a leading slash. Tested with an EFI+PCBIOS image in both EFI and PCBIOS boot modes on two platforms. No ISO image testing was performed. (From OE-Core rev: 5209016cf4c4c8f649e37dc8857b3fbcfe8dd8c8) Signed-off-by: Darren Hart Signed-off-by: Richard Purdie --- meta/classes/grub-efi.bbclass | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'meta/classes/grub-efi.bbclass') diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass index 762322b28e..1efb43b805 100644 --- a/meta/classes/grub-efi.bbclass +++ b/meta/classes/grub-efi.bbclass @@ -22,39 +22,29 @@ GRUB_TIMEOUT ?= "10" GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1" EFIDIR = "/EFI/BOOT" -GRUB_HDDDIR = "${HDDDIR}${EFIDIR}" -GRUB_ISODIR = "${ISODIR}${EFIDIR}" grubefi_populate() { + # DEST must be the root of the image so that EFIDIR is not + # nested under a top level directory. DEST=$1 - install -d ${DEST} - - install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage ${DEST}/vmlinuz - - if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then - install -m 0644 ${INITRD} ${DEST}/initrd - fi - - if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then - install -m 0644 ${ROOTFS} ${DEST}/rootfs.img - fi + install -d ${DEST}${EFIDIR} GRUB_IMAGE="bootia32.efi" if [ "${TARGET_ARCH}" = "x86_64" ]; then GRUB_IMAGE="bootx64.efi" fi - install -m 0644 ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST} + install -m 0644 ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST}${EFIDIR} - install -m 0644 ${GRUBCFG} ${DEST} + install -m 0644 ${GRUBCFG} ${DEST}${EFIDIR} } grubefi_iso_populate() { - grubefi_populate ${GRUB_ISODIR} + grubefi_populate ${ISODIR} } grubefi_hddimg_populate() { - grubefi_populate ${GRUB_HDDDIR} + grubefi_populate ${HDDDIR} } python build_grub_cfg() { @@ -109,7 +99,7 @@ python build_grub_cfg() { bb.data.update_data(localdata) cfgfile.write('\nmenuentry \'%s\'{\n' % (label)) - cfgfile.write('linux ${EFIDIR}/vmlinuz LABEL=%s' % (label)) + cfgfile.write('linux /vmlinuz LABEL=%s' % (label)) append = localdata.getVar('APPEND', True) initrd = localdata.getVar('INITRD', True) @@ -119,7 +109,7 @@ python build_grub_cfg() { cfgfile.write('\n') if initrd: - cfgfile.write('initrd ${EFIDIR}/initrd') + cfgfile.write('initrd /initrd') cfgfile.write('\n}\n') cfgfile.close() -- cgit v1.2.3-54-g00ecf