Current-Users archive

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

Patch for boot loader: "menu" command



Hi,

with NetBSD 5.1, the install kernel needs to be booted with a
kernel module loaded (the miniroot kernel module).

This means that any installation attempts following this old
avenue will FAIL from this point forward:

 * dropping to the boot prompt
 * switch to serial console
 * resuming boot with just "boot"

which used to work just fine in the past, but will now fail
spectacularly, first with a warning about missing /dev/console
and subsequently with no ability to exec /sbin/init, and with
only "reboot" as the remaining option.

Now, there are probably several ways to go around mending this.
Some of them are:

1) provide a way to display the contents of boot.cfg (but need to
   prevent showing the "contents of /netbsd"...)
2) provide a way to recall and edit one of the boot commands from
   boot.cfg (sounds complicated, and more than I intended to chew
   off in this round)
3) provide a way to re-enter the boot menu you dropped from in
   the first step in the procedure above, and then allow to
   select one of the boot methods already specified in boot.cfg

Of these, the least complicated appears to be 3), and here's a
suggested patch (in src/sys/arch/i386/stand/boot/) which I think
will do this.

If there's no vehement opposition, I suggest to also adapt this
for both of netbsd-6 and netbsd-5 and submit pull-up requests for
those branches as well.

Comments?

- Håvard
*** boot2.c     08 Aug 2012 08:31:40 +0200      1.58
--- boot2.c     25 Jul 2013 14:07:26 +0200      
***************
*** 120,125 ****
--- 120,128 ----
  void  command_boot(char *);
  void  command_dev(char *);
  void  command_consdev(char *);
+ #ifndef SMALL
+ void  command_menu(char *);
+ #endif
  void  command_modules(char *);
  void  command_multiboot(char *);
  
***************
*** 131,136 ****
--- 134,142 ----
        { "boot",       command_boot },
        { "dev",        command_dev },
        { "consdev",    command_consdev },
+ #ifndef SMALL
+       { "menu",       command_menu },
+ #endif
        { "modules",    command_modules },
        { "load",       module_add },
        { "multiboot",  command_multiboot },
***************
*** 394,399 ****
--- 400,408 ----
               "dev xd[N[x]]:\n"
               "consdev {pc|com[0123]|com[0123]kbd|auto}\n"
               "vesa {modenum|on|off|enabled|disabled|list}\n"
+ #ifndef SMALL
+              "menu (reenters boot menu, if defined in boot.cfg)\n"
+ #endif
               "modules {on|off|enabled|disabled}\n"
               "load {path_to_module}\n"
               "multiboot [xdNx:][filename] [<args>]\n"
***************
*** 504,509 ****
--- 513,533 ----
        printf("invalid console device.\n");
  }
  
+ #ifndef SMALL
+ /* ARGSUSED */
+ void
+ command_menu(char *arg)
+ {
+ 
+       if (bootconf.nummenu > 0) {
+               /* Does not return */
+               doboottypemenu();
+       } else {
+               printf("No menu defined in boot.cfg\n");
+       }
+ }
+ #endif /* !SMALL */
+ 
  void
  command_modules(char *arg)
  {


Home | Main Index | Thread Index | Old Index