Caution: The process shown below is not for the average user. If you do not understand the process, you should not do it at all. There is a risk of rendering your phone completely dead. Should you need assistance with your phone, contact me on Telegram, I’ll be happy to assist.
Recently I was donated with a fairly new Xiaomi Redmi Note 10 5G smartphone. It was working fine running the latest MIUI (version 13 at the time of writing), but for privacy reasons I wanted to convert it to running LineageOS. A quick search on the official web site showed that there was no official LineageOS version for this model. However, recently there is an option to install a generic version of custom ROMs, called GSI to most devices. I have successfully installed custom ROMs on several phones in the past for myself and for friends and family, but this was the first time I attempted to do such a thing on a modern, project Treble compatible device.
The techniques, tools and tips I share in this article are shown working on my Xiaomi Redmi Note 10 5G, but should work the same way on any similar (i.e. MediaTek CPU, Treble compatible, etc) device.
In this article I will not go into the details how and why I messed up the phone to the point that when switched on it only switched on the LCD backlight for a few second then it switched off again, just to repeat this indefinitely, until the battery ran out with nothing shown on the screen. Enough to say, the phone started to look like a very expensive paperweight… I could not enter recovery
mode (VolumeUp + Power buttons), fastboot
mode (VolumeDown + Power buttons). It was scary…
On the XDA forums there are many ready made, “easy to follow” articles to help you out, but as I found it out, they were not 100% accurate. I have tried a few, learnt a lot from them, but they all failed to bring my phone back to life. That is where my 10+ year experience with similar things come to help. I have adjusted and customized the steps I found all over the internet and compiled them in a more accurate list of steps to help anyone facing the same issue. I also want to thank XDA member wetito for nudging me in the right direction!
Using BROM
mode to make contact with the phone
The Xiaomi Redmi Note 10 5G phone has a MediaTek MT6833 Dimensity 700 CPU. As such the mtktool by bkerler is the weapon of choice when all hope is lost :). Installation and use are listed on the tool’s page.
I recommend using the command line version, as the GUI version kept timing out for me. When this happens to you, no panic, just start it again in command line mode.
Either way, to use the tool, first download and extract the stock ROM for your device. I put my extracted stock firmware files in the E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global
folder.
Then use the following command to revive your phone:
1 |
python mtk wl E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\images\ |
This took 2-3 hours to transfer the required files via USB to the phone. Later on I found a useful tip on the internet (unfortunately I cannot remember where to give credit) how to speed it up: Edit the mtkclient\mtkclient\Library\mtk_daxflash.py
file. Edit the line that says
1 |
dsize = min(length, 0x200) |
to read
1 |
dsize = min(length, 0x2004) |
This will greatly speed up the file transfer. The total time for me went from a couple of hours down to a few (10-15) minutes.
This is a sample output to expect when you first connect the device to the computer:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
PS E:\Downloads\mtkclient> python mtk wl E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\images\ MTK Flash/Exploit Client V1.6.0 (c) B.Kerler 2018-2022 Preloader - Status: Waiting for PreLoader VCOM, please connect mobile Port - Hint: Power off the phone before connecting. For brom mode, press and hold vol up, vol dwn, or all hw buttons and connect usb. For preloader mode, don't press any hw button and connect usb. If it is already connected and on, hold power for 10 seconds to reset. ........Port - Device detected :) Preloader - CPU: MT6833(Dimensity 700 5G k6833) Preloader - HW version: 0x0 Preloader - WDT: 0x10007000 Preloader - Uart: 0x11002000 Preloader - Brom payload addr: 0x100a00 Preloader - DA payload addr: 0x201000 Preloader - CQ_DMA addr: 0x10212000 Preloader - Var1: 0x73 Preloader - Disabling Watchdog... Preloader - HW code: 0x989 Preloader - Target config: 0xe7 Preloader - SBC enabled: True Preloader - SLA enabled: True Preloader - DAA enabled: True Preloader - SWJTAG enabled: True Preloader - EPP_PARAM at 0x600 after EMMC_BOOT/SDMMC_BOOT: False Preloader - Root cert required: False Preloader - Mem read auth: True Preloader - Mem write auth: True Preloader - Cmd 0xC8 blocked: True Preloader - Get Target info Preloader - BROM mode detected. Preloader - HW subcode: 0x8a00 Preloader - HW Ver: 0xca00 Preloader - SW Ver: 0x0 Preloader - ME_ID: *************** Preloader - SOC_ID: *************** PLTools - Loading payload from mt6833_payload.bin, 0x264 bytes PLTools - Kamakiri / DA Run Kamakiri - Trying kamakiri2.. Kamakiri - Done sending payload... PLTools - Successfully sent payload: E:\Downloads\mtkclient\mtkclient\payloads\mt6833_payload.bin Port - Device detected :) DA_handler - Device is protected. DA_handler - Device is in BROM mode. Trying to dump preloader. DAXFlash - Uploading xflash stage 1 from MTK_AllInOne_DA_5.2152.bin xflashext - Patching da1 ... Mtk - Patched "Patched loader msg" in preloader xflashext xflashext - [LIB]: Error on patching da1 version check... Mtk - Patched "Patched loader msg" in preloader Mtk - Patched "get_vfy_policy" in preloader xflashext - Patching da2 ... DAXFlash - Successfully uploaded stage 1, jumping .. Preloader - Jumping to 0x200000 Preloader - Jumping to 0x200000: ok. DAXFlash - Successfully received DA sync DAXFlash - UFS FWVer: 0x34 DAXFlash - UFS Blocksize:0x1000 DAXFlash - UFS ID: KM5P8001DM-B42 DAXFlash - UFS CID: ce014b4d355038303031444d2d423432 DAXFlash - UFS LU0 Size: 0xee5800000 DAXFlash - UFS LU1 Size: 0x400000 DAXFlash - UFS LU2 Size: 0x400000 DAXFlash - DRAM config needed for : ce014b4d355038303031444d2d423432 DAXFlash - Sending emi data ... DAXFlash - DRAM setup passed. DAXFlash - Sending emi data succeeded. DAXFlash - Uploading stage 2... DAXFlash - Upload data was accepted. Jumping to stage 2... DAXFlash - Successfully uploaded stage 2 DAXFlash - UFS FWVer: 0x34 DAXFlash - UFS Blocksize:0x1000 DAXFlash - UFS ID: KM5P8001DM-B42 DAXFlash - UFS CID: ce014b4d355038303031444d2d423432 DAXFlash - UFS LU0 Size: 0xee5800000 DAXFlash - UFS LU1 Size: 0x400000 DAXFlash - UFS LU2 Size: 0x400000 DAXFlash - HW-CODE : 0x989 DAXFlash - HWSUB-CODE : 0x8A00 DAXFlash - HW-VERSION : 0xCA00 DAXFlash - SW-VERSION : 0x0 DAXFlash - CHIP-EVOLUTION : 0x1 DAXFlash - DA-VERSION : 1.0 DAXFlash - Upload data was accepted. Jumping to stage 2... DAXFlash - DA Extensions successfully added DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: boot , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: crclist , skipping Progress: |██████████████████████████████████████████████████| 100.0% Write (Sector 0x1A4681 of 0x1A4681, ) 6.51 MB/s14 MB/sB/s Wrote E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\images\cust.img to sector 367872 with sector count 262912. DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: dpm , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: dtbo , skipping Progress: |██████████████████████████████████████████████████| 100.0% Write (Sector 0x1 of 0x1, ) 0.02 MB/s Wrote E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\images\efuse.img to sector 201216 with sector count 128. DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: elf_path , skipping Progress: |██████████████████████████████████████████████████| 100.0% Write (Sector 0x20 of 0x20, ) 0.33 MB/s Wrote E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\images\gsort.img to sector 328960 with sector count 4096. DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: gz , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: lk , skipping Progress: |██████████████████████████████████████████████████| 100.0% Write (Sector 0xD50 of 0xD50, ) 6.66 MB/s Wrote E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\images\logo.bin to sector 224384 with sector count 2944. DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: mcupm , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: md1img , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: MT6833_Android_scatter , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: oem_misc1 , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: pi_img , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: preloader_camellia , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: provision , skipping Progress: |██████████████████████████████████████████████████| 100.0% Write (Sector 0x51 of 0x51, ) 1.27 MB/s Wrote E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\images\rescue.img to sector 335104 with sector count 32768. DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: scp , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: sparsecrclist , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: spmfw , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: sspm , skipping Progress: |██████████████████████████████████████████████████| 100.0% Write (Sector 0xE05373 of 0xE05373, ) 5.51 MB/s14 MB/sMB/ss Wrote E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\images\super.img to sector 630784 with sector count 2228224. DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: tee , skipping Progress: |██████████████████████████████████████████████████| 100.0% Write (Sector 0x26FA02 of 0x26FA02, ) 8.00 MB/s14 MB/ssB/s Wrote E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\images\userdata.img to sector 2859008 with sector count 12756984. DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: vbmeta , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: vbmeta_system , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: vbmeta_vendor , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: ffu_list , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: MICRON_LYRA2_64GB_0605 , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: S101_64G_430bda1ae4_MICRON , skipping DA_handler DA_handler - [LIB]: Error: Couldn't detect partition: S201_64G_dd6e035122_MICRON , skipping |
If all goes well, you will at least have the option to go to fastboot
mode.
If not, issue the following command, again, in BROM
mode:
python mtk w boot_a "E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\images\boot.img"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
PS E:\Downloads\mtkclient> python mtk w boot_a "E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\images\boot.img" MTK Flash/Exploit Client V1.6.0 (c) B.Kerler 2018-2022 Preloader - Status: Waiting for PreLoader VCOM, please connect mobile Port - Hint: Power off the phone before connecting. For brom mode, press and hold vol up, vol dwn, or all hw buttons and connect usb. For preloader mode, don't press any hw button and connect usb. If it is already connected and on, hold power for 10 seconds to reset. ........... Port - Device detected :) Preloader - CPU: MT6833(Dimensity 700 5G k6833) Preloader - HW version: 0x0 Preloader - WDT: 0x10007000 Preloader - Uart: 0x11002000 Preloader - Brom payload addr: 0x100a00 Preloader - DA payload addr: 0x201000 Preloader - CQ_DMA addr: 0x10212000 Preloader - Var1: 0x73 Preloader - Disabling Watchdog... Preloader - HW code: 0x989 Preloader - Target config: 0xe7 Preloader - SBC enabled: True Preloader - SLA enabled: True Preloader - DAA enabled: True Preloader - SWJTAG enabled: True Preloader - EPP_PARAM at 0x600 after EMMC_BOOT/SDMMC_BOOT: False Preloader - Root cert required: False Preloader - Mem read auth: True Preloader - Mem write auth: True Preloader - Cmd 0xC8 blocked: True Preloader - Get Target info Preloader - BROM mode detected. Preloader - HW subcode: 0x8a00 Preloader - HW Ver: 0xca00 Preloader - SW Ver: 0x0 Preloader - ME_ID: ************* Preloader - SOC_ID: ******************* PLTools - Loading payload from mt6833_payload.bin, 0x264 bytes PLTools - Kamakiri / DA Run Kamakiri - Trying kamakiri2.. Kamakiri - Done sending payload... PLTools - Successfully sent payload: E:\Downloads\mtkclient\mtkclient\payloads\mt6833_payload.bin Port - Device detected :) DA_handler - Device is protected. DA_handler - Device is in BROM mode. Trying to dump preloader. DAXFlash - Uploading xflash stage 1 from MTK_AllInOne_DA_5.2152.bin xflashext - Patching da1 ... Mtk - Patched "Patched loader msg" in preloader xflashext xflashext - [LIB]: Error on patching da1 version check... Mtk - Patched "Patched loader msg" in preloader Mtk - Patched "get_vfy_policy" in preloader xflashext - Patching da2 ... DAXFlash - Successfully uploaded stage 1, jumping .. Preloader - Jumping to 0x200000 Preloader - Jumping to 0x200000: ok. DAXFlash - Successfully received DA sync DAXFlash - UFS FWVer: 0x34 DAXFlash - UFS Blocksize:0x1000 DAXFlash - UFS ID: KM5P8001DM-B42 DAXFlash - UFS CID: ce014b4d355038303031444d2d423432 DAXFlash - UFS LU0 Size: 0xee5800000 DAXFlash - UFS LU1 Size: 0x400000 DAXFlash - UFS LU2 Size: 0x400000 DAXFlash - DRAM config needed for : ce014b4d355038303031444d2d423432 DAXFlash - Sending emi data ... DAXFlash - DRAM setup passed. DAXFlash - Sending emi data succeeded. DAXFlash - Uploading stage 2... DAXFlash - Upload data was accepted. Jumping to stage 2... DAXFlash - Successfully uploaded stage 2 DAXFlash - UFS FWVer: 0x34 DAXFlash - UFS Blocksize:0x1000 DAXFlash - UFS ID: KM5P8001DM-B42 DAXFlash - UFS CID: ce014b4d355038303031444d2d423432 DAXFlash - UFS LU0 Size: 0xee5800000 DAXFlash - UFS LU1 Size: 0x400000 DAXFlash - UFS LU2 Size: 0x400000 DAXFlash - HW-CODE : 0x989 DAXFlash - HWSUB-CODE : 0x8A00 DAXFlash - HW-VERSION : 0xCA00 DAXFlash - SW-VERSION : 0x0 DAXFlash - CHIP-EVOLUTION : 0x1 DAXFlash - DA-VERSION : 1.0 DAXFlash - Upload data was accepted. Jumping to stage 2... DAXFlash - DA Extensions successfully added Progress: |██████████████████████████████████████████████████| 100.0% Write (Sector 0x20000 of 0x20000, ) 7.11 MB/s53 MB/s Wrote E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\images\boot.img to sector 163840 with sector count 16384. |
Using fastboot
mode to restore stock ROM
To upload the stock ROM in fastboot
mode, you need to make sure you have downloaded the fastboot version of the ROM. You can find both recovery and fastboot versions of the stock ROM with a bit of a search. Make sure it is for your model exactly!
Once downloaded and extracted (to a folder which has no space in its path, otherwise the flash process will fail), you should use the batch files (or shell scripts, if you are Linux) included. Many recommend using MiFlash utility, but I couldn’t get it to work – it kept timing out and failing other ways. Finally I decided to do it the proper way, from the command line. The command line scripts are included as part of the stock ROM packages, so you don’t have to download/install anything else.
I recommmend using the flash_all.bat
(or flash_all.sh
for Linux users) to do the job. The scripts use standard platform-tools
commands, so you should have them already in your PATH. If they are not, you can modify the flash_all.bat
file as I did:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
E:\Downloads\platform-tools\fastboot.exe %* getvar product 2>&1 | findstr /r /c:"^product: *camellia" || @echo "error : Missmatching image and device" && exit /B 1 set CURRENT_ANTI_VER=1 for /f "tokens=2 delims=: " %%i in ('E:\Downloads\platform-tools\fastboot.exe %* getvar anti 2^>^&1 ^| findstr /r /#c:"anti:"') do (set version=%%i) if [%version%] EQU [] set version=0 if %version% GTR %CURRENT_ANTI_VER% ( @echo "error : current device antirollback version is greater than this package" exit /B 1 ) E:\Downloads\platform-tools\fastboot.exe erase boot || @echo "Erase boot error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe erase metadata || @echo "Erase metadata error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash preloader_a %~dp0\images\preloader_camellia.bin || @echo "Flash preloader_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash preloader_b %~dp0\images\preloader_camellia.bin || @echo "Flash preloader_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash logo %~dp0\images\logo.bin || @echo "Flash logo error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash tee_a %~dp0\images\tee.img || @echo "Flash tee_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash tee_b %~dp0\images\tee.img || @echo "Flash tee_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash scp_a %~dp0\images\scp.img || @echo "Flash scp_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash scp_b %~dp0\images\scp.img || @echo "Flash scp_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash sspm_a %~dp0\images\sspm.img || @echo "Flash sspm_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash sspm_b %~dp0\images\sspm.img || @echo "Flash sspm_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash lk_a %~dp0\images\lk.img || @echo "Flash lk_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash lk_b %~dp0\images\lk.img || @echo "Flash lk_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash super %~dp0\images\super.img || @echo "Flash super error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash boot_a %~dp0\images\boot.img || @echo "Flash boot_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash boot_b %~dp0\images\boot.img || @echo "Flash boot_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash dtbo_a %~dp0\images\dtbo.img || @echo "Flash dtbo_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash dtbo_b %~dp0\images\dtbo.img || @echo "Flash dtbo_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash rescue %~dp0\images\rescue.img || @echo "Flash rescue error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash vbmeta_a %~dp0\images\vbmeta.img || @echo "Flash vbmeta_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash vbmeta_b %~dp0\images\vbmeta.img || @echo "Flash vbmeta_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash spmfw_a %~dp0\images\spmfw.img || @echo "Flash spmfw_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash spmfw_b %~dp0\images\spmfw.img || @echo "Flash spmfw_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash pi_img_a %~dp0\images\pi_img.img || @echo "Flash pi_img_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash pi_img_b %~dp0\images\pi_img.img || @echo "Flash pi_img_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash dpm_a %~dp0\images\dpm.img || @echo "Flash dpm_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash dpm_b %~dp0\images\dpm.img || @echo "Flash dpm_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash mcupm_a %~dp0\images\mcupm.img || @echo "Flash mcupm_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash mcupm_b %~dp0\images\mcupm.img || @echo "Flash mcupm_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash gz_a %~dp0\images\gz.img || @echo "Flash gz_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash gz_b %~dp0\images\gz.img || @echo "Flash gz_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash md1img_a %~dp0\images\md1img.img || @echo "Flash md1img_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash md1img_b %~dp0\images\md1img.img || @echo "Flash md1img_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash vbmeta_system_a %~dp0\images\vbmeta_system.img || @echo "Flash vbmeta_system_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash vbmeta_vendor_a %~dp0\images\vbmeta_vendor.img || @echo "Flash vbmeta_vendor_a error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash vbmeta_system_b %~dp0\images\vbmeta_system.img || @echo "Flash vbmeta_system_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash vbmeta_vendor_b %~dp0\images\vbmeta_vendor.img || @echo "Flash vbmeta_vendor_b error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash cust %~dp0\images\cust.img || @echo "Flash cust error" && exit /B 1 error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe flash userdata %~dp0\images\userdata.img || @echo "Flash userdata error" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe set_active a || @echo "boot from slot a" && exit /B 1 E:\Downloads\platform-tools\fastboot.exe oem cdms E:\Downloads\platform-tools\fastboot.exe reboot || @echo "Reboot error" && exit /B 1 |
As you can see all I did was to make sure that the fastboot
command is accessible to the script.
Once ready, put the phone in fastboot
mode, and issue this command:
1 |
.\f.bat |
This will execute all the commands in the batch file one by one, you can follow them on the screen:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
PS E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global> .\f.bat E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe getvar product 2>&1 | findstr /r /c:"^product: *camellia" || product: camellian E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>set CURRENT_ANTI_VER=1 E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>for /F "tokens=2 delims=: " %i in ('E:\Downloads\platform-tools\fastboot.exe getvar anti 2>&1 | findstr /r /#c:"anti:"') do (set version=%i ) FINDSTR: /# ignored E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>(set version=1 ) E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>if [1] EQU [] set version=0 E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>if 1 GTR 1 ( exit /B 1 ) E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe erase boot || Erasing 'boot_a' OKAY [ 0.532s] Finished. Total time: 0.538s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe erase metadata || Erasing 'metadata' OKAY [ 0.267s] Finished. Total time: 0.279s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash preloader_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\preloader_camellia.bin || Sending 'preloader_a' (389 KB) OKAY [ 0.031s] Writing 'preloader_a' OKAY [ 0.009s] Finished. Total time: 0.064s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash preloader_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\preloader_camellia.bin || Sending 'preloader_b' (389 KB) OKAY [ 0.031s] Writing 'preloader_b' OKAY [ 0.009s] Finished. Total time: 0.061s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash logo E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\logo.bin || Sending 'logo' (1703 KB) OKAY [ 0.096s] Writing 'logo' OKAY [ 0.008s] Finished. Total time: 0.164s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash tee_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\tee.img || Sending 'tee_a' (2568 KB) OKAY [ 0.129s] Writing 'tee_a' OKAY [ 0.016s] Finished. Total time: 0.193s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash tee_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\tee.img || Sending 'tee_b' (2568 KB) OKAY [ 0.104s] Writing 'tee_b' OKAY [ 0.021s] Finished. Total time: 0.147s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash scp_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\scp.img || Sending 'scp_a' (1056 KB) OKAY [ 0.083s] Writing 'scp_a' OKAY [ 0.006s] Finished. Total time: 0.146s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash scp_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\scp.img || Sending 'scp_b' (1056 KB) OKAY [ 0.054s] Writing 'scp_b' OKAY [ 0.008s] Finished. Total time: 0.086s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash sspm_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\sspm.img || Sending 'sspm_a' (647 KB) OKAY [ 0.042s] Writing 'sspm_a' OKAY [ 0.007s] Finished. Total time: 0.104s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash sspm_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\sspm.img || Sending 'sspm_b' (647 KB) OKAY [ 0.039s] Writing 'sspm_b' OKAY [ 0.007s] Finished. Total time: 0.068s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash lk_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\lk.img || Sending 'lk_a' (1551 KB) OKAY [ 0.082s] Writing 'lk_a' OKAY [ 0.012s] Finished. Total time: 0.150s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash lk_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\lk.img || Sending 'lk_b' (1551 KB) OKAY [ 0.069s] Writing 'lk_b' OKAY [ 0.009s] Finished. Total time: 0.102s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash super E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\super.img || Sending sparse 'super' 1/58 (131069 KB) OKAY [ 7.907s] Writing 'super' OKAY [ 1.009s] Sending sparse 'super' 2/58 (129919 KB) OKAY [ 8.510s] Writing 'super' OKAY [ 1.049s] Sending sparse 'super' 3/58 (130725 KB) OKAY [ 8.636s] Writing 'super' OKAY [ 0.857s] Sending sparse 'super' 4/58 (130345 KB) OKAY [ 8.425s] Writing 'super' OKAY [ 0.798s] Sending sparse 'super' 5/58 (131068 KB) OKAY [ 8.380s] Writing 'super' OKAY [ 0.422s] Sending sparse 'super' 6/58 (130225 KB) OKAY [ 8.440s] Writing 'super' OKAY [ 1.030s] Sending sparse 'super' 7/58 (129678 KB) OKAY [ 8.449s] Writing 'super' OKAY [ 3.935s] Sending sparse 'super' 8/58 (130186 KB) OKAY [ 8.871s] Writing 'super' OKAY [ 1.010s] Sending sparse 'super' 9/58 (130857 KB) OKAY [ 8.468s] Writing 'super' OKAY [ 1.020s] Sending sparse 'super' 10/58 (130130 KB) OKAY [ 7.770s] Writing 'super' OKAY [ 1.698s] Sending sparse 'super' 11/58 (130558 KB) OKAY [ 8.438s] Writing 'super' OKAY [ 1.829s] Sending sparse 'super' 12/58 (131060 KB) OKAY [ 8.687s] Writing 'super' OKAY [ 0.534s] Sending sparse 'super' 13/58 (129710 KB) OKAY [ 8.710s] Writing 'super' OKAY [ 2.171s] Sending sparse 'super' 14/58 (116352 KB) OKAY [ 6.995s] Writing 'super' OKAY [ 0.839s] Sending sparse 'super' 15/58 (129504 KB) OKAY [ 8.540s] Writing 'super' OKAY [ 0.513s] Sending sparse 'super' 16/58 (127284 KB) OKAY [ 8.236s] Writing 'super' OKAY [ 0.563s] Sending sparse 'super' 17/58 (121229 KB) OKAY [ 7.472s] Writing 'super' OKAY [ 0.793s] Sending sparse 'super' 18/58 (131068 KB) OKAY [ 8.639s] Writing 'super' OKAY [ 0.902s] Sending sparse 'super' 19/58 (117521 KB) OKAY [ 7.481s] Writing 'super' OKAY [ 0.986s] Sending sparse 'super' 20/58 (129245 KB) OKAY [ 8.506s] Writing 'super' OKAY [ 1.275s] Sending sparse 'super' 21/58 (131068 KB) OKAY [ 8.964s] Writing 'super' OKAY [ 1.081s] Sending sparse 'super' 22/58 (131068 KB) OKAY [ 8.352s] Writing 'super' OKAY [ 0.938s] Sending sparse 'super' 23/58 (131071 KB) OKAY [ 8.601s] Writing 'super' OKAY [ 1.672s] Sending sparse 'super' 24/58 (122688 KB) OKAY [ 7.769s] Writing 'super' OKAY [ 1.265s] Sending sparse 'super' 25/58 (131069 KB) OKAY [ 8.176s] Writing 'super' OKAY [ 0.769s] Sending sparse 'super' 26/58 (122351 KB) OKAY [ 10.171s] Writing 'super' OKAY [ 3.678s] Sending sparse 'super' 27/58 (131068 KB) OKAY [ 8.547s] Writing 'super' OKAY [ 0.512s] Sending sparse 'super' 28/58 (131068 KB) OKAY [ 8.246s] Writing 'super' OKAY [ 0.881s] Sending sparse 'super' 29/58 (115572 KB) OKAY [ 7.235s] Writing 'super' OKAY [ 0.650s] Sending sparse 'super' 30/58 (128372 KB) OKAY [ 6.976s] Writing 'super' OKAY [ 0.762s] Sending sparse 'super' 31/58 (121408 KB) OKAY [ 6.600s] Writing 'super' OKAY [ 0.448s] Sending sparse 'super' 32/58 (130968 KB) OKAY [ 7.277s] Writing 'super' OKAY [ 0.810s] Sending sparse 'super' 33/58 (130881 KB) OKAY [ 6.664s] Writing 'super' OKAY [ 0.672s] Sending sparse 'super' 34/58 (129422 KB) OKAY [ 7.094s] Writing 'super' OKAY [ 2.250s] Sending sparse 'super' 35/58 (131004 KB) OKAY [ 6.484s] Writing 'super' OKAY [ 1.141s] Sending sparse 'super' 36/58 (130940 KB) OKAY [ 6.813s] Writing 'super' OKAY [ 0.703s] Sending sparse 'super' 37/58 (129770 KB) OKAY [ 7.471s] Writing 'super' OKAY [ 1.109s] Sending sparse 'super' 38/58 (131060 KB) OKAY [ 6.219s] Writing 'super' OKAY [ 0.609s] Sending sparse 'super' 39/58 (131060 KB) OKAY [ 6.344s] Writing 'super' OKAY [ 0.859s] Sending sparse 'super' 40/58 (130112 KB) OKAY [ 6.733s] Writing 'super' OKAY [ 1.344s] Sending sparse 'super' 41/58 (129786 KB) OKAY [ 7.029s] Writing 'super' OKAY [ 1.641s] Sending sparse 'super' 42/58 (122616 KB) OKAY [ 6.391s] Writing 'super' OKAY [ 1.234s] Sending sparse 'super' 43/58 (123052 KB) OKAY [ 6.406s] Writing 'super' OKAY [ 0.906s] Sending sparse 'super' 44/58 (126772 KB) OKAY [ 6.438s] Writing 'super' OKAY [ 1.000s] Sending sparse 'super' 45/58 (121165 KB) OKAY [ 6.250s] Writing 'super' OKAY [ 0.953s] Sending sparse 'super' 46/58 (124328 KB) OKAY [ 6.531s] Writing 'super' OKAY [ 0.844s] Sending sparse 'super' 47/58 (126736 KB) OKAY [ 6.359s] Writing 'super' OKAY [ 1.172s] Sending sparse 'super' 48/58 (130948 KB) OKAY [ 6.516s] Writing 'super' OKAY [ 1.187s] Sending sparse 'super' 49/58 (131068 KB) OKAY [ 6.673s] Writing 'super' OKAY [ 0.609s] Sending sparse 'super' 50/58 (131068 KB) OKAY [ 6.782s] Writing 'super' OKAY [ 0.500s] Sending sparse 'super' 51/58 (131068 KB) OKAY [ 6.734s] Writing 'super' OKAY [ 0.891s] Sending sparse 'super' 52/58 (131068 KB) OKAY [ 6.922s] Writing 'super' OKAY [ 0.922s] Sending sparse 'super' 53/58 (131068 KB) OKAY [ 6.915s] Writing 'super' OKAY [ 1.266s] Sending sparse 'super' 54/58 (131068 KB) OKAY [ 6.406s] Writing 'super' OKAY [ 1.453s] Sending sparse 'super' 55/58 (126388 KB) OKAY [ 6.453s] Writing 'super' OKAY [ 1.125s] Sending sparse 'super' 56/58 (126020 KB) OKAY [ 6.406s] Writing 'super' OKAY [ 1.422s] Sending sparse 'super' 57/58 (119604 KB) OKAY [ 6.002s] Writing 'super' OKAY [ 1.250s] Sending sparse 'super' 58/58 (47116 KB) OKAY [ 2.266s] Writing 'super' OKAY [ 0.312s] Finished. Total time: 507.753s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash boot_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\boot.img || Sending 'boot_a' (65536 KB) OKAY [ 3.297s] Writing 'boot_a' OKAY [ 0.547s] Finished. Total time: 3.922s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash boot_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\boot.img || Sending 'boot_b' (65536 KB) OKAY [ 2.234s] Writing 'boot_b' OKAY [ 0.234s] Finished. Total time: 2.484s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash dtbo_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\dtbo.img || Sending 'dtbo_a' (147 KB) OKAY [ 0.016s] Writing 'dtbo_a' OKAY [ 0.000s] Finished. Total time: 0.078s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash dtbo_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\dtbo.img || Sending 'dtbo_b' (147 KB) OKAY [ 0.016s] Writing 'dtbo_b' OKAY [ 0.016s] Finished. Total time: 0.047s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash rescue E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\rescue.img || Sending 'rescue' (40 KB) OKAY [ 0.016s] Writing 'rescue' OKAY [ 0.016s] Finished. Total time: 0.078s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash vbmeta_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\vbmeta.img || Sending 'vbmeta_a' (4 KB) OKAY [ 0.016s] Writing 'vbmeta_a' OKAY [ 0.000s] Finished. Total time: 0.047s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash vbmeta_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\vbmeta.img || Sending 'vbmeta_b' (4 KB) OKAY [ 0.016s] Writing 'vbmeta_b' OKAY [ 0.016s] Finished. Total time: 0.047s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash spmfw_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\spmfw.img || Sending 'spmfw_a' (14 KB) OKAY [ 0.031s] Writing 'spmfw_a' OKAY [ 0.000s] Finished. Total time: 0.047s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash spmfw_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\spmfw.img || Sending 'spmfw_b' (14 KB) OKAY [ 0.016s] Writing 'spmfw_b' OKAY [ 0.000s] Finished. Total time: 0.047s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash pi_img_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\pi_img.img || Sending 'pi_img_a' (5 KB) OKAY [ 0.016s] Writing 'pi_img_a' OKAY [ 0.000s] Finished. Total time: 0.063s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash pi_img_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\pi_img.img || Sending 'pi_img_b' (5 KB) OKAY [ 0.031s] Writing 'pi_img_b' OKAY [ 0.000s] Finished. Total time: 0.031s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash dpm_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\dpm.img || Sending 'dpm_a' (144 KB) OKAY [ 0.031s] Writing 'dpm_a' OKAY [ 0.016s] Finished. Total time: 0.094s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash dpm_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\dpm.img || Sending 'dpm_b' (144 KB) OKAY [ 0.031s] Writing 'dpm_b' OKAY [ 0.016s] Finished. Total time: 0.047s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash mcupm_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\mcupm.img || Sending 'mcupm_a' (393 KB) OKAY [ 0.031s] Writing 'mcupm_a' OKAY [ 0.000s] Finished. Total time: 0.078s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash mcupm_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\mcupm.img || Sending 'mcupm_b' (393 KB) OKAY [ 0.031s] Writing 'mcupm_b' OKAY [ 0.000s] Finished. Total time: 0.047s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash gz_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\gz.img || Sending 'gz_a' (2779 KB) OKAY [ 0.172s] Writing 'gz_a' OKAY [ 0.016s] Finished. Total time: 0.281s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash gz_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\gz.img || Sending 'gz_b' (2779 KB) OKAY [ 0.109s] Writing 'gz_b' OKAY [ 0.031s] Finished. Total time: 0.156s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash md1img_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\md1img.img || Sending 'md1img_a' (61827 KB) OKAY [ 2.734s] Writing 'md1img_a' OKAY [ 0.234s] Finished. Total time: 3.031s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash md1img_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\md1img.img || Sending 'md1img_b' (61827 KB) OKAY [ 2.109s] Writing 'md1img_b' OKAY [ 0.359s] Finished. Total time: 2.484s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash vbmeta_system_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\vbmeta_system.img || Sending 'vbmeta_system_a' (4 KB) OKAY [ 0.016s] Writing 'vbmeta_system_a' OKAY [ 0.000s] Finished. Total time: 0.062s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash vbmeta_vendor_a E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\vbmeta_vendor.img || Sending 'vbmeta_vendor_a' (4 KB) OKAY [ 0.031s] Writing 'vbmeta_vendor_a' OKAY [ 0.000s] Finished. Total time: 0.047s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash vbmeta_system_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\vbmeta_system.img || Sending 'vbmeta_system_b' (4 KB) OKAY [ 0.016s] Writing 'vbmeta_system_b' OKAY [ 0.000s] Finished. Total time: 0.031s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash vbmeta_vendor_b E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\vbmeta_vendor.img || Sending 'vbmeta_vendor_b' (4 KB) OKAY [ 0.016s] Writing 'vbmeta_vendor_b' OKAY [ 0.000s] Finished. Total time: 0.047s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash cust E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\cust.img || Sending sparse 'cust' 1/7 (129728 KB) OKAY [ 6.094s] Writing 'cust' OKAY [ 0.719s] Sending sparse 'cust' 2/7 (128760 KB) OKAY [ 6.800s] Writing 'cust' OKAY [ 0.531s] Sending sparse 'cust' 3/7 (129028 KB) OKAY [ 5.922s] Writing 'cust' OKAY [ 0.703s] Sending sparse 'cust' 4/7 (128764 KB) OKAY [ 5.906s] Writing 'cust' OKAY [ 0.719s] Sending sparse 'cust' 5/7 (131068 KB) OKAY [ 6.859s] Writing 'cust' OKAY [ 0.953s] Sending sparse 'cust' 6/7 (131068 KB) OKAY [ 6.719s] Writing 'cust' OKAY [ 0.797s] Sending sparse 'cust' 7/7 (82576 KB) OKAY [ 4.344s] Writing 'cust' OKAY [ 0.453s] Finished. Total time: 47.769s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe flash userdata E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\\images\userdata.img || Sending sparse 'userdata' 1/10 (131068 KB) OKAY [ 5.859s] Writing 'userdata' OKAY [ 0.875s] Sending sparse 'userdata' 2/10 (131068 KB) OKAY [ 6.250s] Writing 'userdata' OKAY [ 0.687s] Sending sparse 'userdata' 3/10 (131068 KB) OKAY [ 6.474s] Writing 'userdata' OKAY [ 0.594s] Sending sparse 'userdata' 4/10 (131068 KB) OKAY [ 6.328s] Writing 'userdata' OKAY [ 0.672s] Sending sparse 'userdata' 5/10 (131068 KB) OKAY [ 6.344s] Writing 'userdata' OKAY [ 0.656s] Sending sparse 'userdata' 6/10 (131068 KB) OKAY [ 6.500s] Writing 'userdata' OKAY [ 0.797s] Sending sparse 'userdata' 7/10 (131068 KB) OKAY [ 6.453s] Writing 'userdata' OKAY [ 0.937s] Sending sparse 'userdata' 8/10 (131068 KB) OKAY [ 6.472s] Writing 'userdata' OKAY [ 1.000s] Sending sparse 'userdata' 9/10 (131068 KB) OKAY [ 6.469s] Writing 'userdata' OKAY [ 0.625s] Sending sparse 'userdata' 10/10 (97572 KB) OKAY [ 4.359s] Writing 'userdata' OKAY [ 0.859s] Finished. Total time: 69.728s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe set_active a || Setting current slot to 'a' OKAY [ 0.000s] Finished. Total time: 0.047s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe oem cdms OKAY [ 0.000s] Finished. Total time: 0.000s E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global>E:\Downloads\platform-tools\fastboot.exe reboot || Rebooting OKAY [ 0.000s] Finished. Total time: 0.016s |
The last command is to reboot the phone. If all went well, the phone is now restored to its factory default state. Life is good again! 🙂
Bonus #1: Replace stock MIUI with a GSI
My original goal was to replace the privacy killer MIUI OS with a more privacy friendly OS. In this case I install a GSI version of LineageOS, but (I guess) many other will do as well. The steps below worked for me, so I am recommending them. The steps I found on the internet did NOT work for me, in fact, that’s how I ended up soft-bricking the phone in the first place.
Download a copy of your desired GIS package, then extract it. The content is a single .img file, in my case lineage-19.1-20221011-UNOFFICIAL-arm64_bvS.img
.
Enter the following commands just like I did, one at a time:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
PS E:\Downloads\platform-tools> .\fastboot.exe set_active a Setting current slot to 'a' OKAY [ 0.008s] Finished. Total time: 0.018s PS E:\Downloads\platform-tools> .\fastboot.exe delete-logical-partition product Deleting 'product' OKAY [ 0.010s] Finished. Total time: 0.020s PS E:\Downloads\platform-tools> .\fastboot.exe erase system Erasing 'system_a' OKAY [ 0.084s] Finished. Total time: 0.103s PS E:\Downloads\platform-tools> .\fastboot.exe flash system "E:\Downloads\Xiaomi Note 10 5G - M2103K19G\lineage-19.1-20221011-UNOFFICIAL-arm64_bvS.img" Resizing 'system_a' OKAY [ 0.008s] Sending sparse 'system_a' 1/10 (262140 KB) OKAY [ 16.065s] Writing 'system_a' OKAY [ 0.950s] Sending sparse 'system_a' 2/10 (262140 KB) OKAY [ 16.942s] Writing 'system_a' OKAY [ 0.935s] Sending sparse 'system_a' 3/10 (262140 KB) OKAY [ 16.943s] Writing 'system_a' OKAY [ 1.016s] Sending sparse 'system_a' 4/10 (262140 KB) OKAY [ 17.032s] Writing 'system_a' OKAY [ 0.978s] Sending sparse 'system_a' 5/10 (262140 KB) OKAY [ 15.034s] Writing 'system_a' OKAY [ 1.281s] Sending sparse 'system_a' 6/10 (262140 KB) OKAY [ 12.834s] Writing 'system_a' OKAY [ 1.204s] Sending sparse 'system_a' 7/10 (262140 KB) OKAY [ 12.754s] Writing 'system_a' OKAY [ 1.300s] Sending sparse 'system_a' 8/10 (262140 KB) OKAY [ 12.850s] Writing 'system_a' OKAY [ 1.053s] Sending sparse 'system_a' 9/10 (262140 KB) OKAY [ 12.767s] Writing 'system_a' OKAY [ 1.063s] Sending sparse 'system_a' 10/10 (117804 KB) OKAY [ 5.739s] Writing 'system_a' OKAY [ 0.608s] Finished. Total time: 149.847s PS E:\Downloads\platform-tools> .\fastboot.exe flash system_b "E:\Downloads\Xiaomi Note 10 5G - M2103K19G\lineage-19.1-20221011-UNOFFICIAL-arm64_bvS.img" Resizing 'system_b' OKAY [ 0.006s] Sending sparse 'system_b' 1/10 (262140 KB) OKAY [ 11.960s] Writing 'system_b' OKAY [ 1.106s] Sending sparse 'system_b' 2/10 (262140 KB) OKAY [ 12.767s] Writing 'system_b' OKAY [ 1.013s] Sending sparse 'system_b' 3/10 (262140 KB) OKAY [ 12.698s] Writing 'system_b' OKAY [ 0.998s] Sending sparse 'system_b' 4/10 (262140 KB) OKAY [ 12.758s] Writing 'system_b' OKAY [ 1.020s] Sending sparse 'system_b' 5/10 (262140 KB) OKAY [ 12.549s] Writing 'system_b' OKAY [ 1.005s] Sending sparse 'system_b' 6/10 (262140 KB) OKAY [ 12.626s] Writing 'system_b' OKAY [ 1.093s] Sending sparse 'system_b' 7/10 (262140 KB) OKAY [ 12.604s] Writing 'system_b' OKAY [ 1.001s] Sending sparse 'system_b' 8/10 (262140 KB) OKAY [ 12.641s] Writing 'system_b' OKAY [ 1.020s] Sending sparse 'system_b' 9/10 (262140 KB) OKAY [ 12.727s] Writing 'system_b' OKAY [ 1.009s] Sending sparse 'system_b' 10/10 (117804 KB) OKAY [ 5.697s] Writing 'system_b' OKAY [ 0.593s] Finished. Total time: 129.140s PS E:\Downloads\platform-tools> .\fastboot.exe --disable-verity --disable-verification flash vbmeta "E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\images\vbmeta.img" Rewriting vbmeta struct at offset: 0 Sending 'vbmeta_a' (4 KB) OKAY [ 0.002s] Writing 'vbmeta_a' OKAY [ 0.005s] Finished. Total time: 0.042s PS E:\Downloads\platform-tools> .\fastboot.exe flash vbmeta_b "E:\camellian_global_images_V13.0.3.0.SKSMIXM_20220907.0000.00_12.0_global\images\vbmeta.img" Sending 'vbmeta_b' (4 KB) OKAY [ 0.001s] Writing 'vbmeta_b' OKAY [ 0.005s] Finished. Total time: 0.039s PS E:\Downloads\platform-tools> .\fastboot.exe set_active a Setting current slot to 'a' OKAY [ 0.009s] Finished. Total time: 0.021s PS E:\Downloads\platform-tools> .\fastboot.exe reboot recovery Rebooting into recovery OKAY [ 0.001s] Finished. Total time: 0.012s |
The last command will reboot your phone in recovery
mode. There you need to wipe the data
partition, so select Wipe data
, then Wipe all data
. Once finished, reboot to system
. Your new operating system should boot now without any issues:
Bonus #2: Root your phone with Magisk!
If you want to further your abilities to customize the phone’s OS, you should install Magisk, which is a small utility granting you root
privileges on the phone. The installation and usage of Magisk is clearly written on its own web site. This is the summary:
- Extract
boot.img
from your stock ROM - Move it to the phone
- Install Magisk APK
- Patch the
boot.img
with Magisk - Move the patched file back to your PC
- Flash the patched file to the phone using ADB:
1 2 3 4 5 6 7 |
PS E:\Downloads\platform-tools> .\fastboot.exe flash boot "E:\Downloads\Xiaomi Note 10 5G - M2103K19G\magisk_patched-25200_fYRRs.img" Sending 'boot_a' (65536 KB) OKAY [ 3.016s] Writing 'boot_a' OKAY [ 0.299s] Finished. Total time: 3.378s PS E:\Downloads\platform-tools> .\fastboot.exe reboot Rebooting OKAY [ 0.000s] Finished. Total time: 0.016s |
- Reboot phone
I can confirm that it works well, without a glitch on the Xiaomi Redmi Note 10 5G and several other phones I tested:
Hello Viktor,
Very nice guide you have here!
I notice you did ‘set_active a’ when you install LineageOS. Is it be possible to leave stock rom on the b slot and be able to easily switch between roms?
I’m afraid, I don’t know. But you can certainly use the DSU feature of Android to have two OSs simultaneously on the phone and you can change at will. This is how I use it.
Hi there everybody, here every one is sharing such know-how, therefore it’s good to read
this webpage, and I used to pay a quick visit this website
every day.