首页 > Android, Other > Downloand Android src code

Downloand Android src code

2011-11-15 11:08 星期二    浏览: 1,817    绿 发表评论 阅读评论

 

http://source.android.com/source/downloading.html

 

  • Make sure you have a bin/ directory in your home directory, and that it is included in your path:

  • $ mkdir ~/bin $ PATH=~/bin:$PATH

  • Download the Repo script and ensure it is executable:

  • $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

$ chmod a+x ~/bin/repo

  • The SHA-1 checksum for repo is e1fd3bef059d152edf4d0522590725d317bc637f

Initializing a Repo client

After installing Repo, set up your client to access the android source repository:

  • Create an empty directory to hold your working files. If you’re using MacOS, this has to be on a case-sensitive filesystem. Give it any name you like:

  • $ mkdir WORKING_DIRECTORY $ cd WORKING_DIRECTORY

  • Run repo init to 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.

  • $ 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

  • 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 a registered 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.

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.

Getting the files

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 about repo sync and other Repo commands, see Version Control.

 

因为代码受gpg保护,所以要使用gpg – -import导入 public key(见上面的链接)。

若在repo init时出现gpg  public key not found的错误:

gpg: Can’t check signature: public key not found

error: could not verify the tag ‘v1.10.3′

可能是使用repo同步了其它的repository,此时删掉~/.repoconfig即可。

 

推荐使用代码的本地镜像:

Using a local mirror

When using several clients, especially in situations where bandwidth is scarce, it is better to create a local mirror of the entire server content, and to sync clients from that mirror (which requires no network access). The download for a full mirror is smaller than the download of two clients, while containing more information.

These instructions assume that the mirror is created in /usr/local/aosp/mirror. The first step is to create and sync the mirror itself, which uses close to 13GB of network bandwidth and a similar amount of disk space. Notice the --mirror flag, which can only be specified when creating a new client:

$ mkdir -p /usr/local/aosp/mirror 
$ cd /usr/local/aosp/mirror
$ repo init -u https://android.googlesource.com/mirror/manifest --mirror 
$ repo sync 

Once the mirror is synced, new clients can be created from it. Note that it’s important to specify an absolute path:

$ mkdir -p /usr/local/aosp/master 
$ cd /usr/local/aosp/master 
$ repo init -u /usr/local/aosp/mirror/platform/manifest.git 
$ repo sync 

Finally, to sync a client against the server, the mirror needs to be synced against the server, then the client against the mirror:

$ cd /usr/local/aosp/mirror 
$ repo sync 
$ cd /usr/local/aosp/master 
$ repo sync

本文链接地址: http://blog.redwolf-soft.com/?p=889

原创文章,版权©红狼博客所有, 转载随意,但请注明出处。

    分享到:

相关文章:

  • 无相关文章
分类: Android, Other 标签: ,
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.
订阅评论
  欢迎参与讨论,请在这里发表您的看法、交流您的观点。