1.相关资料及开发环境
开发板:NanoPC-T3_plus
OS:Ubuntu20.04
参考资料:https://wiki.friendlyarm.com/wiki/index.php/NanoPC-T3_Plus/zh
2.编译U-Boot
根据参考资料,用git克隆了U-Boot v2016.01源代码,切换到nanopi2-v2016.01分支。进入u-boot编译,过程如下:
#克隆u-boot仓库
git clone https://github.com/friendlyarm/u-boot.git
#切换分支
cd u-boot git checkout nanopi2-v2016.01
#编译配置
make s5p6818_nanopi3_defconfig
#用交叉编译器进行4线程编译
make -j4 CROSS_COMPILE=aarch64-linux-
3.编译错误
在编译过程中产生如下如下错误:
/bin/sh: 1: dtc: not found
make[2]: *** [scripts/Makefile.lib:296: arch/arm/dts/s5p6818-drone.dtb] Error 127
make[1]: *** [dts/Makefile:36: arch-dtbs] Error 2
make: *** [Makefile:1249: dts] Error 2
4.错误原因
uboot编译需要dtc相关命令的支持
dtc是device-tree-compiler的缩写,即设备树编译器,说明系统中没有安装这个编译器
5.解决方案
安装设备树编译器即可
sudo apt-get install device-tree-compiler
6.编译结果
编译前:
fyywhy@CTO:/work/nanopc-t3-plus/u-boot$ ls
api config.mk drivers include Licenses net snapshot.commit
arch configs dts Kbuild MAINTAINERS post test
board disk examples Kconfig MAKEALL README tools
common doc fs lib Makefile scripts
编译后:
fyywhy@CTO:/work/nanopc-t3-plus/u-boot$ ls
api drivers Kconfig README u-boot.cfg
arch dts lib scripts u-boot.lds
board examples Licenses snapshot.commit u-boot.map
common fip-nonsecure.bin MAINTAINERS System.map u-boot.srec
config.mk fip-nonsecure.img MAKEALL test
configs fs Makefile tools
disk include net u-boot
doc Kbuild post u-boot.bin
编译成功,得到fip-nonsecure.img,可以通过fastboot、sd-fuse_s5p6818和eflasher ROM来更新板上的U-Boot v2016.01。