Build U-Boot(基于SDK安装环境的,重点记录)refer Linux Academy for AM64X
需要重新编译的情况:
- Enabling features which are disabled in the U-Boot defconfig
- Disabling features which are enabled in the U-Boot defconfig
- Modifying U-Boot source code to port U-Boot to a custom board
important tip:
- 一定注意ubuntu是ubuntu18.04.6LTS,尽量不要使用很久以前发布的镜像
- 需要先sudo su,提升权限。否则在sudo make时系统变量失效,导致arm-none-linux-gnueabihf-gcc can’t found错误。
step:
- Getting Security Dev Tool(must be set for HS)
$ git clone https://git.ti.com/git/security-development-tools/core-secdev-k3.git -b master
$ export TI_SECURE_DEV_PKG=`pwd`/core-secdev-k3
- Set Toolchain Path And Other Path
export SDK_INSTALL_DIR=/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04
export PATH=$PATH:$SDK_INSTALL_DIR/linux-devkit/sysroots/x86_64-arago-linux/usr/bin
export UBOOT_DIR=/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/board-support/u-boot-2021.01+gitAUTOINC+2dd2e1d366-g2dd2e1d366
- Compile R5 Image
$ cd $UBOOT_DIR
$ export ARCH=arm
$ export CROSS_COMPILE=arm-none-linux-gnueabihf-
$ make am64x_evm_r5_defconfig O=build/r5
$ make O=build/r5
$ cd ../k3-image-gen-<version>/
$ make SOC=am64x SBL=$UBOOT_DIR/build/r5/spl/u-boot-spl.bin SYSFW_PATH=../prebuilt-images/<TI-SYSFW.bin>
**tip**:如果是GP版本,则不需要SYSFW_PATH,忽略即可。
```bash
$ make SOC=am64x SBL=<UBOOT_DIR>/build/r5/spl/u-boot-spl.bin
- Compile ARM64 Image
tip:
$ cd $UBOOT_DIR
$ export ARCH=arm
$ export CROSS_COMPILE=aarch64-none-linux-gnu-
$ make am64x_evm_a53_defconfig O=build/arm64
$ make ATF=$(pwd)/../prebuilt-images/bl31.bin TEE=$(pwd)/../prebuilt-images/bl32.bin O=build/arm64 #may be error,refer blow
- unable to execute ‘swig’: No such file or directory
error: command ‘swig’ failed with exit status 1
sudo apt install swig
tip:pay attention to python version
- scripts/dtc/pylibfdt/libfdt_wrap.c:149:11: fatal error: Python.h: No such file or directory
sudo apt-get install python-dev
sudo apt-get install python3.6-dev #attention,match your python3 version ,my version is 3.6.9
Target Images
The steps above will generate the following U-Boot images.
-
tiboot3.bin
Located under folder <SDK_INSTALL_DIR>/board-support/k3-image-gen-/. This is the first stage of the boot loader running on R5F core. -
tispl.bin
Located under folder <UBOOT_DIR>/build/arm64/. This is the first stage of the boot loader running on A53 core. -
u-boot.img
Located under folder <UBOOT_DIR>/build/arm64/. This is the second stage of the boot loader running on A53 core.
Update U-Boot on SD Card
$ ls /media/<username>/boot
tiboot3.bin tispl.bin uboot.env u-boot.img uEnv.txt wificfg
$ cd <UBOOT_DIR>
$ sudo cp ../k3-image-gen-<version>/tiboot3.bin /media/<username>/boot/
$ sudo cp build/arm64/tispl.bin /media/<username>/boot/
$ sudo cp build/arm64/u-boot.img /media/<username>/boot/
$ sudo umount /media/<username>/boot