Project

General

Profile

DeprecatedBuildAndroid » History » Version 34

Denis 'GNUtoo' Carikli, 11/11/2010 09:49 AM

1 16 Denis 'GNUtoo' Carikli
Edit:
2
We have now a temporary git repository at gitorious:
3
http://gitorious.org/replicant
4
5 1 Denis 'GNUtoo' Carikli
6 34 Denis 'GNUtoo' Carikli
h2. Before starting
7 1 Denis 'GNUtoo' Carikli
8 34 Denis 'GNUtoo' Carikli
* Root your phone
9
* Backup your current system!!!
10
* Install git
11
12
13
h2. Setting up the build environment and getting source code
14
15
16 25 Aaron Williamson -
These instructions assume that you are building replicant in your home directory (~).  If you are building it in another directory, modify path names accordingly.
17
18 34 Denis 'GNUtoo' Carikli
19
h3. Get the repo tool
20
21 1 Denis 'GNUtoo' Carikli
repo is a front-end to git which is used to manage several git repositories.
22 34 Denis 'GNUtoo' Carikli
<pre>
23 1 Denis 'GNUtoo' Carikli
 mkdir bin
24
 cd bin
25
 wget http://android.git.kernel.org/repo
26
 chmod a+x repo
27 25 Aaron Williamson -
 cd ..
28 34 Denis 'GNUtoo' Carikli
</pre>
29 25 Aaron Williamson -
30 34 Denis 'GNUtoo' Carikli
31
h3. Check out the Replicant repository
32
33 1 Denis 'GNUtoo' Carikli
This step will download the Android source (minus the kernel) and the Replicant patches.
34 34 Denis 'GNUtoo' Carikli
<pre>
35 1 Denis 'GNUtoo' Carikli
 mkdir replicant
36
 cd replicant
37
 ../bin/repo init -u git://gitorious.org/replicant/manifest.git -b replicant
38
 ../bin/repo sync
39 34 Denis 'GNUtoo' Carikli
</pre>
40 25 Aaron Williamson -
41
42 34 Denis 'GNUtoo' Carikli
h2. Optional: building the kernel and wireless LAN driver
43
44
45 1 Denis 'GNUtoo' Carikli
By default, the Android build system uses a pre-compiled kernel and wireless driver rather than compiling these components from scratch.  If you want to compile your own copy of either of these components, you have to compile both: the wireless driver sources included with Android are incompatible with the pre-compiled kernel.
46 25 Aaron Williamson -
47
48 34 Denis 'GNUtoo' Carikli
h3. Get the kernel source
49
50
51 1 Denis 'GNUtoo' Carikli
To download the kernel sources, create a file in your replicant/.repo directory called "local_manifest.xml" containing the following:
52 34 Denis 'GNUtoo' Carikli
<pre>
53 1 Denis 'GNUtoo' Carikli
<?xml version="1.0" encoding="UTF-8"?>
54 25 Aaron Williamson -
 <manifest>
55
  <project path="kernel" name="kernel/msm" revision="refs/heads/android-msm-2.6.27"/>
56
 </manifest>
57 34 Denis 'GNUtoo' Carikli
</pre>
58 25 Aaron Williamson -
59 1 Denis 'GNUtoo' Carikli
Then from the ~/replicant/ directory, run:
60 34 Denis 'GNUtoo' Carikli
<pre>
61 1 Denis 'GNUtoo' Carikli
../bin/repo sync
62 34 Denis 'GNUtoo' Carikli
</pre>
63 1 Denis 'GNUtoo' Carikli
64
This will create a directory called replicant/kernel and download the kernel sources to it.
65
66 25 Aaron Williamson -
67 34 Denis 'GNUtoo' Carikli
h3. Build the kernel
68
69
70 25 Aaron Williamson -
To build the kernel:
71 1 Denis 'GNUtoo' Carikli
72 34 Denis 'GNUtoo' Carikli
<pre>
73 1 Denis 'GNUtoo' Carikli
cd ~/replicant/kernel
74
export ARCH=arm
75 25 Aaron Williamson -
export CROSS_COMPILE=arm-eabi-
76
export PATH=$PATH:~/replicant/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin
77 1 Denis 'GNUtoo' Carikli
cp arch/arm/configs/msm_defconfig .config
78 25 Aaron Williamson -
make oldconfig && make
79 34 Denis 'GNUtoo' Carikli
</pre>
80 25 Aaron Williamson -
81 1 Denis 'GNUtoo' Carikli
Wait several hours.
82
83
84 34 Denis 'GNUtoo' Carikli
h3. Point the build system to your kernel
85
86
87
Create a file called @~/replicant/buildspec.mk@ containing the following:
88
<pre>
89 1 Denis 'GNUtoo' Carikli
TARGET_PRODUCT:=htc_dream
90
TARGET_PREBUILT_KERNEL:=kernel/arch/arm/boot/zImage
91 34 Denis 'GNUtoo' Carikli
</pre>
92 1 Denis 'GNUtoo' Carikli
93
This will instruct the build process to use your kernel rather than the pre-compiled kernel.
94
95
96 34 Denis 'GNUtoo' Carikli
h3. Build the wifi module
97
98
99 25 Aaron Williamson -
To build the wifi module:
100 34 Denis 'GNUtoo' Carikli
<pre>
101 1 Denis 'GNUtoo' Carikli
cd ~/replicant/system/wlan/ti/sta_dk_4_0_4_32
102
export KERNEL_DIR=~/replicant/kernel/
103
make
104 34 Denis 'GNUtoo' Carikli
</pre>
105 1 Denis 'GNUtoo' Carikli
106
(If make can't find your compiler, re-run same PATH export command you ran before compiling the kernel.)
107
108
Replace the pre-built wifi module with the one you just built:
109 34 Denis 'GNUtoo' Carikli
<pre>
110 1 Denis 'GNUtoo' Carikli
cp wlan.ko ~/replicant/vendor/htc/dream-open
111 34 Denis 'GNUtoo' Carikli
</pre>
112 25 Aaron Williamson -
113 1 Denis 'GNUtoo' Carikli
114 34 Denis 'GNUtoo' Carikli
h2. Build the firmware
115 1 Denis 'GNUtoo' Carikli
116
117 34 Denis 'GNUtoo' Carikli
118
h3. Change the build scripts to include some important missing packages
119
120
121
_(This section will be removed once these changes are committed to the replicant repository)_
122
123
<pre>
124
<pre>
125 1 Denis 'GNUtoo' Carikli
 PRODUCT_PACKAGES := \
126
 Calculator \
127
 Email \
128 34 Denis 'GNUtoo' Carikli
 [[ImProvider]] \
129
 [[SdkSetup]] \
130
 [[VoiceDialer]]
131
</pre>
132 26 Aaron Williamson -
133 34 Denis 'GNUtoo' Carikli
This will include packages in the build which would otherwise be missing (including the [[SdkSetup]] package, which will enable incoming calls).
134 26 Aaron Williamson -
135 34 Denis 'GNUtoo' Carikli
<pre>
136 26 Aaron Williamson -
cd ~/replicant
137 1 Denis 'GNUtoo' Carikli
make
138 34 Denis 'GNUtoo' Carikli
</pre>
139 22 Denis 'GNUtoo' Carikli
140
Wait and wait and wait.
141 5 Denis 'GNUtoo' Carikli
142
143 34 Denis 'GNUtoo' Carikli
h2. Flashing the new firmware
144
145
146 5 Denis 'GNUtoo' Carikli
[to be written]
147 1 Denis 'GNUtoo' Carikli
148
149 34 Denis 'GNUtoo' Carikli
h2. Building individual pieces
150
151
152
153
h3. Each time you want to build something
154
155
* open a new console
156
* Then type:
157
<pre>
158 1 Denis 'GNUtoo' Carikli
 cd ~/replicant
159
 source build/envsetup.sh
160
 export ANDROID_JAVA_HOME=$JAVA_HOME
161
 lunch htc_dream-eng
162
 make
163 34 Denis 'GNUtoo' Carikli
</pre>
164
* The files to flash are in ~/replicant/out/target/product/dream,flash them and then clear the cache
165
* boot and push the wifi firmware if you want it
166 24 Denis 'GNUtoo' Carikli
167
168 34 Denis 'GNUtoo' Carikli
169
h3. If you want to build a particular project
170
171
* open a new console
172
* build everything if it was not done before
173
* Then type:
174
<pre>
175 30 Denis 'GNUtoo' Carikli
 cd ~/replicant
176
 source build/envsetup.sh
177
 export ANDROID_JAVA_HOME=$JAVA_HOME
178
 lunch htc_dream-eng
179
 #go into the directory containing an Android.mk
180
 mm
181 34 Denis 'GNUtoo' Carikli
</pre>
182 30 Denis 'GNUtoo' Carikli
183 34 Denis 'GNUtoo' Carikli
184
h2. error workarrounds ==
185
 hyts_Foo.c ===
186 30 Denis 'GNUtoo' Carikli
if you have:
187 34 Denis 'GNUtoo' Carikli
<pre>
188
target Java: [[SettingsProvider]] (out/target/common/obj/APPS/SettingsProvider_intermediates/classes)
189 30 Denis 'GNUtoo' Carikli
target Java: Settings (out/target/common/obj/APPS/Settings_intermediates/classes)
190
java.util.zip.ZipException: duplicate entry: hyts_Foo.c
191
	at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:192)
192
	at java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:109)
193
	at sun.tools.jar.Main.addFile(Main.java:731)
194
	at sun.tools.jar.Main.update(Main.java:585)
195
	at sun.tools.jar.Main.run(Main.java:220)
196
	at sun.tools.jar.Main.main(Main.java:1167)
197
make: *** [out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar] Error 1
198 34 Denis 'GNUtoo' Carikli
make: *** Deleting file @out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar'
199 30 Denis 'GNUtoo' Carikli
make: *** Waiting for unfinished jobs....
200
Note: frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java uses or overrides a deprecated API.
201
Note: Recompile with -Xlint:deprecation for details.
202
Note: Some input files use or override a deprecated API.
203
Note: Recompile with -Xlint:deprecation for details.
204
Note: Some input files use or override a deprecated API.
205 31 Denis 'GNUtoo' Carikli
Note: Recompile with -Xlint:deprecation for details.
206 30 Denis 'GNUtoo' Carikli
Note: Some input files use unchecked or unsafe operations.
207
Note: Recompile with -Xlint:unchecked for details.
208 31 Denis 'GNUtoo' Carikli
Note: Some input files use or override a deprecated API.
209 1 Denis 'GNUtoo' Carikli
Note: Recompile with -Xlint:deprecation for details.
210
Note: Some input files use unchecked or unsafe operations.
211 32 Denis 'GNUtoo' Carikli
Note: Recompile with -Xlint:unchecked for details.
212 34 Denis 'GNUtoo' Carikli
</pre>
213 31 Denis 'GNUtoo' Carikli
214 1 Denis 'GNUtoo' Carikli
do that:
215 34 Denis 'GNUtoo' Carikli
<pre>
216 32 Denis 'GNUtoo' Carikli
rm -f dalvik/libcore/luni/src/test/resources/hyts_Foo.c
217 34 Denis 'GNUtoo' Carikli
</pre>
218 32 Denis 'GNUtoo' Carikli
And it will continue to build
219
220 33 Denis 'GNUtoo' Carikli
Note that that:
221 34 Denis 'GNUtoo' Carikli
<pre>
222 33 Denis 'GNUtoo' Carikli
rm -rf dalvik/libcore/dom/src/test/resources/*
223
rm -rf dalvik/libcore/xml/src/test/resources/*
224 34 Denis 'GNUtoo' Carikli
</pre>
225 33 Denis 'GNUtoo' Carikli
didn't work
226
227 34 Denis 'GNUtoo' Carikli
The workarrounds came from "here":http://groups.google.com/group/android-porting/browse_thread/thread/c51d436b2b1edc8d/b320ee78b2ddd0e4 and "here":http://lazyhack.net/tag/emulator/
228
229
h3. No rule to make target @development/data/etc/apns-conf_sdk.xml'
230
231 1 Denis 'GNUtoo' Carikli
if you have:
232 34 Denis 'GNUtoo' Carikli
<pre>
233
make: *** No rule to make target @development/data/etc/apns-conf_sdk.xml', needed by @out/target/product/dream-open/system/etc/apns-conf.xml'.  Stop.
234 1 Denis 'GNUtoo' Carikli
make: *** Waiting for unfinished jobs....
235 34 Denis 'GNUtoo' Carikli
</pre>
236 1 Denis 'GNUtoo' Carikli
simply re-type make and it should continue