Installing NetBSD/sparc64 from Solaris

by Murray Stokely <murray@osd.bsdi.com>

NetBSD is rapidly becoming a viable operating system for UltraSparc workstations. Unfortunately the main developers are still involved with writing devent console code so the installation method is a little uhm "unpolished". The only was I was able to actually install this beast was with a mystical voodoo dance and then a Solaris hosted installation that never once involved using the 'sysinst' program.

Depending on the hardware in your system the installation may be a little easier. For a hardware compatability list please see the official NetBSD/sparc64 project web page. The remainder of this document will go through the steps I took to install NetBSD through Solaris and then the post-configuration issues that I ran into.

Installing through Solaris

The only way I was able to install NetBSD-1.5_BETA on my Ultra 5 was through the method I describe here. If you are running other hardware then you may want to try the installation methods described in the NetBSD INSTALL document and then come back for the configuration notes section, otherwise read-on.

Preparing the disk

The first step is to format and label the disk that you would like to use with NetBSD. This can be accomplished with the format command in Solaris. The format command should allow you to create disk slices and write a disklabel. You will probably at least want to create a root partition, a swap partition, and a usr partition, but of course you can layout the disk however you see fit.

partition> pr    
         Current partition table (original):
         Total disk cylinders available: 8186 + 2 (reserved cylinders)

         Part      Tag    Flag     Cylinders        Size            Blocks
           0       root    wm       0 - 1923        1.00GB    (1924/0/0) 2097160
           1       swap    wu    1924 - 2863      500.29MB    (940/0/0)  1024600
           2     backup    wu       0 - 8185        4.25GB    (8186/0/0) 8922740
           3 unassigned    wm       0               0         (0/0/0)          0
           4        usr    wm    2864 - 8184        2.77GB    (5321/0/0) 5799890
           5 unassigned    wm       0               0         (0/0/0)          0
           6     backup    wm       0 - 8185        4.25GB    (8186/0/0) 8922740
           7 unassigned    wm       0               0         (0/0/0)          0

After your disk has been labelled you need to create filesystems on your slices. The Solaris newfs command will create ffs filesystems that can be used by NetBSD. You should create filesystems for all of your slices except for root with a command similar to :

     # newfs /dev/dsk/c1t2d0s0
     # newfs /dev/dsk/c1t2d0s4

Installing NetBSD Software

You should now mount your NetBSD root and /usr partitions under Solaris so that you can populate the filesystems with NetBSD binaries.

     # mount /dev/dsk/c1t2d0s0 /mnt
     # mount /dev/dsk/c1t2d0s4 /mnt2

First, you should uncompress all of the binary distribution sets for sparc64 into a temporary directory and then copy the files into the filesystems you just mounted.

     $ cd ~/netbsd/binary/sets
     $ gunzip *.tar.gz
     $ mkdir ~/netbsd/temp
     $ cd ~/netbsd/temp
     $ echo ~/netbsd/binary/sets/*.tar | xargs -n1 tar xf
     # cp -rp usr/* /mnt2
     # cp -rp . /mnt
     # mkdir /mnt/usr

Now you should copy the NetBSD kernel and second stage bootloader into your new NetBSD root partition and install the bootblocks using Solaris's installboot command.

     # cp ~/netbsd/binary/kernel/netbsd.GENERIC /mnt
     # cp /mnt/netbsd.GENERIC /mnt/netbsd
     # cp ~/netbsd/installation/misc/ofwboot /mnt
     # installboot ~/netbsd/installation/misc/bootblk /dev/c1t2d0s0

Creating NetBSD Device Nodes under Solaris

Now you will need to create a minimum set of device nodes so that NetBSD can boot correctly. You should create all of the devices listed in the 'std' section of NetBSD's /dev/MAKEDEV. You can use the Solaris version of mknod to create device nodes but you must be careful to use numeric group id's since the groups are numbered differently between the two systems.

    # mknod console           c 0 0
    # mknod tty               c 2 0   ; chmod 666 tty
    # mknod kmem              c 3 1   ; chmod 640 kmem ; chgrp 2 kmem
    # mknod mem               c 3 0   ; chmod 640 mem ; chgrp 2 mem
    # mknod null              c 3 2   ; chmod 666 null
    # mknod zero              c 3 12  ; chmod 666 zero
    # mknod eeprom            c 3 11  ; chmod 640 eeprom ; chgrp 2 eeprom
    # mknod openprom          c 70 0  ; chmod 640 openprom;chgrp 2 openprom
    # mknod drum              c 7 0   ; chmod 640 drum ; chgrp 2 drum
    # mknod klog              c 16 0  ; chmod 600 klog
    # mknod stdin             c 24 0  ; chmod 666 stdin
    # mknod stdout            c 24 1  ; chmod 666 stdout
    # mknod stderr            c 24 2  ; chmod 666 stderr
    # mknod fb                c 22 0  ; chmod 666 fb
    # mknod mouse             c 13 0  ; chmod 666 mouse
    # mknod kbd               c 29 0  ; chmod 666 kbd

You also must create device nodes for the disk devices that you are installing NetBSD onto, again you can use NetBSD's /dev/MAKEDEV as a reference.

    # mknod sd0a              b 7 0
    # mknod sd0b              b 7 1
    # mknod sd0c              b 7 2
    # mknod sd0d              b 7 3
    # mknod sd0e              b 7 4
    # mknod sd0f              b 7 5
    # mknod sd0g              b 7 6
    # mknod sd0h              b 7 7
    # mknod sd1a              b 7 8
    # mknod sd1b              b 7 9
    # mknod sd1c              b 7 10
    # mknod sd1d              b 7 11
    # mknod sd1e              b 7 12
    # mknod sd1f              b 7 13
    # mknod sd1g              b 7 14
    # mknod sd1h              b 7 15
    # mknod rsd0a             c 17 0
    # mknod rsd0b             c 17 1
    # mknod rsd0c             c 17 2
    # mknod rsd0d             c 17 3
    # mknod rsd0e             c 17 4
    # mknod rsd0f             c 17 5
    # mknod rsd0g             c 17 6
    # mknod rsd0h             c 17 7
    # mknod rsd1a             c 17 8
    # mknod rsd1b             c 17 9
    # mknod rsd1c             c 17 10
    # mknod rsd1d             c 17 11
    # mknod rsd1e             c 17 12
    # mknod rsd1f             c 17 13
    # mknod rsd1g             c 17 14
    # mknod rsd1h             c 17 15
    # chgrp 5 *sd[0-1][a-h]
    # chmod 640 *sd[0-1][a-h]

Configuring the NetBSD system (still under Solaris)

You will now need to configure some of the files in /mnt/etc to allow the system to work properly. In particular, you will need to modify /etc/rc.conf or else you will only get to single user mode. Read through the examples in /etc/defaults/rc.conf and override any settings in /etc/rc.conf. You will also need to create a /etc/fstab file to tell the system which slice to mount as /usr, etc. You should follow the examples in /etc/fstab.wd or /etc/fstab.sd depending on whether you are using IDE or SCSI disks. You may also want to setup your /etc/resolv.conf file for name services and your /etc/hosts file if you are confident that you will get networking setup on your first try.

Booting into NetBSD

You should now be able to reboot. When you are prompted for a root device, specify sd1a or whichever disk/slice you used up to this point. Hit enter for the remaining two choices and you should eventually find yourself at a login prompt. The login name is of course 'root' and there is no passwd yet.

Post-install Configuration

Networking Notes

Unfortunately, dhcp does not work. However, you can use ifconfig and route to setup the hme0 interface in the conventional manner.

   # ifconfig hme0 10.0.0.2 netmask 255.255.255.0
   # route add default 10.0.0.1

One caveat about ifconfig is that it does not display the ip address of the hme0 interface even after it has been successfully brought up.

Installing ssh

NetBSD 1.5_BETA does not currently support the console devices on the PCI based workstations. This means that all IO is done through the hideously slow OpenPROM console code. To me, this meant that my first goal should be to get ssh installed. /etc/rc.d/sshd does not work properly for starting sshd. You should create your host key manually with :

    # /usr/bin/ssh-keygen -b 1024 -f /etc/ssh_host_key
and then start sshd.

Installing a Toolchain

The first thing you will probably want to do is to install a toolchain so that you can build your favorite applications. You can download a gcc 2.95.2 based toolchain from ftp.netbsd.org/pub/NetBSD/arch/sparc64/toolchain. The archives in this directory extract only to /usr/local so there are a couple of post-installation steps required to make sure all the files are in the right place.

   # mv /usr/local/bin/cpp /usr/local/bin/cpp.real
   # rm -f /usr/libexec/cpp
   # ln -s /usr/local/bin/cpp.real /usr/libexec/cpp
   # ln -s /usr/local/bin/strip /usr/bin
   # ln -s /usr/local/bin/gcc /usr/bin
   # ln -s gcc /usr/bin/cc

These changes insure that the NetBSD/usr/bin/cpp is called, that install(1) will find strip(1), and that /usr/bin/cc is present. (From the README)

Upgrading your system by tracking -CURRENT

NetBSD/sparc64 is a rapidly evolving platform; and as such you will probably want to track -CURRENT to be involved in testing the latest bug fixes and enhancements. You can keep track of the NetBSD source changes through sup or through cvs.

Using sup to track -CURRENT

Using CVS to track -CURRENT

CVS is a version control system that allows users to check out the latest development sources. This also allows user the ability to look through the revision logs to examine the changes between specific versions of files. For more information about cvs, please see http://www.cvshome.org.

CVS can be installed from the NetBSD ports collection. To install the NetBSD ports collection, you should first download 'pkgsrc.tar' from ftp.netbsd.org/pub/NetBSD/NetBSD-current and unpack this archive into /usr/pkgsrc. From there you can type :

    # cd /usr/pkgsrc/devel/cvs
    # make all install clean

CVS will now be installed on your system. By default the package system will install new binaries to /usr/pkg/bin so you may have to add this directory to your path before you can use cvs.

To check out the newest sources with CVS you will first have to specify a source code repository where cvs should check out from. The easiest way to do this is with the environment variable CVSROOT.

    # setenv CVSROOT :pserver:anoncvs@anoncvs.netbsd.org:/cvsroot

Once this has been set you will need to login to the server and supply 'anoncvs' as the password.

    # cvs login
    password: <anoncvs>

Now finally we can checkout the newest sources.

    # cd /usr
    # cvs co src

Once this command has completed you will have a complete NetBSD -current source tree on your system. The next step is to build a new kernel and then rebuild the world.

Additional Information

Work in Progress