Bpi-r64 quick start (boot from eMMC)

@moore : do you have some benchmark of this 5Ghz Wifi card? Can it do 80-90MB/s

Can you please discuss this in another thread because it is off-topic?

tried accessing emmc with own uboot and got this:

BPI-R64> printenv partition                                                     
partition=0:1                                                                   
BPI-R64> ls mmc ${partition}                                                    
** Bad device size - mmc 0 **                                                   
BPI-R64> mmc init                                                               
raise: Signal # 8 caught                                                        
ret2 = 1                                                                        
raise: Signal # 8 caught                                                        
ret2 = 1                                                                        
<= [mmc1 block 0] =>                                                            
[0x00000000] 00 00 00 00 b8 29 f3 46                                            
[0x00000008] d8 1c f3 44 04 00 00 00                                            
[0x00000010] 03 00 00 00 06 00 00 00                                            
[0x00000018] 32 17 f3 44 02 00 00 00                                            
[0x00000020] ff ff ff ff 72 6e f6 46                                            
[0x00000028] ff ff ff ff c4 cc f2 44                                            
[0x00000030] 0a 00 00 00 c0 c2 f5 46                                            
[0x00000038] 0a 00 00 00 ff ff ff ff                                            
[0x00000040] ff ff ff ff 02 00 00 00                                            
[0x00000048] 14 00 00 00 f0 a4 f5 46                                            
[0x00000050] 5c e2 f6 46 5c 18 f4 46                                            
[0x00000058] 18 14 f3 44 28 14 f3 44                                            
[0x00000060] 00 00 00 00 54 87 fa 46                                            
[0x00000068] 18 14 f3 44 1c 1c f4 46                                            
[0x00000070] 28 14 f3 44 19 14 f3 44                                            
[0x00000078] 00 87 fa 46 fc 1d f4 46                                            
[0x00000080] 0e a1 f6 46 00 87 fa 46                                            
[0x00000088] 38 14 f3 44 3c 20 f4 46                                            
[0x00000090] 01 00 00 00 28 14 f3 44                                            
[0x00000098] 94 17 f3 44 3b 14 f3 44                                            
[0x000000a0] 94 17 f3 44 a8 c3 f3 46                                            
[0x000000a8] 78 17 f3 44 30 17 f3 44                                            
[0x000000b0] 00 0c f3 44 58 18 f3 44                                            
[0x000000b8] 78 17 f3 44 00 0c f3 44                                            
[0x000000c0] 58 18 f3 44 90 7b f3 46                                            
[0x000000c8] 8c 75 f3 46 00 0c f3 44                                            
[0x000000d0] 27 0a f3 44 26 0a f3 44                                            
[0x000000d8] 30 17 f3 44 62 6f 6f 74                                            
[0x000000e0] 6d 65 6e 75 5f 33 00 46                                            
[0x000000e8] 30 26 f7 46 00 00 00 00                                            
[0x000000f0] 03 00 00 00 00 00 00 00                                            
[0x000000f8] 00 00 00 00 48 14 f3 44                                            
[0x00000100] 03 00 00 00 04 88 f7 46                                            
[0x00000108] 08 14 f3 44 68 1a f5 46                                            
[0x00000110] 01 00 00 00 38 14 f3 44                                            
[0x00000118] 03 00 00 00 48 14 f3 44                                            
[0x00000120] 00 00 00 00 48 14 f3 44                                            
[0x00000128] 03 00 00 00 f0 1d f5 46                                            
[0x00000130] 48 14 f3 44 cc 29 f7 46                                            
[0x00000138] 00 00 00 00 30 99 f3 46                                            
[0x00000140] 00 00 00 00 00 00 00 00                                            
[0x00000148] 03 00 00 00 e0 25 f3 46                                            
[0x00000150] 04 88 f7 46 00 00 00 00                                            
[0x00000158] 68 13 f3 44 00 00 00 00                                            
[0x00000160] 00 00 00 00 48 14 f3 44                                            
[0x00000168] 60 14 f3 44 e0 3d f3 46                                            
[0x00000170] 00 00 00 00 68 ee f3 46                                            
[0x00000178] 14 00 00 00 14 00 00 00                                            
[0x00000180] 00 00 00 00 00 00 00 00                                            
[0x00000188] 00 00 00 00 a8 14 f3 44                                            
[0x00000190] 00 00 00 00 b8 29 f3 46                                            
[0x00000198] 68 13 f3 44 02 00 00 00                                            
[0x000001a0] 00 00 00 00 03 00 00 00                                            
[0x000001a8] 24 ce f2 44 01 00 00 00                                            
[0x000001b0] 00 00 00 00 00 00 00 00                                            
[0x000001b8] 68 13 f3 44 24 ce f2 44                                            
[0x000001c0] 01 00 00 00 7c 44 f3 46                                            
[0x000001c8] 50 ce f2 44 04 00 f3 46                                            
[0x000001d0] 00 00 00 00 00 00 00 00                                            
[0x000001d8] 00 00 00 00 00 00 00 00                                            
[0x000001e0] 00 00 00 00 c0 14 f3 44                                            
[0x000001e8] 68 13 f3 44 a8 14 f3 44                                            
[0x000001f0] 00 00 00 00 00 00 00 00                                            
[0x000001f8] 00 00 00 00 05 00 00 00                                            
raise: Signal # 8 caught                                                        
## Unknown partition table                                                      
No MMC card found                                                               
BPI-R64> ls mmc 1:1                                                             
** Bad device size - mmc 1 **                                                   
BPI-R64> ls mmc 0:1                                                             
** Bad device size - mmc 0 **                                                   
BPI-R64> 

seems uboot cannot read gpt-partition table…@jglanz have you an idea? tried also setting CONFIG_EFI_PARTITION in mt7622_evb.h in emmc-block without success (to test for efi/gpt-partitions)

also tried to enable CMD_GPT, which also fails because of missing define

 #error CONFIG_PARTITION_UUIDS must be enabled for CONFIG_CMD_GPT to be enabled

seems like i need to only define it without value…but how to handle it?

BPI-R64> gpt
gpt - GUID Partition Table

Usage:
gpt <command> <interface> <dev> <partitions_list>
 - GUID partition table restoration
 Restore GPT information on a device connected
 to interface

BPI-R64>

@Jackzeng @sinovoip have you anywhere a emmc-preloader for r64 which can handle mbr or can guide me to get gpt working in uboot?

maybe uboot looks on wrong hw-partitions? it needs to look on the user-partitions and not e.g. boot0

how can i define that?

i also used mmc-utils to verify PARTCONF

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

maybe emmc-driver is broken in uboot?

BPI-R64> mmc device 0                                                                                                                                               
mmc0 is current device                                                                                                                                              
BPI-R64> mmcinfo                                                                                                                                                    
dev_num = 0                                                                                                                                                         
Device: emmc                                                                                                                                                        
Manufacturer ID: 11                                                                                                                                                 
OEM: 100                                                                                                                                                            
Name: 008G3                                                                                                                                                         
Tran Speed: 52000000                                                                                                                                                
Rd Block Len: 512                                                                                                                                                   
SD version 1.0                                                                                                                                                      
High Capacity: Yes                                                                                                                                                  
Capacity: 7.3 GiB                                                                                                                                                   
Bus Width: 0-bit                                      <<<<<<<<<<<<<                                                                                                              
BPI-R64> mmc read 0x0 8                                                                                                                                             
mmc0 operation                                     <<<<<<<<<<<<<                                                                                                                 
BPI-R64> 

looks strange

Found this:

https://github.com/BPI-SINOVOIP/BPI-R64-BSP/blob/95b2edeed3a54529b0cf8598d52a2badd2069c8a/mt-pack/mtk/bpi-r64/configs/default/linux/preloader_evb7622_64_foremmc.bin

as it is in “normal” linux-kernel-repo i guess it is working for ubuntu/debian-images. i made a diff and it’s not the same preloader as above…

currently flashing official debian to my emmc :wink:

unfortunately offical uboot from debian-image prints similar errors on trying to access emmc. played also a bit with switch near reset which seems to be the mmc-selection-switch, results are the same

it seems that uboot always access the same mmc-device (regardless i add device-number 0/1). if i insert sd-card i can show mmc1 (also if requested mmc0), but if i remove sd-card i cannot access both

also if i boot from emmc (till uboot) and try to boot from sdcard (the one acessable) kernel gets loaded, but boot hangs after ATF

Partition Map for MMC device 1  --   Partition Type: DOS                        
                                                                                
Part    Start Sector    Num Sectors     UUID            Type                    
  1     204800          524288          349e4233-01     0c                      
  2     729088          14211072        349e4233-02     83                      
mmc1 is available                                                               
Interface:  MMC                                                                 
  Device 1: Vendor: Man 000003 Snr 2f115901 Rev: 11.3 Prod: ABLCD�              
            Type: Removable Hard Disk                                           
            Capacity: 30436.5 MB = 29.7 GB (62333952 x 512)                     
Filesystem: FAT16 "BPI-BOOT   "                                                 
Boot from SD                                                                    
reading bananapi/bpi-r64/linux/uEnv.txt                                         
** Unable to read file bananapi/bpi-r64/linux/uEnv.txt **                       
reading uEnv.txt                                                                
3726 bytes read in 2 ms (1.8 MiB/s)                                             
Loaded environment from uEnv.txt                                                
## Error: "uenvcmd" not defined                                                 
reading bananapi/bpi-r64/linux/uImage_5.3.0-rc5-r64-phylink-v2.7.3              
FAT: Misaligned buffer address (4007ff28)                                       
FAT: Misaligned buffer address (40081f28)                                       
FAT: Misaligned buffer address (408fcf28)                                       
9064520 bytes read in 4319 ms (2 MiB/s)                                         
bootm flag=0, states=70f                                                        
## Booting kernel from Legacy Image at 4007ff28 ...                             
   Image Name:   Linux Kernel 5.3.0-rc5-r64-phyli                               
   Image Type:   ARM Linux Kernel Image (uncompressed)                          
   Data Size:    9064456 Bytes = 8.6 MiB                                        
   Load Address: 40080000                                                       
   Entry Point:  40080000                                                       
   Verifying Checksum ... OK                                                    
   Loading Kernel Image ... OK                                                  
                                                                                
Starting kernel ...                                                             
                                                                                
[ATF][   388.984564]save kernel info                                            
[ATF][   388.987766]Kernel_EL2                                                  
[ATF][   388.990523]Kernel is 64Bit                                             
[ATF][   388.993711]pc=0x40080000, r0=0x0, r1=0x0                               
INFO:    BL3-1: Preparing for EL3 exit to normal world, Kernel                  
INFO:    BL3-1: Next image address = 0x40080000                                 
INFO:    BL3-1: Next image spsr = 0x3c9                                         
[ATF][   389.011374]el3_exit

@sinovoip @Jackzeng can you help us getting emmc working with debian/ubuntu?

Both 4.4 kernel and 4.19 have been updated to support eMMC startup, please re-burn preloader

please see this log:

Sd card preloader version number is different from emmc version number

I used preloader from my last post (changed/uploaded also on oct 2nd) and official debian buster

Maybe i need to replace uboot with emmc-version to get emmc-driver buildin?

Have you changed anything there i have not yet in bpi-r64 uboot ?

emmc preloader version number : [BLDR] Build Time: 20190927-141930

You can use this option way to take TFTP burn just use we preloader,Because we talent supports both GPT and msdos partition formats

ok here complete bootlog (same buildtime of preloader in boot0-block)

[BLDR] Build Time: 20190927-141930

full log:

F0: 102B 0000
F5: 480A 0031
F5: 480A 0031
F3: 0000 0000
V0: 0000 0000 [0001]
00: 0000 0000
BP: 0000 0041 [0000]
G0: 0190 0000
T0: 0000 0396 [000F]
Jump to BL

UNIVPLL_CON0 = 0xFE000000!!!
mt_pll_init: Set pll frequency for 25M crystal
[PMIC_WRAP]wrap_init pass,the return value=0.
[pmic_init] Preloader Start..................                                   
[pmic_init] MT6380 CHIP Code, reg_val = 0, 1:E2  0:E3                           
[pmic_init] Done...................                                             
Chip part number:7622A                                                          
MT7622 Version: 1.2.7, (iPA)                                                    
SSC OFF                                                                         
mt_pll_post_init: mt_get_cpu_freq = 1350000Khz                                  
mt_pll_post_init: mt_get_mem_freq = 1600000Khz                                  
mt_pll_post_init: mt_get_bus_freq = 1119920Khz                                  
[PLFM] Init I2C: OK(0)                                                          
                                                                                
[BLDR] Build Time: 20190927-141930                                              
==== Dump RGU Reg ========                                                      
RGU MODE:     4D                                                                
RGU LENGTH:   FFE0                                                              
RGU STA:      0                                                                 
RGU INTERVAL: FFF                                                               
RGU SWSYSRST: 8000                                                              
==== Dump RGU Reg End ====                                                      
RGU: g_rgu_satus:0                                                              
 mtk_wdt_mode_config  mode value=10, tmp:22000010                               
PL P ON                                                                         
WDT does not trigger reboot                                                     
WDT NONRST=0x20000000                                                           
WDT IRQ_EN=0x340003                                                             
RGU mtk_wdt_init:MTK_WDT_DEBUG_CTL(590200F3)                                    
[EMI] MDL number = 2                                                            
[EMI] DRAMC calibration start                                                   
                                                                                
[EMI] DRAMC calibration end                                                     
                                                                                
[EMI]rank0 size: 0x40000000                                                     
[MEM] complex R/W mem test pass                                                 
RAM_CONSOLE wdt status (0x0)=0x0                                                
[mmc_init]: msdc0 start mmc_init_host() in PL...                                
[msdc_init]: msdc0 Host controller intialization start                          
[SD0] Pins mode(1), none(0), down(1), up(2), keep(3)                            
[SD0] Pins mode(2), none(0), down(1), up(2), keep(3)                            
[info][msdc_set_startbit 1127] read data start bit at rising edge               
[info][msdc_config_clksrc] input clock is 400000kHz                             
[SD0] Bus Width: 1                                                              
[info][msdc_config_clksrc] input clock is 400000kHz                             
[info][msdc_set_startbit 1127] read data start bit at rising edge               
[SD0] SET_CLK(260kHz): SCLK(259kHz) MODE(0) DDR(0) DIV(385) DS(0) RS(0)         
[msdc_init]: msdc0 Host controller intialization done                           
[mmc_init]: msdc0 start mmc_init_card() in PL...                                
[mmc_init_card]: start                                                          
[info][msdc_config_clksrc] input clock is 400000kHz                             
[info][msdc_set_startbit 1127] read data start bit at rising edge               
[SD0] SET_CLK(260kHz): SCLK(259kHz) MODE(0) DDR(0) DIV(385) DS(0) RS(0)         
[SD0] Bus Width: 8                                                              
[SD0] Switch to High-Speed mode!                                                
[info][msdc_config_clksrc] input clock is 400000kHz                             
[info][msdc_set_startbit 1127] read data start bit at rising edge               
[SD0] SET_CLK(260kHz): SCLK(259kHz) MODE(2) DDR(1) DIV(192) DS(0) RS(0)         
[SD0] Bus Width: 8                                                              
[SD0] Size: 7456 MB, Max.Speed: 52000 kHz, blklen(512), nblks(15269888), ro(0)  
[mmc_init_mem_card 3140][SD0] Initialized, eMMC50                               
before host->cur_bus_clk(259740)                                                
[info][msdc_config_clksrc] input clock is 400000kHz                             
[info][msdc_set_startbit 1127] read data start bit at rising edge               
[SD0] SET_CLK(52000kHz): SCLK(50000kHz) MODE(2) DDR(1) DIV(1) DS(0) RS(0)       
host->cur_bus_clk(50000000)                                                     
[mmc_init_card]: finish successfully                                            
[PLFM] Init Boot Device: OK(0)                                                  
[GPT_PL](BPI)Parsing Primary GPT now...                                         
[GPT_PL]check header, err(signature 0x00000054594C5242!=0x5452415020494645)     
[GPT_PL]Success to find valid GPT.                                              
                                                                                
[PART] blksz: 512B                                                              
[PART] [0x0000000000020000-0x000000000007FFFF] "preloader" (768 blocks)         
[PART] [0x0000000000080000-0x00000000000BFFFF] "tee1" (512 blocks)              
[PART] [0x00000000000C0000-0x000000000013FFFF] "lk" (1024 blocks)               
                                                                                
Device APC domain init setup:                                                   
                                                                                
Domain Setup (0x0)                                                              
Domain Setup (0x0)                                                              
Device APC domain after setup:                                                  
Domain Setup (0x0)                                                              
Domain Setup (0x0)                                                              
[get_part] part->nr_sects=768, part->info->name=preloader                       
[get_part] part->nr_sects=512, part->info->name=tee1                            
[get_part] part->nr_sects=1024, part->info->name=lk                             
[PART] Image with part header                                                   
[PART] name : LK                                                                
[PART] addr : FFFFFFFFh mode : -1                                               
[PART] size : 364756                                                            
[PART] magic: 58881688h                                                         
                                                                                
[PART] load "lk" from 0x00000000000C0200 (dev) to 0x41E00000 (mem) [SUCCESS]    
[PART] load speed: 11490KB/s, 364756 bytes, 31ms                                
load lk (ret=0)                                                                 
[get_part] part->nr_sects=768, part->info->name=preloader                       
[get_part] part->nr_sects=512, part->info->name=tee1                            
[PART] Image with part header                                                   
[PART] name : atf                                                               
[PART] addr : FFFFFFFFh mode : -1                                               
[PART] size : 62032                                                             
[PART] magic: 58881688h                                                         
                                                                                
[PART] load "tee1" from 0x0000000000080200 (dev) to 0x43000DC0 (mem) [SUCCESS]  
[PART] load speed: 6730KB/s, 62032 bytes, 9ms                                   
load tee1 (ret=0)                                                               
[BLDR] bldr load tee part ret=0x0, addr=0x43001000                              
[get_part] part->nr_sects=768, part->info->name=preloader                       
[get_part] part->nr_sects=512, part->info->name=tee1                            
[get_part] part->nr_sects=1024, part->info->name=lk                             
[BLDR] boot part. not found                                                     
[BLDR] part_load_images ret=0x0                                                 
[BLDR] Others, jump to ATF                                                      
                                                                                
[BLDR] jump to 0x41E00000                                                       
[BLDR] <0x41E00000>=0xEA00000F                                                  
[BLDR] <0x41E00004>=0xE59FF014                                                  
                                                                                
                                                                                
U-Boot  (Aug 21 2019 - 15:58:07)                                                
                                                                                
DRAM:  1008 MiB                                                                 
WARNING: Caches not enabled                                                     
NAND:  Recognize SNAND: ID [ef aa ], Device Name [Winbond 1Gb], Page Size [2048B
[mtk_snand] probe successfully!                                                 
128 MiB                                                                         
dev_num = 1                                                                     
raise: Signal # 8 caught                                                        
raise: Signal # 8 caught                                                        
***size=4096, offset=1310720, blk_start=0, blk_cnt=0                            
*** Warning - bad CRC, using default environment                                
                                                                                
In:    serial                                                                   
Out:   serial                                                                   
Err:   serial                                                                   
dev_num = 1                                                                     
raise: Signal # 8 caught                                                        
raise: Signal # 8 caught                                                        
***size=4096, offset=1310720, blk_start=0, blk_cnt=0                            
*** Warning - bad CRC, using default environment                                
                                                                                
Net:   mtk_eth                                                                  
Uip activated                                                                   


  *** 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





raise: Signal # 8 caught
ret2 = 1
raise: Signal # 8 caught
ret2 = 1
<= [mmc1 block 0] =>
[0x00000000] a4 ba f1 7c 74 82 f4 7e
[0x00000008] 06 00 00 00 ac df f2 7e
[0x00000010] cc be f1 7c 1b 5b 31 3b
[0x00000018] 31 48 00 7e 00 00 00 00
[0x00000020] 0a 00 00 00 30 cb f2 7e
[0x00000028] 00 00 00 00 00 00 00 00
[0x00000030] d4 ba f1 7c 74 82 f4 7e
[0x00000038] 07 00 00 00 ac df f2 7e
[0x00000040] 01 00 00 00 58 01 00 00
[0x00000048] 00 00 00 00 00 00 00 00
[0x00000050] f4 ba f1 7c 74 82 f4 7e
[0x00000058] 0e 00 00 00 ac df f2 7e
[0x00000060] 1c bf f1 7c 55 69 70 20
[0x00000068] 61 63 74 69 76 61 74 65
[0x00000070] 64 0a 00 70 43 70 54 e5
[0x00000078] 26 50 c2 e6 67 8c 42 e6
[0x00000080] 95 bb 82 04 1e 71 6f a8
[0x00000088] 20 28 84 e8 8d 2b 85 64
[0x00000090] 04 01 e1 20 00 84 20 44                                            
[0x00000098] d1 1e 90 38 d8 7e f8 1c                                            
[0x000000a0] 45 c0 0e c2 2c d8 8a 3d                                            
[0x000000a8] a5 e0 02 48 c1 1c 14 c4                                            
[0x000000b0] 21 7a 43 d2 cd 22 b6 4a                                            
[0x000000b8] 3a 94 2b ac 04 09 44 b9                                            
[0x000000c0] 2a 0a 41 98 65 48 c0 b5                                            
[0x000000c8] 1d 31 0e 90 9a f3 00 86                                            
[0x000000d0] ca 22 11 0a 00 96 68 70                                            
[0x000000d8] 69 a3 66 62 6f 23 0e 89                                            
[0x000000e0] 80 d5 00 bc 09 e0 26 ec                                            
[0x000000e8] ea 26 d0 3b 24 cc 96 40                                            
[0x000000f0] 82 04 0f 29 f5 eb b4 35                                            
[0x000000f8] 0d 48 db 58 08 51 1d 41                                            
[0x00000100] 20 01 1f 2f c2 22 10 43                                            
[0x00000108] 06 30 4a 04 b8 22 50 49                                            
[0x00000110] 01 46 93 80 90 01 88 0d                                            
[0x00000118] 32 05 f7 22 f4 60 03 98                                            
[0x00000120] 1c 21 12 df 2e c0 a7 af                                            
[0x00000128] 18 01 90 14 12 48 a1 35                                            
[0x00000130] b5 72 2c 87 63 43 03 51                                            
[0x00000138] 5b 8b 04 2e 03 d0 20 e9                                            
[0x00000140] 01 97 11 54 03 55 56 d0                                            
[0x00000148] 0b 26 87 d2 2d 93 85 52                                            
[0x00000150] 88 88 11 30 d1 69 6a 72                                            
[0x00000158] 01 15 a2 51 00 21 98 a3                                            
[0x00000160] 6e 4b b0 c5 84 40 20 52                                            
[0x00000168] 24 f8 cf d0 30 20 e0 93                                            
[0x00000170] c2 49 52 4e c4 48 01 02                                            
[0x00000178] 6b d2 09 3d cc 8a 25 41                                            
[0x00000180] 4d 97 65 b1 06 30 81 11                                            
[0x00000188] 02 0e 40 50 96 50 90 54                                            
[0x00000190] 20 74 cc 20 84 ea 41 c1                                            
[0x00000198] 6b 6d 34 76 91 49 ac 49                                            
[0x000001a0] 9b 70 1c 10 9c da 54 d0                                            
[0x000001a8] 61 14 c0 00 c6 31 24 56                                            
[0x000001b0] 12 30 08 76 42 30 f6 18                                            
[0x000001b8] 04 a7 c1 20 a0 a8 42 08                                            
[0x000001c0] 60 22 10 20 31 33 93 26                                            
[0x000001c8] 09 9e 5a 57 e2 9a 62 9f                                            
[0x000001d0] 24 fa 48 3c c0 ab 21 f2                                            
[0x000001d8] 20 bb cf 20 f0 f0 19 b4                                            
[0x000001e0] 56 0a 0a d4 43 a4 ac 50                                            
[0x000001e8] 8a 30 2b d5 41 62 22 81                                            
[0x000001f0] 34 08 55 a6 94 c0 80 30                                            
[0x000001f8] 00 ec 44 3b 4d 8a 2c f8                                            
raise: Signal # 8 caught                                                        
## Unknown partition table                                                      
No MMC card found                                                               
** Bad device size - mmc 1 **                                                   
Boot from eMMC                                                                  
raise: Signal # 8 caught                                                        
ret2 = 1                                                                        
raise: Signal # 8 caught                                                        
ret2 = 1                                                                        
<= [mmc1 block 0] =>                                                            
[0x00000000] 9d f8 b1 65 ab 00 c3 86                                            
[0x00000008] c2 82 8c cf b9 ed 0d 10                                            
[0x00000010] 27 e4 0c b1 b2 85 08 a8                                            
[0x00000018] 00 00 00 00 00 00 00 00                                            
[0x00000020] 00 00 00 00 00 00 00 00                                            
[0x00000028] a4 e5 f6 7e 00 00 00 00                                            
[0x00000030] 30 3f f2 7c 00 f9 f1 7e                                            
[0x00000038] 00 00 00 00 00 00 00 00                                            
[0x00000040] 70 3e f2 7c 30 3f f2 7c                                            
[0x00000048] 48 3f f2 7c 00 00 00 00                                            
[0x00000050] 00 00 00 00 4c 11 f2 7e                                            
[0x00000058] 00 00 00 00 90 f2 f2 7e                                            
[0x00000060] 14 00 00 00 00 00 00 00                                            
[0x00000068] 00 00 00 00 00 00 00 00                                            
[0x00000070] 00 00 00 00 00 00 00 00                                            
[0x00000078] 00 00 00 00 cc fc f1 7e                                            
[0x00000080] 70 3e f2 7c 00 00 00 00                                            
[0x00000088] 03 00 00 00 02 00 00 00                                            
[0x00000090] 2c ba f1 7c 00 00 00 00                                            
[0x00000098] 01 00 00 00 00 00 00 00                                            
[0x000000a0] 00 00 00 00 2c ba f1 7c                                            
[0x000000a8] 00 00 00 00 cc 17 f2 7e                                            
[0x000000b0] 00 00 00 00 04 00 f3 7e                                            
[0x000000b8] 00 00 00 00 00 00 00 00                                            
[0x000000c0] 00 00 00 00 00 00 00 00                                            
[0x000000c8] 00 00 00 00 a8 3f f2 7c                                            
[0x000000d0] 70 3e f2 7c 90 3f f2 7c                                            
[0x000000d8] 00 00 00 00 00 00 00 00                                            
[0x000000e0] 00 00 00 00 05 00 00 00                                            
[0x000000e8] 58 3e f2 7c 05 00 00 00                                            
[0x000000f0] d8 3c f2 7c 9c fb f1 7e                                            
[0x000000f8] d0 04 f2 7e 00 00 00 00                                            
[0x00000100] 00 00 00 00 b0 0a f2 7e                                            
[0x00000108] 58 3e f2 7c 68 3e f2 7c                                            
[0x00000110] 01 00 00 00 01 00 00 00                                            
[0x00000118] 9c fb f1 7e d0 04 f2 7e                                            
[0x00000120] 58 3e f2 7c 00 00 00 00                                            
[0x00000128] d8 3c f2 7c 58 3e f2 7c                                            
[0x00000130] 00 00 00 00 fc 10 f2 7e                                            
[0x00000138] 18 00 00 00 90 f2 f2 7e                                            
[0x00000140] 14 00 00 00 00 00 00 00                                            
[0x00000148] 00 00 00 00 00 00 00 00                                            
[0x00000150] 00 00 00 00 00 00 00 00                                            
[0x00000158] 00 00 00 00 cc fc f1 7e                                            
[0x00000160] d8 3c f2 7c 00 00 00 00                                            
[0x00000168] 03 00 00 00 02 00 00 00                                            
[0x00000170] 0c bb f1 7c 00 00 00 00                                            
[0x00000178] 01 00 00 00 00 00 00 00                                            
[0x00000180] 00 00 00 00 0c bb f1 7c                                            
[0x00000188] 00 00 00 00 cc 17 f2 7e                                            
[0x00000190] 0a 00 00 00 04 00 f2 7e                                            
[0x00000198] 00 00 00 00 00 00 00 00                                            
[0x000001a0] 00 00 00 00 00 00 00 00                                            
[0x000001a8] 00 00 00 00 30 3e f2 7c                                            
[0x000001b0] d8 3c f2 7c 18 3e f2 7c                                            
[0x000001b8] 00 00 00 00 00 00 00 00                                            
[0x000001c0] 00 00 00 00 03 00 00 00                                            
[0x000001c8] a0 2b f2 7c 03 00 00 00                                            
[0x000001d0] b8 3c f2 7c 9c fb f1 7e                                            
[0x000001d8] d0 04 f2 7e 01 00 00 00                                            
[0x000001e0] 03 00 00 00 84 0a f2 7e                                            
[0x000001e8] 00 00 00 00 ce 3c f2 7c                                            
[0x000001f0] 28 36 f2 7c 03 00 00 00                                            
[0x000001f8] 00 00 00 00 01 00 00 00                                            
raise: Signal # 8 caught                                                        
## Unknown partition table                                                      
No MMC card found                                                               
** Bad device size - mmc 0 **                                                   
** Bad device size - mmc 0 **                                                   
## Error: "uenvcmd" not defined                                                 
** Bad device size - mmc 0 **                                                   
bootm flag=0, states=70f                                                        
Wrong Image Format for bootm command                                            
ERROR: can't get kernel image!                                                  
bootm flag=0, states=70f                                                        
Wrong Image Format for bootm command                                            
ERROR: can't get kernel image!                                                  
BPI-IoT> 

used this preloader: https://github.com/BPI-SINOVOIP/BPI-R64-BSP/blob/95b2edeed3a54529b0cf8598d52a2badd2069c8a/mt-pack/mtk/bpi-r64/configs/default/linux/preloader_evb7622_64_foremmc.bin

and this image: 2019-08-23-debian-10-buster-lite-preview-bpi-r64-sd-emmc.img from here: BPI-R64 Ubuntu 16.04 & AArch64 Linux Lite & Debian 10 Buster Lite Demo Images Release 2019-08-23

And wrote them this way to emmc:

echo 0 > /sys/block/mmcblk1boot0/force_ro
dd if=preloader_evb7622_64_foremmc.bin of=/dev/mmcblk1boot0
unzip -p 2019-08-23-debian-10-buster-lite-preview-bpi-r64-sd-emmc.img.zip | dd of=/dev/mmcblk1 bs=1M

from sd-boot i get this when starting gdisk for emmc:

GPT fdisk (gdisk) version 1.0.1                                                 
                                                                                
Caution: invalid main GPT header, but valid backup; regenerating main header    
from backup!                                                                    
                                                                                
Caution! After loading partitions, the CRC doesn't check out!                   
Warning! Main partition table CRC mismatch! Loaded backup partition table       
instead of main partition table!                                                
                                                                                
Warning! One or more CRCs don't match. You should repair the disk!              
                                                                                
Partition table scan:                                                           
  MBR: MBR only                                                                 
  BSD: not present                                                              
  APM: not present                                                              
  GPT: damaged                                                                  
                                                                                
Found valid MBR and corrupt GPT. Which do you want to use? (Using the           
GPT MAY permit recovery of GPT data.)                                           
 1 - MBR                                                                        
 2 - GPT                                                                        
 3 - Create blank GPT                                                           
                                                                                
Your answer:

hi, i see also the raise errors and unknown partitiontable (where i do not know if it is from sd or emmc)

mmc-part of preloader-output looks same as in your log

[mmc_init_mem_card 3140][SD0] Initialized, eMMC50                               
before host->cur_bus_clk(259740)                                                
[info][msdc_config_clksrc] input clock is 400000kHz                             
[info][msdc_set_startbit 1127] read data start bit at rising edge               
[SD0] SET_CLK(52000kHz): SCLK(50000kHz) MODE(2) DDR(1) DIV(1) DS(0) RS(0)       
host->cur_bus_clk(50000000)                                                     
[mmc_init_card]: finish successfully   

i wonder about this (needed for emmc to work?):

NAND: Recognize SNAND: ID [ef aa 21 ], Device Name [Winbond 1Gb], Page Size [2048]B Spare Size [64]B Total Size [128]MB
[mtk_snand] probe successfully!

[BBT] BMT.v2 is found at 0x3ff

also i see you have a newer build of uboot (not the one from the ubuntu-image)

U-Boot  (Oct 02 2019 - 15:01:05)

and you use a ubuntu 18.4 image i have not found yet (only 16.4 for r64). also in your wiki there is only ubuntu 16.4.

i guess you have changes in uboot/image (atf, bootheaders, …) which are not yet public

tried to fix emmc-boot like it’s done here:

using id instead of fixed “1”, but this leads to uboot-crash (maybe unaligned access)

Net:   mtk_eth                                                                                                                                     
Uip activated                                                                                                                                      
Hit any key to stop autoboot:  0                                                                                                                   
raise: Signal # 8 caught                                                                                                                           
ret2 = 1                                                                                                                                           
raise: Signal # 8 caught                                                                                                                           
ret2 = 1                                                                                                                                           
data abort                                                                                                                                         
pc : [<7ef4921c>]          lr : [<7ef494c4>]                                                                                                       
sp : 7cf297b8  ip : 7ef6f614     fp : 7ef39b6c                                                                                                     
r10: 00000002  r9 : 7cf29f40     r8 : 00000001                                                                                                     
r7 : 00000001  r6 : 7ef6f620     r5 : 7ef6f649  r4 : 7ef7a380                                                                                      
r3 : 00000000  r2 : 7ef6f620     r1 : 7ef6856f  r0 : 00000001                                                                                      
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32                                                                                                       
Resetting CPU ...

r64-uboot-emmc.patch (2,1 KB) for patching my bpi-r64 branch

@ray can you please decode the binary uploaded here: https://drive.google.com/open?id=1rLtG_nwjnfrbO0iXg0ezeB9SipUYk1fl to the crash-location

personal debugger? :slight_smile:

:stuck_out_tongue: if you can say me how to do it by myself :wink: but it seems that linaro objdump does not work like yours

objdump in that case

objdump -d u-boot > u-boot.asm

you’re right…i meant objdump…

arg…it looks like i have missed patching mmcinfo-helper-function itself (only changed forward declaration)

Partition Map for MMC device 0  --   Partition Type: DOS                                                                                           
                                                                                                                                                   
Part    Start Sector    Num Sectors     UUID            Type                                                                                       
  1     204800          524288          e43da9c5-01     0c                                                                                         
  2     729088          14211072        e43da9c5-02     83                                                                                         
mmc0 is available                                                                                                                                  
BPI-R64>
BPI-R64> ls mmc 0:1 bananapi/bpi-r64/linux                                                                                                         
            ./                                                                                                                                     
            ../                                                                                                                                    
 12500539   uimage                                                                                                                                 
     1011   uenv.txt                                                                                                                               
            dtb/                                                                                                                                   
                                                                                                                                                   
2 file(s), 3 dir(s)                                                                                                                                

this is my emmc :wink: (sd removed) :champagne:

and finally can load kernel from emmc and boot it (currently with buildroot initrd) :wink:

way is free to create debian buster-image for emmc

uploaded uboot-binaries to my gdrive

  • u-boot-mtk_r64_emmc_mt7531_gcc8.3.bin
  • u-boot-mtk_r64_emmc_rtl8367_gcc8.3.bin

to reflash ubuntu/debian-image for emmc-usage (maybe after flashing image to emmc)

https://drive.google.com/open?id=1Vg3eoHpx3nlZ9pTCZdDpC2l1pJ4rQh5i

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

That works for the normal OpenWrt build. But if the OpenWrt included many third-party modules, the initramfs-kernel.bin may bigger than 20MB+, after load that kernel into flash via TFTP, the kernel decompress failed with error “Uncompressing Kernel Image … LZMA: uncompress or overwrite error 1”. I think it’s the kernel partition is too small to fit the big kernel. But i don’t know how to modify the kernel partition size. Could you please tell me how to?

Have a nice day! Is there a fresh working firmware assembly OpenWrt/LEDE?

Hi all,

I tried to boot from eMMC but failed. Neither using U-Boot Menu nor explicit commands

echo 0 > /sys/block/mmcblk0boot0/force_ro
dd if=preloader_evb7622_64_foremmc.bin of=/dev/mmcblk0boot0

from https://github.com/BPI-SINOVOIP/BPI-R64-BSP/blob/95b2edeed3a54529b0cf8598d52a2badd2069c8a/mt-pack/mtk/bpi-r64/configs/default/linux/preloader_evb7622_64_foremmc.bin

helped. I always get

F0: 102B 0000
F6: 3800 00A0
F3: 4000 0036
F5: 480A 0031
F5: 480A 0031
00: 1005 0000
F6: 3800 00A0
F3: 4000 0036
F5: 480A 0031
F5: 480A 0031
01: 102A 0001
02: 1005 0000
BP: 0000 00C0 [0001]
T0: 0000 0365 [000F] 
System halt!

What is the problem?

I successfully boot from SD. Also, I managed to change root partition in uEnv.txt file to eMMC’ one and load system from eMMC, but not the kernel.

I many times toggled Boot select switch (physical), but not understand how it works. It seems it doesn’t work with my BPI-R64, that is I got boot from SD in either cases and cannot boot anyhow without it.

That means that preloader does not get loaded…only bootrom.

You have executed the 2 lines from system booted by sdcard? Any error-message?

No, no errors. The output:

root@bpi-iot-ros-ai:~# curl -O https://raw.githubusercontent.com/BPI-SINOVOIP/BPI-R64-BSP/95b2edeed3a54529b0cf8598d52a2badd2069c8a/mt-pack/mtk/bpi-r64/configs/default/linux/preloader_evb7622_64_foremmc.bin
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  140k  100  140k    0     0   137k      0  0:00:01  0:00:01 --:--:--  137k

root@bpi-iot-ros-ai:~# md5sum ./preloader_evb7622_64_foremmc.bin 
d8b8a577e2098ef1f98c610f4358ee77  ./preloader_evb7622_64_foremmc.bin
root@bpi-iot-ros-ai:~# echo 0 > /sys/block/mmcblk0boot0/force_ro
root@bpi-iot-ros-ai:~# echo 0 > /sys/block/mmcblk0boot1/force_ro
root@bpi-iot-ros-ai:~# cat /sys/block/mmcblk0boot0/force_ro /sys/block/mmcblk0boot1/force_ro
0
0

root@bpi-iot-ros-ai:~# dd if=preloader_evb7622_64_foremmc.bin of=/dev/mmcblk0boot0
280+0 records in
280+0 records out
143360 bytes (143 kB, 140 KiB) copied, 0.0320713 s, 4.5 MB/s

root@bpi-iot-ros-ai:~# dd if=preloader_evb7622_64_foremmc.bin of=/dev/mmcblk0boot1
280+0 records in
280+0 records out
143360 bytes (143 kB, 140 KiB) copied, 0.0290717 s, 4.9 MB/s

root@bpi-iot-ros-ai:~# dd if=/dev/mmcblk0boot0 of=preloader_evb7622_64_foremmc.bin_2 bs=143360 count=1
1+0 records in
1+0 records out
143360 bytes (143 kB, 140 KiB) copied, 0.00945774 s, 15.2 MB/s

root@bpi-iot-ros-ai:~# diff --brief ./preloader_evb7622_64_foremmc.bin ./preloader_evb7622_64_foremmc.bin_2 
root@bpi-iot-ros-ai:~# echo $?
0

poweroff, remove SD card

F0: 102B 0000
F5: 480A 0031
F5: 480A 0031
F3: 4000 0036
F2: 300C 0000
00: 1005 0000
F5: 480A 0031
F5: 480A 0031     
F3: 4000 0036
F2: 300C 0000 
01: 102A 0001
02: 1005 0000
BP: 0000 00C0 [0001] 
T0: 0000 035F [000F] 
System halt!

tried bootswitch? in 0-position? make sure it snaps into position…

bootswitch selects first boot-device