Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/usermode allow specifing the root device with 'root...



details:   https://anonhg.NetBSD.org/src/rev/5d5836a27e69
branches:  trunk
changeset: 772762:5d5836a27e69
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Jan 15 10:18:58 2012 +0000

description:
allow specifing the root device with 'root=ldN' parameter

diffstat:

 sys/arch/usermode/dev/cpu.c          |  15 ++++++++++-----
 sys/arch/usermode/usermode/machdep.c |  11 +++++++++--
 2 files changed, 19 insertions(+), 7 deletions(-)

diffs (90 lines):

diff -r b0a9242c84a8 -r 5d5836a27e69 sys/arch/usermode/dev/cpu.c
--- a/sys/arch/usermode/dev/cpu.c       Sun Jan 15 06:53:23 2012 +0000
+++ b/sys/arch/usermode/dev/cpu.c       Sun Jan 15 10:18:58 2012 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
 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>");
diff -r b0a9242c84a8 -r 5d5836a27e69 sys/arch/usermode/usermode/machdep.c
--- a/sys/arch/usermode/usermode/machdep.c      Sun Jan 15 06:53:23 2012 +0000
+++ b/sys/arch/usermode/usermode/machdep.c      Sun Jan 15 10:18:58 2012 +0000
@@ -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 <reinoud%netbsd.org@localhost>
@@ -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_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 @@
            " [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 @@
                                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]);



Home | Main Index | Thread Index | Old Index