android source code 的下載(1)

android source code 下載  可以通過google官方或者第三方鏡像下載 ,步驟基本一樣

一     google 官網

  Downloading the Source

The Android source tree is located in a Git repository hosted by Google. The Git repository includes metadata for the Android source, including those related to changes to the source and the date they were made. This document describes how to download the source tree for a specific Android code-line.

Installing Repo


Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see the Developingsection.

To install Repo:

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

    $ mkdir ~/bin
    $ PATH=~/bin:$PATH
    
  2. Download the Repo tool and ensure that it is executable:

    $ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
    $ chmod a+x ~/bin/repo

Initializing a Repo client


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

  1. 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
  2. Configure git 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.

    $ git config --global user.name "Your Name"
    $ git config --global user.email "[email protected]"
  3. 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. For a list of branches, see Source Code Tags and Builds.

    $ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1

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.

Downloading the Android Source Tree


To pull down the Android source tree 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.



二  , 第三方AOSP  

選擇清華AOSP鏡像

網站    :http://aosp.tuna.tsinghua.edu.cn/android/


過程摘錄

(參考 https://lug.ustc.edu.cn/wiki/mirrors/help/aosp 編寫)

下載 repo 工具:

mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

建立工作目錄:

mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY

初始化倉庫:

repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
# 或 repo init -u git://aosp.tuna.tsinghua.edu.cn/aosp/platform/manifest

## 如果提示無法連接到 gerrit.googlesource.com,可以編輯 ~/bin/repo,把 REPO_URL 一行替換成下面的:
REPO_URL = 'https://gerrit-google.tuna.tsinghua.edu.cn/git-repo'

如果需要某個特定的 Android 版本(列表):

repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-4.0.1_r1

同步源碼樹(以後只需執行這條命令來同步):

repo sync


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章