blob: 42da18b04ca1481f6ef8d365babf695fef885e2f [file] [log] [blame]
Raphael5ea42872009-04-27 15:01:16 -07001Copyright (C) 2009 The Android Open Source Project
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14
15
16Subject: How to get the android source code using Cygwin and Git
17Date: 2009/04/27
Raphael1a0b3ff2009-05-21 11:47:16 -070018Updated: 2009/05/21
Raphael5ea42872009-04-27 15:01:16 -070019
20
21Table of content:
22 1- Goals and Requirements
23 2- Getting the code, the simple way
24 3- SSH issues
25 4- Advanced Tricks
26
27
28-------------------------
291- Goals and Requirements
30-------------------------
31
32This document explains how to checkout the Android source from the git
33repositories under Windows.
34
35As stated in development/docs/howto_build_SDK.txt, one can't build the whole
36Android source code under Windows. You can only build a the SDK tools for
37Windows.
38
39There are a number of caveats in checking out the code from Git under Windows.
40This document tries to explain them.
41
42First you will need to meet the following requirements:
43- You must have Cygwin installed.
44 See http://www.cygwin.com/
45
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.
48
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.
51
52 Note: if you want to build the SDK, check the howto_build_SDK.txt file
53 for a list of extra required packages.
54
55
56-----------------------------------
572- Getting the code, the simple way
58-----------------------------------
59
60Out of the box, "repo" and "git" will work just fine under Cygwin:
61
62 $ repo init -u git://android.git.kernel.org/platform/manifest.git
63 $ repo sync
64
65And you're done. You can build as explained in howto_build_SDK.txt and ignore
66the rest of this document.
67
68
69-------------
703- SSH issues
71-------------
72
73If you maintain your own private repository using an SSH server, you might get
74some "mux/ssh" errors. In this case try this:
75
76 $ repo init -u ssh://my.private.ssh.repo/platform/manifest.git
77 $ export GIT_SSH=ssh
78 $ repo sync
79
80
81------------------
824- Advanced Tricks
83------------------
84
Raphael1a0b3ff2009-05-21 11:47:16 -070085There is one remaining issue with the default repo/git options:
Raphael5ea42872009-04-27 15:01:16 -070086
Raphael1a0b3ff2009-05-21 11:47:16 -070087If you plan on contributing, you will notice that even after a fresh "repo
Raphael5ea42872009-04-27 15:01:16 -070088sync" 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
90which have the same name yet differ only by their case-sensitivity. Since the
91Windows filesystem is not case-sensitive, this confuses Git.
92
93Solution: we can simply ignore these projects as they are not needed to build
94the Windows SDK.
95
96To do this you just need to create a file .repo/local_manifest.xml that
97provides a list of projects to ignore:
98
99<?xml version="1.0" encoding="UTF-8"?>
100<manifest>
Raphael5ea42872009-04-27 15:01:16 -0700101 <remove-project name="platform/external/iptables" />
102</manifest>
103
Raphael1a0b3ff2009-05-21 11:47:16 -0700104The other thing we can do is tell git not to track the files that cause
105problems:
Raphael5ea42872009-04-27 15:01:16 -0700106
Raphael1a0b3ff2009-05-21 11:47:16 -0700107 cd bionic
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
Raphael5ea42872009-04-27 15:01:16 -0700112
Raphael1a0b3ff2009-05-21 11:47:16 -0700113 cd external/tcpdump;
114 git update-index --assume-unchanged \
115 tests/print-X.new \
116 tests/print-XX.new
117
Raphael5ea42872009-04-27 15:01:16 -0700118
119Here's a script that takes care of all these details. It performs the repo
Raphael1a0b3ff2009-05-21 11:47:16 -0700120init, creates the appropriate local_manifest.xml, does a repo sync as
121needed and tell git to ignore the offending files:
Raphael5ea42872009-04-27 15:01:16 -0700122
123------------
124#!/bin/bash
125
126set -e # fail on errors
127
Raphael1a0b3ff2009-05-21 11:47:16 -0700128URL=ssh://android-git.corp.google.com:29418/platform/manifest.git
Raphael5ea42872009-04-27 15:01:16 -0700129BRANCH=donut
Raphael1a0b3ff2009-05-21 11:47:16 -0700130if [ "$1" == "-b" ]; then shift; BRANCH=$1; shift; fi
Raphael5ea42872009-04-27 15:01:16 -0700131
Raphael68fee202009-04-28 12:11:03 -0700132# repo init if there's no .repo directory
133if [[ ! -d .repo ]]; then
Raphael5ea42872009-04-27 15:01:16 -0700134 repo init -u $URL -b $BRANCH
Raphael68fee202009-04-28 12:11:03 -0700135fi
Raphael5ea42872009-04-27 15:01:16 -0700136
Raphael1a0b3ff2009-05-21 11:47:16 -0700137# create a local_manifest to exclude projects that cause problems under Windows
138# due to the case-insenstivines of the file system.
Raphael68fee202009-04-28 12:11:03 -0700139L=.repo/local_manifest.xml
140if [[ ! -f $L ]]; then
Raphael5ea42872009-04-27 15:01:16 -0700141
142 cat > $L <<EOF
143<?xml version="1.0" encoding="UTF-8"?>
144<manifest>
Raphael1a0b3ff2009-05-21 11:47:16 -0700145<remove-project name="platform/external/iptables" />
Raphael5ea42872009-04-27 15:01:16 -0700146</manifest>
Raphael1a0b3ff2009-05-21 11:47:16 -0700147EOF
Raphael5ea42872009-04-27 15:01:16 -0700148fi
149
Raphael1a0b3ff2009-05-21 11:47:16 -0700150# sync using the native ssh client if necessary
Raphael5ea42872009-04-27 15:01:16 -0700151[[ $URL != ${URL/ssh/} ]] && export GIT_SSH=ssh
Raphael1a0b3ff2009-05-21 11:47:16 -0700152repo sync $@
Raphael5ea42872009-04-27 15:01:16 -0700153
154
Raphael1a0b3ff2009-05-21 11:47:16 -0700155# These files cause trouble too, we need to ignore them
156(cd bionic;
157git 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
161)
162(cd external/tcpdump;
163git update-index --assume-unchanged \
164 tests/print-X.new \
165 tests/print-XX.new
166)
167------------
168
Raphael5ea42872009-04-27 15:01:16 -0700169Simply extract this to a "my_sync.sh" file and try the following:
170 $ mkdir android_src
171 $ cd android_src
172 $ chmod +x mysync.sh
173 $ ./mysync.sh
174
175
176-end-
177
178
179
180