SD卡挂载文件系统:VFS: Cannot open root device "

页面导航:首页 > 操作系统 > LINUX > SD卡挂载文件系统:VFS: Cannot open root device "

SD卡挂载文件系统:VFS: Cannot open root device "

来源: 作者: 时间:2016-08-18 10:29 【

SD卡挂载文件系统:VFS: Cannot open root device mmcblk0p2解决使用initramfs文件系统,linux可以正常运行,也能正常读写SD卡。但挂载在SD 卡上,则出现无法挂载的现象,bootargs为console=ttySC0,1152..
SD卡挂载文件:VFS: Cannot open root device "mmcblk0p2"解决
 
使用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)
[<c0027620>] (unwind_backtrace+0x0/0xe4) from [<c029c958>] (panic+0x58/0xd8)
[<c029c958>] (panic+0x58/0xd8) from [<c0008d74>] (mount_block_root+0x1c8/0x208)
[<c0008d74>] (mount_block_root+0x1c8/0x208) from [<c000902c>] (prepare_namespace+0x120/0x174)
[<c000902c>] (prepare_namespace+0x120/0x174) from [<c000845c>] (kernel_init+0x120/0x168)
[<c000845c>] (kernel_init+0x120/0x168) from [<c0022f90>] (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!
[<c0021844>] (unwind_backtrace+0x0/0xe4) from [<c023fe74>] (panic+0x58/0xd8)
[<c023fe74>] (panic+0x58/0xd8) from [<c0030d30>] (do_exit+0x68/0x608)
[<c0030d30>] (do_exit+0x68/0x608) from [<c0031378>] (do_group_exit+0xa8/0xd8)
[<c0031378>] (do_group_exit+0xa8/0xd8) from [<c003c47c>] (get_signal_to_deliver+0x378/0x3cc)
[<c003c47c>] (get_signal_to_deliver+0x378/0x3cc) from [<c001e7b4>] (do_signal+0x68/0x680)
[<c001e7b4>] (do_signal+0x68/0x680) from [<c001ede4>] (do_notify_resume+0x18/0x48)
[<c001ede4>] (do_notify_resume+0x18/0x48) from [<c001bed0>] (work_pending+0x1c/0x20)
 
从红色部分,可以看出,其实文件系统已经挂载上去了。应该是在加载init程序时出错。
后面查找过程中,发现该SD卡驱动部分代码依赖于DMA模块,且问题竟然是与驱动模块编译顺序有关。
这个问题实在太隐蔽。还好有大神帮忙。
在drivers/Makefile文件中,源代码默认的编译顺序是DMA在MMC模块之后,将MMC修改在DMA之前编译,问题解决。
注意该错误的信息:出现在Freeing init memory之后。
后面推测了下大致原因,由于MMC在DMA编译之前,当内核加载好MMC驱动之后,检测到SD卡分区,于是直接挂载mmcblk0p2。
Tags:

文章评论

最 近 更 新
热 点 排 行
Js与CSS工具
代码转换工具

<