My RAM disc page
 

This is how I made mine ... it should work on any LART, and probably most other SA1100 based systems as well.

What you need to get before starting:

The process is going to be:
1. Compile uClibc and get it working (but don't install yet)
2. Compile but don't install busybox
3. Compile but don't install tinylogin
4. Create and mount a ramdisk
5. Install busybox and tinylogin on to ramdisk
6. if you have dynamically linked anything then install uClibc to the ramdisk too
7. Unmount ramdisk
8. gzip, uucode and upload to blob


1. Compile uClibc and get it working (but don't install yet)

You probably got uClibc as a gzipped tarball called something like;
uClibc-snapshot.tar.gz

First, more to your base directory for creating the ramdisk;
cd  ~/ramdisk/

Next ungzip and untar uClibc;
tar zxvf uClibc-snapshot.tar.gz

Now follow the instructions in the README file to copy the Config-arm configuration file to the uClibc directory as Config.

Next, edit the Config file for your setup. Here are some of the lines from that file (AFTER I changed them);
CROSS = arm-linux-
KERNEL_SOURCE=/usr/src/arm/linux/
DEVEL_PREFIX = /data/lart/uClibc
TARGET_PREFIX = /root/initrd

Note that I put the LART GNU toolchain tools in the directory /data/lart/cross (actually I had to, placing them anywhere else doesn't work...).  The uClibc files that we will compile busybox and tinylogin against will be placed in /data/lart/uClibc.

The TARGET_PREFIX is not used just yet - but will be used later when we populate our ramdisc.

Next, we have to ensure that the arm-linux-  executables from the LART GNU toolchain are in our path;
(under bash)
export  PATH=$PATH:/data/lart/cross/bin

Now continue following the README file by executing;
make
make install_dev

but DO NOT make install_target just yet, or export the path.



2. Compile but don't install busybox

Back in your ramdisk directory, ungzip and untar busybox;
cd  ~/ramdisk/
tar zxvf  busybox-0.51.tar.gz
cd  busybox-0.51

Read the README file.

Edit the Config.h file to enable/disable your choice of options.  If you aren't sure, have a look at mine.

Edit the Makefile. Again, a few changes.  Here are the lines I changed AFTER I edited them:
DOSTATIC = true
CROSS = arm-linux-
CC=  /data/lart/uClibc/usr/arm-linux-uclibc/usr/bin/arm-uclibc-gcc

Next simply execute the make ONLY;
make



3. Compile but don't install tinylogin

Very similar to the Busybox compilation-
Back in your ramdisk directory, ungzip and untar tinylogin;
cd  ~/ramdisk/
tar zxvf  tinylogin-0.80.tar.gz
cd tinylogin-0.80

Read the README file.

Edit the Config.h file to enable/disable your choice of options (or if in doubt don't touch).

Edit the Makefile. Again, a few changes.  Here are the lines I changed AFTER I edited them:
DOSTATIC = true
CROSS = arm-linux-
CC=  /data/lart/uClibc/usr/arm-linux-uclibc/usr/bin/arm-uclibc-gcc
LIBCDIR=/data/lart/uClibc/usr/arm-linux-uclibc/

Next simply execute the make ONLY;
make
 



4. Create and mount a ramdisk

(Most of this is from the Loopback-Root-FS mini HOWTO)

Become root
su

Go to your ramdisk directory, create a mount point for the ramdisk somewhere (here, in /root/)
cd ~/ramdisk/
mkdir /root/initrd

Next create a clean area of disc full of zeros (by copying the required number of zeros on to it), and create an ext2 filesystem on it.  The count argument to dd gives the size of ramdisk we want to create.  It makes sense to get this right now (because I don't know how to change it later...mine is 1.2MBytes);
dd if=/dev/zero  of=my-initrd.img  bs=1k  count=1200
mke2fs -i 1024 -b 1024 -m 5 -F -v my-initrd.img

Next mount the directory;
mount my-initrd.img /root/initrd -t ext2 -o loop

We will now leave this mounted and start to put things in it.


5. Install busybox and tinylogin on to ramdisk

First set up some directory structure in your ramdisk
cd /root/initrd
mkdir usr var etc bin sbin lib dev proc mnt

Next, go to the busybox and tinylogin directories in turn and install the programs on the ramdisk;

cd ~/ramdisk/busybox-0.51/
make  PREFIX=/root/initrd  install-hardlinks

cd ~/ramdisk/tinylogin-0.80/
make  PREFIX=/root/initrd  install-hardlinks

If you have a look in /root/initrd you will see the hard linked files in /bin, /sbin and so on.

Now populate the /dev/ directory in your ramdisk.  You need these files in here to actually do anything!
cd /root/initrd/dev
mknod tty0 c 4 0
mknod ttyS0 c 4 64
mknod tty c 5 0
mknod null c 1 3
mknod ram0 b 1 0
mknod ram1 b 1 1
mknod ram2 b 1 2
mknod ram3 b 1 3
mknod mem c 1 1
mknod kmem c 1 2
mknod console c 5 1

Finally, we need some files for the system to startup properly;
cd /root/initrd/etc
mkdir  init.d

And create a very simple /root/initd/etc/inittab (startup script) containing;
::sysinit:/etc/init.d/rcS
ttyS0::respawn:/bin/sh

This very simply runs the shell (sh) on the serial link, and runs the system initialisation file rcS when you boot.
So of course we have to create a file named /root/initd/etc/init.d/rcS to contain something like;
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH

>/etc/mtab
mount  /proc
mount -f /

echo Welcome!

Next create fstab (still in the etc directory) to show the filesystems used/mounted;
/dev/ram        /               ext2    defaults        1 1
none            /proc           proc    defaults        0 0

A passwd file;
root::0:0:root:/root:/bin/sh

A group file;
root::0:root

And you may need a securetty file simply containing;
ttyS0

Finally, you can, if you want, put a file named profile in the etc directory which will be executed whenever you enter the shell with the login argument.  However I have a problem here, it seems that the busybox shell does not accept the -L or --login arguments that you would expect (this would have been done in inittab if possible).  So unfortunately I don't know how to get login shell behaviour here...a minor discomfort only.



6. if you have dynamically linked anything then install uClibc to the ramdisk too

Read the uClibc documentation.  The only point to worry about is that when you compiled uClibc, you should have told it in the Makefile where the library will be located on the runtime system.  Make sure you observe this with your installation to the ramdisk.



7. Unmount ramdisk

cd ~/ramdisk
umount /root/initrd



8. gzip, uucode and upload to blob

Now gzip the ramdisk image (LART expects the ramdisk stored in flash -or in DRAM- to be gzipped).  [I don't know if you can bzip2 the ramdisk and kernel? This is supposed to become standard in time]

gzip -c -9 my-initrd.img > my-initrd.img.gz

Check the size - if you did the same as me (and did not install uClibc) then this should now be around 115kbytes in size.

Of course the blob bootloader expects the ramdisk to be uuencoded so;

uuencode my-initrd.img.gz initrd > my-initrd.img.gz.uu

To upload to blob, I highly recommend using the scrpts available from Aleph 1.

You can alternatively grab my scripts changed a little so you can upload kernel and ramdisk separately.

Once you are talking to blob (I recommend using minicom), just execute a script with the uuencode file you want to upload on the command line (Note: don't manually tell blob you are doing an upload, the script will tell blob for you);

./uploadinitrd  my-initrd.img.gz.uu



Finally, boot and enjoy.  If it doesn't work for you, enjoy your debugging...