bug-hurd
[Top][All Lists]
Advanced

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

Re: Getting rid of serverboot


From: Neal H Walfield
Subject: Re: Getting rid of serverboot
Date: Fri, 24 Aug 2001 14:34:10 +0200
User-agent: Mutt/1.3.18i

> > > line into var=arg pairs, however, I did a small modification so that we
> > > fill in the root boot script variable and not root-device in the
> > > (new) serverboot-less case.
> > 
> > I am not including this change.  The reason that boot-args and root-device
> > are still set as special cases at all is so that a new kernel can still
> > boot an old boot script for an old hurd.  The setting of root should just
> > come from the generic parsing of the command line.
> 
> This is wrong; this change only affects the non-compatabillty case.

The point is now moot.  As promised, here are the changes necessary to
parse the multiboot command line and set up the boot-script variables.

2001-08-24  Neal H Walfield  <neal@cs.uml.edu>

        * kern/bootstrap.c (bootstrap_create) [!OSKIT_MACH]: Parse the
        multiboot command line and populate the boot-script variables
        with all values that look like VAR=VAL.


Index: bootstrap.c
===================================================================
RCS file: /cvs/gnumach/kern/bootstrap.c,v
retrieving revision 1.3.2.9
diff -u -p -r1.3.2.9 bootstrap.c
--- bootstrap.c 2001/08/20 22:16:53     1.3.2.9
+++ bootstrap.c 2001/08/24 12:29:11
@@ -158,24 +158,51 @@ void bootstrap_create()
       }
 #else  /* GNUmach, not oskit-mach */
       {
-       char *flag_string = alloca(1024);
-       char *root_string = alloca(1024);
+       char *start;
+       char *end;
 
-       /*
-        * Get the (compatibility) boot flags and root name strings.
-        */
-       get_compat_strings(flag_string, root_string);
-
-       losers = boot_script_set_variable ("boot-args", VAL_STR,
-                                          (int) flag_string);
-       if (losers)
-         panic ("cannot set boot-script variable %s: %s",
-                "boot-args", boot_script_error_string (losers));
-       losers = boot_script_set_variable ("root-device", VAL_STR,
-                                          (int) root_string);
-       if (losers)
-         panic ("cannot set boot-script variable %s: %s",
-                "root-device", boot_script_error_string (losers));
+       for (start = end = kernel_cmdline; *end; end ++)
+         {
+           while (*end == ' ' || *end == '\t')
+             start = ++end;
+           if (! *end)
+             break;
+
+           if (*end == '=' && start != end)
+             {
+               char *var;
+               char *val;
+
+               var = alloca (end - start + 1);
+               memcpy (var, start, end - start);
+               var[end - start] = '\0';
+
+               start = end + 1;
+
+               end = (char *) strpbrk (start, " \t");
+               if (! end)
+                 {
+                   val = alloca (strlen (start) + 1);
+                   strcpy (val, start);
+
+                   end = start += strlen (start);
+                 }
+               else
+                 {
+                   val = alloca (end - start + 1);
+                   memcpy (val, start, end - start);
+                   val[end - start] = '\0';
+
+                   start = ++ end; 
+                 }
+
+               losers = boot_script_set_variable (val, VAL_STR, (int) var);
+               if (losers)
+                 panic ("cannot set boot-script variable %s: %s",
+                        val, boot_script_error_string (losers));
+             }
+         }
+
       }
 #endif
 

Attachment: pgp1c8Pk8q1nW.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]