当前位置:网站首页>Andorid source build/envsetup. SH details to know
Andorid source build/envsetup. SH details to know
2022-06-30 00:03:00 【broadview_ java】
1. Preface
Compiling Android Source code , The system environment variables must be initialized at the beginning , Two familiar commands :
source build/envsetup.sh
lunch xxx
Initialize like this , What's the point , What quick development instructions can be used after initializing environment variables ? Let's summarize .
2. envsetup.sh command
perform source build/envsetup.sh On command , there envsetup.sh By link here we are build/make/envsetup.sh file

Enter... At the terminal hmm command , as follows :
[email protected]:~/project/code$ hmm
Run "m help" for help with the build system itself.
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- lunch: lunch <product_name>-<build_variant>
Selects <product_name> as the product to build, and <build_variant> as the variant to
build, and stores those selections in the environment to be read by subsequent
invocations of 'm' etc.
- tapas: tapas [<App1> <App2> ...] [arm|x86|mips|arm64|x86_64|mips64] [eng|userdebug|user]
- croot: Changes directory to the top of the tree, or a subdirectory thereof.
- m: Makes from the top of the tree.
- mm: Builds all of the modules in the current directory, but not their dependencies.
- mmm: Builds all of the modules in the supplied directories, but not their dependencies.
To limit the modules being built use the syntax: mmm dir/:target1,target2.
- mma: Builds all of the modules in the current directory, and their dependencies.
- mmma: Builds all of the modules in the supplied directories, and their dependencies.
- umake: Call ninja directly to speed up build when there is no modifications to .mk or .bp files.
- provision: Flash device with all required partitions. Options will be passed on to fastboot.
- cgrep: Greps on all local C/C++ files.
- ggrep: Greps on all local Gradle files.
- jgrep: Greps on all local Java files.
- resgrep: Greps on all local res/ xml files.
- mangrep: Greps on all local AndroidManifest.xml files.
- mgrep: Greps on all local Makefiles files.
- sepgrep: Greps on all local sepolicy files.
- sgrep: Greps on all local source files.
- godir: Go to the directory containing a file.
- allmod: List all modules.
- gomod: Go to the directory containing a module.
- pathmod: Get the directory containing a module.
- refreshmod: Refresh list of modules for allmod/gomod.
Environment options:
- SANITIZE_HOST: Set to 'true' to use ASAN for all host modules. Note that
ASAN_OPTIONS=detect_leaks=0 will be set by default until the
build is leak-check clean.
- ANDROID_QUIET_BUILD: set to 'true' to display only the essential messages.
Explain one by one :
command | interpretative statement |
| lunch | lunch <product_name>-<build_variant> choice <product_name> As a product to build ,<build_variant> As a variant to build , And store these choices in the environment , For subsequent calls “m” Wait to read . |
| tapas | Interactive mode :tapas [<App1> <App2> ...] [arm|x86|mips|arm64|x86_64|mips64] [eng|userdebug|user] |
| croot | Change the directory to the top of the tree or its subdirectories . |
| m | Compile the whole source code , You don't have to switch to the root directory |
mm | Compile the source code in the current directory , Do not include their dependent modules |
mmm | Compile all modules in the specified directory , Do not include their dependent modules for example :mmm dir/:target1,target2. |
mma | Compile the source code in the current directory , Include their dependent modules |
| umake | When .mk or .bp When the file has not been modified , Call directly ninja To speed up the construction of . |
mmma | Compile the required modules in the specified directory , Include their dependent modules |
provision | Flash memory device with all required partitions . Options will be passed to fastboot. |
cgrep | For all local of the system C/C++ File execution grep command |
ggrep | For all local of the system Gradle File execution grep command |
jgrep | For all local of the system Java File execution grep command |
resgrep | For all local of the system res In the catalog xml File execution grep command |
mangrep | For all local of the system AndroidManifest.xml File execution grep command |
mgrep | For all local of the system Makefiles File execution grep command |
sepgrep | For all local of the system sepolicy File execution grep command |
sgrep | For all local of the system source File execution grep command |
godir | according to godir Find the parameter file name in the whole directory , And switch directories |
allmod | List all modules |
gomod | Go to the directory containing the module |
pathmod | Get the directory containing the module |
refreshmod | Refresh allmod/gomod Module list of |
2.1 croot
croot The Chinese translation of “ root ”, It roughly means to go back to the root directory of the project code , For example, you are under a certain module , Want to go back to the root directory , Execute this command :
[email protected]:~/project/mount/cts/android11$ cd frameworks/base/packages/services/
[email protected]:~/project/mount/cts/android11/frameworks/base/packages/services$ croot
[email protected]:/mnt/mount/cts/android11$
2.2 gomod <module>
Jump directly to a sub module , This is very convenient to switch and view the module code
[email protected]:/mnt/mount/cts/android11$ gomod Settings
[email protected]:/mnt/mount/cts/android11/packages/apps/Settings$2.3 pathmod <module>
Displays the path of the current module and pwd Command means the same
[email protected]:/mnt/mount/cts/android11/packages/apps/Settings$ pathmod Settings
/mnt/mount/cts/android11/packages/apps/Settings2.4 m mm mmm
Compile the whole project , Common commands for compiling a module
2.5 umake
When modifying the code of a module , No new addition java file , Resource file , No modification Android.bp Android.mk, Use this command to speed up compilation .
2.6 grep Search for
These commands can be very quick , Find the target file efficiently
jgrep "findString" : Search in this directory for a file containing findString All of the java file
mgrep "findString" : Search in this directory for a file containing findString All of the mk file
resgrep "findString" : Search in this directory for a file containing findString All the resources of (xml) file
mangrep "findString" : Search in this directory for a file containing findString All of the AndroidManifest.xml file
3. lunch command
When performing the lunch After the command :
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=11
TARGET_PRODUCT=full_k79v1_64
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=cortex-a53
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=cortex-a53
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.13.0-41-generic-x86_64-Ubuntu-20.04.3-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=RP1A.200720.011
OUT_DIR=out
============================================
We explain these parameters :
| lunch result | interpretative statement |
| PLATFORM_VERSION_CODENAME=REL | Indicates the name of the platform version |
| PLATFORM_VERSION=11 | Android Version number of the platform |
| TARGET_PRODUCT=full_k79v1_64 | The name of the compiled product |
| TARGET_BUILD_VARIANT=userdebug | The type of product being compiled |
| TARGET_BUILD_TYPE=release | The type of compilation ,debug and release |
| TARGET_ARCH=arm | That represents the compilation target CPU framework |
| TARGET_ARCH_VARIANT=armv8-a | That represents the compilation target CPU Architecture version |
| TARGET_CPU_VARIANT=cortex-a53 | That represents the compilation target CPU Code name |
| HOST_ARCH=x86_64 | Represents the architecture of the compilation platform |
| HOST_2ND_ARCH=x86 | Represents the second... Of the compilation platform CPU framework |
| HOST_OS=linux | Represents the operating system of the compilation platform |
| HOST_OS_EXTRA=Linux-5.13.0-41-generic-x86_64-Ubuntu-20.04.3-LTS | Compile additional information outside the system |
| HOST_CROSS_OS=windows | |
HOST_CROSS_ARCH=x86 | |
| HOST_CROSS_2ND_ARCH=x86_64 | |
HOST_BUILD_TYPE=release | Compile type |
| BUILD_ID=RP1A.200720.011 | BUILD_ID Will appear in the version information , You can use |
| OUT_DIR=out | Path of compilation result output |
边栏推荐
- 数莓派 4怎么样?可能的玩法有哪些?
- Create an API rapid development platform, awesome!
- What is online account opening? In addition, is it safe to open a mobile account?
- 网上开户选哪个证券公司?还有,在线开户安全么?
- HTAP x cloud native: tidb accelerates the release of data value and realizes data agility
- 绿树公司官方网站
- This simple little function saves 213 hours for our production research team in half a year
- xutils3传集合
- 除子
- Virtual machine online migration based on openstack
猜你喜欢

After working in the software development industry for six years, I changed my ideas in those years

Yunhe enmo Guoqiang, identifiez - le, saisissez - le, avant l'ébullition de la base de données nationale

【一起上水硕系列】Day 8

6.28 problem solving

What is IGMP? What is the difference between IGMP and ICMP?

Leetcode (680) -- verifying palindrome string II
![克隆無向圖[bfs訪問每條邊而不止節點]](/img/34/2a1b737b6095293f868ec6aec0ceeb.png)
克隆無向圖[bfs訪問每條邊而不止節點]

QT learning 02 GUI program example analysis
500 error occurred after importing skins folder into solo blog skin

matlab习题 —— 程序控制流程练习
随机推荐
History of deep learning
Bee常用配置
Construction of module 5 of actual combat Battalion
Solr基础操作14
What is IGMP? What is the difference between IGMP and ICMP?
Sword finger offer 13 Range of motion of robot
Analysis of define incdir command in TCL script of Modelsim
除子
QT learning 07 coordinate system in QT
我想知道今天还可以开户么?另外想问,现在在线开户安全么?
Andorid source build/envsetup.sh 该知道的细节
[LeetCode] 只出现一次的数字【136】
vlog常用参数解析
xutils3传集合
Embedded development: Hardware in the loop testing
Solr基础操作6
雲和恩墨蓋國强,識別它、抓住它,在國產數據庫沸騰以前
Cartoon security HIDS, EDR, NDR, XDR
Do mysqlcdc data not support windowing functions like row_ Number, lead
Et la tarte aux framboises 4? Quels sont les jeux possibles?