查看: 1476|回复: 0

【HiKey】使用u-boot作为(三级)bootloader启动

[复制链接]

该用户从未签到

发表于 2016-8-25 08:54:07 | 显示全部楼层 |阅读模式
分享到:
此篇文章是翻译u-boot里的 board/hisilicon/hikey/README 喜欢看英文的可以忽略下面的文章,直接看原文:)
The HiKey U-Boot port has been tested with l-loader, booting ATF, which then boots
U-Boot as the bl33.bin executable.

  • 下载所有代码:
mkdir -p ~/hikey/src ~/hikey/bin
cd ~/hikey/src
git clone git://git.denx.de/u-boot.git
git clone https://github.com/96boards/edk2.git
git clone https://github.com/96boards/arm-trusted-firmware.git
git clone https://github.com/96boards/l-loader.git
git clone https://github.com/96boards/burn-boot.git
cp edk2/HisiPkg/HiKeyPkg/NonFree/mcuimage.bin ~/hikey/bin/
wget -P ~/hikey/bin https://builds.96boards.org/releases/reference-platform/debian/hikey/16.03/bootloader/nvme.img

  • 编译U-Boot
==============
cd ~/hikey/src/u-boot
make CROSS_COMPILE=aarch64-linux-gnu- hikey_config
make CROSS_COMPILE=aarch64-linux-gnu-
cp u-boot.bin ~/hikey/bin

  • 编译 ARM Trusted Firmware (ATF)
==================================
cd ~/hikey/src/arm-trusted-firmware
make CROSS_COMPILE=aarch64-linux-gnu- all fip \
BL30=~/hikey/bin/mcuimage.bin \
BL33=~/hikey/bin/u-boot.bin DEBUG=1 PLAT=hikey

拷贝编译出来的镜像到指定目录
cp build/hikey/debug/bl1.bin ~/hikey/bin
cp build/hikey/debug/fip.bin ~/hikey/bin

  • 编译 l-loader
==============
cd ~/hikey/src/l-loader
make BL1=~/hikey/bin/bl1.bin all
cp *.img ~/hikey/bin
cp l-loader.bin ~/hikey/bin/

  • 进入下载模式烧写
================
sudo python ~/hikey/src/burn_boot/hisi-idt.py -d /dev/ttyUSB0 --img1=~/hikey/bin/l-loader.bin
当LED 0常亮后就表示进入fastboot模式,后面的镜像就可以用fastboot烧写
sudo fastboot flash ptable ~/hikey/bin/ptable-aosp-8g-img
sudo fastboot flash fastboot ~/hikey/bin/fip.bin
sudo fastboot flash nvme ~/hikey/bin/nvme.img
断开下载模式跳线后重新上电启动即可,注意需要断开USB OTG线

  • 附上日志:
INFO:  BL1: 0xf9810000 - 0xf9818000 [size = 32768]
NOTICE:  Booting Trusted Firmware
NOTICE:  BL1: v1.1(debug):7fb9b0e
NOTICE:  BL1: Built : 20:36:31, Aug 24 2016
INFO:  BL1: RAM 0xf9810000 - 0xf9818000
NOTICE:  syspll frequency:1190494208Hz
NOTICE:  succeed to init lpddr3 rank0 dram phy
INFO:  lpddr3_freq_init, set ddrc 533mhz
INFO:  init ddr3 rank0
INFO:  ddr3 rank1 init pass
INFO:  lpddr3_freq_init, set ddrc 800mhz
INFO:  init ddr3 rank0
INFO:  ddr3 rank1 init pass
INFO:  Samsung DDR
INFO:  ddr test value:0xa5a55a5a
INFO:  Hisilicon HiKey platform is initialized
INFO:  Using FIP
INFO:  Loading file 'bl2.bin' at address 0xf9818000
INFO:  File 'bl2.bin' loaded: 0xf9818000 - 0xf9821100
NOTICE:  BL1: Booting BL2
INFO:  BL1: BL2 address = 0xf9818000
INFO:  BL1: BL2 spsr = 0x3c5
INFO:  [BDID] [fff91c18] midr: 0x410fd033
INFO:  [BDID] [fff91c1c] board type: 0
INFO:  [BDID] [fff91c20] board id: 0x2b
INFO:  init_acpu_dvfs: pmic version 17
INFO:  init_acpu_dvfs: ACPU_CHIP_MAX_FREQ=0x186a00.
INFO:  acpu_dvfs_volt_init: success!
INFO:  acpu_dvfs_set_freq: support freq num is 5
INFO:  acpu_dvfs_set_freq: start prof is 0x4
INFO:  acpu_dvfs_set_freq: magic is 0x5a5ac5c5
INFO:  acpu_dvfs_set_freq: voltage:
INFO:  - 0: 0x49
INFO:  - 1: 0x49
INFO:  - 2: 0x50
INFO:  - 3: 0x60
INFO:  - 4: 0x78
NOTICE:  acpu_dvfs_set_freq: set acpu freq success!NOTICE:  BL2: v1.1(debug):7fb9b0e
NOTICE:  BL2: Built : 20:36:32, Aug 24 2016
INFO:  BL2: Loading BL3-0
INFO:  Using FIP
INFO:  Loading file 'bl30.bin' at address 0x1000000
INFO:  Skip reserving memory: 0x1000000 - 0x1023d00
INFO:  File 'bl30.bin' loaded: 0x1000000 - 0x1023d00
INFO:  bl2_plat_handle_bl30: [1000000] 3a334d43 35313032 2f34302f 32203930
INFO:  bl2_plat_handle_bl30: [10000c8] 0 0 b 0
INFO:  bl2_plat_handle_bl30: [1000190] 17 0 0 0
INFO:  bl2_plat_handle_bl30: [1023cf0] 0 0 0 0
INFO:  hisi_mcu_load_image: mcu sections 0:
INFO:  hisi_mcu_load_image:  src  = 0x1000200
INFO:  hisi_mcu_load_image:  dst  = 0xf6000000
INFO:  hisi_mcu_load_image:  size = 31184
INFO:  hisi_mcu_load_image:  [SRC 0x1000200] 0x8000 0x3701 0x7695 0x7689
INFO:  hisi_mcu_load_image:  [DST 0xf6000000] 0x8000 0x3701 0x7695 0x7689
INFO:  hisi_mcu_load_image: mcu sections 1:
INFO:  hisi_mcu_load_image:  src  = 0x1007bd0
INFO:  hisi_mcu_load_image:  dst  = 0x5e00000
INFO:  hisi_mcu_load_image:  size = 93828
INFO:  hisi_mcu_load_image:  [SRC 0x1007bd0] 0xf000b510 0x2103fb3d 0xf0004604 0xf003fb57
INFO:  hisi_mcu_load_image:  [DST 0x5e00000] 0xf000b510 0x2103fb3d 0xf0004604 0xf003fb57
INFO:  hisi_mcu_load_image: mcu sections 2:
INFO:  hisi_mcu_load_image:  src  = 0x101ea54
INFO:  hisi_mcu_load_image:  dst  = 0x5e16e84
INFO:  hisi_mcu_load_image:  size = 15428
INFO:  hisi_mcu_load_image:  [SRC 0x101ea54] 0x9 0x1020640 0x10001 0x8f0d180
INFO:  hisi_mcu_load_image:  [DST 0x5e16e84] 0x9 0x1020640 0x10001 0x8f0d180
INFO:  hisi_mcu_load_image: mcu sections 3:
INFO:  hisi_mcu_load_image:  src  = 0x1022698
INFO:  hisi_mcu_load_image:  dst  = 0x5e22a10
INFO:  hisi_mcu_load_image:  size = 3060
INFO:  hisi_mcu_load_image:  [SRC 0x1022698] 0x0 0x0 0x0 0x0
INFO:  hisi_mcu_load_image:  [DST 0x5e22a10] 0x0 0x0 0x0 0x0
INFO:  hisi_mcu_load_image: mcu sections 4:
INFO:  hisi_mcu_load_image:  src  = 0x102328c
INFO:  hisi_mcu_load_image:  dst  = 0x5e23604
INFO:  hisi_mcu_load_image:  size = 2616
INFO:  hisi_mcu_load_image:  [SRC 0x102328c] 0xf80000a0 0x0 0xf80000ac 0x0
INFO:  hisi_mcu_load_image:  [DST 0x5e23604] 0xf80000a0 0x0 0xf80000ac 0x0
INFO:  hisi_mcu_start_run: AO_SC_SYS_CTRL2=0
INFO:  bl2_plat_handle_bl30: mcu pc is 42933301
INFO:  bl2_plat_handle_bl30: AO_SC_PERIPH_CLKSTAT4   is 39018f09
INFO:  BL2: TrustZone: protecting 16777216 bytes of memory at 0x3f000000
INFO:  BL2: Loading BL3-1
INFO:  Using FIP
INFO:  Loading file 'bl31.bin' at address 0xf9858000
INFO:  File 'bl31.bin' loaded: 0xf9858000 - 0xf9861010
INFO:  BL2: Loading BL3-2
INFO:  Using FIP
WARNING: Failed to access image 'bl32.bin' (-1)
WARNING: Failed to load BL3-2 (-1)
INFO:  BL2: Loading BL3-3
INFO:  Using FIP
INFO:  Loading file 'bl33.bin' at address 0x35000000
INFO:  File 'bl33.bin' loaded: 0x35000000 - 0x350588e8
NOTICE:  BL1: Booting BL3-1
INFO:  BL1: BL3-1 address = 0xf9858000
INFO:  BL1: BL3-1 spsr = 0x3cd
INFO:  BL1: BL3-1 params address = 0xf9821920
INFO:  BL1: BL3-1 plat params address = 0x0
NOTICE:  BL3-1: v1.1(debug):7fb9b0e
NOTICE:  BL3-1: Built : 20:36:34, Aug 24 2016
INFO:  BL3-1: Initializing runtime services
INFO:  BL3-1: Preparing for EL3 exit to normal world
INFO:  BL3-1: Next image address = 0x35000000
INFO:  BL3-1: Next image spsr = 0x3c9

U-Boot 2016.09-rc2 (Aug 24 2016 - 20:08:50 +0000)hikey
DRAM:  990 MiB
HI6553 PMIC init
MMC:  config_sd_carddetect: SD card not present
HiKey DWMMC: 0, HiKey DWMMC: 1
Card did not respond to voltage select!
** Bad device mmc 1 **
Using default environment
In:  uart@f7113000
Out:  uart@f7113000
Err:  uart@f7113000
Net:  Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:
starting USB...
USB0:  Core Release: 3.00a
scanning bus 0 for devices... 2 USB Device(s) found
  scanning usb for storage devices... 0 Storage Device(s) found
  scanning usb for ethernet devices... 0 Ethernet Device(s) found
USB device 0: unknown device
No ethernet found.
No ethernet found.
=>
回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /4 下一条

手机版|小黑屋|与非网

GMT+8, 2024-11-19 12:30 , Processed in 0.123926 second(s), 17 queries , MemCache On.

ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

苏公网安备 32059002001037号

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.