参考: https://www.kancloud.cn/lichee/lpi0/331844
首先选择rootfs文件系统,我是用的是群朋提供的最小根文件系统rootfs-brmin.tar.gz,大小只有3M左右,下载地址在
https://pan.baidu.com/share/link?
shareid=1432204556&uk=3658413294#list/path=%2F
Lichee Zero>zero_imager.zip
Flash支持jffs2文件系统格式,所以需要使用此该rootfs制作jffs2文件系统镜像、
下载jffs2文件系统制作工具
apt-get install mtd-utils
解压 rootfs-brmin.tar.gz
tar xzvf rootfs-brmin.tar.gz
总空间是16M-1M-64K-4M=0xAF0000
mkfs.jffs2 -s 0x100 -e 0x10000 -p 0xAF0000 -d rootfs/ -o jffs2.img
页大小0x100 256字节
块大小0x10000 64k
jffs2分区总空间0xAF0000
jffs2.img是生成的文件系统镜像。
最后将uboot,dtb,kernel,rootfs打包成一个系统镜像,命令如下;
dd if=/dev/zero of=flashimg.bin bs=16M count=1
dd if=../ubootmainline/u-boot/u-boot-sunxi-with-spl.bin of=flashimg.bin bs=1K conv=notrunc
dd if=../zero41y/linux-zero-4.10.y/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dtb of=flashimg.bin bs=1K seek=1024 conv=notrunc
dd if=../zero41y/linux-zero-4.10.y/arch/arm/boot/zImage of=flashimg.bin bs=1K seek=1088 conv=notrunc
dd if=../zero_imager/jffs2/jffs2.img of=flashimg.bin bs=1K seek=5184 conv=notrunc
第一步:生成一个空文件,大小是16MB
第二步:将uboot添加到文件开头
第三步:将dtb放到1M偏移处
第四步:将kernel放到1M+64K偏移处
第五步:将rootfs放到1M+64K+4M偏移处
偏移大小是seek,单位是KB。
执行完毕后生成镜像文件flashimg.bin
我是这么做的:
mkfs.jffs2 -s 0x100 -e 0x1000 -p 0x18F0000 -d /opt/nuc970bsp/rootfs_groups/rootfs_uclibc/ -o jffs2.img
mkfs.jffs2 -s 0x100 -e 0x4000 -p 0x18F0000 -d /opt/nuc970bsp/rootfs_groups/rootfs_uclibc/ -o jffs2.img
mkfs.jffs2 -s 0x100 -e 0x10000 -p 0x18F0000 -d /opt/nuc970bsp/rootfs_groups/rootfs_uclibc/ -o jffs2.img
无论用哪个制作方法, 加载文件系统:
mkdir /tmp/ccc -p
mount -t jffs2 /dev/mtdblock3 /tmp/ccc
cd /tmp/ccc
都会出错:
[ 948.023291] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0018e024: 0x6661 instead
[ 948.032766] jffs2: Further such events for this erase block will not be printed
[ 948.040709] jffs2: Node at 0x0018efec with length 0x00000036 would run over the end of the erase block
[ 948.050039] jffs2: Perhaps the file system was created with the wrong erase size?
[ 948.057736] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0018f000: 0x00c3 instead
[ 948.067264] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0018f004: 0x031f instead
[ 948.076776] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0018f008: 0x0a0e instead
[ 948.087317] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0018f00c: 0x6041 instead
[ 948.098857] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0018f010: 0xff4f instead
[ 948.108354] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0018f014: 0x6c66 instead
[ 948.117846] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0018f018: 0x5f68 instead
[ 948.127340] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0018f01c: 0x7361 instead
[ 948.136832] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0018f020: 0x6c6c instead
[ 948.148001] jffs2: Node at 0x00190f50 with length 0x000000e2 would run over the end of the erase block
[ 948.157349] jffs2: Perhaps the file system was created with the wrong erase size?
[ 948.164842] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00190f54: 0x00e2 instead
[ 948.174348] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00190f58: 0xbdc4 instead
[ 948.183888] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00190f5c: 0x00bf instead
[ 948.194412] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00190f60: 0x003d instead
[ 948.203895] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00190f64: 0x81ed instead
[ 948.213373] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00190f68: 0x03e8 instead
[ 948.222849] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00190f6c: 0x3e54 instead
[ 948.232324] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00190f70: 0x9510 instead
[ 948.241800] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00190f74: 0x9510 instead
[ 948.251275] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00190f78: 0x9510 instead
[ 948.260747] jffs2: Further such events for this erase block will not be printed
[ 948.268271] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00191000: 0xac89 instead
[ 948.277771] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00191004: 0x42cf instead
[ 948.287251] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00191008: 0x51c1 instead
[ 948.296728] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0019100c: 0x6246 instead
[ 948.306192] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00191010: 0x2652 instead
[ 948.315668] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00191014: 0x9032 instead
[ 948.325168] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00191018: 0xe418 instead
[ 948.334675] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0019101c: 0x4010 instead
[ 948.344155] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00191020: 0x5eae instead
[ 948.353632] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00191024: 0x6c0c instead
[ 948.363105] jffs2: Further such events for this erase block will not be printed
[ 949.023851] jffs2: fork failed for JFFS2 garbage collect thread: 4
离线
这个问题我弄了很久都没搞定 W25Q256, MX25L256的JFFS2根文件系统问题,
mkfs.jffs2用了各种参数生成的文件系统镜像都不能在那两个芯片下面挂起来,
后来通过一个非常曲折的方法搞定这个问题。
离线
我的直接,无法启动内核!怎么搞,请指点!
linux-zero-4.13.y
离线