Project

General

Profile

MidasBootloader » History » Version 15

Denis 'GNUtoo' Carikli, 11/03/2020 10:50 PM
Add test results

1 1 Denis 'GNUtoo' Carikli
h1. MidasBootloader
2
3 8 Denis 'GNUtoo' Carikli
{{toc}}
4
5
h2. Accessing the bootloader console
6
7 6 Denis 'GNUtoo' Carikli
When connected on the serial port, during boot, if you press the volume down button and press enter at least 4 times on the serial console, you can get a shell:
8 1 Denis 'GNUtoo' Carikli
<pre>
9
PMIC rev = PASS2(4)
10
BUCK1OUT(vdd_mif) = 0x05
11
BUCK3DVS1(vdd_int) = 0x20
12
[MMC] there are pending interrupts 0x00010000
13
cardtype: 0x00000007
14
SB_MMC_HS_52MHZ_1_8V_3V_IO
15
mmc->card_caps: 0x00000311
16
mmc->host_caps: 0x00000311
17
mmc_initialize: mmc->capacity = 30777344
18
19
Samsung S-Boot 4.0-2836504 for GT-I9300 (Jun 15 2015 - 22:47:58)
20
21
EXYNOS4412(EVT 1.1) / 1022MB / 15028MB / Rev 12 / I9300XXUGOF1 /(PKG_ID 0x7050008)
22
23
- read_bl1
24
pit_check_signature (PIT) valid.
25
initialize_ddi_data: usable! (3:0xf)
26
PARAM ENV VERSION: v1.0..
27
set_charger_current: chg curr(3f), in curr(17)
28
set_charger_state: buck(1), chg(1), reg(0x05)
29
microusb_get_attached_device: STATUS1:0x3d, 2:0x00
30
set_auto_current: ta_state(0), curr(1000)
31
init_fuelgauge: fuelgauge power ok
32
init_fuelgauge: POR status
33
fuelgauge_por: POR start: vcell(4081), vfocv(4188), soc(100)
34
fuelgauge_por: update SDI M0 parameter
35
fuelgauge_por: RCOMP(0x0065), TEMPCO(0x0930)
36
fuelgauge_por: POR finish: vcell(4079), vfocv(4310), soc(88)
37
get_table_soc: vcell(4077) is caculated to t-soc(84.590)
38
init_fuelgauge: start: vcell(4077), vfocv(4301), soc(88), table soc(84)
39
init_fuelgauge: finish: vcell(4077), vfocv(4301), soc(88), table soc(84)
40
init_microusb_ic: MUIC: CONTROL1:0x1b
41
init_microusb_ic: MUIC: CONTROL1:0x1b
42
init_microusb_ic: MUIC: CONTROL2:0x3b
43
init_microusb_ic: MUIC: CONTROL2:0x3b
44
PMIC_ID      = 0x02 
45
PMIC_IRQSRC  = 0x00 
46
PMIC_IRQ1    = 0x06 
47
PMIC_IRQ2    = 0x00 
48
PMIC_IRQ1M   = 0xc0 
49
PMIC_IRQ2M   = 0x03 
50
PMIC_STATUS1 = 0x11 
51
PMIC_STATUS2 = 0x00 
52
PMIC_PWRON   = 0x03 
53
PMIC_RTCINT  = 0x00 
54
PMIC_RTCINTM = 0x3f 
55
s5p_check_keypad: 0x1100000
56
s5p_check_reboot_mode: INFORM3 = 0 ... skip
57
s5p_check_upload: MAGIC(0x277b3bbf), RST_STAT(0x10000)
58
microusb_get_attached_device: STATUS1:0x3d, 2:0x00
59
s5p_check_download: 0
60
microusb_get_attached_device: STATUS1:0x3d, 2:0x00
61
check_pm_status: non chargable jig, bypass check power
62
cmu_div:1, div:7, src_clk:800000000, pixel_clk:57153600
63
s5p_dsim_display_config : VIDEO MODE
64
a2, 60, 90, 
65
66
autoboot aborted..
67
S-BOOT # 
68
S-BOOT # 
69
S-BOOT # 
70
S-BOOT # 
71
S-BOOT # 
72
S-BOOT # 
73
S-BOOT # 
74
S-BOOT # 
75
S-BOOT # 
76
S-BOOT # help
77
Following commands are supported:
78
* chipinfo
79
* help
80
* log
81
* load_kernel
82
* boot
83
* reset
84
* findenv
85
* saveenv
86
* setenv
87
* printenv
88
* checksum_need
89
* usb
90
* upload
91
* keyread
92
* readadc
93
* printcsd
94
* rpmbwritedata
95
* rpmbreadcount
96
* rpmbsetkey
97
* rpmbclose
98
* rpmbopen
99
* sdcard_read
100
* sdcard
101
* fuelgauge
102
* usb_write
103
* usb_read
104
To get commands help, Type "help <command>"
105
S-BOOT #
106
</pre>
107 2 Denis 'GNUtoo' Carikli
108 7 Denis 'GNUtoo' Carikli
h2. Available commands
109
110
Here's the known list of commands:
111 2 Denis 'GNUtoo' Carikli
<pre>
112 7 Denis 'GNUtoo' Carikli
S-BOOT # help
113
Following commands are supported:
114
* chipinfo
115
* help
116
* log
117
* load_kernel
118
* boot
119
* reset
120
* findenv
121
* saveenv
122
* setenv
123
* printenv
124
* checksum_need
125
* usb
126
* upload
127
* keyread
128
* readadc
129
* printcsd
130
* rpmbwritedata
131
* rpmbreadcount
132
* rpmbsetkey
133
* rpmbclose
134
* rpmbopen
135
* sdcard_read
136
* sdcard
137
* fuelgauge
138
* usb_write
139
* usb_read
140
To get commands help, Type "help <command>"
141
S-BOOT #
142
</pre>
143
144
And the respective help:
145
<pre>
146 2 Denis 'GNUtoo' Carikli
S-BOOT # help chipinfo
147
* Help : chipinfo
148
* Usage : display exynos chip info.
149 7 Denis 'GNUtoo' Carikli
150 2 Denis 'GNUtoo' Carikli
S-BOOT # help help
151
* Help : help
152
* Usage : help [command]
153 7 Denis 'GNUtoo' Carikli
154 2 Denis 'GNUtoo' Carikli
S-BOOT # help log
155
* Help : log
156
* Usage : *usage : log
157
158
S-BOOT # help load_kernel
159
* Help : load_kernel
160
* Usage : load kernel image..
161 7 Denis 'GNUtoo' Carikli
162 2 Denis 'GNUtoo' Carikli
S-BOOT # help boot
163
* Help : boot
164
* Usage : boot [kernel options]
165
Boot Linux with optional kernel options
166
167
S-BOOT # help reset
168
* Help : reset
169
* Usage : reboot
170
Reboot system
171
172
S-BOOT # help findenv
173
* Help : findenv
174
* Usage : findenv [filename]
175
176
S-BOOT # help saveenv
177
* Help : saveenv
178
* Usage : saveenv
179
180
S-BOOT # help setenv
181
* Help : setenv
182
* Usage : setenv [name] [value]
183
184
S-BOOT # help printenv
185
* Help : printenv
186
* Usage : printenv
187
188
S-BOOT # help checksum_need
189
* Help : checksum_need
190
* Usage : Setting checksum need. 0 or 1
191 7 Denis 'GNUtoo' Carikli
192 2 Denis 'GNUtoo' Carikli
S-BOOT # help usb
193
* Help : usb
194
* Usage : usb download command.
195 7 Denis 'GNUtoo' Carikli
196 2 Denis 'GNUtoo' Carikli
S-BOOT # help upload
197
* Help : upload
198
* Usage : usb upload command.
199 7 Denis 'GNUtoo' Carikli
200 2 Denis 'GNUtoo' Carikli
S-BOOT # help keyread
201
* Help : keyread
202
* Usage : *Usage : keyread
203
204
S-BOOT # help readadc
205
* Help : readadc
206
* Usage : *usage : readadc <channel>
207
208
S-BOOT # help printcsd
209
* Help : printcsd
210
* Usage : printcsd
211
212
S-BOOT # help rpmbwritedata
213
* Help : rpmbwritedata
214
* Usage : rpmbwritedata [data]
215
216
S-BOOT # help rpmbreadcount
217
* Help : rpmbreadcount
218
* Usage : rpmbreadcount
219
220
S-BOOT # help rpmbsetkey
221
* Help : rpmbsetkey
222
* Usage : rpmbsetkey [key]
223
224
S-BOOT # help rpmbclose
225
* Help : rpmbclose
226
* Usage : rpmbclose
227
228
S-BOOT # help rpmbopen
229
* Help : rpmbopen
230
* Usage : rpmbopen
231
232
S-BOOT # help sdcard_read
233
* Help : sdcard_read
234
* Usage : sdcard_read test command
235 7 Denis 'GNUtoo' Carikli
236 2 Denis 'GNUtoo' Carikli
S-BOOT # help sdcard
237
* Help : sdcard
238
* Usage : sdcard test command
239 7 Denis 'GNUtoo' Carikli
240 2 Denis 'GNUtoo' Carikli
S-BOOT # help fuelgauge
241
* Help : fuelgauge
242
* Usage : *usage : fuelgauge
243
244
S-BOOT # help usb_write
245
* Help : usb_write
246
* Usage : usb_write reg, val
247
Read the usb ic register
248
249
S-BOOT # help usb_read
250
* Help : usb_read
251
* Usage : usb_read reg
252
Read the usb ic register
253 3 Denis 'GNUtoo' Carikli
254
S-BOOT # 
255
</pre>
256
257 7 Denis 'GNUtoo' Carikli
h2. Changing the kernel commandline arguments
258
259
By default we have console=ram and loglevel=4:
260 3 Denis 'GNUtoo' Carikli
<pre>
261 7 Denis 'GNUtoo' Carikli
S-BOOT # printenv
262
: REBOOT_MODE: 0
263
: SWITCH_SEL: 1
264
: DEBUG_LEVEL: 20300
265
: SUD_MODE: 0
266
: DN_ERROR: 0
267
: CHECKSUM: 3
268
: INT_RSVD6: 1
269
: INT_RSVD7: 0
270
: INT_RSVD8: 0
271
: INT_RSVD9: 0
272
: CMDLINE: console=ram loglevel=4
273
: STR_RSVD1: (null)
274
: STR_RSVD2: (null)
275
</pre>
276
277
However if we change that:
278
<pre>
279 3 Denis 'GNUtoo' Carikli
S-BOOT # setenv CMDLINE console=ram loglevel=8
280
argv[0]: setenv
281
argv[1]: CMDLINE
282
argv[2]: console=ram loglevel=8
283
S-BOOT # printenv
284
: REBOOT_MODE: 0
285 1 Denis 'GNUtoo' Carikli
: SWITCH_SEL: 1
286 3 Denis 'GNUtoo' Carikli
: DEBUG_LEVEL: 20300
287
: SUD_MODE: 0
288 7 Denis 'GNUtoo' Carikli
: DN_ERROR: 0
289 3 Denis 'GNUtoo' Carikli
: CHECKSUM: 3
290
: INT_RSVD6: 1
291
: INT_RSVD7: 0
292
: INT_RSVD8: 0
293
: INT_RSVD9: 0
294
: CMDLINE: console=ram loglevel=8
295
: STR_RSVD1: (null)
296
: STR_RSVD2: (null)
297
S-BOOT # saveenv
298 1 Denis 'GNUtoo' Carikli
S-BOOT # reset
299
s5p_restart_handler ('N':null)
300 3 Denis 'GNUtoo' Carikli
301 7 Denis 'GNUtoo' Carikli
PMIC rev = PASS2(4)
302
[...]
303 3 Denis 'GNUtoo' Carikli
</pre>
304
305 7 Denis 'GNUtoo' Carikli
Then after boot we can observe that the cmdline has changed:
306 4 Denis 'GNUtoo' Carikli
<pre>
307
$ adb root
308
$ adb shell
309
root@i9300:/ # cat /proc/cmdline                                               
310 1 Denis 'GNUtoo' Carikli
console=ttySAC2,115200 consoleblank=0 androidboot.hardware=smdk4x12 console=ram loglevel=8 [...]
311 4 Denis 'GNUtoo' Carikli
</pre>
312
313 7 Denis 'GNUtoo' Carikli
After complete power off (with battery removal) and power on, we can see that the modified cmdline has sticked:
314 5 Denis 'GNUtoo' Carikli
<pre>
315
S-BOOT # printenv
316
: REBOOT_MODE: 0
317
: SWITCH_SEL: 1
318
: DEBUG_LEVEL: 20300
319
: SUD_MODE: 0
320
: DN_ERROR: 0
321
: CHECKSUM: 3
322
: INT_RSVD6: 1
323
: INT_RSVD7: 0
324
: INT_RSVD8: 0
325
: INT_RSVD9: 0
326
: CMDLINE: console=ram loglevel=8
327
: STR_RSVD1: (null)
328
: STR_RSVD2: (null)
329
</pre>
330 9 Denis 'GNUtoo' Carikli
331
h2. Other commands
332
333
<pre>
334
S-BOOT # chipinfo
335
5VF4_0023_0190_0178
336
</pre>
337 10 Denis 'GNUtoo' Carikli
338
This seem to give the bootloader log including what the input and output of the commands the user typed:
339
<pre>
340
S-BOOT # log
341
PMIC rev = PASS2(4)
342
BUCK1OUT(vdd_mif) = 0x05
343
BUCK3DVS1(vdd_int) = 0x20
344
[MMC] there are pending interrupts 0x00010000
345
cardtype: 0x00000007
346
SB_MMC_HS_52MHZ_1_8V_3V_IO
347
mmc->card_caps: 0x00000311
348
mmc->host_caps: 0x00000311
349
mmc_initialize: mmc->capacity = 30777344
350
351
Samsung S-Boot 4.0-2836504 for GT-I9300 (Jun 15 2015 - 22:47:58)
352
353
EXYNOS4412(EVT 1.1) / 1022MB / 15028MB / Rev 12 / I9300XXUGOF1 /(PKG_ID 0x7050008)
354
355
- read_bl1
356
pit_check_signature (PIT) valid.
357
initialize_ddi_data: usable! (3:0xf)
358
PARAM ENV VERSION: v1.0..
359
set_charger_current: chg curr(3f), in curr(17)
360
set_charger_state: buck(1), chg(1), reg(0x05)
361
microusb_get_attached_device: STATUS1:0x3d, 2:0x00
362
set_auto_current: ta_state(0), curr(1000)
363
init_fuelgauge: fuelgauge power ok
364
init_fuelgauge: POR status
365
fuelgauge_por: POR start: vcell(4146), vfocv(4256), soc(108)
366
fuelgauge_por: update SDI M0 parameter
367
fuelgauge_por: RCOMP(0x0065), TEMPCO(0x0930)
368
fuelgauge_por: POR finish: vcell(4140), vfocv(4405), soc(94)
369
get_table_soc: vcell(4138) is caculated to t-soc(89.939)
370
init_fuelgauge: start: vcell(4138), vfocv(4396), soc(94), table soc(89)
371
init_fuelgauge: finish: vcell(4138), vfocv(4396), soc(94), table soc(89)
372
init_microusb_ic: MUIC: CONTROL1:0x1b
373
init_microusb_ic: MUIC: CONTROL1:0x1b
374
init_microusb_ic: MUIC: CONTROL2:0x3b
375
init_microusb_ic: MUIC: CONTROL2:0x3b
376
PMIC_ID      = 0x02 
377
PMIC_IRQSRC  = 0x00 
378
PMIC_IRQ1    = 0x04 
379
PMIC_IRQ2    = 0x00 
380
PMIC_IRQ1M   = 0xc0 
381
PMIC_IRQ2M   = 0x03 
382
PMIC_STATUS1 = 0x10 
383
PMIC_STATUS2 = 0x00 
384
PMIC_PWRON   = 0x02 
385
PMIC_RTCINT  = 0x10 
386
PMIC_RTCINTM = 0x3f 
387
s5p_check_keypad: 0x1000000
388
s5p_check_reboot_mode: INFORM3 = 0 ... skip
389
s5p_check_upload: MAGIC(0x275b3bbb), RST_STAT(0x10000)
390
microusb_get_attached_device: STATUS1:0x3d, 2:0x00
391
s5p_check_download: 0
392
microusb_get_attached_device: STATUS1:0x3d, 2:0x00
393
check_pm_status: non chargable jig, bypass check power
394
cmu_div:1, div:7, src_clk:800000000, pixel_clk:57153600
395
s5p_dsim_display_config : VIDEO MODE
396
a2, 60, 90, 
397
398
autoboot aborted..
399
S-BOOT # S-BOOT # S-BOOT # S-BOOT # S-BOOT # S-BOOT # S-BOOT # S-BOOT # S-BOOT # Following commands are supported:
400
* chipinfo
401
* help
402
* log
403
* load_kernel
404
* boot
405
* reset
406
* findenv
407
* saveenv
408
* setenv
409
* printenv
410
</pre>
411 11 Denis 'GNUtoo' Carikli
412
The battery fuel gauge. Note that soc probably means state of charge, not system on a chip:
413
<pre>
414
S-BOOT # fuelgauge
415
fuelgauge_cmd: vcell(4007), vfocv(4157), soc(86)
416
</pre>
417 12 Denis 'GNUtoo' Carikli
418
h2. Boot modes
419
420
"sec-reboot.c":https://git.replicant.us/replicant/kernel_samsung_smdk4412/tree/arch/arm/mach-exynos/sec-reboot.c#n107 has the following code:
421
<pre>
422
		if (!strcmp(cmd, "fota"))
423
			writel(REBOOT_MODE_PREFIX | REBOOT_MODE_FOTA,
424
			       S5P_INFORM3);
425
		else if (!strcmp(cmd, "fota_bl"))
426
			writel(REBOOT_MODE_PREFIX | REBOOT_MODE_FOTA_BL,
427
			       S5P_INFORM3);
428
		else if (!strcmp(cmd, "recovery"))
429
			writel(REBOOT_MODE_PREFIX | REBOOT_MODE_RECOVERY,
430
			       S5P_INFORM3);
431
		else if (!strcmp(cmd, "bootloader"))
432
			writel(REBOOT_MODE_PREFIX | REBOOT_MODE_DOWNLOAD,
433
			       S5P_INFORM3);
434
		else if (!strcmp(cmd, "download"))
435
			writel(REBOOT_MODE_PREFIX | REBOOT_MODE_DOWNLOAD,
436
			       S5P_INFORM3);
437
		else if (!strcmp(cmd, "upload"))
438
			writel(REBOOT_MODE_PREFIX | REBOOT_MODE_UPLOAD,
439
			       S5P_INFORM3);
440
		else if (!strncmp(cmd, "debug", 5)
441
			 && !kstrtoul(cmd + 5, 0, &value))
442
			writel(REBOOT_SET_PREFIX | REBOOT_SET_DEBUG | value,
443
			       S5P_INFORM3);
444
		else if (!strncmp(cmd, "swsel", 5)
445
			 && !kstrtoul(cmd + 5, 0, &value))
446
			writel(REBOOT_SET_PREFIX | REBOOT_SET_SWSEL | value,
447
			       S5P_INFORM3);
448
		else if (!strncmp(cmd, "sud", 3)
449
			 && !kstrtoul(cmd + 3, 0, &value))
450
			writel(REBOOT_SET_PREFIX | REBOOT_SET_SUD | value,
451
			       S5P_INFORM3);
452
		else if (!strncmp(cmd, "emergency", 9))
453
			writel(0, S5P_INFORM3);
454
		else
455
			writel(REBOOT_MODE_PREFIX | REBOOT_MODE_NONE,
456
			       S5P_INFORM3);
457
</pre>
458
459 13 Denis 'GNUtoo' Carikli
We can test them with @reboot <rebootcommand>@. Here are the results:
460 12 Denis 'GNUtoo' Carikli
461
| Device | Command | Comments |
462 14 Denis 'GNUtoo' Carikli
|/10. Galaxy SIII (GT-I9300) | fota       | Reboots and adds bootmode=3 to the kernel command line (/proc/cmdline) |
463
                             | fota_bl    | * Reboots
464 15 Denis 'GNUtoo' Carikli
                                            * No kernel command line change
465
                                            * 'bl' might mean bootloader |
466 14 Denis 'GNUtoo' Carikli
                             | recovery   | reboots to the recovery |
467 1 Denis 'GNUtoo' Carikli
                             | bootloader | reboot in Thor mode |
468
                             | download   | reboot in Thor mode |
469 15 Denis 'GNUtoo' Carikli
                             | upload     | * Reboots
470
                                            * No kernel command line change |
471
                             | debug      | * Reboots
472
                                            * No kernel command line change |
473
                             | swsel      | * Reboots
474
                                            * No kernel command line change |
475
                                            * might be related to the bootloader swsel command |
476
                             | sud        | * Reboots
477
                                            * No kernel command line change |
478
                             | emergency  | * Reboots
479
                                            * No kernel command line change |