Files
poky/meta/recipes-devtools
Hongxu Jia 7ff5ecce28 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)

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>
2025-04-29 09:59:01 +01:00
..
2025-03-17 17:09:22 +00:00
2024-11-25 22:23:25 +00:00
2025-04-03 11:06:19 +01:00
2024-11-27 14:58:48 +00:00
2024-09-03 10:21:38 +01:00
2024-11-27 14:58:48 +00:00
2024-05-28 09:38:23 +01:00
2025-03-19 12:09:06 +00:00
2024-04-16 08:07:01 +01:00
2025-01-04 12:34:04 +00:00
2025-04-29 09:55:31 +01:00
2025-04-10 11:05:34 +01:00
2024-10-29 11:19:57 +00:00
2023-09-26 10:35:27 +01:00
2024-09-30 17:00:50 +01:00
2025-04-08 15:49:17 +01:00
2024-11-18 22:09:02 +00:00
2025-04-17 11:03:22 +01:00
2024-08-23 09:12:37 +01:00
2025-03-17 17:09:22 +00:00
2024-08-28 09:14:26 +01:00
2025-04-10 11:05:34 +01:00
2025-03-17 22:38:32 +00:00
2025-03-27 11:19:03 +00:00
2025-03-06 11:16:47 +00:00
2024-06-04 12:04:52 +01:00
2024-05-28 09:38:24 +01:00
2024-08-29 21:58:19 +01:00
2025-03-06 11:16:47 +00:00
2025-04-17 11:03:22 +01:00
2025-04-17 11:03:22 +01:00
2025-04-03 11:06:20 +01:00
2025-01-20 13:38:59 +00:00
2025-04-20 10:11:16 +01:00
2024-11-22 16:53:37 +00:00
2024-12-05 17:07:10 +00:00
2025-02-05 12:49:55 +00:00
2025-03-27 11:19:04 +00:00
2025-03-17 17:09:22 +00:00
2025-02-05 12:49:56 +00:00