您的位置:首页 > 移动开发 > Android开发

Android源码编译的琐碎笔记

2013-08-30 07:01 495 查看
全部编译:

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: