Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Restore code to create md0, this fixes booting an I...
details: https://anonhg.NetBSD.org/src/rev/7b6a74c5b04b
branches: trunk
changeset: 447257:7b6a74c5b04b
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sat Jan 05 18:03:41 2019 +0000
description:
Restore code to create md0, this fixes booting an INSTALL kernel.
diffstat:
sys/kern/kern_subr.c | 30 +++++++++++++++++++++++++-----
1 files changed, 25 insertions(+), 5 deletions(-)
diffs (74 lines):
diff -r aaf54743406c -r 7b6a74c5b04b sys/kern/kern_subr.c
--- a/sys/kern/kern_subr.c Sat Jan 05 16:56:25 2019 +0000
+++ b/sys/kern/kern_subr.c Sat Jan 05 18:03:41 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_subr.c,v 1.221 2019/01/05 09:39:56 mlelstv Exp $ */
+/* $NetBSD: kern_subr.c,v 1.222 2019/01/05 18:03:41 mlelstv Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.221 2019/01/05 09:39:56 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.222 2019/01/05 18:03:41 mlelstv Exp $");
#include "opt_ddb.h"
#include "opt_md.h"
@@ -112,6 +112,7 @@
static const char *getwedgename(const char *, int);
static void setroot_nfs(device_t);
+static void setroot_md(device_t *);
static void setroot_ask(device_t, int);
static void setroot_root(device_t, int);
static void setroot_dump(device_t, device_t);
@@ -193,7 +194,7 @@
* force boot device to md0
*/
if (md_is_root)
- rootspec = "md0";
+ setroot_md(&bootdv);
#ifdef TFTPROOT
/*
@@ -203,10 +204,10 @@
* reuses NFS init code to set up network
* fetch image into ram disk
*
- * if successful, we change rootspec
+ * if successful, we change boot device
*/
if (tftproot_dhcpboot(bootdv) == 0)
- rootspec = "md0";
+ setroot_md(&bootdv);
#endif
/*
@@ -280,6 +281,25 @@
vfs_delref(vops);
}
+/*
+ * Change boot device to md0
+ *
+ * md0 only exists when it is opened once.
+ */
+static void
+setroot_md(device_t *dvp)
+{
+ int md_major;
+ dev_t md_dev;
+
+ md_major = devsw_name2blk("md", NULL, 0);
+ if (md_major >= 0) {
+ md_dev = MAKEDISKDEV(md_major, 0, RAW_PART);
+ if (bdev_open(md_dev, FREAD, S_IFBLK, curlwp) == 0)
+ *dvp = device_find_by_xname("md0");
+ }
+}
+
static void
setroot_ask(device_t bootdv, int bootpartition)
{
Home |
Main Index |
Thread Index |
Old Index