1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-03 16:58:37 +03:00

meson: increase default number of available sections for the stub

Now that we have multi-profile UKIs people likely want to stick more PE
sections into them than before. Hence, bump the number of available PE
section slots to 30 (up from 15). Also, make this configurable at build
time since some folks probably want even more, and others don't want
this at all.

(pre-allocating too many shouldn't matter too much btw, I'd advise
everyone to overshoot, except maybe on the tiniest of embedded boards)
This commit is contained in:
Lennart Poettering 2024-07-10 10:46:39 +02:00 committed by Yu Watanabe
parent 59e6059513
commit 41a9a502a1
2 changed files with 14 additions and 2 deletions

View File

@ -486,6 +486,10 @@ option('efi-color-highlight', type : 'string', value : 'black,lightgray',
description : 'boot loader color for selected entries')
option('efi-color-edit', type : 'string', value : 'black,lightgray',
description : 'boot loader color for option line edit')
option('efi-stub-extra-sections', type : 'integer', value : 30,
description : 'minimum number of sections to keep free in stub PE header')
option('efi-addon-extra-sections', type : 'integer', value : 15,
description : 'minimum number of sections to keep free in addon PE header')
option('bashcompletiondir', type : 'string',
description : 'directory for bash completion scripts ["no" disables]')

View File

@ -379,9 +379,17 @@ endforeach
foreach efi_elf_binary : efi_elf_binaries
name = efi_elf_binary.name()
name += name.startswith('systemd-boot') ? '.efi' : '.efi.stub'
# For the addon, given it's empty, we need to explicitly reserve space in the header to account for
# the sections that ukify will add.
minimum_sections = name.endswith('.stub') ? '15' : '0'
if name.startswith('linux')
minimum_sections = get_option('efi-stub-extra-sections')
elif name.startswith('addon')
minimum_sections = get_option('efi-addon-extra-sections')
else
minimum_sections = 0
endif
exe = custom_target(
name,
output : name,
@ -396,7 +404,7 @@ foreach efi_elf_binary : efi_elf_binaries
'--efi-major=1',
'--efi-minor=1',
'--subsystem=10',
'--minimum-sections=' + minimum_sections,
'--minimum-sections=@0@'.format(minimum_sections),
'--copy-sections=.sbat,.sdmagic,.osrel',
'@INPUT@',
'@OUTPUT@',