Android源码编译笔记——envsetup.sh脚本提供的主要函数

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
mmmake当前目录下所有模块,但不包括它们的依赖
mmamake当前目录下所有模块,包括它们的依赖
mmmmake指定目录下模块,但不包括它们的依赖
mmmamake指定目录下模块,包括它们的依赖
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 函数的执行示例:

sy@ubuntu:~/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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值