官方下载介绍网站是这个:
http://source.android.com/source/downloading.html
1. 下载与android自己的git工具,其实是一个shell中调用自己的python脚本。
banxi1988@banxi:~$ 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 19731 100 19731 0 0 1332 0 0:00:14 0:00:14 --:--:-- 3923
banxi1988@banxi:~$
2. 查看之后,计算sha1的值。跟官方提供的一样。哈哈。正确。
然后创建工作目录。
banxi1988@banxi:~$ ls -l bin/repo
-rw-r--r-- 1 banxi1988 banxi 19731 2011-11-15 23:08 bin/repo
banxi1988@banxi:~$ chmod a+x ~/bin/repo
banxi1988@banxi:~$ sha1sum ~/bin/repo
e1fd3bef059d152edf4d0522590725d317bc637f /home/banxi1988/bin/repo
banxi1988@banxi:~$ cd android
banxi1988@banxi:~/android$ ls
android-sdk-linux_x86 develop_android.txt myworks
android-sdk_r11-linux_x86.tgz docs temp
debug_log eclipse
develop_android_2.txt eclipse-jee-helios-SR1-linux-gtk.tar.gz
banxi1988@banxi:~/android$ mkdir android4_source
banxi1988@banxi:~/android$ cd android
bash: cd: android: 没有那个文件或目录
banxi1988@banxi:~/android$ cd android4_source/
初始化工作副本也就是仓库有点蛋痛了。
第一次失败:
banxi1988@banxi:~/android/android4_source$ repo init -u https://android.googlesource.com/platform/mainifest
gpg: 钥匙环‘/home/banxi1988/.repoconfig/gnupg/secring.gpg’已建立
gpg: 钥匙环‘/home/banxi1988/.repoconfig/gnupg/pubring.gpg’已建立
gpg: /home/banxi1988/.repoconfig/gnupg/trustdb.gpg:建立了信任度数据库
gpg: 密钥 920F5C65:公钥“Repo Maintainer <[email protected]>”已导入
gpg: 合计被处理的数量:1
gpg: 已导入:1
Get https://android.googlesource.com/tools/repo
remote: Counting objects: 1414, done
remote: Finding sources: 100% (78/78)
remote: Total 1414 (delta 917), reused 1414 (delta 917)
Receiving objects: 100% (1414/1414), 429.88 KiB | 4 KiB/s, done.
Resolving deltas: 100% (917/917), done.
From https://android.googlesource.com/tools/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
* [new tag] v1.0.3 -> v1.0.3
* [new tag] v1.0.4 -> v1.0.4
* [new tag] v1.0.5 -> v1.0.5
* [new tag] v1.0.6 -> v1.0.6
* [new tag] v1.0.7 -> v1.0.7
* [new tag] v1.0.8 -> v1.0.8
* [new tag] v1.0.9 -> v1.0.9
* [new tag] v1.1 -> v1.1
* [new tag] v1.2 -> v1.2
* [new tag] v1.3 -> v1.3
* [new tag] v1.3.1 -> v1.3.1
* [new tag] v1.3.2 -> v1.3.2
* [new tag] v1.4 -> v1.4
* [new tag] v1.4.1 -> v1.4.1
* [new tag] v1.4.2 -> v1.4.2
* [new tag] v1.4.3 -> v1.4.3
* [new tag] v1.4.4 -> v1.4.4
* [new tag] v1.5 -> v1.5
* [new tag] v1.5.1 -> v1.5.1
* [new tag] v1.6 -> v1.6
* [new tag] v1.6.1 -> v1.6.1
* [new tag] v1.6.10 -> v1.6.10
* [new tag] v1.6.10.1 -> v1.6.10.1
* [new tag] v1.6.10.2 -> v1.6.10.2
* [new tag] v1.6.2 -> v1.6.2
* [new tag] v1.6.3 -> v1.6.3
* [new tag] v1.6.4 -> v1.6.4
* [new tag] v1.6.5 -> v1.6.5
* [new tag] v1.6.6 -> v1.6.6
* [new tag] v1.6.7 -> v1.6.7
* [new tag] v1.6.7.1 -> v1.6.7.1
* [new tag] v1.6.7.2 -> v1.6.7.2
* [new tag] v1.6.7.3 -> v1.6.7.3
* [new tag] v1.6.7.4 -> v1.6.7.4
* [new tag] v1.6.7.5 -> v1.6.7.5
* [new tag] v1.6.8 -> v1.6.8
* [new tag] v1.6.8.1 -> v1.6.8.1
* [new tag] v1.6.8.10 -> v1.6.8.10
* [new tag] v1.6.8.11 -> v1.6.8.11
* [new tag] v1.6.8.2 -> v1.6.8.2
* [new tag] v1.6.8.3 -> v1.6.8.3
* [new tag] v1.6.8.4 -> v1.6.8.4
* [new tag] v1.6.8.5 -> v1.6.8.5
* [new tag] v1.6.8.6 -> v1.6.8.6
* [new tag] v1.6.8.7 -> v1.6.8.7
* [new tag] v1.6.8.8 -> v1.6.8.8
* [new tag] v1.6.8.9 -> v1.6.8.9
* [new tag] v1.6.9 -> v1.6.9
* [new tag] v1.6.9.1 -> v1.6.9.1
* [new tag] v1.6.9.2 -> v1.6.9.2
* [new tag] v1.6.9.3 -> v1.6.9.3
* [new tag] v1.6.9.4 -> v1.6.9.4
* [new tag] v1.6.9.5 -> v1.6.9.5
* [new tag] v1.6.9.6 -> v1.6.9.6
* [new tag] v1.6.9.7 -> v1.6.9.7
* [new tag] v1.6.9.8 -> v1.6.9.8
* [new tag] v1.7 -> v1.7
* [new tag] v1.7.1 -> v1.7.1
* [new tag] v1.7.2 -> v1.7.2
* [new tag] v1.7.3 -> v1.7.3
* [new tag] v1.7.3.1 -> v1.7.3.1
* [new tag] v1.7.4 -> v1.7.4
* [new tag] v1.7.4.1 -> v1.7.4.1
* [new tag] v1.7.4.2 -> v1.7.4.2
* [new tag] v1.7.4.3 -> v1.7.4.3
* [new tag] v1.7.5 -> v1.7.5
* [new tag] v1.7.6 -> v1.7.6
* [new tag] v1.7.6.1 -> v1.7.6.1
* [new tag] v1.7.7 -> v1.7.7
* [new tag] v1.7.7.1 -> v1.7.7.1
* [new tag] v1.7.7.2 -> v1.7.7.2
* [new tag] v1.7.7.3 -> v1.7.7.3
* [new tag] v1.7.7.4 -> v1.7.7.4
* [new tag] v1.7.7.5 -> v1.7.7.5
* [new tag] v1.7.7.6 -> v1.7.7.6
Get https://android.googlesource.com/platform/mainifest
error: android.googlesource.com: <urlopen error [Errno 8] _ssl.c:499: EOF occurred in violation of protocol>
banxi1988@banxi:~/android/android4_source$
再来,发现不行。
banxi1988@banxi:~/android/android4_source$ repo init -u https://android.googlesource.com/platform/mainifest
Traceback (most recent call last):
File "/home/banxi1988/android/android4_source/.repo/repo/main.py", line 355, in <module>
_Main(sys.argv[1:])
File "/home/banxi1988/android/android4_source/.repo/repo/main.py", line 337, in _Main
repo._Run(argv)
File "/home/banxi1988/android/android4_source/.repo/repo/main.py", line 135, in _Run
cmd.Execute(copts, cargs)
File "/home/banxi1988/android/android4_source/.repo/repo/subcmds/init.py", line 260, in Execute
self._SyncManifest(opt)
File "/home/banxi1988/android/android4_source/.repo/repo/subcmds/init.py", line 124, in _SyncManifest
m.PreSync()
File "/home/banxi1988/android/android4_source/.repo/repo/project.py", line 2064, in PreSync
cb = self.CurrentBranch
File "/home/banxi1988/android/android4_source/.repo/repo/project.py", line 552, in CurrentBranch
b = self.work_git.GetHead()
File "/home/banxi1988/android/android4_source/.repo/repo/project.py", line 1834, in GetHead
fd = open(path, 'rb')
IOError: [Errno 2] No such file or directory: '/home/banxi1988/android/android4_source/.repo/manifests/.git/HEAD'
banxi1988@banxi:~/android/android4_source$
删除因为前面初始化创建的目录后,继续来。
还是不行。然后直接在网站上打开,发现了下面的东西 。
其实没有什么。
git clone https://android.googlesource.com/platform/manifest.git
在下面再来一次,哈哈,看起来得了。
From /home/banxi1988/android/android4_source/.repo/manifests.git/clone.bundle
* [new branch] master -> origin/master
* [new branch] gingerbread -> origin/gingerbread
remote: Counting objects: 180, done
remote: Finding sources: 100% (176/176)
remote: Getting sizes: 101% (79/78)
remote: Compressing objects: 100% (74/74)
remote: Total 176 (delta 25), reused 154 (delta 21)
Receiving objects: 100% (176/176), 62.90 KiB, done.
Resolving deltas: 100% (43/43), completed with 1 local objects.
From https://android.googlesource.com/platform/manifest
* [new branch] android-1.6_r1 -> origin/android-1.6_r1
* [new branch] android-1.6_r1.1 -> origin/android-1.6_r1.1
* [new branch] android-1.6_r1.2 -> origin/android-1.6_r1.2
* [new branch] android-1.6_r1.3 -> origin/android-1.6_r1.3
* [new branch] android-1.6_r1.4 -> origin/android-1.6_r1.4
* [new branch] android-1.6_r1.5 -> origin/android-1.6_r1.5
* [new branch] android-1.6_r2 -> origin/android-1.6_r2
* [new branch] android-2.0.1_r1 -> origin/android-2.0.1_r1
* [new branch] android-2.0_r1 -> origin/android-2.0_r1
* [new branch] android-2.1_r1 -> origin/android-2.1_r1
* [new branch] android-2.1_r2 -> origin/android-2.1_r2
* [new branch] android-2.1_r2.1p -> origin/android-2.1_r2.1p
* [new branch] android-2.1_r2.1p2 -> origin/android-2.1_r2.1p2
* [new branch] android-2.1_r2.1s -> origin/android-2.1_r2.1s
* [new branch] android-2.2.1_r1 -> origin/android-2.2.1_r1
* [new branch] android-2.2.1_r2 -> origin/android-2.2.1_r2
* [new branch] android-2.2.2_r1 -> origin/android-2.2.2_r1
* [new branch] android-2.2_r1 -> origin/android-2.2_r1
* [new branch] android-2.2_r1.1 -> origin/android-2.2_r1.1
* [new branch] android-2.2_r1.2 -> origin/android-2.2_r1.2
* [new branch] android-2.2_r1.3 -> origin/android-2.2_r1.3
* [new branch] android-2.3.1_r1 -> origin/android-2.3.1_r1
* [new branch] android-2.3.2_r1 -> origin/android-2.3.2_r1
* [new branch] android-2.3.3_r1 -> origin/android-2.3.3_r1
* [new branch] android-2.3.3_r1.1 -> origin/android-2.3.3_r1.1
* [new branch] android-2.3.4_r0.9 -> origin/android-2.3.4_r0.9
* [new branch] android-2.3.4_r1 -> origin/android-2.3.4_r1
* [new branch] android-2.3.5_r1 -> origin/android-2.3.5_r1
* [new branch] android-2.3.6_r0.9 -> origin/android-2.3.6_r0.9
* [new branch] android-2.3.6_r1 -> origin/android-2.3.6_r1
* [new branch] android-2.3.7_r1 -> origin/android-2.3.7_r1
* [new branch] android-2.3_r1 -> origin/android-2.3_r1
* [new branch] android-4.0.1_r1 -> origin/android-4.0.1_r1
* [new branch] froyo -> origin/froyo
82d0651..1b6c432 gingerbread -> origin/gingerbread
* [new branch] gingerbread-release -> origin/gingerbread-release
* [new branch] ics-mr0 -> origin/ics-mr0
6cf16a5..5f8c416 master -> origin/master
* [new tag] android-1.6_r1.1_ -> android-1.6_r1.1_
* [new tag] android-1.6_r1.2_ -> android-1.6_r1.2_
* [new tag] android-1.6_r1.3_ -> android-1.6_r1.3_
* [new tag] android-1.6_r1.4_ -> android-1.6_r1.4_
* [new tag] android-1.6_r1.5_ -> android-1.6_r1.5_
* [new tag] android-1.6_r1_ -> android-1.6_r1_
* [new tag] android-1.6_r2_ -> android-1.6_r2_
* [new tag] android-2.0.1_r1_ -> android-2.0.1_r1_
* [new tag] android-2.0_r1_ -> android-2.0_r1_
* [new tag] android-2.1_r1_ -> android-2.1_r1_
* [new tag] android-2.1_r2.1p2_ -> android-2.1_r2.1p2_
* [new tag] android-2.1_r2.1p_ -> android-2.1_r2.1p_
* [new tag] android-2.1_r2.1s_ -> android-2.1_r2.1s_
* [new tag] android-2.1_r2_ -> android-2.1_r2_
* [new tag] android-2.2.1_r1_ -> android-2.2.1_r1_
* [new tag] android-2.2.1_r2_ -> android-2.2.1_r2_
* [new tag] android-2.2.2_r1_ -> android-2.2.2_r1_
* [new tag] android-2.2_r1.1_ -> android-2.2_r1.1_
* [new tag] android-2.2_r1.2_ -> android-2.2_r1.2_
* [new tag] android-2.2_r1.3_ -> android-2.2_r1.3_
* [new tag] android-2.2_r1_ -> android-2.2_r1_
* [new tag] android-2.3.1_r1_ -> android-2.3.1_r1_
* [new tag] android-2.3.2_r1_ -> android-2.3.2_r1_
* [new tag] android-2.3.3_r1.1_ -> android-2.3.3_r1.1_
* [new tag] android-2.3.3_r1_ -> android-2.3.3_r1_
* [new tag] android-2.3.4_r0.9_ -> android-2.3.4_r0.9_
* [new tag] android-2.3.4_r1_ -> android-2.3.4_r1_
* [new tag] android-2.3.5_r1_ -> android-2.3.5_r1_
* [new tag] android-2.3.6_r0.9 -> android-2.3.6_r0.9
* [new tag] android-2.3.6_r1 -> android-2.3.6_r1
* [new tag] android-2.3.7_r1 -> android-2.3.7_r1
* [new tag] android-2.3_r1_ -> android-2.3_r1_
* [new tag] android-4.0.1_r1 -> android-4.0.1_r1
Your Name [Li HaiZhen]: Li HaiZhen
Your Email [[email protected]]: [email protected]
Your identity is: Li HaiZhen <[email protected]>
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/banxi1988/android/android4_source
然后进行下一步。
banxi1988@banxi:~/android/android4_source$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
.repo/manifests/: manifest switched refs/heads/master...android-4.0.1_r1
project .repo/manifests/
Updating 5f8c416..c4e4db1
Fast-forward
base-for-3.0-gpl.xml | 183 ----------------------------------------------
base-for-3.1-gpl.xml | 188 ------------------------------------------------
base-for-3.2-gpl.xml | 195 --------------------------------------------------
default.xml | 9 +--
4 files changed, 1 insertions(+), 574 deletions(-)
delete mode 100644 base-for-3.0-gpl.xml
delete mode 100644 base-for-3.1-gpl.xml
delete mode 100644 base-for-3.2-gpl.xml
Your Name [Li HaiZhen]: Li HaiZhen
Your Email [[email protected]]: [email protected]
Your identity is: Li HaiZhen <[email protected]>
is this correct [y/n]? y
repo initialized in /home/banxi1988/android/android4_source
banxi1988@banxi:~/android/android4_source$ ls
help
banxi1988@banxi:~/android/android4_source$ cd help/
banxi1988@banxi:~/android/android4_source/help$ ls
banxi1988@banxi:~/android/android4_source/help$
然后将本地仓库与服务器的同步。即真正的下载了。
又有错误。
remote: Counting objects: 38, done
remote: Finding sources: 100% (21/21)
remote: Getting sizes: 103% (33/32)
remote: Compressing objects: 100% (15/15)
remote: Total 21 (delta 2), reused 13 (delta 2)
Unpacking objects: 100% (21/21), done.
From https://android.googlesource.com/platform/development
* [new branch] ics-factoryrom-2-release -> aosp/ics-factoryrom-2-release
* [new branch] ics-mr0 -> aosp/ics-mr0
8e3c195..6b415b7 master -> aosp/master
* [new tag] android-4.0.1_r1 -> android-4.0.1_r1
Fetching projects: 5% (12/221)
error: Exited sync due to fetch errors
banxi1988@banxi:~/android/android4_source$
不管了,继续重复运行repo rsync命令。。。
下载好慢啊,未完待续。