Quick and dirty uClibc buildroot guide... (a work in progress)

last updated: aug 4, 2006: added commentary

To create a bootable linux system you need three primary things a kernel, a root filesystem, and a boot loader. On second though let's say you need a fourth thing... hardware. Here are terse instructions for putting those things together. (Feel free to ignore any parenthetical comments I make to myself in this doc.)

Hardware

... Computer, USB Flash device, Hard drive, Floppy disk, CD,... this will go to determining bootloader later.

Root Filesystem

Checkout buildroot
 svn co svn://uclibc.org/trunk/buildroot
Compile the buildroot
cd buildroot
make
Select desired options especially the following and modify busybox config (does creating a root filesystem from scratch help us at all? smaller size? could we just have a post compile script remove things we don't want? compare sizes of from scratch vs target, show simple way and from scratch way)
ImageApprox. size
From scratch cramfs400k
From scratch ext2
rootfs.i586.cramfs1.8M
rootfs.i586.ext26.1M
Toolchain Options->Kernel Headers->2.6.11
Package Selection for the target->Busybox
You can select other options here but you will need to move them to the root filesytem yourself.
Target Options->Uncheck all
Exit and Save the configuration and run make again to start the compile
make
Create a 4MB root filesystem
dd if=/dev/zero of=root.fs.img bs=1M count=4
/sbin/mkfs.minix root.fs.img
mkdir -p root.fs/etc/init.d root.fs/tmp root.fs/dev root.fs/mnt root.fs/lib root.fs/bin root.fs/sbin root.fs/usr/bin root.fs/usr/sbin root.fs/proc
Copy busybox binaries and uClibc libraries to root filesystem
cp buildroot/build_i586/root/lib/libc.so.0 root.fs/lib
cp buildroot/build_i586/root/lib/ld-uClibc.so.0 root.fs/lib
cp buildroot/build_i586/root/bin/busybox root.fs/bin
Make required links
cd root.fs/bin
ln -s busybox sh
ln -s busybox mount
ln -s busybox ../sbin/init
cd ../..
Place filesystem on image
# As root
mount -o loop root.fs.img /mnt/image
cp -r root.fs/* /mnt/image
umount /mnt/image

Kernel

Your root filesystem and hardware will determine the options needed in your kernel. The common options are as follows.
initrd
ramfs
tmpfs
root filesystem type
boot media type
udev

Bootloader

The hardware you use will limit your bootloader options.
ISO - isolinux, grub
Floppy - kernel, syslinux, grub
Flash drive - grub