Improved EFI boot support
v2 cover Improved EFI boot support
V2
- Added reference to YOCTO #1913 for per Darren
- Remove PR number from cdrtools uprev
- Added Saul's change to cdrtools to get rid of STAGE_TEMP
- made the builtin grub cfg file copied from a SRC_URI
- upreved syslinux to 6.01
- Use the new isohybrid command from syslinux which can now generate EFI enabled ISO's which can boot directly when dd'ed to a USB or HDD device.
- Dropped any references to efi or pcbios in the qemu* configs
- Added the zisofs patch to the end of the series instead of depending on it, in case it is dropped later.
- git -format-patch -M20% is your friend for seeing the delta on recipe upgrades :-)
YAY, with the new version of syslinux it is now possible to build a single live ISO image which can boot in legacy mode or EFI on optical media or USB devices.
We still have to create 2 ISO's one for 32bit EFI systems and one for 64bit EFI systems but this is also true of all other Linux distributions today as well.
Jason.
---
The goal of this patch set is to put the EFI ISO boot method on par with the ISO PCBIOS boot method. This also allows for the creation of a single ISO image which can boot in "legacy boot" mode or EFI boot mode.
In order to make this possible the cdrtools needed an update to the very latest and this brings in an license change. Given that change it was not entirely clear to me if we needed to leave the older package around. I opted to remove the older package recipe since there was no clean way to fail in the case you wanted to build EFI boot media.
The bbnote that was previously in the bootimg.bbclass about EFI only media being untested was a bit of an understatement, as the images would not even build without errors due to the call to isohybrid. I removed any such warnings because that path has been fully vetted now.
Cheers,
Jason.
----------------------------------------------------------------
The following changes since commit b26157a8b575aa7b5c96ffe782fc23ec0920311c:
libnewt-python: Don't write a whiptail package (2013-09-12 08:23:35 +0100)
are available in the git repository at:
. master
for you to fetch changes up to a0d1b567277fdf370cc121720c0c4f30839da01b:
bootimage.bbclass, zisofs-tools-native: add ability to compress ISO images (2013-09-13 19:05:37 -0500)
----------------------------------------------------------------
Jason Wessel (7):
bootimage.bbclass: Move fat image creation into a function
cdrtools-native: Update from 3.00 to 3.01a17
grub-efi-native: Add support for EFI ISO images syslinux.bbclass,syslinux: Update to syslinux 6.01 bootimage.bbclass,grub-efi.bbclass: Improve EFI & PCBIOS+EFI ISO support grub-efi.bbclass: Add serial and graphics menu options bootimage.bbclass, zisofs-tools-native: add ability to compress ISO images
meta/classes/bootimg.bbclass | 165 ++++++++++++--------
meta/classes/grub-efi.bbclass | 49 ++++--
meta/classes/syslinux.bbclass | 1 +
meta/recipes-bsp/grub/files/cfg | 2 +
meta/recipes-bsp/grub/grub-efi-native_2.00.bb | 7 +-
.../cdrtools/cdrtools-native_3.00.bb | 30 ----
.../cdrtools/cdrtools-native_3.01a17.bb | 24 +++
.../{syslinux_4.07.bb => syslinux_6.01.bb} | 26 +--
.../zisofs-tools/zisofs-tools-native_1.0.8.bb | 19 +++
9 files changed, 201 insertions(+), 122 deletions(-)
create mode 100644 meta/recipes-bsp/grub/files/cfg
delete mode 100644 meta/recipes-devtools/cdrtools/cdrtools-native_3.00.bb
create mode 100644 meta/recipes-devtools/cdrtools/cdrtools-native_3.01a17.bb
rename meta/recipes-devtools/syslinux/{syslinux_4.07.bb => syslinux_6.01.bb} (63%)
create mode 100644 meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bbPATCH v2 1/7 bootimage.bbclass: Move fat image creation into a function
In order to call the fat image creation multiple times it needs to be in its own function. A future commit will make use of the new function to additionally create EFI image files for use with an ISO.
[YOCTO #4100]
[YOCTO #1913]
--- meta/classes/bootimg.bbclass | 110 ++++++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 52 deletions(-)
meta/classes/bootimg.bbclass +58 -52
@@ -111,6 +111,63 @@ build_iso() { ln -s ${IMAGE_NAME}.iso ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso } +build_fat_img() { + FATSOURCEDIR=$1 + FATIMG=$2 + + # Calculate the size required for the final image including the + # data and filesystem overhead. + # Sectors: 512 bytes + # Blocks: 1024 bytes + + # Determine the sector count just for the data + SECTORS=$(expr $(du --apparent-size -ks ${FATSOURCEDIR} | cut -f 1) \* 2) + + # Account for the filesystem overhead. This includes directory + # entries in the clusters as well as the FAT itself. + # Assumptions: + # FAT32 (12 or 16 may be selected by mkdosfs, but the extra + # padding will be minimal on those smaller images and not + # worth the logic here to caclulate the smaller FAT sizes) + # < 16 entries per directory + # 8.3 filenames only + + # 32 bytes per dir entry + DIR_BYTES=$(expr $(find ${FATSOURCEDIR} | tail -n +2 | wc -l) \* 32) + # 32 bytes for every end-of-directory dir entry + DIR_BYTES=$(expr $DIR_BYTES + $(expr $(find ${FATSOURCEDIR} -type d | tail -n +2 | wc -l) \* 32)) + # 4 bytes per FAT entry per sector of data + FAT_BYTES=$(expr $SECTORS \* 4) + # 4 bytes per FAT entry per end-of-cluster list + FAT_BYTES=$(expr $FAT_BYTES + $(expr $(find ${FATSOURCEDIR} -type d | tail -n +2 | wc -l) \* 4)) + + # Use a ceiling function to determine FS overhead in sectors + DIR_SECTORS=$(expr $(expr $DIR_BYTES + 511) / 512) + # There are two FATs on the image + FAT_SECTORS=$(expr $(expr $(expr $FAT_BYTES + 511) / 512) \* 2) + SECTORS=$(expr $SECTORS + $(expr $DIR_SECTORS + $FAT_SECTORS)) + + # Determine the final size in blocks accounting for some padding + BLOCKS=$(expr $(expr $SECTORS / 2) + ${BOOTIMG_EXTRA_SPACE}) + + # Ensure total sectors is an integral number of sectors per + # track or mcopy will complain. Sectors are 512 bytes, and we + # generate images with 32 sectors per track. This calculation is + # done in blocks, thus the mod by 16 instead of 32. + BLOCKS=$(expr $BLOCKS + $(expr 16 - $(expr $BLOCKS % 16))) + + # mkdosfs will sometimes use FAT16 when it is not appropriate, + # resulting in a boot failure from SYSLINUX. Use FAT32 for + # images larger than 512MB, otherwise let mkdosfs decide. + if [ $(expr $BLOCKS / 1024) -gt 512 ]; then + FATSIZE="-F 32" + fi + + mkdosfs ${FATSIZE} -n ${BOOTIMG_VOLUME_ID} -S 512 -C ${FATIMG} ${BLOCKS} + # Copy FATSOURCEDIR recursively into the image file directly + mcopy -i ${FATIMG} -s ${FATSOURCEDIR}/* ::/ +} + build_hddimg() { # Create an HDD image if [ "${NOHDD}" != "1" ] ; then
@@ -123,58 +180,7 @@ build_hddimg() { grubefi_hddimg_populate fi - # Calculate the size required for the final image including the - # data and filesystem overhead. - # Sectors: 512 bytes - # Blocks: 1024 bytes - - # Determine the sector count just for the data - SECTORS=$(expr $(du --apparent-size -ks ${HDDDIR} | cut -f 1) \* 2) - - # Account for the filesystem overhead. This includes directory - # entries in the clusters as well as the FAT itself. - # Assumptions: - # FAT32 (12 or 16 may be selected by mkdosfs, but the extra - # padding will be minimal on those smaller images and not - # worth the logic here to caclulate the smaller FAT sizes) - # < 16 entries per directory - # 8.3 filenames only - - # 32 bytes per dir entry - DIR_BYTES=$(expr $(find ${HDDDIR} | tail -n +2 | wc -l) \* 32) - # 32 bytes for every end-of-directory dir entry - DIR_BYTES=$(expr $DIR_BYTES + $(expr $(find ${HDDDIR} -type d | tail -n +2 | wc -l) \* 32)) - # 4 bytes per FAT entry per sector of data - FAT_BYTES=$(expr $SECTORS \* 4) - # 4 bytes per FAT entry per end-of-cluster list - FAT_BYTES=$(expr $FAT_BYTES + $(expr $(find ${HDDDIR} -type d | tail -n +2 | wc -l) \* 4)) - - # Use a ceiling function to determine FS overhead in sectors - DIR_SECTORS=$(expr $(expr $DIR_BYTES + 511) / 512) - # There are two FATs on the image - FAT_SECTORS=$(expr $(expr $(expr $FAT_BYTES + 511) / 512) \* 2) - SECTORS=$(expr $SECTORS + $(expr $DIR_SECTORS + $FAT_SECTORS)) - - # Determine the final size in blocks accounting for some padding - BLOCKS=$(expr $(expr $SECTORS / 2) + ${BOOTIMG_EXTRA_SPACE}) - - # Ensure total sectors is an integral number of sectors per - # track or mcopy will complain. Sectors are 512 bytes, and we - # generate images with 32 sectors per track. This calculation is - # done in blocks, thus the mod by 16 instead of 32. - BLOCKS=$(expr $BLOCKS + $(expr 16 - $(expr $BLOCKS % 16))) - - # mkdosfs will sometimes use FAT16 when it is not appropriate, - # resulting in a boot failure from SYSLINUX. Use FAT32 for - # images larger than 512MB, otherwise let mkdosfs decide. - if [ $(expr $BLOCKS / 1024) -gt 512 ]; then - FATSIZE="-F 32" - fi - - IMG=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg - mkdosfs ${FATSIZE} -n ${BOOTIMG_VOLUME_ID} -S 512 -C ${IMG} ${BLOCKS} - # Copy HDDDIR recursively into the image file directly - mcopy -i ${IMG} -s ${HDDDIR}/* ::/ + build_fat_img ${HDDDIR} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg if [ "${PCBIOS}" = "1" ]; then syslinux_hddimg_install
Signature · 1 line
1.7.9.5
Re: [v2 PATCH 1/7] bootimage.bbclass: Move fat image creation into a function
Quoted 8 lines · Jason Wessel
In order to call the fat image creation multiple times it needs to be in its own function. A future commit will make use of the new function to additionally create EFI image files for use with an ISO.
[YOCTO #4100]
[YOCTO #1913]Signed-off-by Jason Wessel <[email protected]>
Looks good, thanks Jason!
Quoted 132 lines
--- meta/classes/bootimg.bbclass | 110 ++++++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 52 deletions(-)meta/classes/bootimg.bbclass +58
-52@@ -111,6 +111,63 @@ build_iso() { ln -s ${IMAGE_NAME}.iso ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso } +build_fat_img() { + FATSOURCEDIR=$1 + FATIMG=$2 + + # Calculate the size required for the final image including the + # data and filesystem overhead. + # Sectors: 512 bytes + # Blocks: 1024 bytes + + # Determine the sector count just for the data + SECTORS=$(expr $(du --apparent-size -ks ${FATSOURCEDIR} | cut -f 1) \* 2) + + # Account for the filesystem overhead. This includes directory + # entries in the clusters as well as the FAT itself. + # Assumptions: + # FAT32 (12 or 16 may be selected by mkdosfs, but the extra + # padding will be minimal on those smaller images and not + # worth the logic here to caclulate the smaller FAT sizes) + # < 16 entries per directory + # 8.3 filenames only + + # 32 bytes per dir entry + DIR_BYTES=$(expr $(find ${FATSOURCEDIR} | tail -n +2 | wc -l) \* 32) + # 32 bytes for every end-of-directory dir entry + DIR_BYTES=$(expr $DIR_BYTES + $(expr $(find ${FATSOURCEDIR} -type d | tail -n +2 | wc -l) \* 32)) + # 4 bytes per FAT entry per sector of data + FAT_BYTES=$(expr $SECTORS \* 4) + # 4 bytes per FAT entry per end-of-cluster list + FAT_BYTES=$(expr $FAT_BYTES + $(expr $(find ${FATSOURCEDIR} -type d | tail -n +2 | wc -l) \* 4)) + + # Use a ceiling function to determine FS overhead in sectors + DIR_SECTORS=$(expr $(expr $DIR_BYTES + 511) / 512) + # There are two FATs on the image + FAT_SECTORS=$(expr $(expr $(expr $FAT_BYTES + 511) / 512) \* 2) + SECTORS=$(expr $SECTORS + $(expr $DIR_SECTORS + $FAT_SECTORS)) + + # Determine the final size in blocks accounting for some padding + BLOCKS=$(expr $(expr $SECTORS / 2) + ${BOOTIMG_EXTRA_SPACE}) + + # Ensure total sectors is an integral number of sectors per + # track or mcopy will complain. Sectors are 512 bytes, and we + # generate images with 32 sectors per track. This calculation is + # done in blocks, thus the mod by 16 instead of 32. + BLOCKS=$(expr $BLOCKS + $(expr 16 - $(expr $BLOCKS % 16))) + + # mkdosfs will sometimes use FAT16 when it is not appropriate, + # resulting in a boot failure from SYSLINUX. Use FAT32 for + # images larger than 512MB, otherwise let mkdosfs decide. + if [ $(expr $BLOCKS / 1024) -gt 512 ]; then + FATSIZE="-F 32" + fi + + mkdosfs ${FATSIZE} -n ${BOOTIMG_VOLUME_ID} -S 512 -C ${FATIMG} ${BLOCKS} + # Copy FATSOURCEDIR recursively into the image file directly + mcopy -i ${FATIMG} -s ${FATSOURCEDIR}/* ::/ +} + build_hddimg() { # Create an HDD image if [ "${NOHDD}" != "1" ] ; then@@ -123,58 +180,7 @@ build_hddimg() { grubefi_hddimg_populate fi - # Calculate the size required for the final image including the - # data and filesystem overhead. - # Sectors: 512 bytes - # Blocks: 1024 bytes - - # Determine the sector count just for the data - SECTORS=$(expr $(du --apparent-size -ks ${HDDDIR} | cut -f 1) \* 2) - - # Account for the filesystem overhead. This includes directory - # entries in the clusters as well as the FAT itself. - # Assumptions: - # FAT32 (12 or 16 may be selected by mkdosfs, but the extra - # padding will be minimal on those smaller images and not - # worth the logic here to caclulate the smaller FAT sizes) - # < 16 entries per directory - # 8.3 filenames only - - # 32 bytes per dir entry - DIR_BYTES=$(expr $(find ${HDDDIR} | tail -n +2 | wc -l) \* 32) - # 32 bytes for every end-of-directory dir entry - DIR_BYTES=$(expr $DIR_BYTES + $(expr $(find ${HDDDIR} -type d | tail -n +2 | wc -l) \* 32)) - # 4 bytes per FAT entry per sector of data - FAT_BYTES=$(expr $SECTORS \* 4) - # 4 bytes per FAT entry per end-of-cluster list - FAT_BYTES=$(expr $FAT_BYTES + $(expr $(find ${HDDDIR} -type d | tail -n +2 | wc -l) \* 4)) - - # Use a ceiling function to determine FS overhead in sectors - DIR_SECTORS=$(expr $(expr $DIR_BYTES + 511) / 512) - # There are two FATs on the image - FAT_SECTORS=$(expr $(expr $(expr $FAT_BYTES + 511) / 512) \* 2) - SECTORS=$(expr $SECTORS + $(expr $DIR_SECTORS + $FAT_SECTORS)) - - # Determine the final size in blocks accounting for some padding - BLOCKS=$(expr $(expr $SECTORS / 2) + ${BOOTIMG_EXTRA_SPACE}) - - # Ensure total sectors is an integral number of sectors per - # track or mcopy will complain. Sectors are 512 bytes, and we - # generate images with 32 sectors per track. This calculation is - # done in blocks, thus the mod by 16 instead of 32. - BLOCKS=$(expr $BLOCKS + $(expr 16 - $(expr $BLOCKS % 16))) - - # mkdosfs will sometimes use FAT16 when it is not appropriate, - # resulting in a boot failure from SYSLINUX. Use FAT32 for - # images larger than 512MB, otherwise let mkdosfs decide. - if [ $(expr $BLOCKS / 1024) -gt 512 ]; then - FATSIZE="-F 32" - fi - - IMG=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg - mkdosfs ${FATSIZE} -n ${BOOTIMG_VOLUME_ID} -S 512 -C ${IMG} ${BLOCKS} - # Copy HDDDIR recursively into the image file directly - mcopy -i ${IMG} -s ${HDDDIR}/* ::/ + build_fat_img ${HDDDIR} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg if [ "${PCBIOS}" = "1" ]; then syslinux_hddimg_install
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel
PATCH v2 2/7 cdrtools-native: Update from 3.00 to 3.01a17
In reply to Jason WesselThe update is needed to support generation of EFI boot images that work with optical media. Specifically the "-eltorito-platform efi" capability for mkisofs is needed.
[YOCTO #4100]
---
...s-native_3.00.bb => cdrtools-native_3.01a17.bb} | 22 +++++++-------------
1 file changed, 8 insertions(+), 14 deletions(-)
rename meta/recipes-devtools/cdrtools/{cdrtools-native_3.00.bb => cdrtools-native_3.01a17.bb} (47%)meta/recipes-devtools/cdrtools/cdrtools-native_3.01a17.bb renamed from meta/recipes-devtools/cdrtools/cdrtools-native_3.00.bb +8 -14
@@ -5,26 +5,20 @@ SUMMARY = "A set of tools for CD recording, including cdrecord" DESCRIPTION = "A set of tools for CD recording, including cdrecord" HOMEPAGE = "http://cdrecord.berlios.de/private/cdrecord.html" SECTION = "console/utils" -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://COPYING;md5=8d16123ffd39e649a5e4a6bc1de60e6d" -PR = "r0" +LICENSE = "GPLv2 & CDDL-1.0 & LGPLv2.1+" +LIC_FILES_CHKSUM = "file://COPYING;md5=32f68170be424c2cd64804337726b312" -SRC_URI = "ftp://ftp.berlios.de/pub/cdrecord/cdrtools-${PV}.tar.bz2 \ - file://no_usr_src.patch" +SRC_URI = "ftp://ftp.berlios.de/pub/cdrecord/alpha/cdrtools-${PV}.tar.bz2" -SRC_URI[md5sum] = "f9fbab08fbd458b0d2312976d8c5f558" -SRC_URI[sha256sum] = "7f9cb64820055573b880f77b2f16662a512518336ba95ab49228a1617973423d" +SRC_URI[md5sum] = "4cef9db0cf15a770c52d65b00bbee2db" +SRC_URI[sha256sum] = "3d613965b213ad83e4be0ba2535e784901839ea4d11a20a2beb6765f0eb76dfa" -inherit native +S = "${WORKDIR}/cdrtools-3.01" -STAGE_TEMP = "${WORKDIR}/image-temp" +inherit native FILESPATH = "${FILE_DIRNAME}/cdrtools-native/" do_install() { - install -d ${STAGE_TEMP} - make install INS_BASE=${STAGE_TEMP} - - install -d ${D}${bindir}/ - install ${STAGE_TEMP}/bin/* ${D}${bindir}/ + make install GMAKE_NOWARN=true INS_BASE=${prefix} DESTDIR=${D} }
Signature · 1 line
1.7.9.5
Re: [v2 PATCH 2/7] cdrtools-native: Update from 3.00 to 3.01a17
Quoted 7 lines · Jason Wessel
The update is needed to support generation of EFI boot images that work with optical media. Specifically the "-eltorito-platform efi" capability for mkisofs is needed.
[YOCTO #4100]
Signed-off-by Jason Wessel <[email protected]>
Quoted 47 lines
--- ...s-native_3.00.bb => cdrtools-native_3.01a17.bb} | 22 +++++++------------- 1 file changed, 8 insertions(+), 14 deletions(-) rename meta/recipes-devtools/cdrtools/{cdrtools-native_3.00.bb => cdrtools-native_3.01a17.bb} (47%)meta/recipes-devtools/cdrtools/cdrtools-native_3.01a17.bb renamed from meta/recipes-devtools/cdrtools/cdrtools-native_3.00.bb +8
-14@@ -5,26 +5,20 @@ SUMMARY = "A set of tools for CD recording, including cdrecord" DESCRIPTION = "A set of tools for CD recording, including cdrecord" HOMEPAGE = "http://cdrecord.berlios.de/private/cdrecord.html" SECTION = "console/utils" -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://COPYING;md5=8d16123ffd39e649a5e4a6bc1de60e6d" -PR = "r0" +LICENSE = "GPLv2 & CDDL-1.0 & LGPLv2.1+" +LIC_FILES_CHKSUM = "file://COPYING;md5=32f68170be424c2cd64804337726b312" -SRC_URI = "ftp://ftp.berlios.de/pub/cdrecord/cdrtools-${PV}.tar.bz2 \ - file://no_usr_src.patch" +SRC_URI = "ftp://ftp.berlios.de/pub/cdrecord/alpha/cdrtools-${PV}.tar.bz2" -SRC_URI[md5sum] = "f9fbab08fbd458b0d2312976d8c5f558" -SRC_URI[sha256sum] = "7f9cb64820055573b880f77b2f16662a512518336ba95ab49228a1617973423d" +SRC_URI[md5sum] = "4cef9db0cf15a770c52d65b00bbee2db" +SRC_URI[sha256sum] = "3d613965b213ad83e4be0ba2535e784901839ea4d11a20a2beb6765f0eb76dfa" -inherit native +S = "${WORKDIR}/cdrtools-3.01" -STAGE_TEMP = "${WORKDIR}/image-temp" +inherit native FILESPATH = "${FILE_DIRNAME}/cdrtools-native/" do_install() { - install -d ${STAGE_TEMP} - make install INS_BASE=${STAGE_TEMP} - - install -d ${D}${bindir}/ - install ${STAGE_TEMP}/bin/* ${D}${bindir}/ + make install GMAKE_NOWARN=true INS_BASE=${prefix} DESTDIR=${D} }
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel
PATCH v2 3/7 grub-efi-native: Add support for EFI ISO images
In reply to Jason WesselThe iso9660 file system support needs to be added to grub in order to be able to correctly find the grub.cfg. The grub commands to locate the grub.cfg also needs to be encoded into grub's default configuration.
This change allows the resulting grub binary to work both in the hard drive / USB boot case or the optical media boot case.
[YOCTO #4100]
--- meta/recipes-bsp/grub/files/cfg | 2 ++ meta/recipes-bsp/grub/grub-efi-native_2.00.bb | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 meta/recipes-bsp/grub/files/cfg
meta/recipes-bsp/grub/files/cfg new file +2 -0
@@ -0,0 +1,2 @@ +search.file /EFI/BOOT/grub.cfg root +set prefix=($root)/EFI/BOOT
meta/recipes-bsp/grub/grub-efi-native_2.00.bb +5 -2
@@ -23,6 +23,7 @@ PR = "r2" PN := "grub-efi-${TRANSLATED_TARGET_ARCH}-native" SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \ + file://cfg \ file://grub-2.00-fpmath-sse-387-fix.patch \ file://grub-2.00-fix-enable_execute_stack-check.patch \ file://grub-2.00-disable-help2man.patch \
@@ -66,9 +67,11 @@ EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \ --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no" do_mkimage() { - ./grub-mkimage -p /EFI/BOOT -d ./grub-core/ \ + # Search for the grub.cfg on the local boot media by using the + # built in cfg file provided via this recipe + ./grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \ -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \ - boot linux ext2 fat serial part_msdos part_gpt normal efi_gop + boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search } addtask mkimage after do_compile before do_install
Signature · 1 line
1.7.9.5
Re: [v2 PATCH 3/7] grub-efi-native: Add support for EFI ISO images
Quoted 11 lines · Jason Wessel
The iso9660 file system support needs to be added to grub in order to be able to correctly find the grub.cfg. The grub commands to locate the grub.cfg also needs to be encoded into grub's default configuration.
This change allows the resulting grub binary to work both in the hard drive / USB boot case or the optical media boot case.
[YOCTO #4100]
Signed-off-by Jason Wessel <[email protected]>
Quoted 40 lines
--- meta/recipes-bsp/grub/files/cfg | 2 ++ meta/recipes-bsp/grub/grub-efi-native_2.00.bb | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 meta/recipes-bsp/grub/files/cfgmeta/recipes-bsp/grub/files/cfg new file +2
-0@@ -0,0 +1,2 @@ +search.file /EFI/BOOT/grub.cfg root +set prefix=($root)/EFI/BOOTmeta/recipes-bsp/grub/grub-efi-native_2.00.bb +5
-2@@ -23,6 +23,7 @@ PR = "r2" PN := "grub-efi-${TRANSLATED_TARGET_ARCH}-native" SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \ + file://cfg \ file://grub-2.00-fpmath-sse-387-fix.patch \ file://grub-2.00-fix-enable_execute_stack-check.patch \ file://grub-2.00-disable-help2man.patch \@@ -66,9 +67,11 @@ EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \ --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no" do_mkimage() { - ./grub-mkimage -p /EFI/BOOT -d ./grub-core/ \ + # Search for the grub.cfg on the local boot media by using the + # built in cfg file provided via this recipe + ./grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \ -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \ - boot linux ext2 fat serial part_msdos part_gpt normal efi_gop + boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search } addtask mkimage after do_compile before do_install
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel
PATCH v2 4/7 syslinux.bbclass, syslinux: Update to syslinux 6.01
In reply to Jason WesselA newer version of syslinux is required for an EFI enabled isohybrid. This is used for the the capability to generate 3 types of ISO images, all of which can be booted off a USB device or HDD if copied with dd.
1) PC BIOS only ISO
2) EFI only ISO
3) EFI + PC BIOS ISO
The syslinux.bbclass required a minor tweak because ldlinux.c32 is dynamically loaded and needs to be in the created media as of syslinux 5 and up.
[YOCTO #4100]
---
meta/classes/syslinux.bbclass | 1 +
.../{syslinux_4.07.bb => syslinux_6.01.bb} | 26 ++++++++++++--------
2 files changed, 17 insertions(+), 10 deletions(-)
rename meta/recipes-devtools/syslinux/{syslinux_4.07.bb => syslinux_6.01.bb} (63%)meta/classes/syslinux.bbclass +1 -0
@@ -41,6 +41,7 @@ syslinux_populate() { syslinux_iso_populate() { syslinux_populate ${ISODIR} ${ISOLINUXDIR} isolinux.cfg install -m 0644 ${STAGING_DATADIR}/syslinux/isolinux.bin ${ISODIR}${ISOLINUXDIR} + install -m 0644 ${STAGING_DATADIR}/syslinux/ldlinux.c32 ${ISODIR}${ISOLINUXDIR} if [ "${AUTO_SYSLINUXMENU}" = 1 ] ; then install -m 0644 ${STAGING_DATADIR}/syslinux/vesamenu.c32 ${ISODIR}${ISOLINUXDIR}/vesamenu.c32 if [ "${SYSLINUX_SPLASH}" != "" ] ; then
meta/recipes-devtools/syslinux/syslinux_6.01.bb renamed from meta/recipes-devtools/syslinux/syslinux_4.07.bb +16 -10
@@ -2,19 +2,21 @@ DESCRIPTION = "A multi-purpose linux bootloader" HOMEPAGE = "http://syslinux.zytor.com/" LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \ - file://README;beginline=35;endline=41;md5=f7249a750bc692d1048b2626752aa415" + file://README;beginline=35;endline=41;md5=558f2c71cb1fb9ba511ccd4858e48e8a" # If you really want to run syslinux, you need mtools. We just want the # ldlinux.* stuff for now, so skip mtools-native DEPENDS = "nasm-native util-linux" -PR = "r0" -SRC_URI = "${KERNELORG_MIRROR}/linux/utils/boot/syslinux/4.xx/syslinux-${PV}.tar.bz2" +SRC_URI = "${KERNELORG_MIRROR}/linux/utils/boot/syslinux/6.xx/syslinux-${PV}.tar.bz2" -SRC_URI[md5sum] = "9ff6e1b94efab931fb4717b600d88779" -SRC_URI[sha256sum] = "1240a4e4219b518bdaef78931b6e901befeff35e6894ac6db785115848a7a05a" +SRC_URI[md5sum] = "6945ee89e29119d459baed4937bbc534" +SRC_URI[sha256sum] = "83a04cf81e6a46b80ee5a321926eea095af3498b04317e3674b46c125c7a5b43" COMPATIBLE_HOST = '(x86_64|i.86).*-(linux|freebsd.*)' +# Don't let the sanity checker trip on the 32 bit real mode BIOS binaries +INSANE_SKIP_${PN}-misc = "arch" +INSANE_SKIP_${PN}-chain = "arch" EXTRA_OEMAKE = " \ BINDIR=${bindir} SBINDIR=${sbindir} LIBDIR=${libdir} \
@@ -28,21 +30,25 @@ do_configure() { sed -e 's,win32/\S*,,g' -i Makefile # clean installer executables included in source tarball - oe_runmake clean + oe_runmake clean firmware="efi32" EFIINC="${includedir}" + # NOTE: There is a temporary work around above to specify + # the efi32 as the firmware else the pre-built bios + # files get erased contrary to the doc/distib.txt + # In the future this should be "bios" and not "efi32". } do_compile() { # Rebuild only the installer; keep precompiled bootloaders # as per author's request (doc/distrib.txt) - oe_runmake CC="${CC} ${CFLAGS}" LDFLAGS="${LDFLAGS}" installer + oe_runmake CC="${CC} ${CFLAGS}" LDFLAGS="${LDFLAGS}" firmware="bios" installer } do_install() { - oe_runmake install INSTALLROOT="${D}" + oe_runmake install INSTALLROOT="${D}" firmware="bios" install -d ${D}${datadir}/syslinux/ - install -m 644 ${S}/core/ldlinux.sys ${D}${datadir}/syslinux/ - install -m 644 ${S}/core/ldlinux.bss ${D}${datadir}/syslinux/ + install -m 644 ${S}/bios/core/ldlinux.sys ${D}${datadir}/syslinux/ + install -m 644 ${S}/bios/core/ldlinux.bss ${D}${datadir}/syslinux/ } PACKAGES += "${PN}-extlinux ${PN}-mbr ${PN}-chain ${PN}-pxelinux ${PN}-isolinux ${PN}-misc"
Signature · 1 line
1.7.9.5
Re: [v2 PATCH 4/7] syslinux.bbclass, syslinux: Update to syslinux 6.01
Quoted 11 lines · Jason Wessel
A newer version of syslinux is required for an EFI enabled isohybrid. This is used for the the capability to generate 3 types of ISO images, all of which can be booted off a USB device or HDD if copied with dd.
1) PC BIOS only ISO
2) EFI only ISO
3) EFI + PC BIOS ISOThe syslinux.bbclass required a minor tweak because ldlinux.c32 is dynamically loaded and needs to be in the created media as of syslinux 5 and up.
Hi Jason,
can you please look at
https://bugzilla.yoctoproject.org/show_bug.cgi?id=3944
?
Quoted 10 lines
[YOCTO #4100]
Signed-off-by Jason Wessel <[email protected]>--- meta/classes/syslinux.bbclass | 1 + .../{syslinux_4.07.bb => syslinux_6.01.bb} | 26 ++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) rename meta/recipes-devtools/syslinux/{syslinux_4.07.bb => syslinux_6.01.bb} (63%)
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
Re: [v2 PATCH 4/7] syslinux.bbclass, syslinux: Update to syslinux 6.01
Quoted 13 lines · Martin Jansa
Quoted 11 lines · Jason Wessel
A newer version of syslinux is required for an EFI enabled isohybrid. This is used for the the capability to generate 3 types of ISO images, all of which can be booted off a USB device or HDD if copied with dd.
1) PC BIOS only ISO
2) EFI only ISO
3) EFI + PC BIOS ISOThe syslinux.bbclass required a minor tweak because ldlinux.c32 is dynamically loaded and needs to be in the created media as of syslinux 5 and up.
Quoted 5 lines
Hi Jason,
can you please look at
https://bugzilla.yoctoproject.org/show_bug.cgi?id=3944
?
I can look at fixing the defect, but there is no description of how to use the directdisk to see the problem. Could you provide an example?
I added the directdisk to IMAGE_FSTYPES, but didn't get a .directdisk in the deploy directory so that is not how it works. Also I think the right solution is to simply call syslinux_hddimg_populate() from the directdisk class vs having copied code for the install of the syslinux specific files (that is how 1/2 the problem occurred in the first place).
Back to this particular patch, the ldlinux.c32 change does not affect the bootdirect class. The ldlinux.c32 is only required for isolinux and the copy is contained with in the inherited syslinux class.
Cheers,
Jason.
Re: [v2 PATCH 4/7] syslinux.bbclass, syslinux: Update to syslinux 6.01
Quoted 21 lines · Jason Wessel
Quoted 13 lines · Martin Jansa
Quoted 11 lines · Jason Wessel
A newer version of syslinux is required for an EFI enabled isohybrid. This is used for the the capability to generate 3 types of ISO images, all of which can be booted off a USB device or HDD if copied with dd.
1) PC BIOS only ISO
2) EFI only ISO
3) EFI + PC BIOS ISOThe syslinux.bbclass required a minor tweak because ldlinux.c32 is dynamically loaded and needs to be in the created media as of syslinux 5 and up.
Quoted 5 lines
Hi Jason,
can you please look at
https://bugzilla.yoctoproject.org/show_bug.cgi?id=3944
?
Quoted 5 lines
I can look at fixing the defect, but there is no description of how to use the directdisk to see the problem. Could you provide an example?
I added the directdisk to
IMAGE_FSTYPES, but didn't get a .directdisk in the deploy directory so that is not how it works. Also I think the right solution is to simply callsyslinux_hddimg_populate()from the directdisk class vs having copied code for the install of the syslinux specific files (that is how 1/2 the problem occurred in the first place).Back to this particular patch, the ldlinux.c32 change does not affect the bootdirect class. The ldlinux.c32 is only required for isolinux and the copy is contained with in the inherited syslinux class.
You can reproduce it by adding vmdk to IMAGE_FSTYPES and building e.g. qemux86 and trying to boot it in VirtualBox.
It will always enable tty0 and only way to disable it now is to enable menu, but that doesn't work with vmdk images because of missing vesamenu.c32
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
Re: [v2 PATCH 4/7] syslinux.bbclass, syslinux: Update to syslinux 6.01
Quoted 26 lines · Martin Jansa
Quoted 25 lines · Jason Wessel
Quoted 13 lines · Martin Jansa
Quoted 11 lines · Jason Wessel
A newer version of syslinux is required for an EFI enabled isohybrid. This is used for the the capability to generate 3 types of ISO images, all of which can be booted off a USB device or HDD if copied with dd.
1) PC BIOS only ISO
2) EFI only ISO
3) EFI + PC BIOS ISOThe syslinux.bbclass required a minor tweak because ldlinux.c32 is dynamically loaded and needs to be in the created media as of syslinux 5 and up.
Quoted 5 lines
Hi Jason,
can you please look at
https://bugzilla.yoctoproject.org/show_bug.cgi?id=3944
?I can look at fixing the defect, but there is no description of how to use the directdisk to see the problem. Could you provide an example?
I added the directdisk to
IMAGE_FSTYPES, but didn't get a .directdisk in the deploy directory so that is not how it works. Also I think the right solution is to simply callsyslinux_hddimg_populate()from the directdisk class vs having copied code for the install of the syslinux specific files (that is how 1/2 the problem occurred in the first place).
Quoted 9 lines
Quoted 1 line
Back to this particular patch, the ldlinux.c32 change does not affect the bootdirect class. The ldlinux.c32 is only required for isolinux and the copy is contained with in the inherited syslinux class.
You can reproduce it by adding vmdk to
IMAGE_FSTYPESand building e.g. qemux86 and trying to boot it in VirtualBox.It will always enable tty0 and only way to disable it now is to enable menu, but that doesn't work with vmdk images because of missing vesamenu.c32
Thanks for catching that Martin.
I agree that the SYSLINUX_SERIAL needs to be respected regardless of if menu is set.
It should be acceptable to install vesamenu.c32 I would think, although it sounds as though there is some work to perform to make sure bootdirect uses all the new infrastructure as well.
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel
Re: [v2 PATCH 4/7] syslinux.bbclass, syslinux: Update to syslinux 6.01
Quoted 37 lines · Darren Hart
Quoted 26 lines · Martin Jansa
Quoted 25 lines · Jason Wessel
Quoted 13 lines · Martin Jansa
Quoted 11 lines · Jason Wessel
A newer version of syslinux is required for an EFI enabled isohybrid. This is used for the the capability to generate 3 types of ISO images, all of which can be booted off a USB device or HDD if copied with dd.
1) PC BIOS only ISO
2) EFI only ISO
3) EFI + PC BIOS ISOThe syslinux.bbclass required a minor tweak because ldlinux.c32 is dynamically loaded and needs to be in the created media as of syslinux 5 and up.
Quoted 5 lines
Hi Jason,
can you please look at
https://bugzilla.yoctoproject.org/show_bug.cgi?id=3944
?I can look at fixing the defect, but there is no description of how to use the directdisk to see the problem. Could you provide an example?
I added the directdisk to
IMAGE_FSTYPES, but didn't get a .directdisk in the deploy directory so that is not how it works. Also I think the right solution is to simply callsyslinux_hddimg_populate()from the directdisk class vs having copied code for the install of the syslinux specific files (that is how 1/2 the problem occurred in the first place).Quoted 9 lines
Quoted 1 line
Back to this particular patch, the ldlinux.c32 change does not affect the bootdirect class. The ldlinux.c32 is only required for isolinux and the copy is contained with in the inherited syslinux class.
You can reproduce it by adding vmdk to
IMAGE_FSTYPESand building e.g. qemux86 and trying to boot it in VirtualBox.It will always enable tty0 and only way to disable it now is to enable menu, but that doesn't work with vmdk images because of missing vesamenu.c32
Quoted 4 lines
Thanks for catching that Martin.
I agree that the
SYSLINUX_SERIALneeds to be respected regardless of if menu is set.
Yes, that would preserve existing behavior, not everybody wants to have menu.
Quoted 3 lines
It should be acceptable to install vesamenu.c32 I would think, although it sounds as though there is some work to perform to make sure bootdirect uses all the new infrastructure as well.
Yes it would be nice to have the possibility to enable menu, it can even be enabled by default once it's working properly and there is an option to disable it.
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
PATCH v2 5/7 bootimage.bbclass, grub-efi.bbclass: Improve EFI & PCBIOS+EFI ISO support
In reply to Jason WesselUsing the latest mkisofs it is possible to generate 3 different types of ISO images, which can be used in various scenarios.
1) PCBIOS Only ISO
- This option remains unchanged by this commit
- Uses syslinux menus
- Can be directly copied with dd to a USB device
- Can be burned to optical media
2) EFI Only ISO
- Uses grub 2 menus
- Can be burned to optical media
- If you want to use this image on a USB device extra steps must be taken in order to format the USB device with fat32, and copy an EFI loader which will in turn load the iso image
3) PCBIOS / EFI ISO
- This is a hybrid image ISO that will work for case 1 or 2 as above with the same restrictions and boot menu types depending on what type of firmware is installed on the hardware or depending on if EFI or "Legacy Boot" is enabled on some UEFI firmwares.
The syslinux.bbclass is now always required because that is where the isohybrid dependencies come from as well as the configuration data for the isohybrid. The isohybrid is the secret sauce which allows the ISO to work as optical media or as a disk image on USB or a HDD/SSD.
[YOCTO #4100]
--- meta/classes/bootimg.bbclass | 33 +++++++++++++++++++++------------ meta/classes/grub-efi.bbclass | 8 ++++++++ 2 files changed, 29 insertions(+), 12 deletions(-)
meta/classes/bootimg.bbclass +21 -12
@@ -32,6 +32,7 @@ EXCLUDE_FROM_WORLD = "1" HDDDIR = "${S}/hddimg" ISODIR = "${S}/iso" +EFIIMGDIR = "${S}/efi_img" BOOTIMG_VOLUME_ID ?= "boot" BOOTIMG_EXTRA_SPACE ?= "512"
@@ -48,15 +49,10 @@ def pcbios(d): pcbios = base_contains("MACHINE_FEATURES", "efi", "0", "1", d) return pcbios -def pcbios_class(d): - if d.getVar("PCBIOS", True) == "1": - return "syslinux" - return "" - PCBIOS = "${@pcbios(d)}" -PCBIOS_CLASS = "${@pcbios_class(d)}" -inherit ${PCBIOS_CLASS} +# The syslinux is required for the isohybrid command and boot catalog +inherit syslinux inherit ${EFI_CLASS} populate() {
@@ -90,21 +86,34 @@ build_iso() { fi if [ "${EFI}" = "1" ]; then grubefi_iso_populate + build_fat_img ${EFIIMGDIR} ${ISODIR}/efi.img fi - if [ "${PCBIOS}" = "1" ]; then + # EFI only + if [ "${PCBIOS}" != "1" ] && [ "${EFI}" = "1" ] ; then + mkdir -p ${ISODIR}/${ISOLINUXDIR} + install -m 0644 ${STAGING_DATADIR}/syslinux/isolinux.bin ${ISODIR}${ISOLINUXDIR} + fi + + if [ "${PCBIOS}" = "1" ] && [ "${EFI}" != "1" ] ; then + # PCBIOS only media mkisofs -V ${BOOTIMG_VOLUME_ID} \ -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \ -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \ ${MKISOFS_OPTIONS} ${ISODIR} else - bbnote "EFI-only ISO images are untested, please provide feedback." - mkisofs -V ${BOOTIMG_VOLUME_ID} \ + # EFI only OR EFI+PCIBIOS + mkisofs -A ${BOOTIMG_VOLUME_ID} -V ${BOOTIMG_VOLUME_ID} \ -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \ - -r ${ISODIR} + -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} \ + -r ${MKISOFS_OPTIONS} \ + -eltorito-alt-boot -eltorito-platform efi \ + -b efi.img -no-emul-boot \ + ${ISODIR} + isohybrid_args="-u" fi - isohybrid ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso + isohybrid $isohybrid_args ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso cd ${DEPLOY_DIR_IMAGE} rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso
meta/classes/grub-efi.bbclass +8 -0
@@ -41,6 +41,14 @@ grubefi_populate() { grubefi_iso_populate() { grubefi_populate ${ISODIR} + # Build a EFI directory to create efi.img + mkdir -p ${EFIIMGDIR}/${EFIDIR} + cp ${ISODIR}/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR} + cp ${ISODIR}/vmlinuz ${EFIIMGDIR} + echo "EFI\\BOOT\\${GRUB_IMAGE}" > ${EFIIMGDIR}/startup.nsh + if [ -f "${ISODIR}/initrd" ] ; then + cp ${ISODIR}/initrd ${EFIIMGDIR} + fi } grubefi_hddimg_populate() {
Signature · 1 line
1.7.9.5
Re: [v2 PATCH 5/7] bootimage.bbclass, grub-efi.bbclass: Improve EFI & PCBIOS+EFI ISO support
Quoted 69 lines · Jason Wessel
Using the latest mkisofs it is possible to generate 3 different types of ISO images, which can be used in various scenarios.
1) PCBIOS Only ISO
- This option remains unchanged by this commit
- Uses syslinux menus
- Can be directly copied with dd to a USB device
- Can be burned to optical media2) EFI Only ISO
- Uses grub 2 menus
- Can be burned to optical media
- If you want to use this image on a USB device extra steps must be taken in order to format the USB device with fat32, and copy an EFI loader which will in turn load the iso image3) PCBIOS / EFI ISO
- This is a hybrid image ISO that will work for case 1 or 2 as above with the same restrictions and boot menu types depending on what type of firmware is installed on the hardware or depending on if EFI or "Legacy Boot" is enabled on some UEFI firmwares.The syslinux.bbclass is now always required because that is where the isohybrid dependencies come from as well as the configuration data for the isohybrid. The isohybrid is the secret sauce which allows the ISO to work as optical media or as a disk image on USB or a HDD/SSD.
[YOCTO #4100]
Signed-off-by Jason Wessel <[email protected]>--- meta/classes/bootimg.bbclass | 33 +++++++++++++++++++++------------ meta/classes/grub-efi.bbclass | 8 ++++++++ 2 files changed, 29 insertions(+), 12 deletions(-)meta/classes/bootimg.bbclass +3
-7@@ -32,6 +32,7 @@ EXCLUDE_FROM_WORLD = "1" HDDDIR = "${S}/hddimg" ISODIR = "${S}/iso" +EFIIMGDIR = "${S}/efi_img" BOOTIMG_VOLUME_ID ?= "boot" BOOTIMG_EXTRA_SPACE ?= "512"@@ -48,15 +49,10 @@ def pcbios(d): pcbios = base_contains("MACHINE_FEATURES", "efi", "0", "1", d) return pcbios -def pcbios_class(d): - if d.getVar("PCBIOS", True) == "1": - return "syslinux" - return "" - PCBIOS = "${@pcbios(d)}" -PCBIOS_CLASS = "${@pcbios_class(d)}" -inherit ${PCBIOS_CLASS} +# The syslinux is required for the isohybrid command and boot catalog +inherit syslinux inherit ${EFI_CLASS} populate() {@@ -90,21 +86,34 @@ build_iso() { fi
meta/classes/bootimg.bbclass build_iso() { · line 95
Quoted 10 lines
meta/classes/bootimg.bbclass +5
-1if [ "${EFI}" = "1" ]; then grubefi_iso_populate + build_fat_img ${EFIIMGDIR} ${ISODIR}/efi.img fi - if [ "${PCBIOS}" = "1" ]; then + # EFI only + if [ "${PCBIOS}" != "1" ] && [ "${EFI}" = "1" ] ; then + mkdir -p ${ISODIR}/${ISOLINUXDIR} + install -m 0644 ${STAGING_DATADIR}/syslinux/isolinux.bin ${ISODIR}${ISOLINUXDIR}
If it's EFI-only, we copy isolinux.bin over? I was under the impression isolinux.bin was a PCBIOS thing (specifically an executable that wouldn't even work in an EFI environment). How is this used with an EFI-only image? What am I missing?
meta/classes/bootimg.bbclass build_iso() { · line 105
Quoted 12 lines
meta/classes/bootimg.bbclass +5
-2+ fi + + if [ "${PCBIOS}" = "1" ] && [ "${EFI}" != "1" ] ; then + # PCBIOS only media mkisofs -V ${BOOTIMG_VOLUME_ID} \ -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \ -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \ ${MKISOFS_OPTIONS} ${ISODIR} else - bbnote "EFI-only ISO images are untested, please provide feedback." - mkisofs -V ${BOOTIMG_VOLUME_ID} \ + # EFI only OR EFI+PCIBIOS
Nit: s/PCIBIOS/PCBIOS/
...
Thanks,
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel
Re: [v2 PATCH 5/7] bootimage.bbclass, grub-efi.bbclass: Improve EFI & PCBIOS+EFI ISO support
Quoted 11 lines · Darren Hart
meta/classes/bootimg.bbclass build_iso() { · line 95
Quoted 5 lines · Jason Wessel
meta/classes/bootimg.bbclass +4
-1- if [ "${PCBIOS}" = "1" ]; then + # EFI only + if [ "${PCBIOS}" != "1" ] && [ "${EFI}" = "1" ] ; then + mkdir -p ${ISODIR}/${ISOLINUXDIR} + install -m 0644 ${STAGING_DATADIR}/syslinux/isolinux.bin ${ISODIR}${ISOLINUXDIR}If it's EFI-only, we copy isolinux.bin over? I was under the impression isolinux.bin was a PCBIOS thing (specifically an executable that wouldn't even work in an EFI environment). How is this used with an EFI-only image? What am I missing?
There is a bug/feature in the isohybrid that requires it to be in the catalog. I couldn't figure out how to work around it, so I left it in there. The EFI firmware skips right over it anyway. I can add a comment to the bbclass to this effect.
Quoted 15 lines
meta/classes/bootimg.bbclass build_iso() { · line 105
Quoted 13 lines
meta/classes/bootimg.bbclass +5
-2+ fi + + if [ "${PCBIOS}" = "1" ] && [ "${EFI}" != "1" ] ; then + # PCBIOS only media mkisofs -V ${BOOTIMG_VOLUME_ID} \ -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \ -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \ ${MKISOFS_OPTIONS} ${ISODIR} else - bbnote "EFI-only ISO images are untested, please provide feedback." - mkisofs -V ${BOOTIMG_VOLUME_ID} \ + # EFI only OR EFI+PCIBIOSNit: s/PCIBIOS/PCBIOS/
Oops, all fixed in v3. :-)
Jason.
PATCH v2 6/7 grub-efi.bbclass: Add serial and graphics menu options
In reply to Jason WesselThe syslinux.bbclass already has support for automatically generated serial and graphics menu choices. This patch adds the same concept to the grub-efi menu. That makes it possible to generate a single image which can boot on a PCBIOS or EFI firmware with consistent looking boot options.
[YOCTO #4100]
--- meta/classes/grub-efi.bbclass | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-)
meta/classes/grub-efi.bbclass +27 -14
@@ -9,6 +9,7 @@ # External variables # ${INITRD} - indicates a filesystem image to use as an initrd (optional) # ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional) +# ${GRUB_GFXSERIAL} - set this to 1 to have graphics and serial in the boot menu # ${LABELS} - a list of targets for the automatic config # ${APPEND} - an override list of append strings for each label # ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional)
@@ -16,6 +17,7 @@ do_bootimg[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy" +GRUB_SERIAL ?= "console=ttyS0,115200" GRUBCFG = "${S}/grub.cfg" GRUB_TIMEOUT ?= "10" #FIXME: build this from the machine config
@@ -63,6 +65,8 @@ python build_grub_cfg() { bb.error("WORKDIR not defined, unable to package") return + gfxserial = d.getVar('GRUB_GFXSERIAL', True) or "" + labels = d.getVar('LABELS', True) if not labels: bb.debug(1, "LABELS not defined, nothing to do")
@@ -96,6 +100,12 @@ python build_grub_cfg() { else: cfgfile.write('timeout=50\n') + if gfxserial == "1": + btypes = [ [ " graphics console", "console=tty0" ], + [ " serial console", d.getVar('GRUB_SERIAL', True) or "" ] ] + else: + btypes = [ [ "", "" ] ] + for label in labels.split(): localdata = d.createCopy()
@@ -103,24 +113,27 @@ python build_grub_cfg() { if not overrides: raise bb.build.FuncFailed('OVERRIDES not defined') - localdata.setVar('OVERRIDES', label + ':' + overrides) - bb.data.update_data(localdata) + for btype in btypes: + localdata.setVar('OVERRIDES', label + ':' + overrides) + bb.data.update_data(localdata) - cfgfile.write('\nmenuentry \'%s\'{\n' % (label)) - if label == "install": - label = "install-efi" - cfgfile.write('linux /vmlinuz LABEL=%s' % (label)) + cfgfile.write('\nmenuentry \'%s%s\'{\n' % (label, btype[0])) + lb = label + if label == "install": + lb = "install-efi" + cfgfile.write('linux /vmlinuz LABEL=%s' % (lb)) - append = localdata.getVar('APPEND', True) - initrd = localdata.getVar('INITRD', True) + append = localdata.getVar('APPEND', True) + initrd = localdata.getVar('INITRD', True) - if append: - cfgfile.write('%s' % (append)) - cfgfile.write('\n') + if append: + cfgfile.write('%s' % (append)) + cfgfile.write(' %s' % btype[1]) + cfgfile.write('\n') - if initrd: - cfgfile.write('initrd /initrd') - cfgfile.write('\n}\n') + if initrd: + cfgfile.write('initrd /initrd') + cfgfile.write('\n}\n') cfgfile.close() }
Signature · 1 line
1.7.9.5
Re: [v2 PATCH 6/7] grub-efi.bbclass: Add serial and graphics menu options
Quoted 9 lines · Jason Wessel
The syslinux.bbclass already has support for automatically generated serial and graphics menu choices. This patch adds the same concept to the grub-efi menu. That makes it possible to generate a single image which can boot on a PCBIOS or EFI firmware with consistent looking boot options.
[YOCTO #4100]
Signed-off-by Jason Wessel <[email protected]>
Ongoing discussion in previous series on the use of GRUB_SERIAL. I think I'm missing something, but I want to be sure... see V1 thread...
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel
PATCH v2 7/7 bootimage.bbclass, zisofs-tools-native: add ability to compress ISO images
In reply to Jason WesselThe mkzftree is needed to allow ISO images to be compressed with minimal runtime overhead. Below is an example of the savings on a core-image-minimal.
Before ls -l:
24117248 core-image-minimal-qemux86-64.iso
Using the mkzftree ls -l:
16777216 core-image-minimal-qemux86-64.iso
--- meta/classes/bootimg.bbclass | 24 +++++++++++++++++--- .../zisofs-tools/zisofs-tools-native_1.0.8.bb | 19 ++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb
meta/classes/bootimg.bbclass +21 -3
@@ -19,13 +19,15 @@ # External variables (also used by syslinux.bbclass) # ${INITRD} - indicates a filesystem image to use as an initrd (optional) +# ${COMPRESSISO} - Transparent compress ISO, reduce size ~40% if set to 1 # ${NOISO} - skip building the ISO image if set to 1 # ${NOHDD} - skip building the HDD image if set to 1 # ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional) do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \ mtools-native:do_populate_sysroot \ - cdrtools-native:do_populate_sysroot" + cdrtools-native:do_populate_sysroot \ + ${@oe.utils.ifelse(d.getVar('COMPRESSISO'),'zisofs-tools-native:do_populate_sysroot','')}" PACKAGES = " " EXCLUDE_FROM_WORLD = "1"
@@ -33,6 +35,8 @@ EXCLUDE_FROM_WORLD = "1" HDDDIR = "${S}/hddimg" ISODIR = "${S}/iso" EFIIMGDIR = "${S}/efi_img" +COMPACT_ISODIR = "${S}/iso.z" +COMPRESSISO ?= "" BOOTIMG_VOLUME_ID ?= "boot" BOOTIMG_EXTRA_SPACE ?= "512"
@@ -95,18 +99,32 @@ build_iso() { install -m 0644 ${STAGING_DATADIR}/syslinux/isolinux.bin ${ISODIR}${ISOLINUXDIR} fi + if [ "${COMPRESSISO}" = "1" ] ; then + # create compact directory, compress iso + mkdir -p ${COMPACT_ISODIR} + mkzftree -z 9 -p 4 -F ${ISODIR}/rootfs.img ${COMPACT_ISODIR}/rootfs.img + + # move compact iso to iso, then remove compact directory + mv ${COMPACT_ISODIR}/rootfs.img ${ISODIR}/rootfs.img + rm -Rf ${COMPACT_ISODIR} + mkisofs_compress_opts="-R -z -D -l" + else + mkisofs_compress_opts="-r" + fi + if [ "${PCBIOS}" = "1" ] && [ "${EFI}" != "1" ] ; then # PCBIOS only media mkisofs -V ${BOOTIMG_VOLUME_ID} \ -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \ - -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \ + -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} \ + $mkisofs_compress_opts \ ${MKISOFS_OPTIONS} ${ISODIR} else # EFI only OR EFI+PCIBIOS mkisofs -A ${BOOTIMG_VOLUME_ID} -V ${BOOTIMG_VOLUME_ID} \ -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \ -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} \ - -r ${MKISOFS_OPTIONS} \ + $mkisofs_compress_opts ${MKISOFS_OPTIONS} \ -eltorito-alt-boot -eltorito-platform efi \ -b efi.img -no-emul-boot \ ${ISODIR}
meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb new file +19 -0
@@ -0,0 +1,19 @@ +# zisofs-tools-native OE build file +# Copyright (C) 1989, 1991 Free Software Foundation, Inc. +SUMMARY = "A set of tools for iso file compression" +DESCRIPTION = "A set of tools for iso file compression" +HOMEPAGE = "http://http://freecode.com/projects/zisofs-tools" +SECTION = "console/utils" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" + +SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/zisofs-tools/zisofs-tools-${PV}.tar.bz2/2d0ed8c9a1f60b45f949b136f9be1f6c/zisofs-tools-${PV}.tar.bz2" + +SRC_URI[md5sum] = "2d0ed8c9a1f60b45f949b136f9be1f6c" +SRC_URI[sha256sum] = "ae4e53e4914934d41660248fb59d3c8761f1f1fd180d5ec993c17ddb3afd04f3" + +inherit native + +do_install() { + oe_runmake install INSTALLROOT=${D} bindir=${bindir} +}
Signature · 1 line
1.7.9.5
Re: [v2 PATCH 7/7] bootimage.bbclass, zisofs-tools-native: add ability to compress ISO images
Quoted 39 lines · Jason Wessel
The mkzftree is needed to allow ISO images to be compressed with minimal runtime overhead. Below is an example of the savings on a core-image-minimal.
Before ls -l:
24117248 core-image-minimal-qemux86-64.isoUsing the mkzftree ls -l:
16777216 core-image-minimal-qemux86-64.isoSigned-off-by Jason Wessel <[email protected]>--- meta/classes/bootimg.bbclass | 24 +++++++++++++++++--- .../zisofs-tools/zisofs-tools-native_1.0.8.bb | 19 ++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bbmeta/classes/bootimg.bbclass +3
-1@@ -19,13 +19,15 @@ # External variables (also used by syslinux.bbclass) # ${INITRD} - indicates a filesystem image to use as an initrd (optional) +# ${COMPRESSISO} - Transparent compress ISO, reduce size ~40% if set to 1 # ${NOISO} - skip building the ISO image if set to 1 # ${NOHDD} - skip building the HDD image if set to 1 # ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional) do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \ mtools-native:do_populate_sysroot \ - cdrtools-native:do_populate_sysroot" + cdrtools-native:do_populate_sysroot \ + ${@oe.utils.ifelse(d.getVar('COMPRESSISO'),'zisofs-tools-native:do_populate_sysroot','')}" PACKAGES = " " EXCLUDE_FROM_WORLD = "1"
meta/classes/bootimg.bbclass EXCLUDE_FROM_WORLD = "1" · line 39
Quoted 5 lines
meta/classes/bootimg.bbclass +2
-0@@ -33,6 +35,8 @@ EXCLUDE_FROM_WORLD = "1" HDDDIR = "${S}/hddimg" ISODIR = "${S}/iso" EFIIMGDIR = "${S}/efi_img" +COMPACT_ISODIR = "${S}/iso.z" +COMPRESSISO ?= ""
Would an explicit '0' here be better?
Quoted 28 lines
meta/classes/bootimg.bbclass +15
-1BOOTIMG_VOLUME_ID ?= "boot" BOOTIMG_EXTRA_SPACE ?= "512"@@ -95,18 +99,32 @@ build_iso() { install -m 0644 ${STAGING_DATADIR}/syslinux/isolinux.bin ${ISODIR}${ISOLINUXDIR} fi + if [ "${COMPRESSISO}" = "1" ] ; then + # create compact directory, compress iso + mkdir -p ${COMPACT_ISODIR} + mkzftree -z 9 -p 4 -F ${ISODIR}/rootfs.img ${COMPACT_ISODIR}/rootfs.img + + # move compact iso to iso, then remove compact directory + mv ${COMPACT_ISODIR}/rootfs.img ${ISODIR}/rootfs.img + rm -Rf ${COMPACT_ISODIR} + mkisofs_compress_opts="-R -z -D -l" + else + mkisofs_compress_opts="-r" + fi + if [ "${PCBIOS}" = "1" ] && [ "${EFI}" != "1" ] ; then # PCBIOS only media mkisofs -V ${BOOTIMG_VOLUME_ID} \ -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \ - -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \ + -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} \ + $mkisofs_compress_opts \ ${MKISOFS_OPTIONS} ${ISODIR}
meta/classes/bootimg.bbclass build_iso() { · line 130
Quoted 10 lines
meta/classes/bootimg.bbclass +1
-1else # EFI only OR EFI+PCIBIOS mkisofs -A ${BOOTIMG_VOLUME_ID} -V ${BOOTIMG_VOLUME_ID} \ -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \ -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} \ - -r ${MKISOFS_OPTIONS} \ + $mkisofs_compress_opts ${MKISOFS_OPTIONS} \ -eltorito-alt-boot -eltorito-platform efi \ -b efi.img -no-emul-boot \ ${ISODIR}
OK...
Quoted 15 lines
meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb new file +9
-0@@ -0,0 +1,19 @@ +# zisofs-tools-native OE build file +# Copyright (C) 1989, 1991 Free Software Foundation, Inc. +SUMMARY = "A set of tools for iso file compression" +DESCRIPTION = "A set of tools for iso file compression" +HOMEPAGE = "http://http://freecode.com/projects/zisofs-tools" +SECTION = "console/utils" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" +
meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb line 19
Quoted 10 lines
meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb new file +10
-0+SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/zisofs-tools/zisofs-tools-${PV}.tar.bz2/2d0ed8c9a1f60b45f949b136f9be1f6c/zisofs-tools-${PV}.tar.bz2" + +SRC_URI[md5sum] = "2d0ed8c9a1f60b45f949b136f9be1f6c" +SRC_URI[sha256sum] = "ae4e53e4914934d41660248fb59d3c8761f1f1fd180d5ec993c17ddb3afd04f3" + +inherit native + +do_install() { + oe_runmake install INSTALLROOT=${D} bindir=${bindir} +}
Does EXTRA_OEMAKE not work here? I see it isn't listed in the reference manual for the install step (just the compile step), so perhaps not. Just wanted to check.
Generally speaking, I think this looks fine though and I don't object to it going in as-is.
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel
Re: [v2 PATCH 7/7] bootimage.bbclass, zisofs-tools-native: add ability to compress ISO images
Quoted 5 lines · Darren Hart
Quoted 1 line · Jason Wessel
+COMPRESSISO ?= ""
Would an explicit '0' here be better?
That is fine by me.
Quoted 8 lines
meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb line 19
Quoted 4 lines
meta/recipes-devtools/zisofs-tools/zisofs-tools-native_1.0.8.bb new file +4
-0+ +do_install() { + oe_runmake install INSTALLROOT=${D} bindir=${bindir} +}Does
EXTRA_OEMAKEnot work here? I see it isn't listed in the reference manual for the install step (just the compile step), so perhaps not. Just wanted to check.
It does not work. I could patch the Makefile to make it work but I don't think it is worth it, vs just leaving things unchanged for future uprev ease.
Cheers,
Jason.