summaryrefslogtreecommitdiff
path: root/boot/boot.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-10-07 20:01:35 +0000
committerRoland McGrath <roland@gnu.org>2001-10-07 20:01:35 +0000
commit342738229ca024e2de915a941683407779bbbcb8 (patch)
treee5056cd5e82dcaa8b0cd7e6957eeb3dfbf318153 /boot/boot.c
parent749db1a91bef957bad9f6b711a3b89e406e8022c (diff)
2001-10-07 Neal H Walfield <neal@cs.uml.edu>
* boot.c (main): Set the boot script variables based on the KERNEL_COMMAND_LINE value.
Diffstat (limited to 'boot/boot.c')
-rw-r--r--boot/boot.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/boot/boot.c b/boot/boot.c
index 185952ae..2d2e699b 100644
--- a/boot/boot.c
+++ b/boot/boot.c
@@ -536,6 +536,33 @@ main (int argc, char **argv, char **envp)
host_exit (1);
}
+ /* Turn each `FOO=BAR' word in the command line into a boot script
+ variable ${FOO} with value BAR. */
+ {
+ int len = strlen (kernel_command_line) + 1;
+ char *s = memcpy (alloca (len), kernel_command_line, len);
+ char *word;
+
+ while ((word = strsep (&s, " \t")) != 0)
+ {
+ char *eq = strchr (word, '=');
+ if (eq == 0)
+ continue;
+ *eq++ = '\0';
+ err = boot_script_set_variable (word, VAL_STR, (int) eq);
+ if (err)
+ {
+ char *msg;
+ asprintf (&msg, "cannot set boot-script variable %s: %s\n",
+ word, boot_script_error_string (err));
+ assert (msg);
+ write (2, msg, strlen (msg));
+ free (msg);
+ host_exit (1);
+ }
+ }
+ }
+
/* Parse the boot script. */
{
char *p, *line;