Difference between revisions of "U-Boot"

From Rockchip open source Document
Jump to: navigation, search
Line 1: Line 1:
  
U-Boot Guide
+
In your linux SDK root directory. enter to U-Boot directory. 
 +
<pre>cd u-boot
 +
</pre>
  
= Download U-Boot =
+
For RK3399&nbsp;sapphire-excavator board, VS-RK3399 board,&nbsp;Rock960 board. Use below command to build the U-Boot:&nbsp;
 +
<pre>./make.sh evb-rk3399
 +
</pre>
  
== Upstream U-Boot ==
+
For firefly-rk3399&nbsp;board. Use below command to build the U-Boot:&nbsp;
 +
<pre>./make.sh firefly-rk3399
 +
</pre>
  
You can clone the u-boot repository by running:
+
For firefly-rk3288 board. Use below command to build the U-Boot:&nbsp;
<pre>git clone git://git.denx.de/u-boot.git</pre>
+
<pre>./make.sh firefly-rk3288
 +
</pre>
  
Alternatively you can use u-boot-rockchip instead which may with some patches not get in mainline:
+
For rk3288-evb-act8846&nbsp;board. Use below command to build the U-Boot:&nbsp;
<pre>git clone git://git.denx.de/u-boot-rockchip.git
+
<pre>./make.sh evb-rk3288
 
</pre>
 
</pre>
  
== Rockchip U-Boot ==
+
For rk3288-evb-rk808&nbsp;board. Use below command to build the U-Boot:&nbsp;
 +
<pre>./make.sh fennec-rk3288
 +
</pre>
  
You can clone the u-boot repository by running:
+
For rk3288 tinker&nbsp;board. Use below command to build the U-Boot:&nbsp;
<pre>git clone https://github.com/rockchip-linux/u-boot.git
+
<pre>./make.sh tinker-rk3288
 
</pre>
 
</pre>
  
= Supported Devices =
+
For phytec-rk3288&nbsp;board. Use below command to build the U-Boot:&nbsp;
 
+
<pre>./make.sh phycore-rk3288
Upstream U-Boot support Rockchip SoCs:
 
 
 
RK3036, RK3188, [[RK3288|RK3288]], [[RK3328|RK3328]], [[RK3399|RK3399]]
 
 
 
*RK3036 boards supported:
 
<ol style="margin-left: 40px;">
 
<li>EVB RK3036 - use evb-rk3036 configuration</li>
 
<li>Kylin - use kylin_rk3036 configuration</li>
 
</ol>
 
 
 
*RK3288 boards supported:
 
<ol style="margin-left: 40px;">
 
<li>EVB RK3288 - use evb-rk3288 configuration</li>
 
<li>Fennec RK3288 - use fennec-rk3288 configuration</li>
 
<li>Firefly RK3288 - use firefly-rk3288 configuration</li>
 
<li>Hisense Chromebook - use chromebook_jerry configuration</li>
 
<li>Miniarm RK3288 - use miniarm-rk3288 configuration</li>
 
<li>PopMetal RK3288 - use popmetal-rk3288 configuration</li>
 
<li>Radxa Rock 2 - use rock2 configuration</li>
 
<li>ASUS Tinker</li>
 
</ol>
 
 
 
*RK3188 boards&nbsp;supported:
 
<ol style="margin-left: 40px;">
 
<li>Radxa Rock - use rock&nbsp;configuration</li>
 
</ol>
 
 
 
*RK3328 boards&nbsp;supported:
 
<ol style="margin-left: 40px;">
 
<li>EVB RK3328 - use evb-rk3328 configuration</li>
 
</ol>
 
 
 
*RK3399 boards&nbsp;supported:
 
<ol style="margin-left: 40px;">
 
<li>EVB RK3399 - use evb-rk3399 configuration</li>
 
</ol>
 
 
 
= 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:
 
<pre>make CROSS_COMPILE=arm-linux-gnueabi-&nbsp;<board_name>_defconfig</pre>
 
 
 
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:
 
<pre>make CROSS_COMPILE=arm-linux-gnueabi- menuconfig
 
 
</pre>
 
</pre>
  
= Build U-Boot =
+
For rk3288 miqi&nbsp;board. Use below command to build the U-Boot:&nbsp;
 
+
<pre>./make.sh miqi-rk3288
== 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>
  
== Build ==
+
It will generate 3 binary image: rk3xxx_loader_vx.xx.xxx.bin, trust.img, uboot.img.&nbsp;
  
For armv7:
+
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;
<pre>make CROSS_COMPILE=arm-linux-gnueabi-</pre>
 
  
or for ARM64:
+
trust.img:&nbsp;ARM Trusted Firmware
<pre>make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-</pre>
 
  
=== others ===
+
uboot.img: The U-Boot image
 
+
<pre>u-boot/
In order to support debug in ARM DS-5, you may need add ctags in make command:
+
├── rk3399_loader_v1.09.112.bin
<pre>CFLAGS='-gdwarf-3'
+
├── trust.img
 +
└── uboot.img
 
</pre>
 
</pre>
  
For trust support, we are using FIT image with 'mkimage' cmd in Makefile and its script defined in defconfig:
+
Rockchip now only offically support miniloader+U-Boot boot to simplify the customer product design.&nbsp; You can refer to&nbsp;[http://opensource.rock-chips.com/wiki_Boot_option boot option]&nbsp;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;
<pre>make u-boot.itb</pre>
 
 
 
Note: please copy the trust binary() to u-boot root directory and rename it to tee.bin(armv7) or bl31.elf(armv8).
 
 
 
The u-boot.itb including u-boot-nodtb.bin, board.dtb, and trust binaries.
 
 
 
= Install U-Boot =
 
 
 
Rockchip SoCs's bootrom need special format named IDBlock at special offset 0x40&nbsp;block for boot, so we need to package&nbsp;SPL(or Rockchip miniloader) &nbsp;in IDB format.
 
 
 
Rockchip bootrom supports SPL back to bootrom and bootrom load the U-Boot, so the SPL for Rockchip SoCs can option to back to bootrom, usually decided by if the IRAM is enough&nbsp;for driver to load U-Boot.
 
 
 
== Using U-Boot SPL ==
 
 
 
After build&nbsp;complete, U-Boot with SPL support will generate a spl folder with <var>u-boot-spl.bin</var>&nbsp;inside
 
<pre>tools/mkimage -n rk3288 -T rksd -d spl/u-boot-spl.bin  rk3288_idb.img</pre>
 
 
 
'''This image is supposed to flash to offset 0x40.'''
 
 
 
For&nbsp;<var>u-boot.bin</var>, it's different for SPL back to bootrom or not, if enable&nbsp;CONFIG_ROCKCHIP_SPL_BACK_TO_BROM, we can append the U-Boot to IDB data:
 
<pre>cat u-boot.bin >> rk3288_idb.img</pre>
 
 
 
<code>If&nbsp;</code>CONFIG_ROCKCHIP_SPL_BACK_TO_BROM&nbsp;not enabled, no more package operation is need for u-boot-dtb.bin, and it need to flalsh to 0x200 which is decide by&nbsp;CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR.
 
 
 
== Support ATF with SPL FIT image ==
 
 
 
To be continue
 
 
 
== Using Rockchip miniloader ==
 
 
 
Alternatively, you can use Rockchip miniloader and U-Boot instead which do not need SPL.
 
 
 
The miniloader is package as IDBlock, and the u-boot.bin need to package with rockchip tool:
 
<pre>loaderimage --pack --uboot u-boot.bin uboot.img</pre>
 
 
 
According to the [[Partitions|partitions]] definition, the miniloader should write to offset 0x40 and &nbsp;this uboot.img should write to offset 0x4000.
 
 
 
 
 
== Boot up ==
 
 
 
See [[Boot_option|boot option]]&nbsp;about how to boot from eMMC/SD card.
 
 
 
= Boot cmd =
 
 
 
*Distro boot
 
*EFI boot
 
 
 
= Firmware download in U-Boot =
 
 
 
In U-Boot, there are multi way to update image for system, you can chose any of one easy use for you.
 
 
 
*fastboot
 
*ums
 
*rockusb
 

Revision as of 07:24, 18 April 2018

In your linux SDK root directory. enter to U-Boot directory. 

cd u-boot

For RK3399 sapphire-excavator board, VS-RK3399 board, Rock960 board. Use below command to build the U-Boot: 

./make.sh evb-rk3399

For firefly-rk3399 board. Use below command to build the U-Boot: 

./make.sh firefly-rk3399

For firefly-rk3288 board. Use below command to build the U-Boot: 

./make.sh firefly-rk3288

For rk3288-evb-act8846 board. Use below command to build the U-Boot: 

./make.sh evb-rk3288

For rk3288-evb-rk808 board. Use below command to build the U-Boot: 

./make.sh fennec-rk3288

For rk3288 tinker board. Use below command to build the U-Boot: 

./make.sh tinker-rk3288

For phytec-rk3288 board. Use below command to build the U-Boot: 

./make.sh phycore-rk3288

For rk3288 miqi board. Use below command to build the U-Boot: 

./make.sh miqi-rk3288

It will generate 3 binary image: rk3xxx_loader_vx.xx.xxx.bin, trust.img, uboot.img. 

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. 

trust.img: ARM Trusted Firmware

uboot.img: The U-Boot image

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

Rockchip now only offically support miniloader+U-Boot boot to simplify the customer product design.  You can refer to 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.