diff options
author | Roland McGrath <roland@gnu.org> | 2001-08-24 21:30:05 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2001-08-24 21:30:05 +0000 |
commit | e51ac98a35560a32cc26eab30569c3a3d157fb29 (patch) | |
tree | c6d51705929149e1d3ec3ecf3cc3700b407d2a67 /kern/bootstrap.c | |
parent | 068628124d939819df803ff2885713852158d9a8 (diff) |
2001-08-24 Roland McGrath <roland@frob.com>
* kern/bootstrap.c (bootstrap_create): Make setting of boot-args and
root-device no longer conditional on [! OSKIT_MACH].
(bootstrap_create) [! OSKIT_MACH]: Parse FOO=BAR words out of the
multiboot command line and turn those into boot script variables.
Diffstat (limited to 'kern/bootstrap.c')
-rw-r--r-- | kern/bootstrap.c | 61 |
1 files changed, 43 insertions, 18 deletions
diff --git a/kern/bootstrap.c b/kern/bootstrap.c index c0de921..a504115 100644 --- a/kern/bootstrap.c +++ b/kern/bootstrap.c @@ -135,6 +135,31 @@ void bootstrap_create() panic ("cannot set boot-script variable %s: %s", "kernel-command-line", boot_script_error_string (losers)); + { + /* Set the same boot script variables that the old Hurd's + serverboot did, so an old Hurd and boot script previously + used with serverboot can be used directly with this kernel. */ + + char *flag_string = alloca(1024); + char *root_string = alloca(1024); + + /* + * 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)); + } + #if OSKIT_MACH { /* The oskit's "environ" array contains all the words from @@ -158,24 +183,24 @@ void bootstrap_create() } #else /* GNUmach, not oskit-mach */ { - char *flag_string = alloca(1024); - char *root_string = alloca(1024); - - /* - * 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)); + /* Turn each `FOO=BAR' word in the command line into a boot script + variable ${FOO} with value BAR. This matches what we get from + oskit's environ in the oskit-mach case (above). */ + + int len = strlen (kernel_cmdline) + 1; + char *s = memcpy (alloca (len), kernel_cmdline, len); + char *word; + while ((word = strsep (&s, " \t")) != 0) + { + char *eq = strchr (word, '='); + if (eq == 0) + continue; + *eq++ = '\0'; + losers = boot_script_set_variable (word, VAL_STR, (int) eq); + if (losers) + panic ("cannot set boot-script variable %s: %s", + word, boot_script_error_string (losers)); + } } #endif |