怎样实现了单独编译Android源代码中的模块中

接下来给大家介绍一下,怎样实现了单独编译Android源代码中的模块中
第一次下载好Android源代码后,通过在Android源代码工程下执行make命令,然后得到Android的系统镜像system.img.

那么当我们修改了android源代码中某个模块或者android源代码工程中新增了一个自己的模块。此时可以用make命令进行重新编译,不过重新编译比较浪费时间。google提供了另外的命令来进行单独模块的编译,以及重新打包到system.img镜像中的命令。

以下介绍单独编译android中模块的命令,以及打包system.img的命令。

一、首先,执行脚本文件envsetup.sh

该文件在Android源代码目录下的build目录中,在这个shell脚本中定义了hmm,croot,m,mm,mmm等function

执行命令如下:

www.linuxidc.com@Ubuntu:~/my_android$..ild/envsetup.sh

或者

www.linuxidc.com@ubuntu:~/my_android$sourcebuild/envsetup.sh

在当前目录下输入命令hmm(android4.2版本使用hmm,其他版本貌似使用的是help命令),显示envsetup.sh提供命令

www.linuxidc.com@ubuntu:~/my_android$hmm

输出为:

Invoke".build/envsetup.sh"fromyourshelltoaddthefollowingfunctionstoyourenvironment:
-lunch:lunch<product_name>-<build_variant>
-tapas:tapas[<App1><App2>...][arm|x86|mips][eng|userdebug|user]
-croot:Changesdirectorytothetopofthetree.
-m:Makesfromthetopofthetree.
-mm:Buildsallofthemodulesinthecurrentdirectory.
-mmm:Buildsallofthemodulesinthesupplieddirectories.
-cgrep:GrepsonalllocalC/C++files.
-jgrep:GrepsonalllocalJavafiles.
-resgrep:Grepsonalllocalres/*.xmlfiles.
-godir:Gotothedirectorycontainingafile.


Lookatthesourcetoviewmorefunctions.Thecompletelistis:
addcompletionsadd_lunch_combocgrepcheck_productcheck_variantchoosecombochooseproductchoosetypechoosevariantcprojcrootfindmakefilegdbclientgdbwrapperget_abs_build_vargetbugreportsget_build_vargetlastscreenshotgetprebuiltgetscreenshotpathgetsdcardpathgettargetarchgettopgodirhmmisviewserverstartedjgrepkey_backkey_homekey_menulunch_lunchmmangrepmmmmmpidprintconfigprint_lunch_menuresgreprunhatruntestset_java_homesetpathsset_sequence_numberset_stuff_for_environmentsettitlesmoketeststacksstartviewserverstopviewserversystemstacktapastracedmdump

这些命令的具体用法,可以在命令的后面加-help来查看,这里我们只关注mmm命令,也就是可以用它来编译指定目录的所有模块,通常这个目录只包含一个模块。

注:

关于source

source命令会把对应脚本中的内容读取到当前的bash解释器中,在当前的执行环境中执行;其中定义的function以及通过export声明的变量等在source执行结束之后依然存在于当前的bash环境中。比如我们常用的source.bashrc或者source/etc/profile等目的是为了引用刚刚改动过的环境变量。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值