以编译 smdk2410开发板 为例:
make distclean // 清除所有痕迹
make smdk2410_config // 配置U-Boot参数为smdk2410的参数,对应配置参数见include/configs/smdk2410.h。这些配置参数的含义可部分参考U-Boot根目录下的Readme
make all // 编译U-boot及内带的工具
另外,如下集成命令可能更加方便:
make smdk2410 // 功能同下面几个命令的集合:
make unconfig
make smdk2410_config
make // Makefile中第一个目标为 all, 所以make 命令等同于 make all
默认U-boot将编译生成的文件与其源文件放置一起,使用如下两种方法之一可将编译生成的obj文件、最终文件等放置于其它目录下。
1. Add O= to the make command line invocations
make O=/tmp/build distclean
make O=/tmp/build canyonlands_config
make O=/tmp/build all
Note that if the 'O=output/dir' option is used then it must be used for all invocations of make.
2. Set environment variable BUILD_DIR
to point to the desired location:
export BUILD_DIR=/tmp/build
make distclean
make canyonlands_config
make all
3. 我自己的处理方式:修改Makefile,省得经常要多敲字符
ifdef O
ifeq ("$(origin O)", "command line")
BUILD_DIR := $(O)
endif
else # Alex.shi, 20100613
BUILD_DIR := build
endif
需要特别注意的是:命令行的"O="设置回覆盖环境变量BUILD_DIR
的设置。
make all
命令执行后,将生成如下三种镜像格式:
Ø
"u-boot.bin" is a raw binary image
Ø
"u-boot" is an image in ELF binary format
Ø
"u-boot.srec" is in Motorola S-Record format