[PATCH 1/1] efi_loader: require at least 128 KiB of stack space

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Tue Feb 17 09:46:08 CET 2026


On 2/17/26 09:18, Ilias Apalodimas wrote:
> Hi Heinrich,
> 
> On Tue, 17 Feb 2026 at 09:47, Heinrich Schuchardt
> <heinrich.schuchardt at canonical.com> wrote:
>>
>> The UEFI specification requires at least 128 KiB stack space. Consider this
>> value as a prerequisite for CONFIG_EFI_LOADER.
>>
>> Mention the requirement in the CONFIG_STACK_SPACE description and decribe
>> that the UEFI sub-system uses CONFIG_STACK_SPACE when defining the memory
>> map.
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
>> ---
>>   Kconfig                | 8 +++++---
>>   lib/efi_loader/Kconfig | 2 ++
>>   2 files changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/Kconfig b/Kconfig
>> index ce25ea24a60..99b3cd62526 100644
>> --- a/Kconfig
>> +++ b/Kconfig
>> @@ -615,9 +615,11 @@ config STACK_SIZE
>>          default 0x4000 if ARCH_STM32
>>          default 0x1000000
>>          help
>> -         Define Max stack size that can be used by U-Boot. This value is used
>> -         by the UEFI sub-system. On some boards initrd_high is calculated as
>> -         base stack pointer minus this stack size.
>> +         Define Max stack size that can be used by U-Boot. The UEFI sub-system
>> +         considers this value when setting up the memory map. The UEFI
>> +         specification requires 128 KiB or more of available stack space. On
>> +         some boards initrd_high is calculated as base stack pointer minus this
>> +         stack size.
>>
>>   config SYS_MEM_TOP_HIDE
>>          hex "Exclude some memory from U-Boot / OS information"
>> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
>> index 13e44be1d06..450ffa61c0a 100644
>> --- a/lib/efi_loader/Kconfig
>> +++ b/lib/efi_loader/Kconfig
>> @@ -15,6 +15,8 @@ config EFI_LOADER
>>          # We need EFI_STUB_32BIT to be set on x86_32 with EFI_STUB
>>          depends on !EFI_STUB || !X86 || X86_64 || EFI_STUB_32BIT
>>          depends on !EFI_APP
>> +       # The EFI specification requires 128 KiB or more of stack space
>> +       depends on STACK_SIZE >= 0x20000
> 
> Won't this disable EFI for ARCH_STM32 devices? Those define the
> default stack size as 0x4000.

The UEFI specification explicitly requires an enabled MMU.
The ARMv7-M architecture does not offer it.

Best regards

Heinrich

> 
> Thanks
> /Ilias
>>          default y if !ARM || SYS_CPU = armv7 || SYS_CPU = armv8
>>          select EFI
>>          select CHARSET
>> --
>> 2.51.0
>>



More information about the U-Boot mailing list