代码下载
谷歌官方文档: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:
-
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.
-
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.
-
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.
-
Thewhite Google logo will pop up followed by the Android mascot on hisback again with the words Nocommand underneath.
-
Pressand hold the Power keyand the Volumeup keyfor around three seconds and then let go of the Volumeup key,but keep pressing Power.
-
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.
https://twrp.me/
代码阅读
cd到development/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即可。