Page 1 of 1

nanopi-neo-plu2: mmcblk device numbering

Posted: Thu Dec 21, 2017 11:56 am
by blowback
Hi,

I've built my own kernel and u-boot as described here: http://wiki.friendlyarm.com/wiki/index. ... _and_Linux

When I come to boot the SD card, u-boot passes a "root=mmcblk0" command line parameter to the kernel, but when the kernel boots it enumerates the first mmc device as "mmcblk1" (and there's also an mmcblk2, the built-in eMMC). Since this doesn't match the rootfs passed in to the kernel, VFS panics.

How do I make the kernel's device enumeration start at mmcblk0? I've tried changing the node names in the .dts file and building a new sun50i-h5-nanopi-neo-plus2.dbt to no avail.

Re: nanopi-neo-plu2: mmcblk device numbering

Posted: Thu Dec 21, 2017 2:56 pm
by blowback
I was able to fix this by mounting the boot partition from the provided xenial sd-card image and examining their boot setup, which includes these two magic lines:

Code: Select all

fdt addr ${dtb_addr}
fdt set mmc${boot_mmc} boot_device <1>


"boot_device" is an undocumented (and poorly named?) DTB property. In the sun50i-h5-nanopi-neo-plus2.dts file provided it is set to <0> for both mmc0 and mmc2.

From reading the sunx_mmc source code, its purpose seems to be "make this device appear as mmcblk0".

Re: nanopi-neo-plu2: mmcblk device numbering

Posted: Fri Dec 22, 2017 9:40 pm
by igorp
blowback wrote:
I was able to fix this by mounting the boot partition from the provided xenial sd-card image and examining their boot setup, which includes these two magic lines:

Code: Select all

fdt addr ${dtb_addr}
fdt set mmc${boot_mmc} boot_device <1>


"boot_device" is an undocumented (and poorly named?) DTB property. In the sun50i-h5-nanopi-neo-plus2.dts file provided it is set to <0> for both mmc0 and mmc2.

From reading the sunx_mmc source code, its purpose seems to be "make this device appear as mmcblk0".


Check Armbian. It uses UUID since some time on all boards. You can also check how it is solved ...