Android源码编译的琐碎笔记

全部编译:

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

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值