Article Reference Source: http://source.android.com/source/downloading.html
First, window platform on the window platform to download Android source code, the Internet is generally used directly with git to download. For example: http://wenku.baidu.com/view/a4f5f922482fb4daa58d4bb5.htmlhttp://hendyyou.iteye.com/blog/1147738 The most serious problem in this way is that The source code can only be divided into blocks (git blocks) to download, and a lot of blocks. The point is that Google does not seem to provide a detailed list of the Android source git blocks now. At least from the online article to the link I have been unable to find the OH. What I'm introducing here is to simulate the Linux environment by installing Cygwin on the window platform to download the Android source code. 1.1, install the Cygiwn. First need to install Cygwin, for more information on this please refer to the
Cygwin installation Detailed》。 Note When installing Cygwin, we also need to install bash, curl, git and python in addition to installing the default components. 1.2. Add path Path edit. bash_profile add path Path. The. bash_profile file is located in the directory "%cygwin installation directory%\home\% user%". Like mine, "D:\tools\cygwin\home\rohu." Append a row to the. bash_profile file export path=~/bin: $PATH If you are in the country, you need an agent to go out. If you use an agent, you also need to add a sentence command. Assuming the proxy server is "127.0.0.2::8080", the command is: Export http_proxy=127.0.0.2:80801.3, install repo go to the shell command line via Cygwin menu Cygwin terminal. Enter the following command: mkdir ~/bincurl--insecure https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repochmod a+x ~/ Bin/repo If you are at home, you need an agent to go out. I am assuming that the proxy server is "127.0.0.2::8080" if the proxy is used, the above command should be changed to: mkdir ~/bincurl--insecure--proxy 127.0.0.2:8080 https:// Dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repochmod a+x ~/bin/repo to this repo script file is installed.
1.4. Configure Git
On the shell command line, enter the following command: Git config--global http.sslverify "false" if you are in the country, you need an agent to go out. If you use an agent, you also need to add a sentence command. Assuming the proxy server is "127.0.0.2::8080", the command is: git config--global http.proxy "127.0.0.2:8080" to this git is configured. 1.5, install Repo customer service terminal 1.5.1, create a new working directoryworking_directory, switch to this directory in order to store the Android source code:On the shell command line, enter the following command:
$ mkdir WORKING_DIRECTORY $ cd WORKING_DIRECTORY
15.2. Run
repo init
To bring, the latest version of Repo with all its most recent bug fixes. Must specify a URL for the manifest, which specifies where the various repositories included in the Android source wil L be placed within your working directory.
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
1.5.3, when prompted, please configure Repo with your real name and email address. To use the Gerrit Code-review tool, you'll need an e-mail address that's connected with a registered Google account . Make sure this is a live address @ which you can receive messages. The name that is provide here is show up with attributions for your code submissions. When you run the 1.5.2 command, a prompt prompts you to enter your Gmail mailbox. It is best to enter a valid email address. A successful initialization would end with a message stating that Repo are initialized in your working directory. Your Client directory should now contain a. Repo directory where files such as the manifest would be kept. After the initialization of repo, you Recording, you should be able to see a ". Repo" directory, manifest, etc. in this directory. If you encounter a GPG validation error in this step, throw an exception. Then please modify the 187th line of the ~/bin/repo file to skip the GPG validation. The following: if _NEEDSETUPGNUPG (): can_verify =false else: Can_verify = true In addition, we can enter the https://android.googlesource.com/platform/in the browser Manifest for each version of the branch because of the slow access to this address, I posted it on my blog. For more details, please visit the AndroidSource code Branch " 1.6, obtain the source code
To pulled down files to your working directory from the repositories as specified in the default manifest, run
The Android source files would be located in your working directory under their project names. The initial sync operation would take a hour or more to complete. For more on repo sync
and other Repo commands, see Version Control.
To execute the above command, the Android source is downloaded and will be downloaded to the "projects" directory of the ". Repo" directory. 1.7, download kernel source code to execute the following command git clone https://android.googlesource.com/kernel/ Common.git will see a common directory in the Android directory, get the common inside can't see the file, only. git directory into common and then execute git branch-a get * master remotes/ Origin/head, origin/master remotes/origin/android-2.6.39 remotes/origin/android-3.0 remotes/ Origin/master then we can get kernel3.0 source code by executing git checkout android-3.0 Similarly, the same as executing git checkout android-2.6.39 will get kernel2.6.39 source two , Linux platform on the Linux platform to download Android source code, it will be much easier. Cygiwn are not to be installed. But if you don't have curl on your system, Git and python, please install them first. 2.1. Add path Path edit. BASHRC add path Path. The. bashrc file is located in the "/home/% user%" directory in the. bashrc file, append a row to export path=~/bin:$ Path executes the following command at the command line: source. bashrc2.2, install repo please refer to 1.32.3, configure Git with 1.42.4, install repo customer service with 1.52.5, get source code with 1.62.6, download kernel source with 1.7 end!