NetBSD-Bugs archive

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

port-i386/44562: boot loader's `boot' command doesn't try netbsd.old &c.



>Number:         44562
>Category:       port-i386
>Synopsis:       boot loader's `boot' command doesn't try netbsd.old &c.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 13 17:50:00 +0000 2011
>Originator:     Taylor R Campbell <campbell+netbsd%mumble.net@localhost>
>Release:        NetBSD 5.1_STABLE
>Organization:
>Environment:
System: NetBSD smalltalk.local 5.1_STABLE NetBSD 5.1_STABLE (RIADEBUG) #0: Tue 
Feb 1 20:28:45 UTC 2011 
root%smalltalk.local@localhost:/home/riastradh/netbsd/5/obj/sys/arch/i386/compile/RIADEBUG
 i386
Architecture: i386
Machine: i386
>Description:

        The i386/boot(8) man page claims that the `boot' command with
        no file name argument will try to boot netbsd, netbsd.gz,
        netbsd.old, netbsd.old.gz, onetbsd, and then onetbsd.gz, in
        that order.  Instead, it tries only netbsd.

>How-To-Repeat:

        Leave an old kernel in /netbsd.old.  Move /netbsd out of the
        way to try using the old kernel.  Reboot.  Realize that you
        have just rendered the machine unbootable, because it is a
        MacBook on which the boot loader prompt's keyboard input is
        broken so you can't just type `boot netbsd.old'.

        Curse profusely.

>Fix:

        Apply the following patch to sys/arch/i386/stand/boot/boot2.c.
        I have not tested this, but I have tested the next patch on
        netbsd-5.

        Patch to HEAD (untested):

Index: boot2.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/boot/boot2.c,v
retrieving revision 1.52
diff -p -u -r1.52 boot2.c
--- boot2.c     6 Feb 2011 23:16:05 -0000       1.52
+++ boot2.c     13 Feb 2011 17:39:35 -0000
@@ -421,10 +421,21 @@ void
 command_boot(char *arg)
 {
        char *filename;
-       int howto;
+       int howto, tell;
 
-       if (parseboot(arg, &filename, &howto))
-               bootit(filename, howto, (howto & AB_VERBOSE) != 0);
+       if (!parseboot(arg, &filename, &howto))
+               return;
+
+       tell = ((howto & AB_VERBOSE) != 0);
+       if (filename != NULL) {
+               bootit(filename, howto, tell);
+       } else {
+               int i;
+               for (i = 0; i < NUMNAMES; i++) {
+                       bootit(names[i][0], howto, tell);
+                       bootit(names[i][1], howto, tell);
+               }
+       }
 }
 
 void

        Patch to netbsd-5 (tested):

Index: boot2.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/boot/boot2.c,v
retrieving revision 1.38.4.2
diff -p -u -r1.38.4.2 boot2.c
--- boot2.c     14 Feb 2010 14:01:08 -0000      1.38.4.2
+++ boot2.c     13 Feb 2011 17:36:11 -0000
@@ -742,8 +742,18 @@ command_boot(char *arg)
        char *filename;
        int howto;
 
-       if (parseboot(arg, &filename, &howto))
+       if (!parseboot(arg, &filename, &howto))
+               return;
+
+       if (filename != NULL) {
                bootit(filename, howto, 1);
+       } else {
+               int i;
+               for (i = 0; i < NUMNAMES; i++) {
+                       bootit(names[i][0], howto, 1);
+                       bootit(names[i][1], howto, 1);
+               }
+       }
 }
 
 void



Home | Main Index | Thread Index | Old Index