打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
linux

I'm working with embedded ARM platform with built NAND flash. My roofs partition is squashfs. Both u-boot and kernel use OMAP_ECC_BCH8_CODE_HW. The problem is that some boards (not just one) stopped working after a power outage (they were used for about 2 months).

These errors can be seen while booting:

[    8.270507] end_request: I/O error, dev mtdblock9, sector 25184[    8.278930] SQUASHFS error: squashfs_read_data failed to read block 0xc40396[    8.286376] SQUASHFS error: Unable to read fragment cache entry [c40396][    8.293579] SQUASHFS error: Unable to read page, block c40396, size d696[    8.300628] SQUASHFS error: Unable to read fragment cache entry [c40396][    8.307647] SQUASHFS error: Unable to read page, block c40396, size d696[    8.314819] SQUASHFS error: Unable to read fragment cache entry [c40396][    8.321838] SQUASHFS error: Unable to read page, block c40396, size d696[    8.328887] SQUASHFS error: Unable to read fragment cache entry [c40396][    8.335906] SQUASHFS error: Unable to read page, block c40396, size d696[    8.343017] SQUASHFS error: Unable to read fragment cache entry [c40396][    8.350006] SQUASHFS error: Unable to read page, block c40396, size d696/usr/sbin/lighttpd: '/usr/lib/libpcre.so.1' is not an ELF file/usr/sbin/lighttpd: can't load library 'libpcre.so.1'

How should I debug this? I haven't erased the flash so it's still possible to make some tests on it.

What I've done so far:

  1. I used nanddump (with -o, read oob data) on bad partition and I noticed three ecc correction warnings. When I write this dump to another board it booted without a problem.

  2. When I used nanddump with additional option -n (--noecc, Read without error correction) and write it to another board (using nandwrite -n), the second board was unable to boot.

It seems to me that these errors are recoverable and that's why nanddump corrected them in the first case. I compared these 2 dumps and they are only three differences (3 ecc corrections reported by nanddump?)

# diff mtd_without_ecc.hex mtd_with_ecc.hex 486347c486347< 076bca0: 59d2 d8bc 3e89 1c67 a6c2 74a0 bc38 4873  Y...>..g..t..8Hs---> 076bca0: 59d2 d8bc 3e09 1c67 a6c2 74a0 bc38 4873  Y...>..g..t..8Hs783769c783769< 0bf5980: e31e f50a e5b5 6ae5 5a67 8be1 7636 9cf2  ......j.Zg..v6..---> 0bf5980: e31e f50a e5b5 6aa5 5a67 8be1 7636 9cf2  ......j.Zg..v6..1315929c1315929< 1414580: a9ec ef89 ac52 c8a5 61f5 5d0b 6ee2 af41  .....R..a.].n..A---> 1414580: a9ec af89 ac52 c8a5 61f5 5d0b 6ee2 af41  .....R..a.].n..A

The question is: why these errors weren't corrected by system automatically? Is it because squashfs is not "mtd-aware" filesystem and it shouldn't be used on mtd devices? If so, should I use squashfs over UBI? What about the kernel then (as far as I know it has to be raw image in order to boot it from u-boot)?

Thanks for any help!

asked Dec 12 '13 at 18:41

1 Answer

Indeed, the Linux MTD layer doesn't do any maintenance on the NAND/NOR memory.

For example, when a bitflip happens on your NAND, it's corrected by the ECC. The MTD layer is aware of that, but it doesn't DO anything about it. It just returns the error.

So you need another layer on top of MTD to take care of that.

One solution is to use UBI, which is designed to solve this kind of problems. Have a look at the UBI documentation on linux-mtd. If you want to stick with squashfs, it's possible to add another MTD abstraction on top of UBI (gluebi), then run squashfs on top of that. The result looks like that:

---------------------|      SquashFS     |---------------------|     MTD block     |---------------------| MTD API (gluebi)  |---------------------|        UBI        |---------------------|     MTD driver    |---------------------|     Flash Chip    |---------------------

It makes a scary picture, but it works pretty well ;)

Have a look at this slides from free-electrons for more info (the picture comes from slide 47).

About the kernel, I'm not sure but I think U-Boot does support UBI. Never tried it though...

answered Feb 5 '14 at 14:42
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
u-boot UBIFS移植及文件系统烧写
如何逆向嵌入式设备的NAND Flash
u-boot-2012-07 for tiny210, 支持USB DNW, 支持YAFFS2烧写, 彻底抛弃superboot
移植2.6.24内核到2410
Tiny6410 关于制作ubifs文件系统映像
add yaffs fs to kernel
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服