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
22 1- Goals and Requirements
23 2- Getting the code, the simple way
28 -------------------------
29 1- Goals and Requirements
30 -------------------------
32 This document explains how to checkout the Android source from the git
33 repositories under Windows.
35 As stated in development/docs/howto_build_SDK.txt, one can't build the whole
36 Android source code under Windows. You can only build a the SDK tools for
39 There are a number of caveats in checking out the code from Git under Windows.
40 This document tries to explain them.
42 First you will need to meet the following requirements:
43 - You must have Cygwin installed.
44 See http://www.cygwin.com/
46 - You must install Cyginw using the "Unix / Binary" mode.
47 If you don't do that, git will fail to properly compute some SHA1 keys.
49 - You need the "git" and "curl" packages to checkout the code.
50 If you plan to contribute, you might want to get "gitk" also.
52 Note: if you want to build the SDK, check the howto_build_SDK.txt file
53 for a list of extra required packages.
56 -----------------------------------
57 2- Getting the code, the simple way
58 -----------------------------------
60 Out of the box, "repo" and "git" will work just fine under Cygwin:
62 $ repo init -u git://android.git.kernel.org/platform/manifest.git
65 And you're done. You can build as explained in howto_build_SDK.txt and ignore
66 the rest of this document.
73 If you maintain your own private repository using an SSH server, you might get
74 some "mux/ssh" errors. In this case try this:
76 $ repo init -u ssh://my.private.ssh.repo/platform/manifest.git
85 There is one remaining issue with the default repo/git options:
87 If you plan on contributing, you will notice that even after a fresh "repo
88 sync" some projects are marked as having modified files. This happens on the
89 "bionic" and the "external/iptables" project. The issue is that they have files
90 which have the same name yet differ only by their case-sensitivity. Since the
91 Windows filesystem is not case-sensitive, this confuses Git.
93 Solution: we can simply ignore these projects as they are not needed to build
96 To do this you just need to create a file .repo/local_manifest.xml that
97 provides a list of projects to ignore:
99 <?xml version="1.0" encoding="UTF-8"?>
101 <remove-project name="platform/external/iptables" />
104 The other thing we can do is tell git not to track the files that cause
108 git update-index --assume-unchanged \
109 libc/kernel/common/linux/netfilter/xt_CONNMARK.h \
110 libc/kernel/common/linux/netfilter/xt_MARK.h \
111 libc/kernel/common/linux/netfilter_ipv6/ip6t_HL.h
114 git update-index --assume-unchanged \
119 Here's a script that takes care of all these details. It performs the repo
120 init, creates the appropriate local_manifest.xml, does a repo sync as
121 needed and tell git to ignore the offending files:
126 set -e # fail on errors
128 URL=ssh://android-git.corp.google.com:29418/platform/manifest.git
130 if [ "$1" == "-b" ]; then shift; BRANCH=$1; shift; fi
132 # repo init if there's no .repo directory
133 if [[ ! -d .repo ]]; then
134 repo init -u $URL -b $BRANCH
137 # create a local_manifest to exclude projects that cause problems under Windows
138 # due to the case-insenstivines of the file system.
139 L=.repo/local_manifest.xml
140 if [[ ! -f $L ]]; then
143 <?xml version="1.0" encoding="UTF-8"?>
145 <remove-project name="platform/external/iptables" />
150 # sync using the native ssh client if necessary
151 [[ $URL != ${URL/ssh/} ]] && export GIT_SSH=ssh
155 # These files cause trouble too, we need to ignore them
157 git update-index --assume-unchanged \
158 libc/kernel/common/linux/netfilter/xt_CONNMARK.h \
159 libc/kernel/common/linux/netfilter/xt_MARK.h \
160 libc/kernel/common/linux/netfilter_ipv6/ip6t_HL.h
162 (cd external/tcpdump;
163 git update-index --assume-unchanged \
169 Simply extract this to a "my_sync.sh" file and try the following: