Specifications

$ genext2fs -U \
-d ${INITRD_DIR} \
-D ${INITRD_DEVICES} \
-b ${INITRD_SIZE} \
-r ${INITRD_FREE} \
-i ${INITRD_INODES} \
${INITRD_IMAGE}
$ gzip -v9 ${INITRD_IMAGE}
The result is a really small (233 kB) compressed ramdisk image.
Assuming you already have your Linux kernel image, you can now use mkimage to build an U-Boot
multi-file image that combines the Linux kernel and the initial ramdisk:
$ LINUX_KERNEL=linuxppc_2_4_devel/arch/ppc/boot/images/vmlinux.gz
$ mkimage -A ppc -O Linux -T multi -C gzip \
> -n 'Linux with Pivot Root Helper' \
> -d ${LINUX_KERNEL}:${INITRD_IMAGE}.gz linux.img
Image Name: Linux with Pivot Root Helper
Created: Mon Jun 13 01:48:11 2005
Image Type: PowerPC Linux Multi-File Image (gzip compressed)
Data Size: 1020665 Bytes = 996.74 kB = 0.97 MB
Load Address: 0x00000000
Entry Point: 0x00000000
Contents:
Image 0: 782219 Bytes = 763 kB = 0 MB
Image 1: 238433 Bytes = 232 kB = 0 MB
The newly created file linux.img is the second image we have to copy to the CF card.
We are done.
5.
But wait - one essential part was not mentioned yet: the linuxrc script in our initial ramdisk image which
contains all the magic. This script is quite simple:
#!/bin/nash
echo Mounting /proc filesystem
mount -t proc /proc /proc
echo Creating block devices
mkdevices /dev
echo Creating root device
mkrootdev /dev/root
echo 0x0100 > /proc/sys/kernel/real-root-dev
echo Mounting flash card
mount -o noatime -t vfat /dev/hda1 /mnt
echo losetup for filesystem image
losetup /dev/loop0 /mnt/rootfs.img
echo Mounting root filesystem image
mount -o defaults --ro -t ext2 /dev/loop0 /sysroot
echo Running pivot_root
pivot_root /sysroot /sysroot/initrd
umount /initrd/proc
Let's go though it step by step:
9.5.6. Root File System in a Read-Only File in a FAT File System 123