分区表:
0x000000000000-0x000000100000 : "mtdblock0 u-boot 1MB"
0x000000100000-0x000001000000 : "mtdblock1 kernel 15MB"
0x000001000000-0x000002400000 : "mtdblock2 ramdisk 20MB"
0x000002400000-0x000003800000 : "mtdblock3 cramfs 20MB"
0x000003800000-0x000006000000 : "mtdblock4 jffs2 20MB"
0x000006000000-0x000008800000 : "mtdblock5 yaffs2 40MB"
0x000008800000-0x00000b000000 : "mtdblock6 ubifs 40MB"
0x00000b000000-0x00000e200000 : "mtdblock7 apps 50MB"
0x00000e200000-0x000011400000 : "mtdblock8 data 50MB"
创建设备节点:
[lingyun@localhost dev]$ sudo mknod mtdblock0 b 31 0
[lingyun@localhost dev]$ sudo mknod mtdblock1 b 31 1
[lingyun@localhost dev]$ sudo mknod mtdblock2 b 31 2
[lingyun@localhost dev]$ sudo mknod mtdblock3 b 31 3
[lingyun@localhost dev]$ sudo mknod mtdblock4 b 31 4
[lingyun@localhost dev]$ sudo mknod mtdblock5 b 31 5
[lingyun@localhost dev]$ sudo mknod mtdblock6 b 31 6
[lingyun@localhost dev]$ sudo mknod mtdblock7 b 31 7
[lingyun@localhost dev]$ sudo mknod mtdblock8 b 31 8
内核支持
File systems --->
Miscellaneous filesystems --->
Journalling Flash File System v2 (JFFS2) support
(0) JFFS2 debugging verbosity (0 = quiet, 2 = noisy)
[*] JFFS2 write-buffering support
制作
[lingyun@localhost caijie]$ ls
backup driver.tar.bz2 library madplay makefile_sample mkimage mylinux ramdisk.gz rootfs
[lingyun@localhost caijie]$ mkfs.jffs2 -n -s 2048 -e 128KiB -d rootfs -o rootfs.jffs2 --pad=0x1300000
[lingyun@localhost caijie]$ mkfs.jffs2 --help
mkfs.jffs2: error!: Usage: mkfs.jffs2 [OPTIONS]
Make a JFFS2 file system image from an existing directory tree
Options:
-p, --pad[=SIZE] Pad output to SIZE bytes with 0xFF. If SIZE is
not specified, the output is padded to the end of
the final erase block
-r, -d, --root=DIR Build file system from directory DIR (default: cwd)
-s, --pagesize=SIZE Use page size (max data node size) SIZE (default: 4KiB)
-e, --eraseblock=SIZE Use erase block size SIZE (default: 64KiB)
-c, --cleanmarker=SIZE Size of cleanmarker (default 12)
-m, --compr-mode=MODE Select compression mode (default: priortiry)
-x, --disable-compressor=COMPRESSOR_NAME
Disable a compressor
-X, --enable-compressor=COMPRESSOR_NAME
Enable a compressor
-y, --compressor-priority=PRIORITY:COMPRESSOR_NAME
Set the priority of a compressor
-L, --list-compressors Show the list of the avaiable compressors
-t, --test-compression Call decompress and compare with the original (for test)
-n, --no-cleanmarkers Don't add a cleanmarker to every eraseblock
-o, --output=FILE Output to FILE (default: stdout)
-l, --little-endian Create a little-endian filesystem
-b, --big-endian Create a big-endian filesystem
-D, --devtable=FILE Use the named FILE as a device table file
-f, --faketime Change all file times to '0' for regression testing
-q, --squash Squash permissions and owners making all files be owned by root
-U, --squash-uids Squash owners making all files be owned by root
-P, --squash-perms Squash permissions on all files
-h, --help Display this help text
-v, --verbose Verbose operation
-V, --version Display version information
-i, --incremental=FILE Parse FILE and generate appendage output for it
[lingyun@localhost caijie]$ cp rootfs.jffs2 /tftp/
u-boot中设置的变量
jffs2_fs=tftp 30800000 rootfs.jffs2;nand erase 3800000 1400000;nand write 30800000 3800000 1400000
bootargs=noinitrd root=/dev/mtdblock4 rootfstype=jffs2 init=/linuxrc console=ttyS0,115200
bootcmd_jffs2=nand read 30008000 100000 a00000;bootm 30008000
bootcmd=run bootcmd_jffs2
系统启动后查看是否成功移植jffs2
[CJ@MINI2440 ~]:mount
rootfs on / type rootfs (rw)
/dev/root on / type jffs2 (rw,relatime)
proc on /proc type proc (rw,relatime)
tmpfs on /dev type tmpfs (rw,relatime)
ramfs on /tmp type ramfs (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/mtdblock7 on /apps type jffs2 (rw,sync,noatime)
/dev/mtdblock8 on /data type jffs2 (rw,sync,noatime)