Cannot make Pynq boot from SD1 (kernel looks in mmcblk0 for rootfs)

I’m bringing Pynq for a custom board, almost there, I just have a problem that the kernel doesn’t seem to look for the rootfs in the right place.

This board has an eMMC in sd_0 and the SD card in sd_1.
I included the following boot args in system-user.dtsi:

chosen{ 
		bootargs = "earlycon clk_ignore_unused console=ttyPS0,115200 root=/dev/mmcblk1p2 rw rootfstype=ext4 rootwait"; 
	};

And I put that file in:

<my board repo> / <my board folder> / petalinux_bsp/meta-user/recipes-bsp/device-tree/files

Then I build everything with no problem. When it boots I can see this:

mmc1 is current device
Scanning mmc 1:1...
Found U-Boot script /boot.scr
(...)
[    0.000000] Kernel command line: root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 rootwait devtmpfs.mount=1 uio_pdrv_genirq.of_id="generic-uio" clk_ignore_unused
(...)
[    4.172758] mmc0: new HS200 MMC card at address 0001
[    4.178119] mmcblk0: mmc0:0001 Q2J54A 3.64 GiB
[    4.182851] mmcblk0boot0: mmc0:0001 Q2J54A partition 1 2.00 MiB
[    4.188954] mmcblk0boot1: mmc0:0001 Q2J54A partition 2 2.00 MiB
[    4.194951] mmcblk0rpmb: mmc0:0001 Q2J54A partition 3 512 KiB, chardev (243:0)
[    4.203219]  mmcblk0:
[    4.213179] mmc1: new high speed SDHC card at address 0001
[    4.218999] mmcblk1: mmc1:0001 SD32G 29.1 GiB
[    4.224406]  mmcblk1: p1 p2
(...)
[    4.305435] VFS: Cannot open root device "mmcblk0p2" or unknown-block(179,2): error -6
[    4.313373] Please append a correct "root=" boot option; here are the available partitions:
[    4.321744] 0100           65536 ram0
[    4.321745]  (driver?)
[    4.327879] 0101           65536 ram1
[    4.327881]  (driver?)
[    4.333998] 0102           65536 ram2
[    4.333999]  (driver?)
[    4.340127] 0103           65536 ram3
[    4.340128]  (driver?)
[    4.346250] 0104           65536 ram4
[    4.346251]  (driver?)
[    4.352383] 0105           65536 ram5
[    4.352384]  (driver?)
[    4.358506] 0106           65536 ram6
[    4.358507]  (driver?)
[    4.364639] 0107           65536 ram7
[    4.364640]  (driver?)
[    4.370762] 0108           65536 ram8
[    4.370763]  (driver?)
[    4.376897] 0109           65536 ram9
[    4.376898]  (driver?)
[    4.383028] 010a           65536 ram10
[    4.383029]  (driver?)
[    4.389248] 010b           65536 ram11
[    4.389249]  (driver?)
[    4.395466] 010c           65536 ram12
[    4.395467]  (driver?)
[    4.401686] 010d           65536 ram13
[    4.401687]  (driver?)
[    4.407899] 010e           65536 ram14
[    4.407900]  (driver?)
[    4.414106] 010f           65536 ram15
[    4.414107]  (driver?)
[    4.420322] b300         3817472 mmcblk0
[    4.420324]  driver: mmcblk
[    4.427147] b318        30533632 mmcblk1
[    4.427149]  driver: mmcblk
[    4.433976]   b319          133120 mmcblk1p1 623beb7f-01
[    4.433978]
[    4.440805]   b31a         8832445 mmcblk1p2 623beb7f-02
[    4.440806]
[    4.447623] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2)

I don’t understand why the boot args change, do I need to change the kernel config as well?

1 Like

Update:
I found that the Makefile contains this line:

echo 'CONFIG_SUBSYSTEM_SDROOT_DEV="/dev/mmcblk0p2"' >> $$(PL_CONFIG_$1)

That I changed to mmcblk1p2 but, to my surprise, still produced an image looking for the rootfs in mmcblk0p2.

Then I found this:

Indicating that the bootargs are taken from yet another source (not the original petalinux project, not the makefile, but some fixed file!). Pynq needs an important tidy up or it will die in your hands and drag some of you to the dark depths of the software messes.

1 Like

and that was it, the above solved my problem.