1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-26 09:57:26 +03:00

boot: Introduce DEFINE_EFI_MAIN macro

This commit is contained in:
Jan Janssen 2023-01-19 16:13:03 +01:00
parent 831b6a7fb0
commit 31a131bb32
3 changed files with 13 additions and 20 deletions

View File

@ -2647,7 +2647,7 @@ static EFI_STATUS discover_root_dir(EFI_LOADED_IMAGE_PROTOCOL *loaded_image, EFI
return open_volume(loaded_image->DeviceHandle, ret_dir);
}
static EFI_STATUS real_main(EFI_HANDLE image) {
static EFI_STATUS run(EFI_HANDLE image) {
EFI_LOADED_IMAGE_PROTOCOL *loaded_image;
_cleanup_(file_closep) EFI_FILE *root_dir = NULL;
_cleanup_(config_free) Config config = {};
@ -2747,12 +2747,4 @@ out:
return err;
}
EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
InitializeLib(image, sys_table);
notify_debugger("systemd-boot", /*wait_for_debugger=*/false);
EFI_STATUS err = real_main(image);
log_wait();
return err;
}
DEFINE_EFI_MAIN_FUNCTION(run, "systemd-boot", /*wait_for_debugger=*/false);

View File

@ -180,7 +180,7 @@ static bool use_load_options(
return true;
}
static EFI_STATUS real_main(EFI_HANDLE image) {
static EFI_STATUS run(EFI_HANDLE image) {
_cleanup_free_ void *credential_initrd = NULL, *global_credential_initrd = NULL, *sysext_initrd = NULL, *pcrsig_initrd = NULL, *pcrpkey_initrd = NULL;
size_t credential_initrd_size = 0, global_credential_initrd_size = 0, sysext_initrd_size = 0, pcrsig_initrd_size = 0, pcrpkey_initrd_size = 0;
size_t linux_size, initrd_size, dt_size;
@ -417,12 +417,4 @@ static EFI_STATUS real_main(EFI_HANDLE image) {
return err;
}
EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
InitializeLib(image, sys_table);
notify_debugger("systemd-stub", /*wait_for_debugger=*/false);
EFI_STATUS err = real_main(image);
log_wait();
return err;
}
DEFINE_EFI_MAIN_FUNCTION(run, "systemd-stub", /*wait_for_debugger=*/false);

View File

@ -179,6 +179,15 @@ void hexdump(const char16_t *prefix, const void *data, size_t size);
# define notify_debugger(i, w)
#endif
#define DEFINE_EFI_MAIN_FUNCTION(func, identity, wait_for_debugger) \
EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *system_table) { \
InitializeLib(image, system_table); \
notify_debugger((identity), (wait_for_debugger)); \
EFI_STATUS err = func(image); \
log_wait(); \
return err; \
}
#if defined(__i386__) || defined(__x86_64__)
void beep(UINTN beep_count);
#else