[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 <shankerwangmiao@gmail.com>
pull/1417/head
Miao Wang 2025-02-27 23:03:51 +08:00
parent 3114632465
commit 6a9ff34ce5
1 changed files with 6 additions and 0 deletions

View File

@ -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",