From 6a9ff34ce521409b5aacfa3e6758eb7a8456b2bf Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Thu, 27 Feb 2025 23:03:51 +0800 Subject: [PATCH] [efi] replace efi_snp_load_file with a stub when EFI_DOWNGRADE_UX is reuqested When EFI_DOWNGRADE_UX is requested, efi_load_file_protocol_guid is replaced with a dummy one, preventing that protocol from registering, which makes the function efi_snp_load_file useless. This patch replaces this function with a stub when EFI_DOWNGRADE_UX is requested, to prevent dragging in the ipxe() symbol, to prevent further dragging in more symbols and objects. Signed-off-by: Miao Wang --- src/interface/efi/efi_snp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/interface/efi/efi_snp.c b/src/interface/efi/efi_snp.c index f00354126..665dc9923 100644 --- a/src/interface/efi/efi_snp.c +++ b/src/interface/efi/efi_snp.c @@ -84,7 +84,9 @@ static EFI_GUID dummy_load_file_protocol_guid = { { 0x6e, 0x68, 0x65, 0x6c, 0x70, 0x66, 0x75, 0x6c } }; #define efi_load_file_protocol_guid dummy_load_file_protocol_guid +#define is_efi_downgrade_ux 1 #else +#define is_efi_downgrade_ux 0 REQUIRE_OBJECT ( config_efi_console ); #endif @@ -1724,6 +1726,10 @@ efi_snp_load_file ( EFI_LOAD_FILE_PROTOCOL *load_file, struct net_device *netdev = snpdev->netdev; int rc; + if ( is_efi_downgrade_ux ) { + return EFI_UNSUPPORTED; + } + /* Fail unless this is a boot attempt */ if ( ! booting ) { DBGC ( snpdev, "SNPDEV %p cannot load non-boot file\n",