NetBSD-Bugs archive

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

Re: port-i386/47566: kernel ignores root device parameter specified in boot loader



On Thu, Feb 14, 2013 at 12:30:01PM +0000, Takahiro HAYASHI wrote:
> >Number:         47566
> >Category:       port-i386
> >Synopsis:       kernel ignores root device parameter specified in boot loader
> >Confidential:   no
> >Severity:       serious
> >Priority:       medium
> >Responsible:    port-i386-maintainer
> >State:          open
> >Class:          sw-bug
> >Submitter-Id:   net
> >Arrival-Date:   Thu Feb 14 12:30:00 +0000 2013
> >Originator:     Takahiro HAYASHI
> >Release:        NetBSD 6.99.16 (201301271040Z from nyftp)
> >Organization:
> >Environment:
> System: NetBSD  6.99.16 NetBSD 6.99.16 (MONOLITHIC) #0: Sun Jan 27 17:20:26 
> UTC 2013  
> builds%b6.netbsd.org@localhost:/home/builds/ab/HEAD/i386/201301271040Z-obj/home/builds/ab/HEAD/src/sys/arch/i386/compile/MONOLITHIC
>  amd64
> Architecture: x86_64
> Machine: amd64
> >Description:
>       Recent kernel ignores root device parameter specified in
>       boot loader and always boots from hdXa.
> 
>       I installed NetBSD/amd64 on wd0a and NetBSD/i386 on wd0f.
>       (This pc has one disk, so hd0 is wd0.)
>       They are in same MBR partition.  I don't use any dkwedges.
>       /boot.cfg on wd0a has following lines:

Does this patch help?

change 1:

        Use the sizeof() the right thing to compute the length of the
        btinfo_userconfcommands.  This prevents an anonymous (4-bytes long,
        only long enough for the 'len' member) bootinfo_common from being sent
        to the kernel.

change 2:

        Don't track in add_biosdisk_bootinfo() whether the BTINFO_BOOTWEDGE and
        BTINFO_BOOTDISK bootinfo has been BI_ADD()'d, because the bootloader
        might need to re-BI_ADD() if the bootloader have to try to boot a few
        kernels (netbsd, ..., netbsd.gz) before finding one.
        
        A better place to protect against BI_ADD()'ing the same BTINFO_* twice
        is in bi_add().

Dave

-- 
David Young
dyoung%pobox.com@localhost    Urbana, IL    (217) 721-9981
--- sys/arch/i386/stand/lib/biosdisk.c  2012-09-20 01:03:41.000000000 0000
+++ sys/arch/i386/stand/lib/biosdisk.c  2012-10-02 23:55:45.000000000 0000
@@ -694,22 +694,8 @@
 static void
 add_biosdisk_bootinfo(void)
 {
-       static bool done;
-
-       if (bootinfo == NULL) {
-               done = false;
-               return;
-       }
-       
-       if (done)
-               return;
-
        BI_ADD(&bi_disk, BTINFO_BOOTDISK, sizeof(bi_disk));
        BI_ADD(&bi_wedge, BTINFO_BOOTWEDGE, sizeof(bi_wedge));
-
-       done = true;
-
-       return;
 }
 
 #endif
--- sys/arch/i386/stand/lib/exec.c      2012-09-20 01:03:41.000000000 0000
+++ sys/arch/i386/stand/lib/exec.c      2012-10-02 23:57:41.000000000 0000
@@ -627,7 +627,7 @@
        count = 0;
        for (uc = userconf_commands; uc != NULL; uc = uc->uc_next)
                count++;
-       len = sizeof(btinfo_userconfcommands) +
+       len = sizeof(*btinfo_userconfcommands) +
              count * sizeof(struct bi_userconfcommand);
 
        /* Allocate the userconf commands list */


Home | Main Index | Thread Index | Old Index