Skyler Kaufman | 4443691 | 2011-04-07 15:11:52 -0700 | [diff] [blame] | 1 | <!-- |
Conley Owens | 68ef984 | 2011-04-22 13:51:20 -0700 | [diff] [blame] | 2 | Copyright 2010 The Android Open Source Project |
Skyler Kaufman | 4443691 | 2011-04-07 15:11:52 -0700 | [diff] [blame] | 3 | |
Conley Owens | 68ef984 | 2011-04-22 13:51:20 -0700 | [diff] [blame] | 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
Skyler Kaufman | 4443691 | 2011-04-07 15:11:52 -0700 | [diff] [blame] | 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | --> |
| 16 | |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 17 | # Downloading the Source Tree # |
| 18 | |
| 19 | ## Installing Repo ## |
| 20 | |
Skyler Kaufman | 4443691 | 2011-04-07 15:11:52 -0700 | [diff] [blame] | 21 | Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see [Version Control](version-control.html). |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 22 | |
| 23 | To install, initialize, and configure Repo, follow these steps: |
| 24 | |
| 25 | - Make sure you have a bin/ directory in your home directory, and that it is included in your path: |
| 26 | |
| 27 | $ mkdir ~/bin |
| 28 | $ PATH=~/bin:$PATH |
| 29 | |
| 30 | - Download the Repo script and ensure it is executable: |
| 31 | |
Jean-Baptiste Queru | be48f61 | 2011-10-06 14:20:51 -0700 | [diff] [blame] | 32 | $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 33 | $ chmod a+x ~/bin/repo |
| 34 | |
Jean-Baptiste Queru | 5f2afb1 | 2011-12-05 17:19:47 -0800 | [diff] [blame] | 35 | - The SHA-1 checksum for repo is 29ba4221d4fccdfa8d87931cd73466fdc24040b5 |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 36 | |
Jean-Baptiste Queru | 57a7910 | 2012-01-05 08:52:23 -0800 | [diff] [blame] | 37 | |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 38 | ## Initializing a Repo client ## |
| 39 | |
| 40 | After installing Repo, set up your client to access the android source repository: |
| 41 | |
Jean-Baptiste Queru | be48f61 | 2011-10-06 14:20:51 -0700 | [diff] [blame] | 42 | - Create an empty directory to hold your working files. |
Jean-Baptiste Queru | 64175aa | 2011-11-08 17:25:08 -0800 | [diff] [blame] | 43 | If you're using MacOS, this has to be on a case-sensitive filesystem. |
Jean-Baptiste Queru | be48f61 | 2011-10-06 14:20:51 -0700 | [diff] [blame] | 44 | Give it any name you like: |
| 45 | |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 46 | |
| 47 | $ mkdir WORKING_DIRECTORY |
| 48 | $ cd WORKING_DIRECTORY |
| 49 | |
| 50 | - 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. |
| 51 | |
Jean-Baptiste Queru | be48f61 | 2011-10-06 14:20:51 -0700 | [diff] [blame] | 52 | $ repo init -u https://android.googlesource.com/platform/manifest |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 53 | |
| 54 | To check out a branch other than "master", specify it with -b: |
| 55 | |
Jean-Baptiste Queru | 3e466b0 | 2011-10-06 14:34:00 -0700 | [diff] [blame] | 56 | $ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1 |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 57 | |
| 58 | - 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](http://www.google.com/accounts). 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. |
| 59 | |
| 60 | 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. |
| 61 | |
| 62 | |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 63 | ## Getting the files ## |
| 64 | |
| 65 | To pull down files to your working directory from the repositories as specified in the default manifest, run |
| 66 | |
| 67 | $ repo sync |
| 68 | |
Jean-Baptiste Queru | be48f61 | 2011-10-06 14:20:51 -0700 | [diff] [blame] | 69 | The Android source files will be located in your working directory |
| 70 | under their project names. The initial sync operation will take |
| 71 | an hour or more to complete. For more about `repo sync` and other |
| 72 | Repo commands, see [Version Control](version-control.html). |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 73 | |
| 74 | |
Jean-Baptiste Queru | 2e2de67 | 2012-01-05 09:08:46 -0800 | [diff] [blame] | 75 | ## Using authentication ## |
| 76 | |
| 77 | By default, access to the Android source code is anonymous. To protect the |
| 78 | servers against excessive usage, each IP address is associated with a quota. |
| 79 | |
| 80 | When sharing an IP address with other users (e.g. when accessing the source |
| 81 | repositories from beyond a NAT firewall), the quotas can trigger even for |
| 82 | regular usage patterns (e.g. if many users sync new clients from the same IP |
| 83 | address within a short period). |
| 84 | |
| 85 | In that case, it is possible to use authenticated access, which then uses |
| 86 | a separate quota for each user, regardless of the IP address. |
| 87 | |
| 88 | The first step is to create a password from |
| 89 | [the password generator](https://android.googlesource.com/new-password) and |
| 90 | to save it in `~/.netrc` according to the instructions on that page. |
| 91 | |
| 92 | The second step is to force authenticated access, by using the following |
| 93 | manifest URI: `https://android.googlesource.com/a/platform/manifest`. Notice |
| 94 | how the `/a/` directory prefix triggers mandatory authentication. You can |
| 95 | convert an existing client to use mandatory authentication with the following |
| 96 | command: |
| 97 | |
| 98 | $ repo init -u https://android.googlesource.com/a/platform/manifest |
| 99 | |
Jean-Baptiste Queru | 57a7910 | 2012-01-05 08:52:23 -0800 | [diff] [blame] | 100 | ## Troubleshooting network issues ## |
| 101 | |
| 102 | When downloading from behind a proxy (which is common in some |
| 103 | corporate environments), it might be necessary to explicitly |
| 104 | specify the proxy that is then used by repo: |
| 105 | |
| 106 | $ export HTTP_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port> |
| 107 | $ export HTTPS_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port> |
| 108 | |
| 109 | More rarely, Linux clients experience connectivity issues, getting |
| 110 | stuck in the middle of downloads (typically during "Receiving objects"). |
| 111 | It has been reported that tweaking the settings of the TCP/IP stack and |
| 112 | using non-parallel commands can improve the situation. You need root |
| 113 | access to modify the TCP setting: |
| 114 | |
| 115 | $ sudo sysctl -w net.ipv4.tcp_window_scaling=0 |
| 116 | $ repo sync -j1 |
| 117 | |
| 118 | |
Jean-Baptiste Queru | 76adec6 | 2012-01-05 10:12:06 -0800 | [diff] [blame^] | 119 | ## Using a local mirror ## |
| 120 | |
| 121 | When using many clients, especially in situations where bandwidth is scarce, |
| 122 | it is better to create a local mirror of the entire server content, and to |
| 123 | sync clients from that mirror (which requires no network access). |
| 124 | |
| 125 | These instructions assume that the mirror is created in `/usr/local/aosp/mirror`. |
| 126 | The first step is to create and sync the mirror itself, which uses close to |
| 127 | 10GB of network bandwidth and a similar amount of disk space. Notice the |
| 128 | `--mirror` flag, which can only be specified when creating a new client: |
| 129 | |
| 130 | $ mkdir -p /usr/local/aosp/mirror |
| 131 | $ cd /usr/local/aosp/mirror |
| 132 | $ repo init -u https://android.googlesource.com/mirror/manifest --mirror |
| 133 | $ repo sync |
| 134 | |
| 135 | Once the mirror is synced, new clients can be created from it. Note that it's |
| 136 | important to specify an absolute path: |
| 137 | |
| 138 | $ mkdir -p /usr/local/aosp/master |
| 139 | $ cd /usr/local/aosp/master |
| 140 | $ repo init -u /usr/local/aosp/mirror/platform/manifest.git |
| 141 | $ repo sync |
| 142 | |
| 143 | Finally, to sync a client against the server, the mirror needs to be synced |
| 144 | against the server, then the client against the mirror: |
| 145 | |
| 146 | $ cd /usr/local/aosp/mirror |
| 147 | $ repo sync |
| 148 | $ cd /usr/local/aosp/master |
| 149 | $ repo sync |
| 150 | |
| 151 | It's possible to store the mirror on a LAN server and to access it over |
| 152 | NFS, SSH or Git. It's also possible to store it on a removable drive and |
| 153 | to pass that drive around between users or between machines. |
| 154 | |
| 155 | |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 156 | ## Verifying Git Tags ## |
| 157 | |
| 158 | Load the following public key into your GnuPG key database. The key is used to sign annotated tags that represent releases. |
| 159 | |
| 160 | $ gpg --import |
| 161 | |
| 162 | Copy and paste the key(s) below, then enter EOF (Ctrl-D) to end the input and process the keys. |
| 163 | |
Conley Owens | 68ef984 | 2011-04-22 13:51:20 -0700 | [diff] [blame] | 164 | -----BEGIN PGP PUBLIC KEY BLOCK----- |
| 165 | Version: GnuPG v1.4.2.2 (GNU/Linux) |
Jean-Baptiste Queru | 6a64a5b | 2011-05-25 09:07:50 -0700 | [diff] [blame] | 166 | |
Conley Owens | 68ef984 | 2011-04-22 13:51:20 -0700 | [diff] [blame] | 167 | mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV |
| 168 | lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7 |
| 169 | 8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD |
| 170 | u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z |
|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
| 186 | KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb |
| 187 | N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA |
| 188 | vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo |
| 189 | G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ |
| 190 | hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l |
| 191 | EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM= |
| 192 | =Wi5D |
| 193 | -----END PGP PUBLIC KEY BLOCK----- |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 194 | |
Conley Owens | 68ef984 | 2011-04-22 13:51:20 -0700 | [diff] [blame] | 195 | After importing the keys, you can verify any tag with |
| 196 | |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 197 | $ git tag -v TAG_NAME |
| 198 | |
Conley Owens | 34e9812 | 2011-12-09 16:11:30 -0800 | [diff] [blame] | 199 | If you haven't [set up ccache](initializing.html#ccache) yet, |
| 200 | now would be a good time to do it. |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 201 | |
Conley Owens | 91b9bab | 2011-12-12 14:30:13 -0800 | [diff] [blame] | 202 | ## Downloading kernels ## |
| 203 | |
| 204 | If you are only interested in kernel sources, |
| 205 | you can get the kernel you are interested in through one of the following |
| 206 | commands: |
| 207 | |
| 208 | $ git clone https://android.googlesource.com/kernel/common.git |
| 209 | $ git clone https://android.googlesource.com/kernel/goldfish.git |
| 210 | $ git clone https://android.googlesource.com/kernel/msm.git |
| 211 | $ git clone https://android.googlesource.com/kernel/omap.git |
| 212 | $ git clone https://android.googlesource.com/kernel/samsung.git |
| 213 | $ git clone https://android.googlesource.com/kernel/tegra.git |
| 214 | |
Skyler Kaufman | 991ae4d | 2011-04-07 12:30:41 -0700 | [diff] [blame] | 215 | # Next: Build the code # |
| 216 | |
| 217 | You now have a complete local copy of the Android codebase. Continue on to [building](building.html).... |