Search:  
Gentoo Wiki

Soekris_Net4801_how-to

Contents

Soekris Net4801 lspci data

00:00.0 Host bridge: Cyrix Corporation PCI Master
00:06.0 Ethernet controller: National Semiconductor Corporation DP83815 (MacPhyter) Ethernet Controller
00:07.0 Ethernet controller: National Semiconductor Corporation DP83815 (MacPhyter) Ethernet Controller
00:08.0 Ethernet controller: National Semiconductor Corporation DP83815 (MacPhyter) Ethernet Controller
00:12.0 ISA bridge: National Semiconductor Corporation SC1100 Bridge
00:12.1 Bridge: National Semiconductor Corporation SC1100 SMI
00:12.2 IDE interface: National Semiconductor Corporation SCx200 IDE (rev 01)
00:12.5 Bridge: National Semiconductor Corporation SC1100 XBus
00:13.0 USB Controller: Compaq Computer Corporation ZFMicro Chipset USB (rev 08)

Bootstrapping Gentoo on a Soekris Net4801 system

Introduction

This how-to describes how to install a complete Gentoo Linux system on a Soekris Net4801 system. Let's begin by looking at the capabilities of the system itself, and after that, i will explain how to make Gentoo run on it using a 2 GB flash card and the on-board IDE flash card interface.

General information

The machine consists of an AMD Geode 266 mhz cpu, 2 serial ports (one of them is pin-based) and a compact flash based IDE interface. There are several features on the board besides these, but at this point we'll stick with what we need to get the system up and running with Gentoo. The general idea here, is to built a system on a flash card using an ordinary PC, which can then be booted on the Soekris box upon built completion. This procedure pretty much follows a standard Gentoo installation as described in the handbook, but I'll take you through the steps to avoid confusion.

The first step

Start out by booting a system with a functioning network connection using either the Gentoo Minimal CD, or any other system you have at your disposal. It's totally up to you what system you want to use, as long as it is Linux and has a working internet network connection. Fire up your favorite console and grant yourself root priviledges. Insert the Compact Flash card into a flash reader and connect it to your machine. When you're ready, follow the instructions below.

Readying the flash card

First we need to identify the flash card. Type:

# fdisk -l

When you've figured out what device node your flash card uses, we need to create the necessary partitions on the card. In this how-to we assume that the card is located at sdb. Type:

# fdisk /dev/sdb

Start out by erasing all current partitions on the card. "p" lists all partitions, and "d" allows you to delete them one by one.

Warning: You have to assure yourself that you are in fact working on the flash card. If you are not, you might end up deleting your entire system! If you accidentally erase something you shouldn't have, quit the program using ctrl+c. Then the changes will be undone.

Create a swap partition(sdb1), and a root partition(sdb2). "n" creates a new partition, and "t" changes its type. 82 is swap. 128 MB should be fine for the swap partition, and the root partition should have at least 1.5 GB. Remember to set the bootflag on your root partition using "a". Finally, save your spanking new partition layout using "w".

Now we need to create the filesystems in the new partitions. Remember to use your own device node. This example again uses sdb. Type:

# mkswap /dev/sdb1
# mke2fs -j /dev/sdb2

The flash card is now ready for the installation.

Building the system

First, activate the swap partition:

# swapon /dev/sdb1

Now the root partition needs to be mounted. Type:

# mkdir /mnt/gentoo
# mount /dev/sdb2 /mnt/gentoo

Verify the date:

# date

If it's incorrectly set, change it using(this example is february 5th 2007 15:39):

# date 020515392007

Now we need to download and apply the basic system onto the flash card. It is very important that you use a stage3 i586 release, since the Soekris cpu doesn't support i686. Type:

# cd /mnt/gentoo
# wget http://mirror.uni-c.dk/pub/gentoo/releases/x86/2006.1/stages/stage3-i586-2006.1.tar.bz2
# tar xvjpf stage3-*.tar.bz2

You may, of course, use some other mirror for this file if you like, and also keep in mind to grab the latest release. At the time of this writing 2006.1 is the newest release. More mirrors can be found at http://www.gentoo.org/main/en/mirrors.xml

Now grab a portage snapshot, and unpack it on the flash card. Again, you may use any mirror you like. Type:

# wget http://mirror.uni-c.dk/pub/gentoo/snapshots/portage-latest.tar.bz2
# tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr

Add the following lines to the file /mnt/gentoo/etc/make.conf:

File: /etc/make.conf
MAKEOPTS="-j2"

Also, add the needed mirrors and rsync servers using(this only works if you use a Gentoo system, or the Gentoo minimal CD. Otherwise you'll have to find the mirrors manually at http://www.gentoo.org/main/en/mirrors.xml):

# mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
# mirrorselect -i -r -o >> /mnt/gentoo/etc/make.conf

Choose the ones appropriate for your location.

Copy your network information into the new system. Type:

# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

Now it's time to chroot into the new environment. Type:

# mount -t proc none /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev
# chroot /mnt/gentoo /bin/bash
# env-update
# source /etc/profile
# export PS1="(chroot) $PS1"

Entering the flash environment

You are now working inside your flash card. Cool, eh? I think it is. Anyways, start out by syncing your Portage tree:

# emerge --sync

If it tells you that a newer version of Portage is available, emerge it using:

# emerge portage

You have to define your timezone. In this example I'm using Europe, Copenhagen. You, of course, have to adjust this to fit with your own timezone. Tab completion is your friend:

# cp /usr/share/zoneinfo/Europe/Copenhagen /etc/localtime

Building and optimizing your kernel

Now we need to install the kernel source. Type:

# USE="-doc symlink" emerge -va gentoo-sources

At this point we need to built a kernel for the Soekris system. Start the configuration like this:

# cd /usr/src/linux
# make menuconfig

On 64Bit systems (eg. AMD64) use: make ARCH="i386" menuconfig

The following settings are essential:

--> Processor type and features
    --> [ ]Symmetric multi-processing support
    --> Processor family
        -->(x) GeodeGX1
--> Device Drivers
    --> ATA/ATAPI/MFM/RLL support
        --> <x> National SCx200 chipset support
    --> Serial ATA (prod) and Parallel ATA (experimental) drivers
        --> <x> SC1200 PATA support
    --> Network device support
        --> [x] Network device support
            --> Ethernet (10 or 100Mbit)
                --> [x] National Semiconductor DP8381x series PCI Ethernet support
    --> Sound
        --> < > Sound card support

You may turn off lots of other unneeded stuff, but the above should give you a bootable kernel, so we'll leave it at that for the time being. After all, this is a guide to get Gentoo running on the Soekris, not a kernel setup guide.

End the configuration and answer YES when asked if you want to save the configuration. Now, compile the kernel:

# make && make modules_install

On 64Bit systems (eg. AMD64) use: make ARCH="i386" && make ARCH="i386" modules_install

Copy your brand new kernel into /boot:

# cp arch/i386/boot/bzImage /boot/kernel-2.6.19-gentoo-r5

Mounting partitions during boot time

Now we have to make sure that our partitions gets mounted correctly during boot time. This is done through /etc/fstab. We have a swap partition and a root partition and our fstab therefore have to look like this:

File: /etc/fstab
/dev/hda2               /               ext3            noatime         0 1
/dev/hda1               none            swap            sw              0 0
proc                    /proc           proc            defaults        0 0
shm                     /dev/shm        tmpfs           nodev,nosuid,noexec     0 0

Be aware that you might need to change hda to hdb in the first two lines. It depends on how your Soekris box detects your flash card. Normally though, the card will be named hda, so the above settings should be ok. If you experience boot problems when you're ready to boot the machine after following this how-to, you should try changing hda to hdb to see if it solves the problem.

Serial console setup

We now have to make sure that we can log onto the Soekris system using a null modem serial cable. To do this we need to make a change in our /etc/inittab file. Type:

# nano -w /etc/inittab

Find the section ressembling the following lines, and change it to look like this:

File: /etc/inittab
...
# SERIAL CONSOLES
s1:12345:respawn:/sbin/agetty 19200 ttyS0 vt100
...

Networking setup

Now set your desired hostname:

# nano -w /etc/conf.d/hostname

Set up the machine's IP address in /etc/conf.d/net. Below is an example of a class C network using static IP and a gateway. If you want to use dhcp the file must be blank:

File: /etc/conf.d/net
config_eth0=( "x.x.x.x netmask 255.255.255.0" )
routes_eth0=( "default gw x.x.x.x" )

Add your NIC(network card) to the default runlevel:

# rc-update add net.eth0 default

Misc settings and has-to-do's

Change the root password to whatever you want to use:

# passwd

If you want to localize your keyboard settings, change "us" to your desired language in /etc/conf.d/keymaps:

# nano -w /etc/conf.d/keymaps

Remember to change the machine's time to local time if you're hardware clock isn't running UTC(change "UTC" to "local"):

# nano -w /etc/conf.d/clock

Now, install syslog-ng and vixie-cron and add them to the default runlevel:

# emerge syslog-ng
# emerge vixie-cron
# rc-update add syslog-ng default
# rc-update add vixie-cron default

If you are using dhcp, remember to install a dhcp client:

# emerge -va dhcpcd

Also, install openssh, which enables you to connect to the Soekris box using the network interface:

# emerge -va openssh
# rc-update add sshd default

Installing and optimizing Grub

Now, install the Grub boot loader:

# emerge -va grub

What we need to do now, is to optimize the /boot/grub/grub.conf file to work with our Soekris box. This enables us to get a read-out from the null model cable. First, remove any existing grub.conf file(there probably aren't any, but just to make sure):

# rm /boot/grub/grub.conf

Now, create a new one:

# nano -w /boot/grub/grub.conf

The first section has to look like this. You can change the timeout value if you like, but 5 seconds seems quite suitable:

File: /boot/grub/grub.conf
default 0
timeout 5
serial --unit=0 --speed=19200 --word=8 --parity=no --stop=1
terminal serial

Now, add your Gentoo kernel and the belonging options. Insert the following section and adjust it to fit your own kernel image:

File: /boot/grub/grub.conf
title=Gentoo Linux 2.6.19-r5
root (hd0,1)
kernel /boot/kernel-2.6.19-gentoo-r5 root=/dev/hda2 console=ttyS0,19200n8

We now need to install Grub onto the master boot record of the flash card. It is very important that you use the correct hd values here. Grub counts from 0 instead of 1 as Linux device nodes do. If sda is your primary harddrive it would be called hd0 using Grub terms and the first partition on that drive would be named hd0,0 and so on and so forth. If you only have one harddrive connected, your flash card is probably called hd1 and your root partition on the flash card is probably called hd1,1, but remember to use tab completion just to make sure. First start the Grub command line tool:

# grub

Now, define the root partition on the flash card. If your flash card is called sdb, is disc number 2 in your system, and has its root partition as partition 2, type as follows:

> root (hd1,1)

Now install Grub into the flash MBR using the command. Again, we assume that the flash card is drive number 2 in your system:

> setup (hd1)
> quit

Exiting the environment

The system is now finished, and you may exit the chroot and unmount all flash partitions:

# exit
# umount /mnt/gentoo/proc
# umount /mnt/gentoo/dev
# umount /mnt/gentoo

If everything went well, the system is now ready for booting in the Soekris Net4801 box itself. If you encounter any problems, I've added a few notes below, which might help you solve some of those issues.

Troubleshooting

Serial console software

You can use the software gtkterm(emerge gtkterm) through X to communicate with the Soekris Net4801 using a null model cable. Connect the cable to your PC and set the speed to the Soekris default value of baud=19200, bits=8, stopbits=1, flowcontrol=none, parity=none. This will allow you to follow the boot process and maintain the system. An SSH connection is recommended for this during normal circumstances, but since it doesn't allow you to get read-out during boot, the null model connections is very handy if you have to diagnose boot problems.

Grub issues

If Grub doesn't load as expected, you might have installed Grub on a wrong disc. Re-insert the flash card into a card reader, and reenter the environment to check if you made any errors.

If Grub can't find your root directory during boot time, you might need to change hda to hdb in /etc/fstab.

Garbage output from console

If you recieve garbage output from the console, either your console software isn't set up using the correct baud, stopbits and so on, or the Soekris box doesn't have the same values as the ones we used in inittab and grub.conf. Check your Soekris manual to set these values correctly, and make sure your console software is set up with the values mentioned in the "serial console software" section above.

Retrieved from "http://www.gentoo-wiki.info/Soekris_Net4801_how-to"

Last modified: Fri, 05 Sep 2008 11:02:00 +0000 Hits: 7,486