Difference between revisions of "U-Boot"
Line 10: | Line 10: | ||
Alternatively you can use u-boot-rockchip instead which may with some patches not get in mainline: | 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> | + | <pre>git clone git://git.denx.de/u-boot-rockchip.git |
− | + | </pre> | |
− | |||
== Rockchip U-Boot == | == Rockchip U-Boot == | ||
Line 25: | Line 24: | ||
RK3036, RK3188, [[RK3288|RK3288]], [[RK3328|RK3328]], [[RK3399|RK3399]] | RK3036, RK3188, [[RK3288|RK3288]], [[RK3328|RK3328]], [[RK3399|RK3399]] | ||
− | |||
− | |||
*RK3036 boards supported: | *RK3036 boards supported: | ||
Line 60: | Line 57: | ||
<li>EVB RK3399 - use evb-rk3399 configuration</li> | <li>EVB RK3399 - use evb-rk3399 configuration</li> | ||
</ol> | </ol> | ||
− | |||
− | |||
− | |||
− | |||
= Configure U-Boot = | = Configure U-Boot = | ||
Line 75: | Line 68: | ||
there is also menuconfig to play with settings if you feel like it: | there is also menuconfig to play with settings if you feel like it: | ||
− | <pre>make CROSS_COMPILE=arm-linux-gnueabi- menuconfig</pre> | + | <pre>make CROSS_COMPILE=arm-linux-gnueabi- menuconfig |
− | + | </pre> | |
− | |||
− | |||
− | |||
= Build U-Boot = | = Build U-Boot = | ||
Line 92: | Line 82: | ||
Or for ARM64 | Or for ARM64 | ||
<pre>sudo apt-get install gcc-aarch64-linux-gnu | <pre>sudo apt-get install gcc-aarch64-linux-gnu | ||
+ | |||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
== Build == | == Build == | ||
Line 104: | Line 92: | ||
or for ARM64: | or for ARM64: | ||
<pre>make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-</pre> | <pre>make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-</pre> | ||
+ | |||
+ | === others === | ||
In order to support debug in ARM DS-5, you may need add ctags in make command: | In order to support debug in ARM DS-5, you may need add ctags in make command: | ||
− | <pre>CFLAGS='-gdwarf-3'</pre> | + | <pre>CFLAGS='-gdwarf-3' |
+ | </pre> | ||
For trust support, we are using FIT image with 'mkimage' cmd in Makefile and its script defined in defconfig: | For trust support, we are using FIT image with 'mkimage' cmd in Makefile and its script defined in defconfig: | ||
Line 120: | Line 111: | ||
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 for driver to load U-Boot. | 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 for driver to load U-Boot. | ||
− | |||
− | |||
− | |||
− | |||
== Using U-Boot SPL == | == Using U-Boot SPL == | ||
Line 139: | Line 126: | ||
== Support ATF with SPL FIT image == | == Support ATF with SPL FIT image == | ||
− | + | To be continue | |
− | |||
== Using Rockchip miniloader == | == Using Rockchip miniloader == | ||
Line 150: | Line 136: | ||
According to the [[Partitions|partitions]] definition, the miniloader should write to offset 0x40 and this uboot.img should write to offset 0x4000. | According to the [[Partitions|partitions]] definition, the miniloader should write to offset 0x40 and this uboot.img should write to offset 0x4000. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Boot up == | == Boot up == | ||
Line 163: | Line 143: | ||
= Boot cmd = | = Boot cmd = | ||
− | + | * | |
+ | Distro boot | ||
+ | |||
+ | * | ||
+ | EFI boot | ||
− | |||
= Firmware download in U-Boot = | = Firmware download in U-Boot = | ||
Line 171: | Line 154: | ||
In U-Boot, there are multi way to update image for system, you can chose any of one easy use for you. | 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:49, 23 January 2018
U-Boot Guide
Contents
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, RK3288, RK3328, 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 supported:
- Radxa Rock - use rock configuration
- RK3328 boards supported:
- EVB RK3328 - use evb-rk3328 configuration
- RK3399 boards supported:
- EVB RK3399 - use evb-rk3399 configuration
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
Build U-Boot
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
Build
For armv7:
make CROSS_COMPILE=arm-linux-gnueabi-
or for ARM64:
make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
others
In order to support debug in ARM DS-5, you may need add ctags in make command:
CFLAGS='-gdwarf-3'
For trust support, 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() 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 block for boot, so we need to package SPL(or Rockchip miniloader) 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 for driver to load U-Boot.
Using U-Boot SPL
After build complete, U-Boot with SPL support will generate a spl folder with u-boot-spl.bin inside
tools/mkimage -n rk3288 -T rksd -d spl/u-boot-spl.bin rk3288_idb.img
This image is supposed to flash to offset 0x40.
For u-boot.bin, it's different for SPL back to bootrom or not, if enable CONFIG_ROCKCHIP_SPL_BACK_TO_BROM, we can append the U-Boot to IDB data:
cat u-boot.bin >> rk3288_idb.img
If
CONFIG_ROCKCHIP_SPL_BACK_TO_BROM not enabled, no more package operation is need for u-boot-dtb.bin, and it need to flalsh to 0x200 which is decide by 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:
loaderimage --pack --uboot u-boot.bin uboot.img
According to the partitions definition, the miniloader should write to offset 0x40 and this uboot.img should write to offset 0x4000.
Boot up
See boot option 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