Subject: Cannot get -current to boot off non-A partition
To: None <port-sparc@NetBSD.ORG>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: port-sparc
Date: 04/06/1996 17:35:55
hi all,

I'm trying to get NetBSD-current to boot on a Sparcstation IPC, with
rev 1.6 bootproms, off a non-A partition (sd0e).  This machine is one
I have at home, with only one drive, currently running SunOS and swIPe
as my gateway to the World.  I can't abandon SunOS (or my existing
root partition) until I get swIPe running on NetBSD.

I'm trying to set up a bootable NetBSD root and /usr on my sd0e, which
to has enough space for all that.

I'm having several problems:

1.	I'm booting sd0e  via boot sd(0,0,4)netbsd.
	The dk_establish() code in sparc/sparc/disksubr.c
	is interpreting that as meaning target 0, lun 4.

	Since there isn't a drive with LUN 4, dk_establish() fails
	to set bootdv.  This causes setroot() to subsequently panic
	with "boot device not known"

	IMHO that's a completely and utterly bogus interpretation
	of the boothpath: the drive doesn't _have_ lun 4,  and
	NetBSD's  SCSI code knows that.
	Furthermore,  both the PROM and SunOS agree that the above
	PROM bootpath means partition 4 on  drive sd0. (I'm
	absolutely positive of that, because I had to write a
	(sunOS) bootblock onto the partition before it would
	boot at all.)


2.	I tried hacking on the source code to stop dk_establish()
	interpreting sd(0,0,X) as lun X, and instead to find sd0 as
	the root device, avoiding the panic in 1. above.

	However, setroot still 	doesn't know how to parse this bootpath
	and extract a minor number.  It tries to mount sd0a as the root
	device, as  indicated in the comment in the follwoing
	fragment of setroot:

		if (majdev >= 0) {
			/*
			 * Root and swap are on a disk.
			 * Assume that we are supposed to put root on
			 * partition a, and swap on partition b.
			 */
			mindev = (bootdv->dv_unit << PARTITIONSHIFT) + 0;


	I think the assumption is a bug: the PROM is (on a sun4c,
	a sun4m, and sun4u, I dunno about VME-based sun4) deliberately
	passing in enough info for a kernel to figure out exactly
	where the root partition is.



3.	I tried booting with "boot sd(0,0,4)netbsd -as".
	*However*, that does not result in RB_ASKNAME being set
	in the bootflags.
	I had to also type  "netbsd -a -s" when prompted by the
	bootblock for a kernel to boot.

	SunOS manages to pass the flags on...


4.	When I did figure out how to boot a kernel with
	RB_ASKNAME,  and I gave a root partition of "sd0e",
	the kernel asked for a swap device, flashed the keyboard LEDs,
	and hung...


Gordon Ross assures me that booting off non-'a' partitions
is supposed to work....

Has anyone else had any success booting off root partitions that
aren't an 'a' partition?

I'd send a pr, but I'm not sure how many bugs this constitutes
and how many distinct PRs I should send :).


Thanks for any advice
--Jonathan Stone