`
yidongkaifa
  • 浏览: 4051906 次
文章分类
社区版块
存档分类
最新评论

怎样实现了单独编译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等目的是为了引用刚刚改动过的环境变量。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics