ubuntu16安装mtd-utils工具,里面包涵mkfs.ubifs工具(版本1.5.2)
sudo apt-get install mtd-utils
制作ubifs的rootfs镜像
mkfs.ubifs -F -x lzo -m 2048 -e 126976 -c 732 -o ubifs.img -d ./rootfs_busybox
制作ubifs的标卷镜像
CONFIG_FILE=./ubinize.cfg
echo "[rootfs-volume]" > $CONFIG_FILE
echo "mode=ubi" >> $CONFIG_FILE
echo "vol_id=0" >> $CONFIG_FILE
echo "vol_size=92946432" >> $CONFIG_FILE
echo "vol_type=dynamic" >> $CONFIG_FILE
echo "vol_name=system" >> $CONFIG_FILE
echo "vol_flags=autoresize" >> $CONFIG_FILE
echo "image=ubifs.img" >> $CONFIG_FILE
ubinize -o ubifs.bin -m 2048 -p 131072 -s 2048 -O 2048 ubinize.cfg
挂载系统成功的!
[ 1.950000] UBI: attaching mtd2 to ubi0
[ 2.150000] UBI: scanning is finished
[ 2.180000] UBI: volume 0 ("system") re-sized from 732 to 824 LEBs
[ 2.190000] UBI: attached mtd2 (name "user", size 106 MiB) to ubi0
[ 2.200000] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 2.210000] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 2.210000] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 2.220000] UBI: good PEBs: 843, bad PEBs: 5, corrupted PEBs: 0
[ 2.230000] UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
[ 2.230000] UBI: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 563212451
[ 2.240000] UBI: available PEBs: 0, total reserved PEBs: 843, PEBs reserved for bad PEB handling: 15
[ 2.250000] UBI: background thread "ubi_bgt0d" started, PID 614
[ 2.370000] UBIFS: background thread "ubifs_bgt0_0" started, PID 616
[ 2.410000] UBIFS: start fixing up free space
[ 5.600000] UBIFS: free space fixup complete
[ 5.620000] UBIFS: mounted UBI device 0, volume 0, name "system"
[ 5.620000] UBIFS: LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 5.630000] UBIFS: FS size: 91549696 bytes (87 MiB, 721 LEBs), journal size 9023488 bytes (8 MiB, 72 LEBs)
[ 5.640000] UBIFS: reserved for root: 0 bytes (0 KiB)
[ 5.650000] UBIFS: media format: w4/r0 (latest is w4/r0), UUID EC7DF866-8681-4B05-9443-02A154EDD034, small LPT model
[ 5.660000] VFS: Mounted root (ubifs filesystem) on device 0:11.
[ 5.670000] devtmpfs: mounted
[ 5.670000] Freeing unused kernel memory: 164K
因为mkfs.ubifs没有添加-F参数 而出现
UBI warning: ubi_io_read: error -74 (ECCerror) while reading 126976 bytes from PEB 3:4096, read only 126976 bytes,retry
问题原因是ubifs没有自动调整卷大小
[ 1.850000] UBI: attaching mtd2 to ubi0
[ 2.150000] UBI: scanning is finished
[ 2.170000] UBI: attached mtd2 (name "user", size 106 MiB) to ubi0
[ 2.170000] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 2.180000] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 2.190000] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 2.190000] UBI: good PEBs: 843, bad PEBs: 5, corrupted PEBs: 0
[ 2.200000] UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
[ 2.210000] UBI: max/mean erase counter: 2/0, WL threshold: 4096, image sequence number: 1856874797
[ 2.220000] UBI: available PEBs: 0, total reserved PEBs: 843, PEBs reserved for bad PEB handling: 15
[ 2.230000] UBI: background thread "ubi_bgt0d" started, PID 614
[ 2.230000] nuc970-rtc nuc970-rtc: setting system clock to 2005-01-01 05:18:59 UTC (1104556739)
[ 2.290000] UBIFS: background thread "ubifs_bgt0_0" started, PID 616
[ 2.300000] UBI warning: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 3:4096, read only 126976 bytes, retry
[ 2.330000] UBI warning: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 3:4096, read only 126976 bytes, retry
[ 2.360000] UBI warning: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 3:4096, read only 126976 bytes, retry
[ 2.380000] UBI error: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 3:4096, read 126976 bytes
[ 2.390000] CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.108cb-01468-g08dbd13-dirty #19
[ 2.400000] Backtrace:
[ 2.400000] [<c0011614>] (dump_backtrace+0x0/0x104) from [<c0011820>] (show_stack+0x18/0x1c)
[ 2.410000] r6:00000003 r5:c39d8000 r4:0001f000 r3:00200140
[ 2.420000] [<c0011808>] (show_stack+0x0/0x1c) from [<c046f058>] (dump_stack+0x20/0x28)
[ 2.430000] [<c046f038>] (dump_stack+0x0/0x28) from [<c02d665c>] (ubi_io_read+0x1dc/0x2b0)
[ 2.430000] [<c02d6480>] (ubi_io_read+0x0/0x2b0) from [<c02d3f08>] (ubi_eba_read_leb+0x2d4/0x3f0)
[ 2.440000] [<c02d3c34>] (ubi_eba_read_leb+0x0/0x3f0) from [<c02d2e70>] (ubi_leb_read+0xd0/0x130)
[ 2.450000] [<c02d2da0>] (ubi_leb_read+0x0/0x130) from [<c01ea2f8>] (ubifs_leb_read+0x30/0x90)
[ 2.460000] r8:c39de000 r7:00000001 r6:00000000 r5:0001f000 r4:c3bf9ee0
[ 2.470000] [<c01ea2c8>] (ubifs_leb_read+0x0/0x90) from [<c01f1c0c>] (ubifs_start_scan+0x78/0xf4)
[ 2.480000] r7:00000001 r6:00000000 r5:c4a13000 r4:c3bf9ee0
[ 2.480000] [<c01f1b94>] (ubifs_start_scan+0x0/0xf4) from [<c01f1f38>] (ubifs_scan+0x30/0x2f8)
[ 2.490000] r8:00000001 r7:00000000 r6:0001f000 r5:00000000 r4:c4a13000
[ 2.500000] [<c01f1f08>] (ubifs_scan+0x0/0x2f8) from [<c01f0be4>] (ubifs_read_master+0x48/0xcf0)
[ 2.510000] [<c01f0b9c>] (ubifs_read_master+0x0/0xcf0) from [<c01e7b8c>] (ubifs_mount+0xa40/0x1534)
[ 2.520000] [<c01e714c>] (ubifs_mount+0x0/0x1534) from [<c00b301c>] (mount_fs+0x1c/0xcc)
[ 2.520000] [<c00b3000>] (mount_fs+0x0/0xcc) from [<c00ca494>] (vfs_kern_mount+0x50/0xcc)
[ 2.530000] r6:00008000 r5:c3bf9d80 r4:c3824e60
[ 2.540000] [<c00ca444>] (vfs_kern_mount+0x0/0xcc) from [<c00ccd78>] (do_mount+0x75c/0x854)
[ 2.550000] r8:00008000 r7:c05d2aa0 r6:00008000 r5:00000020 r4:c05ef064
r3:00000000
[ 2.550000] [<c00cc61c>] (do_mount+0x0/0x854) from [<c00ccefc>] (SyS_mount+0x8c/0xc0)
[ 2.560000] [<c00cce70>] (SyS_mount+0x0/0xc0) from [<c059b010>] (mount_block_root+0x13c/0x264)
[ 2.570000] r7:00008000 r6:c3ab9000 r5:c3ab9000 r4:c3ab9000
[ 2.580000] [<c059aed4>] (mount_block_root+0x0/0x264) from [<c059b3d4>] (prepare_namespace+0x94/0x1c4)
[ 2.580000] [<c059b340>] (prepare_namespace+0x0/0x1c4) from [<c059ac88>] (kernel_init_freeable+0x1d4/0x220)
[ 2.590000] r6:c05c37ec r5:c05bb738 r4:00000007
[ 2.600000] [<c059aab4>] (kernel_init_freeable+0x0/0x220) from [<c046ba58>] (kernel_init+0x10/0xec)
[ 2.610000] r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c046ba48
r4:00000000
[ 2.620000] [<c046ba48>] (kernel_init+0x0/0xec) from [<c000e518>] (ret_from_fork+0x14/0x3c)
[ 2.620000] r4:00000000 r3:c3842000
[ 2.640000] UBI warning: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 4:4096, read only 126976 bytes, retry
[ 2.660000] UBI warning: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 4:4096, read only 126976 bytes, retry
[ 2.690000] UBI warning: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 4:4096, read only 126976 bytes, retry
[ 2.710000] UBI error: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 4:4096, read 126976 bytes
[ 2.720000] CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.108cb-01468-g08dbd13-dirty #19
[ 2.720000] Backtrace:
[ 2.730000] [<c0011614>] (dump_backtrace+0x0/0x104) from [<c0011820>] (show_stack+0x18/0x1c)
[ 2.730000] r6:00000004[ 2.740000] usb 2-2: new low-speed USB device number 2 using nuc970-ohci
r5:c39d8000 r4:0001f000 r3:00200140
[ 2.750000] [<c0011808>] (show_stack+0x0/0x1c) from [<c046f058>] (dump_stack+0x20/0x28)
[ 2.750000] [<c046f038>] (dump_stack+0x0/0x28) from [<c02d665c>] (ubi_io_read+0x1dc/0x2b0)
[ 2.760000] [<c02d6480>] (ubi_io_read+0x0/0x2b0) from [<c02d3f08>] (ubi_eba_read_leb+0x2d4/0x3f0)
[ 2.770000] [<c02d3c34>] (ubi_eba_read_leb+0x0/0x3f0) from [<c02d2e70>] (ubi_leb_read+0xd0/0x130)
[ 2.780000] [<c02d2da0>] (ubi_leb_read+0x0/0x130) from [<c01ea2f8>] (ubifs_leb_read+0x30/0x90)
[ 2.790000] r8:c39de000 r7:00000002 r6:00000000 r5:0001f000 r4:c3bf9ee0
[ 2.800000] [<c01ea2c8>] (ubifs_leb_read+0x0/0x90) from [<c01f1c0c>] (ubifs_start_scan+0x78/0xf4)
[ 2.810000] r7:00000002 r6:00000000 r5:c4a13000 r4:c3bf9ee0
[ 2.810000] [<c01f1b94>] (ubifs_start_scan+0x0/0xf4) from [<c01f1f38>] (ubifs_scan+0x30/0x2f8)
[ 2.820000] r8:00000002 r7:00000007 r6:0001f000 r5:00000000 r4:c4a13000
[ 2.830000] [<c01f1f08>] (ubifs_scan+0x0/0x2f8) from [<c01f0c4c>] (ubifs_read_master+0xb0/0xcf0)
[ 2.840000] [<c01f0b9c>] (ubifs_read_master+0x0/0xcf0) from [<c01e7b8c>] (ubifs_mount+0xa40/0x1534)
[ 2.840000] [<c01e714c>] (ubifs_mount+0x0/0x1534) from [<c00b301c>] (mount_fs+0x1c/0xcc)
[ 2.850000] [<c00b3000>] (mount_fs+0x0/0xcc) from [<c00ca494>] (vfs_kern_mount+0x50/0xcc)
[ 2.860000] r6:00008000 r5:c3bf9d80 r4:c3824e60
[ 2.870000] [<c00ca444>] (vfs_kern_mount+0x0/0xcc) from [<c00ccd78>] (do_mount+0x75c/0x854)
[ 2.870000] r8:00008000 r7:c05d2aa0 r6:00008000 r5:00000020 r4:c05ef064
r3:00000000
[ 2.880000] [<c00cc61c>] (do_mount+0x0/0x854) from [<c00ccefc>] (SyS_mount+0x8c/0xc0)
[ 2.890000] [<c00cce70>] (SyS_mount+0x0/0xc0) from [<c059b010>] (mount_block_root+0x13c/0x264)
[ 2.900000] r7:00008000 r6:c3ab9000 r5:c3ab9000 r4:c3ab9000
[ 2.900000] [<c059aed4>] (mount_block_root+0x0/0x264) from [<c059b3d4>] (prepare_namespace+0x94/0x1c4)
[ 2.910000] [<c059b340>] (prepare_namespace+0x0/0x1c4) from [<c059ac88>] (kernel_init_freeable+0x1d4/0x220)
[ 2.920000] r6:c05c37ec r5:c05bb738 r4:00000007
[ 2.930000] [<c059aab4>] (kernel_init_freeable+0x0/0x220) from [<c046ba58>] (kernel_init+0x10/0xec)
[ 2.940000] r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c046ba48
r4:00000000
[ 2.940000] [<c046ba48>] (kernel_init+0x0/0xec) from [<c000e518>] (ret_from_fork+0x14/0x3c)
[ 2.950000] r4:00000000 r3:c3842000
[ 2.960000] UBI warning: ubi_io_read: error -74 (ECC error) while reading 88 bytes from PEB 83:28008, read only 88 bytes, retry
[ 2.970000] UBI warning: ubi_io_read: error -74 (ECC error) while reading 88 bytes from PEB 83:28008, read only 88 bytes, retry
[ 2.980000] UBI warning: ubi_io_read: error -74 (ECC error) while reading 88 bytes from PEB 83:28008, read only 88 bytes, retry
[ 2.990000] UBI error: ubi_io_read: error -74 (ECC error) while reading 88 bytes from PEB 83:28008, read 88 bytes
[ 3.000000] CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.108cb-01468-g08dbd13-dirty #19
[ 3.010000] Backtrace:
[ 3.010000] [<c0011614>] (dump_backtrace+0x0/0x104) from [<c0011820>] (show_stack+0x18/0x1c)
[ 3.020000] r6:00000053 r5:c39d8000 r4:00000058 r3:00200140[ 3.040000] input: HID 4555:1031 as /devices/platform/nuc970-ohci/usb2/2-2/2-2:1.0/input/input1
[ 3.050000] [<c0011808>] (show_stack+0x0/0x1c) from [<c046f058>] (dump_stack+0x20/0x28)
[ 3.060000] [<c046f038>] (dump_stack+0x0/0x28) from [<c02d665c>] (ubi_io_read+0x1dc/0x2b0)
[ 3.070000] hid-generic 0003:4555:1031.0001: input,hidraw0: USB HID v1.10 Keyboard [HID 4555:1031] on usb-nuc970-ohci-2/input0
[ 3.080000] [<c02d6480>] (ubi_io_read+0x0/0x2b0) from [<c02d3f08>] (ubi_eba_read_leb+0x2d4/0x3f0)
[ 3.090000] [<c02d3c34>] (ubi_eba_read_leb+0x0/0x3f0) from [<c02d2e70>] (ubi_leb_read+0xd0/0x130)
[ 3.100000] [<c02d2da0>] (ubi_leb_read+0x0/0x130) from [<c01ea2f8>] (ubifs_leb_read+0x30/0x90)
[ 3.110000] r8:00000009 r7:00000051 r6:00005d68 r5:00000058 r4:c3bf6540
[ 3.140000] [<c01ea2c8>] (ubifs_leb_read+0x0/0x90) from [<c01ebe90>] (ubifs_read_node+0x138/0x29c)
[ 3.140000] r7:00000051 r6:00005d68 r5:c39de000 r4:c3bf6540
[ 3.150000] [<c01ebd58>] (ubifs_read_node+0x0/0x29c) from [<c01f4b3c>] (dbg_old_index_check_init+0x6c/0xe0)
[ 3.160000] input: HID 4555:1031 as /devices/platform/nuc970-ohci/usb2/2-2/2-2:1.1/input/input2
[ 3.180000] [<c01f4ad0>] (dbg_old_index_check_init+0x0/0xe0) from [<c01f185c>] (ubifs_read_master+0xcc0/0xcf0)
[ 3.190000] r9:00000008 r8:c39de000 r7:00000000 r6:00000007 r5:00000000
r4:00000000
[ 3.190000] [<c01f0b9c>] (ubifs_read_master+0x0/0xcf0) from [<c01e7b8c>] (ubifs_mount+0xa40/0x1534)
[ 3.210000] [<c01e714c>] (ubifs_mount+0x0/0x1534) from [<c00b301c>] (mount_fs+0x1c/0xcc)
[ 3.210000] [<c00b3000>] (mount_fs+0x0/0xcc) from [<c00ca494>] (vfs_kern_mount+0x50/0xcc)
[ 3.220000] hid-generic 0003:4555:1031.0002: input,hidraw1: USB HID v1.10 Mouse [HID 4555:1031] on usb-nuc970-ohci-2/input1
[ 3.230000] r6:00008000 r5:c3bf9d80 r4:c3824e60
[ 3.240000] [<c00ca444>] (vfs_kern_mount+0x0/0xcc) from [<c00ccd78>] (do_mount+0x75c/0x854)
[ 3.250000] r8:00008000 r7:c05d2aa0 r6:00008000 r5:00000020 r4:c05ef064
r3:00000000
[ 3.260000] [<c00cc61c>] (do_mount+0x0/0x854) from [<c00ccefc>] (SyS_mount+0x8c/0xc0)
[ 3.260000] [<c00cce70>] (SyS_mount+0x0/0xc0) from [<c059b010>] (mount_block_root+0x13c/0x264)
[ 3.270000] r7:00008000 r6:c3ab9000 r5:c3ab9000 r4:c3ab9000
[ 3.280000] [<c059aed4>] (mount_block_root+0x0/0x264) from [<c059b3d4>] (prepare_namespace+0x94/0x1c4)
[ 3.290000] [<c059b340>] (prepare_namespace+0x0/0x1c4) from [<c059ac88>] (kernel_init_freeable+0x1d4/0x220)
[ 3.300000] r6:c05c37ec r5:c05bb738 r4:00000007
[ 3.300000] [<c059aab4>] (kernel_init_freeable+0x0/0x220) from [<c046ba58>] (kernel_init+0x10/0xec)
[ 3.310000] r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c046ba48
r4:00000000
[ 3.320000] [<c046ba48>] (kernel_init+0x0/0xec) from [<c000e518>] (ret_from_fork+0x14/0x3c)
[ 3.330000] r4:00000000 r3:c3842000
[ 3.330000] UBIFS error (pid 1): ubifs_read_node: bad node type (255 but expected 9)
[ 3.340000] UBIFS error (pid 1): ubifs_read_node: bad node at LEB 81:23912, LEB mapping status 1
[ 3.350000] Not a node, first 24 bytes:
[ 3.350000] 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........................
[ 3.360000] CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.108cb-01468-g08dbd13-dirty #19
[ 3.370000] Backtrace:
[ 3.370000] [<c0011614>] (dump_backtrace+0x0/0x104) from [<c0011820>] (show_stack+0x18/0x1c)
[ 3.380000] r6:00005d68 r5:c39de000 r4:c3bf6540 r3:00200140
[ 3.390000] [<c0011808>] (show_stack+0x0/0x1c) from [<c046f058>] (dump_stack+0x20/0x28)
[ 3.400000] [<c046f038>] (dump_stack+0x0/0x28) from [<c01ebfac>] (ubifs_read_node+0x254/0x29c)
[ 3.410000] [<c01ebd58>] (ubifs_read_node+0x0/0x29c) from [<c01f4b3c>] (dbg_old_index_check_init+0x6c/0xe0)
[ 3.420000] [<c01f4ad0>] (dbg_old_index_check_init+0x0/0xe0) from [<c01f185c>] (ubifs_read_master+0xcc0/0xcf0)
[ 3.430000] r9:00000008 r8:c39de000 r7:00000000 r6:00000007 r5:00000000
r4:00000000
[ 3.430000] [<c01f0b9c>] (ubifs_read_master+0x0/0xcf0) from [<c01e7b8c>] (ubifs_mount+0xa40/0x1534)
[ 3.440000] [<c01e714c>] (ubifs_mount+0x0/0x1534) from [<c00b301c>] (mount_fs+0x1c/0xcc)
[ 3.450000] [<c00b3000>] (mount_fs+0x0/0xcc) from [<c00ca494>] (vfs_kern_mount+0x50/0xcc)
[ 3.460000] r6:00008000 r5:c3bf9d80 r4:c3824e60
[ 3.460000] [<c00ca444>] (vfs_kern_mount+0x0/0xcc) from [<c00ccd78>] (do_mount+0x75c/0x854)
[ 3.470000] r8:00008000 r7:c05d2aa0 r6:00008000 r5:00000020 r4:c05ef064
r3:00000000
[ 3.480000] [<c00cc61c>] (do_mount+0x0/0x854) from [<c00ccefc>] (SyS_mount+0x8c/0xc0)
[ 3.490000] [<c00cce70>] (SyS_mount+0x0/0xc0) from [<c059b010>] (mount_block_root+0x13c/0x264)
[ 3.500000] r7:00008000 r6:c3ab9000 r5:c3ab9000 r4:c3ab9000
[ 3.500000] [<c059aed4>] (mount_block_root+0x0/0x264) from [<c059b3d4>] (prepare_namespace+0x94/0x1c4)
[ 3.510000] [<c059b340>] (prepare_namespace+0x0/0x1c4) from [<c059ac88>] (kernel_init_freeable+0x1d4/0x220)
[ 3.520000] r6:c05c37ec r5:c05bb738 r4:00000007
[ 3.530000] [<c059aab4>] (kernel_init_freeable+0x0/0x220) from [<c046ba58>] (kernel_init+0x10/0xec)
[ 3.530000] r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c046ba48
r4:00000000
[ 3.540000] [<c046ba48>] (kernel_init+0x0/0xec) from [<c000e518>] (ret_from_fork+0x14/0x3c)
[ 3.550000] r4:00000000 r3:c3842000
[ 3.550000] UBIFS: background thread "ubifs_bgt0_0" stops
[ 3.560000] List of all partitions:
[ 3.560000] 1f00 2048 mtdblock0 (driver?)
[ 3.570000] 1f01 20480 mtdblock1 (driver?)
[ 3.580000] 1f02 108544 mtdblock2 (driver?)
[ 3.580000] 1f03 8192 mtdblock3 (driver?)
[ 3.590000] 1f04 8192 mtdblock4 (driver?)
[ 3.590000] No filesystem could mount root, tried: ubifs
[ 3.600000] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)