When feeling bored, I often think about tinkering with the electronic products around me, wondering if there could be a better or different experience.For most people, smartphones are essential daily tools, and how comfortable they are to use is quite important. My old phone, the K40, has been in use for four years. Since I don’t play games and only read books, chat on WeChat, and shop online, I haven’t had much demand for upgrades. The configuration still supports daily use. However, Xiaomi has stopped updating the MIUI system, and the Android version is stuck on Android 13, missing some new features.For the first time, I wanted to experience Xiaomi’s Surge OS2 new system, and I found a third-party ROM version developed by an individual online, modified from the 15U ROM. I paid 20 yuan to join the whitelist, and flashing the ROM was quite simple; it could be done directly via fastboot. After trying it for two weeks, I felt it was not much different from Surge OS1, but it overheated severely, so I reverted to Surge OS1. However, I couldn’t tolerate the ads and built-in applications, and I hadn’t found a good ROM. After joining a flashing group, I saw recommendations for a near-native ROM. With the principle of trying it out, I chose LineageOS. I had heard that the most famous Android third-party ROM, CyanogenMod, had disbanded and transformed into the current LineageOS team.Here are some precautions:
- Unlock the bootloader (BL). This requires meeting certain conditions before applying.
- Log out of your Xiaomi account and disable Find My Device. However, it seems that not logging out isn’t a big issue; at least initially, I could still enter the system normally, though some features might be restricted. I later cleared the FRP partition.
- Installing Google services requires some technical knowledge. If you don’t use Google services, it’s fine not to install them.
- Face recognition cannot be used. The philosophy of this system is security, and insecure authentication methods like face recognition have been removed.
- Due to NFC card emulation requiring root access, you need to root the device and use third-party software to enable NFC card functionality.
- There is no memory cleaning feature, but even so, there hasn’t been any lag over time.
- Fast charging will show as slow charging; the maximum I found was only 15W.
Initial Impressions
In a few words, the user experience can be described as: fast, smooth, free, and ad-free.
There are no random background services; everything is under your control. Even with heavy usage, the phone remains cool, unlike Surge OS, which could double as a hand warmer. It also runs the latest Android 15 system. Additionally, the community is quite active, and most issues can generally be resolved.
Flashing Preparation
Taking the K40 as an example, first visit https://wiki.lineageos.org, find Xiaomi in the devices section, click in, and locate the K40 model, for example, https://wiki.lineageos.org/devices/alioth/variant2/. It contains all the information for flashing. The same applies to other models; clicking install will lead you to the tutorial. Note the instructions regarding the base package. If you are unsure what the base package is, it is recommended to flash the base package version first. For the K40, the base package is shown as:
| Device Model | Firmware Version |
|---|---|
| Redmi K40 China | OS1.0.3.0.TKHCNXM |
In simple terms, the flashing process is quite straightforward, but make sure the phone is unlocked before proceeding.
Next, download the necessary files: https://download.lineageos.org/devices/alioth/builds. Select the latest version; you don’t need to download everything, just the Lineage installation package, boot.img, and vendor_boot.img.
Of course, in addition to these, you need a flashing environment. The system is not limited; just install ADB and fastboot.
Entering Recovery
LineageOS does not support or recommend using TWRP or any other custom recovery for operations, as it may lead to boot loops. It is recommended to use the official LineageOS Recovery.
<span>adb reboot bootloader</span> to reboot into<span>fastboot</span> (you can also press the power button and volume down button to enter). The phone will reboot, and an orange<span>fastboot</span> text will appear at the top of the screen.
Navigate to the directory of the downloaded files and execute:
fastboot flash vendor_boot .img # Command to flash vendor boot
fastboot flash boot <your downloaded boot file>.img # Command to flash boot
fastboot reboot recover
Flashing the Base Package
1. Connect the phone to the computer via USB and enable developer mode.
2. On the computer, navigate to the base package directory. Go to https://github.com/ssut/payload-dumper-go to download the payload-dumper-go program, which is used to extract the base package image:
payload-dumper-go miui_ALIOTH*_12.0.zip
4. Navigate to the extracted directory and flash the base package:
fastboot flash abl_ab abl.img
fastboot flash aop_ab aop.img
fastboot flash bluetooth_ab bluetooth.img
fastboot flash cmnlib_ab cmnlib.img
fastboot flash cmnlib64_ab cmnlib64.img
fastboot flash devcfg_ab devcfg.img
fastboot flash dsp_ab dsp.img
fastboot flash featenabler_ab featenabler.img
fastboot flash hyp_ab hyp.img
fastboot flash imagefv_ab imagefv.img
fastboot flash keymaster_ab keymaster.img
fastboot flash modem_ab modem.img
fastboot flash qupfw_ab qupfw.img
fastboot flash tz_ab tz.img
fastboot flash uefisecapp_ab uefisecapp.img
fastboot flash xbl_ab xbl.img
fastboot flash xbl_config_ab xbl_config.img
Flashing LineageOS
<span>fastboot reboot recovery</span> to reboot into recovery mode.
- Click Factory Reset, then click Format data / factory reset to perform a double wipe.
- After completion, return to the main menu, click Apply Update, then select Apply from ADB.
- In the command line, enter
<span>adb sideload filename.zip</span>, where<span>filename.zip</span>is your LineageOS ROM package. - Just wait; it may stop at 47% and report
<span>adb: failed to read command: Success</span>. - Don’t worry about it; just wait for the boot to complete. At this point, your LineageOS has been successfully flashed, and you can boot up!
The flashing process is complete. Below are some additional optimization operations, including flashing Google frameworks, rooting with Magisk, bypassing app root detection, NFC card emulation, and some recommended amazing apps. Feel free to choose to read.
Flashing Google Services (Optional)
If you can’t install it yourself, visit https://wiki.lineageos.org/gapps/ to download MindTheGapps, and similarly use<span>adb sideload filename.zip</span> to flash it. During the process, you may encounter Signature verification failed; just ignore it and type yes.
Flashing Magisk
Download Magisk from https://github.com/topjohnwu/Magisk/releases/tag/v29.0, change the extension to zip, then enter recovery mode, selectApply from ADB, and execute
adb sideload XXX.zip
During the process, you may see<span>signature verification might fail</span> and so on; don’t worry, after rebooting, you will see the Magisk app. Enter it to install modules and services.
App Root Detection
Some banking apps will detect root. Just enable zygisk in Magisk, then add these apps to the “Exclude List” to hide Magisk. This way, they generally work.
NFC Card Emulation
Install NFC card emulation, grant root permissions, and then emulate just like the Xiaomi smart card.
Some Amazing Apps
- SD Maid SE: A powerful junk cleaning tool, open-source and free.
- Weather Master: A weather app, ad-free.
- Gboard: Google’s keyboard, simple and clean.
- Aegis: A two-factor authentication tool.
- Bitwarden: A password generator and manager.
- FOLO: RSS feed reader.
- GadgetBridge: Third-party apps for Xiaomi Mi Band, Huawei Band, etc., ad-free, no store, etc.
- Microsoft Desktop: The default desktop is too ugly; use this instead.