0

I have built mainline U-Boot, with following commands:

make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- -j3 Bananapi_M2_Ultra_defconfig
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- -j3

... and Linux 4.18, trying to run it on the Banana Pi M2-Berry computer (it seems that the Ultra and Berry versions works with the same software). The bootloader loads fine. I haven't yet configured it, so I am trying to boot the kernel specifying necessary commands manually (the .dtb file was built using kernel tree):

=> setenv bootargs "earlyprintk=sunxi-uart,0x01c28000 console=tty1 console=ttyS0,115200n8 console=tty0 sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait"
=> fatload mmc 0 0x43000000 sun8i-r40-bananapi-m2-ultra.dtb
11655 bytes read in 4 ms (2.8 MiB/s)
=> fatload mmc 0 0x47000000 uImage
5575128 bytes read in 262 ms (20.3 MiB/s)
=> bootm 0x47000000 - 0x43000000
## Booting kernel from Legacy Image at 47000000 ...
   Image Name:   Linux-4.18.0-k4be
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5575064 Bytes = 5.3 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 43000000
   Booting using the fdt blob at 0x43000000
   Loading Kernel Image ... OK
   Loading Device Tree to 49ffa000, end 49fffd86 ... OK

Starting kernel ...

At this moment, the system hangs indefinitely.

I have managed to download and run some working SD card image. The kernel there starts with the commands:

setenv bootargs "board=bpi-m2u console=earlyprintk=sunxi-uart,0x01c28000 console=tty1 console=ttyS0,115200n8 no_console_suspend consoleblank=0 root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait bootmenutimeout=10 datadev=mmcblk0p2 service=linux bpiuser=720p mac_addr=? enforcing=1 initcall_debug=0 loglevel=8 init=/bin/bash cma=256M panic=10 disp.screen0_output_type=3 disp.screen0_output_mode=5 disp.screen1_output_type=3 disp.screen1_output_mode=5"
fatload mmc 0:1 0x47000000 bananapi/bpi-m2u/linux/uImage
fatload mmc 0:1 0x49000000 bananapi/bpi-m2u/linux/uInitrd
bootm 0x47000000 0x49000000

Trying to run their kernel using my bootloader and these exact commands also fails with "Starting kernel" hang. (I was unable to get their bootloader to load my kernel because of MMC errors being displayed.)

The prominent difference between the working and non-working system is the u-boot starting process. Mine outputs the following:

U-Boot SPL 2018.09-rc2 (Aug 17 2018 - 01:25:32 +0200)
DRAM: 1024 MiB
Trying to boot from MMC1


U-Boot 2018.09-rc2 (Aug 17 2018 - 01:25:32 +0200) Allwinner Technology

CPU:   Allwinner R40 (SUN8I 1701)
Model: Banana Pi BPI-M2-Ultra
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0, SUNXI SD/MMC: 1
Loading Environment from FAT... Card did not respond to voltage select!
In:    serial@1c28000
Out:   serial@1c28000
Err:   serial@1c28000
SCSI:  SATA link 0 timeout.
AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part ccc apst 

Net:   phy interface7
eth0: ethernet@1c50000
starting USB...
No controllers found
Hit any key to stop autoboot:  0 

The working one prints much more informations (although i can't find any hint in these):

[     0.33]HELLO! BOOT0 is starting!
[     0.37]boot0 commit : 2320b4e28f694a40302a75531ea057ca7fcc0074

[     0.44]boot0 version : 4.0
[     0.47]set pll start
[     0.51]set pll end
[     0.87]rtc[0] value = 0x00000000
[     0.90]rtc[1] value = 0x00000000
[     0.93]rtc[2] value = 0x00000000
[     0.97]rtc[3] value = 0x00000000
[     0.100]rtc[4] value = 0x00000000
[     0.103]rtc[5] value = 0x00000000
[     0.107]DRAMC IS FOUR
[     0.109]DRAM BOOT DRIVE INFO: V1.1
[     0.113]the chip id is 0x00000001
[     0.116]the chip id is 0x00000001
[     0.120]the chip id is 0x00000001
[     0.123]the chip id is 0x00000001
[     0.127]the chip id is 0x00000001
[     0.134]PMU: [     0.135]AXP221
[     0.137]ddr voltage = 1250 mv
[     0.144]PMU: [     0.145]AXP221
[     0.147]ddr voltage = 1250 mv
[     0.158]PMU: [     0.159]AXP221
[     0.161]ddr voltage = 1500 mv
[     0.172]DRAM CLK =576 MHZ
[     0.174]DRAM Type =3 (2:DDR2,3:DDR3,6:LPDDR2,7:LPDDR3)
[     0.180]DRAM zq value: 0x003b3bfb
[     0.186]DRAM SIZE =1024 M
[     0.189]DRAM simple test OK.
[     0.192]dram size =1024
[     0.194]rtc standby flag is 0x00000000, super standby flag is 0x00000000
[     0.203]card no is 0
[     0.205]sdcard 0 line count 4
[     0.208][mmc]: mmc driver ver 2016-07-01 15:30
[     0.212][mmc]: sdc0 spd mode error, 2
[     0.225][mmc]: Wrong media type 0x00000000
[     0.229][mmc]: ***Try SD card 0***
[     0.239][mmc]: HSSDR52/SDR25 4 bit
[     0.242][mmc]: 50000000 Hz
[     0.245][mmc]: 14832 MB
[     0.247][mmc]: ***SD/MMC 0 init OK!!!***
[     0.354]Loading boot-pkg Succeed(index=0).
[     0.358]Entry_name        = u-boot
[     0.377]Ready to disable icache.
[     0.380]Jump to secend Boot.


U-Boot 2014.07 (Nov 11 2017 - 19:07:47) Allwinner Technology 

uboot commit : 8 
i2c_init ok
[      0.446]pmbus:   ready
[      0.465]PMU: AXP221
[      0.465]PMU: AXP22x found
[      0.466]PMU: dcdc2 1160
[      0.468]PMU: cpux 1008 Mhz,AXI=336 Mhz
PLL6=600 Mhz,AHB1=200 Mhz, APB1=100Mhz  MBus=400Mhz
set power on vol to default
dcdc1_vol = 3300, onoff=1
dcdc2_vol = 1160, onoff=1
dcdc3_vol = 1100, onoff=1
dcdc4_vol = 1100, onoff=0
aldo1_vol = 2800, onoff=0
aldo2_vol = 1500, onoff=1
aldo3_vol = 3000, onoff=1
dc1sw_vol = 3000, onoff=0
dc5ldo_vol = 1100, onoff=0
dldo1_vol = 3300, onoff=0
dldo2_vol = 3300, onoff=0
dldo3_vol = 3300, onoff=0
dldo4_vol = 2500, onoff=0
eldo1_vol = 2800, onoff=0
eldo2_vol = 1500, onoff=0
eldo3_vol = 1200, onoff=0
gpio0_vol = 3300, onoff=0
gpio1_vol = 1800, onoff=0
find power_sply to end
vbus exist
BPI: bpi_boot_init_gpio ...
set pin for gpio_pin_1
set pin for gpio_pin_2
set pin for gpio_pin_3
set pin for gpio_pin_4
run key detect
BPI: BPI-M2 Berry 1.0 
bpi_board_version: [2e]
no key found
no uart input
DRAM:  1 GiB
fdt addr: 0x76e81c78
Relocation Offset is: 35ed8000
In:    serial
Out:   serial
Err:   serial
gic: normal mode
[      0.696]start
drv_disp_init
init_clocks: finish init_clocks.
pwm_request: reg = 0x1c23400. pwm = 0.
request pwm success, pwm = 0.
tv_init:
tv_init:
drv_disp_init finish
boot_disp.output_disp=0
boot_disp.output_type=3
boot_disp.output_mode=5
boot_disp.auto_hpd=1
disp0 device type(4) enable
attched ok, mgr0<-->device0, type=4, mode=5
[      1.378]end
workmode = 0,storage type = 1
[      1.378]MMC:    0
[mmc]: mmc driver ver 2016-07-01 15:50:00
[mmc]: boot_card_no error 1
SUNXI SD/MMC: 0
[mmc]: 50 MHz...
[mmc]: sample: 53 - 188(ps)
[mmc]: 100 MHz...
[mmc]: sample: 26 - 192(ps)
[mmc]: 200 MHz...
[mmc]: sample: 13 - 192(ps)
[mmc]: BPI: 0 CARD_TYPE_SD
[mmc]: media type 0x8000001
[mmc]: ************Try SD card 0************
[mmc]: host caps: 0x27
[mmc]: MID 41 PSN 521001cd
[mmc]: PNM SD16G -- 0x53-44-31-36-47
[mmc]: PRV 3.0
[mmc]: MDT m-6 y-2018
[mmc]: speed mode     : HSSDR52/SDR25 
[mmc]: clock          : 50000000 Hz
[mmc]: bus_width      : 4 bit
[mmc]: user capacity  : 14832 MB
[mmc]: ************SD/MMC 0 init OK!!!************
[mmc]: erase_grp_size      : 0x1WrBlk*0x200=0x200 Byte
[mmc]: secure_feature      : 0x0
[mmc]: secure_removal_type : 0x0
[      1.554]sunxi flash init ok
sunxi secure storage is not supported
[      1.560]usb burn from boot
delay time 0
[      1.652]usb prepare ok
usb sof ok
[      1.864]usb probe ok
[      1.864]usb setup ok
key pressed value=0x2e
[      1.866]exit usb burn from boot
next work 1
SUNXI_UPDATE_NEXT_ACTION_NULL
--------fastboot partitions--------
-total partitions:7-
-name-        -start-       -size-      
boot-res    : 1000000       1000000     
env         : 2000000       100000      
boot        : 2100000       800000      
private     : 2900000       100000      
misc        : 2a00000       100000      
rootfs      : 2b00000       a000000     
UDISK       : cb00000       0           
-----------------------------------
base bootcmd=run setargs_nand boot_normal
bootcmd set setargs_mmc
key 0
cant find rcvy value
cant find fstbt value
misc partition found
to be run cmd=run setargs_mmc boot_normal
BPI: disable_node mmc2 in BPI-M2 Berry 1.0
update dtb dram start
update dtb dram  end
sunxi_serial: serial_feature is not exist
serial is: 94507872c6181c0d050f
BPI-M2 Berry: force to set pmu_bat_unused = 1
BPI: axp_probe_battery_exist(32)
BPI: BatExist(32) pmu_bat_unused(0)
BPI: force to set no battery in BPI-M2 Berry 1.0
PowerBus = 2( 2:vBus 3:acBus other: not exist)
no battery, limit to dc
no battery exist
sunxi_bmp_logo_display
reading bootlogo.bmp
3686538 bytes read in 162 ms (21.7 MiB/s)
bmp file buffer: 0x40000000, bmp_info.buffer: 46400000
screen_id =0, screen_width =1280, screen_height =720
frame buffer address 46400036
Net:   No ethernet found.
[      2.366]inter uboot shell
Hit any key to stop autoboot:  0 

-- also ligthing a green LED on the board in the process.

Uboot compiled with sources cloned from here: https://github.com/linux-sunxi/u-boot-sunxi also fails in the same way.

I have also tried to clone the working bootloader:

dd if=/tmp/2018-05-24-raspbian-jessie-preview-bpi-m2u-sd-emmc.img of=/dev/sdc bs=1024 seek=8 skip=8 count=1016

but it hangs after the "set pll end" message. Probably it needs more data than these 1016 kBytes to work.

Did I miss something basic? After lots of google searches, i haven't managed to find any reports of these builds succeeding or failing, only this page: http://linux-sunxi.org/Sinovoip_Banana_Pi_M2_Ultra says that the board should be supported by both mainline U-Boot and Linux.

1 Answer 1

1

I have managed to solve the problem myself. First: the bootloader was working fine from the start. Let's walk through my question step by step.

  1. My bootloader was not booting their kernel, because they use a modified kernel, that wouldn't run with a standard u-boot.
  2. The difference in bootloader output was caused by two things: first, they used another bootloader "BOOT0", not u-boot's SPL, for the first stage, and they used a lot older version of u-boot.
  3. Their bootloader, due to usage of the "BOOT0", has a very different data layout. It is probably not worth bothering to find it out though.
  4. I had multiple problems with the kernel and the device tree file, causing it not to work right.

First, my kernel didn't know how to output text to a serial console, so nothing showed up. This was fixed by enabling the low level debug function in Linux configuration. Then, it was not correctly configured for the "sunxi" SOC (i have probably misconfigured it trying to solve the problem). Also i was using the wrong device tree file for Linux (from u-boot instead of the one from Linux tree - it was literally waiting for me there). The last problem is a mystery. After fixing all the mistakes, Linux booted, but froze after the message about a RTC device. (It was not related to the RTC, because it still happened after completely disabling RTC support.) Finally, the kernel booted fine after cleaning, reconfiguring and recompiling the source tree. The same problem, with freezing after RTC message, happened second time (when compiling natively), and was fixed the same way. At least, everything is working now.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.