2011年4月21日 星期四

booting with jffs2

  1. Add "root=/dev/mtdblock3 rootfstype=jffs2 " to CONFIG_CMDLINE, or to u-boot bootargs if uImage is used, and enable following option:
    File systems --->
    [*] Miscellaneous filesystems --->
    <*> Journalling Flash File System v2 (JFFS2) support
    (0) JFFS2 debugging verbosity (0 = quiet, 2 = noisy)
    [*] JFFS2 write-buffering support
  2. Make jffs2 with:
    mkfs.jffs2 -d $(TARGET_ROOTFS_DIR) -o $(JFFS2_NAME) -e 128
    -e is the erase size, should be set to flash's block size.
  3. write the result $(JFFS2_NAME) to flash


Freerunner booting from SD
http://mkl-note.blogspot.com/2008/09/freerunner-booting-from-sd.html
Mounting the JFFS2 image on a loop back device (Block Memory MTD Emulation)
rootfs=<rootfs.jffs2>
mountpoint=jffsmountpoint;
export loop=$(losetup -f);
losetup $loop $rootfs;
modprobe block2mtd block2mtd=$loop,131072;
modprobe jffs2;
modprobe mtdblock;
mkdir $mountpoint -p;
mount -t jffs2 -o ro /dev/mtdblock0 $mountpoint;


在pc上製作jffs2 image及mount jffs2在loop back上
http://martin-yang.blogspot.com/2007/04/pcjffs2-imagemount-jffs2loop-back.html
modprobe mtdcore
modprobe jffs2
modprobe mtdram
modprobe mtdchar
modprobe mtdblock
確認以上modules會產生/dev/mtd0 及/mtd/mtdblock0檔案
dd if=/jffs2.img of=/dev/mtd0
mount /dev/mtdblock0 /mnt

沒有留言: