Hello everyone, until now, I had been hardcoding the boot device to be the first CD/DVD (when no boot device is specified on the configuration file), but now I want to get the boot device in the right way, for CD/DVD and USB boot.
How exactly should I do this?
How to get the boot device on UEFI?
Re: How to get the boot device on UEFI?
if i am not mistaken, you can get the DeviceHandle from your LoadedImageProtocol; then, the volume that you are booted from should have that handle as well.
you can get handles using bs->LocateHandleBuffer(...).
you can get handles using bs->LocateHandleBuffer(...).
[nx] kernel: http://github.com/zhiayang/nx
Re: How to get the boot device on UEFI?
zhiayang is correct, you can obtain the boot device handle from the LoadedImageProtocol:
Then the boot device handle is at "image->DeviceHandle".
Code: Select all
extern "C" EFI_STATUS efi_main(EFI_HANDLE hImage, EFI_SYSTEM_TABLE* systemTable)
{
// Get access to the boot file system
EFI_LOADED_IMAGE_PROTOCOL* image;
status = BS->HandleProtocol(hImage, &efiLoadedImageProtocolGuid, (void**)&image);