This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

求助,DM8168 Nand Flash运行ubi文件系统出错



我是在DVRRDK4.1下通过命令make ubifs_128生成的ubi文件系统镜像,开发板上用的是现代的SLC Nand Flash,型号H27U4G8_6F2D容量512Mx8bit我将uboot、kernel、ubifs烧到Flash中运行,现在遇到的情况是,在启动时内核挂载文件系统会打印出很多错误信息,比如一下这些

UBI: run torture test for PEB 1572
UBI error: torture_peb: read problems on freshly erased PEB 1572, must be bad
UBI error: erase_worker: failed to erase PEB 1572, error -5
UBI: mark PEB 1572 as bad
UBI: 14 PEBs left in the reserve
UBI: run torture test for PEB 2045
UBI error: torture_peb: read problems on freshly erased PEB 2045, must be bad
UBI error: erase_worker: failed to erase PEB 2045, error -5
UBI: mark PEB 2045 as bad
UBI: 13 PEBs left in the reserve
udev[114]: starting version 164
UBI: run torture test for PEB 1797
UBI error: torture_peb: read problems on freshly erased PEB 1797, must be bad
UBI error: erase_worker: failed to erase PEB 1797, error -5
UBI: mark PEB 1797 as bad
UBI: 12 PEBs left in the reserve
UBI: run torture test for PEB 1729
UBI error: torture_peb: read problems on freshly erased PEB 1729, must be bad
UBI error: erase_worker: failed to erase PEB 1729, error -5
UBI: mark PEB 1729 as bad
UBI: 11 PEBs left in the reserve
Starting Bootlog daemon: UBI: run torture test for PEB 1712
UBI error: torture_peb: read problems on freshly erased PEB 1712, must be bad
UBI error: erase_worker: failed to erase PEB 1712, error -5
UBI: mark PEB 1712 as bad
UBI: 10 PEBs left in the reserve

都是同类错误,烧写后初次启动数量比较多,之后再次启动进系统是会少一些,这个估计是在做ubifs时加了-F选项初次启动会“start fixing up free space”,所以出错数量比较多。

在系统中操作和运行程序时也会不断产生这种错误,最终导致系统变为read only模式并崩溃,信息如下:

UBIFS error (pid 100): ubifs_leb_write: writing 2048 bytes to LEB 1709:118784 failed, error -30
UBIFS warning (pid 100): ubifs_ro_mode: switched to read-only mode, error -30
Backtrace:
[<c0050f58>] (dump_backtrace+0x0/0x110) from [<c03d55b0>] (dump_stack+0x18/0x1c)
 r7:0001d000 r6:ffffffe2 r5:00000000 r4:d9ff8000
[<c03d5598>] (dump_stack+0x0/0x1c) from [<c0195568>] (ubifs_ro_mode+0x74/0x80)
[<c01954f4>] (ubifs_ro_mode+0x0/0x80) from [<c0195a28>] (ubifs_leb_write+0x84/0x98)
 r7:0001d000 r6:00000800 r5:d9ff8000 r4:ffffffe2
[<c01959a4>] (ubifs_leb_write+0x0/0x98) from [<c0195bf0>] (ubifs_wbuf_write_nolock+0x140/0x31c)
 r8:000000a0 r7:d9907188 r6:00000000 r5:d9f82c98 r4:00000002
[<c0195ab0>] (ubifs_wbuf_write_nolock+0x0/0x31c) from [<c018b430>] (write_head+0x58/0x78)
[<c018b3d8>] (write_head+0x0/0x78) from [<c018c608>] (ubifs_jnl_write_inode+0xcc/0x1c4)
 r5:00000000 r4:d9ff8000
[<c018c53c>] (ubifs_jnl_write_inode+0x0/0x1c4) from [<c0191680>] (ubifs_write_inode+0x70/0xd4)
[<c0191610>] (ubifs_write_inode+0x0/0xd4) from [<c00fadcc>] (writeback_single_inode+0x120/0x1c0)
 r7:d990722c r6:d9433ed0 r5:00000000 r4:d9907188
[<c00facac>] (writeback_single_inode+0x0/0x1c0) from [<c00fb21c>] (writeback_sb_inodes+0xa0/0x108)
 r7:d9ff8060 r6:d9433ed0 r5:d9907188 r4:00000000
[<c00fb17c>] (writeback_sb_inodes+0x0/0x108) from [<c00fb7c8>] (writeback_inodes_wb+0xdc/0xf8)
[<c00fb6ec>] (writeback_inodes_wb+0x0/0xf8) from [<c00fb974>] (wb_writeback+0x190/0x200)
[<c00fb7e4>] (wb_writeback+0x0/0x200) from [<c00fbb1c>] (wb_do_writeback+0x138/0x170)
[<c00fb9e4>] (wb_do_writeback+0x0/0x170) from [<c00fbbd4>] (bdi_writeback_thread+0x80/0x14c)
[<c00fbb54>] (bdi_writeback_thread+0x0/0x14c) from [<c00909a8>] (kthread+0x8c/0x94)
[<c009091c>] (kthread+0x0/0x94) from [<c007cc7c>] (do_exit+0x0/0x5fc)
 r7:00000013 r6:c007cc7c r5:c009091c r4:d9c9bef8
UBIFS error (pid 100): ubifs_wbuf_write_nolock: cannot write 160 bytes to LEB 1709:118784, error -30
UBIFS error (pid 100): ubifs_write_inode: can't write inode 103, error -30

感觉像是系统在运行时不断出现读写错误,并将Flash出错地址标为坏块,随着坏块数量超出限制,将文件系统变为了只读。可为什么会出这么多错?可以确定的是Flash上根本没有那么多坏块,因为在uboot下擦除、烧写时也就几个。是Flash驱动问题吗,还是DVRRDK中ubi文件系统生成参数不适合我这个Flash?我在Flash中为文件系统划分了256MB的分区,ubifs_128在makefile中的定义为:

ubifs_128
    $(mtdutils_PATH)/sbin/mkfs.ubifs -r $(TARGET_FS) -F -o ubifs.img -m 2048 -e 126976 -c 2047
    $(mtdutils_PATH)/sbin/ubinize -o $(TFTP_HOME)/ubi_128_$(DVR_RDK_BOARD_TYPE).img -m 2048 -p 128KiB -s 512 -O 2048 $(dvr_rdk_PATH)/makerules/ubinize.cfg
    rm -rf ubifs.img

ubinize.cfg内容为

[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=240MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize

请给些帮助,谢谢!