[ Aleph One home page | Company Information | Security Privacy and Terms of sale | Search ]
HOWTO: Linux on Brutus and other Arms |
I have tried to go into detail about each step, and include all commands to type at the prompt; it may be necessary to modify some of these commands. For example, you will need to replace "cjmorlan" (my username) with yours. Don't do everything as root. If you have problems with any package, hopefully it has an included INSTALL or README file. If you feel that I go too slowly and check too often, it's because there are many things that can go wrong, and knowing what is working is helpful.
I welcome feedback; if there is a problem with this document, please tell me. I can't check, as I no longer have a Brutus as of May 2000. If you want to donate one, I'd not complain. :')
This process requires a computer with one RS-232 serial port, running some sort of *NIX. You must be able to run i386 Linux binaries. If you can't, you can still follow this procedure, but you will need to build binaries for your system. If you build non-i386 replacements for any of the packages, email me so I can link to your copy. Also, on all systems, your compiler must be GCC, as other compilers are apparently unable to compile Glibc.
If you haven't set up your *NIX partitions yet, you should make a spare one; 16 MBytes is more than enough, 5 is as little as you can have. Without a spare partition, you will have to have loopback support in your kernel, and learn how to use it.
I'm assuming that all files downloaded will go into ~/gz/ (ie a sub directory called "gz" in your home directory). You require root access for just a little bit, everything else should be done as a user.
There is no warranty with this HOWTO. At least one step could trash your *NIX install. I assume no responsibility for this or other problems.
[/root]# chmod 666 /dev/ttyS0Now you need to own the spare hard disk partition, and someplace to mount it. I'm using /dev/sda5 but you probably aren't, and you must change every mention I make of it to a spare partition. (If you don't have a spare partition you will need loopback support in your kernel.)
[/root]# chown cjmorlan /dev/sda5 [/root]# mkdir /mnt/ram [/root]# mkdir /usr/arm [/root]# chown cjmorlan /usr/arm [/root]# mkdir /usr/arm-linux [/root]# chown cjmorlan /usr/arm-linuxTo let yourself mount the filesystem, add this line to /etc/fstab:
/dev/sda5 /mnt/ram ext2 user,noauto 0 0The spare partition should not already exist in /etc/fstab; if it does, then it isn't spare. If you use /dev/sda5 and it is not a spare partition you may destroy your system!
You will need to be root again for a few moments later on.
[cjmorlan]$ tar -xvzf ~/gz/brutus-test.tgz [cjmorlan]$ cd brutus-testthen hook up Brutus, switch it on, and type
[brutus-test]$ ./goDownloading to Brutus sometimes halts, and needs to be started over. Hit CTRL-C (^C) until the program quits (or kill it), switch Brutus off then on, and run "./go" again. Sometimes this takes several tries; it appears to be a hardware problem, and Intel seems unable/unwilling to fix it. Once it downloads successfully, you should see a Penguin on the LCD screen, and be able to login as root using the keyboard. Poor connections to the LCD are also a problem.
[brutus-test]$ mv ramdisk.gz ramdisk-old.gzNow download a newer ramdisk Put this one in the brutus-test directory.
[brutus-test]$ mv ~/gz/ramdisk.gz .To mount the disk, use edit_image.sh and save_image.sh. You must edit these two scripts to replace /dev/sda5 with your spare partition. Because you already own the partition, you don't need to be root to mount it. Put the scripts in ~/brutus/brutus-test/, then run edit_image.sh. The '-d' option is required to extract the information from ramdisk.gz. Check that the disk is mounted with df.
[brutus-test]$ mv ~/gz/*_image.sh . [brutus-test]$ chmod +x *_image.sh [brutus-test]$ sh edit_image.sh -d dumping ramdisk.gz to /dev/sda5 10240+0 records in 10240+0 records out mounting /dev/sda5 [brutus-test]$ df Filesystem Size Used Avail Use% Mounted on /dev/hda5 480M 83M 372M 18% / /dev/hda1 9.5M 1.8M 7.2M 20% /boot /dev/sda6 2.0G 1.8G 85M 96% /usr pluto:/home 28G 20G 6.8G 74% /home /dev/sda5 16M 4.6M 1.2M 79% /mnt/ramNow that the data have been dumped to /dev/sda5, you will not require the '-d' switch for edit_image.sh, unless you want to start over or use a different ramdisk.
You need to be root again for a moment, to let you write to /root on the ramdisk.
[/root]# chown cjmorlan /mnt/ram/rootThere isn't anything interesting to do to the filesystem, so for now just prove you can modify it.
[brutus-test]$ ls /mnt/ram/root greet.c greet.o light.c light.o [brutus-test]$ touch /mnt/ram/root/FOO [brutus-test]$ ls /mnt/ram/root FOO greet.c greet.o light.c light.oThere is a new file called FOO. The others are example kernel modules. I will deal with them later. For now, you need to dump the ramdisk back to a file.
[brutus-test]$ sh save_image.sh unmounting /dev/sda5 retrieving ramdisk from /dev/sda5 5+0 records in 5+0 records out gzipping ramdiskNow you can run "go" again to boot with the modified ramdisk. /root/FOO should exist when you login on the Arm.
Building a cross compiler by hand can be difficult. But someone has built one to compile for the Arm using a i386 host. It is available from ftp://ftp.netwinder.org/users/n/nico/arm-xtoolchain.tgz. Expand it from / and make yourself own it. You will need to be root.
[/root]# cd / [/]# tar -xvzf ~cjmorlan/gz/arm-xtoolchain.tgz [/]# chown -R cjmorlan /usr/local/arm-linux/ [/]# chown -R cjmorlan /usr/local/lib/gcc-lib/arm-linux/Non-i386 users will have to make their own cross compiler.
[brutus-test]$ cd /usr/arm [arm]$ mkdir src [arm]$ cd src [src]$ tar -xvzf ~/gz/linux-2.3.39.tar.gz ... [src]$ cd linux [linux]$ gzip -dc ~/gz/patch-2.3.39-rmk1.gz | patch -p1 [linux]$ gzip -dc ~/gz/linux-2.3.39rmk1-cvs000121.diff.gz | patch -p1You now need to edit /usr/arm/src/linux/Makefile. Remove the line
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)(or something like that) with
ARCH = armNow you need to setup a configuration. Do this by saying
[linux]$ make menuconfigYou may need to remove a few things to make it conpile successfully. I had to remove the following:
Now to actually compile the kernel,
[linux]$ make dep [linux]$ make zImageIf it fails, run "make menuconfig" again, remove/add whatever seems appropriate, and run "make zImage" again. A few iterations might be required. The list above is probably what you will need to change.
Take note that the only kernel I have successfully compiled is 2.3.35 with patch-2.3.35-rmk1.gz and diff-2.3.35-rmk1-np7.gz, the latter being a replacement for the patch from ftp.netwinder.org.
So now you probably have a working kernel, and can link the kernel headers to allow compilation of userspace programs.
[linux]$ ln -s /usr/arm/src/linux/include/linux /usr/local/arm-linux/include [linux]$ ln -s /usr/arm/src/linux/include/asm-arm /usr/local/arm-linux/include/asm
[linux]$ cd /usr/arm/src [src]$ tar -xvzf ~/glibc-2.1.tar.gz [src]$ cd glibc-2.1 [glibc-2.1]$ tar -xvzf ~/gz/glibc-linuxthreads-2.1.tar.gz [glibc-2.1]$ tar -xvzf ~/gz/glibc-crypt-2.1.tar.gz [glibc-2.1]$ CC=arm-linux-gcc [glibc-2.1]$ ./configure arm-linux --build=i586-linux --prefix=/usr/local/arm-linux --enable-add-ons [glibc-2.1]$ make [glibc-2.1]$ make install
[brutus-test]$ mv ~/gz/hello.c . [brutus-test]$ arm-linux-gcc hello.c -o helloCopy it to the ramdisk, and download the new ramdisk to Brutus. Run it at the Brutus console.
[root@localhost /root]# ./hello Hello, world!
[root@localhost /root]# insmod greet.o Hello, world [root@localhost /root]# lsmod Module Size Used by greet 64184 0 (unused) [root@localhost /root]# rmmod greet Goodbye cruel world [root@localhost /root]# insmod light.o [root@localhost /root]# rmmod lightWhen "light" is loaded, the light connected to GPIO 20 should switch on.
These modules may not work without being recompiled unless your kernel is the same as mine. Recompiling one should fix it; you can compile a kernel module by saying
[cjmorlan]$ cp /mnt/ram/root/greet.c . [cjmorlan]$ arm-linux-gcc -c greet.cI recommend Linux Device Drivers by Alessandro Rubini if you want to write device drivers.
[ Aleph One home page | Company Information | Security Privacy and Terms of sale | Search ]