summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/syslinux
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/syslinux')
-rw-r--r--meta/recipes-devtools/syslinux/syslinux/0001-Add-extra-sector-count-from-section-entry-for-EFI-ca.patch104
-rw-r--r--meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb1
2 files changed, 105 insertions, 0 deletions
diff --git a/meta/recipes-devtools/syslinux/syslinux/0001-Add-extra-sector-count-from-section-entry-for-EFI-ca.patch b/meta/recipes-devtools/syslinux/syslinux/0001-Add-extra-sector-count-from-section-entry-for-EFI-ca.patch
new file mode 100644
index 0000000000..5422d9b2de
--- /dev/null
+++ b/meta/recipes-devtools/syslinux/syslinux/0001-Add-extra-sector-count-from-section-entry-for-EFI-ca.patch
@@ -0,0 +1,104 @@
1From 79a26046d178ae132cb88ba75de7141bd169ff16 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Sat, 26 Apr 2025 10:45:08 +0800
4Subject: [PATCH] Add extra sector count from section entry for EFI catalogue
5
6According to page 11: `Figure 5 - Section Entry' in El Torito Bootable
7CD-ROM Format Specification [1]. The sector count tooks 2 byte which
8means max sector count is 0xffff (65535), for 512-byte sector, the
9size of bootable image is no more than 32MB (65536 * 512 / 1024 / 1024)
10
11If the size of efi.img > 32MB, the partition table will be truncated
12in ISO, which caused UEFI system or grub-efi read efi.img broken
13occasionally.
14
15This patch extend efi_count, mac_count and count to 4 byte int, if
16Yocto defines `Selection criteria type = 2', add extra sector count
17to original sector count as total count; for other situation, still use
18original sector count as usual
19
20[1]https://pdos.csail.mit.edu/6.828/2017/readings/boot-cdrom.pdf
21
22Upstream-Status: Inappropriate [Yocto specific]
23
24Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
25---
26 utils/isohybrid.c | 48 ++++++++++++++++++++++++++++++++++++++++++-----
27 1 file changed, 43 insertions(+), 5 deletions(-)
28
29diff --git a/utils/isohybrid.c b/utils/isohybrid.c
30index a9e38d4..1bbfd45 100644
31--- a/utils/isohybrid.c
32+++ b/utils/isohybrid.c
33@@ -76,7 +76,7 @@ uint32_t de_lba = 0;
34 uint16_t de_seg = 0, de_count = 0, de_mbz2 = 0;
35 uint8_t de_boot = 0, de_media = 0, de_sys = 0, de_mbz1 = 0;
36 uint32_t efi_lba = 0, mac_lba = 0;
37-uint16_t efi_count = 0, mac_count = 0;
38+uint32_t efi_count = 0, mac_count = 0;
39 uint8_t efi_boot = 0, efi_media = 0, efi_sys = 0;
40
41 int apm_parts = 3;
42@@ -552,17 +552,55 @@ read_efi_section(const uint8_t *buf)
43 }
44
45 int
46-read_efi_catalogue(const uint8_t *buf, uint16_t *count, uint32_t *lba)
47+read_efi_catalogue(const uint8_t *buf, uint32_t *count, uint32_t *lba)
48 {
49+ uint16_t _count = 0;
50+
51+ // Jump to offset 6 byte
52 buf += 6;
53
54- memcpy(count, buf, 2);
55- *count = lendian_short(*count);
56+ *count = 0;
57+
58+ // Offset : 6-7 byte
59+ // Type : Word
60+ // Description: Sector Count, the number of virtual/emulated sectors
61+ // the system will store at Load Segment during the initial boot procedure
62+ memcpy(&_count, buf, 2);
63+ _count = lendian_short(_count);
64 buf += 2;
65
66+ // Offset : 8-0B byte
67+ // Type : D Word
68+ // Description: Load RBA. This is the start address of the virtual disk. CD’s use
69+ // Relative/Logical block addressing.
70 memcpy(lba, buf, 4);
71 *lba = lendian_int(*lba);
72- buf += 6;
73+ buf += 4;
74+
75+ // Offset : 0C byte
76+ // Type : Byte
77+ // Description: Selection criteria type. This defines a vendor unique format
78+ // for bytes 0D-1F.
79+ // The following formats have currently been assigned:
80+ // 0 - No selection criteria
81+ // 1 - Language and Version Information (IBM)
82+ // 2 - Save extra sector count to vendor unique selection criteria (Yocto)
83+ // 3-FF - Reserved
84+ unsigned char slection_criteria_type = *buf;
85+ buf += 1;
86+
87+ // Offset : 0D-0E-0F-10 byte
88+ // Type : D Word
89+ // Description: Selection criteria type = 2, reserved by Yocto,
90+ // save extra sector count to vendor unique selection criteria
91+ if (slection_criteria_type == 2) {
92+ memcpy(count, buf, 4);
93+ *count = lendian_int(*count);
94+ buf += 4;
95+ }
96+
97+ // total count = sector count + extra sector count
98+ *count += _count;
99
100 return 0;
101 }
102--
1032.34.1
104
diff --git a/meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb b/meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb
index 7cf737170c..2522205fa1 100644
--- a/meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb
+++ b/meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb
@@ -23,6 +23,7 @@ SRC_URI = "https://www.zytor.com/pub/syslinux/Testing/6.04/syslinux-${PV}.tar.xz
23 file://0013-remove-clean-script.patch \ 23 file://0013-remove-clean-script.patch \
24 file://0014-Fix-reproducibility-issues.patch \ 24 file://0014-Fix-reproducibility-issues.patch \
25 file://0001-ext2_fs.h-do-not-carry-an-outdated-copy.patch \ 25 file://0001-ext2_fs.h-do-not-carry-an-outdated-copy.patch \
26 file://0001-Add-extra-sector-count-from-section-entry-for-EFI-ca.patch \
26 " 27 "
27 28
28SRC_URI[md5sum] = "2b31c78f087f99179feb357da312d7ec" 29SRC_URI[md5sum] = "2b31c78f087f99179feb357da312d7ec"