Android 學習筆記(七) U-Boot的配置與編譯

1          配置與編譯

1.1       經典方法

以編譯 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

1.2       編譯到其它目錄

默認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的設置。

1.3      鏡像格式

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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章