1 Copyright (C) 2009 The Android Open Source Project
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
7 http://www.apache.org/licenses/LICENSE-2.0
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
16 Subject: How to get the android source code using Cygwin and Git
23 1- Goals and Requirements
24 2- Getting the code, the simple way
29 -------------------------
30 1- Goals and Requirements
31 -------------------------
33 This document explains how to checkout the Android source from the git
34 repositories under Windows.
36 As stated in development/docs/howto_build_SDK.txt, one can't build the whole
37 Android source code under Windows. You can only build the SDK tools for
40 There are a number of caveats in checking out the code from Git under Windows.
41 This document tries to explain them.
43 First you will need to meet the following requirements:
44 - You must have Cygwin installed. But wait! You CANNOT use the latest Cygwin 1.7.
45 Instead you MUST use the "legacy Cygwin 1.5" that you can find at this page:
47 http://cygwin.org/win-9x.html
49 Don't mind the page title, just grab setup-legacy.exe and it will works just fine
52 - You must install Cyginw using the "Unix / Binary" mode.
53 If you don't do that, git will fail to properly compute some SHA1 keys.
55 - You need the "git" and "curl" packages to checkout the code.
56 If you plan to contribute, you might want to get "gitk" also.
58 Note: if you want to build the SDK, check the howto_build_SDK.txt file
59 for a list of extra required packages.
60 The short summary is that you need at least these:
61 autoconf, bison, curl, flex, gcc, g++, git, gnupg, make, mingw-zlib, python, unzip, zip
62 and you must avoid the "readline" package.
65 -----------------------------------
66 2- Getting the code, the simple way
67 -----------------------------------
69 Out of the box, "repo" and "git" will work just fine under Cygwin:
71 $ repo init -u git://android.git.kernel.org/platform/manifest.git
74 And you're done. You can build as explained in howto_build_SDK.txt and ignore
75 the rest of this document.
82 If you maintain your own private repository using an SSH server, you might get
83 some "mux/ssh" errors. In this case try this:
85 $ repo init -u ssh://my.private.ssh.repo/platform/manifest.git
94 There is one remaining issue with the default repo/git options:
96 If you plan on contributing, you will notice that even after a fresh "repo
97 sync" some projects are marked as having modified files. This happens on the
98 "bionic" and the "external/iptables" project. The issue is that they have files
99 which have the same name yet differ only by their case-sensitivity. Since the
100 Windows filesystem is not case-sensitive, this confuses Git.
102 Solution: we can simply ignore these projects as they are not needed to build
105 To do this you just need to create a file .repo/local_manifest.xml that
106 provides a list of projects to ignore:
108 <?xml version="1.0" encoding="UTF-8"?>
110 <remove-project name="platform/external/iptables" />
113 The other thing we can do is tell git not to track the files that cause
117 git update-index --assume-unchanged \
118 libc/kernel/common/linux/netfilter/xt_CONNMARK.h \
119 libc/kernel/common/linux/netfilter/xt_MARK.h \
120 libc/kernel/common/linux/netfilter_ipv6/ip6t_HL.h
123 git update-index --assume-unchanged \
128 Here's a script that takes care of all these details. It performs the repo
129 init, creates the appropriate local_manifest.xml, does a repo sync as
130 needed and tell git to ignore the offending files:
135 set -e # fail on errors
137 URL=ssh://android-git.corp.google.com:29418/platform/manifest.git
139 if [ "$1" == "-b" ]; then shift; BRANCH=$1; shift; fi
141 # repo init if there's no .repo directory
142 if [[ ! -d .repo ]]; then
143 repo init -u $URL -b $BRANCH
146 # create a local_manifest to exclude projects that cause problems under Windows
147 # due to the case-insenstivines of the file system.
148 L=.repo/local_manifest.xml
149 if [[ ! -f $L ]]; then
152 <?xml version="1.0" encoding="UTF-8"?>
154 <remove-project name="platform/external/iptables" />
159 # sync using the native ssh client if necessary
160 [[ $URL != ${URL/ssh/} ]] && export GIT_SSH=ssh
164 # These files cause trouble too, we need to ignore them
166 git update-index --assume-unchanged \
167 libc/kernel/common/linux/netfilter/xt_CONNMARK.h \
168 libc/kernel/common/linux/netfilter/xt_MARK.h \
169 libc/kernel/common/linux/netfilter_ipv6/ip6t_HL.h
171 (cd external/tcpdump;
172 git update-index --assume-unchanged \
178 Simply extract this to a "my_sync.sh" file and try the following: