AOSP代码下载编译及开发

代码下载


谷歌官方文档:http://source.android.com/source/downloading.html


资料链接


 http://blog.csdn.net/zbunix/article/details/8460422


 http://git.omapzoom.org/?p=platform/manifest.git;a=summary



谷歌开发者网站



下载repo


$curl https://storage.googleapis.com/git-repo-downloads/repo >~/bin/repo

$chmod a+x ~/bin/repo


通过repo下载代码


$repo init -u https://android.googlesource.com/platform/manifest -bandroid-4.0.1_r1

$repo sync



国内镜像下载

git.omapzoom.org网站下载

repoinit -u git://git.omapzoom.org/platform/manifest -b android-4.4.2_r2

repoinit -u git://git.omapzoom.org/platform/manifest -b android-4.4.2_r2--repo-url=http://mirrors.ustc.edu.cn/aosp/git-repo--repo-branch=stable


mirrors.ustc.edu.cn网站下载

../repoinit -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest.git -bandroid-7.1.0_r1--repo-url=https://aosp.tuna.tsinghua.edu.cn/git-repo--repo-branch=stable


单独下载某个仓库:gitclone http://mirrors.ustc.edu.cn/aosp/platform/frameworks/base



代码分支


谷歌官方:

http://source.android.com/source/build-numbers.html#source-code-tags-and-builds


注意:不同的分支对应的支持的硬件不同


代码编译



谷歌官方文档:http://source.android.com/source/building.html


全编译


>>准备编译环境,主要是JDK的环境变量设置

>>cd到源码根目录

>>source build/envsetup.sh或者.build/envsetup.sh

>>lunch

>>make


编译某个模块


makeLOCAL_MODULE

例如:makeframework


真机运行



为真机编译image



全编译之前,先在编译环境中安装相应的驱动

https://developers.google.com/android/nexus/drivers

安装完驱动后,进行全编译。


烧写image到手机


http://source.android.com/source/running.html#booting-into-fastboot-mode


>>解锁:进入手机的fastboot模式- >fastboot oem unlock

>>烧写:进入手机的fastboot模式- >fastboot flash system system.img


通过adb升级


adbsideload ~/tmp/os.zip

adbreboot recovery


fastboot命令



fastbootdevices

fastbootflashall

fastboot -wflashall

fastbootreboot

fastboot help

fastboot flashboot boot.img

fastboot flashsystem system.img


Recoverymode


How toboot into recovery mode on a Google Nexus device

Ifyou have a device like the Nexus 5 or Nexus7 runningstock Android then these are the steps required to boot into Recoverymode:

  1. Holddown the Power keyand select Poweroff.If the touchscreen is unresponsive then you can simply keep holdingdown the Power keyfor several seconds until the device turns off.

  2. Pressand hold the Power keyand the Volumedown key.You should see the Android mascot on his back, a bunch ofinformation about your device, andStart atthe top right of the screen.

  3. Tonavigate through the menu options you use the Volumeup and Volumedown keys.The Power keyis used to make a selection. Press Volumedowntwiceand you shuld see Recoverymode inred up at the top right, press thePower keyto select it.

  4. Thewhite Google logo will pop up followed by the Android mascot on hisback again with the words Nocommand underneath.

  5. Pressand hold the Power keyand the Volumeup keyfor around three seconds and then let go of the Volumeup key,but keep pressing Power.

  6. Youshould see the Android system recovery options pop up at the top ofthe screen. Use the Volume keysto highlight the options and the Power keyto select the one you want.


TPeamWin– TWR

https://twrp.me/



代码阅读



cddevelopment/tools/idegen

运行mm,运行完后,应该会产生out/host/linux-x86/framework/idegen.jar

cd到全部源码的根目录,运行development/tools/idegen/idegen.sh

以下错误信息应该是可以忽略:

find:`out/target/product/sailfish/root/d':权限不够

find:`out/target/product/sailfish/recovery/root/d':权限不够

最后,根目录下应该会产生文件android.ipr

androidstudio,直接打开android.ipr即可。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值