EFI bootloader fix

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

EFI bootloader fix

Mark Kettenis
Some versions of U-Boot do not include a "media device path" node in
the boot device path, even though the OpenBSD bootloader has been
loaded from an MS-DOS partition.

The UEFI specification isn't very clear whether such a media device
path node is required or not.  Unfortunately our current EFI
bootloader code pretty much requires it.  The diff below fixes that by
having efi_device_path_depth() return the full depth if no media
device path node is found.

This makes OpenBSD boot reliable on the Theobroma Systems RK3399 Q7
"Puma" board.  And it might help booting using some of the "default"
U-Boot setups on the rock64, rockpro64 and pinebook pro.

Tested this on armv7 (U-Boot), arm64 (U-Boot and real UEFI) and amd64
(real UEFI).

ok?


Index: armv7/stand/efiboot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/armv7/stand/efiboot/conf.c,v
retrieving revision 1.23
diff -u -p -r1.23 conf.c
--- armv7/stand/efiboot/conf.c 1 Mar 2020 15:04:48 -0000 1.23
+++ armv7/stand/efiboot/conf.c 21 Mar 2020 13:08:06 -0000
@@ -42,7 +42,7 @@
 #include "efidev.h"
 #include "efipxe.h"
 
-const char version[] = "1.10";
+const char version[] = "1.11";
 int debug = 0;
 
 struct fs_ops file_system[] = {
Index: armv7/stand/efiboot/efiboot.c
===================================================================
RCS file: /cvs/src/sys/arch/armv7/stand/efiboot/efiboot.c,v
retrieving revision 1.26
diff -u -p -r1.26 efiboot.c
--- armv7/stand/efiboot/efiboot.c 13 Jan 2020 10:17:09 -0000 1.26
+++ armv7/stand/efiboot/efiboot.c 21 Mar 2020 13:08:06 -0000
@@ -301,7 +301,7 @@ efi_device_path_depth(EFI_DEVICE_PATH *d
  return (i);
  }
 
- return (-1);
+ return (i);
 }
 
 int
Index: arm64/stand/efiboot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/arm64/stand/efiboot/conf.c,v
retrieving revision 1.25
diff -u -p -r1.25 conf.c
--- arm64/stand/efiboot/conf.c 29 Feb 2020 11:58:57 -0000 1.25
+++ arm64/stand/efiboot/conf.c 21 Mar 2020 13:08:06 -0000
@@ -46,7 +46,7 @@
 #include "efipxe.h"
 #include "softraid_arm64.h"
 
-const char version[] = "0.20";
+const char version[] = "0.21";
 int debug = 0;
 
 struct fs_ops file_system[] = {
Index: arm64/stand/efiboot/efiboot.c
===================================================================
RCS file: /cvs/src/sys/arch/arm64/stand/efiboot/efiboot.c,v
retrieving revision 1.26
diff -u -p -r1.26 efiboot.c
--- arm64/stand/efiboot/efiboot.c 12 Aug 2019 20:04:31 -0000 1.26
+++ arm64/stand/efiboot/efiboot.c 21 Mar 2020 13:08:06 -0000
@@ -308,7 +308,7 @@ efi_device_path_depth(EFI_DEVICE_PATH *d
  return (i);
  }
 
- return (-1);
+ return (i);
 }
 
 int
Index: amd64/stand/efiboot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/conf.c,v
retrieving revision 1.26
diff -u -p -r1.26 conf.c
--- amd64/stand/efiboot/conf.c 5 Mar 2020 16:36:30 -0000 1.26
+++ amd64/stand/efiboot/conf.c 21 Mar 2020 13:08:06 -0000
@@ -40,7 +40,7 @@
 #include "efidev.h"
 #include "efipxe.h"
 
-const char version[] = "3.49";
+const char version[] = "3.50";
 
 #ifdef EFI_DEBUG
 int debug = 0;
Index: amd64/stand/efiboot/efiboot.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/efiboot.c,v
retrieving revision 1.34
diff -u -p -r1.34 efiboot.c
--- amd64/stand/efiboot/efiboot.c 29 Nov 2019 16:16:19 -0000 1.34
+++ amd64/stand/efiboot/efiboot.c 21 Mar 2020 13:08:06 -0000
@@ -253,7 +253,7 @@ efi_device_path_depth(EFI_DEVICE_PATH *d
  return (i);
  }
 
- return (-1);
+ return (i);
 }
 
 int