forked from CyanogenMod/android_development
-
Notifications
You must be signed in to change notification settings - Fork 0
/
howto_SDK_git_cygwin.txt
189 lines (134 loc) · 5.42 KB
/
howto_SDK_git_cygwin.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
Copyright (C) 2009 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Subject: How to get the android source code using Cygwin and Git
Date: 2009/04/27
Updated: 2009/05/21
Updated: 2010/03/30
Table of content:
1- Goals and Requirements
2- Getting the code, the simple way
3- SSH issues
4- Advanced Tricks
-------------------------
1- Goals and Requirements
-------------------------
This document explains how to checkout the Android source from the git
repositories under Windows.
As stated in development/docs/howto_build_SDK.txt, one can't build the whole
Android source code under Windows. You can only build the SDK tools for
Windows.
There are a number of caveats in checking out the code from Git under Windows.
This document tries to explain them.
First you will need to meet the following requirements:
- You must have Cygwin installed. But wait! You CANNOT use the latest Cygwin 1.7.
Instead you MUST use the "legacy Cygwin 1.5" that you can find at this page:
http://cygwin.org/win-9x.html
Don't mind the page title, just grab setup-legacy.exe and it will works just fine
under XP or Vista.
- You must install Cyginw using the "Unix / Binary" mode.
If you don't do that, git will fail to properly compute some SHA1 keys.
- You need the "git" and "curl" packages to checkout the code.
If you plan to contribute, you might want to get "gitk" also.
Note: if you want to build the SDK, check the howto_build_SDK.txt file
for a list of extra required packages.
The short summary is that you need at least these:
autoconf, bison, curl, flex, gcc, g++, git, gnupg, make, mingw-zlib, python, unzip, zip
and you must avoid the "readline" package.
-----------------------------------
2- Getting the code, the simple way
-----------------------------------
Out of the box, "repo" and "git" will work just fine under Cygwin:
$ repo init -u git://android.git.kernel.org/platform/manifest.git
$ repo sync
And you're done. You can build as explained in howto_build_SDK.txt and ignore
the rest of this document.
-------------
3- SSH issues
-------------
If you maintain your own private repository using an SSH server, you might get
some "mux/ssh" errors. In this case try this:
$ repo init -u ssh://my.private.ssh.repo/platform/manifest.git
$ export GIT_SSH=ssh
$ repo sync
------------------
4- Advanced Tricks
------------------
There is one remaining issue with the default repo/git options:
If you plan on contributing, you will notice that even after a fresh "repo
sync" some projects are marked as having modified files. This happens on the
"bionic" and the "external/iptables" project. The issue is that they have files
which have the same name yet differ only by their case-sensitivity. Since the
Windows filesystem is not case-sensitive, this confuses Git.
Solution: we can simply ignore these projects as they are not needed to build
the Windows SDK.
To do this you just need to create a file .repo/local_manifest.xml that
provides a list of projects to ignore:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remove-project name="platform/external/iptables" />
</manifest>
The other thing we can do is tell git not to track the files that cause
problems:
cd bionic
git update-index --assume-unchanged \
libc/kernel/common/linux/netfilter/xt_CONNMARK.h \
libc/kernel/common/linux/netfilter/xt_MARK.h \
libc/kernel/common/linux/netfilter_ipv6/ip6t_HL.h
cd external/tcpdump;
git update-index --assume-unchanged \
tests/print-X.new \
tests/print-XX.new
Here's a script that takes care of all these details. It performs the repo
init, creates the appropriate local_manifest.xml, does a repo sync as
needed and tell git to ignore the offending files:
------------
#!/bin/bash
set -e # fail on errors
URL=ssh://android-git.corp.google.com:29418/platform/manifest.git
BRANCH=donut
if [ "$1" == "-b" ]; then shift; BRANCH=$1; shift; fi
# repo init if there's no .repo directory
if [[ ! -d .repo ]]; then
repo init -u $URL -b $BRANCH
fi
# create a local_manifest to exclude projects that cause problems under Windows
# due to the case-insenstivines of the file system.
L=.repo/local_manifest.xml
if [[ ! -f $L ]]; then
cat > $L <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remove-project name="platform/external/iptables" />
</manifest>
EOF
fi
# sync using the native ssh client if necessary
[[ $URL != ${URL/ssh/} ]] && export GIT_SSH=ssh
repo sync $@
# These files cause trouble too, we need to ignore them
(cd bionic;
git update-index --assume-unchanged \
libc/kernel/common/linux/netfilter/xt_CONNMARK.h \
libc/kernel/common/linux/netfilter/xt_MARK.h \
libc/kernel/common/linux/netfilter_ipv6/ip6t_HL.h
)
(cd external/tcpdump;
git update-index --assume-unchanged \
tests/print-X.new \
tests/print-XX.new
)
------------
Simply extract this to a "my_sync.sh" file and try the following:
$ mkdir android_src
$ cd android_src
$ chmod +x mysync.sh
$ ./mysync.sh
-end-