- Extract compressed ramdisk image (ramdisk.gz) from U-Boot image:
bash$ dd if=uRamdisk bs=64 skip=1 of=ramdisk.gz
21876+1 records in
21876+1 records out
- Uncompress ramdisk image
bash$ gunzip -v ramdisk.gz
ramdisk.gz: 66.6% -- replaced with ramdisk
- Mount ramdisk image
As root:
bash# mkdir -p /mnt/tmp
bash# mount -o loop ramdisk /mnt/tmp
- Create new ramdisk image, say 8 MB big:
bash$ dd if=/dev/zero of=new_ramdisk bs=1024k count=8
bash$ /sbin/mke2fs -F -m0 new_ramdisk
bash$ /sbin/tune2fs -c 0 -i 0 new_ramdisk
As root:
bash# mkdir -p /mnt/new
bash# mount -o loop new_ramdisk /mnt/new
- Copy files from old ramdisk to new ramdisk:
As root:
bash# cd /mnt/tmp
bash# find . -depth -print | cpio -VBpdum /mnt/new
Now you can add, remove, or modify files in the /mnt/new
directory. If you are done, you can re-pack the ramdisk into a
U-Boot image:
- Unmount ramdisk images:
As root:
bash# umount /mnt/tmp
bash# umount /mnt/new
- Compress new ramdisk image
bash$ gzip -v9 new_ramdisk
ramdisk: 66.6% -- replaced with new_ramdisk.gz
- Create new U-Boot image (new-uRamdisk)
bash$ mkimage -T ramdisk -C gzip -n 'New Simple Embedded Linux Framework' \
> -d new_ramdisk.gz new_uRamdisk
Image Name: Simple Embedded Linux Framework
Created: Sun May 4 13:23:48 2003
Image Type: PowerPC Linux RAMDisk Image (gzip compressed)
Data Size: 1400121 Bytes = 1367.31 kB = 1.34 MB
Load Address: 0x00000000
Entry Point: 0x00000000

Remember that Linux by default supports only ramdisks up to a size of 4 MB.
For bigger ramdisks,
you have to either modify your LInux kernel configuration
(parameter
CONFIG_BLK_DEV_RAM_SIZE in the "Block devices" menue),
or pass a
"ramdisk_size=" boot argument to the Linux kernel.