a497393102的专栏

gitconfig–global http.proxy "127.0.0.2:8080"

到此git就配置好了。

1.5、安装repo客服端

1.5.1、新建一个工作目录WORKING_DIRECTORY,,切换到该目录,以便存放Android源码:

在shell命令行,输入以下命令:

$ mkdir WORKING_DIRECTORY $ cd WORKING_DIRECTORY

15.2、Runrepo initto bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest, which specifies where the various repositories included in the Android source will be placed within your working directory.

在这里可能下载不下来,需要添加配置文件

Staying Authenticated – Windows:

To stay authenticated by saving the password, append the following line to the %HOME%\_netrc configurationfile:

machine android.googlesource.com login git-帐号 password 密码machine android-review.googlesource.com login git-帐号 password密码

Ensure %HOME% is configured in the environment to be the same location as %USERPROFILE%. Note that by default, Windows systems willnotdefine the environment variable %HOME%; you must explicitly add it:

Start menu -> Computer -> (right click) -> Properties -> Advanced System Settings -> Environment Variables

Make sure you have set the permissions on %HOME%\_netrc so that only your user account can read the file.

大意是说需要手动添加一个.netrc文件,然后将上面两段话复制进去(可以从网址中的Using Authentication里面的the password generator得到用户名和密码的链接),最后放在USERPROFILE找得到的地方,就是环境变量下面的,你可以在“我的电脑”地址栏中输入“%USERPROFILE%”,然后回车,就是在这个下面了

$ 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_r11.5.3、When prompted, please configure Repo with your real name and email address. To use the Gerrit code-review tool, you will need an email address that is connected with aregistered Google account. Make sure this is a live address at which you can receive messages. The name that you provide here will show up in attributions for your code submissions.在运行1.5.2的命令时,会弹出一个要求输入你的gmail邮箱的提示。最好输入有效的邮箱地址。

A successful initialization will end with a message stating that Repo is initialized in your working directory. Your client directory should now contain a .repo directory where files such as the manifest will be kept.

在repo完成初始化后,你再当前目录下,应该能看到一个".repo"目录,manifest等就在该目录下。

如下:

if _NeedSetupGnuPG():

can_verify =False

else:

can_verify = True

另外,我们可以通过在浏览器中输入https://android.googlesource.com/platform/manifest来获得各个版本对应的branch

由于访问这个地址很慢,我就把它的内容贴到了我博客上。具体请访问《Android发布版本所对应源码的branch》

1.6、取得源码

To pull down files to your working directory from the repositories as specified in the default manifest, run

$ repo sync

The Android source files will be located in your working directory under their project names. The initial sync operation will take an hour or more to complete. For more aboutrepo syncand other Repo commands, seeVersion Control.

如果已经下载了Android源码,但是现在需要想更新,便可以直接使用repo sync同步到本地。

可能会出现如下错误:

$ repo sync

remote

remotedone.

remote

done.

Fromgit://github.com/richi-chen/Pandaboard-ICS-repo

3ea7f09..11ecd6d master -> origin/master

534d620..5fa74f5 omapzoom -> origin/omapzoom

error: .repo/manifests/: contains uncommitted changes

网友解决:

richi 大虾:

to recover any uncommitted change, you should use ‘git stash’ and ‘git clean -f -d’

for example: if you find it say there are uncommitted changes in .repo/manifests, you shoud ‘cd .repo/manifests’ and then ‘git stash’, ‘git clean -f -d’

1.7、下载kernel源码

执行以下命令

git clone https://android.googlesource.com/kernel/common.git

* master

remotes/origin/HEAD -> origin/master

remotes/origin/android-2.6.39

remotes/origin/android-3.0

remotes/origin/master

二、Linux平台

2.1、添加path路径

.bashrc文件位于"/home/%用户%"这个目录

在.bashrc文件中追加一行

export PATH=~/bin:$PATH

在命令行执行以下命令:

source .bashrc

2.2、安装repo

请参照1.3

2.3、配置git

同1.4

2.4、安装repo客服端

同1.5

2.5、以匿名方式取得源码

同1.6

2.6、以授权方式取得代码

如果你需要向google提交对原生Android的修改。你就需要以授权方式取得代码。

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.

成功是奋斗的结果,而奋斗是成功的必经之路。

a497393102的专栏

相关文章:

你感兴趣的文章:

标签云: