Installing SuSE Linux 9.3 on a Soekris 4801

You need:

Outline:

This step-by-step guide was inspired by:

Note: If you have any way of installing directly to the compactflash card (using a IDE-to-CF adapter) then do that, and jump directly to step 6. It will save you a LOT of work.

Step 1: Install Suse 9.3 on spare computer/vmware

You can either install SuSE on a spare computer or inside VMWare. I did the latter. You will be compiling the linux kernel later on so you need at least 700MB free disk space while at the same time you do not want exceed the CF capacity.

Chances are that your spare computer or vmware is more powerful than the net4801 so you will want to prepare the system as much as possible before moving it to the net4801.

During installation select "minimal installation" then select the packages:

and any other packages you will need. I selected bind, dhcp-server, radvd, ethereal and some other stuff. Then let YaST sort out the dependencies. Remember to select 3 as the default runlevel - net4801 does not have a graphical console.

Configure the system for how you want it setup, including:

Install, reboot etc.

Start YaST again and let it get the latest patches.

Do any additional configuration, such as NTP server setup, disabling unneeded services, etc.

Add ttyS0 to /etc/securetty

I also recommend adding ssh keys to your root profile now. Verify that they work.

Step 2: Make installation available for network boot

The net4801 can boot via PXE over the network. This is what we are going to do.

On the workstation/server you will need:

On the server: Create a partition (or a sub-fs if you want) and mount it as /export/soekris

  1. fdisk /dev/hd....
  2. reboot (usually)
  3. mkfs.ext2 /dev/hd...
  4. mkdir /export/soekris
  5. mount /dev/hd... /export/soekris
  6. Add to /etc/exports
    /export/soekris *(rw,no_root_squash,async)
  7. Start NFS server
    /etc/init.d/nfsserver start

On the spare computer/vmware:

/etc/init.d/portmap start
mkdir /import/soekris
mount <serverip>:/export/soekris /import/soekris

Copy the installation to the NFS drive. On the spare computer/vmware:

cd /
tar clSf - . | (cd /import/soekris; tar xpSf -)

The console on the net4801 will be the serial link. Fix /etc/inittab on the NFS copy:

#1:2345:respawn:/sbin/mingetty --noclear tty1
#2:2345:respawn:/sbin/mingetty tty2
#3:2345:respawn:/sbin/mingetty tty3
#4:2345:respawn:/sbin/mingetty tty4
#5:2345:respawn:/sbin/mingetty tty5
#6:2345:respawn:/sbin/mingetty tty6
#
S0:12345:respawn:/sbin/agetty -L 19200 ttyS0 vt102

By default, grub may hang if nothing is connected to the serial port. Fix /boot/grub/menu.lst on the NFS copy:

hiddenmenu
terminal --timeout=2 serial
 
title soekris-serial
     kernel (hd0,0)/boot/vmlinuz root=/dev/hda1 console=ttyS0,19200n81 selinux=0 splash=silent
    initrd (hd0,0)/boot/initrd

And remove all other entries.

The fstab must be suitable for a NFS root. On the server, fix the /etc/fstab on the NFS copy.

/dev/root            /                    nfs        defaults              1 1
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0
proc                 /proc                proc       defaults              0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
sysfs                /sys                 sysfs      noauto                0 0

I highly recommend changing the IP of the spare system now and rebooting it. You will probably need later while the net4801 is up.

You now have a suitable NFS root for the net4801. But we are not done yet. We have to configure PXE and DHCP.

On the server: configure the DHCP server (/etc/dhcp.conf) for your network, and include this entry:

host soekris {
  option root-path "/export/soekris";
  hardware ethernet <MAC of your soekris eth0 port>;
  filename "/tftpboot/pxelinux.0";
  fixed-address <the ip-address of your soekris>;
}

You also need to set up the TFTP server. The default installation in SuSE chroots to /tftpboot so all filenames are relative to that. Normally PXE stuff is referred to as /tftpboot/... so I ended up with just making the directory /tftpboot/tftpboot.

You now have to compile a kernel that has the network driver embedded and configured for NFS root. The net4810 has a National Semiconductor network chip. The "natsemi.c" is the proper driver. On the spare computer go to /usr/src/linux and:

make cloneconfig  (SuSE specific)
make menuconfig  (and configure the stuff mentioned above as built-in (not modules))
make
make install

Copy the kernel to the server's /tftpboot/tftpboot/vmlinuz-2.6.11.4-21.8-default

Copy /usr/share/syslinux/pxelinux.0 from the spare computer to the /tftpboot/tftpboot/ on the server

Make the directory /tftpboot/tftpboot/pxelinux.cfg

In that directory make a file named after the IP-address of the soekris in hex. Eg. 10.0.0.20 = 0A000014 with the following content:

SERIAL 0 19200 0
PROMPT 1
DEFAULT cf
TIMEOUT 40
label cf
kernel vmlinuz-2.6.11.4-21.8-default
append console=ttyS0,19200n81 root=/dev/nfs nfsroot=<ip-address of your server>:/export/soekris ip=dhcp panic=10 ramdisk_size=16384 rw

Note: some guides uses a backslash to separate long lines. It did not work for me.

Step 3: Boot 4801 via network (PXE)

Connect the null-modem 9-pin female/female cable to the soekris. Start a terminal program and configure it for 19200 8n1. Minicom works fine.

Start tcpdump -n -i eth0 or similar on your server. Chances are that something goes wrong.

If you have already inserted the compactflash card then you will need to press ctrl-P when prompted.

The net4801 will then find your DHCP server, get the fixed ip-address, and be told where to find the boot image. It will then contact your TFTP server and get pxelinux.0. pxelinux.0 will get the /tftpboot/pxelinux.cfg/0A000014 file, and then fetch /tftpboot/vmlinuz-2.6.11.4-21.8-default. The kernel will boot and mount the NFS root and be up and running. Then go to step 4.

Something went wrong, didn't it?

Step 4: Copy to compactflash card

The net4810 uses a National Semiconductor 1100 chipset. Linux 2.6 has a sc1200 driver which works.

On the net4801:

modprobe sc1200
fdisk /dev/hda
Make a single partition covering the whole compact flash card.
Do not create a boot partition.
Remember to mark the partition bootable.
mkfs.ext2 /dev/hda1
mount /dev/hda1 /mnt

grub
grub> root (hd0,0)
grub> setup (hd0)
grub> quit

Then copy the NFS root to the compact flash root

  cd /
  tar clSf - . | (cd /mnt; tar xpSf -)

Edit /mnt/etc/fstab to mount the compact flash root

  /dev/hda1             /                    ext2       noatime,acl,user_xattr 1 1

The 'noatime' option is important. You do not want to wear out the compact flash card. You should probably also consider mounter /tmp and /var/tmp as memory filesystems.

  none                  /tmp                 tmpfs      defaults               1 2
  none                  /var/tmp             tmpfs      defaults               1 2

Edit the INITRD_MODULES line in /etc/sysconfig/kernel:

  INITRD_MODULES="sc1200"

Then run 'mkinitrd' (Yes, this will overwrite the current initrd on the NFS root but you are not using it anyway.). Copy the resulting initrd to the compactflash drive.

  cp /boot/initrd-2.6.11.4-21.8-default /mnt/boot/

unmount the compactflash drive.

  umount /mnt

Step 5: Boot via compactflash card

shutdown -r now

(or simply power cycle the box)

Step 6: Final configuration

During startup there will be a few complaints about at least 3 network interfaces not being configured. For the patient, you can configure them with YaST. For the impatient, you can create the /etc/sysconfig/network/ifcfg-eth-* files by hand.

Start yast, go to system, go to runlevels, and disable all the services you do not want. You probably not want hal, dbus, powersaved, portmap, etc. running.

You may also want to tune /var a bit. http://www.xs4all.nl/~vhouten/Soekris.html has a few tricks.

top - 01:12:39 up  2:56,  2 users,  load average: 0.02, 0.01, 0.00
Tasks:  32 total,   1 running,  31 sleeping,   0 stopped,   0 zombie
Cpu(s):  1.0% us,  0.3% sy,  0.0% ni, 98.7% id,  0.0% wa,  0.0% hi,  0.0% si
Mem:    126400k total,    69684k used,    56716k free,     4008k buffers
Swap:        0k total,        0k used,        0k free,    45944k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 5119 ntp       15   0  2712 2712 1808 S  0.0  2.1   0:00.11 ntpd
 7641 root      15   0  7640 2488 2000 S  0.3  2.0   0:00.79 sshd
 7679 root      15   0  7640 2484 1996 S  0.0  2.0   0:00.64 sshd
 4998 root      15   0  4596 1956 1588 S  0.0  1.5   0:03.62 sshd
 7643 root      16   0  3128 1888 1404 S  0.0  1.5   0:00.78 bash
 5156 dhcpd     16   0  4220 1876 1204 S  0.0  1.5   0:00.00 dhcpd
 7681 root      16   0  3000 1872 1392 S  0.0  1.5   0:00.81 bash
 7700 man       16   0  2928 1136  936 S  0.0  0.9   0:00.04 sh
 7741 root      15   0  2040 1052  824 R  1.3  0.8   0:01.33 top
 7699 man       20   0  2012 1020  764 S  0.0  0.8   0:01.98 man
 4996 root      15   0  1852  856  684 S  0.0  0.7   0:00.12 syslog-ng
 7705 man       15   0  2096  848  692 S  0.0  0.7   0:00.15 less
 5040 daemon    16   0  1684  748  640 S  0.0  0.6   0:00.11 radvd
 5127 root      16   0  1736  744  620 S  0.0  0.6   0:00.02 cron
 1935 root      11  -4  1468  596  408 S  0.0  0.5   0:01.18 udevd
 4995 root      16   0  1600  588  400 S  0.0  0.5   0:00.02 klogd
 5159 root      17   0  1468  476  420 S  0.0  0.4   0:00.00 agetty
 4973 root      20   0  1496  468  404 S  0.0  0.4   0:00.00 resmgrd
 3653 root      17  -2  1456  432  312 S  0.0  0.3   0:00.00 hwscand
    1 root      15   0   680  248  216 S  0.0  0.2   0:02.98 init
    2 root      34  19     0    0    0 S  0.0  0.0   0:00.01 ksoftirqd/0
    3 root      10  -5     0    0    0 S  0.0  0.0   0:00.01 events/0
    4 root      10  -5     0    0    0 S  0.0  0.0   0:00.16 khelper
    9 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kthread
   22 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kblockd/0
   78 root      20   0     0    0    0 S  0.0  0.0   0:00.00 pdflush
   79 root      15   0     0    0    0 S  0.0  0.0   0:00.17 pdflush
   81 root      11  -5     0    0    0 S  0.0  0.0   0:00.00 aio/0
   80 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kswapd0
  672 root      15   0     0    0    0 S  0.0  0.0   0:00.00 kseriod
 2037 root      19   0     0    0    0 S  0.0  0.0   0:00.00 khpsbpkt
 2370 root      15   0     0    0    0 S  0.0  0.0   0:00.00 khubd