
FriendlyARM을 사용하여 임베디드 Linux 애플리케이션을 개발 중입니다.마이크로 2440. Samsung s3c2440 ARM 프로세서에서 실행되며 NAND 플래시 메모리에 squashfs를 사용합니다.
최근 일부 플래시 메모리 블록에 문제가 발생했습니다. u-Boot는 이를 올바르게 찾고 nand bad 명령으로 제공된 오프셋을 사용하여 불량 블록 테이블을 생성합니다.
Device 0 bad blocks:
01340000
0abc0000
0f080000
0ff80000
0ffa0000
0ffc0000
0ffe0000
커널을 부팅하려고 하면 잘못된 블록을 올바르게 검색하고 다음 메시지와 같이 잘못된 블록 테이블을 생성합니다.
Scanning device for bad blocks
Bad eraseblock 154 at 0x000001340000
Bad eraseblock 1374 at 0x00000abc0000
Bad eraseblock 1924 at 0x00000f080000
그러나 커널이 0x000001340000에서 불량 블록이 발생하는 파티션에 파일 시스템을 마운트하면 불량 블록을 건너뛸 수 없는 것 같으며 패닉이 발생합니다. 제공된 오류 메시지는 다음과 같습니다.
SQUASHFS error: squashfs_read_data failed to read block 0xd0e24b
SQUASHFS error: Unable to read metadata cache entry [d0e24b]
SQUASHFS error: Unable to read inode 0x3d1d0f68
------------[ cut here ]------------
WARNING: at fs/inode.c:712 unlock_new_inode+0x20/0x3c()
Modules linked in:
[<c0037750>] (unwind_backtrace+0x0/0xcc) from [<c0044994>] (warn_slowpath_null+0x34/0x4c)
[<c0044994>] (warn_slowpath_null+0x34/0x4c) from [<c00a42c8>] (unlock_new_inode+0x20/0x3c)
[<c00a42c8>] (unlock_new_inode+0x20/0x3c) from [<c00a61b8>] (iget_failed+0x14/0x20)
[<c00a61b8>] (iget_failed+0x14/0x20) from [<c00f75cc>] (squashfs_fill_super+0x3c8/0x508)
[<c00f75cc>] (squashfs_fill_super+0x3c8/0x508) from [<c0095990>] (get_sb_bdev+0x110/0x16c)
[<c0095990>] (get_sb_bdev+0x110/0x16c) from [<c00f7164>] (squashfs_get_sb+0x18/0x20)
[<c00f7164>] (squashfs_get_sb+0x18/0x20) from [<c0095008>] (vfs_kern_mount+0x44/0xd8)
[<c0095008>] (vfs_kern_mount+0x44/0xd8) from [<c00950e0>] (do_kern_mount+0x34/0xe0)
[<c00950e0>] (do_kern_mount+0x34/0xe0) from [<c00a9084>] (do_mount+0x5d8/0x658)
[<c00a9084>] (do_mount+0x5d8/0x658) from [<c00a9330>] (sys_mount+0x84/0xc4)
[<c00a9330>] (sys_mount+0x84/0xc4) from [<c0008c60>] (mount_block_root+0xe4/0x20c)
[<c0008c60>] (mount_block_root+0xe4/0x20c) from [<c00090fc>] (prepare_namespace+0x160/0x1c0)
[<c00090fc>] (prepare_namespace+0x160/0x1c0) from [<c00089c8>] (kernel_init+0xd8/0x104)
[<c00089c8>] (kernel_init+0xd8/0x104) from [<c0033738>] (kernel_thread_exit+0x0/0x8)
---[ end trace c21b44698de8995c ]---
VFS: Cannot open root device "mtdblock5" or unknown-block(31,5)
Please append a correct "root=" boot option; here are the available partitions:
1f00 256 mtdblock0 (driver?)
1f01 128 mtdblock1 (driver?)
1f02 640 mtdblock2 (driver?)
1f03 5120 mtdblock3 (driver?)
1f04 5120 mtdblock4 (driver?)
1f05 40960 mtdblock5 (driver?)
1f06 40960 mtdblock6 (driver?)
1f07 167936 mtdblock7 (driver?)
1f08 1024 mtdblock8 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,5)
[<c0037750>] (unwind_backtrace+0x0/0xcc) from [<c02fdd40>] (panic+0x3c/0x114)
[<c02fdd40>] (panic+0x3c/0x114) from [<c0008d44>] (mount_block_root+0x1c8/0x20c)
[<c0008d44>] (mount_block_root+0x1c8/0x20c) from [<c00090fc>] (prepare_namespace+0x160/0x1c0)
[<c00090fc>] (prepare_namespace+0x160/0x1c0) from [<c00089c8>] (kernel_init+0xd8/0x104)
[<c00089c8>] (kernel_init+0xd8/0x104) from [<c0033738>] (kernel_thread_exit+0x0/0x8)
mtdblock6 파티션에 파일 시스템을 마운트하려고 시도했는데 해당 메모리 부분에 불량 블록이 없었기 때문에 모든 것이 예상대로 작동했습니다. 불량 블록 관리를 담당하는 mtd 소스 파일을 조사했지만 커널이 불량 블록을 건너뛰는 방법에 대한 유용한 정보를 찾을 수 없었습니다.
답변1
우리는 문제가 squashfs 자체에 있다는 것을 발견했습니다. 아래 설명된 대로 불량 블록 감지를 지원하지 않습니다.
http://elinux.org/Support_read-only_block_filesystems_on_MTD_flash
따라서 가능한 해결책은 다른 파일 시스템을 사용하거나 UBI를 사용하여 불량 블록을 관리한 다음 squashfs를 계속 사용하는 것입니다.
답변2
부팅 매개변수에 "rootdelay=2"(또는 그 이상, 최대 10개까지 가능)와 같은 항목을 추가해 보셨나요? 커널이 플래시에 액세스하기 전에 플래시의 내용을 정리할 추가 시간이 주어질 수 있습니다.