How To Guide How to flash ROM and TWRP on POCO F3 / k40 / mi11x. And an explanation. A very important guide

Search This thread

néonaloj

Senior Member
Dec 29, 2014
974
459
Hi, thanks for the guide !
Only one question, as of now, what needs to be done between "install ramdisk" or "flash" twrp ?
We now do have working twrp (skkk), it's m'y last day before unlock BL, and I'm wondering..
Thanks !
 

tsavman

Senior Member
Mar 13, 2011
111
34
Google Nexus 4
Google Nexus 5
Hi, thanks for the guide !
Only one question, as of now, what needs to be done between "install ramdisk" or "flash" twrp ?
We now do have working twrp (skkk), it's m'y last day before unlock BL, and I'm wondering..
Thanks !
Flash TWRP from fastboot, and enjoy.
It will be permanent.

Just don't forget to check "auto-flash TWRP after flashing rom", when flashing a ROM from TWRP.
 

Billytromp

Senior Member
Nov 1, 2016
83
18
I have a weird issue I hope someone can help me with. When trying to boot into twrp via fastboot, fastboot boot twrp.img, I get the usual code:

Sending 'boot.IMG'.... Okay
Booting.... Okay

But then it boots just back into the ROM every time. Anybody any clue? I tried on 2 different PC's and its the same.

Edit: I have the latest official lineage installed with the lineage recovery. And tried OrangeFox, but it too can't be booted..
 
Last edited:

coolkillermax

Senior Member
Nov 12, 2012
1,267
123
Malaysia
Very more new knowledge now day for install EU rom or any custom ROMs.... i just done unlock bootloader & during flashing EU rom once done installed saw 2 slot show in TWRP, Slot A & Slot B ?? What is that ?? choose slot B it just can not normal boot but fastboot only, than i choose Slot A than my NEW EU rom boot OK, seem now day flashing ROMs quite complicated compare old time So simple easy!! Could anyone explain this... Appreciate if anyone can tell me :)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 28

    Mandatory instructions for beginners (and not only beginners) to install ROM and other on poco f3

    Prerequisite, unlocking the bootloader

    For questions, if something is not clear, please write to "Conversations", I will try to correct it in a post with a simpler explanation. And I will answer the question (I am not a 24/7 support service, so duplicate your question in the ROM discussion thread in order to give an answer if I'm busy)

    This is your last chance. After this, there is no turning back. You take the blue pill - the story ends, you wake up in your bed and believe whatever you want to believe. You take the red pill - you stay in Wonderland and I show you how deep the rabbit-hole goes

    !!! The spoiler below is a must-read before doing anything with your device. !!!

    2.1 We have a so-called A/B partition structure - this is when two spaces are used for system partitions (read more in google) the essence is that there are "Firmware" partitions
    Code:
    "dsp.img", "/dev/block/bootdevice/by-name/dsp_a"
    "dsp.img", "/dev/block/bootdevice/by-name/dsp_b"
    "xbl_config.img", "/dev/block/bootdevice/by-name/xbl_config_a"
    "xbl_config.img", "/dev/block/bootdevice/by-name/xbl_config_b"
    "modem.img", "/dev/block/bootdevice/by-name/modem_a"
    "modem.img", "/dev/block/bootdevice/by-name/modem_b"
    "tz.img", "/dev/block/bootdevice/by-name/tz_a"
    "tz.img", "/dev/block/bootdevice/by-name/tz_b"
    "bluetooth.img", "/dev/block/bootdevice/by-name/bluetooth_a"
    "bluetooth.img", "/dev/block/bootdevice/by-name/bluetooth_b"
    "abl.img", "/dev/block/bootdevice/by-name/abl_a"
    "abl.img", "/dev/block/bootdevice/by-name/abl_b"
    "featenabler.img", "/dev/block/bootdevice/by-name/featenabler_a"
    "featenabler.img", "/dev/block/bootdevice/by-name/featenabler_b"
    "keymaster.img", "/dev/block/bootdevice/by-name/keymaster_a"
    "keymaster.img", "/dev/block/bootdevice/by-name/keymaster_b"
    "uefisecapp.img", "/dev/block/bootdevice/by-name/uefisecapp_a"
    "uefisecapp.img", "/dev/block/bootdevice/by-name/uefisecapp_b"
    "qupfw.img", "/dev/block/bootdevice/by-name/qupfw_a"
    "qupfw.img", "/dev/block/bootdevice/by-name/qupfw_b"
    "xbl.img", "/dev/block/bootdevice/by-name/xbl_a"
    "xbl.img", "/dev/block/bootdevice/by-name/xbl_b"
    "cmnlib.img", "/dev/block/bootdevice/by-name/cmnlib_a"
    "cmnlib.img", "/dev/block/bootdevice/by-name/cmnlib_b"
    "cmnlib64.img", "/dev/block/bootdevice/by-name/cmnlib64_a"
    "cmnlib64.img", "/dev/block/bootdevice/by-name/cmnlib64_b"
    "devcfg.img", "/dev/block/bootdevice/by-name/devcfg_a"
    "devcfg.img", "/dev/block/bootdevice/by-name/devcfg_b"
    "hyp.img", "/dev/block/bootdevice/by-name/hyp_a"
    "hyp.img", "/dev/block/bootdevice/by-name/hyp_b"
    "imagefv.img", "/dev/block/bootdevice/by-name/imagefv_a"
    "imagefv.img", "/dev/block/bootdevice/by-name/imagefv_b"
    "aop.img", "/dev/block/bootdevice/by-name/aop_a"
    "aop.img", "/dev/block/bootdevice/by-name/aop_b"
    and there are partitions directly ROM /data, /system /system_ext, /vendor, /product, /odm, /vendor_boot, /boot

    2.2 miui based ROMs update all of these sections. In the case of firmware, they are put in both slots at once. Although this is not necessary in essence.
    ROMs of a custom type, those based on a "pure" android are often flashed for only partitions of the ROM, but not in 100% case

    2.3 For our device, there are 3 types of ROM installation files, 2 of which are divided into two types of installation methods

    2.3.1 Let's start simple, Official miui image for fastboot - installation is recommended via miflash, has all partitions inside the archive. There are also 3 files inside - for easy installation of all partitions, for installing all partitions and formatting the memory, as well as for installing all partitions and locking the bootloader (the memory is formatted automatically), the name of the .bat files speaks for themselves

    2.3.2 Next - the installation .zip archive of unofficial MIUI for TWRP. Not all partitions, but the main ones (always stitched into section A), including firmware (stitched into both slots A and B)

    2.3.3 Sideload type firmware (99% of all custom ROMs) are divided into two installation methods.
    Inside the archive there is a payload.bin file in which the rom and sometimes firmware sections are packed
    Installation always goes to the adjacent NOT active memory slot, and after completion, makes the adjacent slot active to load the firmware
    Installation via PC, via ADB (on the phone, AOSP recovery adb sideload/twrp adb sideload mode) or installation via TWRP directly from the device

    2.4 Custom ROMs for fastboot, usually used for a clean installation, which implies cleaning and data from memory (pictures, etc.) inside sometimes have firmware sections and always rom sections. Inside, as the author saw fit, there are .bat launchers for updating (does not erase all data) and for a clean installation (erases all data)

    2.5 Another very important feature of the AB structure in our case is two types of fastboot mod. It is called bootloader - official miui is completely flashed through it, and there is a fastbootD mode that is built into the boot sector in aosp recovery or in twrp, it is also needed for flashing img images. Ask what are the differences if this and that fastboot?
    The answer is idiotic
    Bootloader can flash all main partitions only in both A and B sections at the same time command type - "fastboot flash system_ab system.img"
    He knows how to essentially flash a couple of partitions into a certain slot, we only need in this case vendor_boot and boot command type "fastboot flash boot_a boot.img" or instead of A you need to write B
    FastbootD, on the other hand, can flash img images separately into the desired slot A or B

    2.6 Poco f3/k40/mi11x does not have a separate partition for recovery/twrp,the whole thing is stored in the boot sector in the ramdisk, and the kernel is also stored there. Several factors follow from this knowledge.
    2.6.1 To install TWRP, you must first boot into a temporary TWRP, the command type is "fastboot boot twrp.img". Inside TWRP, in the Advanced tab, click install recovery ramdisk, and select the img twrp image on the phone
    2.6.3 To install aosp recvoery, you need to flash boot "fastboot boot boot.img"
    2.6.4 After installing magisk, as it is stored in the RAMDISK. If you install TWRP again in ramdisk, the magisk will be deleted
    2.6.5 When installing the magisk, TWRP does not crash
    2.6.6 When installing kernel.zip via TWRP, TWRPis not deleted.
    2.6.7 After updating the ROM, or changing the ROM, the TWRPis deleted, since the boot sector is bundled with all the ROMs as a whole and mainly with aosp recovery included, some romodels can immediately push TWRP into it. But it's better to play it safe and flash it yourself
    2.6.8 When entering TWRP, it writes the installation .zip archives to the active slot, and always works with the active slot A or B, the exception concerns firmware, wrote above in paragraph 2.3
    2.6.9 install recovery ramdis on surveillance writes TWRP to both slots
    3.1 There are currently only 2 TWRPs from Nebrassy and from vasishath. What is the difference? God knows. In fact, they are bugged equally strongly, so I will write instructions using the example of Nebrassy, from experience there are no problems with it.
    3.2 AOSP recovery is like it was 10 years ago cwm recovery if anyone remembers. Serves only for switching to fastbootD and ADB sideload mode, updating the firmware over the air, and sometimes cleaning the data. Supplied by many ROM developers as a necessary component (in fact, not so)

    Now, based on the knowledge above, we have an understanding of how and what works. Now we need to disassemble the installation procedure. Here, too, not everything is so simple. There are two options for each installation. And in addition, we have 10 ways to install firmware. Why 10? And all due to the fact that I was unaware and had to write a small script called DFE. Isn't there a ready-made one on the Internet? According to my tests, they simply don't work.
    Somewhere 90% of ROM Developers out of the box have such a function as data encryption, DFE removes "flags" from one file in the /vendor section so that the system encrypts the data "Entire /data section" at startup therefore, just like with TWRP, after changing or updating the firmware, you need to flash it through TWRP.
    - Why should I remove encryption? - ask a question
    I will answer, in fact, there is no need, if only you are ready to always back up all data to a flash drive or PC from the internal memory of the phone when changing the firmware, because not all firmware have the same encryption keys, and you can install the firmware, but it is simply will not start at best, at worst everything will be encrypted over a new one and all files will be lost.
    But literally all the instructions from the developers of the ROM are written precisely taking into account the fact that you will format the date when installing their firmware. Also, if encryption is disabled, TWRP will not ask for a password to see the memory, and therefore your data is at risk when the phone is stolen, since it will not be difficult to pull them out.
    For all cases, you cannot do format data before installing the firmware, otherwise the PC will not see the memory, format data is done only at the end of the installation.
    Method 1:
    1. We drop twrp.img into the folder with adb
    2. In windows, hold down shift + right mouse button in an empty space in the folder, open a shell or cmd
    3. The console will open, in the case of win10 / 11, if this is a shell, you need to register cmd
    4. Reboot the phone into fastboot mode / bootloader (volume down + power button) and connect it to the computer via the wire
    5. We write to the command "fastboot boot twrp.img"
    6. TWRP will start by itself

    Method 2:
    1.Download TWRP Autoruner https://drive.google.com/file/d/1HsA1XAEzFgEo0n7K1Vf0QqPlyEICzkpd/view?usp=sharing
    2. Unpack anywhere
    3. Boot into FastBoot
    4. Run the batch file in the folder
    Method 1: Works ALWAYS
    1. Go to the advanced tab and select install recvoery ramdisk
    2. Find the twrp.img file on your phone and select it
    3. If TWRP shows "Error opening: No such file or directory"
    then you need to change the active slot in the Reboot contribution, then back and flash TWRP into the ramdisk again

    Method 2: For TWRP from Nebrassy does not work 100% of the time
    In the same place, in the advanced tab, click flash current TWRP

    Method 3: For TWRP from Vasishath. does not work 100%
    In the same place, in the advanced tab, click Inject TWRP

    Before flashing custom, it is recommended to install a miui stock or a custom miui. It is advisable to drain through a fastboot by analogy with the spoiler instruction, from point 1 to point 9
    This is done in order to update all sections in memory, remove tails from other ROMs. Refresh the markup of the sections. Otherwise, there may be errors, not working conditional nfc, lags, whatever. In the best case, the ROM simply won't be installed. At worst, there will be a bad opinion about the ROM because of your own wrong actions and an extra day for flashing and configuring another or the same ROM.

    All files are additional here

    1. You saw that the PC does not see the memory on the device, or the TWRP is empty (this already means that all the data has been erased)
    2. Download one of these TWRO to your computer
    recovery_vasishath_nonflags.img or recovery_nebrassy_nonflags.img
    3. Through that TWRP where everything is empty, we do format data (yes)
    4. Reboot bootloader
    5. On the PC we prescribe "fastboot boot twrp.img" any of the post
    6. TWRP is loaded (the computer and TWRP sees the memory, but this is not all, nothing will work)
    7. In the advanced tab, click fix context
    8. In the mounts tab, remove the checkbox from the date and put it back.
    9. Now you can upload files from your computer
    10. You flash the ROM, you can not do the date format again, when the system boots, it will erase everything from memory, and if you did not set dfe, then the date itself will be encrypted, if you set the data in the same way, it will be erased, but there will be no encryption.

    Note:
    These TWRPs will not see the date (files in memory) if the data is encrypted, usually TWRP asks for a password when entering it, or you can see it in the security tab.
    This TWRP works fine with the already decrypted date, if you use the DFE patch, everything works normally
    In this TWRP, the encryption flags are simply removed, so that after the date format when entering TWRP, the date is not encrypted with keys from TWRP and does not break from this

    When using DFE, you should not use internal methods of updating in ROM, when the firmware is updated in the background, and when you reboot it is already updated, as I wrote earlier, the sections are updated, and therefore the DFE stops working, and it is rather difficult to predict when the system has updated itself, and if DFE will stop working, all data will be deleted, and the ROM simply will not start, so it's better to manually set everything.


    1. Download zip with fastboot image MIUI
    2. Unpack it to a convenient place
    3. You need to go to the folder, and look for the flash_all_except_storage.bat file there
    4. You need to open it with a text editor and delete the last line with the text "fastboot reboot"
    5. Now, through miflash, we look for the directory with this file
    6. We transfer the phone to fastboot mode (Hold the power button + volume rocker down)
    7. We connect the device with a wire to the computer and, in the program, select the bottom right flash_all_except_storage.bat, press flash
    8. After the end of the process, you need to boot into TWRP
    9. In TWRP, if you did everything correctly, then the memory is not erased.
    10. We transfer DFE from the computer to the phone, or if you did it in advance, then we flash it. in 99% of cases, an inscription will come out that you need to pre-flash SystemRW_1.32. Then we do it.
    11. In the case of SystemRW, you need to reboot into TWRP, then either put it in RamDisk and just reboot, or click reboot bootloader and boot from the computer back to TWRP.
    12. Repeat step 10.
    13. If you have not used DFE before, then you need to do format DATA (yes). If you have updated the firmware in this way, then you do not need to do Format data. If you have changed the firmware, it is recommended to do wipe data, otherwise either the firmware will not boot, or it will not work correctly
    1. Install TWRP in ramdisk and / or go into it
    2. Flash .zip ROM file
    3. Install TWRP in ramdisk
    4. Reboot into TWRP
    5. Flash DFE.zip
    6. If you have not used DFE before, then you need to do format DATA (yes). If you have updated the firmware in this way, then you do not need to do Format data. If you have changed the firmware, it is recommended to do wipe data, otherwise either the firmware will not boot, or it will not work correctly
    1. Download the .zip ROM to your PC. Upload the archive to the adb folder
    2. Then, according to the instructions from the developer, you can flash the vendor and vendor_boot ROM provided by the developer, or load into the temporary TWRP from nebrassy "fastboot flash boot twrp.img", or through the autoinstall script
    3. Further, in the case of AOSP recovery fastboot --set-active = a and fastboot reboot recovery
    5. In twrp, select the advanced section and click adb sideload. in AOSP recovery select Install update through ADB
    6. In the console from the adb folder in which the archive from the ROM is located, write "adb sideload name_file_PZU.zip"
    7. Flash DFE.zip
    8. If you have not used DFE before, then you need to do format DATA (yes). If you have updated the firmware in this way, then you do not need to do Format data. If you have changed the firmware, it is recommended to do wipe data, otherwise either the firmware will not boot, or it will not work correctly
    1. Download CustomMIUI.zip
    2. Install TWRP in ramdisk and / or go into it
    3. Flash CustomMIUI.zip ROM file
    4. Install TWRP in ramdisk
    5. Reboot into TWRP
    6. Flash DFE.zip
    7. If you have not used DFE before, then you need to do format DATA (yes). If you have updated the firmware in this way, then you do not need to do Format data. If you have changed the firmware, it is recommended to do wipe data, otherwise either the firmware will not boot, or it will not work correctly
    1. Download fastboot ROM on PC
    2. Unzip to a convenient place, and go to the folder, find the update.bat file there, you need to open it with a text editor and delete the last line with the text "fastboot reboot"
    3. We transfer the phone to fastboot mode (Hold the power button + volume down)
    4. Run update.bat and wait for the end of the procedure
    5. After the end of the process, you need to boot into TWRP
    9. In TWRP, if you did everything right, then the memory is not erased. Otherwise, I recommend using this method so that the memory appears.
    10. We transfer DFE from the computer to the phone, or if you did it in advance, then we flash it.
    11. If you have not used DFE before, then you need to do format DATA (yes). If you have updated the firmware in this way, then you do not need to do Format data. If you have changed the firmware, it is recommended to do wipe data, otherwise either the firmware will not boot, or it will not work correctly
    1. Download zip with fastboot image MIUI
    2. Unpack it to a convenient place
    3. Now, through miflash, we look for the directory with this file
    4. We transfer the phone to fastboot mode (Hold the power button + volume ring down)
    5. We connect with a wire to the PC and first select in the program at the bottom right flash_all_except_storage.bat (For updating), flash_all.bat (For Clean installation) flash_all_lock.bat (for clean installation and locking the bootloader) or press flash
    6. The system will reboot itself. Ready
    7. Additionally (Magisk, gapps and other zip) after a clean install with all files removed:
    7.1 After loading into the system, we go through the device configuration, and we must put a pin or a graphic key
    7.2 Flash temporary TWRP
    7.3 If you need a TWRP on an ongoing basis, then we flash it into a ramdisk (Imstall recvoery ramdisk), the img image of the TWRP must be on the device
    7.4 Flash the zip archives you need
    7.5 You can make Wipe data to set up your phone again
    8. If you updated your phone, you can do steps 7.2-7.4 Immediately after installing the update
    1. Install TWRP in ramdisk and / or go into it
    2. Flash .zip ROM file
    3. Install TWRP in ramdisk
    4. Make Format Data as indicated in the instructions of the firmware developer, or wipe date if you change it from custom to custom (does not always work), or just boot into the system (Risky !!)
    5.Additional (Magisk, gapps and other zip):
    5.1 If you have updated the ROM, you can flash additional files
    5.2 If you have made format data, you need to boot into the system, go through the setup, put the lock key and reboot into TWRP, after that you can put an additional zip. and make wipe data to configure it again
    1. Download the .zip ROM to your PC. Upload the archive to the adb folder
    2. Further, you can follow the instructions either from the developer, flash the vendor and vendor_boot provided by the developer, or boot into the temporary TWRP from nebrassy "fastboot flash boot twrp.img", or through the autoinstall script
    3. Further, in the case of AOSP recovery fastboot --set-active = a and fastboot reboot recovery
    5. In twrp, select the advanced section and click adb sideload. in aosp recovery select Install update through ADB
    6. In the console, from the adb folder in which the archive with the firmware is located, write adb sideload_file_name.zip
    7. At the end of the process, make Format Data as indicated in the developer's instructions, or wipe the date, if you change it from custom to custom (it does not always work), or just boot into the system
    8.Additional (Magisk, gapps and other zip):
    8.1 After loading into the system, we go through the device configuration, and we must put a pin or a graphic key
    8.2 Reboot the phone into fastboot mode (volume down and hold down the power button) connect the computer, flash the temporary TWRP
    8.3 If you need a TWRP for a constant, then we flash it into a ramdisk (Imstall recvoery ramdisk), the img image of a TWRP must be on the device
    8.4 Flash the zip archives you need
    9. If you updated your phone, you can do steps 8.2-8.4 Immediately after installing the update
    1. Download CustomMIUI.zip
    2. Install TWRP in ramdisk and / or go into it
    3. Flash CustomMIUI.zip ROM file
    4. Install TWRP to ramdisk
    5. Reboot into TWRP
    6. Make Format Data as indicated in the Developer's instructions, or wipe date, if you change miui to miui (does not always work), or just boot into the system
    7.Additional (Magisk, gapps and other zip):
    7.1 In case you have updated the ROM, you can flash additional files
    7.2 If you have made format data, you need to boot into the system, go through the setup, put the lock key and reboot into TWRP, after that you can put an additional zip. and make wipe data to configure it again
    1. Download fastboot ROM on PC
    2. Unzip to a convenient place, and go to the folder, find the update.bat file and installformat.bat there FirestInstall.bat
    3. Go into fastboot mode, connect the device to the PC and select the desired installer, or update, to update, or for a clean install installformat.bat or FirestInstall.bat (all data will be erased, including memory
    4. Additionally (Magisk, gapps and other zip) after a clean install with all files removed:
    4.1 After loading into the system, we go through the device configuration, and we must put a pin or a graphic key
    4.2 Reboot the phone into fastboot mode (volume down and hold down the power button) connect the computer, flash the temporary TWRP
    4.3 If you need TWRP for Permanent then we do it
    4.4 Flash the zip archives you need
    4.5 You can make Wipe data to set up your phone again
    5. If you updated your phone, you can do steps 4.2-4.4 Immediately after installing the update
    1
    I would propose to add and / or replace in the 1st spoiler "diriver and utilities" the link to this site
    to download "miflashtool" 👇


    where the latest version of the software is present. 😉
    Okey, I'll do it later
    1
    I hope everything in this guide is clear. I just used Google translator. I do not speak English myself ideally
    1
    in 99% of cases, an inscription will come out that you need to pre-flash SystemRW_1.32. Then we do it.
    11. In the case of SystemRW, you need to reboot into TWRP, then either put it in RamDisk and just reboot, or click reboot bootloader and boot from the computer back to TWRP.

    Hi @LeeGarChat thanks for your interest in my SystemRW / SuperRW feat. MakeRW script
    Does it work well on your Poco F3 device? You never sent me your log files... 😒
    If you're going to use my SystemRW / SuperRW feat. MakeRW project (or parts thereof) in your thread and make a video about it could you please at least have the decency to include a visible link (not hidden inside of spoiler tags!) to

    the official SystemRW / SuperRW feat. MakeRW by lebigmac project thread

    in the first post of this thread as well as in your video description? Thanks (y)
    And please keep in mind that unauthorized, unverified re-uploads of my SystemRW project files are not allowed!
    The official download links in the official SystemRW / SuperRW feat. MakeRW by lebigmac thread work just fine!
    I can't offer any customer support for old, unofficial, deprecated, unverified versions of my script which were reuploaded by 3rd parties but I can only offer support for the latest official version of my script downloaded directly from the official SystemRW / SuperRW feat. MakeRW by lebigmac project thread

    Thank you!

    Good news! New version of © SystemRW / SuperRW feat. MakeRW™ by lebigmac ® coming soon! Stay tuned!​

    1
    Hey Guys i need your help, i followed all the steps in that post but i could not find the " Onekey injection" so i ignored that step and installed the xiaomi eu rom. Everything went well, now when i want to boot in recovery mode it shows up the stock recovery
    So my question is when i want to update my phone in the future, i have to install it through TWRP and if my data will be lost or no?