4 ms·
> I'd quite like UEFI to be able to pass some kind of argv[0] to the direct-loaded kernel, so the kernel knows exactly which file on which partition of which d
by bpye 3y ago
> I'd quite like UEFI to be able to pass some kind of argv[0] to the direct-loaded kernel, so the kernel knows exactly which file on which partition of which disk it was loaded from. That would then become the default root filesystem.
I think UEFI gives an EFI application (such as the Linux kernel) everything it would need for this already - but I guess Linux doesn't use it.
The EFI application entry point includes a handle to your own image [0], and the EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID [1] protocol allows you to query the path it was loaded from. It is possible for an image to be loaded without a path, but it looks like EDK2 provides it at least [2].
[0] - https://uefi.org/specs/UEFI/2.10/07_Services_Boot_Services.html#efi-image-entry-point https://uefi.org/specs/UEFI/2.10/07_Services_Boot_Services.h...
[1] - https://uefi.org/specs/UEFI/2.10/09_Protocols_EFI_Loaded_Image.html#efi-loaded-image-device-path-protocol https://uefi.org/specs/UEFI/2.10/09_Protocols_EFI_Loaded_Ima...
[2] - https://github.com/tianocore/edk2/blob/991515a0583f65a64b3a6fa354409c64e670a762/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c#L1932 https://github.com/tianocore/edk2/blob/991515a0583f65a64b3a6...