Module Name: src
Committed By: jmcneill
Date: Sun Jan 15 10:18:58 UTC 2012
Modified Files:
src/sys/arch/usermode/dev: cpu.c
src/sys/arch/usermode/usermode: machdep.c
Log Message:
allow specifing the root device with 'root=ldN' parameter
To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/usermode/dev/cpu.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/usermode/usermode/machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.65 src/sys/arch/usermode/dev/cpu.c:1.66
--- src/sys/arch/usermode/dev/cpu.c:1.65 Sat Jan 14 21:45:28 2012
+++ src/sys/arch/usermode/dev/cpu.c Sun Jan 15 10:18:58 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.65 2012/01/14 21:45:28 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.66 2012/01/15 10:18:58 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <[email protected]>
@@ -30,7 +30,7 @@
#include "opt_hz.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.65 2012/01/14 21:45:28 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.66 2012/01/15 10:18:58 jmcneill Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -380,11 +380,16 @@ cpu_startup(void)
void
cpu_rootconf(void)
{
+ extern char *usermode_root_device;
device_t rdev;
- rdev = device_find_by_xname("ld0");
- if (rdev == NULL)
- rdev = device_find_by_xname("md0");
+ if (usermode_root_device != NULL) {
+ rdev = device_find_by_xname(usermode_root_device);
+ } else {
+ rdev = device_find_by_xname("ld0");
+ if (rdev == NULL)
+ rdev = device_find_by_xname("md0");
+ }
aprint_normal("boot device: %s\n",
rdev ? device_xname(rdev) : "<unknown>");
Index: src/sys/arch/usermode/usermode/machdep.c
diff -u src/sys/arch/usermode/usermode/machdep.c:1.50 src/sys/arch/usermode/usermode/machdep.c:1.51
--- src/sys/arch/usermode/usermode/machdep.c:1.50 Sat Jan 7 18:10:18 2012
+++ src/sys/arch/usermode/usermode/machdep.c Sun Jan 15 10:18:58 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.50 2012/01/07 18:10:18 jmcneill Exp $ */
+/* $NetBSD: machdep.c,v 1.51 2012/01/15 10:18:58 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Reinoud Zandijk <[email protected]>
@@ -37,7 +37,7 @@
#include "opt_memsize.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.50 2012/01/07 18:10:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.51 2012/01/15 10:18:58 jmcneill Exp $");
#include <sys/types.h>
#include <sys/systm.h>
@@ -78,6 +78,7 @@ char *usermode_tap_device = NULL;
char *usermode_tap_eaddr = NULL;
static char usermode_audio_devicebuf[PATH_MAX] = "";
char *usermode_audio_device = NULL;
+char *usermode_root_device = NULL;
int usermode_vnc_width = 0;
int usermode_vnc_height = 0;
int usermode_vnc_port = -1;
@@ -92,12 +93,14 @@ usage(const char *pn)
" [net=<tapdev>,<eaddr>]"
" [audio=<audiodev>]"
" [disk=<diskimg> ...]"
+ " [root=<device>]"
" [vnc=<width>x<height>,<port>]\n",
pn);
printf(" (ex. \"%s"
" net=tap0,00:00:be:ef:ca:fe"
" audio=audio0"
" disk=root.fs"
+ " root=ld0"
" vnc=640x480,5900\")\n", pn);
}
@@ -185,6 +188,10 @@ main(int argc, char *argv[])
usermode_disk_image_path[
usermode_disk_image_path_count++] =
argv[i] + strlen("disk=");
+ } else if (strncmp(argv[i], "root=",
+ strlen("root=")) == 0) {
+ usermode_root_device = argv[i] +
+ strlen("root=");
} else {
printf("%s: unknown parameter\n", argv[i]);
usage(argv[0]);