Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm/fdt Add support for auto-selection of GPT ro...
details: https://anonhg.NetBSD.org/src/rev/e72d502e1f16
branches: trunk
changeset: 445528:e72d502e1f16
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Thu Nov 01 00:44:06 2018 +0000
description:
Add support for auto-selection of GPT root devices
diffstat:
sys/arch/evbarm/fdt/fdt_machdep.c | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
diffs (64 lines):
diff -r ad91a640cd11 -r e72d502e1f16 sys/arch/evbarm/fdt/fdt_machdep.c
--- a/sys/arch/evbarm/fdt/fdt_machdep.c Thu Nov 01 00:43:38 2018 +0000
+++ b/sys/arch/evbarm/fdt/fdt_machdep.c Thu Nov 01 00:44:06 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.52 2018/10/31 13:37:35 jmcneill Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.53 2018/11/01 00:44:06 jmcneill Exp $ */
/*-
* Copyright (c) 2015-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.52 2018/10/31 13:37:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.53 2018/11/01 00:44:06 jmcneill Exp $");
#include "opt_machdep.h"
#include "opt_bootconfig.h"
@@ -60,6 +60,8 @@
#include <sys/vnode.h>
#include <sys/kauth.h>
#include <sys/fcntl.h>
+#include <sys/uuid.h>
+#include <sys/disk.h>
#include <sys/md5.h>
#include <dev/cons.h>
@@ -629,7 +631,7 @@
uint8_t buf[DEV_BSIZE];
uint8_t hash[16];
const uint8_t *rhash;
- char rootarg[32];
+ char rootarg[64];
struct vnode *vp;
MD5_CTX md5ctx;
int error, len;
@@ -677,6 +679,27 @@
snprintf(rootarg, sizeof(rootarg), " root=%s%c", device_xname(dev), part + 'a');
strcat(boot_args, rootarg);
}
+
+ if (of_hasprop(chosen, "netbsd,gpt-guid")) {
+ char guidbuf[UUID_STR_LEN];
+ const struct uuid *guid = fdtbus_get_prop(chosen, "netbsd,gpt-guid", &len);
+ if (guid == NULL || len != 16)
+ return;
+
+ uuid_snprintf(guidbuf, sizeof(guidbuf), guid);
+ snprintf(rootarg, sizeof(rootarg), " root=wedge:%s", guidbuf);
+ strcat(boot_args, rootarg);
+ }
+
+ if (of_hasprop(chosen, "netbsd,gpt-label")) {
+ const char *label = fdtbus_get_string(chosen, "netbsd,gpt-label");
+ if (label == NULL || *label == '\0')
+ return;
+
+ device_t dv = dkwedge_find_by_wname(label);
+ if (dv != NULL)
+ booted_device = dv;
+ }
}
static void
Home |
Main Index |
Thread Index |
Old Index