SamsungSerial » History » Version 15
Paul Kocialkowski, 09/30/2011 08:34 PM
1 | 1 | Denis 'GNUtoo' Carikli | == Introduction == |
---|---|---|---|
2 | This page contains information on how to work on a bootloader replacement. |
||
3 | 2 | Denis 'GNUtoo' Carikli | |
4 | == Informations == |
||
5 | 3 | Denis 'GNUtoo' Carikli | * The [http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=summary official u-boot source code] already has support for the S5PC110 SOC(system on a chip) that the Nexus S uses |
6 | * The S5PC110 has a bootrom |
||
7 | 4 | Denis 'GNUtoo' Carikli | * The Nexus S has an usb port with an FSA9480 behind it |
8 | |||
9 | 15 | Paul Kocialkowski | == Links of interest == |
10 | |||
11 | * [http://forum.xda-developers.com/showthread.php?t=1233273 Create your own I9000/S8500 (& all S5PC110 based devices) bootloader&ultimate unbrick - XDA-Developers Forums] |
||
12 | * [http://forum.xda-developers.com/showthread.php?t=1277056 HOW-TO UnBrick the UnBrickable Vibrant - xda-developers] |
||
13 | * [http://code.google.com/p/hummingbird-hibl/ Boot sequence interception/redirection for Hummingbird processors] |
||
14 | * [http://code.google.com/p/hummingbird-hibl/source/browse/trunk/HummingBirdInterceptorBootloader/ source code for hummingbird-hibl] |
||
15 | |||
16 | 8 | Paul Kocialkowski | === Partitioning informations === |
17 | |||
18 | Here's a detailed output showing the partitioning of the NAND that you can obtain with {{{ heimdall print-pit }}} with the device in download mode (VOL+ and VOL- held at reboot): |
||
19 | {{{ |
||
20 | Entry Count: 16 |
||
21 | Unknown 1: 0 |
||
22 | Unknown 2: 0 |
||
23 | Unknown 3: 0 |
||
24 | Unknown 4: 0 |
||
25 | Unknown 5: 0 |
||
26 | Unknown 6: 0 |
||
27 | Unknown 7: 0 |
||
28 | Unknown 8: 0 |
||
29 | |||
30 | |||
31 | --- Entry #0 --- |
||
32 | Unused: No |
||
33 | Partition Type: 0 (RFS) |
||
34 | Partition Identifier: 0 |
||
35 | Partition Flags: 0 (R) |
||
36 | Unknown 1: 0 |
||
37 | Partition Block Size: 256 |
||
38 | Partition Block Count: 1 |
||
39 | Unknown 2: 0 |
||
40 | Unknown 3: 0 |
||
41 | Partition Name: IPBL |
||
42 | Filename: bootloader.img |
||
43 | |||
44 | |||
45 | --- Entry #1 --- |
||
46 | Unused: No |
||
47 | Partition Type: 0 (RFS) |
||
48 | Partition Identifier: 1 |
||
49 | Partition Flags: 0 (R) |
||
50 | Unknown 1: 0 |
||
51 | Partition Block Size: 256 |
||
52 | Partition Block Count: 7 |
||
53 | Unknown 2: 0 |
||
54 | Unknown 3: 0 |
||
55 | Partition Name: SBL |
||
56 | Filename: |
||
57 | |||
58 | |||
59 | --- Entry #2 --- |
||
60 | Unused: No |
||
61 | Partition Type: 0 (RFS) |
||
62 | Partition Identifier: 2 |
||
63 | Partition Flags: 0 (R) |
||
64 | Unknown 1: 0 |
||
65 | Partition Block Size: 256 |
||
66 | Partition Block Count: 7 |
||
67 | Unknown 2: 0 |
||
68 | Unknown 3: 0 |
||
69 | Partition Name: SBL2 |
||
70 | Filename: |
||
71 | |||
72 | |||
73 | --- Entry #3 --- |
||
74 | Unused: No |
||
75 | Partition Type: 0 (RFS) |
||
76 | Partition Identifier: 3 |
||
77 | Partition Flags: 0 (R) |
||
78 | Unknown 1: 0 |
||
79 | Partition Block Size: 256 |
||
80 | Partition Block Count: 4 |
||
81 | Unknown 2: 0 |
||
82 | Unknown 3: 0 |
||
83 | Partition Name: PARAM |
||
84 | Filename: |
||
85 | |||
86 | |||
87 | --- Entry #4 --- |
||
88 | Unused: No |
||
89 | Partition Type: 0 (RFS) |
||
90 | Partition Identifier: 4 |
||
91 | Partition Flags: 0 (R) |
||
92 | Unknown 1: 0 |
||
93 | Partition Block Size: 256 |
||
94 | Partition Block Count: 5 |
||
95 | Unknown 2: 0 |
||
96 | Unknown 3: 0 |
||
97 | Partition Name: MISC |
||
98 | Filename: |
||
99 | |||
100 | |||
101 | --- Entry #5 --- |
||
102 | Unused: No |
||
103 | Partition Type: 0 (RFS) |
||
104 | Partition Identifier: 5 |
||
105 | Partition Flags: 0 (R) |
||
106 | Unknown 1: 0 |
||
107 | Partition Block Size: 256 |
||
108 | Partition Block Count: 32 |
||
109 | Unknown 2: 0 |
||
110 | Unknown 3: 0 |
||
111 | Partition Name: BOOT |
||
112 | Filename: boot.img |
||
113 | |||
114 | |||
115 | --- Entry #6 --- |
||
116 | Unused: No |
||
117 | Partition Type: 0 (RFS) |
||
118 | Partition Identifier: 6 |
||
119 | Partition Flags: 0 (R) |
||
120 | Unknown 1: 0 |
||
121 | Partition Block Size: 256 |
||
122 | Partition Block Count: 32 |
||
123 | Unknown 2: 0 |
||
124 | Unknown 3: 0 |
||
125 | Partition Name: RECOVERY |
||
126 | Filename: recovery.img |
||
127 | |||
128 | |||
129 | --- Entry #7 --- |
||
130 | Unused: No |
||
131 | Partition Type: 0 (RFS) |
||
132 | Partition Identifier: 7 |
||
133 | Partition Flags: 1 (R) |
||
134 | Unknown 1: 0 |
||
135 | Partition Block Size: 256 |
||
136 | Partition Block Count: 1878 |
||
137 | Unknown 2: 0 |
||
138 | Unknown 3: 0 |
||
139 | Partition Name: CACHE |
||
140 | Filename: cache.img |
||
141 | |||
142 | |||
143 | --- Entry #8 --- |
||
144 | Unused: Yes |
||
145 | Partition Type: 0 (RFS) |
||
146 | Partition Identifier: 8 |
||
147 | Partition Flags: 0 (R) |
||
148 | Unknown 1: 0 |
||
149 | Partition Block Size: 256 |
||
150 | Partition Block Count: 54 |
||
151 | Unknown 2: 0 |
||
152 | Unknown 3: 0 |
||
153 | Partition Name: RADIO |
||
154 | Filename: radio.img |
||
155 | |||
156 | |||
157 | --- Entry #9 --- |
||
158 | Unused: No |
||
159 | Partition Type: 0 (RFS) |
||
160 | Partition Identifier: 9 |
||
161 | Partition Flags: 1 (R) |
||
162 | Unknown 1: 0 |
||
163 | Partition Block Size: 256 |
||
164 | Partition Block Count: 27 |
||
165 | Unknown 2: 0 |
||
166 | Unknown 3: 0 |
||
167 | Partition Name: EFS |
||
168 | Filename: |
||
169 | |||
170 | |||
171 | --- Entry #10 --- |
||
172 | Unused: No |
||
173 | Partition Type: 0 (RFS) |
||
174 | Partition Identifier: 10 |
||
175 | Partition Flags: 0 (R) |
||
176 | Unknown 1: 0 |
||
177 | Partition Block Size: 256 |
||
178 | Partition Block Count: 1 |
||
179 | Unknown 2: 0 |
||
180 | Unknown 3: 0 |
||
181 | Partition Name: DGS |
||
182 | Filename: dgs.img |
||
183 | |||
184 | |||
185 | --- Entry #11 --- |
||
186 | Unused: No |
||
187 | Partition Type: 2 (EXT4) |
||
188 | Partition Identifier: 0 |
||
189 | Partition Flags: 2 (R/W) |
||
190 | Unknown 1: 0 |
||
191 | Partition Block Size: 512 |
||
192 | Partition Block Count: 2048 |
||
193 | Unknown 2: 0 |
||
194 | Unknown 3: 0 |
||
195 | Partition Name: PGPT |
||
196 | Filename: emmc.img |
||
197 | |||
198 | |||
199 | --- Entry #12 --- |
||
200 | Unused: No |
||
201 | Partition Type: 2 (EXT4) |
||
202 | Partition Identifier: 1 |
||
203 | Partition Flags: 2 (R/W) |
||
204 | Unknown 1: 0 |
||
205 | Partition Block Size: 512 |
||
206 | Partition Block Count: 1048576 |
||
207 | Unknown 2: 0 |
||
208 | Unknown 3: 0 |
||
209 | Partition Name: SYSTEM |
||
210 | Filename: system.img |
||
211 | |||
212 | |||
213 | --- Entry #13 --- |
||
214 | Unused: No |
||
215 | Partition Type: 2 (EXT4) |
||
216 | Partition Identifier: 2 |
||
217 | Partition Flags: 2 (R/W) |
||
218 | Unknown 1: 0 |
||
219 | Partition Block Size: 512 |
||
220 | Partition Block Count: 2097152 |
||
221 | Unknown 2: 0 |
||
222 | Unknown 3: 0 |
||
223 | Partition Name: USERDATA |
||
224 | Filename: userdata.img |
||
225 | |||
226 | |||
227 | --- Entry #14 --- |
||
228 | Unused: No |
||
229 | Partition Type: 2 (EXT4) |
||
230 | Partition Identifier: 3 |
||
231 | Partition Flags: 2 (R/W) |
||
232 | Unknown 1: 0 |
||
233 | Partition Block Size: 512 |
||
234 | Partition Block Count: 33554432 |
||
235 | Unknown 2: 0 |
||
236 | Unknown 3: 0 |
||
237 | Partition Name: MEDIA |
||
238 | Filename: media.img |
||
239 | |||
240 | |||
241 | --- Entry #15 --- |
||
242 | Unused: No |
||
243 | Partition Type: 2 (EXT4) |
||
244 | Partition Identifier: 4 |
||
245 | Partition Flags: 2 (R/W) |
||
246 | Unknown 1: 0 |
||
247 | Partition Block Size: 512 |
||
248 | Partition Block Count: 33 |
||
249 | Unknown 2: 0 |
||
250 | Unknown 3: 0 |
||
251 | Partition Name: SGPT |
||
252 | Filename: |
||
253 | }}} |
||
254 | 4 | Denis 'GNUtoo' Carikli | |
255 | 9 | Paul Kocialkowski | == Serial Console == |
256 | |||
257 | It is possible to setup a serial console on the Nexus S. It will show: |
||
258 | 10 | Paul Kocialkowski | * the 1st bootloader output |
259 | * the 2nd bootloader output |
||
260 | * the 2nd bootloader #2 output |
||
261 | * the fiq debugger |
||
262 | * (the kernel output if enabled) |
||
263 | 9 | Paul Kocialkowski | |
264 | === How to enable serial console === |
||
265 | |||
266 | 12 | Paul Kocialkowski | * completely turn off the Nexus S |
267 | * attach the microUSB connector to the Nexus S |
||
268 | 10 | Paul Kocialkowski | * wire GND and ID (from the microUSB connector) to a 150K resistor |
269 | * get an UART to USB module like this one: http://www.dealextreme.com/p/usb-to-uart-5-pin-cp2102-module-serial-converter-81872 |
||
270 | * wire it following this table: |
||
271 | 9 | Paul Kocialkowski | || UART to USB board output || resistor || microUSB connector(s) name(s) || microUSB wire color || |
272 | || N/A || 150K Ohm || ID and GND || ID not wired (the 5th connector that is unused), GND is black || |
||
273 | || 3.3V || N/A || V+ || red || |
||
274 | || GND || N/A || GND || black || |
||
275 | || Rx || N/A || D- || white || |
||
276 | || Tx || N/A || D+ || green || |
||
277 | |||
278 | '''Warning: the voltage to use is 3.3V and not 5V! Using 5V can cause serious damages to the UART component.''' |
||
279 | |||
280 | When the USB to UART module is connected to the host PC, a new tty node will be created on the host PC, usually {{{ /dev/ttyUSB0 }}}. |
||
281 | To read/write on the serial, you can use screen (or picocomm, or any other software that deals with serial consoles): |
||
282 | 11 | Paul Kocialkowski | {{{ screen /dev/ttyUSB0 115200 }}} |
283 | 9 | Paul Kocialkowski | 115200 is the baud rate to use (certainly with most UART to USB board). |
284 | |||
285 | 13 | Paul Kocialkowski | Then, do a regular boot. You should see the second bootloader #2 output. To get the 1st and 2nd bootloaders output, press <enter> to get in fiq debugger and write "reboot" then <enter>. |
286 | |||
287 | |||
288 | 12 | Paul Kocialkowski | Photos: here's what it looks like when all setup: |
289 | 1 | Denis 'GNUtoo' Carikli | |
290 | 13 | Paul Kocialkowski | [[Image(http://download.paulk.fr/replicant/crespo/uart/uart_board.jpg)]] |
291 | |||
292 | The UART to USB board. USB is connected to the host PC, UART pins to the microUSB connector. |
||
293 | |||
294 | [[Image(http://download.paulk.fr/replicant/crespo/uart/nexuss_resistor.jpg)]] |
||
295 | |||
296 | The 150K resistor (two resistors here that make 150K together) soldered to the microUSB connector, that is attached to the Nexus S. |
||
297 | |||
298 | ''Note: it was done the quick and dirty way here, it's better to use a protoboard (prototyping board).'' |
||
299 | |||
300 | [[Image(http://download.paulk.fr/replicant/crespo/uart/nexuss_global_text.jpg)]] |
||
301 | |||
302 | The USB cable that is connected to the Nexus S ends on the connectors attached to the UART to USB board. |
||
303 | 14 | Paul Kocialkowski | |
304 | 13 | Paul Kocialkowski | ''Note: it was done the quick and dirty way here, it's better to use a protoboard (prototyping board).'' |
305 | 9 | Paul Kocialkowski | |
306 | === Bootloaders outputs === |
||
307 | |||
308 | first bootloader: |
||
309 | {{{ |
||
310 | ----------------------------------------------------------- |
||
311 | Samsung Primitive Bootloader (PBL) v3.0 |
||
312 | Copyright (C) Samsung Electronics Co., Ltd. 2006-2010 |
||
313 | ----------------------------------------------------------- |
||
314 | |||
315 | Muxed OneNAND 512MB (0x50) Sync |
||
316 | Scanning Bad Block ....... |
||
317 | Bad Block 77 (5) |
||
318 | Bad Block 295 (5) |
||
319 | Bad Block 1232 (5) |
||
320 | Bad Block 1646 (5) |
||
321 | Bad Block 1831 (5) |
||
322 | Bad Block 2047 (0) |
||
323 | SBL loadding success |
||
324 | |||
325 | Set cpu clk. from 400MHz to 800MHz. |
||
326 | OM=0x9, device=OnenandMux(Audi) |
||
327 | IROM e-fused - Secure Boot Version. |
||
328 | }}} |
||
329 | |||
330 | second bootloader: |
||
331 | {{{ |
||
332 | ----------------------------------------------------------- |
||
333 | Samsung Secondary Bootloader (SBL) v3.0 |
||
334 | Copyright (C) Samsung Electronics Co., Ltd. 2006-2010 |
||
335 | |||
336 | Board Name: HERRING REV 52 |
||
337 | Build On: Jan 20 2011 17:19:41 |
||
338 | ----------------------------------------------------------- |
||
339 | |||
340 | MMC SEM16G 15188 MB |
||
341 | Re_partition: magic code(0x0) |
||
342 | Muxed OneNAND 512MB (0x50) Sync |
||
343 | Scanning Bad Block ....... |
||
344 | Bad Block 77 (5) |
||
345 | Bad Block 295 (5) |
||
346 | Bad Block 1232 (5) |
||
347 | Bad Block 1646 (5) |
||
348 | Bad Block 1831 (5) |
||
349 | Bad Block 2047 (0) |
||
350 | Partitions loading success |
||
351 | Read image(PARAM) from flash ....... |
||
352 | Done |
||
353 | init_fuel_gauge: vcell = 4083mV, soc = 94 |
||
354 | PMIC_IRQ1 = 0xc0 |
||
355 | PMIC_IRQ2 = 0x0 |
||
356 | PMIC_IRQ3 = 0x0 |
||
357 | PMIC_IRQ4 = 0x0 |
||
358 | PMIC_STATUS1 = 0x0 |
||
359 | PMIC_STATUS2 = 0x0 |
||
360 | PMIC_STATUS3 = 0x0 |
||
361 | PMIC_STATUS4 = 0x0 |
||
362 | PMIC_STATUS5 = 0x0 |
||
363 | PMIC_SMPL = 0x0 |
||
364 | Key scan = 0x0 |
||
365 | message.command = |
||
366 | message.status = |
||
367 | message.recovery = |
||
368 | }}} |
||
369 | |||
370 | second bootloader #2: |
||
371 | {{{ |
||
372 | BOOT_MODE_NORMAL (SW_RST(0x00000004), INFORM(0x000000ee)) |
||
373 | LCD ID = 0x0060a953 |
||
374 | Done |
||
375 | Kernel(boot.img) read success from partition no.5 |
||
376 | Setting param.serialnr = 0x3733bab6 0x6de200ec |
||
377 | Setting param.board_rev = 0x34 |
||
378 | Setting param.cmdline = console=ttyFIQ0 no_console_suspend androidboot.serialno=3733BAB66DE200EC androidboot.bootloader=I9020XXKA3 androidboot.baseband=I9020XXKB3 androidboot.info=0x4,0xee,1 androidboot.carrier=EUR gain_code=3 s3cfb.bootloaderfb=0x34a00000 mach-herring.lcd_type=0x00000000 oem_state=unlocked |
||
379 | Setting param.initrd_start = 0x31000000, param.initrd_size = 0x23265 |
||
380 | |||
381 | Starting kernel at 0x30008000... |
||
382 | |||
383 | Uncompressing Linux... done, booting the kernel. |
||
384 | }}} |
||
385 | |||
386 | kernel |
||
387 | {{{ |
||
388 | <hit enter to activate fiq debugger> |
||
389 | }}} |
||
390 | |||
391 | 4 | Denis 'GNUtoo' Carikli | == TODO == |
392 | 6 | Denis 'GNUtoo' Carikli | * Look if [http://www.glassechidna.com.au/products/heimdall/ Heimdall] can talk to the bootrom |
393 | 4 | Denis 'GNUtoo' Carikli | * Serial console: |
394 | * Use the correct resistors enabling the serial console on the FSA9480 |
||
395 | * Mesure the voltage of the Nexus S serial port |
||
396 | * Make a level shifter to shift the serial port levels |
||
397 | * Cross compile microcom or picocom |
||
398 | * get a serial console |
||
399 | 5 | Denis 'GNUtoo' Carikli | * Find the JTAG |
400 | 7 | Denis 'GNUtoo' Carikli | * look if the first stage bootloader(after the bootrom) is signed |