summary refs log tree commit diff stats
path: root/blog/misc/merlin.html
blob: ec7f975adb0287b09d4733a36d7568fd20287963 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2024-04-12 Fri 19:51 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>ON MERLIN'S BEARD</title>
<meta name="author" content="Crystal for my sloth" />
<meta name="generator" content="Org Mode" />
<link rel="stylesheet" type="text/css" href="../../src/css/colors.css"/>
<link rel="stylesheet" type="text/css" href="../../src/css/style.css"/>
<link rel="icon" type="image/x-icon" href="../../../favicon.png">
</head>
<body>
<div id="org-div-home-and-up">
 <a accesskey="h" href=""> UP </a>
 |
 <a accesskey="H" href="https://crystal.tilde.institute/"> HOME </a>
</div><div id="content" class="content">
<h1 class="title">ON MERLIN&rsquo;S BEARD</h1>
<p>
Let&rsquo;s say, hypothetically, you have a <b>Xiaomi Redmi Note 9</b> (codenamed <b>Merlin</b>), and we would assume that it&rsquo;s broken in a way that it shows the <b>Xiaomi logo</b> only then reboots/shuts-down, your first solution would be &ldquo;Oh let&rsquo;s take it to a repairshop, they would fix it&rdquo; but why do so when you could fix it at home, alone, with the help of this little guide.
</p>
<div id="outline-container-org88c83c3" class="outline-2">
<h2 id="org88c83c3">Axioms :</h2>
<div class="outline-text-2" id="text-org88c83c3">
<p>
We will assume the following things :
</p>
<ul class="org-ul">
<li>You have a Redmi Note 9&#x2026;or any Redmi, but some steps WILL vary ever so slightly.</li>
<li>The phone at least gives a sign of life, the Xiaomi logo is well enough.</li>
<li>You have a PC, preferably running the second best OS known to mankind, <b>Linux !!!</b>. If you are not running Linux, a good start is <b>Ubuntu</b> (we will assume the usage of a <b>Debian</b>-based distro here, if you use anything other than them, you are probably smart enough to figure this shit yourself)</li>
<li>You have a good USB-C cable.</li>
<li>You have a working brain.</li>
</ul>
</div>
</div>
<div id="outline-container-org0e634c8" class="outline-2">
<h2 id="org0e634c8">Step Uno : Downloading the required files and the medkits :</h2>
<div class="outline-text-2" id="text-org0e634c8">
</div>
<div id="outline-container-orgdbc8e67" class="outline-3">
<h3 id="orgdbc8e67">android-tools :</h3>
<div class="outline-text-3" id="text-orgdbc8e67">
<div class="org-src-container">
<pre class="src src-sh"><span style="color: #f9e2af;">sudo</span> apt update
<span style="color: #f9e2af;">sudo</span> apt install android-tools-adb android-tools-fastboot
</pre>
</div>
</div>
</div>
<div id="outline-container-orga65ea6a" class="outline-3">
<h3 id="orga65ea6a">mtkclient and it&rsquo;s dependencies :</h3>
<div class="outline-text-3" id="text-orga65ea6a">
</div>
<div id="outline-container-orgcbafb81" class="outline-4">
<h4 id="orgcbafb81">Dependencies :</h4>
<div class="outline-text-4" id="text-orgcbafb81">
<div class="org-src-container">
<pre class="src src-sh"><span style="color: #f9e2af;">sudo</span> apt install python3 <span style="color: #f9e2af;">git</span> libusb-1.0-0 python3-pip
</pre>
</div>
</div>
</div>
<div id="outline-container-org4a33127" class="outline-4">
<h4 id="org4a33127">Grab the files :</h4>
<div class="outline-text-4" id="text-org4a33127">
<div class="org-src-container">
<pre class="src src-shell"><span style="color: #f9e2af;">git</span> clone https://github.com/bkerler/mtkclient
<span style="color: #f9e2af;">cd</span> mtkclient
pip3 install .
</pre>
</div>
</div>
</div>
<div id="outline-container-orge0a0f85" class="outline-4">
<h4 id="orge0a0f85">Install rules :</h4>
<div class="outline-text-4" id="text-orge0a0f85">
<div class="org-src-container">
<pre class="src src-shell"><span style="color: #f9e2af;">sudo</span> usermod -a -G plugdev $<span style="color: #cdd6f4;">USER</span>
<span style="color: #f9e2af;">sudo</span> usermod -a -G dialout $<span style="color: #cdd6f4;">USER</span>
<span style="color: #f9e2af;">sudo</span> <span style="color: #f9e2af;">cp</span> mtkclient/Setup/Linux/*.rules /etc/udev/rules.d
<span style="color: #f9e2af;">sudo</span> udevadm control -R
</pre>
</div>
<p>
and do <b>NOT</b> forget to reboot, otherwise you will face errors.
</p>
</div>
</div>
</div>
<div id="outline-container-org283a105" class="outline-3">
<h3 id="org283a105">Fastboot image :</h3>
<div class="outline-text-3" id="text-org283a105">
<p>
Personally, I prefer to use a custom ROM for these XIMI phones, but since this is a fool-proof guide, we will use the latest <b>Global</b> fastboot image, note that the difference between <b>Global</b> , <b>EEA (European Economic Area)</b> , <b>Turkish</b> , <b>Russian</b> and <b>Taiwan</b> ROMS are little though the Global version is most of the time behind the other ones in terms of updates , but the biggest one comes with the <b>Chinese</b> one, it&rsquo;s more polished, runs faster, but is filled with Chinese-only apps, and does not have Google services (which is a huge W for me). But at the end of the day, it&rsquo;s up to you!
</p>

<p>
We will be using this one <a href="https://xiaomifirmwareupdater.com/miui/merlin/stable/V13.0.2.0.SJOMIXM/">https://xiaomifirmwareupdater.com/miui/merlin/stable/V13.0.2.0.SJOMIXM/</a> which is the Global version of miui. Make sure to scroll all the way <b>Down</b> and download the one with <b>Type: Fastboot</b>, it will be larger in size, but it&rsquo;s the one we need. Use any mirror that you want, and wait patiently for it to download. Once it finishes, extract it to a folder, it&rsquo;s a big archive so it will take time.
</p>
</div>
</div>
<div id="outline-container-org4addd56" class="outline-3">
<h3 id="org4addd56">Meanwhile, mtkclient :</h3>
<div class="outline-text-3" id="text-org4addd56">
<p>
While waiting for your download to finish, go to your mtkclient folder and run this command:
</p>
<div class="org-src-container">
<pre class="src src-shell">python mtk_gui
</pre>
</div>
<p>
this should bring up the GUI client, if it doesn&rsquo;t, replace <b>python</b> with <b>python3</b>. Once it&rsquo;s running, make sure your phone is powered-off, and plug the USB-C cable into your PC <b>While holding both the Up and Down volume buttons</b> until you see a change in the GUI app. If you notice a red error message on the console which will be running in the background, relaunch using <b>sudo</b>.
</p>

<p>
Now explore the app but do <b>NOT</b> touch anything with the word <b>Write</b> or <b>Erase</b>, also the ones with <b>Read</b> are useless for you, what is important is looking for the <b>Unlock bootloader</b> button, click on it, and wait until it&rsquo;s okay, then remove your phone from the cable. aaaand we shoould be done for this part.
</p>
</div>
</div>
<div id="outline-container-org25169bd" class="outline-3">
<h3 id="org25169bd">The Fun Part :</h3>
<div class="outline-text-3" id="text-org25169bd">
<p>
Once the fastboot image is downloaded and extracted, go to the folder and look for this file <b>flash_all_except_storage.sh</b> this will be the one you would need.
</p>

<p>
<b>DO NOT EVER EVER EVER, UNDER ANY CASE, TOUCH A FILE THAT HAS THE WORD LOCK IN IT.</b>
</p>

<p>
Once you located this file, open a terminal there, and give it exec permissions. Or in other words :
</p>
<div class="org-src-container">
<pre class="src src-shell"><span style="color: #f9e2af;">chmod</span> +x ./flash_all_except_storage.sh
</pre>
</div>
<p>
and now take your phone <b>again</b> and now Power it on while holding the <b>Vol DOWN</b> button, keep that position until you see a <b>fastboot</b> screen, or a Russian robot rewiring the organs of it&rsquo;s victim.
</p>

<p>
Once you see it, plug the phone to the pc, and run
</p>
<div class="org-src-container">
<pre class="src src-shell"><span style="color: #f9e2af;">sudo</span> fastboot devices
</pre>
</div>
<p>
sudo might not be needed for you, but i dont know why, it never worked for me without sudo (probably the rules step)
</p>

<p>
Once you see your device in there, it means it recognized it, go again to the folder with <b>flash_all_except_storage</b> and run it
</p>
<div class="org-src-container">
<pre class="src src-shell"><span style="color: #f9e2af;">sudo</span> ./flash_all_except_storage.sh
</pre>
</div>
</div>
</div>
<div id="outline-container-org95f8d76" class="outline-3">
<h3 id="org95f8d76">Waiting :</h3>
<div class="outline-text-3" id="text-org95f8d76">
<p>
This step takes a lot of time, so be sure to let your pc in a place where you don&rsquo;t risk accidentally moving your phone and disconnecting it. DO NOT CLOSE THE TERMINAL, once it&rsquo;s finished, it should reboot automatically and voila !! good as knew, and you might even keep your local files if you provide your password
</p>
</div>
</div>
</div>
<div id="outline-container-org1a283a8" class="outline-2">
<h2 id="org1a283a8">Edge cases :</h2>
<div class="outline-text-2" id="text-org1a283a8">
<ul class="org-ul">
<li>If the initial setup (after the reboot) doesn&rsquo;t work, try the flash_all.sh file instead.</li>
</ul>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Crystal for my sloth</p>
<p class="date">Created: 2024-04-12 Fri 19:51</p>
</div>
</body>
</html>