Module Name:    src
Committed By:   pgoyette
Date:           Wed Jun 26 00:54:04 UTC 2019

Modified Files:
        src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Similar to changes made for x86, allow for the boot-loader to auto-push
a list of modules for file-system support.  This allows, for example,
booting from an ext2fs file-system when the kernel has no built-in ufs
or ext2fs modules.

XXX Untested, as I have no sandpoint hardware.  I'd appreciate it if
XXX someone with hardware can build and test.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.29 src/sys/arch/sandpoint/stand/altboot/main.c:1.30
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.29	Thu Feb  8 09:05:18 2018
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Wed Jun 26 00:54:04 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.29 2018/02/08 09:05:18 dholland Exp $ */
+/* $NetBSD: main.c,v 1.30 2019/06/26 00:54:04 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -90,6 +90,7 @@ uint32_t kmodloadp;
 int modules_enabled = 0;
 
 void module_add(const char *);
+void module_add_split(const char *);
 void module_load(const char *);
 int module_open(struct boot_module *);
 
@@ -367,7 +368,7 @@ main(int argc, char *argv[], char *boota
 
 		if (modules_enabled) {
 			if (fsmod != NULL)
-				module_add(fsmod);
+				module_add_split(fsmod);
 			kmodloadp = marks[MARK_END];
 			btinfo_modulelist = NULL;
 			module_load(bname);
@@ -423,6 +424,42 @@ bi_add(void *new, int type, int size)
 	bi_next += size;
 }
 
+/*
+ * Add a /-separated list of module names to the boot list
+ */
+static void
+module_add_split(const char *name)
+{
+	char mod_name[MAXMODNAME];
+	int i;
+	const char *mp = name;
+	char *ep;
+
+	while (*mp) {				/* scan list of module names */
+		i = MAXMODNAME;
+		ep = mod_name;
+		while (--i) {			/* scan for end of first name */
+			*ep = *mp;
+			if (*ep == '/')		/* NUL-terminate the name */
+				*ep = '\0';
+
+			if (*ep == 0 ) {	/* add non-empty name */
+				if (ep != mod_name)
+					module_add(mod_name);
+				break;
+			}
+			ep++; mp++;
+		}
+		if (*ep != 0) {
+			printf("module name too long\n");
+			return;
+		}
+		if  (*mp == '/') {		/* skip separator if more */
+			mp++;
+		}
+	}
+}
+
 void
 module_add(const char *name)
 {

Reply via email to