I am hacking together a quick embedded linux system on a DM816x evm board. Previously I have been using TFTP and NFS to load my kernel and root filesystem to the board. I am now trying to switch over to loading everything from an SD card.

I have my card partitioned such that uBoot and my kernel image are in one partition, and my rootFS in another partition. At power-on, Uboot starts correctly and successfully launches the kernel. However, the kernel is unable to mount the root file system. It appears that it doesn't recognize any SD (mmc) cards. It gives this error message.

VFS: Cannot open root device "mmcblk0p2" or unknown-block(2,0)
Please append a correct "root=" boot option; here are the available partitions:
1f00             256 mtdblock0  (driver?)
1f01               8 mtdblock1  (driver?)
1f02            2560 mtdblock2  (driver?)
1f03            1272 mtdblock3  (driver?)
1f04            2432 mtdblock4  (driver?)
1f05             128 mtdblock5  (driver?)
1f06            4352 mtdblock6  (driver?)
1f07          204928 mtdblock7  (driver?)
1f08           50304 mtdblock8  (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

I feel like I'm missing something fundamental here. Why does it not recognize the root device I am trying to load from?

Here is my uBoot boot script that is running:

setenv bootargs console=ttyO2,115200n8 root=/dev/mmcblk0p2 rw mem=124M earlyprink vram=50M ti816xfb.vram=0:16M,1:16M,2:6M ip=off noinitrd;mmc init;fatload mmc 1 0x80009000 uImage;bootm 0x80009000
  • My current line of thinking is leading me to believe I may need to recompile my kernel and explicitly enable the option to load the root file system from an MMC device. I'd like to get some second opinions on this before I undertake this seemingly large time consuming task. – Brandon Yates Dec 19 '12 at 21:22
  • One possibility is that your root filesystem device specification is off. To verify try the following: Under your old boot config using TFTP/NFS, can you see the card device? Then can you mount the filesystem on the card using /dev/mmcblk0p2? Could your partition index be off by one? /dev/mmcblk0p1? Whatever device & partition you successfully access the card-based filesystem from should be the argument after "root=" in your boot args. – Digikata Dec 19 '12 at 21:25
  • 1
    Embedded software development is not off topic people. This is not like getting your desktop to boot. – Karl Bielefeldt Dec 19 '12 at 21:39

I see that some sample bootarg lines from the DM816x EVMs have a rootdelay=2 up to rootdelay=10. Since it's missing from your bootargs, starting at the lower end of 2 might be nice to see if you need a little bit of time to allow the mmc device to come online.

  • 1
    Do you live near Philadelphia by any chance? Because if so I'd like to buy you a beer. Problem freaking solved! Thank you so much. I never would have even thought to try this on my own. – Brandon Yates Dec 19 '12 at 23:16
  • Afraid not, I'm in Southern California. I'm happy to help, and appreciate the sentiment. Good luck in your embedded linux endeavors! – Digikata Dec 19 '12 at 23:47
  • This has saved my bacon. I was totally baffled by an SBC from pcengines.ch (APU2 - nice product for a router) that was very flaky over booting from an SDHC card - sometimes it would, sometimes it failed and caused a panic. Putting a one second delay in, before mounting root, seems to have solved the problem. – Nicole May 19 '17 at 19:35

Yes, the root filesystem driver must be built into the kernel, not a module. The reason is that modules are loaded from the root filesystem. Recompiling a kernel isn't such a huge deal. The first couple times it's tricky, but it's definitely not something only a kernel hacker can understand.

  • Thank you for the reply. Following the advice above from @Digikata I loaded up my system using NFS and TFTP, and I was able to mount /dev/mmcblk0p1 after that. I'm not sure totally how to interpret this. Is the kernel loading the device driver for mmc after mounting the rootfs? – Brandon Yates Dec 19 '12 at 21:43
  • Most likely. Do a lsmod after you've booted up. If it shows mmc-related modules, that means they are being loaded after the root filesystem comes up. – Karl Bielefeldt Dec 19 '12 at 21:47
  • No MMC modules loaded. During startup I do get this error printed to the console "Jan 1 00:00:06 udevd[79]: inotify_add_watch(6, /dev/mmcblk0, 10) failed: No such file or directory " The kernel I'm using was provided to us by a 3rd party that we no longer work with and is in disarray, it's probably best for me to recompile a fresh kernel in any case. Thanks for the help. – Brandon Yates Dec 19 '12 at 21:52
  • After you verified that you could mount /dev/mmcblk0p1 - p1 was the root filesystem partition I assume? Did you change your bootargs from root=/dev/mmcblk0p2 to root=/dev/mmcblk0p1 and retry booting from the card with the new root device? – Digikata Dec 19 '12 at 22:04
  • 1
    If there are no MMC modules loaded, yet you've successfully mounted the mmc, that suggests that the mmc modules were already statically compiled into the kernel and no kernel recompile is required. (Though I agree, it's worth doing to get comfortable with working with kernels). – Digikata Dec 19 '12 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.