Configuring a BEE2 for Linux
Introduction
The purpose of this page is to describe the steps required to setup a BEE2 board to properly boot linux. This is primarily concerned with setting up the EEPROM on the BEE2 to hold the proper configuration strings. You can also find information on building a BEE2 root filesystem on Compact Flash, building a root filesystem for NFS, and building a kernel.
Overview of Configuration
The BEE2 has a small 512 byte EEPROM which comes as part of the X1226 RTC. The EEPROM and RTC are connected to the IIC bus. We currently use a simple software IIC core which we developed to access the IIC and SMB devices on the board. We use the EEPROM to hold a series of key/value pairs which describe configuration information necessary to boot Linux. This information includes:
Command line: this is the command line which will be passed to the kernel on boot. The boot loader will first display this line for several seconds, during which you can edit it if necessary. The command line contains information on the IP configuration, console setup, and how to mount the root filesystem. We will give more information on this below.
MAC address: the MAC address for the Fast Ethernet. If you have a brand new board which does not have this assigned, you should follow the BEE2 naming convention. The MAC address should be "00:6D:12:B2:XY:ZZ" where X is the board revision number, Y is the batch number of your board and ZZ is the board number. If your serial number is "2.1.10" your revision number (X) would be "2", your batch (Y) number would be "1" and your board (ZZ) number would be "0A". The address should be entered in the form "############" where # is a hexadecimal number (for the example above it would be 006D12B2210A).
Serial port baud rate: this is the baud rate which is used by the boot loader when it displays the configuration information. By default this should be 115200. Changing the baud rate requires a few other changes which will be described below.
Serial number: this is a serial number to identify the board. All new boards will come marked with a serial number from the assembler. The convention for serial numbers is REV.BATCH.NUM so a serial number 2.1.10 would mean board revision 2, assembly batch 1, board number 10.
Setting the Configuration Strings
Our BEE2 test suite includes software to set and read the configuration strings for the board. We have information on building and running the test suite in the wiki. Once you have the test suite running on the board and are connected over the RS232 link, run the following command:
set_eeprom
This will prompt you to enter the four pieces of information mentioned above. For each item it will also print the old value which you can cut/paste with your terminal emulator if you don't want to change the value. When you are done entering each one, hit enter, and at the end it should pause for a few seconds while it writes the values to the EEPROM. To test that the values were written successfully run the command:
get_eeprom
Which should print out the values you just entered.
Boot Command String
The boot command is probably the most important value you will set. It is the string that is passed to the kernel on boot, and can take any of the acceptable boot parameters. Here is an example (and recommended) command line for the BEE2 Linux reference design:
console=tty0 console=ttyS0,115200 nfsroot=/b2roots/hostname ip=192.168.0.100:192.168.0.1:192.168.0.1:255.255.255.0:hostname:eth0:off mem=512M rw root=/dev/nfs
console=tty0 - Use tty0 (frame buffer) as one of the consoles. This will not be the primary console because it comes first, so it will not be bound to /dev/console when init takes over
console=ttyS0,115200 - This means to use "COM1" as the serial console and to set the baud rate to 115200
root=/dev/nfs - This means that the root will be an NFS mount. If you are using a root filesystem on the CF (as described in Bee2DebianRootFs) then you will want to change this to something like "/dev/xsysace/disc0/part3" or something like that
nfsroot=/b2roots/hostname - This tells the kernel which NFS export to use as its root. If you use our NFS root (described in Bee2DebianRootNfs)
ip=... - This sets the IP configuration for the primary NIC (eth0) and is used for NFS boot and for IP configuration. This should be set regardless of whether you use NFS or not. The first IP address is the address of the BEE2, the second is the address of the NFS server, and the third is the address of the default gateway (this is described in the "Documentation/nfsroot.txt" file in the linux kernel source)
mem=512M - This is a required parameter to prevent Linux from trying to use memory over 512M. We currently think there is a bug in the highmem support for the PPC405 which causes the system to crash if it thinks it has more than 512MB of memory. This is something we are looking into, but until it is resolved you must have this parameter.
rw - Mount the root file system in read/write mode.
Changing Baud Rate
The default baud rate for Linux on the BEE2 is 115200. There really isn't a good reason to change this, but if you find a reason to, you must change several things. First, you need to change the command line stored in the EEPROM from console=ttyS0,115200 to console=ttyS0,YOURBAUD. Next, you need to change the baud rate parameter stored in the EEPROM to your baud rate. Finally, on your root file system you need to edit the file /etc/inittab and change the baud rate on the getty that spawns on ttyS0.