Hi,
in comparison to my usual diffs this is actually amd64 and not arm64.
I'm surprised this didn't come up earlier, but I think the for-loop is a
bit wrong. What the code is supposed to be doing is going over each
device path node for the loaded image, which is supposed to be the path
to the device that efiboot was loaded from, and check for a node that
is a medium (as in hard drive, cdrom) and look for a hard drive.
As it turns out, the code would actually skip all device paths that
are mediums and instead match on all non-media types. It's surprising
to me that this seems to work for people.
On Qemu and VMware the first node in the device path is ACPI (2) with
subtype (1). Interestingly, the hard drive subtype in the media type
has the subtype (1) as well. So that might be a reason it did work.
Patrick
diff --git a/sys/arch/amd64/stand/efiboot/efiboot.c
b/sys/arch/amd64/stand/efiboot/efiboot.c
index 1903862d271..84648a1bd19 100644
--- a/sys/arch/amd64/stand/efiboot/efiboot.c
+++ b/sys/arch/amd64/stand/efiboot/efiboot.c
@@ -87,7 +87,7 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
if (status == EFI_SUCCESS) {
for (dp = dp0; !IsDevicePathEnd(dp);
dp = NextDevicePathNode(dp)) {
- if (DevicePathType(dp) == MEDIA_DEVICE_PATH)
+ if (DevicePathType(dp) != MEDIA_DEVICE_PATH)
continue;
if (DevicePathSubType(dp) == MEDIA_HARDDRIVE_DP) {
bios_bootdev = 0x80;