DeprecatedPortingGuideMSMQSD » History » Version 46
Denis 'GNUtoo' Carikli, 01/06/2011 05:44 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 | 1 | Denis 'GNUtoo' Carikli | == Terminology == |
11 | 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. |
12 | 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. |
13 | 1 | Denis 'GNUtoo' Carikli | TODO: point to 0707 standard or newer |
14 | |||
15 | 31 | Denis 'GNUtoo' Carikli | == Help with source code == |
16 | 32 | Michael Haas - | Keep in mind that on most devices, the full source code of the kernel is released. |
17 | However, some userspace libraries, or dlopened libraries (libraries loaded at runtime after the application started) are proprietary software, |
||
18 | 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. |
19 | That can help a lot, and sometimes there is even some sort of documentation in the headers. |
||
20 | 1 | Denis 'GNUtoo' Carikli | |
21 | == Build the source == |
||
22 | |||
23 | The first thing to do is to download the replicant sources: |
||
24 | [wiki:BuildDream] can be used as a reference: download and build the sources for your device. |
||
25 | 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 |
26 | of the Wildfire. |
||
27 | 1 | Denis 'GNUtoo' Carikli | |
28 | 32 | Michael Haas - | You need to configure the build tree for our device. By default, a generic image |
29 | for the Android emulator will be built. |
||
30 | In [wiki:BuildDream], you would use the following command to set up the build: |
||
31 | 2 | Denis 'GNUtoo' Carikli | {{{ |
32 | lunch cyanogen_dream_sapphire-eng |
||
33 | }}} |
||
34 | 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. |
35 | In order to do that, run the following command and look at its output. |
||
36 | 2 | Denis 'GNUtoo' Carikli | {{{ |
37 | $ source build/envsetup.sh |
||
38 | including device/geeksphone/one/vendorsetup.sh |
||
39 | including device/htc/ace/vendorsetup.sh |
||
40 | including device/htc/bravoc/vendorsetup.sh |
||
41 | including device/htc/bravo/vendorsetup.sh |
||
42 | including device/htc/buzz/vendorsetup.sh |
||
43 | including device/htc/glacier/vendorsetup.sh |
||
44 | 1 | Denis 'GNUtoo' Carikli | including device/htc/heroc/vendorsetup.sh |
45 | including device/htc/inc/vendorsetup.sh |
||
46 | 2 | Denis 'GNUtoo' Carikli | including device/htc/legend/vendorsetup.sh |
47 | including device/htc/liberty/vendorsetup.sh |
||
48 | including device/htc/supersonic/vendorsetup.sh |
||
49 | including device/htc/vision/vendorsetup.sh |
||
50 | including device/motorola/sholes/vendorsetup.sh |
||
51 | including device/nvidia/harmony/vendorsetup.sh |
||
52 | including vendor/cyanogen/vendorsetup.sh |
||
53 | }}} |
||
54 | 37 | Denis 'GNUtoo' Carikli | The last line is important: |
55 | 1 | Denis 'GNUtoo' Carikli | {{{ |
56 | 37 | Denis 'GNUtoo' Carikli | $ cat vendor/cyanogen/vendorsetup.sh |
57 | add_lunch_combo cyanogen_ace-eng |
||
58 | add_lunch_combo cyanogen_bravo-eng |
||
59 | add_lunch_combo cyanogen_bravoc-eng |
||
60 | add_lunch_combo cyanogen_buzz-eng |
||
61 | add_lunch_combo cyanogen_dream_sapphire-eng |
||
62 | add_lunch_combo cyanogen_espresso-eng |
||
63 | add_lunch_combo cyanogen_glacier-eng |
||
64 | add_lunch_combo cyanogen_harmony-eng |
||
65 | add_lunch_combo cyanogen_hero-eng |
||
66 | add_lunch_combo cyanogen_heroc-eng |
||
67 | add_lunch_combo cyanogen_inc-eng |
||
68 | add_lunch_combo cyanogen_legend-eng |
||
69 | add_lunch_combo cyanogen_liberty-eng |
||
70 | add_lunch_combo cyanogen_one-eng |
||
71 | add_lunch_combo cyanogen_passion-eng |
||
72 | add_lunch_combo cyanogen_sholes-eng |
||
73 | add_lunch_combo cyanogen_supersonic-eng |
||
74 | add_lunch_combo cyanogen_vibrant-eng |
||
75 | add_lunch_combo cyanogen_vision-eng |
||
76 | add_lunch_combo cyanogen_z71-eng |
||
77 | 4 | Denis 'GNUtoo' Carikli | |
78 | 37 | Denis 'GNUtoo' Carikli | PATH=$PATH:$PWD/vendor/cyanogen/tools ; export PATH |
79 | 4 | Denis 'GNUtoo' Carikli | }}} |
80 | 37 | Denis 'GNUtoo' Carikli | The output include the list of supported (by cyanogenmod) devices. |
81 | For instance if you have the Wildfire (codename 'buzz') phone do: |
||
82 | 36 | Michael Haas - | {{{ |
83 | 1 | Denis 'GNUtoo' Carikli | lunch cyanogen_buzz-eng |
84 | 36 | Michael Haas - | }}} |
85 | |||
86 | 1 | Denis 'GNUtoo' Carikli | Then build the source, backup what's on your device, including the operating system, and flash the new replicant image. |
87 | 9 | Denis 'GNUtoo' Carikli | |
88 | Then test what works and what doesn't. |
||
89 | 1 | Denis 'GNUtoo' Carikli | |
90 | The images are located in |
||
91 | {{{ |
||
92 | out/target/product/dream_sapphire |
||
93 | 32 | Michael Haas - | }}} |
94 | 8 | Denis 'GNUtoo' Carikli | in the case of the HTC Dream. You need to look in the path that corresponds to your device. |
95 | 1 | Denis 'GNUtoo' Carikli | |
96 | == Trying free replacements == |
||
97 | 32 | Michael Haas - | |
98 | The source code you just built contains some free replacements for the proprietary |
||
99 | libraries shipped by your phone vendor with the default firmware. |
||
100 | |||
101 | 1 | Denis 'GNUtoo' Carikli | A list of proprietary libraries is available in |
102 | 10 | Denis 'GNUtoo' Carikli | {{{ |
103 | device/htc/dream_sapphire/extract-files.sh |
||
104 | 32 | Michael Haas - | }}} |
105 | 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 |
||
106 | 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). |
107 | 32 | Michael Haas - | |
108 | |||
109 | === RIL test === |
||
110 | I will take the example of how to use the free RIL (Radio Interface Library) to see if it works fine without modifications: |
||
111 | 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 |
112 | here's a part of extract-files.sh: |
||
113 | {{{ |
||
114 | adb pull /system/lib/libhtc_ril.so ../../../vendor/htc/$DEVICE/proprietary/libhtc_ril.so |
||
115 | 32 | Michael Haas - | }}} |
116 | 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 |
||
117 | 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). |
||
118 | |||
119 | 12 | Denis 'GNUtoo' Carikli | So looking at the above line the proprietary RIL is located here on the phone: |
120 | {{{ |
||
121 | /system/lib/libhtc_ril.so |
||
122 | 32 | Michael Haas - | }}} |
123 | 13 | Denis 'GNUtoo' Carikli | while the free ril is located here (known fact): |
124 | 14 | Denis 'GNUtoo' Carikli | {{{ |
125 | 1 | Denis 'GNUtoo' Carikli | /system/lib/libreference-ril.so |
126 | 32 | Michael Haas - | }}} |
127 | 13 | Denis 'GNUtoo' Carikli | In order to test the free RIL you could be tempted to do that: |
128 | 14 | Denis 'GNUtoo' Carikli | {{{ |
129 | 15 | Denis 'GNUtoo' Carikli | # ./adb remount |
130 | 14 | Denis 'GNUtoo' Carikli | # ./adb shell |
131 | 1 | Denis 'GNUtoo' Carikli | mv /system/lib/libreference-ril.so /system/lib/libhtc_ril.so |
132 | }}} |
||
133 | 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: |
||
134 | 14 | Denis 'GNUtoo' Carikli | {{{ |
135 | 1 | Denis 'GNUtoo' Carikli | # ./adb shell |
136 | # setprop |
||
137 | usage: setprop <key> <value> |
||
138 | 32 | Michael Haas - | }}} |
139 | 39 | Konstantinos Karantias - | What you can do to set the libre RIL is - possibly - this: |
140 | {{{ |
||
141 | ./adb shell |
||
142 | setprop rild.libpath /system/lib/libreference-ril.so |
||
143 | setprop rild.libargs -d/dev/smd0 |
||
144 | }}} |
||
145 | 13 | Denis 'GNUtoo' Carikli | Here's how it looks on a working replicant on the HTC Dream: |
146 | {{{ |
||
147 | # ./adb shell |
||
148 | # getprop | grep ril |
||
149 | [ro.ril.hsxpa]: [2] |
||
150 | [ro.ril.gprsclass]: [10] |
||
151 | 1 | Denis 'GNUtoo' Carikli | [rild.libpath]: [/system/lib/libreference-ril.so] |
152 | [rild.libargs]: [-d/dev/smd0] |
||
153 | 15 | Denis 'GNUtoo' Carikli | [init.svc.ril-daemon]: [running] |
154 | [ro.ril.def.agps.mode]: [2] |
||
155 | 32 | Michael Haas - | [gsm.version.ril-impl]: [android reference-ril 1.0] |
156 | 14 | Denis 'GNUtoo' Carikli | }}} |
157 | 12 | Denis 'GNUtoo' Carikli | * /dev/smd0 is the (emulated) serial port |
158 | * /system/lib/libreference-ril.so is where to look for the RIL hardware specific library |
||
159 | 1 | Denis 'GNUtoo' Carikli | |
160 | 39 | Konstantinos Karantias - | Then, you can kill the ril daemon: |
161 | 1 | Denis 'GNUtoo' Carikli | {{{ |
162 | 39 | Konstantinos Karantias - | ./adb shell killall rild |
163 | 1 | Denis 'GNUtoo' Carikli | }}} |
164 | 39 | Konstantinos Karantias - | Then try the reference RIL. You can see debugging things and such by doing: |
165 | {{{ |
||
166 | ./adb logcat -b radio |
||
167 | }}} |
||
168 | |||
169 | 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. |
||
170 | 32 | Michael Haas - | |
171 | 16 | Denis 'GNUtoo' Carikli | == Replacing proprietary libraries for real == |
172 | 32 | Michael Haas - | |
173 | On the HTC Dream the following proprietary libraries were replaced: |
||
174 | 16 | Denis 'GNUtoo' Carikli | (Refer to [wiki:ProprietaryHtcDreamLibsReplacement] for more up to date details(or fix it if it's less recent)) |
175 | |||
176 | The first thing you will have to do is to modify the build system. |
||
177 | 1 | Denis 'GNUtoo' Carikli | The key thing to do is to change |
178 | 32 | Michael Haas - | |
179 | === RIL === |
||
180 | If the RIL you previously tried works fine, why not switching to it...directly in the build system. |
||
181 | 16 | Denis 'GNUtoo' Carikli | Here's the diff between A working RIL and a non-working RIL for the htcdream: |
182 | {{{ |
||
183 | android_device_htc_dream_sapphire$ git diff 5593d2899203ec378c306701788f1c43af9a6935 -- full_dream_sapphire.mk |
||
184 | diff --git a/full_dream_sapphire.mk b/full_dream_sapphire.mk |
||
185 | index 9ec7feb..eb1b956 100644 |
||
186 | --- a/full_dream_sapphire.mk |
||
187 | +++ b/full_dream_sapphire.mk |
||
188 | @@ -40,7 +40,8 @@ PRODUCT_PROPERTY_OVERRIDES := \ |
||
189 | ro.media.dec.jpeg.memcap=10000000 |
||
190 | |||
191 | PRODUCT_PROPERTY_OVERRIDES += \ |
||
192 | - rild.libpath=/system/lib/libhtc_ril.so \ |
||
193 | + rild.libpath=/system/lib/libreference-ril.so \ |
||
194 | + rild.libargs=-d/dev/smd0 \ |
||
195 | wifi.interface=tiwlan0 |
||
196 | 17 | Denis 'GNUtoo' Carikli | |
197 | # Time between scans in seconds. Keep it high to minimize battery drain. |
||
198 | |||
199 | }}} |
||
200 | Note that full_dream_sapphire.mk is located here: |
||
201 | {{{ |
||
202 | 18 | Denis 'GNUtoo' Carikli | device/htc/dream_sapphire/full_dream_sapphire.mk |
203 | }}} |
||
204 | The diff is self-explanatory and how to do the change is left as an exercise to the reader. |
||
205 | 32 | Michael Haas - | |
206 | 18 | Denis 'GNUtoo' Carikli | In case the RIL need to be modified the sources are in : |
207 | 19 | Denis 'GNUtoo' Carikli | {{{ |
208 | hardware/ril/reference-ril |
||
209 | }}} |
||
210 | 21 | Denis 'GNUtoo' Carikli | They are written in C. |
211 | 19 | Denis 'GNUtoo' Carikli | |
212 | 32 | Michael Haas - | === Audio libraries === |
213 | On the HTC dream the audio libraries were modified. |
||
214 | 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]. |
215 | Note several things on [http://gitorious.org/replicant/android_hardware_msm7k/commit/e0b55a19b2fc004915503ebdfd7c4c02c4264611 the commit]: |
||
216 | 22 | Denis 'GNUtoo' Carikli | * the routing was disabled, I had to re-enable it |
217 | 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. |
218 | * I had nearly no knowledge of C++ |
||
219 | 32 | Michael Haas - | * it was easy |
220 | 28 | Denis 'GNUtoo' Carikli | |
221 | 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). |
222 | |||
223 | 42 | Denis 'GNUtoo' Carikli | === GPS === |
224 | Two GPS libraries exist: |
||
225 | * libgps |
||
226 | * libloc_api |
||
227 | Both provide the same functionalities at the application level. |
||
228 | Choose the one that is supported by your device or that has support for a device close to your device. |
||
229 | 43 | Denis 'GNUtoo' Carikli | ==== libgps ==== |
230 | 1 | Denis 'GNUtoo' Carikli | 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]: |
231 | 43 | Denis 'GNUtoo' Carikli | 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) : |
232 | {{{ |
||
233 | BOARD_HAVE_GPS_HARDWARE := true |
||
234 | BOARD_GPS_LIBRARIES := libhardware |
||
235 | }}} |
||
236 | I'm not sure if the "BOARD_HAVE_GPS_HARDWARE := true" is really needed. |
||
237 | 1 | Denis 'GNUtoo' Carikli | |
238 | 43 | Denis 'GNUtoo' Carikli | If your device is different from the htc dream you may have to modify the GPS library code to match your device, |
239 | Here's the adaptation made for the htc dream: |
||
240 | {{{ |
||
241 | hardware/libhardware_legacy/gps$ diff -u ../../../../repos_external/phh_libhardware_legacy/gps/gps-rpc.c ./gps-rpc.c |
||
242 | --- ../../../../repos_external/phh_libhardware_legacy/gps/gps-rpc.c 2010-08-15 11:35:03.210095153 +0200 |
||
243 | +++ ./gps-rpc.c 2011-01-06 16:46:45.417685002 +0100 |
||
244 | @@ -464,8 +464,8 @@ |
||
245 | } |
||
246 | |||
247 | int init_gps6125() { |
||
248 | - struct CLIENT *clnt=clnt_create(NULL, 0x3000005B, 0, NULL); |
||
249 | - struct CLIENT *clnt_atl=clnt_create(NULL, 0x3000001D, 0, NULL); |
||
250 | + struct CLIENT *clnt=clnt_create(NULL, 0x3000005B, 0x90380d3d, NULL); |
||
251 | + struct CLIENT *clnt_atl=clnt_create(NULL, 0x3000001D, 0x51c92bd8, NULL); |
||
252 | int i; |
||
253 | _clnt=clnt; |
||
254 | SVCXPRT *svc=svcrtr_create(); |
||
255 | @@ -538,33 +538,21 @@ |
||
256 | |||
257 | |||
258 | int init_gps_rpc() { |
||
259 | - int fd=open("/sys/class/htc_hw/amss", O_RDONLY); |
||
260 | - char buf[32]; |
||
261 | - bzero(buf, 32); |
||
262 | - read(fd, buf, 32); |
||
263 | - if(strncmp(buf, "6125", 4)==0) |
||
264 | - amss=A6125; |
||
265 | - else if((strncmp(buf, "5225", 4)==0) || (strncmp(buf, "6150", 4)==0)) |
||
266 | - amss=A5225; |
||
267 | - else |
||
268 | - amss=A6125; //Fallback to 6125 ATM |
||
269 | - if(amss==A6125) |
||
270 | - init_gps6125(); |
||
271 | - else if(amss==A5225) |
||
272 | - init_gps5225(); |
||
273 | + amss=A6125; |
||
274 | + init_gps6125(); |
||
275 | return 0; |
||
276 | } |
||
277 | |||
278 | void gps_get_position() { |
||
279 | int i; |
||
280 | - for(i=5;i;--i) if(!can_send) sleep(1);//Time out of 5 seconds on can_send |
||
281 | + for(i=3;i;--i) if(!can_send) sleep(1);//Time out of 5 seconds on can_send |
||
282 | can_send=0; |
||
283 | 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]); |
||
284 | } |
||
285 | |||
286 | void exit_gps_rpc() { |
||
287 | - if(amss==A6125) |
||
288 | - pdsm_client_end_session(_clnt, 0, 2); |
||
289 | + //if(amss==A6125) |
||
290 | + // pdsm_client_end_session(_clnt, 0, 2); |
||
291 | //5225 doesn't seem to like end_session ? |
||
292 | //Bah it ends session on itself after 10seconds. |
||
293 | } |
||
294 | }}} |
||
295 | 1 | Denis 'GNUtoo' Carikli | |
296 | 44 | Denis 'GNUtoo' Carikli | so let's go step by steps on that diff: |
297 | First we see that: |
||
298 | {{{ |
||
299 | + struct CLIENT *clnt=clnt_create(NULL, 0x3000005B, 0x90380d3d, NULL); |
||
300 | + struct CLIENT *clnt_atl=clnt_create(NULL, 0x3000001D, 0x51c92bd8, NULL); |
||
301 | }}} |
||
302 | This corresponds to some devices nodes: |
||
303 | {{{ |
||
304 | # ls -l /dev/oncrpc |
||
305 | crw-rw---- 1 radio system 253, 0 Jan 6 16:43 00000000:0 |
||
306 | crw-rw---- 1 radio system 253, 11 Jan 6 16:43 30000000:5a10cf88 |
||
307 | crw-rw---- 1 radio system 253, 9 Jan 6 16:43 30000002:aa2b1a44 |
||
308 | crw-rw---- 1 radio system 253, 4 Jan 6 16:43 30000003:94103dec |
||
309 | crw-rw---- 1 radio system 253, 30 Jan 6 16:43 3000000a:71d1094b |
||
310 | crw-rw---- 1 radio system 253, 28 Jan 6 16:43 3000000e:2bf06595 |
||
311 | crw-rw---- 1 radio system 253, 26 Jan 6 16:43 3000000f:46d257e5 |
||
312 | crw-rw---- 1 radio system 253, 23 Jan 6 16:43 30000013:e94e8f0c |
||
313 | crw-rw---- 1 radio system 253, 22 Jan 6 16:43 30000014:7cfcd2c6 |
||
314 | crw-rw---- 1 radio system 253, 21 Jan 6 16:43 30000016:c713bd79 |
||
315 | crw-rw---- 1 radio system 253, 19 Jan 6 16:43 30000019:acb4a896 |
||
316 | crw-rw---- 1 radio system 253, 18 Jan 6 16:43 3000001b:97d7b24a |
||
317 | crw-rw---- 1 radio system 253, 12 Jan 6 16:43 3000001d:51c92bd8 |
||
318 | crw-rw---- 1 radio system 253, 8 Jan 6 16:43 30000021:f330a24e |
||
319 | crw-rw---- 1 radio system 253, 14 Jan 6 16:43 3000003c:03d4377c |
||
320 | crw-rw---- 1 radio system 253, 29 Jan 6 16:43 30000048:0da5b528 |
||
321 | crw-rw---- 1 radio system 253, 17 Jan 6 16:43 30000059:00000000 |
||
322 | crw-rw---- 1 radio system 253, 16 Jan 6 16:43 3000005a:00000000 |
||
323 | crw-rw---- 1 radio system 253, 13 Jan 6 16:43 3000005b:90380d3d |
||
324 | crw-rw---- 1 radio system 253, 7 Jan 6 16:43 3000005f:95d1d9f5 |
||
325 | crw-rw---- 1 radio system 253, 5 Jan 6 16:43 30000060:bcfb5d63 |
||
326 | crw-rw---- 1 radio system 253, 2 Jan 6 16:43 30000061:fb837d0b |
||
327 | crw-rw---- 1 radio system 253, 31 Jan 6 16:43 30000066:1f4b343e |
||
328 | crw-rw---- 1 radio system 253, 27 Jan 6 16:43 3000006b:0aabc7a4 |
||
329 | crw-rw---- 1 radio system 253, 25 Jan 6 16:43 3000006c:00000000 |
||
330 | crw-rw---- 1 radio system 253, 20 Jan 6 16:43 30000075:f708938d |
||
331 | crw-rw---- 1 radio system 253, 15 Jan 6 16:43 30000079:00000000 |
||
332 | crw-rw---- 1 radio system 253, 1 Jan 6 16:43 30000081:ccc5b439 |
||
333 | crw-rw---- 1 radio system 253, 24 Jan 6 16:43 3000fe00:00000000 |
||
334 | crw-rw---- 1 radio system 253, 10 Jan 6 16:43 3000fffe:00000000 |
||
335 | crw-rw---- 1 radio system 253, 6 Jan 6 16:43 30100001:00000000 |
||
336 | crw-rw---- 1 radio system 253, 3 Jan 6 16:43 30100002:00000000 |
||
337 | }}} |
||
338 | Theses 2 lines should ring a bell: |
||
339 | {{{ |
||
340 | crw-rw---- 1 radio system 253, 13 Jan 6 16:43 3000005b:90380d3d |
||
341 | crw-rw---- 1 radio system 253, 12 Jan 6 16:43 3000001d:51c92bd8 |
||
342 | }}} |
||
343 | 1 | Denis 'GNUtoo' Carikli | |
344 | 45 | Denis 'GNUtoo' Carikli | Next there is that line: |
345 | {{{ |
||
346 | + for(i=3;i;--i) if(!can_send) sleep(1);//Time out of 5 seconds on can_send |
||
347 | }}} |
||
348 | This is the time between 2 requests, if you put it too low it can reboot your phone(it will crashes and reboot) |
||
349 | 1 | Denis 'GNUtoo' Carikli | |
350 | 45 | Denis 'GNUtoo' Carikli | |
351 | ==== libloc_api ==== |
||
352 | |||
353 | ==== Note on the GPS ==== |
||
354 | 43 | 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). |
355 | 1 | Denis 'GNUtoo' Carikli | |
356 | 45 | Denis 'GNUtoo' Carikli | The GPS is attached to the modem on the htc dream and the nexus one. |
357 | 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. |
||
358 | That RPC mecanism uses shared memory between the modem and the CPU that runs Android. |
||
359 | |||
360 | 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. |
||
361 | So compatibility with applications that understand NMEA is garanteed. |
||
362 | |||
363 | 46 | 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) |
364 | 42 | Denis 'GNUtoo' Carikli | |
365 | 32 | Michael Haas - | == Re-using source code == |
366 | The previous source code re-used some public source code that was licensed under the Apache 2.0 license. |
||
367 | 28 | Denis 'GNUtoo' Carikli | The ril will also re-use some public source code licensed under Apache 2.0. |
368 | 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. |
||
369 | 22 | 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. |
370 | |||
371 | 23 | Denis 'GNUtoo' Carikli | === Ril === |
372 | * vilvord ril |
||
373 | * openmoko (android on freerunner) ril |
||
374 | |||
375 | == Source organization and commit access == |
||
376 | Until now we made some changes in the tree, but we want the changes to land upstream in replicant. |
||
377 | For instance let's say we modified only the ril path like in the ril section in |
||
378 | {{{ |
||
379 | 24 | Denis 'GNUtoo' Carikli | device/htc/dream_sapphire/full_dream_sapphire.mk |
380 | }}} |
||
381 | first we save our modifications: |
||
382 | {{{ |
||
383 | cd device/htc/dream_sapphire/ |
||
384 | git diff > git_diff.patch |
||
385 | }}} |
||
386 | then we find where is the root of the git repository we are in: |
||
387 | 1 | Denis 'GNUtoo' Carikli | {{{ |
388 | cd replicant-2.2 #top replicant directory where everything is in |
||
389 | 24 | Denis 'GNUtoo' Carikli | cd .repo |
390 | cat manifest.xml |
||
391 | }}} |
||
392 | and we find that: |
||
393 | {{{ |
||
394 | <project path="device/htc/buzz" name="CyanogenMod/android_device_htc_buzz" remote="github" /> |
||
395 | }}} |
||
396 | so...now our repository is in device/htc/buzz |
||
397 | We will now look where the source repository is: |
||
398 | {{{ |
||
399 | cd device/htc/buzz |
||
400 | cd .git |
||
401 | cat config |
||
402 | }}} |
||
403 | We find that: |
||
404 | {{{ |
||
405 | url = git://github.com/CyanogenMod/android_device_htc_buzz.git |
||
406 | }}} |
||
407 | |||
408 | 25 | Denis 'GNUtoo' Carikli | Then create a directory, not under the replicant-2.2 directory that will contain your repositories: |
409 | {{{ |
||
410 | mkdir repo |
||
411 | cd repo |
||
412 | }}} |
||
413 | and clone the source: |
||
414 | {{{ |
||
415 | git clone git://github.com/CyanogenMod/android_device_htc_buzz.git |
||
416 | cd android_device_htc_buzz |
||
417 | 26 | Denis 'GNUtoo' Carikli | }}} |
418 | apply the previous patch: |
||
419 | 27 | Denis 'GNUtoo' Carikli | {{{ |
420 | 26 | Denis 'GNUtoo' Carikli | git apply path/to/git_diff.patch |
421 | }}} |
||
422 | commit locally the result: |
||
423 | {{{ |
||
424 | git commit -s |
||
425 | }}} |
||
426 | 32 | Michael Haas - | Note that the commit message should have the following format: |
427 | The first line should be a summary |
||
428 | 1 | Denis 'GNUtoo' Carikli | Followed by a linebreak |
429 | 27 | Denis 'GNUtoo' Carikli | And then the details explaining the commit |
430 | If you made an error writing the commit message do |
||
431 | {{{ |
||
432 | git commit --amend |
||
433 | }}} |
||
434 | 1 | Denis 'GNUtoo' Carikli | |
435 | TODO: complete for sending the git patch(git format-patch -1,git send-email) |
||
436 | |||
437 | ==== Pushing to replicant ==== |
||
438 | TODO: git remote add+git push |