编译命令
对于TQ2440开发板,编译U-Boot需要执行如下的命令:
- $ make TQ2440_config
- $ make all
$ make TQ2440_config
$ make all
使用上面的命令编译U-Boot,编译生成的所有文件都保存在源代码目录中。
为了保持源代码目录的干净,可以使用如下命令将编译生成的文件输出到一个外部目录,而不是在源代码目录中.
下面的2种方法都将编译生成的文件输出到 /tmp/build目录:
- $ export BUILD_DIR=/tmp/build
- $ make TQ2440_config
- $ make all
$ export BUILD_DIR=/tmp/build
$ make TQ2440_config
$ make all
或
- $ make O=/tmp/build TQ2440_config (注意是大写字母O,而不是数字0)
- $ make all
$ make O=/tmp/build TQ2440_config (注意是大写字母O,而不是数字0)
$ make all
具体可以这样操作的原因,在顶层Makefile中:
- #########################################################################
- #
- # U-boot build supports producing a object files to the separate external
- # directory. Two use cases are supported:
- #
- # 1) Add O= to the make command line
- # 'make O=/tmp/build all'
- #
- # 2) Set environement variable BUILD_DIR to point to the desired location
- # 'export BUILD_DIR=/tmp/build'
- # 'make'
- #
- # The second approach can also be used with a MAKEALL script
- # 'export BUILD_DIR=/tmp/build'
- # './MAKEALL'
- #
- # Command line 'O=' setting overrides BUILD_DIR environent variable.
- #
- # When none of the above methods is used the local build is performed and
- # the object files are placed in the source directory.
- #
- ifdef O
- ifeq ("$(origin O)", "command line")
- BUILD_DIR := $(O)
- endif
- endif
- ifneq ($(BUILD_DIR),)
- saved-output := $(BUILD_DIR)
- # Attempt to create a output directory.
- $(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})
- # Verify if it was successful.
- BUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd)
- $(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))
- endif