IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]Android源码编译的琐碎笔记

    lincyang发表于 2013-08-30 07:01:52
    love 0

    全部编译:

    1.初始化

    source build/envsetup.sh (source 就是point符号,可以替换为”. “,比如. build/envsetup.sh)

    这样就可以多出一些命令供我们使用:

    - 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.

     

    - 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.

     

    2.选择一个目标

    lunch full-eng

     

    3.编译

    make –j16


    局部编译

    有时我们对源代码做了修改以后,并不想全部编译源码,这样相当费时。如果能对修改的编译,然后直接烧写就好了。下面举几个例子:

    1.      Kernel

    这个一直使用公司写的脚本,个人还没有详细研究。

    2.      Framework

    使用mm 命令,步骤参考app。例如可以编译成framework.jar,而c++的一些比如mtp可以编出libmtp.so。

    3.      App

    类似于编译framework,只是路径不同而已。举个编译mediaprovider的例子:

    cd packages/providers/MediaProvider

    mm -B

     

    #need root and mount

    adb shell

    mount -o remount rw /system

    chmod 777system/app

    exit

    adb push MediaProvider.apk /system/app

    adb reboot


    后记1

    查看Android源码版本

    build\core\version_defaults.mk

    文件中搜索PLATFORM_VERSION

    比如:4.4.1



沪ICP备19023445号-2号
友情链接