使用initramfs文件系统,linux可以正常运行,也能正常读写SD卡。但挂载在SD 卡上,则出现无法挂载的现象,
bootargs为“console=ttySC0,115200 root=/dev/mmcblk0p2 init=/init rootfstype=ext3 rootwait”
相关信息为:
mmc0 at 0xd082c000 irq 119
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
No device for DAI AK4554
ALSA device list:
No soundcards found.
TCP cubic registered
NET: Registered protocol family 17
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
Waiting for root device /dev/mmcblk0p2...
mmc0: new high speed SDHC card at address b368
mmcblk0: mmc0:b368 00000 7.51 GiB (ro)
mmcblk0: p1 p2 p3
VFS: Cannot open root device "mmcblk0p2" or unknown-block(179,2)
Please append a correct "root=" boot option; here are the available partitions:
b300 7879680 mmcblk0 driver: mmcblk
b301 486266 mmcblk0p1
b302 555768 mmcblk0p2
b303 6831315 mmcblk0p3
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2)
[] (unwind_backtrace+0x0/0xe4) from [] (panic+0x58/0xd8)
[] (panic+0x58/0xd8) from [] (mount_block_root+0x1c8/0x208)
[] (mount_block_root+0x1c8/0x208) from [] (prepare_namespace+0x120/0x174)
[] (prepare_namespace+0x120/0x174) from [] (kernel_init+0x120/0x168)
[] (kernel_init+0x120/0x168) from [] (kernel_thread_exit+0x0/0x8)
发现SD 为只读:mmcblk0: mmc0:b368 00000 7.51 GiB (ro)
注意该错误信息中,出现(ro),以及后面会提示推荐的挂载分区:
Please append a correct "root=" boot option; here are the available partitions:... etc
而实际上SD 卡未上锁,由于硬件没法查看,因此临时在代码中修改:
将mmc驱动中关于判定读写保护的部分取消,直接return 0。
之后再运行,又出现新的错误:
Waiting for root device /dev/mmcblk0p2...
mmc0: new high speed SDHC card at address b368
mmcblk0: mmc0:b368 00000 7.51 GiB
mmcblk0: p1 p2 p3
EXT3-fs: barriers not enabled
EXT3-fs (mmcblk0p2): warning: mounting unchecked fs, running e2fsck is recommended
kjournald starting. Commit interval 5 seconds
EXT3-fs (mmcblk0p2): using internal journal
EXT3-fs (mmcblk0p2): mounted filesystem with ordered data mode
VFS: Mounted root (ext3 filesystem) on device 179:2.
Freeing init memory: 76K
Kernel panic - not syncing: Attempted to kill init!
[] (unwind_backtrace+0x0/0xe4) from [] (panic+0x58/0xd8)
[] (panic+0x58/0xd8) from [] (do_exit+0x68/0x608)
[] (do_exit+0x68/0x608) from [] (do_group_exit+0xa8/0xd8)
[] (do_group_exit+0xa8/0xd8) from [] (get_signal_to_deliver+0x378/0x3cc)
[] (get_signal_to_deliver+0x378/0x3cc) from [] (do_signal+0x68/0x680)
[] (do_signal+0x68/0x680) from [] (do_notify_resume+0x18/0x48)
[] (do_notify_resume+0x18/0x48) from [] (work_pending+0x1c/0x20)
从红色部分,可以看出,其实文件系统已经挂载上去了。应该是在加载init程序时出错。
后面查找过程中,发现该SD卡驱动部分代码依赖于DMA模块,且问题竟然是与驱动模块编译顺序有关。
这个问题实在太隐蔽。还好有大神帮忙。
在drivers/Makefile文件中,源代码默认的编译顺序是DMA在MMC模块之后,将MMC修改在DMA之前编译,问题解决。
注意该错误的信息:出现在Freeing init memory之后。
后面推测了下大致原因,由于MMC在DMA编译之前,当内核加载好MMC驱动之后,检测到SD卡分区,于是直接挂载mmcblk0p2。
但不知道为什么,DMA驱动还未加载完毕,这时候要读取SD卡里面的内容时无法正常读取,于是出错。
阅读(13102) | 评论(1) | 转发(1) |