交叉编译u-boot
1 配置交叉编译工具链:
下载地址 https://releases.linaro.org/components/toolchain/binaries/
### CROSS-COMPILE
export AARCH64_LINUX_GNU_TOOLS=/media/wmx/cross_compile_tools/aarch64-linux-gun/gcc-x86_64_aarch64-linux-gnu/bin
export ARM_LINUX_GNUEABI_TOOLS=/media/wmx/cross_compile_tools/arm-linux-guneabi/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi/bin/
export ARM_LINUX_GNUEABIHF_TOOLS=/media/wmx/cross_compile_tools/arm-linux-guneabihf/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin
2 编译脚本 mybuild.sh
#!/bin/bash#make mrproper
#make ARCH=arm64 mrproper
#make clean#----1 [CROSS_COMPILE & ARCH]
echo "step1 TARGET_ARCH = arm64 arm-sf arm-hf"
TARGET_ARCH=arm-hf
case $TARGET_ARCH inarm64)#---arm64echo " -------- build target arm64 -------- "export CROSS_COMPILE=$AARCH64_LINUX_GNU_TOOLS/aarch64-linux-gnu-export ARCH=arm64;;arm-hf)#---arm-hfecho " -------- build target arm hard float -------- "export CROSS_COMPILE=$ARM_LINUX_GNUEABIHF_TOOLS/arm-linux-gnueabihf-export ARCH=arm;;arm-hf)#---arm-sfecho " -------- build target arm soft float -------- "export CROSS_COMPILE=$ARM_LINUX_GNUEABI_TOOLS/arm-linux-gnueabi-export ARCH=arm;;
esacecho "CROSS_COMPILE = "$CROSS_COMPILE
echo "ARCH = "$ARCH#----2 [BOARD]
#u-boot-path=/path/to/u-boot
echo "step2 BOARD= ls $(u-boot-path)/configs "
BOARD=vexpress_ca9x4_defconfigcase $BOARD inorangepi-5-rk3588s_defconfig)echo " -------- board is orangepi-5-rk3588s_defconfig -------- "export ROCKCHIP_TPL=/media/wmx/linux-workspace/my-kernel/rkbin/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.16.binexport BL31=/media/wmx/linux-workspace/my-kernel/rkbin/bin/rk35/rk3588_bl31_v1.45.elfmake orangepi-5-rk3588s_defconfig;;vexpress_ca9x4_defconfig)echo " -------- board is vexpress_ca9x4_defconfig -------- "make vexpress_ca9x4_defconfig;;rpi_4_defconfig)echo " -------- board is rpi_4_defconfig -------- "make rpi_4_defconfig;;
esac make -j48echo "...finish and exit ..."
exit 0
3 执行脚本
修改脚本,执行不同的配置
TARGET_ARCH=arm-hf
BOARD=vexpress_ca9x4_defconfig
./mybuild.sh
4 qemu测试
在u-boot 路径下执行
qemu-system-arm -M vexpress-a9 -m 512M -kernel ./u-boot -nographic -no-reboot