Project

General

Profile

OptimusBlackBootloader » History » Version 11

Paul Kocialkowski, 04/03/2016 08:47 AM

1 1 Paul Kocialkowski
h1. Optimus Black bootloader
2
3
{{>toc}}
4
5 4 Paul Kocialkowski
The Optimus Black comes with a bootrom and a set of two bootloaders. The bootrom is stored read-only on the OMAP3630 SoC chip. It loads the first bootloader, which loads the second bootloader.
6
7
More information on the booting sequence is available on the OMAP36xx Technical Reference Manual section 26 (Initialization).
8 1 Paul Kocialkowski
9
h2. Boot device priority
10
11
According to the OMAP36xx Technical Reference Manual, section 26.4.4.3 (Booting Device List Setup), the OMAP3630 platform will first choose devices to boot from based on the software booting configuration. If no valid software booting configuration is found, it will read the status of the SYS_BOOT pins to determine the boot device priority order.
12
13
h3. Software booting configuration
14
15 9 Paul Kocialkowski
According to the OMAP36xx Technical Reference Manual, section 26.4.4.4 (Software Booting Configuration), the software booting configuration is a data structure stored in scratchpad memory, at address 0x48002910. It is not cleared at reset and can be written with a valid structure before reboot, to take effect.
16 1 Paul Kocialkowski
17
h3. CONTROL_STATUS register
18
19
According to the OMAP36xx Technical Reference Manual, table 13-109 (CONTROL_STATUS), the CONTROL_STATUS register provides the values of the SYS_BOOT pins as sampled at reset time. It is located at address: 0x480022f0.
20
The register value can be read using:
21
<pre>
22
$ devmem 0x480022f0 8
23
0x25
24
</pre>
25
26
h3. SYS_BOOT resistors
27
28 3 Paul Kocialkowski
According to the OMAP36xx Technical Reference Manual, section 26.2.3 (Boot Configuration), the SYS_BOOT[5:0] pins are used to select the boot device priority. SYS_BOOT5 indicates whether peripheral booting is preferred.
29 1 Paul Kocialkowski
30
According to the Optimus Black (P970) Service Manual:
31
!p970_sys_boot.png!
32
33 2 Paul Kocialkowski
Some of the resistors framed on the schematics were found not to be populated on the board. The actual layout is the following:
34
35 3 Paul Kocialkowski
| |_. SYS_BOOT5 |_. SYS_BOOT4 |_. SYS_BOOT3 |_. SYS_BOOT2 |_. SYS_BOOT1 |_. SYS_BOOT0 |
36 2 Paul Kocialkowski
| Pull-up resistor | R316 | N/A | N/A | R314 | N/A | R318 |
37
| Pull-down resistor | R323 | R322 | R321 | N/A | R319 | N/A |
38
| Boolean value | 0 | 0 | 0 | 1 | 0 | 1 |
39
40
h3. First boot device
41
42 8 Paul Kocialkowski
According to the OMAP36xx Technical Reference Manual, section 26.2.3 (Boot Configuration), such a value (0x05) indicates MMC2 as first boot device and USB as second boot device.
43 1 Paul Kocialkowski
44
h2. USB boot
45
46 10 Paul Kocialkowski
With MMC2 as first boot device, there is no immediate and easy way to recover from flashing a non-functional bootloader. With that setup, the bootloader can only be updated from the bootloader itself or the running system, both of which require a working bootloader. This makes it nearly impossible to work on developing a bootloader, which may end up not working for unexpected reasons or during the initial bringup phase.
47
48
The easiest solution for a fail-proof boot method is to switch the boot device priority order to USB boot first. According to the OMAP36xx Technical Reference Manual, section 26.4.5 (Peripheral Booting), the bootrom allows loading an image from USB to the internal SRAM, at address *0x40200000* and will execute it in place. Note that the image must not have any header, unlike memory booting.
49
50
This can be achieved either by a temporary software-only solution or by a permanent hardware-only solution.
51
52
*Note that blanking the contents of MMC2 does not make the bootrom switch automatically to USB boot.*
53
54
h3. Temporary USB boot
55
56 11 Paul Kocialkowski
The [[#Software-booting-configuration|Software booting configuration]] register can be used to temporarily set the boot device priority to USB first, according to the OMAP36xx Technical Reference Manual, section 26.4.4.4 (Software Booting Configuration).
57
58
At this point, there is no readily available software that allows doing this from either the Android or GNU/Linux userspace.
59
60 10 Paul Kocialkowski
h3. Permanent USB boot
61 1 Paul Kocialkowski
62 5 Paul Kocialkowski
h3. Software setup
63 1 Paul Kocialkowski
64
h2. Factory bootloaders
65
66 6 Paul Kocialkowski
h2. U-Boot
67
68 7 Paul Kocialkowski
h2. References
69 1 Paul Kocialkowski
70
* "Optimus Black (P970) Service Manual and Schematics":http://www.cpkb.org/wiki/LG_P970_Optimus_Black_service_manual
71
* "OMAP36xx Technical Reference Manual":http://www.ti.com/lit/pdf/swpu177
72
73
*These documents are the propriety of LG Electronics and Texas Instruments and are not hosted by the Replicant project.*
74
*However, some excerpts from these documents are provided, for the purpose of providing technical evidence of the facts that are mentioned in this page. We believe that this particular use of the copyrighted work is fair use.*