poky/meta
Hongxu Jia 84bf4efc11 cdrtools-native: fix booting EFI ISO live failed
In ISO live, if the size of efi.img > 32MB, and copy EFI application
(bootx64.efi) to efi.img behind of kernel and initrd, UEFI system
could not find EFI application bootx64.efi

Using QEMU+OVMF to boot ISO live image, press ESC to enter UEFI shell:
...
Shell> ls FS0:\
Directory of: FS0:\
04/05/2011  23:00          12,985,344  bzImage
04/05/2011  23:00 <DIR>         2,048  EFI
04/05/2011  23:00          20,494,696  initrd
04/05/2011  23:00                  26  startup.nsh
          3 File(s)  33,480,066 bytes
          1 Dir(s)

Shell> ls FS0:\EFI
Directory of: FS0:\EFI
          0 File(s)           0 bytes
          0 Dir(s)
...

In following case, add 64MB extra space to bootable image efi.img,
and the partition table of EFI is truncated to 26.3M

$ echo 'IMAGE_FSTYPES:pn-core-image-minimal = " live"' >> conf/local.conf
$ echo 'MACHINE_FEATURES:append = " efi pcbios"' >> conf/local.conf
$ echo '# 64MB extra space to bootable image efi.img' >> conf/local.conf
$ echo 'BOOTIMG_EXTRA_SPACE = "65535"' >> conf/local.conf
$ bitbake core-image-minimal
$ fdisk -l tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.rootfs.iso
...
Device                                                                 Boot Start    End Sectors  Size Id Type
tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.rootfs.iso1 *        0 376831  376832  184M  0 Empty
tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.rootfs.iso2        120  54079   53960 26.3M ef EFI (FAT-12/16/32)

According to page 11: `Figure 5 - Section Entry' in El Torito Bootable
CD-ROM Format Specification [1]. The sector count takes 2 byte which
means max sector count is 0xffff (65535), for 512-byte sector, the
size of bootable image is no more than 32MB (65536 * 512 / 1024 / 1024)

This commit truncate to 32MB if image size larger than 32MB, and
report a warning, then save the extra image sector count to
vendor unique selection criteria

After apply this commit, the partition table of EFI is truncated to 32M
$ fdisk -l tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.rootfs.iso
...
Device                                                                 Boot Start    End Sectors  Size Id Type
tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.rootfs.iso1 *        0 376831  376832  184M  0 Empty
tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.rootfs.iso2        120  65654   65535   32M ef EFI (FAT-12/16/32)

[1]https://pdos.csail.mit.edu/6.828/2017/readings/boot-cdrom.pdf

(From OE-Core rev: 259bb8907d8bfe1217e88a3b6935c160e5a92f8d)

(From OE-Core rev: d184f119c26983c2f15b47a25204049d0525c871)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-05-14 08:33:40 -07:00
..
classes classes/spdx-*.bbclass: move spdx2 specific variables out of spdx-common class 2025-03-28 11:19:40 +00:00
classes-global insane.bbclass: Report all invalid PACKAGECONFIGs for a recipe at once 2025-05-14 08:33:40 -07:00
classes-recipe cargo.bbclass: show PACKAGECONFIG_CONFARGS in bbnote 2025-03-25 21:20:41 +00:00
conf layer.conf: Update layer series name for release 2025-03-29 15:31:15 +00:00
files overlayfs-etc: Unmount /sys and /proc before init 2025-03-27 11:19:04 +00:00
lib patch.py: set commituser and commitemail for addNote 2025-05-14 08:33:40 -07:00
recipes-bsp lrzsz: Fix build with gcc-15 2025-03-27 11:19:04 +00:00
recipes-connectivity buildtools-tarball: Make buildtools respects host CA certificates 2025-05-14 08:33:40 -07:00
recipes-core buildtools-tarball: Make buildtools respects host CA certificates 2025-05-14 08:33:40 -07:00
recipes-devtools cdrtools-native: fix booting EFI ISO live failed 2025-05-14 08:33:40 -07:00
recipes-extended tzdata/tzcode-native: upgrade 2025a -> 2025b 2025-05-14 08:33:40 -07:00
recipes-gnome gsettings-desktop-schemas: update 47.1 -> 48.0 2025-03-24 17:29:16 +00:00
recipes-graphics mesa-demos: fix detection of GLX headers 2025-04-23 19:48:04 +01:00
recipes-kernel linux-yocto/6.12: cfg: fix iommu configuration for -tiny kernel 2025-04-23 19:48:04 +01:00
recipes-multimedia alsa-tools: Fix build with gcc 15 2025-03-27 11:19:03 +00:00
recipes-rt rt-tests: Fix build with glibc 2.41+ 2025-01-29 16:16:52 +00:00
recipes-sato webkitgtk: Fix build on RISCV 2025-03-24 17:29:16 +00:00
recipes-support buildtools-tarball: Make buildtools respects host CA certificates 2025-05-14 08:33:40 -07:00
site site/arm-linux: Fix typo for sizeof_char_p 2024-11-21 12:16:28 +00:00
COPYING.MIT
recipes.txt