NetBSD Problem Report #33987

From he@smistad.uninett.no  Wed Jul 12 18:08:34 2006
Return-Path: <he@smistad.uninett.no>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id D06D963B896
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 12 Jul 2006 18:08:33 +0000 (UTC)
Message-Id: <20060712160809.1496C21DCA0@smistad.uninett.no>
Date: Wed, 12 Jul 2006 18:08:09 +0200 (CEST)
From: he@NetBSD.org
Reply-To: he@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: sysinst on sparc64 fails to install primary bootstrap loader
X-Send-Pr-Version: 3.95

>Number:         33987
>Category:       port-sparc64
>Synopsis:       sysinst on sparc64 fails to install primary bootstrap loader
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-sparc64-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 12 18:10:00 +0000 2006
>Closed-Date:    Wed Jul 12 21:37:13 +0000 2006
>Last-Modified:  Wed Jul 12 21:45:01 +0000 2006
>Originator:     Havard Eidnes
>Release:        NetBSD 3.99.21 3 Jul 2006
>Organization:
>Environment:
System: NetBSD torbidinsu.urc.uninett.no 3.99.21 NetBSD 3.99.21 (GENERIC) #0: Fri Jul  7 15:42:53 CEST 2006  he@torbidinsu.urc.uninett.no:/usr/obj/sys/arch/sparc64/compile/GENERIC sparc64
Architecture: sparc64
Machine: sparc64
>Description:
	After installing NetBSD on a system with wiped harddisks,
	attempts to reboot from the recently-installed system gives

{0} ok boot disk netbsd
Resetting ... 
...
Rebooting with command: boot disk netbsd
Boot device: /pci@1f,4000/scsi@3/disk@0,0  File and args: netbsd
The file just loaded does not appear to be executable.
Boot device: /pci@1f,4000/scsi@3/disk@0,0:a  File and args: 
The file just loaded does not appear to be executable.

	Manually installing the primary bootstrap loader with

# installboot /dev/rsd0c /usr/mdec/bootblk

	fixed the problem.  ('c' starts at same offset as 'a').

	A closer inspection of the sysinst session from the serial
	console gives some clue as to the problem.  Sysinst runs

/usr/mdec/binstall ffs /targetroot

	to install the boot code.  This resulted in the following
	error message:

installboot: File system `/dev/rsd0a' is of an unknown type

	and thus, no primary boot loader was installed.	

	Before installing the new boot code I net-booted again to
	inspect the disk label sysinst had placed on the hard drive,
	and it looked like this:

# disklabel sd0
# /dev/rsd0c:
type: unknown
disk: torbidinsu
label: 
flags:
bytes/sector: 512
sectors/track: 248
tracks/cylinder: 19
sectors/cylinder: 4712
cylinders: 7506
total sectors: 35368272
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

8 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:  25124384         0     4.2BSD   2048 16384 28216  # (Cyl.      0 -   5331)
 b:  10243888  25124384       swap                     # (Cyl.   5332 -   7505)
 c:  35368272         0     unused      0     0        # (Cyl.      0 -   7505)
# 

	Modifying binstall to allow a test run in secure mode reveals
	what commands it would try to execute:

% /usr/mdec/binstall -t ffs /
Inspecting "/dev/sd0a on / type ffs (local)"
Boot device: /dev/rsd0a
Primary boot program: /usr/mdec/bootblk
Secondary boot program: //ofwboot
=> cp -p -f /usr/mdec/ofwboot //ofwboot
/usr/sbin/installboot -v -m sparc64 /dev/rsd0a /usr/mdec/bootblk ofwboot
=> /usr/sbin/installboot -v -m sparc64 /dev/rsd0a /usr/mdec/bootblk ofwboot
% 

	(except -t to binstall turns on -v to installboot as well)

>How-To-Repeat:
	Try to install -current on a sparc64 system with a wiped
	system disk, and watch it fail to install the primary boot
	loader.

>Fix:
	The problem appears to be that installboot for the install
	image is compiled with SMALLPROG, which ends up defining
	the NO_STAGE2 option, and the list of fs types to match
	against in fstypes[] is thus left empty!

	This is from installboot's Makefile, where we when SMALLPROG
	is defined only end up adding sparc64.c to ARCH_FILES:

.if !defined(SMALLPROG) && !defined(ARCH_FILES)
ARCH_FILES=  alpha.c amiga.c ews4800mips.c hp300.c hp700.c i386.c
ARCH_FILES+= macppc.c news.c next68k.c pmax.c
ARCH_FILES+= sparc.c sparc64.c sun68k.c vax.c x68k.c
.else
ARCH_FILES?= ${ARCH_XLAT:M${MACHINE}-*:S/${MACHINE}-//}
.if empty(ARCH_FILES)
ARCH_FILES= ${MACHINE}.c
.endif
.endif

	and since sparc64 is not in this match pattern:

.if empty(ARCH_FILES:C/(macppc|news|sparc|sun68k|x68k)/stg2/:Mstg2.c)
CPPFLAGS        += -DNO_STAGE2
.else
SRCS+= bbinfo.c

# fstypes are only needed for 'stage2' and then only from bbinfo.
SRCS+= ffs.c
.if SMALLPROG
CPPFLAGS+=      -DNO_FFS_SWAP
.else
SRCS+= ffs_bswap.c
.endif
.endif

	-DNO_STAGE2 gets added to CPPFLAGS.

	Now, I'm not entirely certain exactly how this is supposed to
	be fixed.  Perhaps by fixing the binstall script to not supply
	the name of the secondary boot loader (since it's installed by
	copying it to the root directory of the target file system
	anyway?), and presumably doesn't need to be given to
	installboot, at least not for sparc64?

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: he@netbsd.org
State-Changed-When: Wed, 12 Jul 2006 21:37:13 +0000
State-Changed-Why:
Should now be fixed with the recent change to the shared
sparc / sparc64 binstall.sh script.


From: Havard Eidnes <he@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/33987 CVS commit: src/sys/arch/sparc/stand/binstall
Date: Wed, 12 Jul 2006 21:34:45 +0000 (UTC)

 Module Name:	src
 Committed By:	he
 Date:		Wed Jul 12 21:34:45 UTC 2006

 Modified Files:
 	src/sys/arch/sparc/stand/binstall: binstall.sh

 Log Message:
 Omit specifying the secondary bootloader on the installboot command line
 for sparc64 systems.  This should fix PR#33987.

 Also adapt to the way sparc64 32-bit kernels now report its CPU
 architecture -- these still need the sparc64 boot loader, but now
 report hw.machine = sparc.  Adapt by testing machdep.cpu_arch
 instead.

 Hints from martin and mrg.


 To generate a diff of this commit:
 cvs rdiff -r1.14 -r1.15 src/sys/arch/sparc/stand/binstall/binstall.sh

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

>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.