Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbmips/cavium Handle using "octeth" as root device...



details:   https://anonhg.NetBSD.org/src/rev/819bb1759b99
branches:  trunk
changeset: 942724:819bb1759b99
user:      simonb <simonb%NetBSD.org@localhost>
date:      Mon Aug 17 06:23:01 2020 +0000

description:
Handle using "octeth" as root device by converting "octethN" to "cnmacN"
for any N < 100.  This allows booting for u-boot to use root=$(ethact)
on the command line and the kernel can use the ethernet interface the
kernel was loaded on as the NFS root device.

diffstat:

 sys/arch/evbmips/cavium/autoconf.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (43 lines):

diff -r c8578a09a089 -r 819bb1759b99 sys/arch/evbmips/cavium/autoconf.c
--- a/sys/arch/evbmips/cavium/autoconf.c        Mon Aug 17 06:18:39 2020 +0000
+++ b/sys/arch/evbmips/cavium/autoconf.c        Mon Aug 17 06:23:01 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.8 2020/06/23 05:19:12 simonb Exp $      */
+/*     $NetBSD: autoconf.c,v 1.9 2020/08/17 06:23:01 simonb Exp $      */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.8 2020/06/23 05:19:12 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.9 2020/08/17 06:23:01 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -95,12 +95,24 @@
                return;
 
        if (rootspec && *rootspec) {
+               /* if we get passed root=octethN, convert to cnmacN */
+               if (strncmp(rootspec, "octeth", 6) == 0) {
+                       /* allow for up to 100 interfaces */
+                       static char buf[sizeof("cnmacXX")];
+                       const char *cp = &rootspec[strlen("octeth")];
+
+                       KASSERT(strlen(cp) < sizeof("XX"));
+                       snprintf(buf, sizeof(buf), "cnmac%s", cp);
+                       rootspec = buf;
+               }
+
                /* XXX hard coded "cnmac" for network boot */
                if (strncmp(rootspec, "cnmac", 5) == 0) {
                        rootfstype = "nfs";
                        netboot = 1;
                        return;
                }
+
                /*
                 * XXX
                 * Assume that if the root spec is not a cnmac, it'll



Home | Main Index | Thread Index | Old Index