Bpi-r64 quick start (boot from eMMC)

is your uboot 32 or 64bit? i guess it’s 32 so you should see ATF-messages before kernel starts…addresses look like 32bit

kernel is 64bit?

try to get in uboot-console and search for console in bootcmd

on my openwrt source code

target/linux/mediatek/files-4.19/arch/arm64/boot/dts/mediatek/mt7622.dtsi

define 64bit
But I’m not sure if it is 64bit


and i on the uboot-console type ‘version’ to got this info

U-Boot 2014.04-rc1 (May 09 2019 - 19:22:09) arm-linux-gcc (Buildroot 2014.11) 4.9.2 GNU ld (GNU Binutils) 2.24

i don’t konw how to check uboot architecture

Looks like 32bit…

Just share information that Openwrt trunk upgraded to kernel 5.4 which supports bpi-r2 and bpi-r64.

1 Like

thx,

You reminded me

when i update openwrt source code to trunk version

and compile it

than it work

so, The reason is that the dts file of the mainline version has been updated

@frank-w

Hi @frank-w, I am trying to boot from eMMC but I have issues with latest kernels (> 5.4)

I took inspiration from the script in your drive for partitioning: https://wiki.fw-web.de/doku.php?id=en:bpi-r64:storage

And I flashed eMMC from official sd 4.19 with emmc preloader, 64bits ATF and 2020.04 64bits u-boot. I also formatted /dev/mmcblk (emmc) with vfat and ext4 partitions, like the SD.

So far I boot kernel like this but latest kernels show problems while mouting root ext4 partition. (kernel panic) Same kernel but booted from SD:

[[email protected] ~]# mount /dev/mmcblk0p2 /mnt
[  147.999133] mtk-msdc 11230000.mmc: phase: [map:fffffff] [maxlen:28] [final:9]
[  148.271952] mtk-msdc 11230000.mmc: phase: [map:fffffff] [maxlen:28] [final:9]
[  148.294032] mtk-msdc 11230000.mmc: phase: [map:fffffff] [maxlen:28] [final:9]
[  148.303078] blk_update_request: I/O error, dev mmcblk0, sector 729088 op 0x1:    (WRITE) flags 0x20800 phys_seg 1 prio class 0
[  148.314516] Buffer I/O error on dev mmcblk0p2, logical block 0, lost sync page     write
[  148.322874] EXT4-fs (mmcblk0p2): I/O error while writing superblock
[  148.330233] EXT4-fs (mmcblk0p2): mount failed
mount: /mnt: can't read superblock on /dev/mmcblk0p2.    

mkfs.ext4 /dev/mmcblk0p2 also triggers tons of same error. Any ideas ? Thanks guys.

Have you created filesystem on ext4-partition (mkefs -t ext4)? You can check with badblocks-command in linux.

For your previous uboot-command you need to pass also a partition to fatload…not only device

fatload mmc dev:part address file

Yes I created ext4 fs on second partition with official SD 4.19. I even managed to check the eMMC filesystems in u-boot (using fatls and extls), it is okay. But latest kernels have troubles mounting eMMC filesystems in RW, it works ok in RO. But I need RW to use the ext4 fs as root filesystem. I compile kernels using your repo and branches 5.4-main, 5.6-main… Could it be a missing kernel parameter ?

My u-boot env: (SD boot)

BPI-R64> printenv
baudrate=115200
boot_kernel=bootm 0x44000000 - 0x47000000
bootargs=console=ttyS0,115200 root=/dev/mmcblk1p2 rw rootwait pci=nomsi
bootcmd=run load_kernel; run load_dtb; run boot_kernel;
bootdelay=2
fdtcontroladdr=7f7fd418
ipaddr=192.168.1.1
load_dtb=fatload mmc 1 0x47000000 bpi-r64.dtb
load_kernel=fatload mmc 1 0x44000000 uImage_nodt
loadaddr=0x4007ff28
serverip=192.168.1.3
[email protected]
[email protected]
[email protected]

You still missing partition in fatload…

I guess fatload fails and you cannot boot kernel…uboot does not mount

Partition in fatload is ok, it takes the first as default which is the vfat partition, which contains kernel. I think my problem is within mediatek emmc kernel drivers but I’m not sure. Are you able to write to emmc with 5.4 ? At least mount it in RW.

Which uboot version do you use? Uboot 2014-04 in official images for r64 contain a bug with emmc (was fixed later in github,but images still have it).

Basicly it was this change (here in my repo because official was rebased at some time):

Can you post uboot-output of fatload+bootm…and maybe bootlog of kernel if it is started

I use u-boot branch 2020-04-bpi-all from your repo. The patch emmc-support is for old u-boot if I am right because this commit is not in 2020-04-bpi-all branch. I uploaded emmc bootlog (with switch to 0 and no SD) until kernel panic. Something in kernel prevents this device to be written correctly.boot.log (27,5 Ko)

Right, patch is for 2014-04…as far as i see in log,uboot is not the problem…have you added ext4-support in your kernel-config? How about booting your kernel from sdcard and then try to mount emmc from there?

Btw. I use this options for rootfs in cmdline:

rootfstype=ext4 rootwait

You use “rw” which i do not use…

Hi yes I have added ext4 and tried to mount emmc partitions from sd boot using same kernel and result is in my first post : Bpi-r64 quick start (boot from eMMC) I can mount the vfat but cannot write to it and there are errors, I can not mount ext4 at all. So to me this looks like mediatek kernel mmc driver bug, or could it be device tree ? Maybe related but /dev/mmcblk0,1 device id switched between 4.19 and 5.4 kernels.

Debugging further, this problem arises because of u-boot 64bits… When using old u-boot and same kernel, same dtb I don’t have issues with MMC. Note that the issue affects SD as well but differently, SD can be mounted (and booted as root filesystem) but everything is very slow, almost unusable. So I don’t know if this is a problem with 64bits or maybe my 2020.04 u-boot does not init MMC properly. I see that mmc init or mmcinit is not a command in u-boot 2020.04 but mmc init exists in old u-boot.

Do you build uboot from my repo? If not can you try build 32bit uboot from my repo (2020-04-bpi)

Yes I did. I tried 2020.04 32bits u-boot and I have same issue. So my bug is not related to 64bits but rather u-boot build. This is very strange because MMC (sd and emmc) works fine in u-boot shell, at least mmc part, mmc info and fs commands.

I don’t think it’s uboot related…i guess more kernel issue…

Which kernel do you use? I have no 5.6-r64-main branch. With beginning 5.4 i manage r2 and r64 in -main (only 5.4 has a separate r64 branch for my reference what to be merged)

i don’t know if i tested uboot with emmc on r64 much…afair only loaded kernel, but without rootfs on emmc

I’m pretty sure it’s u-boot now. Here is my scenario : I have 2 SD, one with old u-boot and one with 2020.04 (32bits to exclude the 64bits hypothesis). They both have the exact same kernel (5.1 checked with shasum) and dtb and with old u boot I manage to get emmc as root filesystem and I cannot with new u-boot. I have attached the two bootlogs. I also notice that mmc requires mmc init in old u-boot which is not required in latest (command is not there), I am suspecting something with that or maybe the patch you mentionned before. boot_new_uboot.log (25,3 Ko) boot_old_uboot.log (43,1 Ko)

Maybe different preloader/atf? Afair there was a issue in early preloaders