Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sandpoint/stand/altboot Similar to changes made for...



details:   https://anonhg.NetBSD.org/src/rev/2409cfccec86
branches:  trunk
changeset: 452279:2409cfccec86
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Wed Jun 26 00:54:04 2019 +0000

description:
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.

diffstat:

 sys/arch/sandpoint/stand/altboot/main.c |  41 +++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 2 deletions(-)

diffs (69 lines):

diff -r 31439777e2be -r 2409cfccec86 sys/arch/sandpoint/stand/altboot/main.c
--- a/sys/arch/sandpoint/stand/altboot/main.c   Wed Jun 26 00:30:39 2019 +0000
+++ b/sys/arch/sandpoint/stand/altboot/main.c   Wed Jun 26 00:54:04 2019 +0000
@@ -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 @@
 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 @@
 
                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_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)
 {



Home | Main Index | Thread Index | Old Index