zoukankan      html  css  js  c++  java
  • 编译Android源码中的单独模块

    一次完整的Android源码的编译过程耗时很久,慢点的机器可能需要数个小时甚至更多的时间。实际上Android源代码可以分模块单独编译。一次完全编译后,以后可以根据需要单独编译需要的模块,然后在重新打包成system.img 。

    模块编译需要的工具在Android源码目录下的build/envsetup.sh中,运行这个脚本可以初始化一些环境变量并提供一些额外的命令。

    $ source ./build/envsetup.sh

    提供的命令如下:

    - croot: Changes directory to the top of the tree.  #切换工作目录为android源码目录的顶层目录
    - m:       Makes from the top of the tree.  #从android源码树的顶部开始编译
    - mm:      Builds all of the modules in the current directory.  #编译当前目录下的所有模块
    - mmm:     Builds all of the modules in the supplied directories.  #编译指定目录下的所有模块
    - cgrep:   Greps on all local C/C++ files.
    - jgrep:   Greps on all local Java files.
    - resgrep: Greps on all local res/*.xml files.
    - godir:   Go to the directory containing a file.  #搜索出指定文件所在目录提供给用户来选择进入
    

    譬如可以使用mmm命令来编译Email模块:

    $ mmm packages/apps/Email/
    ....
    Install: out/target/product/generic/system/app/Email.apk
    ....
    Install: out/target/product/generic/data/app/EmailTests.apk
    

    编译生成的模块分别放到了out/target/product/generic/下的system/app和data/app下。这个路径可以通过设置环境变量ANDROID_PRODUCT_OUT 来改变。

    打包system.img的方法如下:

    $ make snod
    ...
    Install: out/host/linux-x86/bin/mkyaffs2image
    make snod: ignoring dependencies
    Target system fs image: out/target/product/generic/system.img
    

    这样就不需要每次都完全编译整个源码了。

    参考:

    http://blog.csdn.net/luoshengyang/article/details/6566662

  • 相关阅读:
    最少代码的瀑布流实现
    GoLang代码规范
    wcf基础知识之ListenUri和ListenUriMode实现 逻辑地址和物理地址的分离
    STL学习笔记 string
    Bitbucket上使用SSH协作
    使用注册表文件(REG)添加、 修改或删除注册表子项和值
    《大话设计模式》Python版代码实现
    go windows 32位环境搭建
    借书场景领域建模分析
    E/R模型学习
  • 原文地址:https://www.cnblogs.com/daemon369/p/3276508.html
Copyright © 2011-2022 走看看