[BPI-R64] new image: debian buster for emmc

Hi

i created a basic debian buster-image for r64 EMMC

  • user/pw: root/bananapi
  • lan-Ports have IP 192.168.0.18/24
  • wan-Port is dhcp enabled
  • openssh-server with PermitRootlogin=yes (should be changed if new users are created)
  • Kernel: 5.4-rc1 (currently very limited but can be replaced)

how to flash:

  1. booting with SD-Card and write preloader from here (maybe adjust mmcblk1 to mmcblk0 if mmc-devices swapped in your sd-image):
echo 0 > /sys/block/mmcblk1boot0/force_ro
dd if=preloader_evb7622_64_foremmc.bin of=/dev/mmcblk1boot0
  1. If you have not yet used emmc on your board you have to set PARTITION_CONFIG using mmc-tool (see my second post here) root@bpi-r64:~# ./mmc bootpart enable 1 1 /dev/mmcblk0 mmc-binary is in same gdrive-folder as image

  2. flashing buster-image to emmc-user-Partition

#md5sum -c r64_buster_emmc_rtl8367.img.gz.md5
gunzip r64_buster_emmc_rtl8367.img.gz
dd if=r64_buster_emmc_rtl8367.img of=/dev/mmcblk1
  1. maybe replace uboot (if you need netboot with mt7531-switch)
dd if=u-boot-mtk_r64_emmc_mt7531_gcc8.3.bin of=/dev/mmcblk1 bs=1k seek=768
  1. powerdown + eject sd-card + power up
  2. configure
  • /etc/hostname
  • /etc/resolv.conf (dns-server)
  • /etc/network/interfaces (ip-configuration)
  • /boot/bananapi/bpi-r64/linux/uEnv.txt (kernel+fdt), change/append this if you have new r64 board (mt7531):
kernel=uImage
fdt=mt7622-bananapi-bpi-r64.dtb

Kernel 5.4 with mt7531 is not ready yet

download:

Tried it with my R64. It doesn’t work for me:

# echo 0 > /sys/block/mmcblk0boot0/force_ro
# 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.0360368 s, 4.0 MB/s
# dd if=r64_buster_emmc_rtl8367.img of=/dev/mmcblk0
445051+1 records in
445051+1 records out
227866151 bytes (228 MB, 217 MiB) copied, 29.5415 s, 7.7 MB/s
# dd if=u-boot-mtk_r64_emmc_mt7531_gcc8.3.bin of=/dev/mmcblk0 bs=1k seek=768
256+1 records in
256+1 records out
262232 bytes (262 kB, 256 KiB) copied, 0.0522046 s, 5.0 MB/s

I powered down. Took out MicroSD. Powered up again:

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!

Any ideas? :frowning:

Let me try it,currently tested only on my old board. I guessed only uboot is broken because i used armbian-image and preloader for new board

It seems preloader does not get loaded. Could you try change bootswitch (near back pcie-slot)

Maybe using mmc-utils to check partconf (boot0 active flag)

Will not have much time this weekend :frowning:

have reproduced it on my new r64 (preloader gets not loaded and print only bootrom-numbers), bootswitch made no change…

and it looks like same problem we had on r2

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

after that i see preloader booting

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 039F [000F]                                                            
Jump to BL                                                                      
                                                                                
UNIVPLL_CON0 = 0xFE000000!!!                                                    
mt_pll_init: Set pll frequency for 25M crystal                                  
RAM_CONSOLE preloader last status: 0x0 0x0 0x0 0x0 0x0 0x0                      
[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 0x0000000000000000!=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                             
load lk (ret=-1)                                                                
[BLDR] Second Bootloader Load Failed                                            
PL fatal error...

i had only flashed preloader till now…

i compiled mmcutils from my 4.14-main branch the following way:

utils/mmc$ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make

and uploaded it in the image-dir linked above

Zusammenfassung

btw. on my new r64 i want to try to make boot manually (check bootheaders needed), have now flashed uboot and mbr partition table (from sdcard), but still failing on second bootloader failed

[mmc_init_card]: finish successfully                                                                                                   
[PLFM] Init Boot Device: OK(0)                                                                                                         
[GPT_PL](BPI)Parsing Primary GPT now...                                                                                                
[GPT_PL]check header, err(signature 0x0000000000000000!=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 : 261720                                                                                                                   
[PART] magic: 58881688h                                                                                                                
                                                                                                                                       
[PART] load "lk" from 0x00000000000C0200 (dev) to 0x41E00000 (mem) [SUCCESS]                                                           
[PART] load speed: 11112KB/s, 261720 bytes, 23ms                                                                                       
load lk (ret=0)                                                                                                                        
[get_part] part->nr_sects=768, part->info->name=preloader                                                                              
[get_part] part->nr_sects=512, part->info->name=tee1                                                                                   
load tee1 (ret=-1)                                                                                                                     
[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] tee2 part. not found                                                                                                            
[BLDR] Second Bootloader Load Failed                                                                                                   
PL fatal error...

no idea why now tee2 comes up…maybe we need some more headers on emmc like on sdcard…

sudo dd if=$HEAD0 	of=$O bs=512 seek=0 #0
sudo dd if=$HEAD1 	of=$O bs=512 seek=1 #512 = 0x200

sudo dd if=$PRELOADER 	of=$O bs=1k seek=2 #2k = 0x800

sudo dd if=$ATF 	of=$O bs=1k seek=512 #512k = 0x80000

it seems i need to write all headers above to emmc user-part (also sd-card preloader) to load uboot on emmc

i have added a package with script to initialize emmc (set partition config and write all bootheaders incl. uboot and partitiontable) from a debian-based sdcard-image (uses apt to install dosfstools to format boot-partition)

then you can add any rootfs and kernel to the partitions