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

  • 相关阅读:
    python requests用法总结
    Linux统计某文件夹下文件的个数
    PM2使用及介绍
    如何区分USB 2.0 和USB 3.0插口
    npm突然找不到npm-cli.js的解决方法
    mRemoteNG
    js中几种实用的跨域方法原理详解
    Tornado异步阻塞解决方案
    [阅读笔记]EfficientDet
    iOS 保存视频AVAssetWriter
  • 原文地址:https://www.cnblogs.com/daemon369/p/3276508.html
Copyright © 2011-2022 走看看