From 2afeaf1675a6a68636be493a9461e72ce067db19 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Mon, 27 Feb 2023 16:54:48 +0100 Subject: boot: Bring back bootloader builds This adds back sd-boot builds by using meson compile targets directly. We can do this now, because userspace binaries use the special dependency that allows us to easily separate flags, so that we don't pass anything to EFI builds that shouldn't be passed. Additionally, we pass a bunch of flags to hopefully disable/override any distro provided flags that should not be used for EFI binaries. Fixes: #12275 --- meson.build | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 8c4e50de73..cde0c88e48 100644 --- a/meson.build +++ b/meson.build @@ -1972,11 +1972,28 @@ if get_option('bootloader') != 'false' and efi_arch != '' elif get_option('bootloader') == 'true' and efi_arch == '' error('EFI not supported for this arch.') endif + +efi_arch_alt = '' +if efi_arch == 'x64' and cc.links(''' + #include + int main(int argc, char *argv[]) { + return __builtin_popcount(argc - CHAR_MAX); + }''', args : ['-m32', '-march=i686'], name : '32bit build possible') + efi_arch_alt = 'ia32' +endif + +have_pyelftools = pymod.find_installation('python3', required : false, modules : ['elftools']).found() +if get_option('bootloader') == 'true' and (not python_39 or not have_pyelftools) + error('EFI bootloader support requires Python >= 3.9 and pyelftools.') +endif + conf.set10( 'ENABLE_BOOTLOADER', get_option('efi') and get_option('bootloader') in ['auto', 'true'] and - efi_arch != '', + efi_arch != '' and + python_39 and + have_pyelftools, ) if get_option('ukify') == 'auto' @@ -1990,18 +2007,20 @@ conf.set10('ENABLE_UKIFY', want_ukify) ############################################################ # +elf2efi_lds = project_source_root / 'tools/elf2efi.lds' +elf2efi_py = find_program('tools/elf2efi.py') +export_dbus_interfaces_py = find_program('tools/dbus_exporter.py') generate_gperfs = find_program('tools/generate-gperfs.py') make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py') make_directive_index_py = find_program('tools/make-directive-index.py') make_man_index_py = find_program('tools/make-man-index.py') meson_render_jinja2 = find_program('tools/meson-render-jinja2.py') update_dbus_docs_py = find_program('tools/update-dbus-docs.py') -update_man_rules_py = find_program('tools/update-man-rules.py') -update_hwdb_sh = find_program('tools/update-hwdb.sh') update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh') +update_hwdb_sh = find_program('tools/update-hwdb.sh') +update_man_rules_py = find_program('tools/update-man-rules.py') update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh') xml_helper_py = find_program('tools/xml_helper.py') -export_dbus_interfaces_py = find_program('tools/dbus_exporter.py') ############################################################ -- cgit v1.2.1