原文引自: http://source.android.com/source/downloading.html
前題:
用戶名为username,ubuntu10.04,安装完编译android所需工具.
安装repo
在/home/username/目录下创建执行文件夹保存repo工具,并将其加入到环境变量.
$ mkdir ~/bin
$ PATH=~/bin:$PATH
结果:
username@ubuntu64:~$echo $PATH
/home/username/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
http://source.android.com/source/build-numbers.html
下载repo脚本,确认其可执行
$curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$chmod a+x ~/bin/repo
应得结果:
username@ubuntu64:~$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 20774 100 20774 0 0 62575 0 --:--:-- --:--:-- --:--:-- 159k
username@ubuntu64:~$ ls -al ./bin/repo
-rwxr-xr-x 1 zuoqiang zuoqiang 20774 2012-07-18 10:52 ./bin/repo
初始化repo客戶端
创建工作目录
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
应得结果:
username@ubuntu64:~$ mkdir mydroid4
username@ubuntu64:~$ cd mydroid4/
username@ubuntu64:~/mydroid4$
指定清单,列出所有可用的分支和标签.
$ repo init -u https://android.googlesource.com/platform/manifest
应得结果:
zuoqiang@zuoqiang-laptop-ubuntu64:~/mydroid4$ repo init -u https://android.googlesource.com/platform/manifest
gpg: keyring `/home/zuoqiang/.repoconfig/gnupg/secring.gpg' created
gpg: keyring `/home/zuoqiang/.repoconfig/gnupg/pubring.gpg' created
gpg: /home/zuoqiang/.repoconfig/gnupg/trustdb.gpg: trustdb created
gpg: key 920F5C65: public key "Repo Maintainer <repo@android.kernel.org>" imported
gpg: Total number processed: 1
gpg: imported: 1
Get https://gerrit.googlesource.com/git-repo
remote: Counting objects: 1651, done
remote: Finding sources: 100% (90/90)
remote: Total 1651 (delta 1023), reused 1651 (delta 1023)
Receiving objects: 100% (1651/1651), 762.01 KiB | 599 KiB/s, done.
Resolving deltas: 100% (1023/1023), done.
From https://gerrit.googlesource.com/git-repo
* [new branch] maint -> origin/maint
* [new branch] master -> origin/master
* [new branch] stable -> origin/stable
* [new tag] v1.0 -> v1.0
* [new tag] v1.0.1 -> v1.0.1
* [new tag] v1.0.2 -> v1.0.2
...
...
Your Name [username]:
Your Email [username@ubuntu64.(none)]: username@**email.com
Your identity is: username <username@**email.com>
is this correct [y/N]? y
Testing colorized output (for 'repo diff', 'repo status'):
black red green yellow blue magenta cyan white
bold dim ul reverse
Enable color display in this user account (y/N)? y
repo initialized in /home/username/mydroid4
检出分支
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.4_r2.1
log:
.repo/manifests/: discarding 26 commits
Your Name [username]:
Your Email [usernameGmail.com]:
Your identity is: username <usernameGmail.com>
is this correct [y/N]? y
repo initialized in /home/username/mydroid4
获取文件:
$repo sync
结果:
...
...
* [new tag] android-1.6_r1.4 -> android-1.6_r1.4
* [new tag] android-1.6_r1.3 -> android-1.6_r1.3
* [new tag] android-1.6_r1.2 -> android-1.6_r1.2
* [new tag] android-1.6_r1.1 -> android-1.6_r1.1
* [new tag] android-1.6_r1 -> android-1.6_r1
remote: Counting objects: 1, done
remote: Finding sources: 100% (1/1)
remote: Total 1 (delta 0), reused 1 (delta 0)
Unpacking objects: 100% (1/1), done.
From https://android.googlesource.com/platform/prebuilt
* [new branch] ics-plus-aosp -> aosp/ics-plus-aosp
* [new tag] android-4.1.1_r1 -> android-4.1.1_r1
Fetching projects: 100% (230/230), done.
Checking out files: 100% (19168/19168), done. files: 3% (636/19168)
Checking out files: 100% (5365/5365), done.out files: 14% (781/5365)
Checking out files: 100% (8311/8311), done.out files: 6% (575/8311)
Checking out files: 100% (24603/24603), done.ut files: 50% (12315/24603)
Checking out files: 100% (19253/19253), done.ut files: 1% (306/19253)
Checking out files: 100% (33094/33094), done.ut files: 0% (20/33094)
Syncing work tree: 100% (230/230), done.
username@ubuntu64:~/mydroid4$ ls
abi build development external libcore packages system
bionic cts device frameworks Makefile prebuilt
bootable dalvik docs hardware ndk sdk
版本号也可通过html查
http://source.android.com/source/build-numbers.html