Module Name: src
Committed By: simonb
Date: Mon Aug 17 06:23:01 UTC 2020
Modified Files:
src/sys/arch/evbmips/cavium: autoconf.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbmips/cavium/autoconf.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/evbmips/cavium/autoconf.c
diff -u src/sys/arch/evbmips/cavium/autoconf.c:1.8 src/sys/arch/evbmips/cavium/autoconf.c:1.9
--- src/sys/arch/evbmips/cavium/autoconf.c:1.8 Tue Jun 23 05:19:12 2020
+++ src/sys/arch/evbmips/cavium/autoconf.c Mon Aug 17 06:23:01 2020
@@ -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 @@ findroot(void)
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