一、环境准备
1. uboot源码地址
2. 基本环境
- 虚拟机 ubuntu 16.04
- 树莓派3B
- u-boot 2016.09
3.安装交叉编译链
本次编译需要的交叉编译链为arm-linux-gnueabi-gcc
sudo apt install gcc-arm-linux-gnueabi
4.设置环境变量
export ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
二、开始编译
1.解压u-boot-2016.09.tar.bz2
tar jxvf u-boot-2016.09.tar.bz2

2.生成.config配置文件
make rpi_3_32b_defconfig V=1 (V=1 表示make时显示详细信息)

3. 裁剪u-boot
make menuconfig

4.编译
make –j4

把生成的u-boot.bin文件拷贝到sd卡中,并在config.txt中添加:
kernel=u-boot.bin

三、可能存在的问题
- 编译时报出dtc not found,u-boot从u-boot 14.10引入Kbuild构建系统,uboot也加入了dtb模块 需要安装dtc
sudo apt install device-tree-compiler
网友评论