准备 请看友善 som-rk3399 uboot 移植
uboot 介绍 基于 TPL/SPL uboot 文件生成依赖关系
1 2 idbloader.img <-------- U-Boot TPL/SPL u-boot.itb <----------- U-Boot 和 bl31.elf
uboot 源码下载 这里选择 v2023.07.y 版本
1 git clone https://source.denx.de/u-boot/u-boot.git -b u-boot-2023.07.y
编译 uboot 使用 uboot 配置文件
1 2 make distclean -j12 ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- make evb-rk3399_defconfig -j12 ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
编译 uboot 命令
1 make -j12 ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
出现错误,这个问题是缺少 python setuptools 工具
1 2 3 4 5 6 7 8 9 10 File "/home/mo/develop/som-rk3399/sdk/uboot/u-boot-u-boot-2023.07.y/scripts/dtc/pylibfdt/setup.py", line 23, in <module> from setuptools import setup, Extension ModuleNotFoundError: No module named 'setuptools' make[2]: *** [scripts/dtc/pylibfdt/Makefile:33: rebuild] Error 1 make[1]: *** [scripts/Makefile.build:397: scripts/dtc/pylibfdt] Error 2 make[1]: *** Waiting for unfinished jobs.... UPD include/generated/generic-asm-offsets.h UPD include/generated/asm-offsets.h LDS u-boot.lds make: *** [Makefile:2012: scripts_dtc] Error 2
安装 python 依赖
1 2 sudo apt install python3-pip pip install setuptools
再次执行编译 uboot 命令
1 make -j12 ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
出现错误,这个错误是因为在 .,.,./board/rockchip/evb_rk3399,arch/arm/dts 目录下找不到 atf-bl31 文件,这个文件我们可以自行编译 atf 获得,或者使用 rockchip 编译好的 atf 文件
1 2 binman: Filename 'atf-bl31' not found in input path (.,.,./board/rockchip/evb_rk3399,arch/arm/dts) (cwd='/home/mo/develop/som-rk3399/sdk/uboot/u-boot-u-boot-2023.07.y') make: *** [Makefile:1114: .binman_stamp] Error 1
ATF github
1 https://github.com/ARM-software/arm-trusted-firmware
atf-bl31
1 https://github.com/rockchip-linux/rkbin/tree/master/bin/rk33
下载好后我们放到 uboot 根目录, 重定向 atf-bl31 文件地址
1 export BL31=${BL31_PATH}
再次执行编译 uboot 命令
1 make -j12 ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
出现错误,这个是因为缺少 python 工具 elftools
1 2 3 Wrote map file './simple-bin.map' to show errors binman: Node '/binman/simple-bin/fit': subnode 'images/@atf-SEQ': Failed to read ELF file: Python: No module named 'elftools' make: *** [Makefile:1115: .binman_stamp] Error 1
安装 python elftools
再次执行编译 uboot 命令编译成功
1 make -j12 ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-