Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/stand/efiboot Load boot.cfg from the EFI system partitio...
details: https://anonhg.NetBSD.org/src/rev/7982b34ccf68
branches: trunk
changeset: 973346:7982b34ccf68
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Jun 27 17:23:08 2020 +0000
description:
Load boot.cfg from the EFI system partition instead of the first FFS
partition on that device.
diffstat:
sys/stand/efiboot/boot.c | 10 +++++++---
sys/stand/efiboot/efifile.c | 21 ++++++++++++++++++++-
sys/stand/efiboot/efifile.h | 4 +++-
3 files changed, 30 insertions(+), 5 deletions(-)
diffs (89 lines):
diff -r 41fa19aca5c2 -r 7982b34ccf68 sys/stand/efiboot/boot.c
--- a/sys/stand/efiboot/boot.c Sat Jun 27 17:22:12 2020 +0000
+++ b/sys/stand/efiboot/boot.c Sat Jun 27 17:23:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.24 2020/06/26 03:23:04 thorpej Exp $ */
+/* $NetBSD: boot.c,v 1.25 2020/06/27 17:23:08 jmcneill Exp $ */
/*-
* Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -29,6 +29,7 @@
#include "efiboot.h"
#include "efiblock.h"
+#include "efifile.h"
#include "efifdt.h"
#include "efiacpi.h"
#include "efienv.h"
@@ -539,11 +540,15 @@
void
boot(void)
{
+ char pathbuf[80];
int currname, c;
read_env();
- parsebootconf(BOOTCFG_FILENAME);
+ if (efi_bootdp != NULL && efi_file_path(efi_bootdp, BOOTCFG_FILENAME, pathbuf, sizeof(pathbuf)) == 0) {
+ twiddle_toggle = 1;
+ parsebootconf(pathbuf);
+ }
if (bootcfg_info.clear)
uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);
@@ -551,7 +556,6 @@
print_banner();
/* Display menu if configured */
- twiddle_toggle = 1;
if (bootcfg_info.nummenu > 0) {
doboottypemenu(); /* No return */
}
diff -r 41fa19aca5c2 -r 7982b34ccf68 sys/stand/efiboot/efifile.c
--- a/sys/stand/efiboot/efifile.c Sat Jun 27 17:22:12 2020 +0000
+++ b/sys/stand/efiboot/efifile.c Sat Jun 27 17:23:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efifile.c,v 1.3 2018/08/26 21:28:18 jmcneill Exp $ */
+/* $NetBSD: efifile.c,v 1.4 2020/06/27 17:23:08 jmcneill Exp $ */
/*-
* Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -146,3 +146,22 @@
return 0;
}
+
+int
+efi_file_path(EFI_DEVICE_PATH *dp, const char *fname, char *buf, size_t buflen)
+{
+ UINTN vol;
+ int depth;
+
+ depth = efi_device_path_depth(dp, END_DEVICE_PATH_TYPE);
+
+ for (vol = 0; vol < efi_nvol; vol++) {
+ if (efi_device_path_ncmp(dp, DevicePathFromHandle(efi_vol[vol]), depth) == 0)
+ break;
+ }
+ if (vol == efi_nvol)
+ return ENOENT;
+
+ snprintf(buf, buflen, "fs%u:%s", (u_int)vol, fname);
+ return 0;
+}
diff -r 41fa19aca5c2 -r 7982b34ccf68 sys/stand/efiboot/efifile.h
--- a/sys/stand/efiboot/efifile.h Sat Jun 27 17:22:12 2020 +0000
+++ b/sys/stand/efiboot/efifile.h Sat Jun 27 17:23:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efifile.h,v 1.1 2018/08/24 02:01:06 jmcneill Exp $ */
+/* $NetBSD: efifile.h,v 1.2 2020/06/27 17:23:08 jmcneill Exp $ */
/*-
* Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -31,3 +31,5 @@
int efi_file_open(struct open_file *, ...);
int efi_file_close(struct open_file *);
int efi_file_strategy(void *, int, daddr_t, size_t, void *, size_t *);
+int efi_file_path(EFI_DEVICE_PATH *, const char *, char *, size_t);
+
Home |
Main Index |
Thread Index |
Old Index