How to go back to stock EMUI 5.0 after flashing TWRP/Custom roms (Guide)

Y

YMNDLZ

Guest
Tested Devices:
Huawei GR5 BLL-L22.

Hello all,
I just wanted to put this guide out there for anyone struggling with restoring stock after flashing a custom nougat rom/TWRP. It took me several days to figure out this method, which has never failed to get me back to stock after screwing with my phone. You can also use this if you accidentally wiped data without removing your fingerprint.

Prerequisites:
- Stock firmware for your device. If you were using a BLL-L22, you need the firmware which matches your phone's model and it has only been tested with the same firmware version. You can use the Huawei firmware update finder to get it.
- You'll need HuaweiUpdateExtractor, find it here: https://forum.xda-developers.com/showthread.php?t=2433454 . All credit goes to the original creator of the tool, @worstenbrood .
- You also need a Micro SD card in your phone, along with a micro SD card reader/ SD card reader (if you have a micro SD to SD card converter).
- You need a functioning computer with ADB commands installed system wide.

Anyways, here goes:
1. Unzip the update zip file, and ensure you have the update.app .
2. Using Huawei Update Extractor, extract only the boot.img, recovery.img, system.img, and vendor.img from the update.app . Those are the only files you need.
3. Boot into TWRP and format data. then wipe ALL partitions.
HINT: If you had your Micro SD card merged with internal storage, MAKE SURE you partition your micro SD card in TWRP via the partition SD card functionality, using EXT3/4.
4. Reboot into TWRP, and flash the vendor.img using the install image functionality in TWRP.
5. Wipe all partitions and format data as well, and reboot into the bootloader (fastboot).
6. Flash the BOOT, RECOVERY, and SYSTEM images, in that order, using fastboot.
7. Reboot into fastboot, and remove your micro SD card.
8. Create a folder called dload in the folder where the update.app file is located, and place the update.app file inside the dload folder.
9. Copy the dload folder to the micro SD card you have connected to your PC via a card reader.
10. Place the micro SD card back inside the phone, and then hold power + volume up + volume down.
11. This should begin the flashing process, wait till it finishes flashing and reboots.
12. Boot into the stock recovery, and factory reset and also clear data.
13. Reboot.
14. PROFIT! You should be back on EMUI 5.0 with a fully functional phone once more.

If you have any questions at all, feel free to ask. Also, if the guide worked for you, please let me know and I'll compile a list of devices it has been tested on. Thanks guys!

DISCLAIMER: This method works flawlessly for me, and I have used it countless times with my Huawei GR5 2017 (BLL-L22). I am not responsible for any damage done to your phone, nor can I guarantee this will work on every single variant of the Honor 6X. Do to this at your own discretion.

Hit thanks if I helped.
 
Last edited:

Jax

Senior Member
Jul 3, 2017
513
127
0
I backed up my stock emui 5 boot,system,vendor but after restoring backup I stucked on boot animation what i can do now

Sent from my HONOR-6X using Tapatalk
 
Y

YMNDLZ

Guest
I backed up my stock emui 5 boot,system,vendor but after restoring backup I stucked on boot animation what i can do now
This guide concerns rolling back via dload, not via TWRP. You'd be better off asking in the TWRP thread, or asking the OpenKirin team.
 

yoko89

Senior Member
Aug 15, 2009
128
13
0
I haven’t follow this guide
I just used dload directly with the same firmware (i was only rooted)
Phone doesn’t enter fastboot using volume down and power
But i can go to fastboot using adb command (adb reboot bootloader)
 

xda_jm

Senior Member
May 6, 2017
81
15
0
I am actually exactly doing this right now. Honor was not able to help me, after the BETA UEMI 5.0 put the system into a non-upgradable state. I tried to upgrade it/rollback etc. but that made it worse.

So- my current problem is, I don't have TWRP (It is installed, but won't start because I am in the rollback-version of the firmware). what can I do to actually go on with it?

When you say: 3. Boot into TWRP and format data. then wipe ALL partitions.
So - I used the recovery from HAWEI to format the data partition (That should do it).
As I said - I only have fastboot at hand right now.

Also - the vendor image flash returns this:
Code:
$ fastboot flash vendor VENDOR.img 
target reported max download size of 471859200 bytes
sending 'vendor' (419273 KB)...
OKAY [ 11.443s]
writing 'vendor'...
FAILED (remote: Command not allowed)
finished. total time: 11.448s
Any hints?
 

Jax

Senior Member
Jul 3, 2017
513
127
0
Use dload method to flash full latest firmware from firmware finder

Sent from my BLN-L22 using Tapatalk

---------- Post added at 09:33 AM ---------- Previous post was at 09:32 AM ----------

If u are unable to boot any recovery then go to service centre they will replace your mobo

Sent from my BLN-L22 using Tapatalk
 

xda_jm

Senior Member
May 6, 2017
81
15
0
Use dload method to flash full latest firmware from firmware finder

Sent from my BLN-L22 using Tapatalk

---------- Post added at 09:33 AM ---------- Previous post was at 09:32 AM ----------

If u are unable to boot any recovery then go to service centre they will replace your mobo
No, it just won't allow me to write the vendor image.
I can go into the regular recovery etc., but I can' t do anything. Not even reset the system etc.
 

Jax

Senior Member
Jul 3, 2017
513
127
0
No, it just won't allow me to write the vendor image.
I can go into the regular recovery etc., but I can' t do anything. Not even reset the system etc.
Flash twrp using fastboot or use dload method

Sent from my BLN-L22 using Tapatalk
 

xda_jm

Senior Member
May 6, 2017
81
15
0
Flash twrp using fastboot or use dload method
I have the BLN-L21C432 device (Berlin). You know which TWRP I have to flash?

Using the twrp from https://dl.twrp.me/berlin/ ->
twrp-3.1.1-0-berlin.img

That twrp won't show up. Probably because I don't have the right Vendor-image or so. No logs available etc. A real bummer ... :crying:
Stuck here:
Code:
You're device has been unlocked and can't be trusted.

To learn more, visit:
Blabla UYRL ...

Your device is booting now...


My assumption is that I have a mismatch between Vendor/recovery/system and boot.img files. Only, how do I look into these images (I could mount them as loopback device under linux? Linux only here, no windows). And I need to identify the verison of these images/build to flash the right versions for the dload to actually handle the right upgrade.
 
Last edited:

RedSkull23

Senior Member
Apr 29, 2017
1,774
641
0
Milan
soundcloud.com
You know which TWRP I have to flash?

Using the twrp from https://dl.twrp.me/berlin/ ->
twrp-3.1.1-0-berlin.img

That twrp won't show up. Probably because I don't have the right Vendor-image or so. No logs available etc. A real bummer ... :crying:
That TWRP won't work, sadly even if hosted on official site it never worked. Grab the TWRP from here https://forum.xda-developers.com/honor-6x/development/twrp-t3583413 and flash via fastboot, it'll surely works. Vendor partition is separated from recovery one, so don't worry because even with an incorrect vendor.img it'll works anyway ;)
 

xda_jm

Senior Member
May 6, 2017
81
15
0
That TWRP won't work, sadly even if hosted on official site it never worked. Grab the TWRP from here https://forum.xda-developers.com/honor-6x/development/twrp-t3583413 and flash via fastboot, it'll surely works. Vendor partition is separated from recovery one, so don't worry because even with an incorrect vendor.img it'll works anyway ;)
Yeah. That was it.
So I am able to actually get into the TWRP recovery. Nice :)
Now - following your guide, I am unable to format data partition:

Code:
Full SELinux support is present
MTP Enabled
Formating data using mkfs.f2fs
mkfs.f2fs -t 0 /dev/block/mmcblk0p49 process ended with ERROR: 255
unabel to wipe data
unable to format to remove encryption
Any idea?
Shall I continue with the process?
I could change the filesystem of data to ext4 or so for testing?

UPDATE: Actually changing data to ext4, formating it as ext4 + rebooting into recovery and changing back to f2fs and formating f2fs worked in the end. What a crap.
I'll write down exactly what I do!

So - everything worked, except the factory reset showed a red exclamation mark.
It is now rebooting. And - no. I still have the BETA EMUI 5.0 showing, BuildNr. BLN-L21C900B300

Opening a new post for the next steps...
 
Last edited:

xda_jm

Senior Member
May 6, 2017
81
15
0
So - the cleaning has not worked.
After checking the imags in the update package, I noticed they are all different.
Why did the system-reset fail at all? Where does that come from?

Here the file-checksums:
Code:
$ cat BLN-L21C432B360-FullOTA-MF-PV/md5sums.txt 
cbc1a5b85deb8caca46d7ed691f1d5d7  BOOT.img
78ccf0ff58d189284293e219f2aa8ce2  CACHE.img
eef4f7d2c4187b7cd195df1c1139950e  CRC.img
f6594819938b923bccf075349b250347  CURVER.img
a181b39b6095f221ffb207268d10d540  DTS.img
aa3a0518794c16bb22849676c13ba55c  EFI.img
0f1fcd32afb2db5183d86e527510c6b4  FASTBOOT.img
8379cfc96d5ddd57993da668c0e68da7  FW_HIFI.img
d60eb96f274cab285fe1bc5cb8ac874c  FW_LPM3.img
afd9223813961adfbf71b0a51c310f66  MODEM_FW.img
176c0d4b0489a639f5bd371b5445a466  MODEMNVM_UPDATE.img
f07fcca53b5337e003e9894ec4b231e6  PRODUCT.img
40c8ce310fb8dde705c6b29ce316a215  RECOVERY2.img
a3883873ca0054ec12fb8d0a71835ca9  RECOVERY.img
cd22975bcc99a3436a74d6123e9c2796  SENSORHUB.img
2c4fab4df4b00c7dcb08fd8a47c0228f  SHA256RSA.img
0565a9f075122ebf46c9f623eb6b22d2  TEEOS.img
e6a5b518daa00ea67a2a360408534dd9  TRUSTFIRMWARE.img
09e9dcef68ffddce4c1a41f1bbeae435  UPDATE.APP
19324f9cd1351119b4efdfa5c235200e  VENDOR.img
9219d25ed7eb999fb08c03bf493929a3  VERLIST.img
83c5d8c7866c34f4ff901e17536ad3b4  XLOADER.img
Code:
$ cat RollBack_DE/md5sum.txt 
6682ebf3c4c59b58e27cac42bc0a5760  BOOT.img
c9026aa21284a5c6575573bad6c67531  CACHE.img
643062216ba9a1a9c43091a56407b4e4  CRC.img
e665793d69c041c1a67ce25e342bb665  CURVER.img
862d05d2ac39567d48db9d4a996698e8  CUST.img
0c66cff221dd1adade7060d93f9f14db  DTS.img
997a84cac4901d8d47a13d03a41645c1  EFI.img
cfdb3c574a4e22e6918021eb551af744  FASTBOOT.img
6534c81facf064c61fbe838a844bcf53  FW_HIFI.img
2c6cf6c896c17ed938563779d4bc015d  FW_LPM3.img
330f6c5fe86c9c716ba675ade522a4c4  MODEM_FW.img
77ca34a576955b1aa7b09adcc43183aa  MODEMNVM_UPDATE.img
bf696a2a9eb149bf3d409ab3fab8da1b  RECOVERY2.img
ba1a5ef8d2d77dd03a4e5a3fb8be724b  RECOVERY.img
e73ae0c33807474e61caaf2f5864bd93  SENSORHUB.img
53d8a3d3afcfd61a73d4446d37602249  SHA256RSA.img
713c288402f5d540efc722e442218fc0  SYSTEM.img
29a07ee1454ece337416b595101a016f  TEEOS.img
15a226f7741aee2d026d760f755d6991  TRUSTFIRMWARE.img
b8100f45c08c2b54ec089e52d945fae9  VERLIST.img
7eb918861de29526259611fe95365e90  XLOADER.img
The rollback one is supposed to be an intermediate entry - C900B300 - which was supposed to make a rollback to EMUI 4.x (Tried that route, because I couldn't update any EMUI 5 releases).

Any idea what to do?

Reloaded twrp. When I chec the internal storqage, I see:

Cache
Data
System
Vendor
Product
Micro SDCard
USB OTG

Could it be the Product partition? What's inside?
 
Last edited:

xda_jm

Senior Member
May 6, 2017
81
15
0
Reloaded twrp. When I check the internal storage, I see:

Cache
Data
System
Vendor
Product
Micro SDCard
USB OTG

Could it be the Product partition? What's inside?
Actually, there are 48 Partitions *lol* Amazing.

And - to write an image manually using adb shell in twrp (That's where it works), the extracted images from UPDATE.APP need to be uncompressed first with:

Code:
 /external_sd # simg2img PRODUCT.img PRODUCT.raw
/external_sd # dd if=PRODUCT.raw of=/dev/block/mmcblk0p48
393216+0 records in
393216+0 records out
201326592 bytes (192.0MB) copied, 7.405686 seconds, 25.9MB/s
Alas, the images are identical. So no changes.
Still debugging under the hood.

If anyone has an idea, let me know :}
 

xda_jm

Senior Member
May 6, 2017
81
15
0
So - last post from me probably. It has not worked.
My wife decided to stay with the beta EMUI 5.0.0.1 until a decent Lineage OS 14.1 version is there (Stable). I'll then put it on the Honor 6x.

It is amazing to see that actually 8GB of space from the disk is reserved for HUAWEI and GOOGLE tools, dispersed in 48 partitions, all to prevent people from using the device freely.
And I bet in future it will get worse and worse. Anyway - have learned a lot regarding the tools and how to use these, and what to take into account when doing things with phones.
I personally still use an old BQ E4.5 Aquaris Ubuntu phone which does most of what I need very nicely :) IO know why I hate Apple devices, and not so much Android devices.
 
Y

YMNDLZ

Guest
in 5% i get failed
software install failed
my build is NRD90M test-keys
after write system recovery boot but faild in dload mode
bootloader is unlock
I'll PM you the files. Certain update.app files fail to write, I don't know why. Give me a few hours to get the files to you.
 
Last edited: