参考链接:
http://www.linux-mtd.infradead.org/faq/ubifs.html
# Wipe the MTD device out. Note, we could use flash_eraseall, but we do not
# want to lose erase counters
ubiformat /dev/mtd0
# Load UBI module
modprobe ubi
# Attach mtd0 to UBI - UBI will detect that the MTD device is
# empty and automatically format it. This command will also create
# UBI device 0 and udev should create /dev/ubi0 node
ubiattach /dev/ubi_ctrl -m 0
# Create an UBI volume - the created volume will be empty
ubimkvol /dev/ubi0 -N test_volume -s 10MiB
# Mount UBIFS - it will automatically format the empty volume
mount -t ubifs ubi0:test_volume /mnt/ubifs
相关参考:
请问 buildroot 根文件系统 ubi和ubifs有什么区别呢?
http://whycan.com/t_6019.html
(出处:哇酷开发者社区)
离线
tiny200 spi nand 现场测试:
#
# ubiformat /dev/mtd4
ubiformat: mtd4 (nand), size 50331648 bytes (48.0 MiB), 384 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 383 -- 100 % complete
ubiformat: 383 eraseblocks have valid erase counter, mean value is 2
ubiformat: 1 bad eraseblocks found, numbers: 192
ubiformat: formatting eraseblock 383 -- 100 % complete
#
# ubiattach /dev/ubi_ctrl -m 4
[ 325.203966] ubi0: attaching mtd4
[ 325.867234] ubi0: scanning is finished
[ 325.905417] ubi0: attached mtd4 (name "overlay", size 48 MiB)
[ 325.911186] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 325.918219] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 325.925002] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 325.932013] ubi0: good PEBs: 383, bad PEBs: 1, corrupted PEBs: 0
[ 325.938054] ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
[ 325.945301] ubi0: max/mean erase counter: 4/3, WL threshold: 4096, image sequence number: 1368536342
[ 325.954413] ubi0: available PEBs: 360, total reserved PEBs: 23, PEBs reserved for bad PEB handling: 19
[ 325.965401] ubi0: background thread "ubi_bgt0d" started, PID 200
UBI device number 0, total 383 LEBs (48631808 bytes, 46.3 MiB), available 360 LEBs (45711360 bytes, 43.5 MiB), LEB size 126976 bytes (124.0 KiB)
#
#
#
# ubimkvol /dev/ubi0 -N test_volume -s 20MiB
Volume ID 0, size 166 LEBs (21078016 bytes, 20.1 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "test_volume", alignment 1
#
#
# mkdir -p /mnt/ubifs/; mount -t ubifs ubi0:test_volume /mnt/ubifs
[ 396.316740] UBIFS (ubi0:0): default file-system created
[ 396.323943] UBIFS (ubi0:0): Mounting in unauthenticated mode
[ 396.334069] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 206
[ 396.510137] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "test_volume"
[ 396.518175] UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 396.528174] UBIFS (ubi0:0): FS size: 19808256 bytes (18 MiB, 156 LEBs), journal size 1015809 bytes (0 MiB, 8 LEBs)
[ 396.538550] UBIFS (ubi0:0): reserved for root: 935592 bytes (913 KiB)
[ 396.544998] UBIFS (ubi0:0): media format: w5/r0 (latest is w5/r0), UUID DDF61ED8-29D8-41D3-B75C-D06A4B5B5FC8, small LPT model
[ 396.560487] UBIFS (ubi0:0): full atime support is enabled.
#
# cd /mnt/ubifs/
#
# dd if=/dev/urandom of=test1.bin bs=15M count=1
1+0 records in
1+0 records out
#
# ls -l
total 15360
-rw-r--r-- 1 root root 15728640 Jan 1 00:07 test1.bin
#
# md5sum test1.bin
30303d04108632117aa0f3a656dadb14 test1.bin
# md5sum test1.bin
30303d04108632117aa0f3a656dadb14 test1.bin
#
离线
重启之后15M随机数文件test1.bin md5码依然是正确的!
#ubiattach /dev/ubi_ctrl -m 4
[ 42.202019] ubi0: attaching mtd4
[ 42.875260] ubi0: scanning is finished
[ 42.920832] ubi0: attached mtd4 (name "overlay", size 48 MiB)
[ 42.926746] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 42.933618] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 42.940486] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 42.947485] ubi0: good PEBs: 383, bad PEBs: 1, corrupted PEBs: 0
[ 42.953485] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[ 42.960736] ubi0: max/mean erase counter: 5/3, WL threshold: 4096, image sequence number: 1368536342
[ 42.969884] ubi0: available PEBs: 194, total reserved PEBs: 189, PEBs reserved for bad PEB handling: 19
[ 42.981773] ubi0: background thread "ubi_bgt0d" started, PID 194
UBI device number 0, total 383 LEBs (48631808 bytes, 46.3 MiB), available 194 LEBs (24633344 bytes, 23.4 MiB), LEB size 126976 bytes (124.0 KiB)
#
#
#
#
# mkdir -p /mnt/ubifs/; mount -t ubifs ubi0:test_volume /mnt/ubifs
[ 73.033794] UBIFS (ubi0:0): Mounting in unauthenticated mode
[ 73.050609] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 199
[ 73.285632] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "test_volume"
[ 73.293482] UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 73.303552] UBIFS (ubi0:0): FS size: 19808256 bytes (18 MiB, 156 LEBs), journal size 1015809 bytes (0 MiB, 8 LEBs)
[ 73.313941] UBIFS (ubi0:0): reserved for root: 935592 bytes (913 KiB)
[ 73.320457] UBIFS (ubi0:0): media format: w5/r0 (latest is w5/r0), UUID DDF61ED8-29D8-41D3-B75C-D06A4B5B5FC8, small LPT model
[ 73.338918] UBIFS (ubi0:0): full atime support is enabled.
#
#
# cd /mnt/ubifs/
#
# md5sum test1.bin
30303d04108632117aa0f3a656dadb14 test1.bin
#
# md5sum test1.bin
30303d04108632117aa0f3a656dadb14 test1.bin
#
#
说明:测试OK!
离线
&spi0 {
status = "okay";
spi-nand@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "spi-nand";
reg = <0>;
spi-max-frequency = <50000000>;
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x80000>;
read-only;
};
partition@1 {
label = "dtb";
reg = <0x80000 0x20000>;
read-only;
};
partition@2 {
label = "kernel";
reg = <0x100000 0x700000>;
read-only;
};
partition@3 {
label = "rom";
reg = <0x800000 0x4000000>;
read-only;
};
partition@4 {
label = "overlay";
reg = <0x4800000 0x3000000>;
};
};
};
};
spi nand分区是 aodzip 大佬默认的配置.
[ 0.879898] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pc not found, using dummy regulator
[ 0.892723] spi-nand spi0.0: GigaDevice SPI NAND was found.
[ 0.898426] spi-nand spi0.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
[ 0.908036] 5 fixed-partitions partitions found on MTD device spi0.0
[ 0.914397] Creating 5 MTD partitions on "spi0.0":
[ 0.919311] 0x000000000000-0x000000080000 : "u-boot"
[ 0.929945] 0x000000080000-0x0000000a0000 : "dtb"
[ 0.938921] 0x000000100000-0x000000800000 : "kernel"
[ 0.947089] random: fast init done
[ 0.977131] 0x000000800000-0x000004800000 : "rom"
[ 1.222006] 0x000004800000-0x000007800000 : "overlay"
[ 1.407977] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
这是开机log
# cat /proc/mtd
dev: size erasesize name
mtd0: 00080000 00020000 "u-boot"
mtd1: 00020000 00020000 "dtb"
mtd2: 00700000 00020000 "kernel"
mtd3: 04000000 00020000 "rom"
mtd4: 03000000 00020000 "overlay"
这是分区信息。
离线
继续创建一个 test_volume2 卷,写入10M test2.bin 文件, 重启检查md5校验码:
# cat /proc/mtd
dev: size erasesize name
mtd0: 00080000 00020000 "u-boot"
mtd1: 00020000 00020000 "dtb"
mtd2: 00700000 00020000 "kernel"
mtd3: 04000000 00020000 "rom"
mtd4: 03000000 00020000 "overlay"
#
#
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 114901 92103 14197 87% /
devtmpfs 18852 0 18852 0% /dev
tmpfs 27556 0 27556 0% /dev/shm
tmpfs 27556 32 27524 0% /tmp
tmpfs 27556 68 27488 0% /run
ubi0:test_volume 17200 14936 1352 92% /mnt/ubifs
#
#
#
# ubimkvol /dev/ubi0 -N test_volume2 -s 15MiB
Volume ID 1, size 124 LEBs (15745024 bytes, 15.0 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "test_volume2", alignment 1
#
#
#
# mkdir -p /mnt/ubifs2/; mount -t ubifs ubi0:test_volume2 /mnt/ubifs2
[ 1491.419679] UBIFS (ubi0:1): default file-system created
[ 1491.428380] UBIFS (ubi0:1): Mounting in unauthenticated mode
[ 1491.439012] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 214
[ 1491.614619] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "test_volume2"
[ 1491.622701] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 1491.632704] UBIFS (ubi0:1): FS size: 14475264 bytes (13 MiB, 114 LEBs), journal size 1015809 bytes (0 MiB, 6 LEBs)
[ 1491.643085] UBIFS (ubi0:1): reserved for root: 683702 bytes (667 KiB)
[ 1491.649575] UBIFS (ubi0:1): media format: w5/r0 (latest is w5/r0), UUID 90D01E93-DCFB-4015-916E-426926CA867C, small LPT model
[ 1491.665149] UBIFS (ubi0:1): full atime support is enabled.
#
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 114901 92104 14196 87% /
devtmpfs 18852 0 18852 0% /dev
tmpfs 27556 0 27556 0% /dev/shm
tmpfs 27556 32 27524 0% /tmp
tmpfs 27556 68 27488 0% /run
ubi0:test_volume 17200 14936 1352 92% /mnt/ubifs
ubi0:test_volume2 12384 20 11696 0% /mnt/ubifs2
#
#
# cd /mnt/ubifs2; dd if=/dev/urandom of=test2.bin bs=10M count=1
1+0 records in
1+0 records out
#
# md5sum test2.bin
a7a11444e92abb24b92da2d459142ef7 test2.bin
#
# md5sum test2.bin
a7a11444e92abb24b92da2d459142ef7 test2.bin
#
执行命令:
ubiattach /dev/ubi_ctrl -m 4
mkdir -p /mnt/ubifs/; mount -t ubifs ubi0:test_volume /mnt/ubifs
mkdir -p /mnt/ubifs2/; mount -t ubifs ubi0:test_volume2 /mnt/ubifs2
md5sum /mnt/ubifs/test1.bin
md5sum /mnt/ubifs2/test2.bin
运行结果:
# ubiattach /dev/ubi_ctrl -m 4
m[ 117.787394] ubi0: attaching mtd4
kdir -p /mnt/ubifs/; mount -t ubifs ubi0:test_volume [ 118.474268] ubi0: scanning is finished
/mnt/[ 118.518382] ubi0: attached mtd4 (name "overlay", size 48 MiB)
[ 118.524234] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 118.531237] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 118.538097] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 118.545064] ubi0: good PEBs: 383, bad PEBs: 1, corrupted PEBs: 0
[ 118.551153] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
[ 118.558415] ubi0: max/mean erase counter: 5/3, WL threshold: 4096, image sequence number: 1368536342
[ 118.567585] ubi0: available PEBs: 70, total reserved PEBs: 313, PEBs reserved for bad PEB handling: 19
ubifs
mk[ 118.579706] ubi0: background thread "ubi_bgt0d" started, PID 196
dir -UBI device number 0, total 383 LEBs (48631808 bytes, 46.3 MiB), available 70 LEBs (8888320 bytes, 8.4 MiB), LEB size 126976 bytes (124.0 KiB)
# mkdir -p /mnt/ubifs/; mount -t ubifs ubi0:test_volume /mnt/ubifs
p /[ 118.664103] UBIFS (ubi0:0): Mounting in unauthenticated mode
[ 118.673953] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 200
mnt/ubifs2/; mount -[ 118.908290] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "test_volume"
[ 118.916285] UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 118.926338] UBIFS (ubi0:0): FS size: 19808256 bytes (18 MiB, 156 LEBs), journal size 1015809 bytes (0 MiB, 8 LEBs)
[ 118.936716] UBIFS (ubi0:0): reserved for root: 935592 bytes (913 KiB)
[ 118.943184] UBIFS (ubi0:0): media format: w5/r0 (latest is w5/r0), UUID DDF61ED8-29D8-41D3-B75C-D06A4B5B5FC8, small LPT model
t ubifs[ 118.961970] UBIFS (ubi0:0): full atime support is enabled.
# mkdir -p /mnt/ubifs2/; mount -t ubifs ubi0:test_volume2 /mnt/ubifs2
md5[ 119.401852] UBIFS (ubi0:1): Mounting in unauthenticated mode
su[ 119.412234] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 203
m /mnt/ubifs/test1.bin
m[ 119.644532] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "test_volume2"
[ 119.652611] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 119.662659] UBIFS (ubi0:1): FS size: 14475264 bytes (13 MiB, 114 LEBs), journal size 1015809 bytes (0 MiB, 6 LEBs)
[ 119.673054] UBIFS (ubi0:1): reserved for root: 683702 bytes (667 KiB)
[ 119.679560] UBIFS (ubi0:1): media format: w5/r0 (latest is w5/r0), UUID 90D01E93-DCFB-4015-916E-426926CA867C, small LPT model
d5sum /m[ 119.698437] UBIFS (ubi0:1): full atime support is enabled.
n#
# md5sum /mnt/ubifs/test1.bin
/ubifs2/test2.bin
30303d04108632117aa0f3a656dadb14 /mnt/ubifs/test1.bin
# md5sum /mnt/ubifs2/test2.bin
a7a11444e92abb24b92da2d459142ef7 /mnt/ubifs2/test2.bin
#
#
#
# md5sum /mnt/ubifs/test1.bin
30303d04108632117aa0f3a656dadb14 /mnt/ubifs/test1.bin
#
# md5sum /mnt/ubifs2/test2.bin
a7a11444e92abb24b92da2d459142ef7 /mnt/ubifs2/test2.bin
#
两个卷的随机数大文件校验码仍然正常。
离线
占坑
离线
占坑
离线
占坑
离线
Cool
离线
buildroot关于ubi文件系统的配置:
BR2_TARGET_ROOTFS_TAR=y
BR2_TARGET_ROOTFS_TAR_NONE=y
BR2_TARGET_ROOTFS_TAR_OPTIONS=""
BR2_TARGET_ROOTFS_UBI=y
BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x20000
BR2_TARGET_ROOTFS_UBI_SUBSIZE=2048
BR2_TARGET_ROOTFS_UBI_OPTS=""
BR2_TARGET_ROOTFS_UBIFS=y
BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x1f000
BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x800
BR2_TARGET_ROOTFS_UBIFS_MAXLEBCNT=2048
BR2_TARGET_ROOTFS_UBIFS_RT_LZO=y
BR2_TARGET_ROOTFS_UBIFS_NONE=y
BR2_TARGET_ROOTFS_UBIFS_OPTS=""
把buildroot生成的rootfs.ubi烧录到 nand flash:
# flash_eraseall /dev/mtd3
Erasing 128 Kibyte @ 33a0000 - 46% complete.
Skipping bad block at 0x033c0000
Erasing 128 Kibyte @ 57e0000 - 78% complete.
Skipping bad block at 0x05800000
Erasing 128 Kibyte @ 7000000 - 100% complete.
#
# ubiformat /dev/mtd3 -f /mnt/udisk/rootfs.ubi -s 2048 -O 2048
ubiformat: mtd3 (nand), size 117440512 bytes (112.0 MiB), 896 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 895 -- 100 % complete
ubiformat: 894 eraseblocks are supposedly empty
ubiformat: 2 bad eraseblocks found, numbers: 414, 704
ubiformat: flashing eraseblock 422 -- 100 % complete
ubiformat: formatting eraseblock 895 -- 100 % complete
#
# ubiattach /dev/ubi_ctrl -m 3
[ 2338.369507] ubi0: attaching mtd3
[ 2339.932799] ubi0: scanning is finished
[ 2339.996910] ubi0: volume 0 ("rootfs") re-sized from 420 to 872 LEBs
[ 2340.021735] ubi0: attached mtd3 (name "rootfs", size 112 MiB)
[ 2340.027648] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 2340.034519] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 2340.041381] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 2340.048382] ubi0: good PEBs: 894, bad PEBs: 2, corrupted PEBs: 0
[ 2340.054382] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[ 2340.061631] ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 1797218344
[ 2340.070778] ubi0: available PEBs: 0, total reserved PEBs: 894, PEBs reserved for bad PEB handling: 18
[ 2340.082502] ubi0: background thread "ubi_bgt0d" started, PID 242
UBI device number 0, total 894 LEBs (113516544 bytes, 108.2 MiB), available 0 LEBs (0 bytes), LEB size 126976 bytes (124.0 KiB)
#
#
# mkdir -p /mnt/rootfs/; mount -t ubifs ubi0:rootfs /mnt/rootfs
[ 2424.798470] UBIFS (ubi0:0): Mounting in unauthenticated mode
[ 2424.815509] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 247
[ 2425.061164] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[ 2425.068703] UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 2425.078691] UBIFS (ubi0:0): FS size: 109326336 bytes (104 MiB, 861 LEBs), journal size 9023488 bytes (8 MiB, 72 LEBs)
[ 2425.089322] UBIFS (ubi0:0): reserved for root: 0 bytes (0 KiB)
[ 2425.095205] UBIFS (ubi0:0): media format: w4/r0 (latest is w5/r0), UUID C2613C70-55A8-4922-BAD7-FC87B64728E0, small LPT model
[ 2425.122645] UBIFS (ubi0:0): full atime support is enabled.
#
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 114901 92109 14191 87% /
devtmpfs 18852 0 18852 0% /dev
tmpfs 27556 0 27556 0% /dev/shm
tmpfs 27556 356 27200 1% /tmp
tmpfs 27556 88 27468 0% /run
/dev/sda 1920768 54048 1866720 3% /mnt/udisk
ubi0:rootfs 98056 47932 50124 49% /mnt/rootfs
#
# ls /mnt/rootfs/
bin/ lib/ media/ overlay/ root/ sys/ var/
dev/ lib32/ mnt/ proc/ run/ tmp/
etc/ linuxrc opt/ rom/ sbin/ usr/
#
# md5sum /mnt/rootfs/bin/busybox
cdb44d81c489bc9d4f82e4a27253433f /mnt/rootfs/bin/busybox
#
至此, 我们用ubifs 作为根文件系统的任务已经完成一大半了。
离线
使用aodzip的sd卡镜像启动,敲回车进入uboot命令行, 手动输入下面三行命令可以从sd卡引脚:
setenv bootargs "console=ttyS0,115200 earlyprintk rootwait consoleblank=0 net.ifnames=0 biosdevname=0 root=/dev/mmcblk0p3"
setenv bootcmd "load mmc 0:2 0x80000000 zImage; load mmc 0:2 0x80700000 devicetree.dtb;bootz 0x80000000 - 0x80700000;"
boot
手动输入这几行命令, 也可以sd卡引导,但是根文件系统已经是ubifs了:
sf probe 1000000
sf probe 10000000
setenv bootargs "console=ttyS0,115200 earlyprintk rootwait consoleblank=0 net.ifnames=0 biosdevname=0 root=ubi0:rootfs rw rootflags=sync rootfstype=ubifs ubi.mtd=3"
setenv bootcmd "load mmc 0:2 0x80000000 zImage; load mmc 0:2 0x80700000 devicetree.dtb;bootz 0x80000000 - 0x80700000;"
boot
这是启动log:
U-Boot SPL 2020.07 (Feb 19 2021 - 12:13:05 +0800)
DRAM: 64 MiB
Trying to boot from MMC1
U-Boot 2020.07 (Feb 19 2021 - 12:13:05 +0800) Allwinner Technology
CPU: Allwinner F Series (SUNIV)
Model: Allwinner F1C100s Generic Device
DRAM: 64 MiB
MMC: mmc@1c0f000: 0, mmc@1c10000: 1
Setting up a 800x480 lcd console (overscan 0x0)
In: serial
Out: vga
Err: vga
Allwinner mUSB OTG (Peripheral)
Hit any key to stop autoboot: 0
=>
=>
=> sf probe
unrecognized JEDEC id bytes: ff, c8, f1
Failed to initialize SPI flash at 0:0 (error -2)
=> sf probe 1000000
unrecognized JEDEC id bytes: 00, c8, f1
Failed to initialize SPI flash at 0:1000000 (error -2)
=> sf probe 10000000
unrecognized JEDEC id bytes: 00, c8, f1
Failed to initialize SPI flash at 0:10000000 (error -2)
=> setenv bootargs "console=ttyS0,115200 earlyprintk rootwait consoleblank=0 net.ifnames=0 biosdevname=0 root=ubi0:rootfs rw rootflags=sync rootfstype=ubifs ubi.mtd=3"
=> setenv bootcmd "load mmc 0:2 0x80000000 zImage; load mmc 0:2 0x80700000 devicetree.dtb;bootz 0x80000000 - 0x80700000;"
=> boot
4613080 bytes read in 750 ms (5.9 MiB/s)
14901 bytes read in 7 ms (2 MiB/s)
## Flattened Device Tree blob at 80700000
Booting using the fdt blob at 0x80700000
Loading Device Tree to 816f9000, end 816ffa34 ... OK
Cannot setup simplefb: node not found
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.4.66 (cube@ubuntu) (gcc version 8.4.0 (Buildroot 2020.02.4-00005-g9d84975a2d)) #2 Fri Feb 19 14:15:21 CST 2021
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] OF: fdt: Machine model: Widora MangoPi R3
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] cma: Reserved 16 MiB at 0x83000000
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: console=ttyS0,115200 earlyprintk rootwait consoleblank=0 net.ifnames=0 biosdevname=0 root=ubi0:rootfs rw rootflags=sync rootfstype=ubifs ubi.mtd=3
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 37708K/65536K available (7168K kernel code, 253K rwdata, 1752K rodata, 1024K init, 228K bss, 11444K reserved, 16384K cma-reserved)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] random: get_random_bytes called from start_kernel+0x254/0x444 with crng_init=0
[ 0.000051] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000146] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000897] Console: colour dummy device 80x30
[ 0.001006] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[ 0.070269] pid_max: default: 32768 minimum: 301
[ 0.070774] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.070816] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.072732] CPU: Testing write buffer coherency: ok
[ 0.074840] Setting up static identity map for 0x80100000 - 0x80100058
[ 0.076158] devtmpfs: initialized
[ 0.087670] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.087741] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[ 0.091985] pinctrl core: initialized pinctrl subsystem
[ 0.094714] NET: Registered protocol family 16
[ 0.098625] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.100968] cpuidle: using governor menu
[ 0.149556] SCSI subsystem initialized
[ 0.149974] usbcore: registered new interface driver usbfs
[ 0.150151] usbcore: registered new interface driver hub
[ 0.150482] usbcore: registered new device driver usb
[ 0.151020] mc: Linux media interface: v0.10
[ 0.151148] videodev: Linux video capture interface: v2.00
[ 0.151274] pps_core: LinuxPPS API ver. 1 registered
[ 0.151294] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.151361] PTP clock support registered
[ 0.152448] ion_parse_dt_heap_common: id 4 type 4 name cma align 1000
[ 0.153474] Advanced Linux Sound Architecture Driver Initialized.
[ 0.156033] clocksource: Switched to clocksource timer
[ 0.187887] thermal_sys: Registered thermal governor 'step_wise'
[ 0.188647] NET: Registered protocol family 2
[ 0.190251] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.190356] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.190417] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.190472] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.190797] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 0.190861] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 0.191377] NET: Registered protocol family 1
[ 0.194196] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.196142] Initialise system trusted keyrings
[ 0.196785] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[ 0.218403] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.219017] jffs2: version 2.2. (NAND) (SUMMARY) ? 2001-2006 Red Hat, Inc.
[ 0.333754] Key type asymmetric registered
[ 0.333797] Asymmetric key parser 'x509' registered
[ 0.333976] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[ 0.334006] io scheduler mq-deadline registered
[ 0.334024] io scheduler kyber registered
[ 0.349792] suniv-f1c100s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.374405] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.380689] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pa not found, using dummy regulator
[ 0.382050] printk: console [ttyS0] disabled
[ 0.402366] 1c25400.serial: ttyS0 at MMIO 0x1c25400 (irq = 28, base_baud = 6250000) is a 16550A
[ 0.836213] printk: console [ttyS0] enabled
[ 0.846141] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pd not found, using dummy regulator
[ 0.867399] panel-simple panel: panel supply power not found, using dummy regulator
[ 0.877103] SCSI Media Changer driver v0.25
[ 0.882889] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pc not found, using dummy regulator
[ 0.895727] spi-nand spi0.0: GigaDevice SPI NAND was found.
[ 0.901430] spi-nand spi0.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
[ 0.911035] 4 fixed-partitions partitions found on MTD device spi0.0
[ 0.917508] Creating 4 MTD partitions on "spi0.0":
[ 0.922319] 0x000000000000-0x000000080000 : "u-boot"
[ 0.932832] 0x000000080000-0x0000000a0000 : "dtb"
[ 0.941783] 0x000000100000-0x000000800000 : "kernel"
[ 0.950003] random: fast init done
[ 0.980009] 0x000000800000-0x000007800000 : "rootfs"
[ 1.402173] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.408827] ehci-platform: EHCI generic platform driver
[ 1.414476] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.420788] ohci-platform: OHCI generic platform driver
[ 1.426594] usbcore: registered new interface driver usb-storage
[ 1.433571] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ 1.445500] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ 1.451503] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[ 1.461545] hub 1-0:1.0: USB hub found
[ 1.465450] hub 1-0:1.0: 1 port detected
[ 1.472619] i2c /dev entries driver
[ 1.476904] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pd not found, using dummy regulator
[ 1.490501] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pe not found, using dummy regulator
[ 1.501522] sun4i-csi 1cb0000.csi: Packed (RAW) format enabled.
[ 1.509439] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[ 1.519519] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pf not found, using dummy regulator
[ 1.557652] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[ 1.567195] usbcore: registered new interface driver usbhid
[ 1.572769] usbhid: USB HID core driver
[ 1.577049] sunxi-cedar 1c0e000.video-codec: sunxi cedar version 0.01alpha
[ 1.584253] sunxi-cedar 1c0e000.video-codec: cedar-ve the get irq is 20
[ 1.596530] debugfs: Directory '1c23c00.codec' with parent 'F1C100s Audio Codec' already present!
[ 1.610346] sun4i-codec 1c23c00.codec: Codec <-> 1c23c00.codec mapping ok
[ 1.626408] NET: Registered protocol family 17
[ 1.630974] Key type dns_resolver registered
[ 1.636695] Loading compiled-in X.509 certificates
[ 1.660968] sun4i-drm soc:display-engine: bound 1e00000.display-frontend (ops 0xc083d0a0)
[ 1.670060] sun4i-drm soc:display-engine: bound 1e60000.display-backend (ops 0xc083c8e0)
[ 1.679651] sun4i-drm soc:display-engine: bound 1c0c000.lcd-controller (ops 0xc083b480)
[ 1.688224] sun4i-drm soc:display-engine: bound 1c0a000.tv-encoder (ops 0xc083c1a0)
[ 1.695886] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 1.702599] [drm] No driver support for vblank timestamp query.
[ 1.710256] [drm] Initialized sun4i-drm 1.0.0 20150629 for soc:display-engine on minor 0
[ 1.719318] [drm] kms: can't enable cloning when we probably wanted to.
[ 1.791243] Console: switching to colour frame buffer device 100x30
[ 1.793879] mmc0: host does not support reading read-only switch, assuming write-enable
[ 1.796674] mmc0: new high speed SD card at address 0001
[ 1.798984] mmcblk0: mmc0:0001 00000 1.83 GiB
[ 1.830776] mmcblk0: p1 p2 p3
[ 1.855478] sun4i-drm soc:display-engine: fb0: sun4i-drmdrmfb frame buffer device
[ 1.864055] ubi0: attaching mtd3
[ 1.878025] random: crng init done
[ 3.423082] ubi0: scanning is finished
[ 3.453782] ubi0: attached mtd3 (name "rootfs", size 112 MiB)
[ 3.459706] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 3.466645] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 3.473421] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 3.480441] ubi0: good PEBs: 894, bad PEBs: 2, corrupted PEBs: 0
[ 3.486491] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[ 3.493730] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1797218344
[ 3.502884] ubi0: available PEBs: 0, total reserved PEBs: 894, PEBs reserved for bad PEB handling: 18
[ 3.512774] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 3.521005] ubi0: background thread "ubi_bgt0d" started, PID 60
[ 3.536715] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 3.543541] ALSA device list:
[ 3.546645] #0: F1C100s Audio Codec
[ 3.550867] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 3.559634] cfg80211: failed to load regulatory.db
[ 3.566817] UBIFS: parse sync
[ 3.572891] UBIFS (ubi0:0): Mounting in unauthenticated mode
[ 3.582724] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 65
[ 3.851755] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[ 3.859311] UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 3.869328] UBIFS (ubi0:0): FS size: 109326336 bytes (104 MiB, 861 LEBs), journal size 9023488 bytes (8 MiB, 72 LEBs)
[ 3.879963] UBIFS (ubi0:0): reserved for root: 0 bytes (0 KiB)
[ 3.885832] UBIFS (ubi0:0): media format: w4/r0 (latest is w5/r0), UUID C2613C70-55A8-4922-BAD7-FC87B64728E0, small LPT model
[ 3.903107] UBIFS (ubi0:0): full atime support is enabled.
[ 3.908873] VFS: Mounted root (ubifs filesystem) on device 0:16.
[ 3.918242] devtmpfs: mounted
[ 3.927799] Freeing unused kernel memory: 1024K
[ 3.932838] Run /sbin/init as init process
Mounting OverlayFS: Skip
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Populating /dev using udev: [ 5.675841] udevd[97]: starting version 3.2.9
[ 5.967378] udevd[98]: starting eudev-3.2.9
[ 8.152908] Goodix-TS 0-005d: 0-005d supply AVDD28 not found, using dummy regulator
[ 8.161063] Goodix-TS 0-005d: 0-005d supply VDDIO not found, using dummy regulator
[ 8.178104] ov2640 0-0030: Product ID error fa:fa
[ 8.329337] Goodix-TS 0-005d: i2c test failed attempt 1: -6
[ 8.369858] Goodix-TS 0-005d: i2c test failed attempt 2: -6
[ 8.406275] Goodix-TS 0-005d: I2C communication failure: -6
#
#
#
# df
Filesystem 1K-blocks Used Available Use% Mounted on
ubi0:rootfs 98056 47964 50092 49% /
devtmpfs 18852 0 18852 0% /dev
tmpfs 27556 0 27556 0% /dev/shm
tmpfs 27556 32 27524 0% /tmp
tmpfs 27556 76 27480 0% /run
#
# md5sum /bin/busybox
cdb44d81c489bc9d4f82e4a27253433f /bin/busybox
#
#
从日志看,ubifs根文件系统已经完全正常:
[ 3.559634] cfg80211: failed to load regulatory.db
[ 3.566817] UBIFS: parse sync
[ 3.572891] UBIFS (ubi0:0): Mounting in unauthenticated mode
[ 3.582724] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 65
[ 3.851755] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[ 3.859311] UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 3.869328] UBIFS (ubi0:0): FS size: 109326336 bytes (104 MiB, 861 LEBs), journal size 9023488 bytes (8 MiB, 72 LEBs)
[ 3.879963] UBIFS (ubi0:0): reserved for root: 0 bytes (0 KiB)
[ 3.885832] UBIFS (ubi0:0): media format: w4/r0 (latest is w5/r0), UUID C2613C70-55A8-4922-BAD7-FC87B64728E0, small LPT model
[ 3.903107] UBIFS (ubi0:0): full atime support is enabled.
[ 3.908873] VFS: Mounted root (ubifs filesystem) on device 0:16.
#
# df
Filesystem 1K-blocks Used Available Use% Mounted on
ubi0:rootfs 98056 47964 50092 49% /
#
离线