From 97443208a79f94e7a41dbf066f1204b0e4e80d0c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 5 Jul 2012 09:24:23 +0200 Subject: [PATCH] export LoaderDevicePath= to allow the OS to find the active ESP --- gummiboot.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gummiboot.c b/gummiboot.c index 60d7d23..3d36ae4 100644 --- a/gummiboot.c +++ b/gummiboot.c @@ -1257,6 +1257,7 @@ EFI_STATUS EFIAPI efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { EFI_LOADED_IMAGE *loaded_image; EFI_FILE *root_dir; CHAR16 *loaded_image_path; + EFI_DEVICE_PATH *device_path; EFI_STATUS err; Config config; UINT64 ticks; @@ -1274,6 +1275,11 @@ EFI_STATUS EFIAPI efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { return err; } + /* export the device path this image is started from */ + device_path = DevicePathFromHandle(loaded_image->DeviceHandle); + if (device_path) + efivar_set(L"LoaderDevicePath", DevicePathToStr(device_path), FALSE); + root_dir = LibOpenRoot(loaded_image->DeviceHandle); if (!root_dir) { Print(L"Unable to open root directory: %r ", err); @@ -1281,11 +1287,11 @@ EFI_STATUS EFIAPI efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { return EFI_LOAD_ERROR; } - ZeroMem(&config, sizeof(Config)); - + /* the filesystem path to this image, to prevent adding ourselves to the menu */ loaded_image_path = DevicePathToStr(loaded_image->FilePath); /* scan "\loader\entries\*.conf" files */ + ZeroMem(&config, sizeof(Config)); config_load(&config, root_dir, loaded_image_path); /* if we find some well-known loaders, add them to the end of the list */ -- 2.7.4