Filesystem for embedded linux
1) Bootloader
2) Linux Kernel customization
3) Root filesystem generation.
The newest trend in the Root filesystem generation is Debootstrap. But if you still need control over the file system creation, then this good old shell script is present there to rescue you 
#!/bin/bash
# Housekeeping…
rm -f /tmp/ramdisk.img
rm -f /tmp/ramdisk.img.gz
# Ramdisk Constants
RDSIZE=5000
BLKSIZE=1024
# Create an empty ramdisk image
dd if=/dev/zero of=/tmp/ramdisk.img bs=$BLKSIZE count=$RDSIZE
# Make it an ext2 mountable file system
/sbin/mke2fs -F -m 0 -b $BLKSIZE /tmp/ramdisk.img $RDSIZE
# Mount it so that we can populate
mount /tmp/ramdisk.img /mnt/initrd -t ext2 -o loop
# Populate the filesystem (subdirectories)
mkdir /mnt/initrd/bin
mkdir /mnt/initrd/sys
mkdir /mnt/initrd/dev
mkdir /mnt/initrd/proc
mkdir /mnt/initrd/lib
mkdir /mnt/initrd/etc
# Grab busybox and create the symbolic links
pushd /mnt/initrd/bin
cp -a /root/hi ./first
chmod +s first
popd
# Grab the necessary dev files
cp -a /dev/console /mnt/initrd/dev
cp -a /dev/zero /mnt/initrd/dev
cp -a /dev/mem /mnt/initrd/dev
cp -a /dev/ramdisk /mnt/initrd/dev
cp -a /dev/ram1 /mnt/initrd/dev
cp -a /dev/ram0 /mnt/initrd/dev
cp -a /dev/ram /mnt/initrd/dev
cp -a /dev/null /mnt/initrd/dev
cp -a /dev/tty /mnt/initrd/dev
cp -a /dev/tty1 /mnt/initrd/dev
cp -a /dev/tty2 /mnt/initrd/dev
# Equate sbin with bin
pushd /mnt/initrd
ln -s bin sbin
popd
# Finish up…
umount /mnt/initrd
gzip -9 /tmp/ramdisk.img
cp /tmp/ramdisk.img.gz /root/ramdisk.img.gz
Have a happy ramdisk.