pcDuino3 Nano 使用 u-boot 卡在 "Starting kernel ..."

pcDuino3 Nano stuck at "Starting kernel ..." using u-boot

其实我正在做一个课程的实验,编译u-boot并替换现有的。我遇到了这个问题,Google 似乎没有任何帮助。所以我 post 在这里,想要一些可能的原因或解决方案。

Board: pcDuino3 Nano

OS: Linaro 12.07 (GNU/Linux 3.4.79+ armv7l) (the first image in the page)

Media: SD card

步骤:

  1. I have succeed in booting from SD card and entered the shell.
  2. Then I compiled the latest u-boot and got u-boot-sunxi-with-spl.bin.
  3. I used dd if=u-boot-sunxi-with-spl.bin of=/dev/sdb bs=1024 seek=8 to flash the bin to SD card.
  4. pcDuino3 Nano stuck at Starting kernel ....

u-boot 的旧输出:

U-Boot 2014.04-rc3-10520-g87ca6dc-dirty (Apr 09 2014 - 18:46:35) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
Board: pcDuino3
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
In:    serial
Out:   serial
Err:   serial
Net:   emac
Hit any key to stop autoboot:  0 
reading uEnv.txt
575 bytes read in 21 ms (26.4 KiB/s)
reading script.bin
50660 bytes read in 27 ms (1.8 MiB/s)
reading uImage
6495136 bytes read in 331 ms (18.7 MiB/s)
## Booting kernel from Legacy Image at 48000000 ...
   Image Name:   Linux-3.4.79+
   Created:      2014-12-05   9:23:21 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    6495072 Bytes = 6.2 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

u-boot的新输出:

U-Boot 2016.05-rc3-gad14166 (May 01 2016 - 18:19:38 +0800) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
Model: LinkSprite pcDuino3
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
In:    serial
Out:   serial
Err:   serial
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:   eth0: ethernet@01c50000
Hit any key to stop autoboot:  0 
reading uEnv.txt
575 bytes read in 21 ms (26.4 KiB/s)
reading script.bin
50660 bytes read in 32 ms (1.5 MiB/s)
reading uImage
6495136 bytes read in 703 ms (8.8 MiB/s)
## Booting kernel from Legacy Image at 48000000 ...
   Image Name:   Linux-3.4.79+
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    6495072 Bytes = 6.2 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

printenv 的旧输出:

sun7i# printenv 
baudrate=115200
boot_mmc=fatload mmc 0 0x43000000 script.bin && fatload mmc 0 0x48000000 uImage && bootm 0x48000000
boot_nand=fatload mmc 0 0x43000000 script.bin && fatload mmc 0 0x48000000 ${kernel} && bootm 0x48000000
bootargs=console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p2 loglevel=8 panic=10
bootcmd=if run loadbootenv; then env import -t ${scriptaddr} ${filesize};fi;run setargs boot_mmc;
bootdelay=1
bootenv=uEnv.txt
bootscr=boot.scr
console=ttyS0,115200
ethact=emac
filesize=631ba0
kernel=uImage
loadbootenv=fatload mmc 0 $scriptaddr ${bootenv}
loadbootscr=fatload mmc 0 $scriptaddr ${bootscr} || ext2load mmc 0 $scriptaddr ${bootscr} || ext2load mmc 0 $scriptaddr boot/${bootsc}
loglevel=8
mmc_root=/dev/mmcblk0p2
panicarg=panic=10
recovery_key_value_max=0x13
recovery_key_value_min=0x10
root=/dev/mmcblk0p6 rootwait
scriptaddr=0x44000000
setargs=setenv bootargs console=${console} console=tty1 root=${mmc_root} loglevel=${loglevel} ${panicarg} ${extraargs}
stderr=serial
stdin=serial
stdout=serial
udrate=115200

Environment size: 1082/131068 bytes

printenv的新输出:

=> printenv 
baudrate=115200
boot_mmc=fatload mmc 0 0x43000000 script.bin && fatload mmc 0 0x48000000 uImage && bootm 0x48000000
boot_nand=fatload mmc 0 0x43000000 script.bin && fatload mmc 0 0x48000000 ${kernel} && bootm 0x48000000
bootargs=console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p2 loglevel=8 panic=10
bootcmd=if run loadbootenv; then env import -t ${scriptaddr} ${filesize};fi;run setargs boot_mmc;
bootdelay=1
bootenv=uEnv.txt
bootscr=boot.scr
console=ttyS0,115200
ethact=emac
ethaddr=02:8b:08:42:69:fe
fdtcontroladdr=7af319c0
filesize=631ba0
kernel=uImage
loadbootenv=fatload mmc 0 $scriptaddr ${bootenv}
loadbootscr=fatload mmc 0 $scriptaddr ${bootscr} || ext2load mmc 0 $scriptaddr ${bootscr} || ext2load mmc 0 $scriptaddr boot/${bootsc}
loglevel=8
mmc_root=/dev/mmcblk0p2
panicarg=panic=10
recovery_key_value_max=0x13
recovery_key_value_min=0x10
root=/dev/mmcblk0p6 rootwait
scriptaddr=0x44000000
serial#=1651668b084269fe
setargs=setenv bootargs console=${console} console=tty1 root=${mmc_root} loglevel=${loglevel} ${panicarg} ${extraargs}
stderr=serial
stdin=serial
stdout=serial
udrate=115200

Environment size: 1163/131068 bytes

如有相关者将不胜感激:)

您需要的答案很可能在 https://linux-sunxi.org/Mainline_U-Boot#Legacy_kernel_won.27t_start 上找到,因为使用主线 U-Boot 引导旧内核或供应商内核需要一些小心。

H/T 到 IRC 上的 NiteHawk。