Installing Debian on Power Architecture® based systems using U-Boot
Author
This document was created by
WolfgangDenk (wd {at} denx {dot} de)
and is based on work by Bernhard Kuhn (bkuhn {at} metrowerks {dot} com).
Introduction
This document describes how to install Debian GNU/Linux 3.0
(woody) on Power Architecture® based systems equipped with the U-Boot
bootloader. Both, the root filesystem and the installation
media will be mounted via NFS.
Status
The following installation instructions have been successfully
tested with TQM860L and LITE5200 boards and U-Boot-0.3.0. Other versions of
U-Boot should work as well.
Software Reqirements
On the Linux host, you need to have an
TFTP and NFS server
up and running. For the target, you need to download
the Power Architecture® binary iso image "woody-powerpc-1.iso", i.e.
from:
http://smokeping.planetmirror.com/pub/debian-minicd/woody/
Copy or move the iso image to the
/tmp directory on
your host machine (not to the target file system).
For the following instructions, it is assumed that
your host has the IP address
192.168.1.1 and the
target has
192.168.1.20
Preparing the host for installation
In order to be able to install Debian on the target,
you first need to prepare several files, directories
and services on the host: login as root on the host
and perform the following steps:
- Prepare an NFS root directory for the target, i.e.
install -d /tftpboot/192.168.1.20
- Loop-back mount the iso image and copy the content
to the NFS directory of the target
install -d /mnt/loop
install -d /tftpboot/192.168.1.20/var/ftp/debian
mount -o loop /tmp/woody-powerpc-1.iso /mnt/loop
cp -vax /mnt/loop/* /tftpboot/192.168.1.20/var/ftp/debian
umount /mnt/loop
- Prepare the installation ramdisk image:
cp /tftpboot/192.168.1.20/var/ftp/debian/install/prep/root.bin /tftpboot/
/opt/Embedix/bsp/mpc5200icecube-2.0/emb-bin/mkimage \
-T ramdisk -d /tftpboot/root.bin /tftpboot/root.bin.img
The location of "mkimage" may vary.
- Add an NFS export entry for the target and restart the NFS server:
echo "/tftpboot/192.168.1.20 192.168.1.20(rw,no_root_squash)" \
>> /etc/exports
/etc/rc.d/init.d/nfs stop
/etc/rc.d/init.d/nfs start
For SuSE, use /etc/rc.d/nfsserver instead.
- Compile the kernel for the target and place the U-Boot
compliant kernel image to /tftpboot as "uImage".
Please note that the kernel needs support for initial
ramdisk and that a "cat /proc/cpuinfo" on the target
needs to show an entry like this:
machine : PReP
Otherwise the Debian installer will complain about a
not yet supported platform and stop operation.
Usualy, you need to modifiy the kernel to archive this
behaviour.
For the TQM860, just add the line
len += sprintf(len+buffer,"machine\t\t: PReP\n");
in file arch/ppc/kernel/m8xx_setup.c, function
m8xx_setup_residual().
For IceCube+, change the appropriate line to
seq_printf(m, "machine\t\t: PReP\n");
in file arch/ppc/platforms/icecube.c, function
icecube_show_cpuinfo().
Preparing the target for Installation
Setup several bootloader environment variables on the
U-Boot command line prompt. make sure that U-Boot
has been installed on the target, do a reset and
type in the following lines after the bootloader comes
up on the serial terminal (default com parameters:
115200,8,n,1):
setenv ethaddr 00:11:22:33:44:55
setenv ipaddr 192.168.1.20
setenv serverip 192.168.1.1
setenv bootcmd tftp 100000 /tftpboot/uImage \; tftp 200000 /tftpboot/root.bin.img \; bootm 100000 200000
setenv bootargs root=/dev/ram rw
saveenv
Installing Debian
- Reset the target. After the autoboot sequence, the kernel and
the installation root filesystem should be downloaded via
the network, both will be uncompressed, the kernel will boot
and mount the ramdisk. Finally, the Debian installer intro
will come up on the serial console. Just press to continue.
- Skip the Keyboard configuration and select "Configure the hostname"
alternativly - just accept the default "debian"
- Accept "Next: Configure the Network", don't do
"Automatic Network Configuration". Enter the following
values during network configuration:
IP address: 192.168.1.20
Netmask: 255.255.255.0
Gateway: 192.168.1.1
Domain name: muenchen.de
DNS server: 62.155.254.208
Some of these parameter may differ in your setup.
After the network setup, you should be returned to the
"Debian GNU/Linux Installation Main Menu"
- Select "Do Without a Swap Partition" and accept
"Yes" in the next dialog.
- Now choose "Execute a Shell" and type mount the target root
filesystem manually:
mount -o nolock -t nfs 192.168.1.1:/tftpboot/192.168.1.20 /target
Type "exit" in order to return to the main menu.
- Select "Install the Base System" in the main menu.
- In the "Select Installation Medium" dialog, choose
"mounted : already mounted filesystem".
- Accept the given "partition" in the next dialog.
- Choose "manually : Enter the directory manually" in the
"Select Debian Archive path" dialog box and enter
var/ftp/debian/dists/woody/main/binary-powerpc
as the directory that contains the Archive files.
The installation process will start, now. For the TQM860l, this
took about an hour to complete. After the installation, the
configuration of several packages will fail - this is not fatal.
Just press until you end up in the main menu, again.
- Reset the target, wait until the bootloader shows up and
interrupt the autoboot sequence.
Preparing the target filesystem for operation
After the installation, you need to modify several files
on the target filesystem. It's easier to do these
changes on the export filesystem on the host:
- In /tftpboot/192.168.1.20/etc/inittab, comment out the
following entries:
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
and add the following entry:
T0:23:respawn:/sbin/getty 115200 ttyS0
- In /tftpboot/192.168.1.20/etc/securetty, add an entry
for the serial console:
ttyS0
- Goto to /tftpboot/192.168.1.20/sbin and type:
mv start-stop-daemon start-stop-daemon.FAKE
mv start-stop-daemon.REAL start-stop-daemon
to correct some installation wiredness.
- Goto /tftpboot/192.168.1.20/etc and type:
find rc* -name "S*pcmcia" | xargs rm
find rc* -name "K*pcmcia" | xargs rm
find rc* -name "S*hwclock*" | xargs rm
find rc* -name "K*hwclock*" | xargs rm
to get rid of hwclock and pcmcia startup script invocation
- In /tftpboot/192.168.1.20/etc/init.d/checkroot.sh change
line 27 ("rootcheck=yes") into "rootcheck=no". Then comment
out lines 169 and 174:
line 169: #mount -n -o remount,$rootmode /
line 174: #mount -f -o remount /
- Goto /tftpboot/192.168.1.20/etc and type:
echo "server ntp1-rz.rrze.uni-erlangen.de" > ntp.conf
echo "deb file:/var/ftp/debian woody main" > apt/sources.list
echo "none /proc proc defaults 0 0" >> fstab
rm resolv.conf
cat > resolv.conf << EOF
search muenchen.de
nameserver 62.155.254.208
nameserver 194.25.2.129
EOF
for adjusting certain settings.
- Goto /tftpboot/192.168.1.20 and type:
install -d lib/modules/2.4.21-rc1/kernel
Preparing the target bootloader for operation
Finally setup the bootloader to automatically load the
kernel and boot Debian via nfs:
setenv bootargs root=/dev/nfs rw nfsroot=192.168.1.1:/tftpboot/192.168.1.20 ip=192.168.1.20:192.168.1.1:192.168.1.1:255.255.255.0:ppc:eth0:off
setenv bootcmd tftpboot 100000 /tftpboot/uImage \; bootm 100000
saveenv
After reset, the Debian should boot. Login as root, there is
no password.
Optimizing Debian for operation
After booting Debian in the target, login as root and perform the
following steps:
- Install ntpdate
apt-get update
apt-get install ntpdate
Now reset the target and login as root, again.
- Install certain packages that will allow you to compile
a kernel nativly:
apt-get install gcc
apt-get install g++
apt-get install make
apt-get install ssh
- Apply a password for root, or otherwise you won't be able to
login via ssh.
- Reset the target to make sshd effective. Alternativly, start
sshd manually.
Compiling a Kernel nativly
- Prepare the target filesystem on the host. Type:
cd /tftpboot/192.168.1.20/lib
ln -s libncurses.so.5 libncurses.so
cp -a /usr/include/ncurses* /tftpboot/192.168.1.20/usr/include
cp -a /opt/Embedix/home/kuhn/project/mpc5200-4/src/linuxppc_2_4_mpc5200 /tftpboot/192.168.1.20/usr/src/linux
The patch from where to take the kernel may certainly vary in your setup.
Please note that the ncurses header files for the target are taken from
the host. The clean solution would be to compile the ncurses library
nativly.
- Login into the target via ssh and type:
cd /usr/src/linux
cp .config config_icecube
make CROSS_COMPILE= distclean
cp config_icecube .config
make CROSS_COMPILE= menuconfig
make CROSS_COMPILE= uImage