- 安装Cygwin。因为repo脚本的运行必须在linux下,因此我们要安装Cygwin。Cygwin是一个在Windows平台下运行的Unix模拟环境,点击这里下载。
- 安装Cygwin的过程中可以选择要安装的包,以下是我们要安装的包:
1、Net -> curl;
2、Devel -> git* (git, git-completion, git-gui, gitk);
3、Libs -> libreadline6, libiconv2;
4、Editors -> vim
5、Python -> python。 $ mkdir ~/bin$ PATH=~/bin:$PATH
4$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo$ chmod a+x ~/bin/repo
$ mkdir WORKING_DIRECTORY$ cd WORKING_DIRECTORY
$ repo init -u https://android.googlesource.com/platform/manifest
To check out a branch other than "master", specify it with -b:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
Getting the files
To pull down files to your working directory from the repositories as specified in the default manifest, run
?
$ repo sync
?
?
?
按照上面的方法,下载时,可能报连接超时,这是因为,android源码,默认下载是用匿名方式的,google为了某种性能和管理目的,做了限制,像一 般的,动态公网IP就 可能下载不了。为此,google提供了认证方式下载。
?
?
Using authentication
By default, access to the Android source code is anonymous. To protect the servers against excessive usage, each IP address is associated with a quota.
When sharing an IP address with other users (e.g. when accessing the source repositories from beyond a NAT firewall), the quotas can trigger even for regular usage patterns (e.g. if many users sync new clients from the same IP address within a short period).
In that case, it is possible to use authenticated access, which then uses a separate quota for each user, regardless of the IP address.
The first step is to create a password from the password generator and to save it in ~/.netrc
according to the instructions on that page.
The second step is to force authenticated access, by using the following manifest URI: https://android.googlesource.com/a/platform/manifest
. Notice how the /a/
directory prefix triggers mandatory authentication. You can convert an existing client to use mandatory authentication with the following command:
$ repo init -u https://android.googlesource.com/a/platform/manifest
第四步:
- 参考来源:
- http://source.android.com/source/downloading.html
- ?http://www.2eggs.org/?p=97
- http://www.cnblogs.com/mandroid/archive/2011/06/06/2073473.html
- http://blog.rexzhao.com/2011/11/29/Google-Code-set-netrc.html
http://my.oschina.net/armsky/blog/55644?p=1#rpl_267635548
Git是面向Linux内核管理的一个工具,它是一种分布式的版本控制系统,即每一个工作目录下都是一个完整的仓库,因此也支持离线工作, 在本地提交后,便会稍后更新到服务器上。它这种结构比集中式版本控制系统(如常见的SVN、CVS等只有一个完整仓库)更加健壮。
2、repo
其实repo只是用Python编写的一个脚本,它是为了更好、更方便地管理Android操作系统下多个组成部分,如Kernel、Dalivk、Bionic、prebuild、build等多个项目。repo的目的就是为了统一管理这些项目,简化Git的使用过程。
3、curl
curl是一个利用URL语法在命令行模式下的文件传输工具。这里我们用它来获取repo脚本。
machine android.googlesource.com
login git-xxxx.gmail.com
password 1/xeyniDN1qln7w_P-bQ2vTD71_wyX_6G7aXOvYPkSuYc
machine android-review.googlesource.com
login git-xxx.gmail.com
password 1/xeyniDN1qln7w_P-bQ2vTD71_wyX_6G7aXOvYPkSuYc
也就是用来,使用认证方式下载源码时,不用我们手动输入密码和账号,自动到.netrc文件找了,
文件内容,需要google账号才能生成。