From 2a8e4351ba76fdc8476bd7a3670e507987fbd142 Mon Sep 17 00:00:00 2001 From: Keshav Amburay Date: Tue, 22 Apr 2014 21:46:18 -0400 Subject: Add new config file keyword 'architecture' to specify the architecture of the EFI image --- src/efi/gummiboot.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index d405453..9357b08 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -416,8 +416,9 @@ static VOID print_status(Config *config, EFI_FILE *root_dir, CHAR16 *loaded_imag } Print(L"gummiboot version: " VERSION "\n"); + Print(L"gummiboot arch: " MACHINE_TYPE_NAME "\n"); Print(L"loaded image: %s\n", loaded_image_path); - Print(L"UEFI version: %d.%02d\n", ST->Hdr.Revision >> 16, ST->Hdr.Revision & 0xffff); + Print(L"UEFI specification: %d.%02d\n", ST->Hdr.Revision >> 16, ST->Hdr.Revision & 0xffff); Print(L"firmware vendor: %s\n", ST->FirmwareVendor); Print(L"firmware version: %d.%02d\n", ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff); if (efivar_get_raw(&global_guid, L"SecureBoot", &b, &size) == EFI_SUCCESS) { @@ -846,7 +847,7 @@ static BOOLEAN menu_run(Config *config, ConfigEntry **chosen_entry, EFI_FILE *ro break; case KEYPRESS(0, 0, 'v'): - status = PoolPrint(L"gummiboot " VERSION ", UEFI %d.%02d, %s %d.%02d", + status = PoolPrint(L"gummiboot " VERSION " (" MACHINE_TYPE_NAME "), UEFI Specification %d.%02d, Vendor %s %d.%02d", ST->Hdr.Revision >> 16, ST->Hdr.Revision & 0xffff, ST->FirmwareVendor, ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff); break; @@ -1149,6 +1150,24 @@ static VOID config_entry_add_from_file(Config *config, EFI_HANDLE *device, CHAR1 continue; } + if (strcmpa((CHAR8 *)"architecture", key) == 0) { + CHAR16 *gummiboot_arch = NULL; + CHAR16 *loader_arch = NULL; + + gummiboot_arch = stra_to_str((CHAR8 *)MACHINE_TYPE_NAME); + loader_arch = stra_to_str(value); + + /* do not add an entry for an EFI image of architecture not matching with that of the gummiboot image */ + if (StriCmp(gummiboot_arch, loader_arch) != 0) { + entry->type = LOADER_UNDEFINED; + break; + } + + FreePool(gummiboot_arch); + FreePool(loader_arch); + continue; + } + if (strcmpa((CHAR8 *)"initrd", key) == 0) { CHAR16 *new; -- cgit v1.2.3