1:下載android主線分支
repo init -u https://android.googlesource.com/platform/manifest
2:下載android其它分支
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
3;查看android分支版本號(hào)
git --git-dir .repo/manifests/.git/ branch -a
4:查看android當(dāng)前版本號(hào)
在build/core/version_defaults.mk文件中查看PLATFORM_VERSION即可。
5:切換android分支
4.1 初始化repo客戶端到某一分支(以android-4.0.3_r1為例)
repo init -b android-4.0.3_r1
可以在目錄 .repo/manifest.xml中查看repo客戶端是在哪個(gè)分支上。
4.1 同步代碼
repo sync
6:創(chuàng)建自己的本地分支
6.1 構(gòu)造本地分支
repo start myandroid4.0.3 --all ,分支名稱為myandroid4.0.3
6.2檢出到自己創(chuàng)建的分支上
repo checkout myandroid4.0.3 或
repo checkout myandroid4.0.3 origin/android-4.0.3_r1
7:下載android linux kernel代碼
查看https://android.googlesource.com/
8:如何獲得指定版本的Linux內(nèi)核
在下載目錄下執(zhí)行:
git checkout remotes/origin/android-2.6.29
(以android-2.6.29為例)
9:查看repo可切換的分支
cd .repo/manifests
git branch -a | cut -d / -f 3
出錯(cuò)問題解決:
1:執(zhí)行repo sync時(shí)出現(xiàn)
fatal: '../platform/abi/cpp.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
error: Cannot fetch platform/abi/cpp
------》在.repo目錄下的manifest.xml里找到fetch屬性,改成fetch= "git://Android.git.linaro.org/ ",或 "http://android.googlesource.com”。
:
repo工具是git工具的封裝,下載單個(gè)project時(shí)使用git,下載所有android源碼時(shí)使用repo工具。用法都是一樣的。
看著Google的教程,下載了android的源代碼。
默認(rèn)分支是android-4.0.1_r1.
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
代碼下載完成了,也編譯通過,并在虛擬機(jī)中運(yùn)行了。
最大的問題是:
如何將代碼的版本從4.0.1降到2.3.6呢?
網(wǎng)上找一個(gè)切換分支的文檔,就是不成功。
疑問:是不是切換分支,就可以更改android代碼的版本?
文檔如下:
查看可切換的分支
cd .repo/manifests
git branch -a | cut -d / -f 3
以 gingerbread-release 分支為例
repo init -b gingerbread-release
repo sync (not needed if your local copy is up to date)
repo start gingerbread-release --all
查看當(dāng)前的分支
repo branches
聯(lián)系客服