Subject: Bootblocks ignore partition for kernel (plus LFS fun)
To: None <port-sparc64@netbsd.org>
From: None <abs@mono.org>
List: port-sparc64
Date: 03/31/2003 12:07:07
	I've just tried root on LFS on a sparc64 box, without much luck:

	The boot blocks do not understand lfs, so I created a small sd0h
	partition at the start of the disk containing bootblocks and a
	kernel.

	Unfortunately the bootblocks appear to be only able to load a kernel
	from the 'a:' partition:

	At the 'Boot:' prompt given directly after 'boot -sa' it does not
	appear to matter which partition is given the boot blocks always
	try to load the kernel from 'a:'.

	eg: both of the following try to load a kernel from a:

	    Boot: /sbus@1f,0/SUNW,fas@e,8800000/sd@0,0:a/netbsd
	    Boot: /sbus@1f,0/SUNW,fas@e,8800000/sd@0,0:h/netbsd

	Unless I'm missing something obvious here?

	In order to get the kernel to boot with an lfs root I needed to
	have a small ffs 'a' partition and the real root on 'e', then
	'boot -a' and manually enter the root device (This could be
	avoided with a custom kernel), but then the root device is not
	accessible:

	    # fsck
	    /dev/sd0e (Bad file descriptor)Can't stat /dev/sd0e
	    /dev/sd0e (Bad file descriptor)Can't stat /dev/sd0e
	    Can't stat /dev/sd0e: Bad file descriptor
	    ** /dev/rsd0a
	    ** File system is clean; not checking
	    # ls -l /dev/sd0*
	    ls: /dev/sd0e: Bad file descriptor
	    brw-r-----  1 root  operator  7, 0 Mar 31 11:44 /dev/sd0a
	    brw-r-----  1 root  operator  7, 1 Mar 31 11:44 /dev/sd0b
	    brw-r-----  1 root  operator  7, 2 Mar 31 11:44 /dev/sd0c
	    brw-r-----  1 root  operator  7, 3 Mar 31 11:44 /dev/sd0d
	    brw-r-----  1 root  operator  7, 5 Mar 31 11:44 /dev/sd0f
	    brw-r-----  1 root  operator  7, 6 Mar 31 11:44 /dev/sd0g
	    brw-r-----  1 root  operator  7, 7 Mar 31 11:44 /dev/sd0h
	    #

	This is a little more than bizarre. Netbooting the bootblocks
	and kernel and specifying the root partition as sd0e results
	in fsck panicing with:

	    Stopped in pid 9.1 (fsck) at sys_statfs+0x54: ldx [%i0 + 0 x10], %o0
	    db> trace
	    syscall(1133bed0, 9d, 0, 112f1300, 4052fb78, 4052fb74) at
	    syscall+0x344
	    syscall_setup(ffffffffffffdc6d, ffffffffffffcbf0, 212000, 406e0a80,
	    0, 0) at syscall_setup+0xe8

	Netbooting with nfs root and mounting sd0e somewhere else works fine.

-- 
		David Brownlee