I have confirmed that the following combinations, first with your code and then, with my new patches, work:
> new gnumach -> new hurd's serverboot -> new hurd Check. > new gnumach -> old hurd's serverboot -> old hurd Check. > old gnumach -> new hurd's serverboot -> new hurd Check. > new gnumach -> old boot script -> old hurd > any gnumach -> new hurd's serverboot -> old hurd Check. > [subhurd] new hurd's boot -> old boot script -> old hurd Check. However, I fail to see why we even want to be compatible here; one can easily use the new Hurd's boot with the new boot script to boot an old Hurd. And not to mention that this feature is (currently) only used by developers and on top of that, pollutes the variable name space. > [subhurd] new hurd's boot -> new boot script -> new hurd Check. The patches: First, GNU Mach. There are two errors in determining the compatibility case: first, we need to also ignore trailing newlines; second, in the case where there are multiple modules, the logic was backwards. This patch also corrects the output: I have no clue what the padding with spaces was all about, however, it seems to me to be completely superfluous; the output is now consistent with other messages. 2001-10-07 Neal H Walfield <[EMAIL PROTECTED]> * kernel/bootstrap.c (bootstrap_create): When checking for compatability mode, ignore both trailing spaces and new lines. Set P to non-zero in the non-compatability case. Fix the output. Index: bootstrap.c =================================================================== RCS file: /cvsroot/hurd/gnumach/kern/bootstrap.c,v retrieving revision 1.10 diff -u -p -r1.10 bootstrap.c --- bootstrap.c 2001/09/30 21:45:27 1.10 +++ bootstrap.c 2001/10/07 13:24:52 @@ -105,6 +105,9 @@ void bootstrap_create() || (boot_info.mods_count == 0)) panic ("No bootstrap code loaded with the kernel!"); + /* If we have a single multiboot module with no arguments, go into + compatibility mode (i.e. using the traditional serverboot method + to bootstrap). */ if (boot_info.mods_count == 1) { p = strchr((char*)phystokv(bmods[0].string), ' '); @@ -112,13 +115,13 @@ void bootstrap_create() { do ++p; - while (*p == ' '); + while (*p == ' ' || *p == '\n'); if (*p == '\0') p = 0; } } else - p = 0; + p = (void *) !0; if (p == 0) { @@ -128,7 +131,7 @@ void bootstrap_create() } else { - int i, losers, maxlen; + int i, losers; /* Initialize boot script variables. We leak these send rights. */ losers = boot_script_set_variable @@ -219,15 +222,11 @@ void bootstrap_create() } #endif - maxlen = 0; for (i = 0; i < boot_info.mods_count; ++i) { int err; char *line = (char*)phystokv(bmods[i].string); - int len = strlen (line) + 1; - if (len > maxlen) - maxlen = len; - printf ("\rmodule %d: %*s", i, -maxlen, line); + printf ("\nmodule %d: %s", i, line); err = boot_script_parse_line (&bmods[i], line); if (err) { @@ -235,7 +234,7 @@ void bootstrap_create() ++losers; } } - printf ("\r%d multiboot modules %*s", i, -maxlen, ""); + printf ("\n%d multiboot modules\n", i); if (losers) panic ("%d of %d boot script commands could not be parsed", losers, boot_info.mods_count); The Hurd proper: In boot, we incorrectly setup the default kernel_command_line. This really affects us now that init now uses ARGP_IN_ORDER. Additionally, we must set the boot script variables based on the kernel command line. 2001-10-07 Neal H Walfield <[EMAIL PROTECTED]> * boot.c (main): Do not prepend our program invocation name to the default kernel command line. Set the boot script variables based on KERNEL_COMMAND_LINE. Index: boot/boot.c =================================================================== RCS file: /cvsroot/hurd/hurd/boot/boot.c,v retrieving revision 1.101 diff -u -p -r1.101 boot.c --- boot/boot.c 2001/08/24 02:51:21 1.101 +++ boot/boot.c 2001/10/07 15:40:07 @@ -517,8 +517,8 @@ main (int argc, char **argv, char **envp mach_port_deallocate (mach_task_self (), foo); if (kernel_command_line == 0) - asprintf (&kernel_command_line, "%s %s root=%s", - argv[0], bootstrap_args, bootdevice); + asprintf (&kernel_command_line, "%s root=%s", + bootstrap_args, bootdevice); /* Initialize boot script variables. */ if (boot_script_set_variable ("host-port", VAL_PORT, @@ -535,6 +535,33 @@ main (int argc, char **argv, char **envp write (2, msg, strlen (msg)); 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. */ { _______________________________________________ Bug-hurd mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-hurd