From 342738229ca024e2de915a941683407779bbbcb8 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sun, 7 Oct 2001 20:01:35 +0000 Subject: 2001-10-07 Neal H Walfield * boot.c (main): Set the boot script variables based on the KERNEL_COMMAND_LINE value. --- boot/boot.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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; -- cgit v1.2.3