Subject: SCSI boot support
To: None <port-next68k@netbsd.org>
From: Christian Limpach <chris@Pin.LU>
List: port-next68k
Date: 06/06/2002 01:37:36
Hi!

I've made some modifications and it's now possible to boot from SCSI
devices.
Changes made:
- updated scsi code in boot loader
- support for reading/writing native disklabels
- network media selection in boot loader
- network media selection in kernel
- bootdevice selection in kernel
- passing boot parameters from boot loader to kernel
- small fix to kernel-scsi support

The network media selection code was necessary because if you boot from SCSI
and you're using 10baseT/UTP, the network wasn't working since it would
still be initialised to 10base2/BNC.  Now you can also switch between
connectors without rebooting and the status of the link is indicated if
10baseT is used.  If the media is set to auto (default), 10baseT is selected
if a link is detected, 10base2 if not.

To boot from a SCSI disk:

You have to put a NeXT disklabel on the disk.  The updated disklabel code
always puts NeXT disklabels on disks unless there is already a NetBSD
disklabel present.  The following sequence of commands has worked for me to
switch a label from NetBSD to NeXT (if there's currently no partition used
on sd0):
    disklabel sd0 >/tmp/sd0
    dd if=/dev/zero of=/dev/rsd0c bs=1k count=8
    disklabel -R sd0 /tmp/sd0
To check what label is on the disk:
    dd if=/dev/rsd0c | od -c | less
The first 4 bytes should be 'd' 'l' 'V' '3'.

You have to install an updated boot loader.  The boot blocks are located at
positions 32k and 96k.  I believe the one at 32k is usually used but I've
always written both on my disks.  The installboot.sh script will install the
boot blocks.  You'll need at least 61k of free space at the beginning of the
disk to install one boot block.  The default on Nextstep is to leave 160k
free.

You have to put a kernel on a partition on the disk.

You have to put a root partition on the disk (unless you make the kernel use
root on nfs)

"bsd netbsd" from the prompt will boot with the kernel (named netbsd) and
root on sd0a.
"bsd(1,0,3) netbsd" will boot with the kernel and root on sd1d

Patched kernel sources and the patch for the changes are in:
ftp://lola.pin.lu:21/pub/NetBSD/arch/next68k/scsi/

I've built two kernels and there's also an updated boot block and the
installboot.sh script:
ftp://lola.pin.lu:21/pub/NetBSD/arch/next68k/scsi/scsi-06-06-current-05-20/
SCSI - with DDB and console support
SCSIK - with kgdb (on port B) and serial console support (on port A)

     christian