NetBSD Problem Report #46027

From www@NetBSD.org  Wed Feb 15 17:00:01 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 1480B63D787
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 15 Feb 2012 17:00:01 +0000 (UTC)
Message-Id: <20120215165959.7175863BCF4@www.NetBSD.org>
Date: Wed, 15 Feb 2012 16:59:59 +0000 (UTC)
From: mbalmer@NetBSD.org
Reply-To: mbalmer@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: First stage bootloader (bootxx_ffsv2) on i386 broken for Soekris net4801 
X-Send-Pr-Version: www-1.0

>Number:         46027
>Category:       install
>Synopsis:       First stage bootloader (bootxx_ffsv2) on i386 broken for Soekris net4801
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    install-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 15 17:05:00 +0000 2012
>Closed-Date:    Sun Jun 24 16:43:01 +0000 2012
>Last-Modified:  Sun Jun 24 16:43:01 +0000 2012
>Originator:     Marc Balmer
>Release:        5.99.65
>Organization:
TNF
>Environment:
>Description:
A fresh install of NetBSD 5.99.65 on a Soekris Engineering net4801 with a 2 GB San Disk CF card, finished without problems.  When rebooting, however, the first stage bootloader resets the machine after printing the banner on the console (first and last line are from the soekris BIOS):

 1 Seconds to automatic boot.   Press Ctrl-P for entering Monitor.
NetBSD MBR boot

NetBSD/x86 ffsv2 Primary Bootstrap

Press return to boot now, any other key for boot menu
booting \ - starting in 0 seconds.     
> ls


POST: 0123456789bcefghipajklnopq,,,tvwxy 
>How-To-Repeat:
Boot from CF card.

>Fix:

>Release-Note:

>Audit-Trail:
From: David Laight <david@l8s.co.uk>
To: gnats-bugs@NetBSD.org
Cc: install-manager@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386 broken for Soekris net4801
Date: Wed, 15 Feb 2012 22:45:57 +0000

 On Wed, Feb 15, 2012 at 05:05:00PM +0000, mbalmer@NetBSD.org wrote:
 > >Number:         46027
 > >Category:       install
 > >Synopsis:       First stage bootloader (bootxx_ffsv2) on i386 broken for Soekris net4801
 ...
 > >Description:
 > A fresh install of NetBSD 5.99.65 on a Soekris Engineering net4801
 > with a 2 GB San Disk CF card, finished without problems.
 > When rebooting, however, the first stage bootloader resets the machine
 > after printing the banner on the console (first and last line
 > are from the soekris BIOS):

 Did you select the serial console during the install?

 Does it die immediately, or is there a short delay where it
 might be reading the kernel from disk first?

 I've booted a net4801 moderately recently.

 	David

 -- 
 David Laight: david@l8s.co.uk

From: Marc Balmer <marc@msys.ch>
To: "gnats-bugs@NetBSD.org" <gnats-bugs@NetBSD.org>
Cc: "install-manager@NetBSD.org" <install-manager@NetBSD.org>,
        "gnats-admin@NetBSD.org" <gnats-admin@NetBSD.org>,
        "netbsd-bugs@NetBSD.org" <netbsd-bugs@NetBSD.org>,
        "mbalmer@NetBSD.org" <mbalmer@NetBSD.org>
Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386 broken for Soekris net4801
Date: Thu, 16 Feb 2012 08:17:56 +0100

 Am 15.02.2012 um 23:50 schrieb David Laight <david@l8s.co.uk>:

 > The following reply was made to PR install/46027; it has been noted by GNA=
 TS.
 >=20
 > From: David Laight <david@l8s.co.uk>
 > To: gnats-bugs@NetBSD.org
 > Cc: install-manager@netbsd.org, gnats-admin@netbsd.org,
 >    netbsd-bugs@netbsd.org
 > Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386 b=
 roken for Soekris net4801
 > Date: Wed, 15 Feb 2012 22:45:57 +0000
 >=20
 > On Wed, Feb 15, 2012 at 05:05:00PM +0000, mbalmer@NetBSD.org wrote:
 >>> Number:         46027
 >>> Category:       install
 >>> Synopsis:       First stage bootloader (bootxx_ffsv2) on i386 broken for=
  Soekris net4801
 > ...
 >>> Description:
 >> A fresh install of NetBSD 5.99.65 on a Soekris Engineering net4801
 >> with a 2 GB San Disk CF card, finished without problems.
 >> When rebooting, however, the first stage bootloader resets the machine
 >> after printing the banner on the console (first and last line
 >> are from the soekris BIOS):
 >=20
 > Did you select the serial console during the install?

 Yes.

 >=20
 > Does it die immediately, or is there a short delay where it
 > might be reading the kernel from disk first?

 There is no noticeable delay. It prints open on the console, then resets.

 >=20
 > I've booted a net4801 moderately recently.
 >=20
 >    David
 >=20
 > --=20
 > David Laight: david@l8s.co.uk
 >=20

From: Marc Balmer <mbalmer@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386
 broken for Soekris net4801
Date: Sat, 18 Feb 2012 09:14:18 +0100

 Jak pointed out that this more likely is caused by the second stage boot
 loader /boot, as the banner and prompt are displayed.

From: Marc Balmer <mbalmer@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: install-manager@NetBSD.org, gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386
 broken for Soekris net4801
Date: Fri, 24 Feb 2012 09:28:54 +0100

 It is (confirmed) not teh first stage boot loader bootxx_ffsv2 that
 causes the problem, but the second stage boot loader /boot.  The problem
 happens only when /boot is compiled with the GPT code (which is the
 default), when it is compiled with -DNO_GPT, the reset does not happen.

From: David Laight <david@l8s.co.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386 broken for Soekris net4801
Date: Fri, 24 Feb 2012 18:07:15 +0000

 On Fri, Feb 24, 2012 at 08:30:06AM +0000, Marc Balmer wrote:
 > The following reply was made to PR install/46027; it has been noted by GNATS.
 > 
 > From: Marc Balmer <mbalmer@NetBSD.org>
 > To: gnats-bugs@NetBSD.org
 > Cc: install-manager@NetBSD.org, gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
 > Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386
 >  broken for Soekris net4801
 > Date: Fri, 24 Feb 2012 09:28:54 +0100
 > 
 >  It is (confirmed) not teh first stage boot loader bootxx_ffsv2 that
 >  causes the problem, but the second stage boot loader /boot.  The problem
 >  happens only when /boot is compiled with the GPT code (which is the
 >  default), when it is compiled with -DNO_GPT, the reset does not happen.

 Do you know if bootxx_ffsv2 manages to load /boot - and the fail is
 within /boot, or something (size) stops /boot itself being loaded.

 There ought to be a printf() very early on in /boot - so you can tell
 it has started at all (someone removed some of them ...)

 Also check the sizes of /boot (code/data/stack etc) and especially
 that its heap is actually beyond all the other sections.
 ISTR that the heap is at a fixed address, not one assigned by
 linker script 'magic'.

 	David

 -- 
 David Laight: david@l8s.co.uk

From: Marc Balmer <mbalmer@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386
 broken for Soekris net4801
Date: Sat, 25 Feb 2012 10:03:01 +0100

 Am 24.02.12 19:15, schrieb David Laight:
 > The following reply was made to PR install/46027; it has been noted by GNATS.
 > 
 > From: David Laight <david@l8s.co.uk>
 > To: gnats-bugs@NetBSD.org
 > Cc: 
 > Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386 broken for Soekris net4801
 > Date: Fri, 24 Feb 2012 18:07:15 +0000
 > 
 >  On Fri, Feb 24, 2012 at 08:30:06AM +0000, Marc Balmer wrote:
 >  > The following reply was made to PR install/46027; it has been noted by GNATS.
 >  > 
 >  > From: Marc Balmer <mbalmer@NetBSD.org>
 >  > To: gnats-bugs@NetBSD.org
 >  > Cc: install-manager@NetBSD.org, gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
 >  > Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386
 >  >  broken for Soekris net4801
 >  > Date: Fri, 24 Feb 2012 09:28:54 +0100
 >  > 
 >  >  It is (confirmed) not teh first stage boot loader bootxx_ffsv2 that
 >  >  causes the problem, but the second stage boot loader /boot.  The problem
 >  >  happens only when /boot is compiled with the GPT code (which is the
 >  >  default), when it is compiled with -DNO_GPT, the reset does not happen.
 >  
 >  Do you know if bootxx_ffsv2 manages to load /boot - and the fail is
 >  within /boot, or something (size) stops /boot itself being loaded.
 >  
 >  There ought to be a printf() very early on in /boot - so you can tell
 >  it has started at all (someone removed some of them ...)
 >  
 >  Also check the sizes of /boot (code/data/stack etc) and especially
 >  that its heap is actually beyond all the other sections.
 >  ISTR that the heap is at a fixed address, not one assigned by
 >  linker script 'magic'.

 Yes, as I said, the bug happens in /boot, so it gets loaded.  The
 problem is somewhere within the GPT support code.  If I build /boot with
 -DNO_GPT, there is no problem, no resets.

From: David Laight <david@l8s.co.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386 broken for Soekris net4801
Date: Mon, 27 Feb 2012 18:53:32 +0000

 On Sat, Feb 25, 2012 at 09:05:04AM +0000, Marc Balmer wrote:
 > The following reply was made to PR install/46027; it has been noted by GNATS.
 > 
 > From: Marc Balmer <mbalmer@NetBSD.org>
 > To: gnats-bugs@NetBSD.org
 > Cc: 
 > Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386
 >  broken for Soekris net4801
 ...
 >  >  There ought to be a printf() very early on in /boot - so you can tell
 >  >  it has started at all (someone removed some of them ...)
 >  >  
 >  >  Also check the sizes of /boot (code/data/stack etc) and especially
 >  >  that its heap is actually beyond all the other sections.
 >  >  ISTR that the heap is at a fixed address, not one assigned by
 >  >  linker script 'magic'.
 >  
 >  Yes, as I said, the bug happens in /boot, so it gets loaded.  The
 >  problem is somewhere within the GPT support code.  If I build /boot with
 >  -DNO_GPT, there is no problem, no resets.

 It might be a problem with the size of the /boot program, rather than
 anything in the GPT support code itself.

 Which is why having a very early printf is useful.

 Of course, seeing what is going on isn't helped by the brain-dead
 net4801 'bios' generating a 'home cursor', 'clear screen' sequence
 every time in initialises ...

 	David

 -- 
 David Laight: david@l8s.co.uk

From: Konrad Schroder <perseant@uw.edu>
To: gnats-bugs@gnats.netbsd.org
Cc: install-manager@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386
 broken for Soekris net4801
Date: Wed, 30 May 2012 15:59:07 -0700

 I just had the same problem on a Soekris net4501, but solved it with the 
 following patch.  The sector size was being changed to crazy values---in 
 one instance to 0 and in another instance to 4.  I'm not sure that 512 
 is the right limit here, and I didn't investigate why it was coming back 
 with crazy values; but this did make it work for me.

 Take care,

 -----------------------------------------------------------------------
 Konrad Schroder              Box 352143 -or- 215 Fluke Hall, Mason Road
 Linux System Administrator                     University of Washington
 College of Engineering                          Seattle, WA, 98195, USA

 ----
 Index: sys/arch/i386/stand/lib/biosdisk.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/i386/stand/lib/biosdisk.c,v
 retrieving revision 1.40
 diff -u -r1.40 biosdisk.c
 --- sys/arch/i386/stand/lib/biosdisk.c  16 Jan 2012 18:47:57 -0000      1.40
 +++ sys/arch/i386/stand/lib/biosdisk.c  30 May 2012 22:52:37 -0000
 @@ -316,7 +316,8 @@
          gptsector[0] = GPT_HDR_BLKNO;
          if (set_geometry(&d->ll, &ed) == 0 && d->ll.flags & 
 BIOSDISK_INT13EXT) {
                  gptsector[1] = ed.totsec - 1;
 -               d->ll.secsize = ed.sbytes;
 +               if (ed.sbytes >= 512)
 +                       d->ll.secsize = ed.sbytes;
          } else {
   #ifdef DISK_DEBUG
                  printf("Unable to determine extended disk geometry - "

From: David Laight <david@l8s.co.uk>
To: gnats-bugs@gnats.netbsd.org
Cc: 
Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386 broken for Soekris net4801
Date: Thu, 31 May 2012 07:54:27 +0100

 On Wed, May 30, 2012 at 03:59:07PM -0700, Konrad Schroder wrote:
 > -               d->ll.secsize = ed.sbytes;
 > +               if (ed.sbytes >= 512)
 > +                       d->ll.secsize = ed.sbytes;

 Probably also best to check it is a power of 2 as well.

 Do you actually have media with non-512 byte sectors?

 	David

 -- 
 David Laight: david@l8s.co.uk

From: Konrad Schroder <perseant@uw.edu>
To: gnats-bugs@gnats.netbsd.org
Cc: David Laight <david@l8s.co.uk>
Subject: Re: install/46027: First stage bootloader (bootxx_ffsv2) on i386
 broken for Soekris net4801
Date: Thu, 31 May 2012 08:35:12 -0700

 On Thu, May 31, 2012, David Laight wrote:

  > Probably also best to check it is a power of 2 as well.

 Sure, done.

  > Do you actually have media with non-512 byte sectors?

 I doubt it very much; it's an ordinary CF card.  I certainly do not have 
 a device with 0- or 4-byte sectors---those were the values being 
 reported from the BIOS via set_geometry().

 I think that everything coming back from set_geometry() is bogus in this 
 case; the size of the disk in ed.totsec was also being given an 
 impossible value.

 Take care,

 -----------------------------------------------------------------------
 Konrad Schroder              Box 352143 -or- 215 Fluke Hall, Mason Road
 Linux System Administrator                     University of Washington
 College of Engineering                          Seattle, WA, 98195, USA

 ----
 Index: sys/arch/i386/stand/lib/biosdisk.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/i386/stand/lib/biosdisk.c,v
 retrieving revision 1.40
 diff -u -r1.40 biosdisk.c
 --- sys/arch/i386/stand/lib/biosdisk.c  16 Jan 2012 18:47:57 -0000      1.40
 +++ sys/arch/i386/stand/lib/biosdisk.c  31 May 2012 15:29:44 -0000
 @@ -316,7 +316,9 @@
          gptsector[0] = GPT_HDR_BLKNO;
          if (set_geometry(&d->ll, &ed) == 0 && d->ll.flags & 
 BIOSDISK_INT13EXT) {
                  gptsector[1] = ed.totsec - 1;
 -               d->ll.secsize = ed.sbytes;
 +               /* Sanity check values returned from BIOS */
 +               if (ed.sbytes >= 512 && (ed.sbytes & (ed.sbytes - 1)) == 0)
 +                       d->ll.secsize = ed.sbytes;
          } else {
   #ifdef DISK_DEBUG
                  printf("Unable to determine extended disk geometry - "

From: "Konrad Schroder" <perseant@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46027 CVS commit: src/sys/arch/i386/stand/lib
Date: Wed, 13 Jun 2012 18:34:20 +0000

 Module Name:	src
 Committed By:	perseant
 Date:		Wed Jun 13 18:34:20 UTC 2012

 Modified Files:
 	src/sys/arch/i386/stand/lib: biosdisk.c

 Log Message:
 Sanity check the values coming back from the int13 extensions of the bios,
 so we can catch impossible return values.  Allows the bootloader to work
 again on the Soekris net4501.

 Fixes PR kern/46027.


 To generate a diff of this commit:
 cvs rdiff -u -r1.40 -r1.41 src/sys/arch/i386/stand/lib/biosdisk.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Julian Coleman" <jdc@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46027 CVS commit: [netbsd-6] src/sys/arch/i386/stand/lib
Date: Sun, 24 Jun 2012 16:17:40 +0000

 Module Name:	src
 Committed By:	jdc
 Date:		Sun Jun 24 16:17:40 UTC 2012

 Modified Files:
 	src/sys/arch/i386/stand/lib [netbsd-6]: biosdisk.c

 Log Message:
 Pull up revision 1.41 (requested by martin in ticket #349).

 Sanity check the values coming back from the int13 extensions of the bios,
 so we can catch impossible return values.  Allows the bootloader to work
 again on the Soekris net4501.

 Fixes PR kern/46027.


 To generate a diff of this commit:
 cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/arch/i386/stand/lib/biosdisk.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: jdc@NetBSD.org
State-Changed-When: Sun, 24 Jun 2012 16:43:01 +0000
State-Changed-Why:
Fix commited and pulled up to netbsd-6.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.