Developments Featured Full XDA Games MIUI MIUI 10 MIUI 9 News Tutorials XDA Android XDA Feature xiaomi Xiaomi Mi 6X Xiaomi Mi 8 Xiaomi Mi Max 3 Xiaomi Redmi 6 Xiaomi Redmi Note 5 xiaomi redmi note 5 pro

How to avoid bricking your phone

How to avoid bricking your phone

Again in July, Xiaomi rolled out MIUI 10 International Beta eight.7.5 for eight Xiaomi units. When customers put in the replace on their Xiaomi Redmi Notice 5 Professional, they unknowingly flashed a construct with anti-rollback safety enabled. Customers who didn’t like MIUI 10 International Beta discovered a nasty shock once they tried to re-install the newest MIUI 9 International Secure ROM: their telephones have been bricked! This wasn’t the sort of brick that you possibly can repair by restoring a TWRP backup, flashing a brand new ROM, or utilizing MiFlash to restore to a manufacturing unit picture. This can be a onerous, unrecoverable brick that requires using EDL mode to repair. However EDL mode isn’t accessible until you’ve a licensed account, so many customers have been left with no means to repair their phone besides sending it in to a licensed service middle or paying to use somebody’s account with EDL entry. On this article, we’re going to clarify every part you want to find out about Xiaomi’s new anti-rollback safety so you’ll be able to avoid bricking your new phone.


Why does Xiaomi require lengthy bootloader unlock wait occasions, EDL authorization, and Anti-Rollback Safety?

Chinese language electronics big Xiaomi is the preferred smartphone model in India thanks to their large choice of finances and mid-range units. Like Huawei, Xiaomi additionally sells a ton of smartphones of their house market of China. Many of those units are by no means bought outdoors of China, however that doesn’t cease individuals from importing them. Unofficial retailers for Xiaomi merchandise have sprung up on Aliexpress, Gearbest, and different loads of different web sites, permitting anybody from outdoors China to purchase the newest Xiaomi merchandise. This has posed a problem for the corporate because the software program they ship on their Chinese language units, referred to as “MIUI China,” doesn’t include Google Play Providers, the Google Play Retailer, or languages aside from English or Mandarin. Thus, anybody who imports a Xiaomi gadget from China shouldn’t be getting Google apps and providers outdoors of the field.

Nevertheless, third-party retailers found out a method round this so they might persuade clients they have been promoting Xiaomi units with an “official” MIUI International ROM. The retailers would purchase Xiaomi units in bulk, unlock the bootloader, change the software program themselves or flash a customized ROM like Xiaomi.eu (unofficial ROMs based mostly on MIUI China however with extra languages and options), after which promote the system. Most shoppers would haven’t any approach of understanding they’re operating unofficial/modified software program, and would as an alternative blame Xiaomi for a scarcity of updates or bugs they encounter. Even worse, some retailers would deliberately bundle malware or adware so they might make a bit of additional cash. Xiaomi’s status was actively being harmed by this follow as tech reviewers and shoppers have been caught up within the schemes of those unofficial retailers, and they also wanted to provide you with a means to cease shady retailers from promoting modified units in bulk.

One answer is to utterly block bootloader unlocking, which is a drastic transfer that Huawei just lately took. Seeing their model’s success amongst fanatics, Xiaomi hasn’t moved to block bootloader unlocking simply but. As an alternative, they’ve carried out a number of roadblocks to safeguard customers towards the actions of malicious third-party retailers.

Bootloader Unlock Wait Occasions

First, they carried out a ready interval for bootloader unlocking. Xiaomi units, save for the Xiaomi Mi A1, Xiaomi Mi A2, and Xiaomi Mi A2 Lite which run inventory Android beneath the Android One program, require using Xiaomi’s proprietary Mi Unlock device to unlock the bootloader. After sending your request to unlock the bootloader, Mi Unlock forces you to wait earlier than it validates your request and unlocks the bootloader. The ready time used to be three days earlier than growing to 15 days in early 2018, and just lately, the ready time has elevated to 30 or as excessive as 60 days in some situations. (Xiaomi’s new sub-brand, Poco, lowered the ready time to three days after receiving suggestions from the group, though almost everybody else nonetheless has to wait a very long time.) Including a wait time to the bootloader unlock course of was efficient in slowing down the operations of third-party retailers, however additionally it is understandably annoying for fanatics who need to unlock the bootloader to root their gadget, flash customized ROMs, and flash customized kernels.

EDL Authorization

Subsequent, the corporate started to lock down EDL mode on their units. EDL stands for Emergency Obtain Mode, and it’s an alternate boot-mode on all Qualcomm units that’s generally used to unbrick your system. So as to make use EDL mode, you want to discover what’s referred to as a “programmer” that has been approved by the OEM (Xiaomi) to be used on your gadget. EDL mode could be very highly effective and really low-level, and it’s routinely utilized by service facilities to restore units. Nevertheless, EDL mode was additionally generally used to flash each official and modified MIUI International ROMs on Chinese language Xiaomi units with out unlocking the bootloader. In essence, EDL mode turned one other means that third-party retailers might bypass Xiaomi. Xiaomi doesn’t need shoppers shopping for Chinese language variations of their hardware with International ROMs put in, in order that they did two issues: Made it unimaginable to boot a International ROM if the system isn’t a International model (with the warning message “This MIUI can’t be installed on this device”), and made it so EDL mode can’t be used until you might have a licensed Mi account.

Anti-Rollback Safety

Lastly, they carried out anti-rollback safety within the newest variations of MIUI for the newest Xiaomi units. You’ll have heard of anti-rollback safety earlier than. Google added help for the function in Android eight.zero Oreo and made it obligatory for units launching with Android Pie. Google’s anti-rollback safety is a function of Android Verified Boot 2.zero (also referred to as Verified Boot) and it prevents the system from booting if it detects that the system has been downgraded to an older, unapproved software program construct. Anti-rollback safety is important to forestall attackers from loading older software program on a tool that’s prone to an exploit. The most important distinction between Google and Xiaomi’s implementation is that Google’s anti-rollback safety is disabled when you unlock the bootloader whereas Xiaomi’s can’t be disabled. As soon as you put in a construct with anti-rollback safety enabled on a Xiaomi gadget, there’s no going again. For example, anti-rollback safety is enabled for the Xiaomi Mi eight and Xiaomi Redmi Notice 5 Professional beginning in MIUI 10 China eight.9.6 and MIUI 10 International Beta eight.7.5 respectively.

Xiaomi Anti-rollback protection

Listing of units which presently have anti-rollback safety enabled. Supply: Xiaomi.eu.

Anti-rollback safety will cease any unauthorized retailer from benefiting from exploits in older MIUI variations, thus defending customers from exploitation. Nevertheless, it has additionally caught many off guard as a result of Xiaomi rolled it out to the Redmi Observe 5 Professional with out informing customers beforehand. As a result of TWRP doesn’t have any checks in place to cease customers from putting in older, unauthorized MIUI variations, many individuals by accident bricked their units once they downgraded from a MIUI beta ROM to a MIUI secure ROM. All presently supported Xiaomi units will ultimately achieve anti-rollback safety, so it’s extremely necessary that you simply perceive how to verify for it earlier than downgrading and what you are able to do if anti-rollback safety is enabled.


How to examine for Anti-Rollback Safety

Once we talked about anti-rollback safety prevents a tool from booting older, insecure software program, we stated that Verified Boot “detects” the presence of older software program. How this detection works is that Verified Boot has a rollback index that’s in contrast with the rollback index of the pictures to be put in. Relying on how the rollback indices examine, the next will occur:

  • If the present rollback index is lower than the rollback index within the photographs to be flashed, then the pictures might be flashed and the present rollback index shall be incremented to match the brand new rollback index.
  • If the present rollback index is equal to the rollback index within the pictures to be flashed, then the pictures might be flashed and the rollback index gained’t change.
  • If the present rollback index is bigger than the rollback index within the pictures to be flashed, then the pictures might be rejected in the event you’re flashing by way of fastboot or Mi Flash. (TWRP doesn’t examine the rollback indices earlier than flashing, which is why almost all bricks have been the results of downgrading by way of TWRP.)

Now that you’ve a greater understanding of the rollback index, right here’s how to truly verify the present rollback index on your gadget and the picture you need to flash.

How to discover present rollback index

  1. Reboot to fastboot mode
  2. Enter the next command: fastboot getvar anti
  3. If the output is clean, then anti-rollback has not but been enabled. Should you get a quantity within the output, then that’s your present rollback index.
Xiaomi Anti-rollback protection

Present anti-rollback index of the gadget is four.

How to discover rollback index of photographs

  1. Obtain the “fastboot” ROM equal of the restoration ROM you are attempting to set up. The restoration ROM all the time has the gadget’s advertising identify within the filename and ends in .zip. The fastboot ROM all the time has the gadget’s code-name within the filename and ends in .tar.gz.
  2. Extract flash-all.bat from the .tar.gz archive. 7Zip can simply deal with this.
  3. Open flash-all.bat in a textual content editor like Notepad++ and search for the next line: set CURRENT_ANTI_VER=#
  4. That quantity (#) is the rollback index of the MIUI model you need to flash. If that quantity is equal to or higher than your present rollback index, then it’s protected to flash in TWRP, Mi Flash, and so on. If that quantity is lower than your present rollback index, then DO NOT FLASH THIS ROM VIA TWRP.
Xiaomi Anti-rollback protection

Snippet from the flash-all script of a fastboot ROM

Avoiding a full, unrecoverable brick ought to be easy as long as you verify the rollback indices earlier than downgrading by way of TWRP. Simply to be protected, you need to persist with Mi Flash or fastboot to flash MIUI ROMs as your phone’s bootloader has built-in protections to forestall you from downgrading to a model with a decrease rollback index.


How does Anti-Rollback Safety have an effect on Customized ROMs?

When you plan on by no means flashing MIUI once more, then not a lot will change for you. If you need to flash an AOSP ROM like LineageOS, Pixel Expertise, Resurrection Remix, Carbon ROM, and so on., you’ll nonetheless want to unlock the bootloader by way of Mi Unlock, boot TWRP, after which flash the customized ROM. The one notable distinction is how you put in TWRP by way of fastboot. Since anti-rollback safety blocks you from flashing the TWRP picture, you want to flash a “dummy” picture first. The dummy picture is an empty file that serves no different objective than sending a command to the bootloader so it is aware of that afterward, it will probably settle for different flashes. (Should you take a look at the flash-all script from the earlier part, that is truly how Xiaomi formally does it.) Alternatively, you’ll be able to “fastboot boot” the TWRP picture, transfer the TWRP picture to your system’s storage, then flash the TWRP picture from inside TWRP. I’m not offering detailed directions on both technique as I urge you to go to your system’s discussion board for device-specific directions.

XDA Discussion board Index for all Xiaomi units

There’s one caveat, nevertheless. There’s no means to inform beforehand if the rollback index has been incremented due to an up to date bootloader, modem, vendor, or different partitions. Take into account that customized ROMs often solely change the system and boot partitions, however to hold your gadget really safe with the newest safety patch updates, you’ll sometimes want to flash the newest pictures which are contained within the newest official MIUI ROMs. Builders of customized ROMs may have to manually verify the rollback index of those builds earlier than they advocate you to replace—that means, you’ll know when a brand new replace locks you into sure MIUI variations when you plan on going again to MIUI from an AOSP ROM.


What do I do if I bricked my phone?

Should you bricked your phone by triggering anti-rollback safety, you’ve only a few choices.

  1. Ship your gadget to a licensed service middle for restore. The service facilities have entry to restore your gadget by way of EDL mode.
  2. Hope that there’s by some means a method to bypass EDL authorization (primarily, an exploit) so you possibly can manually restore your gadget with the proper programmer.

As you’ll be able to see, bricking your phone by triggering anti-rollback safety is not any joke. You actually need to watch out earlier than you flash any older MIUI model.


Ceaselessly Requested Questions (FAQs)

  1. What do I avoid if I don’t need to brick my system?
    • Don’t flash a MIUI model with a rollback index lower than your gadget’s present rollback index. See above for directions.
    • Don’t flash an official MIUI International ROM on Chinese language Xiaomi hardware with a locked bootloader.
  2. Can I nonetheless set up customized AOSP ROMs, kernels, Magisk, Xposed, Substratum, ARISE, and different mods?
  3. Can I nonetheless change between MIUI International Secure, MIUI International Developer, MIUI China Secure, and MIUI China Developer?
    • Sure, however you want to examine the rollback indices prior to installing an older MIUI model.
  4. Why doesn’t Xiaomi disable anti-rollback safety once you unlock the bootloader?
    • That’s an excellent query.
  5. Why does Xiaomi onerous brick your phone if anti-rollback safety is triggered, which Google doesn’t do?
    • That’s one other good query.
  6. Why doesn’t Xiaomi show the usual Verified Boot warning to present the consumer the software program has been tampered with?
    • You’re on a roll with these nice questions! In all seriousness, this one may be considerably justified as a result of it’s attainable to disable this splash display – at the least on some units.

Particular thanks to XDA Acknowledged Developer yshalsager and XDA Junior Member franztesca for his or her help on this article!

Need extra posts like this delivered to your inbox? Enter your e-mail to be subscribed to our publication.

!perform(f,b,e,v,n,t,s)if(f.fbq)return;n=f.fbq=perform()n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments);if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!zero;n.model=’2.zero’;n.queue=[];t=b.createElement(e);t.async=!zero;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)(window,
doc,’script’,’https://connect.facebook.net/en_US/fbevents.js’);
fbq(‘init’, ‘403489180002579’); // Insert your pixel ID right here.
fbq(‘monitor’, ‘PageView_XDA’);