Bpi-r64 quick start (boot from eMMC)

Tried both, no success. What really should do that switch in position 0 and what in position 1?

mhm, position 0 is booting emmc first

can you look with mmc-tools about your partition-config?

it should be 0x48

binary (copy to your system) https://github.com/frank-w/BPI-R2-4.14/blob/5.4-r64-main/utils/mmc/mmc

root@bpi-r64:~# ./mmc extcsd read /dev/mmcblk1 | grep 'PARTITION_CONFIG'                                                                                       
Boot configuration bytes [PARTITION_CONFIG: 0x00]
root@bpi-r64:~# ./mmc bootpart enable 1 1 /dev/mmcblk1                                                                                                         
root@bpi-r64:~# ./mmc extcsd read /dev/mmcblk1 | grep 'PARTITION_CONFIG'                                                                                       
Boot configuration bytes [PARTITION_CONFIG: 0x48]

Thanks, it works, really it works up to ‘U-Boot SD CARD’

  *** U-Boot SD CARD ***

     1. System Load Linux to SDRAM via TFTP.
     2. System Load Linux Kernel then write to Flash via TFTP.
     3. Boot Linux from SD.
     4. System Load U-Boot then write to Flash via TFTP.
     5. System Load U-Boot then write to Flash via Serial.
     6. System Load ATF then write to Flash via TFTP.
     7. System Load Preloader then write to Flash via TFTP.
     8. System Load ROM header then write to Flash via TFTP.
     9. System Load CTP then write to Flash via TFTP.
     a. System Load CTP then Boot to CTP (via Flash).
     b. System Load flashimage then write to Flash via TFTP.
     c. System Load partition table then write to Flash via TFTP.
     U-Boot console


  Press UP/DOWN to move or Press 1~9,a~b to choose, ENTER to select

Afterwards I used that your magic piece

dd if=u-boot-mtk_r64_emmc_rtl8367_gcc8.3.bin of=/dev/mmcblk0 bs=1k seek=768

change root and uEnv.txt and finally booted from emmc.

Thanks, Franks.

How does it work, u-boot-mtk_r64_emmc_rtl8367_gcc8.3.bin - how to build it/where is config etc? How you have changed that menu to

  *** U-Boot EMMC ***

     1. Reload Bootmenu
     2. Load Kernel from TFTP.
     3. Boot Linux from SD.
     U-Boot console


  Press UP/DOWN to move or Press 1~9,a~b to choose, ENTER to select

These binaries are build from this tree

See commits on how i changed menu.

You can change menu also with uEnv.txt. my version loads this file before display menu.so you need no recompile.

why using rtl version? As far as i see you have v1 board which has mt7531 switch…

If you don’t need ethernet you can use 2020-01 version from same repo different branch.

hi i try this way but not work always stay on ‘Starting kernel …’

which kernel do you use? which uboot, how do you try to load it?

stock ATF loads 32bit-uboot which switches to 64bot-mode after unpacking uImage. so uImage needs to be 32bit (armhf) and kernel needs to be 64bit

upstream uboot is 64bit which needs 64bit atf and needs 64bit uImage (aarch64) with 64bit kernel

also make sure your debug-console is set right (kernel cmdline vs. uart-order)

Thank you for your reply.:grinning:

first, i use Official Bootloader ‘U-Boot Emmc’ choose

–> (2). System Load Linux Kernel then write to Flash via TFTP

by tftp upload self-compile openwrt kernel ‘initramfs-kernel.bin’ version is 4.19

than always stay on ‘Starting kernel …’

and i use uart tools is minicom and ch341 chip 115200

please tell me where i wrong

thx

i have not done anything on r64 with openwrt…i only loaded linux kernel from uboot without using the flashing menuentries in stock uboot…

try loading your file without the flash command

as you see uboot-menu your uart setup is right so far…only kernel cmdline may not be right (console=…), so you don’t see kernel booting. maybe you can check if system is booted if you can ping router over ethernet (openwrts default ip/dhcp-ip)

just like this

no errer log

no log

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:

[root@alarm ~]# 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
stderr=serial@11002000
stdin=serial@11002000
stdout=serial@11002000

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