AnsweredAssumed Answered

Load rootfs from SD card

Question asked by 3DeeMoN on Jan 19, 2016
Latest reply on Jan 20, 2016 by Aaronwu



Now I'm trying to make system which will run u-boot from SPI flash and then load kernel and rootfs from SD card.


Loading u-boot from SPI flash is ok. Loading kernel from SD is ok too: just "ext2load mmc 0 0x1000000 /boot/vmImage" in u-boot. I also set environment variable

setenv bootargs 'root=/dev/mmcblk0p1 rootwait rw clkin_hz=25000000 earlyprintk=serial,uart0,57600 console=ttyBF0,57600'

But mounting rootfs fails with this:

[   17.456874] mmc0: host does not support reading read-only switch. assuming write-enable.

[   17.474607] Warning: unable to open an initial console.

[   17.485305] Waiting for root device /dev/mmcblk0p1...

[   17.495420] mmc0: new SDHC card at address 0001

[   17.505972] mmcblk0: mmc0:0001 00000 3.79 GiB

[   17.517260]  mmcblk0: p1

[   17.599437] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1)

[   17.615996] Hardware Trace:

[   17.621609]    0 Target : <0x0024df20> { _dump_stack + 0x0 }

[   17.632899]      Source : <0x0024dfce> { _panic + 0x6a } CALL pcrel

[   17.645435]    1 Target : <0x0024dfbc> { _panic + 0x58 }



However I can mount rootfs manually when I boot uImage

root:/> mount /dev/mmcblk0p1 /mnt

[   53.155654] EXT2-fs (mmcblk0p1): warning: mounting unchecked fs, running e2fsck is recommended


I prepare SD card with this commands

sudo sfdisk --in-order --Linux --unit M /dev/sdb <<-__EOF__



sudo mkfs.ext2 /dev/sdb1 -L rootfs

sudo tar xfp ./output/images/rootfs.tar -C /media/user/rootfs/

sudo mkdir /media/user/rootfs/boot

sudo cp ./output/images/vmImage /media/user/boot/vmImage


I tried ext4 and ext2 FS. Both mounts manually, but none on startup process. What should I check?



By the way, can I load u-boot and kernel with rootfs from the same sdcard? I found that I should put u-boot at 0 sector on SD, but partition table also should be at 0 sector.