4. Booting the SunPCi card with an NFS-Root

The next challange is providing Linux with an IP address to allow it to mount the NFS partition as its root filesystem. Obvious choices like RARP, BOOTP and DHCP can be used, but since we are already booting Linux using LOADLIN for DOS, we have another option.

4.1. Using the nfsroot and ip kernel command line options

The Linux kernel (see paragraph 3.3.1) can by itself mount an NFS partition as its root filesystem. There are 2 options we will use to configure the kernel. They are discussed in greater detail in the Documentation/nfsroot.txt file of the kernel source. I also have a local copy.

First we need to set the root=/dev/nfs option. This is not a real device but simply enables the use of the nfsroot option. The syntax is:

nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]

In order to mount, an ipaddress needs to be configured. We'll use the ip option. The syntax is:

ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>

This yields the following DOS batch file one liner. Name it nfsboot.bat.

loadlin linux root=/dev/nfs nfsroot=192.168.0.2:/home/sunpci/linux ip=192.168.0.11:192.168.0.2:192.168.0.1:255.255.255.0:sunpci:eth0:off

Execute is from DOS mode, and if all the changes from chapter 3 have been applied, your system should come up without errors.

4.2. Completing the installion

If you have succesfully boot your system, and you created your root filesystem by booting Linux first (using the Debian menu based installer), the program base-config will be run automatically. If you have chosen one of the other ways to create your root filesystem, run the program manually (after logging in as root):

bash# /usr/sbin/base-config

This program will configure things like the root password, timezone, user account and will give you the option of selecting additional Debian packages to complete your installation. Note that you can always switch to tty2 by pressing left Alt + F2 to get a shell.

4.3. Automating the boot process

Eventually you will want to boot Linux in a bit more automated way then running a batch file from DOS mode. A very fast way is to put the nfsboot.bat on the last line of the autoexec.bat of an OpenDOS diskimage. You can then boot Linux by typing:

# sunpci -C linux.diskimage

This will create a 512MB sparse file. This means that the file will only use as much real diskspace as actual data is inside it. When you just don't like to have a file that looks large just for LOADLIN and a Linux kernel, create a grow as you go disk by hand:

# /opt/SUNWspci2/bin/makedisk -o linux.diskimage \ 
	-i /opt/SUNWspci2/defaults/C.7.01.template \
	-s 512 -l -r 2 -b \
	-d /opt/SUNWspci2/defaults/7.01/ -c

There is still a 512MB minimun size restriction, but the size of the diskimage will only be the actual size used by the files in it. If you add the -f flag to the makedisk command, the diskimage is filled up (and an X status bar is shown).

Another option is to use the menu options of Windows 95/98 (and Millennium if you have resurrected the DOS mode for it). This is a simple setup that will give you a choice between booting Windows and Linux.

config.sys
[MENU]

; The following sets Yellow Text on a Blue background:
MENUCOLOR=14,1

; This means that Menuitem 1 will be executed after 5 seconds...
; [MENUDEFAULT=MENUITEM, Seconds before executing IF you don't press a key]:
MENUDEFAULT=1,5

; Here are the Option items in order [MENUITEM=Label, Item_Title]:
MENUITEM=WIN, Windows
MENUITEM=LINUX, Linux
MENUITEM=DOSONLY, DOS mode

[COMMON]
DEVICE=C:\WINDOWS\HIMEM.SYS /TESTMEM:OFF /V
DOS=HIGH,UMB

[WIN]

[LINUX]

[DOSONLY]

[COMMON]
autoexec.bat
@ECHO OFF

PATH=C:\WINDOWS;C:\WINDOWS\COMMAND

GOTO %CONFIG%

:WIN
C:\WINDOWS\WIN.COM
GOTO END

:LINUX
CALL C:\LINUX\NFSBOOT.BAT
GOTO END

:DOSONLY

:END

If your Win9x bootmenu does not show by default, and you don't want to press F8 all the time, make MSDOS.SYS read-write and change the value of BootMenu to 1. To use the DOS only option, you will also need to set BootGUI to 0.
Altenatively you can try: Start -> Run -> msconfig -> General -> Selective Startup -> Advanced -> Enable Startup Menu

Note: LILO will not work. Since Linux does not see the diskimage, it is not possible to install LILO on its Master Boot Record.

4.4. Booting SunPCi from a non-X terminal

Now that you have a Linux system running somewhat independent of the Sun host, it seems silly to have it only available within a Sun X session. Especially when you only access the Linux OS (or worse: the Sun host) through ssh or telnet, getting rid of the SunPCi X window becomes an itch.

The SunPCi card can only be booted by the X application named sunpcbinary. To be able to use an X app from a non-X terminal you need an X virtual frame buffer. The standard X11 release from X.org comes with Xvfb to accomplish this. Unfortunately, Sun did not include it with Solaris.

4.4.1. SUNWspci2 version 2.3 and later

The SunPCi drivers 2.3 and above come bundled with a modified version of VNC. This is a client-server based virtual X server. Xvnc is the daemon to run on the server, and vncviewer is the client which can run either on the server itself or on a remote machine. Since Sun has modified the authetication mechanism of the VNC package, you must use the vncviewer supplied by Sun to succesfully connect to the daemon. The Solaris package you need to install to make use of VNC for the SunPCi card is called SUNWspvnc.

The easiest way to start Xvnc is by using the sunpcid daemon that now comes with the SunPCi drivers. The configuration file for this daemon is /etc/Master.ini At the bottom of this file, there should be a section to configure vnc. If not, you can add the default settings like this:

[vnc]
CmdLineArgs=-geometry "1152x900" -depth 24
DisplayNum=10
StartupScript=/opt/SUNWspci2/bin/VNCStartup
UID=root        ;User ID
GID=root        ;Group ID
HomeDir=/root   ;Home directory
AutoStart=Enabled
Now whenever sunpcid is started (either by hand or by using /etc/init.d/sunpci.server, Xvnc will be started as well. You can connect to it by using:

$ vncviewer localhost:10

If you are running this command from a remote machine, replace localhost by the name or ip address of the server running Xvnc.

You will be prompted for a password. Type the password of the user that Xvnc is running as (root in the above example). Once inside the virtual X server, you can either run sunpci by hand, or use the /etc/Master.ini file to automate this for you. See man sunpcid for further details.

4.4.2. Earlier versions of SUNWspci2

If you are running an earlier version of the SunPCi drivers that does not come with VNC, you can either download VNC yourself or use Xvfb instead. The downside to Xvfb is that there is no way to interact with the X server once it is running. Xvfb for Solaris can be downloaded at http://www.idevelopment.info/data/Unix/General_UNIX/GENERAL_XvfbforSolaris.shtml . The simplest form of using Xvfb is:

# /usr/X11R6/bin/Xvfb :1 -screen 0 1024x768x8 &
# DISPLAY=:1 sunpci -C linux.diskimage

In this example Xvfb will create a socket in /tmp/.X11-unix and therefor has to be started as root. For example, link to this init.d script from the rc3.d directory. This might be prefered, as it does not interfere with the Xsun server you might have running on your console. If you do not have anyone logged on at the console, any user can start Xvfb using:

# /usr/X11R6/bin/Xvfb :1 -pn -screen 0 1024x768x8 &
# DISPLAY=localhost:1 sunpci -C linux.diskimage

See also the Xvfb section of the Solaris FAQ at http://www.science.uva.nl/pub/solaris/solaris2.html#q3.58

After shutting down your Linux system (using shutdown -h now or init 0) you will have to manually shut down sunpcbinary and Xvfb:

# pkill -x sunpcbinary
# pkill -x Xvfb