Skip to content

Commit a1e7dd7

Browse files
committed
Pull request efi-2025-04-rc1 Documentation: * Correct the defconfig name in the coolpi documentation UEFI: * Carve out the biggest part of the RISC-V and ARM linker scripts for EFI binary into a common include. * Correct the values of SizeOfCode and SizeOfInitializedData in generated EFI binaries for RISC-V and ARM. * Avoid gaps between sections in EFI binaries causing a failure in secure boot. * Makefile: let clean remove capsule_in.capsule*.efi-capsule * Refactor some of the code used for launching EFI binaries.
2 parents 319b2e6 + f58b0d0 commit a1e7dd7

File tree

12 files changed

+150
-313
lines changed

12 files changed

+150
-313
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2230,7 +2230,7 @@ CLEAN_FILES += include/autoconf.mk* include/bmp_logo.h include/bmp_logo_data.h \
22302230
itb.fit.fit itb.fit.itb itb.map spl.map mkimage-out.rom.mkimage \
22312231
mkimage.rom.mkimage mkimage-in-simple-bin* rom.map simple-bin* \
22322232
idbloader-spi.img lib/efi_loader/helloworld_efi.S *.itb \
2233-
Test* capsule.*.efi-capsule capsule*.map
2233+
Test* capsule*.*.efi-capsule capsule*.map
22342234

22352235
# Directories & files removed with 'make mrproper'
22362236
MRPROPER_DIRS += include/config include/generated spl tpl vpl \

arch/arm/lib/crt0_aarch64_efi.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ optional_header:
4141
.byte 0x02 /* MajorLinkerVersion */
4242
.byte 0x14 /* MinorLinkerVersion */
4343
.long _etext - _start /* SizeOfCode */
44-
.long 0 /* SizeOfInitializedData */
44+
.long _data_size /* SizeOfInitializedData */
4545
.long 0 /* SizeOfUninitializedData */
4646
.long _start - ImageBase /* AddressOfEntryPoint */
4747
.long _start - ImageBase /* BaseOfCode */

arch/arm/lib/crt0_arm_efi.S

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ optional_header:
3838
.short IMAGE_NT_OPTIONAL_HDR32_MAGIC /* PE32 format */
3939
.byte 0x02 /* MajorLinkerVersion */
4040
.byte 0x14 /* MinorLinkerVersion */
41-
.long _edata - _start /* SizeOfCode */
42-
.long 0 /* SizeOfInitializedData */
41+
.long _etext - _start /* SizeOfCode */
42+
.long _data_size /* SizeOfInitializedData */
4343
.long 0 /* SizeOfUninitializedData */
4444
.long _start - image_base /* AddressOfEntryPoint */
4545
.long _start - image_base /* BaseOfCode */
4646
.long 0 /* BaseOfData */
4747

4848
extra_header_fields:
49-
.long 0 /* image_base */
50-
.long 0x200 /* SectionAlignment */
49+
.long 0 /* ImageBase */
50+
.long 0x1000 /* SectionAlignment */
5151
.long 0x200 /* FileAlignment */
5252
.short 0 /* MajorOperatingSystemVersion */
5353
.short 0 /* MinorOperatingSystemVersion */
@@ -84,6 +84,7 @@ extra_header_fields:
8484
.quad 0 /* CertificationTable */
8585
.quad 0 /* BaseRelocationTable */
8686

87+
/* Section table */
8788
section_table:
8889

8990
/*
@@ -111,9 +112,9 @@ section_table:
111112
.byte 0
112113
.byte 0
113114
.byte 0 /* end of 0 padding of section name */
114-
.long _text_size /* VirtualSize */
115+
.long _etext - _start /* VirtualSize */
115116
.long _start - image_base /* VirtualAddress */
116-
.long _text_size /* SizeOfRawData */
117+
.long _etext - _start /* SizeOfRawData */
117118
.long _start - image_base /* PointerToRawData */
118119
.long 0 /* PointerToRelocations */
119120
.long 0 /* PointerToLineNumbers */

arch/arm/lib/elf_aarch64_efi.lds

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -8,70 +8,4 @@
88
OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
99
OUTPUT_ARCH(aarch64)
1010

11-
PHDRS
12-
{
13-
data PT_LOAD FLAGS(3); /* SHF_WRITE | SHF_ALLOC */
14-
}
15-
16-
ENTRY(_start)
17-
SECTIONS
18-
{
19-
.text 0x0 : {
20-
_text = .;
21-
*(.text.head)
22-
*(.text)
23-
*(.text.*)
24-
*(.gnu.linkonce.t.*)
25-
*(.srodata)
26-
*(.rodata*)
27-
. = ALIGN(16);
28-
*(.dynamic);
29-
. = ALIGN(512);
30-
}
31-
.rela.dyn : { *(.rela.dyn) }
32-
.rela.plt : { *(.rela.plt) }
33-
.rela.got : { *(.rela.got) }
34-
.rela.data : { *(.rela.data) *(.rela.data*) }
35-
_etext = .;
36-
_text_size = . - _text;
37-
. = ALIGN(4096);
38-
.data : {
39-
_data = .;
40-
*(.sdata)
41-
*(.data)
42-
*(.data1)
43-
*(.data.*)
44-
*(.got.plt)
45-
*(.got)
46-
47-
/*
48-
* The EFI loader doesn't seem to like a .bss section, so we
49-
* stick it all into .data:
50-
*/
51-
. = ALIGN(16);
52-
_bss = .;
53-
*(.sbss)
54-
*(.scommon)
55-
*(.dynbss)
56-
*(.bss)
57-
*(.bss.*)
58-
*(COMMON)
59-
. = ALIGN(512);
60-
_bss_end = .;
61-
_edata = .;
62-
} :data
63-
_data_size = _edata - _data;
64-
65-
. = ALIGN(4096);
66-
.dynsym : { *(.dynsym) }
67-
. = ALIGN(4096);
68-
.dynstr : { *(.dynstr) }
69-
. = ALIGN(4096);
70-
.note.gnu.build-id : { *(.note.gnu.build-id) }
71-
/DISCARD/ : {
72-
*(.rel.reloc)
73-
*(.eh_frame)
74-
*(.note.GNU-stack)
75-
}
76-
.comment 0 : { *(.comment) }
77-
}
11+
INCLUDE lib/efi_loader/elf_efi.ldsi

arch/arm/lib/elf_arm_efi.lds

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -8,73 +8,4 @@
88
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
99
OUTPUT_ARCH(arm)
1010

11-
PHDRS
12-
{
13-
data PT_LOAD FLAGS(3); /* PF_W | PF_X */
14-
}
15-
16-
ENTRY(_start)
17-
SECTIONS
18-
{
19-
.text 0x0 : {
20-
_text = .;
21-
*(.text.head)
22-
*(.text)
23-
*(.text.*)
24-
*(.gnu.linkonce.t.*)
25-
*(.srodata)
26-
*(.rodata*)
27-
. = ALIGN(16);
28-
*(.dynamic);
29-
. = ALIGN(512);
30-
}
31-
_etext = .;
32-
_text_size = . - _text;
33-
. = ALIGN(4096);
34-
.data : {
35-
_data = .;
36-
*(.sdata)
37-
*(.data)
38-
*(.data1)
39-
*(.data.*)
40-
*(.got.plt)
41-
*(.got)
42-
43-
/*
44-
* The EFI loader doesn't seem to like a .bss section, so we
45-
* stick it all into .data:
46-
*/
47-
. = ALIGN(16);
48-
_bss = .;
49-
*(.sbss)
50-
*(.scommon)
51-
*(.dynbss)
52-
*(.bss)
53-
*(.bss.*)
54-
*(COMMON)
55-
. = ALIGN(512);
56-
_bss_end = .;
57-
_edata = .;
58-
} :data
59-
_data_size = . - _data;
60-
61-
/DISCARD/ : {
62-
/*
63-
* We don't support relocations. These would have to be
64-
* translated from ELF to PE format and added to the .reloc
65-
* section.
66-
*/
67-
*(.rel.dyn)
68-
*(.rel.plt)
69-
*(.rel.got)
70-
*(.rel.data)
71-
*(.rel.data*)
72-
*(.rel.reloc)
73-
*(.eh_frame)
74-
*(.note.GNU-stack)
75-
*(.dynsym)
76-
*(.dynstr)
77-
*(.note.gnu.build-id)
78-
*(.comment)
79-
}
80-
}
11+
INCLUDE lib/efi_loader/elf_efi.ldsi

arch/riscv/lib/crt0_riscv_efi.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ optional_header:
6363
.short PE_MAGIC /* PE32(+) format */
6464
.byte 0x02 /* MajorLinkerVersion */
6565
.byte 0x14 /* MinorLinkerVersion */
66-
.long _edata - _start /* SizeOfCode */
67-
.long 0 /* SizeOfInitializedData */
66+
.long _etext - _start /* SizeOfCode */
67+
.long _data_size /* SizeOfInitializedData */
6868
.long 0 /* SizeOfUninitializedData */
6969
.long _start - ImageBase /* AddressOfEntryPoint */
7070
.long _start - ImageBase /* BaseOfCode */

arch/riscv/lib/elf_riscv32_efi.lds

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -8,70 +8,4 @@
88
OUTPUT_FORMAT("elf32-littleriscv", "elf32-littleriscv", "elf32-littleriscv")
99
OUTPUT_ARCH(riscv)
1010

11-
PHDRS
12-
{
13-
data PT_LOAD FLAGS(3); /* SHF_WRITE | SHF_ALLOC */
14-
}
15-
16-
ENTRY(_start)
17-
SECTIONS
18-
{
19-
.text 0x0 : {
20-
_text = .;
21-
*(.text.head)
22-
*(.text)
23-
*(.text.*)
24-
*(.gnu.linkonce.t.*)
25-
*(.srodata)
26-
*(.rodata*)
27-
. = ALIGN(16);
28-
*(.dynamic);
29-
. = ALIGN(512);
30-
}
31-
.rela.dyn : { *(.rela.dyn) }
32-
.rela.plt : { *(.rela.plt) }
33-
.rela.got : { *(.rela.got) }
34-
.rela.data : { *(.rela.data) *(.rela.data*) }
35-
_etext = .;
36-
_text_size = . - _text;
37-
. = ALIGN(4096);
38-
.data : {
39-
_data = .;
40-
*(.sdata)
41-
*(.data)
42-
*(.data1)
43-
*(.data.*)
44-
*(.got.plt)
45-
*(.got)
46-
47-
/*
48-
* The EFI loader doesn't seem to like a .bss section, so we
49-
* stick it all into .data:
50-
*/
51-
. = ALIGN(16);
52-
_bss = .;
53-
*(.sbss)
54-
*(.scommon)
55-
*(.dynbss)
56-
*(.bss)
57-
*(.bss.*)
58-
*(COMMON)
59-
. = ALIGN(512);
60-
_bss_end = .;
61-
_edata = .;
62-
} :data
63-
_data_size = _edata - _data;
64-
65-
. = ALIGN(4096);
66-
.dynsym : { *(.dynsym) }
67-
. = ALIGN(4096);
68-
.dynstr : { *(.dynstr) }
69-
. = ALIGN(4096);
70-
.note.gnu.build-id : { *(.note.gnu.build-id) }
71-
/DISCARD/ : {
72-
*(.rel.reloc)
73-
*(.eh_frame)
74-
*(.note.GNU-stack)
75-
}
76-
.comment 0 : { *(.comment) }
77-
}
11+
INCLUDE lib/efi_loader/elf_efi.ldsi

arch/riscv/lib/elf_riscv64_efi.lds

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -8,70 +8,4 @@
88
OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv")
99
OUTPUT_ARCH(riscv)
1010

11-
PHDRS
12-
{
13-
data PT_LOAD FLAGS(3); /* SHF_WRITE | SHF_ALLOC */
14-
}
15-
16-
ENTRY(_start)
17-
SECTIONS
18-
{
19-
.text 0x0 : {
20-
_text = .;
21-
*(.text.head)
22-
*(.text)
23-
*(.text.*)
24-
*(.gnu.linkonce.t.*)
25-
*(.srodata)
26-
*(.rodata*)
27-
. = ALIGN(16);
28-
*(.dynamic);
29-
. = ALIGN(512);
30-
}
31-
.rela.dyn : { *(.rela.dyn) }
32-
.rela.plt : { *(.rela.plt) }
33-
.rela.got : { *(.rela.got) }
34-
.rela.data : { *(.rela.data) *(.rela.data*) }
35-
_etext = .;
36-
_text_size = . - _text;
37-
. = ALIGN(4096);
38-
.data : {
39-
_data = .;
40-
*(.sdata)
41-
*(.data)
42-
*(.data1)
43-
*(.data.*)
44-
*(.got.plt)
45-
*(.got)
46-
47-
/*
48-
* The EFI loader doesn't seem to like a .bss section, so we
49-
* stick it all into .data:
50-
*/
51-
. = ALIGN(16);
52-
_bss = .;
53-
*(.sbss)
54-
*(.scommon)
55-
*(.dynbss)
56-
*(.bss)
57-
*(.bss.*)
58-
*(COMMON)
59-
. = ALIGN(512);
60-
_bss_end = .;
61-
_edata = .;
62-
} :data
63-
_data_size = _edata - _data;
64-
65-
. = ALIGN(4096);
66-
.dynsym : { *(.dynsym) }
67-
. = ALIGN(4096);
68-
.dynstr : { *(.dynstr) }
69-
. = ALIGN(4096);
70-
.note.gnu.build-id : { *(.note.gnu.build-id) }
71-
/DISCARD/ : {
72-
*(.rel.reloc)
73-
*(.eh_frame)
74-
*(.note.GNU-stack)
75-
}
76-
.comment 0 : { *(.comment) }
77-
}
11+
INCLUDE lib/efi_loader/elf_efi.ldsi

doc/board/coolpi/genbook_cm5_rk3588.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Get the TF-A and DDR init (TPL) binaries
2828
cd u-boot
2929
export ROCKCHIP_TPL=../rkbin/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.17.bin
3030
export BL31=../rkbin/bin/rk35/rk3588_bl31_v1.46.elf
31-
make coolpi-genbook-cm5-rk3588_defconfig
31+
make coolpi-cm5-genbook-rk3588_defconfig
3232
make CROSS_COMPILE=aarch64-linux-gnu-
3333

3434
This will build ``u-boot-rockchip.bin`` for eMMC and ``u-boot-rockchip-spi.bin`` for SPI Nor.

0 commit comments

Comments
 (0)