doc:appunti:hardware:xiaomi_mi_a1
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
doc:appunti:hardware:xiaomi_mi_a1 [2018/11/19 17:37] – [Control and Privacy Settings] niccolo | doc:appunti:hardware:xiaomi_mi_a1 [2019/11/09 06:53] – [Fastboot Mode] niccolo | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Xiaomi Mi A1 Android Phone ====== | ====== Xiaomi Mi A1 Android Phone ====== | ||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | ^ RAM | 3.8 Gb | | ||
+ | ^ Internal Memory | ||
+ | ^ CPU | Qualcomm Snapdragon 625 2.0GHz 8-core | ||
+ | ^ Screen | ||
+ | ^ Connector | ||
+ | ^ Audio jack | 3.5 mm | | ||
+ | ^ A/B (Seamless) System Updates | ||
===== How to Gain root Privileges ===== | ===== How to Gain root Privileges ===== | ||
Line 8: | Line 21: | ||
- Install on your PC the **adb** and **fastboot** command line tools. | - Install on your PC the **adb** and **fastboot** command line tools. | ||
- | - **Unlock** the Bootloader. | ||
- **Backup**. | - **Backup**. | ||
+ | - **Unlock** the Bootloader. | ||
- Install a **custom Recovery** program (we used [[https:// | - Install a **custom Recovery** program (we used [[https:// | ||
- Install the **su** binary and an app to manage **superuser privileges** (we used [[https:// | - Install the **su** binary and an app to manage **superuser privileges** (we used [[https:// | ||
Line 55: | Line 68: | ||
< | < | ||
adb shell | adb shell | ||
- | tissot_sprout:/ | + | tissot_sprout:/ |
- | /dev/block/platform/soc/ | + | |
- | cd / | + | |
- | ls -l | + | |
... | ... | ||
lrwxrwxrwx 1 root root 21 1970-07-10 05:23 boot_a -> / | lrwxrwxrwx 1 root root 21 1970-07-10 05:23 boot_a -> / | ||
Line 65: | Line 75: | ||
</ | </ | ||
- | The meaning is: search into **/dev/** for a directory named " | + | The meaning is: search into **/dev/ |
Now we need to **boot** into an environment where we have **root privileges**, | Now we need to **boot** into an environment where we have **root privileges**, | ||
< | < | ||
- | adb reboot-bootloader | + | adb reboot bootloader |
</ | </ | ||
Line 101: | Line 111: | ||
< | < | ||
- | adb reboot-bootloader | + | adb reboot bootloader |
fastboot boot recovery-3.2.1-2-oreo.img | fastboot boot recovery-3.2.1-2-oreo.img | ||
</ | </ | ||
Line 107: | Line 117: | ||
Once that TWRP is started on the phone, swipe to allow writing to the partitions, then choose **Install** and browse to the **Twrp-recoveryInstaller-3.2.1-2-oreo.zip** archive. | Once that TWRP is started on the phone, swipe to allow writing to the partitions, then choose **Install** and browse to the **Twrp-recoveryInstaller-3.2.1-2-oreo.zip** archive. | ||
- | After the installation, | + | After the installation, |
Beware of this: | Beware of this: | ||
{{ .: | {{ .: | ||
- | * **Do not swap Slot A and Slot B**. Some recipes found on the internet say to do that in TWRP (it is from the Reboot menu). I tried it and it was a nightmare! The Reboot menu was stating that the Slot B were active, so I switched to Slot A and installed TWRP. At the next reboot I got a non-working environment: | + | * **Do not swap Slot A and Slot B**. Some recipes found on the internet say to do that in TWRP (it is from the Reboot menu). I tried it and it was a nightmare! The Reboot menu was stating that the Slot B were active, so I switched to Slot A and installed TWRP. At the next reboot I got a non-working environment: |
* **Do not veryfy the ZIP archive**. The archive does not have the required info to check. | * **Do not veryfy the ZIP archive**. The archive does not have the required info to check. | ||
* **Do not wipe the Dalvik cache after the install**. Don't know if it was the culprit, but after installing TWRP, I clicked the button to wipe Dalvik cache, at the next reboot I had a damaged system. The **home button did not work**, the Developer options were no longer availables (// | * **Do not wipe the Dalvik cache after the install**. Don't know if it was the culprit, but after installing TWRP, I clicked the button to wipe Dalvik cache, at the next reboot I had a damaged system. The **home button did not work**, the Developer options were no longer availables (// | ||
Line 119: | Line 129: | ||
{{ .: | {{ .: | ||
- | When rooting an Android device we generally need the **su** binary program (the actual Unix tool used to switch from normal user to root), plus an **app to manage superuser permissions** granted (or denied) to other applications. Historically the most known app for this purpose was **SuperSU** by Chainfire, but something changed. Chainfire [[https:// | + | When rooting an Android device we generally need the **su** binary program (the actual Unix tool used to switch from normal user to root), plus an **app to manage superuser permissions** granted (or denied) to other applications. Historically the most known app for this purpose was **SuperSU** by Chainfire, but something changed. Chainfire [[https:// |
- | The first step is to install the ZIP archive which provides the **su** binary, we already copied the **Magisk-v17.3.zip** file to the phone storag. Let's reboot into TWRP Recovery executing from the connected PC the following command: | + | The first step is to install the ZIP archive which provides the **su** binary, we already copied the **Magisk-v17.3.zip** file to the phone storage. Let's reboot into TWRP Recovery executing from the connected PC the following command: |
< | < | ||
Line 151: | Line 161: | ||
===== Fastboot Mode ===== | ===== Fastboot Mode ===== | ||
- | Once in Recovery Menu, you can boot into the **Fastboot Mode** using the menu entry //Reboot to bootloader// | + | In Android, **fastboot** is a special diagnostic protocol that you can boot your Android device |
- | < | + | You can start fastboot mode in severl ways: |
- | adb reboot bootloader | + | |
- | </code> | + | * Power off the phone, then press **VolDown + Power** buttons together, untill vibration. |
+ | * Executing the **adb reboot bootloader** command on a PC when the phone is booted normally and connected via the USB cable. It is required to enable | ||
+ | * From the **stock Recovery** menu, choosing the entry **Reboot to bootloader**. | ||
+ | * From the **TWRP Recovery**, choosing **Reboot** menu, then **Bootloader**. | ||
+ | |||
+ | The Xiaomi Mi A1 will show the following image when in fastboot mode: | ||
{{.: | {{.: | ||
+ | |||
+ | To control the fastboot mode of the phone, you have to install the **fastboot** command on your PC. On a Debian GNU/Linux install the **fastboot 8.1.0** package. **NOTICE**: Version 7.0.0 is not reccomended, | ||
+ | |||
+ | Here are some commands that can be used in fastboot mode: | ||
< | < | ||
- | adb devices | + | fastboot help |
- | List of devices | + | fastboot |
- | 574524d99913 | + | fastboot boot recovery-3.2.1-2-oreo.img |
+ | fastboot flash boot_b boot_b.img | ||
+ | fastboot oem unlock | ||
+ | fastboot set_active b | ||
+ | fastboot reboot | ||
</ | </ | ||
Line 198: | Line 221: | ||
* Drive | * Drive | ||
* Gmail | * Gmail | ||
- | * Google Play Film | + | * Google Play Film, ... |
- | * ... | + | |
- | * Settings => Mi Services => **User Experience Program** | + | |
- | * Settings => Mi Services => **Send diagnostic data automatically** | + | |
- | * Google Play => Settings => **Auto-update apps** | + | |
- | * Google Play => Settings => Notification settings => **Updates** | + | |
- | * Contacts => Settings => **Default account for new contacts** | + | |
- | * Impostazioni => **Servizi Mi** | + | * Impostazioni => **Sicurezza e posizione** |
- | * Programma Esperienza Utente | + | * **App di amministrazione dispositivo** |
- | * Invia i dati diagnostici automaticamente | + | * ** Crittografia e credenziali** (Telefono criptato) |
* Impostazioni => **Google** | * Impostazioni => **Google** | ||
Line 214: | Line 231: | ||
* Sicurezza => **Trova il mio dispositivo** | * Sicurezza => **Trova il mio dispositivo** | ||
* Posizione => **Modalità** (Alta precisione, Basso consumo, Solo dispositivo) | * Posizione => **Modalità** (Alta precisione, Basso consumo, Solo dispositivo) | ||
+ | * Posizione => **Cronologia delle posizioni Google** | ||
* Smart Lock per password => **Smart Lock per password** (salvare le password nel tuo Account Google) | * Smart Lock per password => **Smart Lock per password** (salvare le password nel tuo Account Google) | ||
+ | * Altro (menu in alto a destra) => **Utilizzo e diagnostica** (off) | ||
- | * FIXME Dove sono queste voci? | + | * Settings => **Mi Services** |
- | | + | * **User Experience Program** (Programma Esperienza Utente) |
- | * Migliora la precisione | + | * **Send diagnostic data automatically** (Invia i dati diagnostici |
- | * Invia dati diagnostici | + | |
- | * Installa aggiornamenti e app (non disattivabile? | + | * Google Play => Settings => **Auto-update apps** |
+ | * Google Play => Settings => Notification settings => **Updates** | ||
+ | * Contacts => Settings => **Default account for new contacts** | ||
===== Battery Otimization and Background Sync ===== | ===== Battery Otimization and Background Sync ===== | ||
Line 227: | Line 248: | ||
* Settings => Apps & notifications => Advanced => Special app access => **Battery optimization** | * Settings => Apps & notifications => Advanced => Special app access => **Battery optimization** | ||
+ | |||
+ | ===== Upgrading Android maintaining root privileges ===== | ||
+ | |||
+ | In November 2019 my phone still was running the following: | ||
+ | |||
+ | * **Android 8.1.0** - Patch 2018-10-05 | ||
+ | * **Magisk v17.3** (the **su** binary, etc.) | ||
+ | * **MagiskManager v6.0.1** (the superuser rights management app) | ||
+ | * **TWRP 3.2.1-2** | ||
+ | |||
+ | MagiskManager warns about the availability of **Magisk v20.1**, the operating system too warns about the availability of **Nov 2018 Android System Update**. Also **MagiskManager** can be upgraded to **v7.4.0** (but **don' | ||
+ | |||
+ | ==== Upgrade Magisk and MagiskManager ==== | ||
+ | |||
+ | - Copy the **[[https:// | ||
+ | - Copy the **[[https:// | ||
+ | - Reboot into TWRP recovery. I used the **adb reboot recovery** command from the PC, but you can use the **VolumeUp + Power** trick. | ||
+ | - From the TWRP menu, choose **Install** and search for the Magisk-v20.1.zip archive. | ||
+ | - I choosed not to verify the zip archive and not to reboot the phone, so I had time to read the output of the command. Everything seemed OK, so I finally **rebooted**. | ||
+ | - Once rebooted in normal system, install **MagiskManager-v7.4.0.apk** from the file manager of your choice (it will require the permission //System// => //App// => <File manager> => //Unknown sources//). | ||
+ | |||
+ | ==== Upgrading the Operating System ==== | ||
+ | |||
+ | The phone automatically warns about the availability of an **OTA (On The Air) Upgrade**. You can also check for upgrades availability by tapping // | ||
+ | |||
+ | If you allow downloading and installing the upgrade, a check will be performed about the **integrity** of the **boot image** and the **system image**, before the actual install. The check will fail and the upgrade will be aborted if one of this condition is true: | ||
+ | |||
+ | - You have installed **Magisk SU** or **TWRP Recovery**. These software are installed into the boot partition, either **boot_a** or **boot_b** partition. The installation of Magisk patches only the active boot partition, whereas TWRP will patches (install itself) both boot partitions. | ||
+ | - You have used **su** to modify the **/system** partition. If you have **re-mounted** /system in **read/ | ||
+ | |||
+ | The upgrade process will fail with a warning message **Couldn’t update - Installation problem** (in Italian: // | ||
+ | |||
+ | To rescue from the first condition, it is sufficient to restore the boot partition from the original backup. You will loose root and TWRP Recovery, but you can reinstall them after the upgrade. If you have just installed Magisk, uninstalling it should be rather simple. Start the Magisk Manager app, disable and uninstall all the modules (if any) and reboot. Then run Magisk Manager again and choose to uninstall it completely. But if you have installed also TWRP you have to recover from a backup image. This is the recipe to run from a PC command line (supposing that active partition is B and that you have the original **boot_b.img** dump): | ||
+ | |||
+ | < | ||
+ | adb reboot bootloader | ||
+ | fastboot flash boot_b boot_b.img | ||
+ | fastboot reboot | ||
+ | </ | ||
+ | |||
+ | Allow upgrading after tampering the /system partition is more painful; yuo have to restore the full system by flashing the original ROM (so loosing all your data, apps and settings), then you will allow the update to install, and restore all your customization. | ||
+ | |||
+ | ==== The OTA Update ==== | ||
+ | |||
+ | When the phone downloads an OTA upgrade, it will save it into the **/ | ||
+ | |||
+ | The file is actualy a Jar archive. The jar executable is provided by the Debian package **openjdk-8-jdk-headless** (or whatever version of Java you have), and you can use it in this way: | ||
+ | |||
+ | < | ||
+ | mkdir update | ||
+ | cd update | ||
+ | jar -xf ../ | ||
+ | </ | ||
+ | |||
+ | The main content is a **payload.bin**, | ||
===== Web References ===== | ===== Web References ===== | ||
Line 233: | Line 309: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// |
doc/appunti/hardware/xiaomi_mi_a1.txt · Last modified: 2020/09/23 17:06 by niccolo