[BPI-R2 Pro] Kernel loads but fails to find SD card

Do you have the old bootloader on emmc? This causes sd is not booted and fails in atf…but as far as i understood you can boot into sd linux without maskrom or any other tricks.

Strange that you need to change boot to emmc…sdboot is working dor me after kernel-ci add the itb in the bpi-r2pro tarball. So if this can be booted you should have the right version.

Changed the fstab too as sdcard is mmcblk0 in image build script. Also changed systemd files abot so that lan should be up on bootup (when link detected, not forced up).

@ericwoud end0 is gmac for mt7531 switch. Wan on r2pro is other mac on soc and renamed from ethX to wan. Also added the cmdline param to uboots builtin env so mac is not renamed to end0

And added sysboot (not yet tested).

Ok, I see. I would have expected a name like ethX or endX, but it is renamed. Then indeed it should not matter is other mac is up :wink:

mhm, currently i have a kernel-panic on starting init…kernel tries different bins from right partition, but seems all failed…maybe i card is broken :frowning:

used an older samsung 8GB card as it was the only i found empty

first try /sbin/init is there as symlink to systemd…so all looks good, seems filesystem has errors :frowning:

edit: fsck fixed it…again up and running (boot from sd without problems now) and wan is up with ip from dhcp :slight_smile:

full bootlog here: https://pastebin.com/zzfbTZDf

and made first steps with distroboot in newer uboot:

BPI-R2PRO> setenv kernel_addr_r 0x02080000
BPI-R2PRO> setenv fdt_addr_r 0x0a100000
BPI-R2PRO> setenv kernel_comp_addr_r 0x0c000000
BPI-R2PRO> setenv kernel_comp_size 0x03000000
BPI-R2PRO> bootflow scan -lb
Scanning for bootflows in all bootdevs
Seq  Method       State   Uclass    Part  Name                      Filename
---  -----------  ------  --------  ----  ------------------------  ----------------
Scanning global bootmeth 'efi_mgr':
Scanning bootdev '[email protected]':
  0  extlinux     ready   mmc          2  [email protected] /extlinux/extlinux.conf
** Booting bootflow '[email protected]_2' with extlinux
Select the boot mode
1:      linux
Enter choice: 1:        linux
Retrieving file: Image.gz
Skipping linux for failure retrieving kernel
Boot failed (err=-14)
Scanning bootdev '[email protected]':
No more bootdevs
---  -----------  ------  --------  ----  ------------------------  ----------------
(1 bootflow, 1 valid)

BPI-R2PRO> ls mmc 1:2 extlinux
            ./
            ../
    60074   bpi-r2pro.dtb
 10308454   Image.gz
      234   extlinux.conf

but i do not see whats wrong (not uboot has swapped device numbers…)

BPI-R2PRO> mmc list
mmc@fe2b0000: 1 (SD)
mmc@fe310000: 0 (eMMC)

maybe anyone here has an idea whats the problem

BPI-R2PRO> fatload mmc 1:2 $loadaddr extlinux/extlinux.conf
234 bytes read in 4 ms (56.6 KiB/s)
BPI-R2PRO> setexpr listend ${loadaddr} + ${filesize};mw.b ${listend} 00 2;strings ${loadaddr}
menu title Select the boot mode
#timeout 1/10s
TIMEOUT 50
DEFAULT linux
LABEL linux
        linux Image.gz
        fdt bpi-r2pro.dtb
        append earlycon=uart8250,mmio32,0xfe660000  console=ttyS2,1500000n8 root=/dev/mmcblk0p3 rootwait rw  earlk

BPI-R2PRO>

Did you try the uncompressed Image file? (without .gz extension)

Not yet as old distroboot was working with compressed images…i also try adding directory to filenames when i’m back home

With this extlinux.conf, the files should be at root of boot partition…

thanks adding extlinux/ to the files worked…thought the kernel-files have to be in extlinux-folder (relatively to the conf)…works now…need to find older card where i have older uboot and change either my buildimg or the kernel-script

edit: yes my old bootchain have looked for files in extlinux folder…my initrd is defined as “initrd /rootfs.cpio.lz4” because it is located in root…so i change the extlinux in the buildimg.sh

Do you have the old bootloader on emmc? This causes sd is not booted and fails in atf…but as far as i understood you can boot into sd linux without maskrom or any other tricks.

Strange that you need to change boot to emmc…sdboot is working dor me after kernel-ci add the itb in the bpi-r2pro tarball. So if this can be booted you should have the right version.

I can’t read from/see an SD card as soon as the Linux kernel is loaded, so if I try to boot off the SD card (with rootfs on SD) it hangs waiting for the rootfs. Even if I boot into Linux off of the emmc and then insert an SD card, mmcblk0 doesn’t appear in /dev. The only time I can read the SD card is in u-boot (e.g., fatls works from the u-boot console).

To confirm that it wasn’t something on the emmc, I wiped the emmc with:

# dd if=/dev/zero of=/dev/mmcblk1 status=progress

but the kernel still won’t detect the SD card. So I can load u-boot and a kernel off the SD card, but my rootfs needs to be on the emmc or on a SATA drive to boot the system.

Very strange…maybe something is broken on your board…was it working anytime before? Strange that it works in uboot but not in linux. And with my board it works now…

@sinovoip is something changed on r2pro with wan-port and mmc in newer hw revisions (after my v1.1 r2ro)?

@technocratik can you post full bootlog (txt file or pastebin)?

Very strange…maybe something is broken on your board…was it working anytime before?

Nope, I’ve never been able to boot off a rootfs on the SD card. And yes, I’m also starting to think I have an issue with my board.

Comparing with your boot log, I notice that the kernel can’t communicate with the RK809:

[    3.459708] rk808 0-0020: failed to read the chip id at 0x17

I’m not sure if this is relevant, but if there is an issue with the PMIC, to my mind it could explain the sundry issues I’ve been having (kernel panics with the sinovoip images, SD card issues, etc.).

I’ve attached the full bootlog for 6.1 bookworm: bpi-r2pro_bootlog.txt (61.4 KB)

It is posssible that you have a pmic problem,but then it should stay in uboot-settings,but maybe uboot does not use uhs mode and kernel switches to it and fails. Ethernet is not usable in uboot because of missing rockchip/designware driver. Afair there is a separate iodomain for the wan-port which has to be raised voltage (default is 3v3 for all supplies and uboot does not initialize it).

You could try to read the i2c-bus (i2cdetect) and look for address of pmic,but i do not know how to get further.

edit: the uboot-extlinux path issue was fixed in 2023.07-rc5 with this commit

https://source.denx.de/u-boot/u-boot/-/commit/a7e4dffcd8c582bf4344548270d2fc7ac6c0f9ec

so i revert the commit adding path in buildimg.sh after the uboot-pipeline finishes

It is posssible that you have a pmic problem,but then it should stay in uboot-settings,but maybe uboot does not use uhs mode and kernel switches to it and fails. Ethernet is not usable in uboot because of missing rockchip/designware driver. Afair there is a separate iodomain for the wan-port which has to be raised voltage (default is 3v3 for all supplies and uboot does not initialize it).

I do get these errors right after u-boot loads:

can't get vref-supply: -121
rockchip_dnl_key_pressed: adc_channel_single_shot fail!
Hit any key to stop autoboot:  0
Card did not respond to voltage select! : -110

so I will investigate the PMIC further, because it looks like it is the most likely culprit.

You could try to read the i2c-bus (i2cdetect) and look for address of pmic,but i do not know how to get further.

I did this, and i2c-0 showed no devices. So I probed I2C0_SCL_PMIC and I2C0_SDA_PMIC on my oscilloscope:

BPIR2P_I2C-0

ID 0x17 yields no acknowledge on the I2C, but also it looks like I2C0_SDA_PMIC (in purple) is only being pulled up to ~1.2V, whereas I would expect its high voltage to be 3.3V like I2C0_SCL_PMIC (though I’m no expert). Can someone confirm that this is indicative of a fault?