Me when the when me me

This commit is contained in:
Crystal 2024-04-12 19:51:59 +01:00
parent 7fdc20eb45
commit a9504fe442
2 changed files with 282 additions and 0 deletions

191
blog/misc/merlin.html Normal file
View File

@ -0,0 +1,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>

View File

@ -0,0 +1,91 @@
#+title: ON MERLIN'S BEARD
#+OPTIONS: ^:{}
#+AUTHOR: Crystal for my sloth
#+OPTIONS: num:nil
#+EXPORT_FILE_NAME: ../../../../blog/misc/merlin.html
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../../src/css/colors.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../../src/css/style.css"/>
#+OPTIONS: html-style:nil
#+OPTIONS: toc:nil
#+HTML_HEAD: <link rel="icon" type="image/x-icon" href="../../../favicon.png">
#+HTML_LINK_HOME: https://crystal.tilde.institute/
Let's say, hypothetically, you have a *Xiaomi Redmi Note 9* (codenamed *Merlin*), and we would assume that it's broken in a way that it shows the *Xiaomi logo* only then reboots/shuts-down, your first solution would be "Oh let's take it to a repairshop, they would fix it" but why do so when you could fix it at home, alone, with the help of this little guide.
* Axioms :
We will assume the following things :
- You have a Redmi Note 9...or any Redmi, but some steps WILL vary ever so slightly.
- The phone at least gives a sign of life, the Xiaomi logo is well enough.
- You have a PC, preferably running the second best OS known to mankind, *Linux !!!*. If you are not running Linux, a good start is *Ubuntu* (we will assume the usage of a *Debian*-based distro here, if you use anything other than them, you are probably smart enough to figure this shit yourself)
- You have a good USB-C cable.
- You have a working brain.
* Step Uno : Downloading the required files and the medkits :
** android-tools :
#+BEGIN_SRC sh
sudo apt update
sudo apt install android-tools-adb android-tools-fastboot
#+END_SRC
** mtkclient and it's dependencies :
*** Dependencies :
#+BEGIN_SRC sh
sudo apt install python3 git libusb-1.0-0 python3-pip
#+END_SRC
*** Grab the files :
#+BEGIN_SRC shell
git clone https://github.com/bkerler/mtkclient
cd mtkclient
pip3 install .
#+END_SRC
*** Install rules :
#+BEGIN_SRC shell
sudo usermod -a -G plugdev $USER
sudo usermod -a -G dialout $USER
sudo cp mtkclient/Setup/Linux/*.rules /etc/udev/rules.d
sudo udevadm control -R
#+END_SRC
and do *NOT* forget to reboot, otherwise you will face errors.
** Fastboot image :
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 *Global* fastboot image, note that the difference between *Global* , *EEA (European Economic Area)* , *Turkish* , *Russian* and *Taiwan* 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 *Chinese* one, it'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's up to you!
We will be using this one https://xiaomifirmwareupdater.com/miui/merlin/stable/V13.0.2.0.SJOMIXM/ which is the Global version of miui. Make sure to scroll all the way *Down* and download the one with *Type: Fastboot*, it will be larger in size, but it'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's a big archive so it will take time.
** Meanwhile, mtkclient :
While waiting for your download to finish, go to your mtkclient folder and run this command:
#+BEGIN_SRC shell
python mtk_gui
#+END_SRC
this should bring up the GUI client, if it doesn't, replace *python* with *python3*. Once it's running, make sure your phone is powered-off, and plug the USB-C cable into your PC *While holding both the Up and Down volume buttons* 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 *sudo*.
Now explore the app but do *NOT* touch anything with the word *Write* or *Erase*, also the ones with *Read* are useless for you, what is important is looking for the *Unlock bootloader* button, click on it, and wait until it's okay, then remove your phone from the cable. aaaand we shoould be done for this part.
** The Fun Part :
Once the fastboot image is downloaded and extracted, go to the folder and look for this file *flash_all_except_storage.sh* this will be the one you would need.
*DO NOT EVER EVER EVER, UNDER ANY CASE, TOUCH A FILE THAT HAS THE WORD LOCK IN IT.*
Once you located this file, open a terminal there, and give it exec permissions. Or in other words :
#+BEGIN_SRC shell
chmod +x ./flash_all_except_storage.sh
#+END_SRC
and now take your phone *again* and now Power it on while holding the *Vol DOWN* button, keep that position until you see a *fastboot* screen, or a Russian robot rewiring the organs of it's victim.
Once you see it, plug the phone to the pc, and run
#+BEGIN_SRC shell
sudo fastboot devices
#+END_SRC
sudo might not be needed for you, but i dont know why, it never worked for me without sudo (probably the rules step)
Once you see your device in there, it means it recognized it, go again to the folder with *flash_all_except_storage* and run it
#+BEGIN_SRC shell
sudo ./flash_all_except_storage.sh
#+END_SRC
** Waiting :
This step takes a lot of time, so be sure to let your pc in a place where you don't risk accidentally moving your phone and disconnecting it. DO NOT CLOSE THE TERMINAL, once it's finished, it should reboot automatically and voila !! good as knew, and you might even keep your local files if you provide your password
* Edge cases :
- If the initial setup (after the reboot) doesn't work, try the flash_all.sh file instead.