Android源码编译笔记——envsetup.sh脚本提供的主要函数
程序员文章站
2022-07-02 15:34:02
...
envsetup.sh位置
AOSP源码根目录/build/envsetup.sh
从8.0开始有略微调整,build/envsetup.sh
已经变成了一个指向 build/make/envsetup.sh
的链接文件:
ls -l build/envsetup.sh
lrwxrwxrwx 1 sy sy 16 Apr 13 01:24 build/envsetup.sh -> make/envsetup.sh
函数
函数 | 描述 |
---|---|
croot | 回到AOSP源码工程的根目录 |
m | 从源码树根节点开始执行make |
mm | make当前目录下所有模块,但不包括它们的依赖 |
mma | make当前目录下所有模块,包括它们的依赖 |
mmm | make指定目录下模块,但不包括它们的依赖 |
mmma | make指定目录下模块,包括它们的依赖 |
cgrep | 只针对所有 C/C++ 文件执行 grep 命令 |
ggrep | 只针对所有 gradle 文件执行 grep 命令 |
jgrep | 只针对所有 Java 文件执行 grep 命令 |
resgrep | 只针对所有 res/*.xml 文件执行 grep 命令 |
mangrep | 只针对所有 AndroidManifest.xml 文件执行 grep 命令 |
sepgrep | 只针对所有 sepolicy 文件执行 grep 命令 |
sgrep | 针对所有源代码文件执行 grep 命令 |
godir | 转到包含指定文件的目录下 |
hmm | 执行 . build/envsetup.sh 提供的功能说明,包括上面这些函数 |
下面是Android 7.1.2 版本 hmm
函数的执行示例:
[email protected]:~/android-7.1.2_r32$ hmm
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- lunch: lunch <product_name>-<build_variant>
- tapas: tapas [<App1> <App2> ...] [arm|x86|mips|armv5|arm64|x86_64|mips64] [eng|userdebug|user]
- croot: Changes directory to the top of the tree.
- 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.
- 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.
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.
Look at the source to view more functions. The complete list is:
addcompletions add_lunch_combo build_build_var_cache cgrep check_product check_variant choosecombo
chooseproduct choosetype choosevariant core coredump_enable coredump_setup cproj croot
destroy_build_var_cache findmakefile get_abs_build_var getbugreports get_build_var getdriver
getlastscreenshot get_make_command getprebuilt getscreenshotpath getsdcardpath gettargetarch gettop
ggrep godir hmm is isviewserverstarted jgrep key_back key_home key_menu lunch _lunch m make mangrep
mgrep mm mma mmm mmma pez pid printconfig print_lunch_menu provision qpid rcgrep resgrep runhat
runtest sepgrep set_java_home setpaths set_sequence_number set_stuff_for_environment settitle sgrep
smoketest stacks startviewserver stopviewserver systemstack tapas tracedmdump treegrep