Android Build System Architecture
其中$(TOP)/Makefile位于android的顶层目录中。其它Makefile文件均位于$(TOP)/build/core目录下
Initialize the environment
初始化编译环境使用的是$(TOP)/build/envsetup.sh脚本。
envsetup.sh提供的函数如下:
函数 | 功能 |
hmm | 帮助命令,envsetup.sh提供的函数的用法 |
get_abs_build_var | |
get_build_var | |
check_product | |
check_variant | |
setpaths | |
printconfig | |
set_stuff_for_environment | |
set_sequence_number | |
settitle | |
addcompletions | |
choosetype | |
chooseproduct | |
choosevariant | |
choosecombo | |
add_lunch_combo | |
print_lunch_menu | |
lunch | |
_lunch | |
tapas | |
gettop | |
getdriver | |
m | 从顶层目录build整个系统 |
mmm | build指定目录下所有的模块 |
mma | build当前目录下所有的模块以及这些模块所依赖的模块 |
mmma | build指定目录下所有的模块以及这些模块所依赖的模块 |
croot | 到android所在的顶层目录 |
cproj | |
qpid | |
pid | |
systemstack | |
stacks | |
gdbwrapper | |
sgrep | |
gettargetarch | |
jgrep | |
cgrep | |
resgrep | |
mangrep | |
sepgrep | |
mgrep | |
treegrep | |
getprebuilt | |
tracedmdump | |
runhat | |
getbugreports | |
getsdcardpath | |
getscreenshotpath | |
startviewserver | |
isviewserverstarted | |
key_home | |
key_back | |
key_menu | |
smoketest | |
runtest | |
godir | |
set_java_home | |
pez | |
findnmakefile | |
gdbcleint | |
# Clear this variable. It will be built up again when the vendorsetup.sh
# files are included at the end of this file.
unset LUNCH_MENU_CHOICES
function add_lunch_combo()
{
local new_combo=$1
local c
for c in ${LUNCH_MENU_CHOICES[@]} ; do
if [ "$new_combo" = "$c" ] ; then
return
fi
done
LUNCH_MENU_CHOICES=(${LUNCH_MENU_CHOICES[@]} $new_combo)
}
# add the default one here
add_lunch_combo aosp_arm-eng
add_lunch_combo aosp_x86-eng
add_lunch_combo aosp_mips-eng
add_lunch_combo aosp_x86_64-eng
add_lunch_combo vbox_x86-eng
调用add_lunch_combo函数将 combo配置到LUNCH_MENU_CHOICES变量中。lunch命令就是选择combo。# Execute the contents of any vendorsetup.sh files we can find.
for f in `test -d device && find device -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null` \
`test -d vendor && find vendor -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null`
do
echo "including $f"
. $f
done
unset f
搜索device目录下所有的vendorsetup.sh,并执行。下面是ti的vendorsetup.sh的例子:add_lunch_combo full_panda-userdebug
其中full_panda-userdebug分为两部分,一部分是product name:full_panda,一部分是Build variant:userdebug. build variant共有三种选择分别是user, userdebug, engeng:工程机
user:最终用户机
userdebug:调试测试机
编译环境设置完成后,就可以编译整个android系统。