Skip to main content.

9.5.5. Root File System on a Flash Card

Using an ext2 file system on a flash memory card (like CompactFlash, SD, MMC or a USB memory stick) is standard technology. To avoid unnecessary flash wear it is a good idea to mount the root file system read-only, or at least using the "noatime" mount option.

For our test we can use the "ext2.img" file from the previous step without changes:

  1. In this test we use a standard CompactFlash card which comes with a single partition on it. We use U-Boot to copy the ext2 file system image into this partition:
    => tftp 100000 /tftpboot/TQM860L/ext2.img
    Using FEC ETHERNET device
    TFTP from server 192.168.3.1; our IP address is 192.168.3.80
    Filename '/tftpboot/TQM860L/ext2.img'.
    Load address: 0x100000
    Loading: #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             ##########################
    done
    Bytes transferred = 3788800 (39d000 hex)
    => ide part
    
    Partition Map for IDE device 0  --   Partition Type: DOS
    
    Partition     Start Sector     Num Sectors     Type
        1                   32          500704       6
    => ide write 100000 20 1ce8
    
    IDE write: device 0 block # 32, count 7400 ... 7400 blocks written: OK
    
    Note that the "ide write" command takes parameters as hex numbers, and the write count is in terms of disk blocks of 512 bytes each. So we have to use 0x20 for the starts sector of the first partition, and 3788800 / 512 = 7400 = 0x1CE8 for the block count.
  2. We now prepare the Linux boot arguments to take this partition as read-only root device:
    => setenv cf_args setenv bootargs root=/dev/hda1 ro
    => setenv flash_cf 'run cf_args addip;bootm ${kernel_addr} - ${fdt_addr}'
    => setenv bootcmd run flash_cf
    
  3. ...and boot the system:
    ...
    Linux version 2.4.25 (wd@xpert) (gcc version 3.3.3 (DENX ELDK 3.1.1 3.3.3-9)) #1 Sun Jun 12 18:32:18 MEST 2005
    On node 0 totalpages: 4096
    zone(0): 4096 pages.
    zone(1): 0 pages.
    zone(2): 0 pages.
    Kernel command line: root=/dev/hda1 ro ip=192.168.3.80:192.168.3.1::255.255.255.0:tqm860l:eth1:off panic=1
    Decrementer Frequency = 187500000/60
    Calibrating delay loop... 49.86 BogoMIPS
    ...
    
9.5.4. Root File System on a Read-Only ext2 File System 1. Abstract 9.5.6. Root File System in a Read-Only File in a FAT File System
Prev Home Next