Project

General

Profile

RecoveryInstallationWithHeimdall » History » Version 77

dl lud, 06/30/2020 02:02 PM
Add workaround for Secure Download Mode Enabled.

1 58 Mark Matney
h1. Recovery image installation or update with Heimdall
2 1 Denis 'GNUtoo' Carikli
3 59 Mark Matney
These instructions explain how to install the [[RecoveryImage|Replicant recovery image]] to your device. This procedure is part of [[ReplicantInstallation|the larger procedure of installing Replicant]].
4 1 Denis 'GNUtoo' Carikli
5 59 Mark Matney
{{TOC}}
6 1 Denis 'GNUtoo' Carikli
7 59 Mark Matney
h2. Prerequisites
8
9
h3. Applicable devices
10
11 1 Denis 'GNUtoo' Carikli
This guide applies only to the following devices:
12 74 Denis 'GNUtoo' Carikli
* [[GalaxyS2I9100|Galaxy S II (GT-I9100)]]
13
* [[GalaxyS3I9300|Galaxy S III (GT-I9300)]]
14
* [[GalaxyS3I9305|Galaxy S III 4G (GT-I9305)]]
15
* [[GalaxyNexusI9250|Galaxy Nexus (GT-I9250)]]
16
* [[GalaxyNoteN7000|Galaxy Note (GT-N7000)]]
17
* [[GalaxyNote2N7100|Galaxy Note 2 (GT-N7100)]]
18
* [[GalaxyTab270P31xx|Galaxy Tab 2 7.0 (GT-P3100)]]
19
* [[GalaxyTab270P31xx|Galaxy Tab 2 7.0 Wi-Fi (GT-P3110)]]
20
* [[GalaxyTab2101P51xx|Galaxy Tab 2 10.1 (GT-P5100)]]
21
* [[GalaxyTab2101P51xx|Galaxy Tab 2 10.1 Wi-Fi (GT-P5110)]]
22
* [[GalaxyNote80N51xx|Galaxy Note 8.0 (GT-N5100)]]
23
* [[GalaxyNote80N51xx|Galaxy Note 8.0 Wi-Fi (GT-N5110)]]
24 1 Denis 'GNUtoo' Carikli
25 66 Mark Matney
If you use these instructions with a device not listed above, there is a significant risk of ""bricking" your device":https://en.wikipedia.org/wiki/Brick_(electronics).
26 1 Denis 'GNUtoo' Carikli
27 59 Mark Matney
h3. Personal computer
28
29
In order to install the recovery image on your device, it is assumed that you have a computer running a GNU/Linux operating system and everything necessary to connect your device to the computer through USB.
30
31
Moreover, it is assumed that anyone performing the installation knows how to use the command line in a terminal and has basic knowledge about it.
32 1 Denis 'GNUtoo' Carikli
33 67 Mark Matney
h2. Install heimdall
34 63 Mark Matney
35 71 Denis 'GNUtoo' Carikli
The heimdall tool is required to flash (install) the recovery image to your device.
36
37 72 Denis 'GNUtoo' Carikli
If you don't already have heimdall you can use the instructions on the [[ToolsInstallation]] page to install all the required tools.
38 63 Mark Matney
39 67 Mark Matney
h2. Download the files
40 1 Denis 'GNUtoo' Carikli
41 73 Denis 'GNUtoo' Carikli
First find the section for the Replicant version you want to install. 
42 1 Denis 'GNUtoo' Carikli
43 73 Denis 'GNUtoo' Carikli
For instance if you want to install Replicant 6.0 0003, go in the [[Images#Replicant-60-0003-images|Replicant 6.0 0003 section]].
44
45
Then find the @Security@ subsection and download the GPG signing key for that release.
46
47
Then, you need to find the @Images@ subsection, and, inside it find the in the row that corresponds to your device.
48
49
Inside that row, there are links to the recovery image and the corresponding signature, which are in that row under the column *Bootable/recovery*.
50
51
You need to download both files to your PC.
52
53
For example, if you want to install Replicant to a [[GalaxyS2I9100|Galaxy S II (GT-I9100)]], you will download *recovery-i9100.img* and *recovery-i9100.img.asc*.
54 61 Mark Matney
55 67 Mark Matney
h2. Check the signature of the recovery image
56 1 Denis 'GNUtoo' Carikli
57 62 Mark Matney
First, [[ReplicantReleaseKey#Retrieving-the-Replicant-release-key|add the Replicant release key to your GPG keyring]].
58
59
Then, from the command line:
60
61
# Change directories to the location of the recovery image and its signature (the location of the files may differ depending on your system setup):
62 1 Denis 'GNUtoo' Carikli
<pre>
63
cd "${HOME}/Downloads/"
64 56 Mark Matney
</pre>
65 62 Mark Matney
# Check the signature of the recovery with the following command, substituting "<yourdevice>" with your device's identifier:
66 1 Denis 'GNUtoo' Carikli
<pre>
67
gpg --verify recovery-<yourdevice>.img.asc
68
</pre>
69
70
Unless GPG reports something to the effect of a "good signature" from [[ReplicantReleaseKey#Which-key-for-which-Replicant-version|the expected key]], *do not continue*! Your downloaded files may be corrupted or compromised.
71
72 67 Mark Matney
h2. Prepare the device
73 1 Denis 'GNUtoo' Carikli
74
The next step in the installation process is to prepare the device for heimdall mode.
75
76 56 Mark Matney
# Make sure the device is completely turned off and the USB cable is disconnected from the device
77
# Remove the device's "external case":https://en.wikipedia.org/wiki/Mobile_phone_accessories#Cases or protection if it has one.
78 1 Denis 'GNUtoo' Carikli
79 68 Mark Matney
There are a few additional steps to follow, depending on which device you have.
80
81 75 Denis 'GNUtoo' Carikli
h3. Galaxy Nexus (GT-I9250)
82 1 Denis 'GNUtoo' Carikli
83 75 Denis 'GNUtoo' Carikli
If your device is the Galaxy Nexus (GT-I9250):
84 56 Mark Matney
85
# Start the device by holding the following key combination:  *Volume down, Power*.
86
# Hold the key combination until the device shows a green "Start".
87
88 76 Denis 'GNUtoo' Carikli
h3. Galaxy Tab 2
89
90
If your device is one of the following devices:
91
* Galaxy Tab 2 7.0 (GT-P3100)
92
* Galaxy Tab 2 7.0 Wi-Fi (GT-P3110)
93
* Galaxy Tab 2 10.1 (GT-P5100)
94
* Galaxy Tab 2 10.1 Wi-Fi (GT-P5110)
95
96
# Start the device by holding the following key combination:  *Volume down, Power*.
97
# Hold the key combination until the device shows a *Warning* message.
98
# Confirm that you want to download a custom OS using volume up
99
# Make sure the device is in *Downloading* mode
100
101
You can then connect the USB cable to both the computer and the device
102
103 56 Mark Matney
h3. All other devices
104
105
For all other devices:
106
107
# Start the device by holding the following key combination: *Volume down, Select, Power*,
108
# Hold the key combination until the device shows a *Warning* message.
109
# Confirm that you want to download a custom OS using volume up
110
# Make sure the device is in *Downloading* mode
111 33 Denis 'GNUtoo' Carikli
112 39 Denis 'GNUtoo' Carikli
You can then connect the USB cable to both the computer and the device
113
114 67 Mark Matney
h2. Flash the recovery image
115 1 Denis 'GNUtoo' Carikli
116 69 Mark Matney
For instructions on installing the recovery image on your device for the first time, proceed to the section on [[RecoveryInstallationWithHeimdall#Install-the-recovery-image|installing the recovery]].
117 1 Denis 'GNUtoo' Carikli
118 69 Mark Matney
Otherwise, for instructions on updating the recovery image on your device, proceed to the section on [[RecoveryInstallationWithHeimdall#Upgrade-the-recovery-image|upgrading the recovery]].
119 1 Denis 'GNUtoo' Carikli
120 67 Mark Matney
h3. Install the recovery image
121 1 Denis 'GNUtoo' Carikli
122
When installing or upgrading Replicant, use the commands in the table below. This will make sure that the device is rebooted right into the recovery. It does that by also installing the recovery in the boot partition.
123
124 69 Mark Matney
If instead you only want to upgrade an existing recovery, use the commands in the section on [[RecoveryInstallationWithHeimdall#Upgrade-the-recovery-image|upgrading the recovery]].
125 1 Denis 'GNUtoo' Carikli
126 65 Mark Matney
Once in the recovery you can then proceed to the installation or s.
127 1 Denis 'GNUtoo' Carikli
128 65 Mark Matney
|_. Devices |_. Command for installing the recovery image |
129 1 Denis 'GNUtoo' Carikli
|_. Galaxy Nexus (I9250) |  <pre>heimdall flash --boot path/to/recovery-<yourdevice>.img --recovery path/to/recovery-<yourdevice>.img</pre> |
130
|_. Galaxy S 3 (I9300) |/5. <pre>heimdall flash --BOOT path/to/recovery-<yourdevice>.img --RECOVERY path/to/recovery-<yourdevice>.img</pre> |
131
|_. Galaxy S 3 4G (I9305) |
132
|_. Galaxy Note 2 (N7100) |
133
|_. Galaxy Note 8.0 (N5100) |
134
|_. Galaxy Note 8.0 Wi-Fi (N5110) |
135
|_. Galaxy S 2 (I9100) |/6. <pre>heimdall flash --KERNEL path/to/recovery-<yourdevice>.img --RECOVERY path/to/recovery-<yourdevice>.img</pre> |
136
|_. Galaxy Note (N7000) |
137
|_. Galaxy Tab 2 7.0 (P3100) |
138
|_. Galaxy Tab 2 7.0 Wi-Fi (P3110) |
139
|_. Galaxy Tab 2 10.1 (P5100) |
140
|_. Galaxy Tab 2 10.1 Wi-Fi (P5110) |
141 65 Mark Matney
142
If your device reboots into the recovery OS, *you have successfully installed the Replicant recovery*. Proceed with the remaining [[ReplicantInstallation|installation instructions]], or with the [[MinorVersionUpgrade|minor version upgrade instructions]] if you are upgrading an existing Replicant installation.
143
144
Otherwise, see the section on [[RecoveryInstallationWithHeimdall#Troubleshooting|troubleshooting]].
145
146 67 Mark Matney
h3. Upgrade the recovery image
147 65 Mark Matney
148
If you only want to update the recovery, without updating or installing Replicant, use the commands in the this section. This will make sure that your Replicant installation is not modified.
149
150 69 Mark Matney
If instead you are installing Replicant for the first time, use the commands in the section on [[RecoveryInstallationWithHeimdall#Install-the-recovery-image|installing the recovery]].
151 65 Mark Matney
152
The command to update the recovery depends on which device you have. See below.
153
154
h4. Galaxy Nexus (I9250)
155
156
If your device is the Galaxy Nexus (I9250):
157
158
<pre>heimdall flash --recovery path/to/recovery-<yourdevice>.img</pre>
159
160
h4. All other devices
161
162
For all other devices:
163
164
 <pre>heimdall flash --RECOVERY path/to/recovery-<yourdevice>.img</pre>
165 34 Denis 'GNUtoo' Carikli
166
h2. Troubleshooting
167
168
h3. Making sure that the device is connected in download mode
169 35 Denis 'GNUtoo' Carikli
170 34 Denis 'GNUtoo' Carikli
You can run the following command to verify if the device is in download mode:
171
<pre>
172 38 Denis 'GNUtoo' Carikli
lsusb
173 34 Denis 'GNUtoo' Carikli
</pre>
174
175
If it is you will then have one line that will be somewhat similar to that one:
176
<pre>
177
Bus 004 Device 002: ID 04e8:685d Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II] (Download mode)
178
</pre>
179 36 Denis 'GNUtoo' Carikli
180 37 Denis 'GNUtoo' Carikli
h3. Heimdall failing with "ERROR: Protocol initialisation failed!"
181 36 Denis 'GNUtoo' Carikli
182 77 dl lud
It is pretty easy to end up with heimdall failing like that:
183 36 Denis 'GNUtoo' Carikli
<pre>
184
Heimdall v1.4.2
185
186
Copyright (c) 2010-2017 Benjamin Dobell, Glass Echidna
187
http://www.glassechidna.com.au/
188
189
This software is provided free of charge. Copying and redistribution is
190
encouraged.
191
192
If you appreciate this software and you would like to support future
193
development please consider donating:
194
http://www.glassechidna.com.au/donate/
195
196
Initialising connection...
197
Detecting device...
198
Claiming interface...
199
Setting up interface...
200
201
Initialising protocol...
202
ERROR: Protocol initialisation failed!
203
204
Releasing device interface...
205
</pre>
206
207
In that case disconnect and reconnect the USB cable from the computer and try again.
208 54 Denis 'GNUtoo' Carikli
209
If it still fails, make sure that your computer isn't doing resource intensive tasks:
210
* Doing tasks that uses a lot your storage device (HDD, SSD, etc) can easily make the installation of the images fail.
211
212
If it still fails:
213
* Verify if your USB cable is not damaged by trying with another cable if you have one
214 1 Denis 'GNUtoo' Carikli
* Verify if your USB port is not damaged by trying with another port if you have one
215 77 dl lud
216
h3. Heimdall failing when Secure Download is Enabled
217
218
The download mode for more recent devices, like the Galaxy S III GT-I9305, may show the following message in blue:
219
<pre>
220
Secure Download : Enabled
221
</pre>
222
223
This is usually not an issue, but in devices that have never been flashed before, it may prevent flashing. Heimdall will fail with errors like:
224
<pre>
225
Initialising connection...
226
Detecting device...
227
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/028: Input/output error
228
ERROR: Failed to access device. libusb error: -1
229
</pre>
230
or block during the image upload, or even appear to successfully flash with no actual modification taking place.
231
232
This can usually be solved with the following adb command:
233
<pre>
234
adb reboot booloader
235
</pre>
236
This command must be issued when running the installed Android system. In order to use adb you'll have to enable @Android debugging@ in the @Developer settings@.
237
238
Unlike what's expected (a reboot to Download mode), this command will rather trigger a normal reboot, with the device going back to the installed Android system. After this you should power off your phone and use the key combination to enter Download mode. Heimdall flashing should work from then on.