Project

General

Profile

DeprecatedPortingGuideMSMQSD » History » Version 65

Paul Kocialkowski, 10/03/2011 03:13 PM

1 1 Denis 'GNUtoo' Carikli
== Introduction ==
2
Many people bought many different phones, and some of them whish to help replicant and/or to port replicant to their phones or devices.
3 33 Michael Haas -
This guide will show what was done for the htc dream, so these people can understand the process better.
4 34 Michael Haas -
When talking about porting, this page talks about re-using existing product definitions. You will not learn how to
5
build Android for a device not currently supported by Android. Instead, you will learn how to build a version of
6
[Cyanogenmod http://www.cyanogenmod.com/] without proprietary parts.
7 35 Michael Haas -
To gain more insight in the Android build system, refer to [http://source.android.com/porting/build_system.html Android Build System documentation] which is part of
8 34 Michael Haas -
[http://source.android.com/porting/ Android Platform Developer's Guide]. You should find an answer there if you have any questions about the Makefiles referenced in this document.
9 32 Michael Haas -
10 62 Igor Almeida -
Note: The Android Build System documentation above has been removed. You can find a mirror of the (outdated) documentation [http://www.kandroid.org/online-pdk/guide/index.html here] and [http://www.netmite.com/android/mydroid/development/pdk/docs/ here].
11
12 1 Denis 'GNUtoo' Carikli
== Terminology ==
13 33 Michael Haas -
The RIL is the radio interface library, that is to say, a library that talks to the modem, usually (but not always) trough AT commands.
14 32 Michael Haas -
Basically the modem runs on a separate CPU,and there is some sort of communication needed between the main CPU and the modem CPU to make telephony work. For instance, the modem must tell you when you've got a call, and you must tell the modem that you want to call someone.
15 1 Denis 'GNUtoo' Carikli
TODO: point to 0707 standard or newer
16
17 31 Denis 'GNUtoo' Carikli
== Help with source code ==
18 32 Michael Haas -
Keep in mind that on most devices, the full source code of the kernel is released.
19
However, some userspace libraries, or dlopened libraries (libraries loaded at runtime after the application started) are proprietary software,
20 31 Denis 'GNUtoo' Carikli
so if you're porting to a new CPU/SOC keep in mind that you have the source code to the kernel interfaces.
21
That can help a lot, and sometimes there is even some sort of documentation in the headers.
22 1 Denis 'GNUtoo' Carikli
23
== Build the source ==
24
25
The first thing to do is to download the replicant sources:
26
[wiki:BuildDream] can be used as a reference: download and build the sources for your device.
27 32 Michael Haas -
Let's say the user has a HTC Wildfire. It is useful to know the codename of the device in question, which is "Buzz" in case
28
of the Wildfire.
29 1 Denis 'GNUtoo' Carikli
30 32 Michael Haas -
You need to configure the build tree for our device. By default, a generic image
31
for the Android emulator will be built. 
32
In [wiki:BuildDream], you would use the following command to set up the build:
33 2 Denis 'GNUtoo' Carikli
{{{
34
lunch cyanogen_dream_sapphire-eng 
35
}}}
36 32 Michael Haas -
Now, since you are not building for the HTC dream, you need to identify the right command that corresponds to your device.
37
In order to do that, run the following command and look at its output.
38 2 Denis 'GNUtoo' Carikli
{{{
39
$ source build/envsetup.sh
40
including device/geeksphone/one/vendorsetup.sh
41
including device/htc/ace/vendorsetup.sh
42
including device/htc/bravoc/vendorsetup.sh
43
including device/htc/bravo/vendorsetup.sh
44
including device/htc/buzz/vendorsetup.sh
45
including device/htc/glacier/vendorsetup.sh
46 1 Denis 'GNUtoo' Carikli
including device/htc/heroc/vendorsetup.sh
47
including device/htc/inc/vendorsetup.sh
48 2 Denis 'GNUtoo' Carikli
including device/htc/legend/vendorsetup.sh
49
including device/htc/liberty/vendorsetup.sh
50
including device/htc/supersonic/vendorsetup.sh
51
including device/htc/vision/vendorsetup.sh
52
including device/motorola/sholes/vendorsetup.sh
53
including device/nvidia/harmony/vendorsetup.sh
54
including vendor/cyanogen/vendorsetup.sh
55
}}}
56 37 Denis 'GNUtoo' Carikli
The last line is important:
57 1 Denis 'GNUtoo' Carikli
{{{
58 37 Denis 'GNUtoo' Carikli
$ cat vendor/cyanogen/vendorsetup.sh
59
add_lunch_combo cyanogen_ace-eng
60
add_lunch_combo cyanogen_bravo-eng
61
add_lunch_combo cyanogen_bravoc-eng
62
add_lunch_combo cyanogen_buzz-eng
63
add_lunch_combo cyanogen_dream_sapphire-eng
64
add_lunch_combo cyanogen_espresso-eng
65
add_lunch_combo cyanogen_glacier-eng
66
add_lunch_combo cyanogen_harmony-eng
67
add_lunch_combo cyanogen_hero-eng
68
add_lunch_combo cyanogen_heroc-eng
69
add_lunch_combo cyanogen_inc-eng
70
add_lunch_combo cyanogen_legend-eng
71
add_lunch_combo cyanogen_liberty-eng
72
add_lunch_combo cyanogen_one-eng
73
add_lunch_combo cyanogen_passion-eng
74
add_lunch_combo cyanogen_sholes-eng
75
add_lunch_combo cyanogen_supersonic-eng
76
add_lunch_combo cyanogen_vibrant-eng
77
add_lunch_combo cyanogen_vision-eng
78
add_lunch_combo cyanogen_z71-eng
79 4 Denis 'GNUtoo' Carikli
80 37 Denis 'GNUtoo' Carikli
PATH=$PATH:$PWD/vendor/cyanogen/tools ; export PATH
81 4 Denis 'GNUtoo' Carikli
}}}
82 37 Denis 'GNUtoo' Carikli
The output include the list of supported (by cyanogenmod) devices.
83
For instance if you have the Wildfire (codename 'buzz') phone do:
84 36 Michael Haas -
{{{
85 1 Denis 'GNUtoo' Carikli
lunch cyanogen_buzz-eng
86 36 Michael Haas -
}}}
87
88 1 Denis 'GNUtoo' Carikli
Then build the source, backup what's on your device, including the operating system, and flash the new replicant image.
89 9 Denis 'GNUtoo' Carikli
90
Then test what works and what doesn't.
91 1 Denis 'GNUtoo' Carikli
92
The images are located in 
93
{{{
94
out/target/product/dream_sapphire
95 32 Michael Haas -
}}}
96 8 Denis 'GNUtoo' Carikli
in the case of the HTC Dream. You need to look in the path that corresponds to your device.
97 1 Denis 'GNUtoo' Carikli
98
== Trying free replacements ==
99 32 Michael Haas -
100
The source code you just built contains some free replacements for the proprietary
101
libraries shipped by your phone vendor with the default firmware.
102
103 1 Denis 'GNUtoo' Carikli
A list of proprietary libraries is available in
104 10 Denis 'GNUtoo' Carikli
{{{
105
device/htc/dream_sapphire/extract-files.sh
106 32 Michael Haas -
}}}
107
Note: don't run this file, just look at it. If you run it, the proprietary files will be copied from your phone into the build tree. A build containing proprietary files would put you and
108 1 Denis 'GNUtoo' Carikli
your users at risk. Additionally, it is illegal to redistribute such build, because the libraries are not redistributable(the copyright owner didn't allow you to redistribute them).
109 32 Michael Haas -
110
111
=== RIL test ===
112
I will take the example of how to use the free RIL (Radio Interface Library) to see if it works fine without modifications:
113 11 Denis 'GNUtoo' Carikli
The proprietary RIL library (which you don't have in the phone) location is found looking at the extract-files.sh
114
here's a part of extract-files.sh:
115
{{{
116
adb pull /system/lib/libhtc_ril.so ../../../vendor/htc/$DEVICE/proprietary/libhtc_ril.so
117 32 Michael Haas -
}}}
118
Note: don't run this command, just look at it. If you run it, the proprietary files will be copied from your phone into the build tree. A build containing proprietary files would put you and
119
your users at risk. Additionally, it is illegal to redistribute such build, because the libraries are not redistributable(the copyright owner didn't allow you to redistribute them).
120
121 12 Denis 'GNUtoo' Carikli
So looking at the above line the proprietary RIL is located here on the phone:
122
{{{
123
/system/lib/libhtc_ril.so
124 32 Michael Haas -
}}}
125 13 Denis 'GNUtoo' Carikli
while the free ril is located here (known fact):
126 14 Denis 'GNUtoo' Carikli
{{{
127 1 Denis 'GNUtoo' Carikli
/system/lib/libreference-ril.so
128 32 Michael Haas -
}}}
129 13 Denis 'GNUtoo' Carikli
In order to test the free RIL you could be tempted to do that:
130 14 Denis 'GNUtoo' Carikli
{{{
131 15 Denis 'GNUtoo' Carikli
# ./adb remount
132 14 Denis 'GNUtoo' Carikli
# ./adb shell
133 1 Denis 'GNUtoo' Carikli
mv /system/lib/libreference-ril.so /system/lib/libhtc_ril.so
134
}}}
135
But that wouldn't work as it wouldn't be using the right serial port, the correct way to try that is to use getprop/setprop:
136 14 Denis 'GNUtoo' Carikli
{{{
137 1 Denis 'GNUtoo' Carikli
# ./adb shell
138
# setprop
139
usage: setprop <key> <value>
140 32 Michael Haas -
}}}
141 39 Konstantinos Karantias -
What you can do to set the libre RIL is - possibly - this:
142
{{{
143
./adb shell
144
setprop rild.libpath /system/lib/libreference-ril.so
145
setprop rild.libargs -d/dev/smd0
146
}}}
147 13 Denis 'GNUtoo' Carikli
Here's how it looks on a working replicant on the HTC Dream:
148
{{{
149
# ./adb shell
150
# getprop | grep ril
151
[ro.ril.hsxpa]: [2]
152
[ro.ril.gprsclass]: [10]
153 1 Denis 'GNUtoo' Carikli
[rild.libpath]: [/system/lib/libreference-ril.so]
154
[rild.libargs]: [-d/dev/smd0]
155 15 Denis 'GNUtoo' Carikli
[init.svc.ril-daemon]: [running]
156
[ro.ril.def.agps.mode]: [2]
157 32 Michael Haas -
[gsm.version.ril-impl]: [android reference-ril 1.0]
158 14 Denis 'GNUtoo' Carikli
}}}
159 12 Denis 'GNUtoo' Carikli
 * /dev/smd0 is the (emulated) serial port
160
 * /system/lib/libreference-ril.so is where to look for the RIL hardware specific library 
161 1 Denis 'GNUtoo' Carikli
162 39 Konstantinos Karantias -
Then, you can kill the ril daemon:
163 1 Denis 'GNUtoo' Carikli
{{{
164 39 Konstantinos Karantias -
./adb shell killall rild
165 1 Denis 'GNUtoo' Carikli
}}}
166 39 Konstantinos Karantias -
Then try the reference RIL. You can see debugging things and such by doing:
167
{{{
168
./adb logcat -b radio
169
}}}
170
171
That's also tested and worked on the gtklocker's HTC Hero, so I suppose it will work for the most HTC devices out there. If your device isn't listed anywhere, don't dare to try it.
172 32 Michael Haas -
173 16 Denis 'GNUtoo' Carikli
== Replacing proprietary libraries for real ==
174 32 Michael Haas -
175
On the HTC Dream the following proprietary libraries were replaced:
176 16 Denis 'GNUtoo' Carikli
(Refer to [wiki:ProprietaryHtcDreamLibsReplacement] for more up to date details(or fix it if it's less recent))
177
178
The first thing you will have to do is to modify the build system.
179 1 Denis 'GNUtoo' Carikli
The key thing to do is to change 
180 32 Michael Haas -
181
=== RIL ===
182 64 Paul Kocialkowski
183
==== Android Reference RIL ====
184
185 32 Michael Haas -
If the RIL you previously tried works fine, why not switching to it...directly in the build system.
186 16 Denis 'GNUtoo' Carikli
Here's the diff between A working RIL and a non-working RIL for the htcdream:
187
{{{
188
android_device_htc_dream_sapphire$ git diff 5593d2899203ec378c306701788f1c43af9a6935 -- full_dream_sapphire.mk
189
diff --git a/full_dream_sapphire.mk b/full_dream_sapphire.mk
190
index 9ec7feb..eb1b956 100644
191
--- a/full_dream_sapphire.mk
192
+++ b/full_dream_sapphire.mk
193
@@ -40,7 +40,8 @@ PRODUCT_PROPERTY_OVERRIDES := \
194
     ro.media.dec.jpeg.memcap=10000000
195
 
196
 PRODUCT_PROPERTY_OVERRIDES += \
197
-    rild.libpath=/system/lib/libhtc_ril.so \
198
+    rild.libpath=/system/lib/libreference-ril.so \
199
+    rild.libargs=-d/dev/smd0 \
200
     wifi.interface=tiwlan0
201 17 Denis 'GNUtoo' Carikli
 
202
 # Time between scans in seconds. Keep it high to minimize battery drain.
203
204
}}}
205
Note that full_dream_sapphire.mk is located here:
206
{{{
207 18 Denis 'GNUtoo' Carikli
device/htc/dream_sapphire/full_dream_sapphire.mk
208
}}}
209
The diff is self-explanatory and how to do the change is left as an exercise to the reader.
210 32 Michael Haas -
211 18 Denis 'GNUtoo' Carikli
In case the RIL need to be modified the sources are in :
212 19 Denis 'GNUtoo' Carikli
{{{
213
hardware/ril/reference-ril
214
}}}
215 21 Denis 'GNUtoo' Carikli
They are written in C.
216 19 Denis 'GNUtoo' Carikli
217 64 Paul Kocialkowski
==== HTC Generic RIL ====
218
219
Another RIL has been written for MSM devices originally running Windows Mobile and is used on the Replicant project as it works better than the Android reference RIL on most devices.
220
 * It's originally hosted at: [https://gitorious.org/xdandroid/hardware_xdandroid-ril https://gitorious.org/xdandroid/hardware_xdandroid-ril]
221
 * We made a copy of this with some modifications there: [https://gitorious.org/replicant/hardware_xdandroid-ril https://gitorious.org/replicant/hardware_xdandroid-ril]
222
223 65 Paul Kocialkowski
This ril should be built automatically with MSM and QSD devices but if it's not the case, add a test that matches your device and set {{{ BUILD_HTCGENERIC_RIL := true }}} on:[[BR]]
224 64 Paul Kocialkowski
'''hardware/ril/libhtcgeneric-ril/Android.mk''' :
225
{{{
226
BUILD_HTCGENERIC_RIL := false
227
228
ifeq ($(TARGET_BOARD_PLATFORM),qsd8k)
229
  BUILD_HTCGENERIC_RIL := true
230
else ifeq ($(TARGET_BOARD_PLATFORM),msm7x30)
231
  BUILD_HTCGENERIC_RIL := true
232
else ifeq ($(TARGET_BOARD_PLATFORM),msm7k)
233
  BUILD_HTCGENERIC_RIL := true
234
endif
235
}}}
236
237
Then, on your device configuration, switch:[[BR]]
238
{{{ rild.libpath=/system/lib/libreference-ril.so }}}
239
240
to:[[BR]]
241
{{{ rild.libpath=/system/lib/libhtcgeneric-ril.so }}}
242 32 Michael Haas -
=== Audio libraries ===
243
On the HTC dream the audio libraries were modified.
244 40 Denis 'GNUtoo' Carikli
If your device is an msm7k "CPU" (in reality it's called a SOC, or system on a chip), it already contain [http://gitorious.org/replicant/android_hardware_msm7k/commit/e0b55a19b2fc004915503ebdfd7c4c02c4264611 the routing fix].
245
Note several things on [http://gitorious.org/replicant/android_hardware_msm7k/commit/e0b55a19b2fc004915503ebdfd7c4c02c4264611 the commit]:
246 22 Denis 'GNUtoo' Carikli
 * the routing was disabled, I had to re-enable it
247 28 Denis 'GNUtoo' Carikli
 * I had to replace some non-existant functions, for that I used public playwav2.c source code that the author released to us under the apache 2.0 license.
248
 * I had nearly no knowledge of C++
249 32 Michael Haas -
 * it was easy
250 28 Denis 'GNUtoo' Carikli
251 41 Denis 'GNUtoo' Carikli
On the nexus one the proprietary libacoustic libraries are only used for bluetooth(all the rest works if you pushed the firmwares).
252
253 58 Paul Kocialkowski
On the dream (msm7k), libacoustic has been fully replaced, see [http://gitorious.org/replicant/android_hardware_msm7k/commit/c650b45892aa8be87f3e88ee6eae5df053a0a047]: it loads the values from the /system/etc/AudioPara4.csv CSV file to MSM shared memory, which fixes in-call volume regulation and adds support for No Mic Wired Headset. It should also add support for other other things (probably including bluetooth devices) but this has not been tested yet. 
254 56 Paul Kocialkowski
The existing replacement code (hardware/msm7k/libaudio/AudioAcoustic.cpp) should work for your msm7k device but it has only been tested on the Dream. 
255 1 Denis 'GNUtoo' Carikli
256 61 Paul Kocialkowski
'''Note that (even if unconfirmed) it should more likely work the same way for every msm7k device, so try the code without any modification first and do the following steps only if the code does not work for your msm7k device! '''
257 60 Paul Kocialkowski
258 59 Paul Kocialkowski
If it does not work, check that your device contains the /system/etc/AudioPara4.csv CSV file. If it does not, the file may have another name, then you should modify replicant code to use the filename of your device and test if it works.
259 1 Denis 'GNUtoo' Carikli
260 59 Paul Kocialkowski
If you don't see any CSV file anywhere, then your device must not work like HTC Dream and you'll probably have to write the code to support acoustic or find another working replacement. You can read jbruneaux's work on audio acoustic for WinCE devices from {{{ git://gitorious.org/~jbruneaux/xdandroid/hardware_msm7k_libacoustic.git }}} (userland) and {{{ git://gitorious.org/linux-on-qualcomm-s-msm/linux-msm-home-work.git }}} branch {{{ htc-msm-2.6.27-libacoustic }}} (kernel-space). Note that audio acoustic is not absolutely necessary to make audio work, it'll just cause some minor issues as written above. 
261
262 56 Paul Kocialkowski
To make sure it parses the CSV file, run adb logcat | grep Audio and find the following lines: 
263 1 Denis 'GNUtoo' Carikli
{{{
264 56 Paul Kocialkowski
D/AudioAcousticMSM72XX(  122): Successfully opened /system/etc/AudioPara4.csv
265
D/AudioAcousticMSM72XX(  122): CSV Header: Dream_TMU_20090305
266
D/AudioAcousticMSM72XX(  122): Read:
267
D/AudioAcousticMSM72XX(  122): 24 Audio_Path_Table entries
268
D/AudioAcousticMSM72XX(  122): 24 Audio_Path_Uplink_Table entries
269
D/AudioAcousticMSM72XX(  122): 35 Phone_Acoustic_Table entries
270
D/AudioAcousticMSM72XX(  122): 35 BT_Phone_Acoustic_Table entries
271
D/AudioAcousticMSM72XX(  122): 24 HTC_VOC_CAL_CODEC_TABLE_Table entries
272
D/AudioAcousticMSM72XX(  122): 0 CE_Acoustic_Table entries
273 1 Denis 'GNUtoo' Carikli
}}}
274 56 Paul Kocialkowski
Then, if it parses the file but does not work, it's probably because the addresses (or the size) where the tables must be written in MSM shared memory are not the same for the Dream and for your device. 
275
In order to find the correct addresses, you'll have to use CyanogenMod code with the non-free libhtc_acoustic.so lib that you can get from CyanogenMod downloadable zip for your device.
276
move the hardware/msm7k/ directory to another place '''not in the build tree''' or it'll fail ({{{ mv hardware/msm7k/ ../msm7k }}}.
277
Then download CyanogenMod code:
278
{{{ git clone git://github.com/CyanogenMod/android_hardware_msm7k.git -b froyo-stable hardware/msm7k/ }}}
279
Now you need to modify the kernel-side driver to print some useful infos on file kernel-msm/arch/arm/mach-msm/htc_acoustic.c, function acoustic_mmap(), add the following code:
280
{{{
281
D(" -- vma dump start --\n");
282
283
D("vm_start=%x (%d)\n", vma->vm_start, vma->vm_start);
284
D("vm_end=%x (%d)\n", vma->vm_end, vma->vm_end);
285
D("vm_page_prot=%x (%d)\n", vma->vm_page_prot,vma->vm_page_prot);
286
D("vm_flags=%x (%d)\n", vma->vm_flags, vma->vm_flags);
287
D("vm_pgoff=%x (%d)\n", vma->vm_pgoff, vma->vm_pgoff);
288
289
D(" -- vma dump end --\n");
290
}}}
291
292
Then build the code (make -j9 bootimage && make-j9 systemimage), and flash system.img and boot.img to your device, boot it, copy the libhtc_acoustic.so lib to /system/lib/ (you need to remount /system using {{{ adb remount }}} to write under /system) and check the kernel logs with {{{ adb shell dmesg | grep acoustic }}}. You should see something like:
293
{{{
294
<6>[   22.250274] htc-acoustic: open
295
<6>[   22.252716] htc-acoustic: mmap
296
<6>[   22.253265] htc-acoustic:  -- vma dump start --
297
<6>[   22.254028] htc-acoustic: vm_start=4010c000 (1074839552)
298
<6>[   22.254699] htc-acoustic: vm_end=40119000 (1074892800)
299
<6>[   22.255310] htc-acoustic: vm_page_prot=38f (911)
300
<6>[   22.256011] htc-acoustic: vm_flags=400844ff (1074283775)
301
<6>[   22.256622] htc-acoustic: vm_pgoff=1f4a (8010)
302
<6>[   22.257293] htc-acoustic:  -- vma dump end --
303
<6>[   22.742675] htc-acoustic: ioctl
304
<6>[   22.743103] htc-acoustic: ioctl: ACOUSTIC_ARM11_DONE called 123.
305
<6>[   22.746612] htc-acoustic: ioctl: ONCRPC_ACOUSTIC_INIT_PROC success.
306
<6>[   22.747344] htc-acoustic: release
307
}}}
308
309 61 Paul Kocialkowski
Now you can get the size of the dedicated memory area: vm_end - vm_start = 0x40119000 - 0x4010c000 = '''0xd000'''.
310 56 Paul Kocialkowski
Then, you'll have to dump the entire memory to a file that you need to create: {{{ adb shell touch /data/dump }}}. Add a function to AudioHardware.cpp :
311
{{{
312
void acoustic_mmap_dump(void)
313
{
314
	uint8_t *test_map_base;
315
	uint8_t *ptr, nval;
316
	int fd, fdd=0;
317
	off_t TargetAddr;
318
	int len;
319
320
	fd = open("/dev/htc-acoustic", O_RDWR | O_SYNC);
321
	fdd = open("/data/dump", O_RDWR | O_TRUNC | O_CREAT);
322
323
	test_map_base = (uint8_t *)
324
	    mmap(0, 0xd000, PROT_READ | PROT_WRITE, MAP_SHARED, fd,
325
		 0);
326
//	test_virt_base = test_map_base + (TargetAddr & MAP_MASK);
327
//	LOGD("virtual base at %p (phys=0x%X)\n", test_virt_base, TargetAddr);
328
329
	LOGD(" -- htc-acoustic memory read -- \n");
330
	LOGD("beginning adress is@%p\n", test_map_base);
331
          for (len = 0; len < 0xd000; len++)
332
		{
333
			if( write(fdd, test_map_base, sizeof(uint8_t) ) < 0)
334
			{
335
				LOGE("write failed");
336
				break;
337
			}
338
			//LOGD("0x%x (%d) @%p",  *(test_map_base), *(test_map_base), test_map_base);
339
		  test_map_base++;
340
		}
341
342
343
	munmap(test_map_base, 0xd000);
344
	close(fdd);
345
	close(fd);
346 1 Denis 'GNUtoo' Carikli
}
347
}}}
348
replace 0xd000 by the size you found out and call it after {{{ int rc = set_acoustic_parameters(); }}} on the AudioHardware::AudioHardware() function.
349 58 Paul Kocialkowski
Build the code (make -j9 systemimage), flash system.img to your device and get /data/dump: {{{ adb pull /data/dump }}}. This should copy dump to your current directory. You can try to load that file in MSM shared memory at the exact place where you dumped it. To do that, add the following functions to AudioHardware.cpp (don't forget to replace the size, 0xd000 if it's different for your device):
350
{{{
351
#define ACOUSTIC_IOCTL_MAGIC 'p'
352
#define ACOUSTIC_NOTICE		_IOW(ACOUSTIC_IOCTL_MAGIC, 42, unsigned int)
353
#define ACOUSTIC_ARM11_DONE	_IOW(ACOUSTIC_IOCTL_MAGIC, 22, unsigned int)
354
355
void acoustic_mmap(void)
356
{
357
	char *test_map_base;
358
	volatile int *ptr, nval;
359
	int fd, fdd;
360
	off_t TargetAddr;
361
	int len;
362
363
	fd = open("/dev/htc-acoustic", O_RDWR | O_SYNC);
364
	fdd = open("/data/dump", O_RDWR);
365
366
	test_map_base = (char *)
367
	    mmap(0, 0xd000, PROT_READ | PROT_WRITE, MAP_SHARED, fd,
368
		 0);
369
//	test_virt_base = test_map_base + (TargetAddr & MAP_MASK);
370
//	LOGD("virtual base at %p (phys=0x%X)\n", test_virt_base, TargetAddr);
371
372
	LOGD(" -- htc-acoustic memory write -- \n");
373
          for (len = 0; len < 0xd000; len++)
374
		{
375
		  read(fdd, test_map_base, sizeof(char) );
376
		  test_map_base++;
377
		}
378
379
380
	munmap(test_map_base, 0xd000);
381
	close(fdd);
382
	close(fd);
383
}
384
385
void acoustic_done(void)
386
{
387
     int fd;
388
	       fd = open("/dev/htc-acoustic",O_RDWR);
389
390
               if (fd < 0) {
391
	            LOGE("Cannot open htc-acoustic device");
392
	            close(fd);
393
	            return;
394
               }
395
396
       ioctl(fd,ACOUSTIC_ARM11_DONE, NULL);
397
       close(fd);
398
}
399
}}}
400
Now replace:
401
{{{
402
    set_acoustic_parameters = (int (*)(void))::dlsym(acoustic, "set_acoustic_parameters");
403
    if ((*set_acoustic_parameters) == 0 ) {
404
        LOGE("Could not open set_acoustic_parameters()");
405
        return;
406
    }
407
408
    int rc = set_acoustic_parameters();
409
    if (rc < 0) {
410
        LOGE("Could not set acoustic parameters to share memory: %d", rc);
411
//        return;
412
    }
413
}}}
414
with:
415
{{{
416
acoustic_mmap();
417
acoustic_done();
418
}}}
419
420 1 Denis 'GNUtoo' Carikli
Build system.img: {{{ make -j9 systemimage }}} and flash it to your device. Now '''audioacoustic should work''' but it's not a clean way to make it work: the clean way is to parse the CSV file and load it to MSM shared memory with free code. If it does not work, then your device is definitely not working like the Dream and you'll have to find another way to make it work. 
421 59 Paul Kocialkowski
422
Replace the hardware/msm7k/ folder by the replicant one. The next step is to find the right addresses to write the tables in MSM shared memory. To find this out, you have to read the dump and understand where each table begins. So first, you have to hexdump the dump:
423
{{{ hexdump -C dump > dump.txt }}}. This will create dump.txt, containing the hexedacimal values of dump as text. So now you should be able to understand where each table begins. As an example, here's how it was done with the dream values: consider the following as the beginning of the dump.txt file: 
424
{{{
425
00000000  35 71 36 61 37 00 38 00  39 03 3a 00 3b 00 3c 00  |5q6a7.8.9.:.;.<.|
426
00000010  3d 00 3e 00 3f 00 40 00  41 1c 42 00 43 00 44 00  |=.>.?.@.A.B.C.D.|
427
00000020  45 00 46 00 47 00 48 00  49 00 4a 01 4b 00 4c 00  |E.F.G.H.I.J.K.L.|
428
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
429
*
430
00000080  35 71 36 61 37 00 38 00  39 03 3a 00 3b 00 3c 00  |5q6a7.8.9.:.;.<.|
431
00000090  3d 00 3e 00 3f 00 40 00  41 1c 42 00 43 00 44 00  |=.>.?.@.A.B.C.D.|
432
000000a0  45 00 46 00 47 00 48 00  49 00 4a 01 4b 00 4c 00  |E.F.G.H.I.J.K.L.|
433
000000b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
434
}}}
435
it's the 2 first elements of the table we want to find the address (which will be 00000000, the beginning of the table). Now read AudioPara4.csv. On the dream, you can read:
436
{{{
437
A0,HTC_VOC_CODEC_EARCUPLE_VOICE,35,71,36,61,37,0,38,0,39,3,3A,0,3B,0,3C,0,3D,0,3E,0,3F,0,40,0,41,1C,42,0,43,0,44,0,45,0,46,0,47,0,48,0,49,0,4A,1,4B,0,4C,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
438
A1,HTC_VOC_CODEC_EARCUPLE_MIDI,35,71,36,61,37,0,38,0,39,3,3A,0,3B,0,3C,0,3D,0,3E,0,3F,0,40,0,41,1C,42,0,43,0,44,0,45,0,46,0,47,0,48,0,49,0,4A,1,4B,0,4C,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
439
}}}
440
you can see that {{{35 71 36 61 37 00 38 00  39 03 3a 00 3b 00 3c 00}} is the same as {{{ 35,71,36,61,37,0,38,0,39,3,3A,0,3B,0,3C,0 }}}, so {{{35 71 36 61 37 00 38 00  39 03 3a 00 3b 00 3c 00}} is the beginning of the first element of table A. So table A starts at 0. 
441
442
Now if you read the ParseAudioParaLine function from AudioAcoustic.cpp (on the already existing free audio acoustic code), you can see:
443
{{{
444
        case 'A':
445
[…]
446
            while ( (token = strtok(NULL, ",")) ) {
447
                Audio_Path_Table[table_num].array[field_count++] = strtol(token, &ps, 16);
448
            };
449
            break;
450
}}}
451
452
So "A" is for the Audio_Path_Table table. 
453
Now you have to do the same work for every table. You can see that another tables begins when the table-specific characters change e.g.:
454
{{{
455
00001780  35 00 36 00 37 ff 38 00  39 00 3a 00 3b 00 3c c4  |5.6.7.8.9.:.;.<.|
456
00001790  3d c4 3e 08 3f 80 40 05  41 00 42 00 43 00 44 00  |=.>.?.@.A.B.C.D.|
457
000017a0  45 00 46 00 47 00 48 00  49 00 4a 00 4b 00 4c 00  |E.F.G.H.I.J.K.L.|
458
000017b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
459
*
460
00001800  00 00 00 40 13 20 00 00  b2 7f fd 23 00 00 33 2d  |...@. .....#..3-|
461
00001810  00 00 80 0c 9a ff 80 1d  33 f3 ec 01 ee ff 0a 20  |........3...... |
462
00001820  65 7f 00 00 00 ed 00 00  00 00 d9 3f 00 00 80 0c  |e..........?....|
463
00001830  9a ff 0c 1b 33 f3 ec 01  ee ff 0a 20 65 7f ff 7f  |....3...... e...|
464
00001840  00 08 ff 7f 9f 14 00 00  14 00 00 08 00 20 00 20  |............. . |
465
00001850  fa 00 46 00 02 00 ff 02  40 00 20 00 50 46 40 00  |..F.....@. .PF@.|
466
00001860  a0 41 00 08 63 00 ff 4d  ff 4d 02 00 00 3f d0 07  |.A..c..M.M...?..|
467
00001870  00 00 00 00 00 01 00 01  00 02 50 00 00 03 50 01  |..........P...P.|
468
00001880  64 00 a8 1c c2 01 e0 2e  a0 0f ff ff 00 00 00 00  |d...............|
469
00001890  00 00 00 00 00 00 00 00  00 40 00 00 00 00 00 00  |.........@......|
470
000018a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
471
}}}
472
473
You can see that a new table begins at 0x1800.
474
Note that some tables may not start at easy-to-find addresses such as 0x1800 but may start at in the middle of an hexdump line (so it makes the task even harder).
475
476
When you have found all the correct addresses for every table in your CSV file, you should check that your tables have the same size than the tables you got from the dump. If it's not, adjust the tables defined in AudioAcoustic.h and the tables defined at the top of AudioAcoustic.cpp. 
477
When all that stuff is ok, it's possible that there is a necessary footer to make it work. On the Dream, it is:
478
{{{
479
0000c8e0  78 56 34 12 00 00 00 00  00 00 00 00 00 00 00 00  |xV4.............|
480
}}}
481
(present at the end of the dump file).
482
483
Now that you found out the size of the memory map, the address of each table, adjusted the size of the tables and found the footer, it's time to put the remaining infos on the free code.
484
Modify with the values you found out, on the file hardware/msm7k/libaudio/AudioAcoustic.cpp:
485
{{{
486
static int mmap_size = 0xd000;
487
static int mmap_address_audio_path_table = 0x0;
488
static int mmap_address_audio_path_uplink_table = 0xc00;
489
static int mmap_address_phone_acoustic_table = 0x1800;
490
static int mmap_address_bt_phone_acoustic_table = 0x4a00;
491
static int mmap_address_htc_voc_cal_codec_table_table = 0xc700;
492
static int mmap_address_htc_acoustic_end = 0xc8e0;
493
}}}
494
and adapt the array sizes both on the top of AudioAcoustic.cpp and AudioAcoustic.h (if you didn't do it already).
495
496
Then build an image (make -j9 systemimage) and it should work. If it does not, please check that you successfully passed all the required steps. 
497
But the fact is that you replaced Dream values with the correct values for your device, so it will break audio acoustic for Dream.
498
The solution would be to write a set_device_configuration() which selects the good values for the device we build replciant for and the appropriated tables. 
499
Nothing like that has been written yet since replicant AudioAcoustic hasn't been ported to any other device yet. Please notify replicant developers to write such a function (or do it yourself) before you send the code.
500 56 Paul Kocialkowski
501 42 Denis 'GNUtoo' Carikli
=== GPS ===
502
Two GPS libraries exist:
503
 * libgps
504
 * libloc_api
505 43 Denis 'GNUtoo' Carikli
Both provide the same functionalities at the application level.
506 1 Denis 'GNUtoo' Carikli
Choose the one that is supported by your device or that has support for a device close to your device.
507 43 Denis 'GNUtoo' Carikli
==== libgps ====
508
For adding support to libgps you need to enable it like in [http://gitorious.org/replicant/android_device_htc_dream_sapphire/commit/153ab7e8fcf6bfc294b200d60a6f01feb5bb571a this commit]:
509
add the following(or modify if it's already there but holds another value) in device/htc/dream_sapphire/BoardConfig.mk (replace dream_saphire by your device code) :
510
{{{
511
BOARD_HAVE_GPS_HARDWARE := true
512
BOARD_GPS_LIBRARIES := libhardware
513 1 Denis 'GNUtoo' Carikli
}}}
514 43 Denis 'GNUtoo' Carikli
I'm not sure if the "BOARD_HAVE_GPS_HARDWARE := true" is really needed.
515
516
If your device is different from the htc dream you may have to modify the GPS library code to match your device,
517
Here's the adaptation made for the htc dream:
518
{{{
519
hardware/libhardware_legacy/gps$ diff -u ../../../../repos_external/phh_libhardware_legacy/gps/gps-rpc.c ./gps-rpc.c 
520
--- ../../../../repos_external/phh_libhardware_legacy/gps/gps-rpc.c	2010-08-15 11:35:03.210095153 +0200
521
+++ ./gps-rpc.c	2011-01-06 16:46:45.417685002 +0100
522
@@ -464,8 +464,8 @@
523
 }
524
 
525
 int init_gps6125() {
526
-	struct CLIENT *clnt=clnt_create(NULL, 0x3000005B, 0, NULL);
527
-	struct CLIENT *clnt_atl=clnt_create(NULL, 0x3000001D, 0, NULL);
528
+	struct CLIENT *clnt=clnt_create(NULL, 0x3000005B, 0x90380d3d, NULL);
529
+	struct CLIENT *clnt_atl=clnt_create(NULL, 0x3000001D, 0x51c92bd8, NULL);
530
 	int i;
531
 	_clnt=clnt;
532
 	SVCXPRT *svc=svcrtr_create();
533
@@ -538,33 +538,21 @@
534
 
535
 
536
 int init_gps_rpc() {
537
-	int fd=open("/sys/class/htc_hw/amss", O_RDONLY);
538
-	char buf[32];
539
-	bzero(buf, 32);
540
-	read(fd, buf, 32);
541
-	if(strncmp(buf, "6125", 4)==0)
542
-		amss=A6125;
543
-	else if((strncmp(buf, "5225", 4)==0) || (strncmp(buf, "6150", 4)==0))
544
-		amss=A5225;
545
-	else
546
-		amss=A6125; //Fallback to 6125 ATM
547
-	if(amss==A6125)
548
-		init_gps6125();
549
-	else if(amss==A5225)
550
-		init_gps5225();
551
+	amss=A6125;
552
+	init_gps6125();
553
 	return 0;
554
 }
555
 
556
 void gps_get_position() {
557
 	int i;
558
-	for(i=5;i;--i) if(!can_send) sleep(1);//Time out of 5 seconds on can_send
559
+	for(i=3;i;--i) if(!can_send) sleep(1);//Time out of 5 seconds on can_send
560
 	can_send=0;
561
 	pdsm_get_position(_clnt, 0, 0, 1, 1, 1, 0x3B9AC9FF, 1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,1,32,2,client_IDs[2]);
562
 }
563
 
564
 void exit_gps_rpc() {
565
-	if(amss==A6125)
566
-		pdsm_client_end_session(_clnt, 0, 2);
567
+	//if(amss==A6125)
568
+	//	pdsm_client_end_session(_clnt, 0, 2);
569
 	//5225 doesn't seem to like end_session ?
570
 	//Bah it ends session on itself after 10seconds.
571 1 Denis 'GNUtoo' Carikli
 }
572 44 Denis 'GNUtoo' Carikli
}}}
573
574
so let's go step by steps on that diff:
575
First we see that:
576
{{{
577
+	struct CLIENT *clnt=clnt_create(NULL, 0x3000005B, 0x90380d3d, NULL);
578
+	struct CLIENT *clnt_atl=clnt_create(NULL, 0x3000001D, 0x51c92bd8, NULL);
579
}}}
580
This corresponds to some devices nodes:
581
{{{
582
# ls -l /dev/oncrpc
583
crw-rw----    1 radio    system    253,   0 Jan  6 16:43 00000000:0
584
crw-rw----    1 radio    system    253,  11 Jan  6 16:43 30000000:5a10cf88
585
crw-rw----    1 radio    system    253,   9 Jan  6 16:43 30000002:aa2b1a44
586
crw-rw----    1 radio    system    253,   4 Jan  6 16:43 30000003:94103dec
587
crw-rw----    1 radio    system    253,  30 Jan  6 16:43 3000000a:71d1094b
588
crw-rw----    1 radio    system    253,  28 Jan  6 16:43 3000000e:2bf06595
589
crw-rw----    1 radio    system    253,  26 Jan  6 16:43 3000000f:46d257e5
590
crw-rw----    1 radio    system    253,  23 Jan  6 16:43 30000013:e94e8f0c
591
crw-rw----    1 radio    system    253,  22 Jan  6 16:43 30000014:7cfcd2c6
592
crw-rw----    1 radio    system    253,  21 Jan  6 16:43 30000016:c713bd79
593
crw-rw----    1 radio    system    253,  19 Jan  6 16:43 30000019:acb4a896
594
crw-rw----    1 radio    system    253,  18 Jan  6 16:43 3000001b:97d7b24a
595
crw-rw----    1 radio    system    253,  12 Jan  6 16:43 3000001d:51c92bd8
596
crw-rw----    1 radio    system    253,   8 Jan  6 16:43 30000021:f330a24e
597
crw-rw----    1 radio    system    253,  14 Jan  6 16:43 3000003c:03d4377c
598
crw-rw----    1 radio    system    253,  29 Jan  6 16:43 30000048:0da5b528
599
crw-rw----    1 radio    system    253,  17 Jan  6 16:43 30000059:00000000
600
crw-rw----    1 radio    system    253,  16 Jan  6 16:43 3000005a:00000000
601
crw-rw----    1 radio    system    253,  13 Jan  6 16:43 3000005b:90380d3d
602
crw-rw----    1 radio    system    253,   7 Jan  6 16:43 3000005f:95d1d9f5
603
crw-rw----    1 radio    system    253,   5 Jan  6 16:43 30000060:bcfb5d63
604
crw-rw----    1 radio    system    253,   2 Jan  6 16:43 30000061:fb837d0b
605
crw-rw----    1 radio    system    253,  31 Jan  6 16:43 30000066:1f4b343e
606
crw-rw----    1 radio    system    253,  27 Jan  6 16:43 3000006b:0aabc7a4
607
crw-rw----    1 radio    system    253,  25 Jan  6 16:43 3000006c:00000000
608
crw-rw----    1 radio    system    253,  20 Jan  6 16:43 30000075:f708938d
609
crw-rw----    1 radio    system    253,  15 Jan  6 16:43 30000079:00000000
610
crw-rw----    1 radio    system    253,   1 Jan  6 16:43 30000081:ccc5b439
611
crw-rw----    1 radio    system    253,  24 Jan  6 16:43 3000fe00:00000000
612
crw-rw----    1 radio    system    253,  10 Jan  6 16:43 3000fffe:00000000
613
crw-rw----    1 radio    system    253,   6 Jan  6 16:43 30100001:00000000
614
crw-rw----    1 radio    system    253,   3 Jan  6 16:43 30100002:00000000
615
}}}
616
Theses 2 lines should ring a bell:
617
{{{
618
crw-rw----    1 radio    system    253,  13 Jan  6 16:43 3000005b:90380d3d
619 1 Denis 'GNUtoo' Carikli
crw-rw----    1 radio    system    253,  12 Jan  6 16:43 3000001d:51c92bd8
620 45 Denis 'GNUtoo' Carikli
}}}
621
622
Next there is that line:
623
{{{
624
+	for(i=3;i;--i) if(!can_send) sleep(1);//Time out of 5 seconds on can_send
625 1 Denis 'GNUtoo' Carikli
}}}
626 45 Denis 'GNUtoo' Carikli
This is the time between 2 requests, if you put it too low it can reboot your phone(it will crashes and reboot)
627
628 47 Denis 'GNUtoo' Carikli
629
==== libloc_api ====
630 49 Denis 'GNUtoo' Carikli
For adding support for libloc_api you need to modify the BOARD_GPS_LIBRARIES variable
631 45 Denis 'GNUtoo' Carikli
632 50 Denis 'GNUtoo' Carikli
[https://github.com/CyanogenMod/android_hardware_qcom_gps That repository] should have newer devices support(like in AOSP) and older too(like rmcc's commits)
633
634
==== testing ====
635
{{{
636
cd hardware/libhardware_legacy/tests/gpstest/
637
mm
638 45 Denis 'GNUtoo' Carikli
}}}
639 43 Denis 'GNUtoo' Carikli
gives you a gpstest binary, copy it to the device and run it, it'll tell you if it has a fix
640 1 Denis 'GNUtoo' Carikli
==== Note on the GPS ====
641 45 Denis 'GNUtoo' Carikli
Note that messing with GPS can reboot(that is to say your phone crashes and reboots because of that) your phone on certain devices(like the htc dream or the nexus one).
642
643
The GPS is attached to the modem on the htc dream and the nexus one.
644
The only way to request a fix or to activate it is trough a rpc mecanism that is between the modem and the CPU that runs Android.
645
That RPC mecanism uses shared memory between the modem and the CPU that runs Android.
646
647
On the htcdream and the nexusone a serial line is emulated on top of the RPC mecanism: the serial lines can be accesed at /dev/smd0 for the modem(AT commands) and /dev/smd27 for the GPS NMEA.
648 46 Denis 'GNUtoo' Carikli
So compatibility with applications that understand NMEA is garanteed.
649 42 Denis 'GNUtoo' Carikli
650 51 Denis 'GNUtoo' Carikli
Note that the GPS parsing library doesn't require to use NMEA, it could also uses the RPC directly(to be verified)
651
652
=== Sensors ===
653
Devices with an hardware keyboard slide can rotate with the slide of the keyboard, so accelerometers are not strictly necessary. Examples of such device include the HTC dream.
654
Other devices lack that hardware keyboard, and so the only way to rotate is trough theses accelerometers. Examples of such device include the nexus one.
655
656 52 Denis 'GNUtoo' Carikli
The nexusone has akmd.free which is the free implementation of akmd, the sensor daemon(which handle rotation)
657 51 Denis 'GNUtoo' Carikli
658
==== akmd.free ====
659
akmd.free is located in:
660
{{{
661 1 Denis 'GNUtoo' Carikli
hardware/akmd_free
662 52 Denis 'GNUtoo' Carikli
}}}
663 51 Denis 'GNUtoo' Carikli
it has currently(at the time of writing) support for akm8973+bma150 based sensors.
664
akmd.free was made specifically for the htc hero by its authors.
665
The device supported include the nexus one(tested) and the HTC hero(not tested,not activated).
666
667 1 Denis 'GNUtoo' Carikli
In order to activate the support for it you must add that in your BoardConfig.mk
668 52 Denis 'GNUtoo' Carikli
{{{
669
BUILD_AKMD := true
670
}}}
671
672
If you need to add support for other akm sensors  you could modify hardware/akmd_free/jni/Android.mk, for instance the nexusone had an issue with rotation beeing done in the reverse sense, so I did that:
673
{{{
674
+#ifdef TARGET_DEVICE_NEXUSONE
675
+    abuf[index] = Vector(-bma150_data[0], -bma150_data[1], bma150_data[2]);
676
+#else
677
     abuf[index] = Vector(bma150_data[0], -bma150_data[1], bma150_data[2]);
678
+#endif
679
}}}
680
And that:
681
{{{
682
ifeq ($(TARGET_DEVICE),passion)
683 51 Denis 'GNUtoo' Carikli
  LOCAL_CFLAGS += -DTARGET_DEVICE_NEXUSONE
684 32 Michael Haas -
endif
685
}}}
686 63 Paul Kocialkowski
687
=== Slowness issues ===
688
689
If the device is too slow without non-free libs, there can still be some workarounds:
690
 * Adding debug.sf.hw=0 in the proprieties: in a makefile on the device files, add:
691
{{{ PRODUCT_PROPERTY_OVERRIDES += debug.sf.hw=0 }}}
692
 * Use a patched gralloc: the [https://www.codeaurora.org/gitweb/quic/la/ Code Aurora] had a fix for a nasty Nexus One graphics bug on the {{{ froyo_almond }}} branch.
693
 * Use TARGET_LIBAGL_USE_GRALLOC_COPYBITS with libagl: if your device uses gralloc+copybits, you can try a fix that improved the speed on Nexus One: in a makefile on the device files, add:
694
{{{  TARGET_LIBAGL_USE_GRALLOC_COPYBITS := true }}}
695
696
The commits with these fixes for Nexus One are:
697
 * https://gitorious.org/replicant/android_device_htc_passion/commit/86aeb1822a90b71e2cbb1af71200e759d98f4993
698
 * https://gitorious.org/replicant/android_hardware_msm7k/commit/d2d79391f10789ed9d2f5dd818aac3b23c48d69e
699
700 28 Denis 'GNUtoo' Carikli
== Re-using source code ==
701
The previous source code re-used some public source code that was licensed under the Apache 2.0 license.
702 22 Denis 'GNUtoo' Carikli
The ril will also re-use some public source code licensed under Apache 2.0.
703
That is the advised way to do it as it save some time and is easier to do, however proper credit must be attributed, at least in the commit message.
704 23 Denis 'GNUtoo' Carikli
It is even advised to look at the public apache 2.0 source code of other rils libraries or components of android.
705
706
=== Ril ===
707
 * vilvord ril
708
 * openmoko (android on freerunner) ril
709
710
== Source organization and commit access ==
711
Until now we made some changes in the tree, but we want the changes to land upstream in replicant.
712 24 Denis 'GNUtoo' Carikli
For instance let's say we modified only the ril path like in the ril section in 
713
{{{
714
device/htc/dream_sapphire/full_dream_sapphire.mk 
715
}}}
716
first we save our modifications:
717
{{{
718
cd device/htc/dream_sapphire/
719
git diff > git_diff.patch
720 1 Denis 'GNUtoo' Carikli
}}}
721
then we find where is the root of the git repository we are in:
722 24 Denis 'GNUtoo' Carikli
{{{
723
cd replicant-2.2 #top replicant directory where everything is in
724
cd .repo
725
cat manifest.xml
726
}}}
727
and we find that:
728
{{{
729
  <project path="device/htc/buzz" name="CyanogenMod/android_device_htc_buzz" remote="github" />
730
}}}
731
so...now our repository is in device/htc/buzz
732
We will now look where the source repository is:
733
{{{
734
cd device/htc/buzz
735
cd .git
736
cat config
737
}}}
738
We find that:
739
{{{
740
	url = git://github.com/CyanogenMod/android_device_htc_buzz.git
741 25 Denis 'GNUtoo' Carikli
}}}
742
743
Then create a directory, not under the replicant-2.2 directory that will contain your repositories:
744
{{{
745
mkdir repo
746
cd repo
747
}}}
748
and clone the source:
749
{{{
750 26 Denis 'GNUtoo' Carikli
git clone git://github.com/CyanogenMod/android_device_htc_buzz.git
751
cd android_device_htc_buzz
752 27 Denis 'GNUtoo' Carikli
}}}
753 26 Denis 'GNUtoo' Carikli
apply the previous patch:
754
{{{
755
git apply path/to/git_diff.patch
756
}}}
757
commit locally the result:
758
{{{
759 32 Michael Haas -
git commit -s
760
}}}
761 1 Denis 'GNUtoo' Carikli
Note that the commit message should have the following format:
762 27 Denis 'GNUtoo' Carikli
The first line should be a summary
763
Followed by a linebreak
764
And then the details explaining the commit
765
If you made an error writing the commit message do
766
{{{
767 1 Denis 'GNUtoo' Carikli
git commit --amend
768
}}}
769
770
TODO: complete for sending the git patch(git format-patch -1,git send-email)
771
772
==== Pushing to replicant ====
773
TODO: git remote add+git push