Difference between revisions of "U-Boot"

From Rockchip open source Document
Jump to: navigation, search
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  
In your linux SDK root directory. enter to U-Boot directory. 
+
= Download U-Boot =
<pre>cd u-boot
+
 
 +
== Upstream U-Boot ==
 +
 
 +
You can clone the u-boot repository by running:
 +
<pre>git clone git://git.denx.de/u-boot.git</pre>
 +
 
 +
Alternatively you can use u-boot-rockchip instead which may with some patches not get in mainline:
 +
<pre>git clone git://git.denx.de/u-boot-rockchip.git</pre>
 +
 
 +
&nbsp;
 +
 
 +
== Rockchip U-Boot ==
 +
 
 +
You can clone the u-boot repository by running:
 +
<pre>git clone https://github.com/rockchip-linux/u-boot.git
 
</pre>
 
</pre>
  
For RK3399&nbsp;sapphire-excavator board, VS-RK3399 board,&nbsp;Rock960 board. Use below command to build the U-Boot:&nbsp;
+
= Supported Devices =
<pre>./make.sh evb-rk3399
+
 
 +
Upstream U-Boot support Rockchip SoCs:
 +
 
 +
RK3036, RK3188,&nbsp;[http://opensource.rock-chips.com/wiki_RK3288 RK3288],&nbsp;[http://opensource.rock-chips.com/wiki_RK3328 RK3328],&nbsp;[http://opensource.rock-chips.com/wiki_RK3399 RK3399]
 +
 
 +
*RK3036 boards supported:
 +
 
 +
#EVB RK3036 - use evb-rk3036 configuration
 +
#Kylin - use kylin_rk3036 configuration
 +
 
 +
*RK3288 boards supported:
 +
 
 +
#EVB RK3288 - use evb-rk3288 configuration
 +
#Fennec RK3288 - use fennec-rk3288 configuration
 +
#Firefly RK3288 - use firefly-rk3288 configuration
 +
#Hisense Chromebook - use chromebook_jerry configuration
 +
#Miniarm RK3288 - use miniarm-rk3288 configuration
 +
#PopMetal RK3288 - use popmetal-rk3288 configuration
 +
#Radxa Rock 2 - use rock2 configuration
 +
#ASUS Tinker
 +
 
 +
*RK3188 boards&nbsp;supported:
 +
 
 +
#Radxa Rock - use rock&nbsp;configuration
 +
 
 +
*RK3328 boards&nbsp;supported:
 +
 
 +
#EVB RK3328 - use evb-rk3328 configuration
 +
 
 +
*RK3399 boards&nbsp;supported:
 +
 
 +
#EVB RK3399 - use evb-rk3399 configuration
 +
 
 +
= Get a toolchain =
 +
 
 +
If you haven't done so before, get a suitable&nbsp;toolchain&nbsp;installed and add it&nbsp;to your PATH.
 +
 
 +
In Ubuntu 14.04, you can use below command to install cross compiler for armv7:
 +
<pre>sudo apt-get install gcc-arm-linux-gnueabi</pre>
 +
 
 +
Or for ARM64
 +
<pre>sudo apt-get install gcc-aarch64-linux-gnu
 
</pre>
 
</pre>
  
For firefly-rk3399&nbsp;board. Use below command to build the U-Boot:&nbsp;
+
Note that the latest U-Boot require version gcc-5.0 and later, we recommand to use linaro 6.3.1.
<pre>./make.sh firefly-rk3399
+
<pre>https://github.com/rockchip-linux/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf.git</pre>
</pre>
+
<pre>https://github.com/rockchip-linux/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.git</pre>
 +
 
 +
= Build U-Boot =
 +
 
 +
== Configure U-Boot ==
  
For firefly-rk3288 board. Use below command to build the U-Boot:&nbsp;
+
First you need to choose a correct defconfig for your board;
<pre>./make.sh firefly-rk3288
 
</pre>
 
  
For rk3288-evb-act8846&nbsp;board. Use below command to build the U-Boot:&nbsp;
+
When you have determined what <board_name> you want to build, configure:
<pre>./make.sh evb-rk3288
+
<pre>make CROSS_COMPILE=arm-linux-gnueabi- <board_name>_defconfig</pre>
</pre>
 
  
For rk3288-evb-rk808&nbsp;board. Use below command to build the U-Boot:&nbsp;
+
You may need to change the U-Boot function/feature support by modify the defconfig file or,
<pre>./make.sh fennec-rk3288
 
</pre>
 
  
For rk3288 tinker&nbsp;board. Use below command to build the U-Boot:&nbsp;
+
there is also menuconfig to play with settings if you feel like it:
<pre>./make.sh tinker-rk3288
+
<pre>make CROSS_COMPILE=arm-linux-gnueabi- menuconfig
 
</pre>
 
</pre>
  
For phytec-rk3288&nbsp;board. Use below command to build the U-Boot:&nbsp;
+
&nbsp;
<pre>./make.sh phycore-rk3288
 
</pre>
 
  
For rk3288 miqi&nbsp;board. Use below command to build the U-Boot:&nbsp;
+
== Buid Rockchip U-Boot ==
<pre>./make.sh miqi-rk3288
 
</pre>
 
  
It will generate 3 binary image: rk3xxx_loader_vx.xx.xxx.bin, trust.img, uboot.img.&nbsp;
+
For&nbsp;convenience, Rockchip provide a &nbsp;script 'make.sh' to make it easy to get everything before kernel, this script need toolchain and [https://github.com/rockchip-linux/rkbin rkbin] support.
 +
<pre>├── prebuilts
 +
│  └── gcc
 +
│      └── linux-x86
 +
│          ├── aarch64
 +
│          └── arm
 +
├── rkbin
 +
├── u-boot</pre>
  
rk3xxx_loader_vx.xx.xxx.bin: Rockchip miniloader. rk3xxx is the part number of the chip. vx.xx.xxx is the version number. Please flash this binary to miniloader partition.&nbsp;
+
expample for build rk3399:
 +
<pre>./make.sh rk3399</pre>
  
trust.img:&nbsp;ARM Trusted Firmware, Please flash this binary to trust partition
+
and&nbsp;use './make.sh -h' for more option.
  
uboot.img: The U-Boot image, Please flash this binary to uboot partition
+
The output will including pre-loader, trust and u-boot image which is ready to use with rockchip upgrade tool,&nbsp;
 
<pre>u-boot/
 
<pre>u-boot/
 
├── rk3399_loader_v1.09.112.bin
 
├── rk3399_loader_v1.09.112.bin
 
├── trust.img
 
├── trust.img
└── uboot.img
+
└── uboot.img</pre>
</pre>
+
 
 +
&nbsp;
 +
 
 +
== Build Upstream U-Boot ==
 +
 
 +
This is common and available for both Upstream U-Boot and Rockchip U-Boot.
 +
 
 +
For armv7:
 +
<pre>make CROSS_COMPILE=arm-linux-gnueabi-</pre>
 +
 
 +
or for ARM64:
 +
<pre>make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-</pre>
 +
 
 +
In order to support debug symbol in ARM DS-5, you may need add ctags in make command:
 +
<pre>CFLAGS='-gdwarf-3'</pre>
 +
 
 +
The output including u-boot.bin, spl/u-boot-spl.bin, tpl/u-boot-tpl.bin at this step, and you need to package it with mkimage tool before use with rockchip upagrade tool. Get detail at&nbsp;[http://opensource.rock-chips.com/wiki_Boot_option boot option].
 +
 
 +
'''Support ATF with SPL FIT image'''
 +
 
 +
For trust support in SPL, we are using FIT image with 'mkimage' cmd in Makefile and its script defined in defconfig:
 +
<pre>make u-boot.itb</pre>
 +
 
 +
Note: please copy the trust binary(optee.bin or bl31.elf from rkbin project) to u-boot root directory and rename it to tee.bin(armv7) or bl31.elf(armv8).
 +
 
 +
The output u-boot.itb is a its based package including u-boot-nodtb.bin, board.dtb, and trust binaries which can be used directly with upgrade tool.
 +
<pre>├── u-boot
 +
│  ├── u-boot.bin
 +
│  ├── u-boot.itb
 +
│  ├── spl
 +
│  │  └── u-boot-spl.bin
 +
│  └── tpl
 +
│      └── u-boot-tpl.bin</pre>
 +
 
 +
= Install U-Boot =
 +
 
 +
See&nbsp;[http://opensource.rock-chips.com/wiki_Boot_option boot option]&nbsp;about how to
 +
 
 +
- package the available binaries
 +
 
 +
- flash and boot from eMMC/SD card.
 +
 
 +
 
 +
= Boot cmd =
 +
 
 +
Rockchip U-Boot supports:
 +
 
 +
Android boot(boot_android), Rockchip RKIMG boot(boot_rockchip) and LInux distro boot(distro_bootcmd).
 +
 
 +
Upstream U-Boot supports:
 +
 
 +
Linux distro boot(distro_bootcmd).
 +
 
 +
= Firmware download in U-Boot =
 +
 
 +
In U-Boot, there are multi way to update image into emmc via U-Boot, you can chose any of one easy use for you.
 +
 
 +
fastboot:&nbsp;See&nbsp;[http://opensource.rock-chips.com/wiki_Fastboot fastboot]
  
Rockchip now only offically support miniloader+U-Boot boot to simplify the customer product design.&nbsp; You can refer to&nbsp;[[Boot_option|boot option]] page for more boot path. But do remember that you should do it all by your own. Rockchip won't provide technical support for these boot option.&nbsp;
+
rockusb: See [[Rockusb|rockusb]]

Revision as of 07:59, 6 December 2018

Download U-Boot

Upstream U-Boot

You can clone the u-boot repository by running:

git clone git://git.denx.de/u-boot.git

Alternatively you can use u-boot-rockchip instead which may with some patches not get in mainline:

git clone git://git.denx.de/u-boot-rockchip.git

 

Rockchip U-Boot

You can clone the u-boot repository by running:

git clone https://github.com/rockchip-linux/u-boot.git

Supported Devices

Upstream U-Boot support Rockchip SoCs:

RK3036, RK3188, RK3288RK3328RK3399

  • RK3036 boards supported:
  1. EVB RK3036 - use evb-rk3036 configuration
  2. Kylin - use kylin_rk3036 configuration
  • RK3288 boards supported:
  1. EVB RK3288 - use evb-rk3288 configuration
  2. Fennec RK3288 - use fennec-rk3288 configuration
  3. Firefly RK3288 - use firefly-rk3288 configuration
  4. Hisense Chromebook - use chromebook_jerry configuration
  5. Miniarm RK3288 - use miniarm-rk3288 configuration
  6. PopMetal RK3288 - use popmetal-rk3288 configuration
  7. Radxa Rock 2 - use rock2 configuration
  8. ASUS Tinker
  • RK3188 boards supported:
  1. Radxa Rock - use rock configuration
  • RK3328 boards supported:
  1. EVB RK3328 - use evb-rk3328 configuration
  • RK3399 boards supported:
  1. EVB RK3399 - use evb-rk3399 configuration

Get a toolchain

If you haven't done so before, get a suitable toolchain installed and add it to your PATH.

In Ubuntu 14.04, you can use below command to install cross compiler for armv7:

sudo apt-get install gcc-arm-linux-gnueabi

Or for ARM64

sudo apt-get install gcc-aarch64-linux-gnu

Note that the latest U-Boot require version gcc-5.0 and later, we recommand to use linaro 6.3.1.

https://github.com/rockchip-linux/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf.git
https://github.com/rockchip-linux/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.git

Build U-Boot

Configure U-Boot

First you need to choose a correct defconfig for your board;

When you have determined what <board_name> you want to build, configure:

make CROSS_COMPILE=arm-linux-gnueabi- <board_name>_defconfig

You may need to change the U-Boot function/feature support by modify the defconfig file or,

there is also menuconfig to play with settings if you feel like it:

make CROSS_COMPILE=arm-linux-gnueabi- menuconfig

 

Buid Rockchip U-Boot

For convenience, Rockchip provide a  script 'make.sh' to make it easy to get everything before kernel, this script need toolchain and rkbin support.

├── prebuilts
│   └── gcc
│       └── linux-x86 
│           ├── aarch64
│           └── arm
├── rkbin
├── u-boot

expample for build rk3399:

./make.sh rk3399

and use './make.sh -h' for more option.

The output will including pre-loader, trust and u-boot image which is ready to use with rockchip upgrade tool, 

u-boot/
├── rk3399_loader_v1.09.112.bin
├── trust.img
└── uboot.img

 

Build Upstream U-Boot

This is common and available for both Upstream U-Boot and Rockchip U-Boot.

For armv7:

make CROSS_COMPILE=arm-linux-gnueabi-

or for ARM64:

make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-

In order to support debug symbol in ARM DS-5, you may need add ctags in make command:

CFLAGS='-gdwarf-3'

The output including u-boot.bin, spl/u-boot-spl.bin, tpl/u-boot-tpl.bin at this step, and you need to package it with mkimage tool before use with rockchip upagrade tool. Get detail at boot option.

Support ATF with SPL FIT image

For trust support in SPL, we are using FIT image with 'mkimage' cmd in Makefile and its script defined in defconfig:

make u-boot.itb

Note: please copy the trust binary(optee.bin or bl31.elf from rkbin project) to u-boot root directory and rename it to tee.bin(armv7) or bl31.elf(armv8).

The output u-boot.itb is a its based package including u-boot-nodtb.bin, board.dtb, and trust binaries which can be used directly with upgrade tool.

├── u-boot 
│   ├── u-boot.bin
│   ├── u-boot.itb
│   ├── spl
│   │   └── u-boot-spl.bin
│   └── tpl 
│       └── u-boot-tpl.bin

Install U-Boot

See boot option about how to

- package the available binaries

- flash and boot from eMMC/SD card.


Boot cmd

Rockchip U-Boot supports:

Android boot(boot_android), Rockchip RKIMG boot(boot_rockchip) and LInux distro boot(distro_bootcmd).

Upstream U-Boot supports:

Linux distro boot(distro_bootcmd).

Firmware download in U-Boot

In U-Boot, there are multi way to update image into emmc via U-Boot, you can chose any of one easy use for you.

fastboot: See fastboot

rockusb: See rockusb