uboot编译学习---编译命令

编译命令 

对于TQ2440开发板,编译U-Boot需要执行如下的命令:

  1. $  make  TQ2440_config  
  2. $  make  all  
$  make  TQ2440_config
$  make  all

使用上面的命令编译U-Boot,编译生成的所有文件都保存在源代码目录中。

为了保持源代码目录的干净,可以使用如下命令将编译生成的文件输出到一个外部目录,而不是在源代码目录中.

下面的2种方法都将编译生成的文件输出到 /tmp/build目录:

  1. $  export  BUILD_DIR=/tmp/build  
  2. $  make  TQ2440_config  
  3. $  make  all  
$  export  BUILD_DIR=/tmp/build
$  make  TQ2440_config
$  make  all

  1. $  make  O=/tmp/build  TQ2440_config  (注意是大写字母O,而不是数字0)  
  2. $  make  all  
$  make  O=/tmp/build  TQ2440_config  (注意是大写字母O,而不是数字0)
$  make  all

具体可以这样操作的原因,在顶层Makefile中:
  1. #########################################################################   
  2. #   
  3. # U-boot build supports producing a object files to the separate external   
  4. # directory. Two use cases are supported:   
  5. #   
  6. # 1) Add O= to the make command line   
  7. # 'make O=/tmp/build all'   
  8. #   
  9. # 2) Set environement variable BUILD_DIR to point to the desired location   
  10. # 'export BUILD_DIR=/tmp/build'   
  11. # 'make'   
  12. #   
  13. # The second approach can also be used with a MAKEALL script   
  14. # 'export BUILD_DIR=/tmp/build'   
  15. # './MAKEALL'   
  16. #   
  17. # Command line 'O=' setting overrides BUILD_DIR environent variable.   
  18. #   
  19. # When none of the above methods is used the local build is performed and   
  20. # the object files are placed in the source directory.   
  21. #   
  22.   
  23. ifdef O  
  24. ifeq ("$(origin O)""command line")  
  25. BUILD_DIR := $(O)  
  26. endif  
  27. endif  
  28.   
  29. ifneq ($(BUILD_DIR),)  
  30. saved-output := $(BUILD_DIR)  
  31.   
  32. # Attempt to create a output directory.   
  33. $(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})  
  34.   
  35. # Verify if it was successful.   
  36. BUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd)  
  37. $(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))  
  38. endif 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值