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/syslinux.bbclass | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) (limited to 'meta/classes/syslinux.bbclass') diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass index 91c4275747..1569074b21 100644 --- a/meta/classes/syslinux.bbclass +++ b/meta/classes/syslinux.bbclass @@ -18,42 +18,34 @@ do_bootimg[depends] += "syslinux:do_populate_sysroot \ SYSLINUXCFG = "${S}/syslinux.cfg" SYSLINUXMENU = "${S}/menu" -SYSLINUX_ISODIR = "${ISODIR}/isolinux" -SYSLINUX_HDDDIR = "${HDDDIR}" +ISOLINUXDIR = "/isolinux" +SYSLINUXDIR = "/" ISO_BOOTIMG = "isolinux/isolinux.bin" ISO_BOOTCAT = "isolinux/boot.cat" MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table" syslinux_populate() { DEST=$1 - CFGNAME=$2 + BOOTDIR=$2 + CFGNAME=$3 - install -d ${DEST} - - # Install the kernel, initrd, and rootfs - 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}${BOOTDIR} # Install the config files - install -m 0644 ${SYSLINUXCFG} ${DEST}/${CFGNAME} + install -m 0644 ${SYSLINUXCFG} ${DEST}${BOOTDIR}/${CFGNAME} if [ -f ${SYSLINUXMENU} ]; then - install -m 0644 ${SYSLINUXMENU} ${DEST} + install -m 0644 ${SYSLINUXMENU} ${DEST}${BOOTDIR} fi } syslinux_iso_populate() { - syslinux_populate ${SYSLINUX_ISODIR} isolinux.cfg - install -m 0644 ${STAGING_LIBDIR}/syslinux/isolinux.bin ${SYSLINUX_ISODIR} + syslinux_populate ${ISODIR} ${ISOLINUXDIR} isolinux.cfg + install -m 0644 ${STAGING_LIBDIR}/syslinux/isolinux.bin ${ISODIR}${ISOLINUXDIR} } syslinux_hddimg_populate() { - syslinux_populate ${SYSLINUX_HDDDIR} syslinux.cfg - install -m 0444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${SYSLINUX_HDDDIR}/ldlinux.sys + syslinux_populate ${HDDDIR} ${SYSLINUXDIR} syslinux.cfg + install -m 0444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${HDDDIR}${SYSLINUXDIR}/ldlinux.sys } syslinux_hddimg_install() { @@ -187,7 +179,7 @@ python build_syslinux_cfg () { localdata.setVar('OVERRIDES', label + ':' + overrides) bb.data.update_data(localdata) - cfgfile.write('LABEL %s\nKERNEL vmlinuz\n' % (label)) + cfgfile.write('LABEL %s\nKERNEL /vmlinuz\n' % (label)) append = localdata.getVar('APPEND', 1) initrd = localdata.getVar('INITRD', 1) @@ -196,7 +188,7 @@ python build_syslinux_cfg () { cfgfile.write('APPEND ') if initrd: - cfgfile.write('initrd=initrd ') + cfgfile.write('initrd=/initrd ') cfgfile.write('LABEL=%s '% (label)) -- cgit v1.2.3-54-g00ecf