Skip to main content.

14.4.1. How to Add Files to a SELF Ramdisk

It is not always necessary to rebuild a SELF based ramdisk image if you want to modify or to extend it. Especially during development it is often eaiser to unpack it, modify it, and re-pack it again. To do so, you have to understand the internal structure of the uRamdisk (resp. pRamdisk) images files as used with the U-Boot (old: PPCBoot) boot loader:

The uRamdisk image contains two parts:

To modify the contents you have to extract, uncompress and mount the ramdisk image. This can be done as follows:

  1. Extract compressed ramdisk image (ramdisk.gz)
    bash$ dd if=uRamdisk bs=64 skip=1 of=ramdisk.gz
    21876+1 records in
    21876+1 records out
    
  2. Uncompress ramdisk image (if it was a compressed one)
    bash$ gunzip -v ramdisk.gz
    ramdisk.gz:      66.6% -- replaced with ramdisk
    
  3. Mount ramdisk image
    bash# mount -o loop ramdisk /mnt/tmp
    

Now you can add, remove, or modify files in the /mnt/tmp directory. If you are done, you can re-pack the ramdisk into a U-Boot image:

  1. Unmount ramdisk image:
    bash# umount /mnt/tmp
    
  2. Compress ramdisk image
    bash$ gzip -v9 ramdisk
    ramdisk:         66.6% -- replaced with ramdisk.gz
    
  3. Create new U-Boot image (new-uRamdisk)
    bash$ mkimage -T ramdisk -C gzip -n 'Simple Embedded Linux Framework' \
    > -d 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
    

Instead of re-packing into a U-boot ramdisk image you can of course also just extract the contents of the SELF image and re-use it as base of a (known to be working) root filesystem.

14.4. Self 1. Abstract 14.4.2. How to Increase the Size of the Ramdisk
Prev Home Next