我已经使用以下命令构建了主线 U-Boot:
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- -j3 Bananapi_M2_Ultra_defconfig
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- -j3
...和Linux 4.18,尝试在Banana Pi M2-Berry计算机上运行它(似乎Ultra和Berry版本可以使用相同的软件)。引导加载程序加载良好。我还没有配置它,所以我尝试启动内核并手动指定必要的命令(.dtb 文件是使用内核树构建的):
=> 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 ...
此时,系统无限期挂起。
我已经成功下载并运行了一些可用的 SD 卡映像。那里的内核以以下命令启动:
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
尝试使用我的引导加载程序运行他们的内核,这些确切的命令也会因“启动内核”挂起而失败。 (由于显示 MMC 错误,我无法让他们的引导加载程序加载我的内核。)
工作系统和非工作系统的显着区别在于u-boot的启动过程。我的输出如下:
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
工作打印了更多信息(尽管我在其中找不到任何提示):
[ 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
-- 在此过程中还会点亮板上的绿色 LED。
Uboot 使用从这里克隆的源代码进行编译:https://github.com/linux-sunxi/u-boot-sunxi也以同样的方式失败。
我还尝试克隆工作引导加载程序:
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
但它在“set pll end”消息之后挂起。可能需要比这 1016 kBytes 更多的数据才能工作。
我错过了一些基本的东西吗?经过大量谷歌搜索后,我没有找到任何关于这些构建成功或失败的报告,只有这个页面:http://linux-sunxi.org/Sinovoip_Banana_Pi_M2_Ultra说该主板应该同时受到主线 U-Boot 和 Linux 的支持。
答案1
我已经设法自己解决了这个问题。首先:引导加载程序从一开始就工作正常。让我们逐步解决我的问题。
- 我的引导加载程序没有引导他们的内核,因为他们使用修改后的内核,无法与标准 u-boot 一起运行。
- 引导加载程序输出的差异是由两件事引起的:首先,他们在第一阶段使用了另一个引导加载程序“BOOT0”,而不是u-boot的SPL,并且他们使用了很多旧版本的u-boot。
- 由于使用了“BOOT0”,他们的引导加载程序具有非常不同的数据布局。不过,可能不值得费心去找出它。
- 我的内核和设备树文件存在多个问题,导致其无法正常工作。
首先,我的内核不知道如何将文本输出到串行控制台,因此什么都没有显示出来。通过在 Linux 配置中启用低级调试功能解决了这个问题。然后,它没有为“sunxi”SOC正确配置(我可能在尝试解决问题时配置错误)。此外,我使用了错误的 Linux 设备树文件(来自 u-boot,而不是来自 Linux 树的文件 - 它确实在那里等着我)。最后一个问题是一个谜。修复所有错误后,Linux 启动了,但在出现有关 RTC 设备的消息后冻结了。(这与 RTC 无关,因为在完全禁用 RTC 支持后仍然会发生这种情况。)最后,在清理、重新配置和重新编译源树后,内核启动正常。同样的问题,在 RTC 消息后冻结,第二次发生(在本机编译时),并以相同的方式修复。至少,现在一切都正常了。