From 5209016cf4c4c8f649e37dc8857b3fbcfe8dd8c8 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. Signed-off-by: Darren Hart --- meta/classes/bootimg.bbclass | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'meta/classes/bootimg.bbclass') diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass index a717600cf..1d1a3d04a 100644 --- a/meta/classes/bootimg.bbclass +++ b/meta/classes/bootimg.bbclass @@ -8,13 +8,13 @@ # End result is two things: # # 1. A .hddimg file which is an msdos filesystem containing syslinux, a kernel, -# an initrd and a rootfs image. These can be written to harddisks directly and +# an initrd and a rootfs image. These can be written to harddisks directly and # also booted on USB flash disks (write them there with dd). # # 2. A CD .iso image -# Boot process is that the initrd will boot and process which label was selected -# in syslinux. Actions based on the label are then performed (e.g. installing to +# Boot process is that the initrd will boot and process which label was selected +# in syslinux. Actions based on the label are then performed (e.g. installing to # an hdd) # External variables (also used by syslinux.bbclass) @@ -29,8 +29,8 @@ do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \ PACKAGES = " " EXCLUDE_FROM_WORLD = "1" -HDDDIR = "${S}/hdd/boot" -ISODIR = "${S}/cd" +HDDDIR = "${S}/hddimg" +ISODIR = "${S}/iso" BOOTIMG_VOLUME_ID ?= "boot" BOOTIMG_EXTRA_SPACE ?= "512" @@ -58,6 +58,22 @@ PCBIOS_CLASS = ${@pcbios_class(d)} inherit ${PCBIOS_CLASS} inherit ${EFI_CLASS} +populate() { + DEST=$1 + install -d ${DEST} + + # Install bzImage, initrd, and rootfs.img in DEST for all loaders to use. + 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 + +} build_iso() { # Only create an ISO if we have an INITRD and NOISO was not set @@ -66,7 +82,7 @@ build_iso() { return fi - install -d ${ISODIR} + populate ${ISODIR} if [ "${PCBIOS}" = "1" ]; then syslinux_iso_populate @@ -95,7 +111,8 @@ build_iso() { build_hddimg() { # Create an HDD image if [ "${NOHDD}" != "1" ] ; then - install -d ${HDDDIR} + populate ${HDDDIR} + if [ "${PCBIOS}" = "1" ]; then syslinux_hddimg_populate fi -- cgit v1.2.3