[TOOL][WIN/LINUX/MAC] Xiaomi Flashable Firmware Creator V2 (GUI/CLI)

Search This thread

yshalsager

Recognized Developer
Do you want to create your own firmware files from MIUI ROMs without depending on Xiaomi Firmware Updater? Then you need the new tool!
Xiaomi Flashable Firmware Creator
Part of Xiaomi Firmware Updater project
jSIVrRy.png
Code:
#include 
/*
* Your warranty is now void.
*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this tool
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*/

Xiaomi Flashable Firmware Creator is a tool that generates flashable firmware-update packages from official (or non-official?) MIUI ROMS.
It supports creating untouched firmware, non-arb firmware, firmware + vendor flashable zip and firmware-less ROMs.
1.png


Features:
  • CLI and GUI version.
  • Easy-to-use interface.
  • Supports local and remote zip files.
  • Easy to integrate with other Python scripts.
  • Multilanguage support (more than 25 languages!). Thanks to our community members!

Screenshots:
Here, or Here.

GUI Usage:

  • Make sure that you have Python3 installed on your device.
  • Install the tool.
    Code:
    pip3 install xiaomi_flashable_firmware_creator_gui
  • Run the tool.
    Code:
    xiaomi_flashable_firmware_creator_gui
  • Select MIUI zip, or drop it to the box.
  • Choose the output type you would like to create.
  • Click on create button.

CLI Usage:
You need python 3 installed on your device, or you can get the compiled executable from here.
Install the tool using the following command:
Code:
pip3 install xiaomi_flashable_firmware_creator

- Creating normal (untouched) firmware:
Code:
xiaomi_flashable_firmware_creator -F [MIUI ZIP]
- Creating non-arb firmware (without anti-rollback):
Code:
xiaomi_flashable_firmware_creator -N [MIUI ZIP]
- Creating firmware-less ROM (stock untouched ROM with just firmware removed):
Code:
xiaomi_flashable_firmware_creator -L [MIUI ZIP]
- Creating normal vendpr+firmware:
Code:
xiaomi_flashable_firmware_creator -V [MIUI ZIP]

- Using executable files:
On Linux:
Code:
./create_flashable_firmware -F [MIUI ZIP]
On Windows:
Code:
create_flashable_firmware.exe -F [MIUI ZIP]

Detailed Guide:
Check [Guide] How to edit Miui ROMs to flash without bootloader by @AL_IRAQI

Ready-made firmware files:
If you're lazy or looking for ready-made firmware files for whatever Xiaomi device, check my Xiaomi Firmware Updater project. It provides automatically generated Xiaomi firmware flashable zip files for every MIUI new update!

Support and Contact:
Having trouble with firmware files? You can open a new issue on Github repository or just write here in a reply, and I’ll help you sort it out.
Also If you want to add a new feature or fix any problem, feel free to push a PR.

Donations:
My works are free and open-source, that cost money, time and many efforts.
If you want to make a donation, you can use:
- Paypal
- Pateron
- LiberaPay

XDA:DevDB Information
Xiaomi Flashable Firmware Creator V2, Tool/Utility for the Android General

Contributors
yshalsager
Source Code: https://github.com/XiaomiFirmwareUpdater/xiaomi-flashable-firmware-creator


Version Information
Status: Stable
Current Stable Version: 2.0
Stable Release Date: 2020-10-17

Created 2018-11-24
Last Updated 2020-10-17
 

Attachments

  • 1.png
    1.png
    41 KB · Views: 1,747
  • 2.png
    2.png
    88 KB · Views: 1,669
  • 3.png
    3.png
    48.6 KB · Views: 1,587
  • 4.png
    4.png
    75.6 KB · Views: 1,503
  • 5.png
    5.png
    43.7 KB · Views: 1,462
  • 6.png
    6.png
    51.1 KB · Views: 1,430
  • 7.png
    7.png
    42.3 KB · Views: 1,350
  • 8.png
    8.png
    42.9 KB · Views: 1,272
  • 9.png
    9.png
    43.2 KB · Views: 1,274
  • 10.png
    10.png
    59.4 KB · Views: 1,364

robinex

Member
Sep 11, 2018
8
1
in windows 10 give error after make new zip rename.
edit py file with text editor.
Find
Code:
def make_zip():
    rom, process = arg_parse()
    with open("out/META-INF/com/google/android/updater-script", 'r') as i:
        codename = str(i.readlines()[7].split('/', 3)[2]).split(':', 1)[0].replace('_', '-')
    print("Creating " + process + " zip from " + rom + " for " + codename)
    make_archive('firmware', 'zip', 'out/')
    if path.exists('firmware.zip'):
        if process == "firmware":
            rename('firmware.zip', 'fw_' + codename + "_" + rom)
        elif process == "nonarb":
            rename('firmware.zip', 'fw-non-arb_' + codename + "_" + rom)
        elif process == "firmwareless":
            rename('firmware.zip', 'fw-less_' + codename + "_" + rom)
        print("All done!")
        rmtree("tmp")
        rmtree('out')
    else:
        print("Failed!" + '\n' + "Check out folder!")

Replace this

Code:
def make_zip():
    rom, process = arg_parse()
    with open("out/META-INF/com/google/android/updater-script", 'r') as i:
        codename = "NEW"
    print("Creating " + process + " zip from " + rom + " for " + codename)
    make_archive('firmware', 'zip', 'out/')
    if path.exists('firmware.zip'):
        if process == "firmware":
            rename('firmware.zip', 'fw_' + codename + "_.zip")
        elif process == "nonarb":
            rename('firmware.zip', 'fw-non-arb_' + codename + "_.zip")
        elif process == "firmwareless":
            rename('firmware.zip', 'fw-less_' + codename + "_.zip")
        print("All done!")
        rmtree("tmp")
        rmtree('out')
    else:
        print("Failed!" + '\n' + "Check out folder!")
 
  • Like
Reactions: and-roid007

yshalsager

Recognized Developer
V1.1 is here

I was reported that there's some firmware unmounting errors with some devices like mido.
Code:
unmount of /firmware failed; no such volume
mount: failed to mount /dev/block/bootdevice/by-name/sec at /firmware: Invalid argument
It was because of inaccurate grepping of lines with "firmware" in it.
Also, there's a missing line which caused temporary updater-script to be added in firmware zip.

These issues are fixed now. You can get the new update from here:
Py script: https://github.com/XiaomiFirmwareUpdater/xiaomi-flashable-firmware-creator
Executable files: https://github.com/XiaomiFirmwareUpdater/xiaomi-flashable-firmware-creator/releases/tag/V1.1
 

poas12

Member
Dec 20, 2010
6
0
Link to executable files is down

Hi,
the link to the executable files is down.
Can you fix it, please.

Thanks...
 

poas12

Member
Dec 20, 2010
6
0
TWRP: Error 6

Hi,
thanks for your fast support but when i try to install firmware-less.zip I get an error 6 from twrp.

Can you help me, please?
 

poas12

Member
Dec 20, 2010
6
0
TWRP: Error 6

Here the informations:

Xiaomi redmi Note 5 Pro (whyred)
TWRP 3.2.1.3 or TWRP 3.2.3.2
original ROM: miui_HMNote5HMNote5ProGlobal_V10.2.1.0.OEIMIXM_5191f339c3_8.1.zip
modified ROM: fw-less_whyred_miui_HMNote5HMNote5ProGlobal_V10.2.1.0.OEIMIXM_5191f339c3_8.1.zip

Message from twrp:

Installing zip file '/data/media/0/fw-less_whyred_miui_HMNote5HMNote5ProGlobal_V10.2.1.0.OEIMIXM_5191f339c3_8.1.zip'
Checking for Digest file...
Skipping Digest check: no Digest file found
Updater process ended with Error: 6
Error installing zip file '/data/media/0/fw-less_whyred_miui_HMNote5HMNote5ProGlobal_V10.2.1.0.OEIMIXM_5191f339c3_8.1.zip'
 

yshalsager

Recognized Developer
Here the informations:

Xiaomi redmi Note 5 Pro (whyred)
TWRP 3.2.1.3 or TWRP 3.2.3.2
original ROM: miui_HMNote5HMNote5ProGlobal_V10.2.1.0.OEIMIXM_5191f339c3_8.1.zip
modified ROM: fw-less_whyred_miui_HMNote5HMNote5ProGlobal_V10.2.1.0.OEIMIXM_5191f339c3_8.1.zip

Message from twrp:

Installing zip file '/data/media/0/fw-less_whyred_miui_HMNote5HMNote5ProGlobal_V10.2.1.0.OEIMIXM_5191f339c3_8.1.zip'
Checking for Digest file...
Skipping Digest check: no Digest file found
Updater process ended with Error: 6
Error installing zip file '/data/media/0/fw-less_whyred_miui_HMNote5HMNote5ProGlobal_V10.2.1.0.OEIMIXM_5191f339c3_8.1.zip'

In order to know what went wrong I need to check twrp log. Please attach it.
 

inouext

Senior Member
May 5, 2011
344
49
@yshalsager
A little unralated question.
Do you know if the firmware update folder inside Xiaomi EU roms is the firmware of the day or is a custom made by them?
Example: 9.1.10 Xiaomi EU Rom, inside the firmware update folder is from 9.1.10 China rom?
Or should i flash the firmware myself?
I couldn't get this awnser from them.
 

yshalsager

Recognized Developer
@yshalsager
A little unralated question.
Do you know if the firmware update folder inside Xiaomi EU roms is the firmware of the day or is a custom made by them?
Example: 9.1.10 Xiaomi EU Rom, inside the firmware update folder is from 9.1.10 China rom?
Or should i flash the firmware myself?
I couldn't get this awnser from them.

Yes, it's the same official firmware of that day.
You don't have to flash firmware as long as you use miui, whatever it was.
 
  • Like
Reactions: inouext

Top Liked Posts

  • There are no posts matching your filters.
  • 20
    Do you want to create your own firmware files from MIUI ROMs without depending on Xiaomi Firmware Updater? Then you need the new tool!
    Xiaomi Flashable Firmware Creator
    Part of Xiaomi Firmware Updater project
    jSIVrRy.png
    Code:
    #include 
    /*
    * Your warranty is now void.
    *
    * I am not responsible for bricked devices, dead SD cards,
    * thermonuclear war, or you getting fired because the alarm app failed. Please
    * do some research if you have any concerns about features included in this tool
    * before flashing it! YOU are choosing to make these modifications, and if
    * you point the finger at me for messing up your device, I will laugh at you.
    */

    Xiaomi Flashable Firmware Creator is a tool that generates flashable firmware-update packages from official (or non-official?) MIUI ROMS.
    It supports creating untouched firmware, non-arb firmware, firmware + vendor flashable zip and firmware-less ROMs.
    1.png


    Features:
    • CLI and GUI version.
    • Easy-to-use interface.
    • Supports local and remote zip files.
    • Easy to integrate with other Python scripts.
    • Multilanguage support (more than 25 languages!). Thanks to our community members!

    Screenshots:
    Here, or Here.

    GUI Usage:

    • Make sure that you have Python3 installed on your device.
    • Install the tool.
      Code:
      pip3 install xiaomi_flashable_firmware_creator_gui
    • Run the tool.
      Code:
      xiaomi_flashable_firmware_creator_gui
    • Select MIUI zip, or drop it to the box.
    • Choose the output type you would like to create.
    • Click on create button.

    CLI Usage:
    You need python 3 installed on your device, or you can get the compiled executable from here.
    Install the tool using the following command:
    Code:
    pip3 install xiaomi_flashable_firmware_creator

    - Creating normal (untouched) firmware:
    Code:
    xiaomi_flashable_firmware_creator -F [MIUI ZIP]
    - Creating non-arb firmware (without anti-rollback):
    Code:
    xiaomi_flashable_firmware_creator -N [MIUI ZIP]
    - Creating firmware-less ROM (stock untouched ROM with just firmware removed):
    Code:
    xiaomi_flashable_firmware_creator -L [MIUI ZIP]
    - Creating normal vendpr+firmware:
    Code:
    xiaomi_flashable_firmware_creator -V [MIUI ZIP]

    - Using executable files:
    On Linux:
    Code:
    ./create_flashable_firmware -F [MIUI ZIP]
    On Windows:
    Code:
    create_flashable_firmware.exe -F [MIUI ZIP]

    Detailed Guide:
    Check [Guide] How to edit Miui ROMs to flash without bootloader by @AL_IRAQI

    Ready-made firmware files:
    If you're lazy or looking for ready-made firmware files for whatever Xiaomi device, check my Xiaomi Firmware Updater project. It provides automatically generated Xiaomi firmware flashable zip files for every MIUI new update!

    Support and Contact:
    Having trouble with firmware files? You can open a new issue on Github repository or just write here in a reply, and I’ll help you sort it out.
    Also If you want to add a new feature or fix any problem, feel free to push a PR.

    Donations:
    My works are free and open-source, that cost money, time and many efforts.
    If you want to make a donation, you can use:
    - Paypal
    - Pateron
    - LiberaPay

    XDA:DevDB Information
    Xiaomi Flashable Firmware Creator V2, Tool/Utility for the Android General

    Contributors
    yshalsager
    Source Code: https://github.com/XiaomiFirmwareUpdater/xiaomi-flashable-firmware-creator


    Version Information
    Status: Stable
    Current Stable Version: 2.0
    Stable Release Date: 2020-10-17

    Created 2018-11-24
    Last Updated 2020-10-17
    6
    GUI version is now available
    1.png

    Features:
    • CLI and GUI version
    • Easy-to-use interface
    • Multilanguage support (more than 25 languages!). Thanks to our community members!
    Screenshots:
    Here, or Here.

    GUI Usage:

    • Clone or download this repo.
    • Make sure that you have Python3 installed on your device.
    • Install the required packages.
      Code:
      pip3 install -r requirements.txt
    • Run the tool.
      Code:
      python3 main.py
    • Select MIUI zip, or drop it to the box.
    • Choose the output type you would like to create.
    • Click on create button.
    1
    in windows 10 give error after make new zip rename.
    edit py file with text editor.
    Find
    Code:
    def make_zip():
        rom, process = arg_parse()
        with open("out/META-INF/com/google/android/updater-script", 'r') as i:
            codename = str(i.readlines()[7].split('/', 3)[2]).split(':', 1)[0].replace('_', '-')
        print("Creating " + process + " zip from " + rom + " for " + codename)
        make_archive('firmware', 'zip', 'out/')
        if path.exists('firmware.zip'):
            if process == "firmware":
                rename('firmware.zip', 'fw_' + codename + "_" + rom)
            elif process == "nonarb":
                rename('firmware.zip', 'fw-non-arb_' + codename + "_" + rom)
            elif process == "firmwareless":
                rename('firmware.zip', 'fw-less_' + codename + "_" + rom)
            print("All done!")
            rmtree("tmp")
            rmtree('out')
        else:
            print("Failed!" + '\n' + "Check out folder!")

    Replace this

    Code:
    def make_zip():
        rom, process = arg_parse()
        with open("out/META-INF/com/google/android/updater-script", 'r') as i:
            codename = "NEW"
        print("Creating " + process + " zip from " + rom + " for " + codename)
        make_archive('firmware', 'zip', 'out/')
        if path.exists('firmware.zip'):
            if process == "firmware":
                rename('firmware.zip', 'fw_' + codename + "_.zip")
            elif process == "nonarb":
                rename('firmware.zip', 'fw-non-arb_' + codename + "_.zip")
            elif process == "firmwareless":
                rename('firmware.zip', 'fw-less_' + codename + "_.zip")
            print("All done!")
            rmtree("tmp")
            rmtree('out')
        else:
            print("Failed!" + '\n' + "Check out folder!")
    1
    @yshalsager
    A little unralated question.
    Do you know if the firmware update folder inside Xiaomi EU roms is the firmware of the day or is a custom made by them?
    Example: 9.1.10 Xiaomi EU Rom, inside the firmware update folder is from 9.1.10 China rom?
    Or should i flash the firmware myself?
    I couldn't get this awnser from them.

    Yes, it's the same official firmware of that day.
    You don't have to flash firmware as long as you use miui, whatever it was.
    1
    -F --firmware argument generates the firmware ZIP normally, however the other two arguments -N/ --noarb and -L/ --firmwareless are failing, and finally -V/ --vendor works again.

    The same occurs on Windows and in latest Debian 12. Tried all things, basically...

    Bash:
    Welcome to Termux!
    
    Docs:       https://termux.dev/docs
    Donate:     https://termux.dev/donate
    Community:  https://termux.dev/community
    
    Working with packages:
    
     - Search:  pkg search <query>
     - Install: pkg install <package>
     - Upgrade: pkg upgrade
    
    Subscribing to additional repositories:
    
     - Root:    pkg install root-repo
     - X11:     pkg install x11-repo
    
    For fixing any repository issues,
    try 'termux-change-repo' command.
    
    Report issues at https://termux.dev/issues
    ~ $ termux-info
    Termux Variables:
    TERMUX_APK_RELEASE=F_DROID
    TERMUX_APP_PACKAGE_MANAGER=apt
    TERMUX_APP_PID=25203
    TERMUX_IS_DEBUGGABLE_BUILD=0
    TERMUX_MAIN_PACKAGE_FORMAT=debian
    TERMUX_VERSION=0.118.0
    Packages CPU architecture:
    aarch64
    Subscribed repositories:
    # sources.list
    deb https://packages-cf.termux.dev/apt/termux-main/ stable main
    Updatable packages:
    All packages up to date
    termux-tools version:
    1.39.5
    Android version:
    13
    Kernel build information:
    Linux localhost 4.19.157-perf-gf8cdf943b2b3 #1 SMP PREEMPT Fri May 5 13:50:57 UTC 2023 aarch64 Android
    Device manufacturer:
    Xiaomi
    Device model:
    M2012K11AG
    LD Variables:
    LD_LIBRARY_PATH=
    LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
    ~ $ python --version
    Python 3.11.6
    ~ $ pip list
    Package                           Version
    --------------------------------- ----------
    certifi                           2023.11.17
    charset-normalizer                3.3.2
    idna                              3.6
    pip                               23.3.1
    protobuf                          3.20.3
    remotezip                         0.12.1
    requests                          2.31.0
    setuptools                        69.0.2
    tabulate                          0.9.0
    urllib3                           2.1.0
    wheel                             0.42.0
    xiaomi-flashable-firmware-creator 2.2.13
    ~ $ alias xi="xiaomi_flashable_firmware_creator"
    ~ $ cd ~/storage/downloads
    ~/storage/downloads $ xi -F fw_alioth_miui_ALIOTHEEAGlobal_V14.0.9.0.TKHEUXM_13.0.zip -o ~/storage/downloads
    Unzipping MIUI ROM...
    Generating flashing script...
    Creating new zip file..
    All done! Output file is /data/data/com.termux/files/home/storage/downloads/fw_codename_fw_alioth_miui_ALIOTHEEAGlobal_V14.0.9.0.TKHEUXM_13.0.zip
    ~/storage/downloads $ xi -N fw_alioth_miui_ALIOTHEEAGlobal_V14.0.9.0.TKHEUXM_13.0.zip -o ~/storage/downloads
    Unzipping MIUI ROM...
    Traceback (most recent call last):
      File "/data/data/com.termux/files/usr/bin/xiaomi_flashable_firmware_creator", line 8, in <module>
        sys.exit(main())
                 ^^^^^^
      File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/xiaomi_flashable_firmware_creator/xiaomi_flashable_firmware_creator.py", line 43, in main
        new_zip = firmware_creator.auto()
                  ^^^^^^^^^^^^^^^^^^^^^^^
      File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/xiaomi_flashable_firmware_creator/firmware_creator.py", line 522, in auto
        _, invalid_files = self.extract()
                           ^^^^^^^^^^^^^^
      File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/xiaomi_flashable_firmware_creator/firmware_creator.py", line 485, in extract
        raise RuntimeError("Nothing found to extract!")
    RuntimeError: Nothing found to extract!
    ~/storage/downloads $ xi -L fw_alioth_miui_ALIOTHEEAGlobal_V14.0.9.0.TKHEUXM_13.0.zip -o ~/storage/downloads
    Unzipping MIUI ROM...
    Generating flashing script...
    Traceback (most recent call last):
      File "/data/data/com.termux/files/usr/bin/xiaomi_flashable_firmware_creator", line 8, in <module>
        sys.exit(main())
                 ^^^^^^
      File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/xiaomi_flashable_firmware_creator/xiaomi_flashable_firmware_creator.py", line 43, in main
        new_zip = firmware_creator.auto()
                  ^^^^^^^^^^^^^^^^^^^^^^^
      File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/xiaomi_flashable_firmware_creator/firmware_creator.py", line 524, in auto
        self.generate_flashing_script(invalid_files)
      File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/xiaomi_flashable_firmware_creator/firmware_creator.py", line 429, in generate_flashing_script
        self.generate_updater_script(invalid_files)
      File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/xiaomi_flashable_firmware_creator/firmware_creator.py", line 335, in generate_updater_script
        raise RuntimeError("Could not extract lines from updater-script!")
    RuntimeError: Could not extract lines from updater-script!
    ~/storage/downloads $ xi -V fw_alioth_miui_ALIOTHEEAGlobal_V14.0.9.0.TKHEUXM_13.0.zip -o ~/storage/downloads
    Unzipping MIUI ROM...
    Generating flashing script...
    Creating new zip file..
    All done! Output file is /data/data/com.termux/files/home/storage/downloads/fw-vendor_codename_fw_alioth_miui_ALIOTHEEAGlobal_V14.0.9.0.TKHEUXM_13.0.zip
    ~/storage/downloads $
    There's no benefit of making non-arb firmware of devices without arb such as yours. For firmwareless it's only compatible with ROMs with updater-script.