首先选择一个uboot版本官网链接,如下图所示,
解压缩即可,然后使用命令 git clone https://github.com/linux-sunxi/sunxi-tools
获取sunxi-tools
,然后进入sunxi-tools
目录执行make
,遇到如下报错
Setting version information: c21f4a60
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ -o sunxi-fexc fexc.c script.c script_uboot.c script_bin.c script_fex.c
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ -o sunxi-bootinfo bootinfo.c
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ `pkg-config --cflags libusb-1.0` `pkg-config --cflags zlib` -o sunxi-fel \
fel.c fit_image.c progress.c soc_info.c fel_lib.c fel-spiflash.c `pkg-config --libs libusb-1.0` `pkg-config --libs zlib` -lfdt
fit_image.c:19:10: fatal error: libfdt.h: No such file or directory
19 | #include <libfdt.h>
| ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:145: sunxi-fel] Error 1
执行命令apt-get install libfdt-dev
即可,然后重新make,成功如下图。
然后编译uboot,make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- A33-OLinuXino_defconfig
,make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j8,进行编译即可,编译成功会生成u-boot-sunxi-with-spl.bin
文件,然后执行./sunxi-tools/sunxi-fel uboot u-boot/u-boot-sunxi-with-spl.bin
命令即可