summaryrefslogtreecommitdiff
path: root/sys/arch/loongson/stand
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2018-04-20 14:08:13 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2018-04-20 14:08:13 +0000
commit013891cb59289e4c0581986d5c86393f60e152b7 (patch)
tree29e8d677ac277a44b37382f52b94c2cd49be8398 /sys/arch/loongson/stand
parent19ba523bdc430ccce8b245173cbe3bb2cc7bc516 (diff)
Make loongson bootblocks use disklabel duid instead of PMON device name
when indicating the boot device to the kernel. This should reduce ambiguity in root device selection.
Diffstat (limited to 'sys/arch/loongson/stand')
-rw-r--r--sys/arch/loongson/stand/boot/conf.c4
-rw-r--r--sys/arch/loongson/stand/boot/dev.c12
2 files changed, 13 insertions, 3 deletions
diff --git a/sys/arch/loongson/stand/boot/conf.c b/sys/arch/loongson/stand/boot/conf.c
index b4ca61462b0..f23771d0ea3 100644
--- a/sys/arch/loongson/stand/boot/conf.c
+++ b/sys/arch/loongson/stand/boot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.7 2016/09/13 18:27:49 jasper Exp $ */
+/* $OpenBSD: conf.c,v 1.8 2018/04/20 14:08:12 visa Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -39,7 +39,7 @@
#include <lib/libsa/ufs.h>
#include <lib/libsa/cd9660.h>
-const char version[] = "0.5";
+const char version[] = "0.6";
#if 0 /* network code not compiled in */
int debug = 0;
#endif
diff --git a/sys/arch/loongson/stand/boot/dev.c b/sys/arch/loongson/stand/boot/dev.c
index cd093a951bc..d692eacd393 100644
--- a/sys/arch/loongson/stand/boot/dev.c
+++ b/sys/arch/loongson/stand/boot/dev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.c,v 1.8 2015/10/01 20:28:12 krw Exp $ */
+/* $OpenBSD: dev.c,v 1.9 2018/04/20 14:08:12 visa Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -103,6 +103,7 @@ pmon_iostrategy(void *f, int rw, daddr32_t dblk, size_t size, void *buf,
int
pmon_ioopen(struct open_file *f, ...)
{
+ static const u_char zero[8] = { 0 };
struct pmon_iodata *pi;
int rc;
va_list ap;
@@ -145,6 +146,15 @@ pmon_ioopen(struct open_file *f, ...)
return EPART;
}
+ if (memcmp(pi->label.d_uid, zero, sizeof(pi->label.d_uid)) != 0) {
+ const u_char *duid = pi->label.d_uid;
+
+ snprintf(pmon_bootdev, sizeof(pmon_bootdev),
+ "bootduid=%02x%02x%02x%02x%02x%02x%02x%02x",
+ duid[0], duid[1], duid[2], duid[3],
+ duid[4], duid[5], duid[6], duid[7]);
+ }
+
pi->partoff = DL_GETPOFFSET(&pi->label.d_partitions[part]);
pi->curpos = 0;