1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

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 <dvhart@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Darren Hart
2012-02-01 16:15:04 -08:00
committed by Richard Purdie
parent 50a097be16
commit 67cfa74744
3 changed files with 46 additions and 47 deletions
+9 -19
View File
@@ -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()