diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2019-12-21 10:17:56 +0200 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2021-01-28 08:54:50 +0000 |
commit | 49dbbe99c2e645f5d800fa9f88a97ff6d545efba (patch) | |
tree | 815a90a05cc6f9a0926f9b5e30a524e87c41eae6 /src/arch/x86 | |
parent | 2289a70b6f5fa14f3e008bc6041d8a8bd4ef956b (diff) |
arch/x86: Top-align .text in bootblock
Move .text section closer to .init. This reduces the size
of the flat bootblock binary and footprint in CBFS.
Change-Id: I64325bd633e1104853cfb928c7f801d94ff3045a
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47971
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/arch/x86')
-rw-r--r-- | src/arch/x86/Kconfig | 3 | ||||
-rw-r--r-- | src/arch/x86/bootblock.ld | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig index 4de8c96f1c..943bb91d69 100644 --- a/src/arch/x86/Kconfig +++ b/src/arch/x86/Kconfig @@ -191,6 +191,9 @@ config C_ENV_BOOTBLOCK_SIZE hex default 0x10000 +config FIXED_BOOTBLOCK_SIZE + bool + # Default address romstage is to be linked at config ROMSTAGE_ADDR hex diff --git a/src/arch/x86/bootblock.ld b/src/arch/x86/bootblock.ld index 65952621d9..3cd09003c9 100644 --- a/src/arch/x86/bootblock.ld +++ b/src/arch/x86/bootblock.ld @@ -12,12 +12,25 @@ ap_sipi_vector_in_rom = (_start16bit >> 12) & 0xff; #endif SECTIONS { + +#if CONFIG(FIXED_BOOTBLOCK_SIZE) . = _ebootblock - CONFIG_C_ENV_BOOTBLOCK_SIZE; +#else + . = BOOTBLOCK_TOP - PROGRAM_SZ; + . = ALIGN(16); +#endif _bootblock = .; INCLUDE "bootblock/lib/program.ld" + /* + * Allocation reserves extra space here. Alignment requirements + * may cause the total size of a section to change when the start + * address gets applied. + */ + PROGRAM_SZ = SIZEOF(.text) + 512; + . = MIN(_ID_SECTION, _FIT_POINTER) - EARLYASM_SZ; . = CONFIG(SIPI_VECTOR_IN_ROM) ? ALIGN(4096) : ALIGN(16); BOOTBLOCK_TOP = .; @@ -66,3 +79,5 @@ SECTIONS { _bogus1 = ASSERT(_bootblock & 0x80000000, "_bootblock too low, invalid ld script"); _bogus2 = ASSERT(_start16bit & 0x80000000, "_start16bit too low, invalid ld script"); _bogus3 = ASSERT(_start16bit >= 0xffff0000, "_start16bit too low. Please report."); +_bogus4 = ASSERT(_ebootblock - _bootblock <= CONFIG_C_ENV_BOOTBLOCK_SIZE, + "_bootblock too low, increase C_ENV_BOOTBLOCK_SIZE"); |