android 编译步骤分析之envsetup.sh
1. cd AP 进入AP目录,如果已经进入到了A目录,可以忽略
2. source build/envsetup.sh 初始编译环境,envsetup.sh里面是一些编译命令,类似于linxu自带的ls cd等指令
cwm@cwm-OptiPlex-7060:~/work/project/gm/android_p/AP$ source build/envsetup.sh including device/generic/car/vendorsetup.shincluding device/generic/mini-emulator-arm64/vendorsetup.shincluding device/generic/mini-emulator-armv7-a-neon/vendorsetup.shincluding device/generic/mini-emulator-x86_64/vendorsetup.shincluding device/generic/mini-emulator-x86/vendorsetup.shincluding device/generic/uml/vendorsetup.shincluding device/google/muskie/vendorsetup.shincluding device/google/taimen/vendorsetup.shincluding device/qcom/common/vendorsetup.shincluding device/qcom/qssi/vendorsetup.shincluding vendor/dolby/device/sailfish_dax1_sw/vendorsetup.shincluding vendor/dolby/device/walleye_dax1_sw/vendorsetup.shincluding vendor/qcom/opensource/core-utils/vendorsetup.shincluding vendor/qcom/proprietary/common/vendorsetup.shincluding sdk/bash_completion/adb.bash
3. lunch 这个lunc命令执行了第二步以后,在当前环境存在的,选择的是第40个选项 40. msm8937_64-userdebug
cwm@cwm-OptiPlex-7060:~/work/project/gm/android_p/AP$ lunchYou're building on LinuxLunch menu... pick a combo:1. aosp_arm-eng2. aosp_arm64-eng3. aosp_mips-eng4. aosp_mips64-eng5. aosp_x86-eng6. aosp_x86_64-eng7. aosp_car_arm-userdebug8. aosp_car_arm64-userdebug9. aosp_car_x86-userdebug10. aosp_car_x86_64-userdebug11. mini_emulator_arm64-userdebug12. m_e_arm-userdebug13. mini_emulator_x86_64-userdebug14. mini_emulator_x86-userdebug15. uml-userdebug16. aosp_walleye-userdebug17. aosp_walleye_test-userdebug18. aosp_taimen-userdebug19. msm8974-userdebug20. msm8610-userdebug21. msm8226-userdebug22. apq8084-userdebug23. mpq8092-userdebug24. msm_bronze-userdebug25. msm8916_32-userdebug26. msm8916_32_512-userdebug27. msm8916_32_k64-userdebug28. msm8916_64-userdebug29. msm8994-userdebug30. msm8996-userdebug31. msm8909-userdebug32. msm8909go-userdebug33. msm8909_512-userdebug34. msm8909_512go-userdebug35. msm8992-userdebug36. msm8952_64-userdebug37. msm8952_32-userdebug38. msm8937_32-userdebug39. msm8937_32go-userdebug40. msm8937_64-userdebug41. msm8953_32-userdebug42. msm8953_64-userdebug43. msm8998-userdebug44. msm8998_32-userdebug45. sdm660_64-userdebug46. sdm660_32-userdebug47. sdm845-userdebug48. apq8098_latv-userdebug49. sdm710-userdebug50. msmnile-userdebug51. msmnile_au-userdebug52. qcs605-userdebug53. talos-userdebug54. talos_au-userdebug55. qssi-userdebug56. sailfish_dax1_sw-userdebug57. walleye_dax1_sw-userdebugWhich would you like? [aosp_arm-eng] 40
4. make -j6 开始编译根据需要选择自己的核数
第2步的envsetup.sh脚本分析之lunch命令
function lunch()
{local answerif [ "$1" ] ; thenanswer=$1 #如果lunch时带参数,那么就执行这条语句elseprint_lunch_menu #把所支持的平台信息显示在终端,用于平台选择,此函数在下面有分析echo -n "Which would you like? [aosp_arm-eng] "read answerfilocal selection=if [ -z "$answer" ]thenselection=aosp_arm-engelif (echo -n $answer | grep -q -e "^[0-9][0-9]*$")thenif [ $answer -le ${#LUNCH_MENU_CHOICES[@]} ]thenselection=${LUNCH_MENU_CHOICES[$(($answer-1))]}fielseselection=$answerfiexport TARGET_BUILD_APPS=local product variant_and_version variant versionproduct=${selection%%-*} # Trim everything after first dashvariant_and_version=${selection#*-} # Trim everything up to first dashif [ "$variant_and_version" != "$selection" ]; thenvariant=${variant_and_version%%-*}if [ "$variant" != "$variant_and_version" ]; thenversion=${variant_and_version#*-}fifiif [ -z "$product" ]thenechoecho "Invalid lunch combo: $selection"return 1fiTARGET_PRODUCT=$product \TARGET_BUILD_VARIANT=$variant \TARGET_PLATFORM_VERSION=$version \build_build_var_cacheif [ $? -ne 0 ]thenreturn 1fiexport TARGET_PRODUCT=$(get_build_var TARGET_PRODUCT)export TARGET_BUILD_VARIANT=$(get_build_var TARGET_BUILD_VARIANT)if [ -n "$version" ]; thenexport TARGET_PLATFORM_VERSION=$(get_build_var TARGET_PLATFORM_VERSION)elseunset TARGET_PLATFORM_VERSIONfiexport TARGET_BUILD_TYPE=releaseechoset_stuff_for_environmentprintconfigdestroy_build_var_cache
}
print_lunch_menu函数分析
function print_lunch_menu()
{local uname=$(uname)echoecho "You're building on" $unameechoecho "Lunch menu... pick a combo:"local i=1local choicefor choice in ${LUNCH_MENU_CHOICES[@]} #LUNCH_MENU_CHOICES保存的是所有平台信息,平台信息收集是通过add_lunch_combo函数doecho " $i. $choice"i=$(($i+1))doneecho
}
add_lunch_combo函数分析
unset LUNCH_MENU_CHOICES
function add_lunch_combo() #调用此函数,同时跟一个代表平台信息的参数,此函数会在不同目录下的vendorsetup.sh脚本被调用
{local new_combo=$1local cfor c in ${LUNCH_MENU_CHOICES[@]} ; doif [ "$new_combo" = "$c" ] ; thenreturnfidoneLUNCH_MENU_CHOICES=(${LUNCH_MENU_CHOICES[@]} $new_combo)
}
遍历的目录包含device vendor product
# Execute the contents of any vendorsetup.sh files we can find.
for f in `test -d device && find -L device -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null | sort` \`test -d vendor && find -L vendor -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null | sort` \`test -d product && find -L product -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null | sort`
doecho "including $f". $f
done
unset f
查看device/qcom/common目录下的vendorsetup.sh,加载了以下平台信息
#
# Copyright (c) 2012, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#add_lunch_combo msm8974-userdebug
add_lunch_combo msm8610-userdebug
add_lunch_combo msm8226-userdebug
add_lunch_combo apq8084-userdebug
add_lunch_combo mpq8092-userdebug
add_lunch_combo msm_bronze-userdebug
add_lunch_combo msm8916_32-userdebug
add_lunch_combo msm8916_32_512-userdebug
add_lunch_combo msm8916_32_k64-userdebug
add_lunch_combo msm8916_64-userdebug
add_lunch_combo msm8994-userdebug
add_lunch_combo msm8996-userdebug
add_lunch_combo msm8909-userdebug
add_lunch_combo msm8909go-userdebug
add_lunch_combo msm8909_512-userdebug
add_lunch_combo msm8909_512go-userdebug
add_lunch_combo msm8992-userdebug
add_lunch_combo msm8952_64-userdebug
add_lunch_combo msm8952_32-userdebug
add_lunch_combo msm8937_32-userdebug
add_lunch_combo msm8937_32go-userdebug
add_lunch_combo msm8937_64-userdebug
add_lunch_combo msm8953_32-userdebug
add_lunch_combo msm8953_64-userdebug
add_lunch_combo msm8998-userdebug
add_lunch_combo msm8998_32-userdebug
add_lunch_combo sdm660_64-userdebug
add_lunch_combo sdm660_32-userdebug
add_lunch_combo sdm845-userdebug
add_lunch_combo apq8098_latv-userdebug
add_lunch_combo sdm710-userdebug
add_lunch_combo msmnile-userdebug
add_lunch_combo msmnile_au-userdebug
add_lunch_combo qcs605-userdebug
add_lunch_combo talos-userdebug
add_lunch_combo talos_au-userdebug
android 编译步骤分析之envsetup.sh相关推荐
- Android 编译(1)——Android编译步骤梳理
文章目录 Android编译步骤 envsetup.sh vendorsetup.sh add_lunch_combo命令 lunch命令 Android makefile inherit函数 And ...
- Android编译系统环境过程初始化分析【转】
本文转载自:http://blog.csdn.net/luoshengyang/article/details/18928789 Android源代码在编译之前,要先对编译环境进行初始化,其中最主要就 ...
- 【Bash百宝箱】Android envsetup.sh及lunch
文章目录 1.envsetup.sh 2.lunch 3.make 在Android开发环境中编译一个目标时,一般要执行下面三行命令: $ . build/envsetup.sh $ lunch &l ...
- android 编译
ubantu linux 相关文件的解析 /etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.并从/etc/profile.d目录的配置文件中搜集shell ...
- Android编译及编译脚本、Android构建基础学习笔记
Android编译及编译脚本.Android构建基础学习笔记 Android编译及编译脚本 概述 Android.mk转换成Android.bp 例子(简单Android.mk文件转Android.b ...
- Android编译系统分析四:实战-新增一个产品
通过上一节"android编译系统(三)-make"的分析,初步理清楚了编译初期加载产品相关信息的流程,整个过程主要涉及三个文件:1.AndroidProducts.mk,2.具体 ...
- 全志 android 编译,全志Android SDK编译详解(二)
注意要确定安装了jdk) 第一步: cd lichee; ./build.sh -p sun5i_elite -k 3.0 (apt-get install uboot-mkimage需要安装m ...
- H6机顶盒Android编译[2]-Android编译
注意:本人也是第一次android编译,记录其过程为方便自己,同时给初学者提供参考,不正确之处还望包含指正! 前言 使用易新泰的H6机顶盒平台,搭载全志H6处理器,使用易新泰提供的SDK环境,使用ub ...
- 理解Android编译命令(转)
一.引言 关于Android Build系统,这个话题很早就打算整理下,迟迟没有下笔,决定跟大家分享下.先看下面几条指令,相信编译过Android源码的人都再熟悉不过的. source setenv. ...
最新文章
- 基于OpenCV的实时睡意检测系统
- 解决git did not exit cleanly (exit code 128)
- J-Link驱动下载和JLINK下载Hex程序
- wcf系列---- binding的使用(1)
- 005 NsPack 1.4 之附加数据初探
- Struts2中的Action
- c语言和java和汇编语言_C语言和汇编语言的区别是什么?
- JS笔记:检测客户端(引擎、浏览器、平台、操作系统)
- input type:text输入框点击输入,文字消失
- AZURE kinect 深度相机配置ubuntu16.04
- CSDN 开学见面礼!3 周带你 Get 大厂工程师基础能力
- 内核并发控制---读写信号量(来自网易)
- linux .o文件,Linux 文件I/O
- 迭代DOM集合的几种方法
- RDIFramework.NET开发实例━表约束条件权限的使用-WinForm
- MySQL主从复制故障1595报错【原创】
- 网站和搜索引擎是分工协作的伙伴关系
- 禅道报表中关闭bug统计图_如何生成动态统计图,这款BI教你定义炫酷
- python语言程序设计教程赵璐电子版_python语言程序设计教程 赵璐pdf 相关实例(示例源码)下载 - 好例子网...
- 领导力培训知识点汇总及感悟-1