Treble Recovery - Xiaomi Redmi 5 Questions & Answers

I Know this sounds a little noobish, but can we flash GSI using treble recovery?

Yes you can using a modded twrp which points /cust as /vendor without actually repartitioning the /cust. You need to flash system, vendor image but as this is done like capire le treble project you have to copy firmware folder to /etc after flashing in order to boot.
Also every time you flash a GSI from bootloader you need again to copy firmware folder

Manosdocpap said:
Yes you can using a modded twrp which points /cust as /vendor without actually repartitioning the /cust. You need to flash system, vendor image but as this is done like capire le treble project you have to copy firmware folder to /etc after flashing in order to boot.
Also every time you flash a GSI from bootloader you need again to copy firmware folder
Click to expand...
Click to collapse
But can you tell us how can we do it?

Related

[Dev][Guide][JB+KK] Dedicated recovery/boot.cpio partition

Hi there!
Today I finally found how to make our codinas' kernels universal, i.e. allow to install kernel on whatever ROM and finally separate recovery from kernel. It's well known, bootloader decides what will be loaded - kernel or recovery. That probably may explain why AnyKernel installer(or other similar) doesn't work on codina, because we can't move recovery partition anywhere.
But there is also a little trick that allow us load recovery and boot.cpio from different partition - https://github.com/ChronoMonochrome/Chrono_Kernel/commit/df9094f1f12618ad9599da266792d6b2f8106170 - just an another approach
Don't worry, we won't touch bootloader at all.
As can be seen, /dev/block/mmcblk0p17 (kernel2 partition) will be used for storing recovery.cpio and boot.cpio. On stock that may not work (I don't know for what exactly uses Kernel2 partition, besides of manually restoring of kernel1 partition. I only know that is almost useless on custom ROMs, and we can use it as we want )
First do some preparations:
Download this kernel and needed recovery/boot scripts(4.4.x.cpio.zip, 4.4.x_f2fs.cpio.zip, etc... 4.4.x.cpio means that it support only ext4) from my google drive (folder ramdisks), unzip recovery (twrp or cwm) and rename to recovery.cpio, then move it to external SD card. Then do it with boot scripts that you've downloaded (e.g. 4.4.x_f2fs.cpio.zip - unzip and rename to boot.cpio)
Well, that all that needs for installation. Read following instruction very carefully, otherwise that may cause brick Keep in mind, all that you do at your own risk! I'm not responsible if you brick your phone!
Installation method:
1) reboot into recovery, plug your phone to your PC, enable adb:
Code:
adb shell
2) Format kernel2 partition to ext4 file system:
Code:
mke2fs -T ext4 /dev/block/mmcblk0p17
Think twice before you hit 'enter' button - wrong command may cause hardbrick!
3) create /ramdisk folder and mount kernel2 partition
Code:
mkdir /ramdisk
mount -t ext4 /dev/block/mmcblk0p17 /ramdisk
move your recovery.cpio and boot.cpio to this folder, give 777 permissions:
Code:
chmod 777 /ramdisk/recovery.cpio
chmod 777 /ramdisk/boot.cpio
4) install downloaded kernel
Now you can change recovery via changing /ramdisk/recovery.cpio - just make a backup of this file, and then replace with one of another recoveries. If you want to install another ROM or change filesystem of partition then replace /ramdisk/boot.cpio with one of needed boot scripts. Don't forget to give 777 permission (probably 644 is enough, but I didn't test it) to both of these files.
This method tested and working on 4.4.x TC ROM + twrp recovery + kernel with full F2FS support.
Well, now it's time to create uncompressed kernel, that may slightly decrease the boot time
@ChronoMonochrome
Thanks. do you mean that kernel2 partition is useless in stock and cyanogenmod firmware?
Is it right that boot loader will read kernel1 partition then it will read system partition? and kernel2 is not necessary for booting?
I have installed new universal kernel (2.5) , so I flashed new ramdisk for 4.4.x , can I roll back to older versions or stock firmware with this ramdisk or I should restore Partition17 backup?
sorset said:
@ChronoMonochrome
Thanks. do you mean that kernel2 partition is useless in stock and cyanogenmod firmware?
Click to expand...
Click to collapse
As it turned out, it's unneeded even on stock. So if you won't restore kernel2 partition, nothing will happen.
Is it right that boot loader will read kernel1 partition then it will read system partition? and kernel2 is not necessary for booting?
I have installed new universal kernel (2.5) , so I flashed new ramdisk for 4.4.x , can I roll back to older versions or stock firmware with this ramdisk or I should restore Partition17 backup?
Click to expand...
Click to collapse
Yes, you can roll back to usual kernels. it doesn't matter what written on kernel2 partition - real kernel or anything else...
ChronoMonochrome said:
As it turned out, it's unneeded even on stock. So if you won't restore kernel2 partition, nothing will happen.
Click to expand...
Click to collapse
Ok, thanks , But why do you mount kernel2 partition inside of OS? As I understand boot.cpio is necessary before booting OS . And inside of OS is just an extra storage! (is that true?)
sorset said:
And inside of OS is just an extra storage! (is that true?)
Click to expand...
Click to collapse
Yes and no, is 16 Mb big enough to be called "storage"? I did it, just to be able replace ramdisks even without booting to recovery. But newest boot scripts doesn't have it.
Ace 2 has 15 - 20 Partitions my Friend
ace2nutzer said:
Ace 2 has 15 - 20 Partitions my Friend
Click to expand...
Click to collapse
And what ? We actually talking about kernel2 partition.
ChronoMonochrome said:
And what ? We actually talking about kernel2 partition.
Click to expand...
Click to collapse
sorry, i meant @sorset
ChronoMonochrome said:
Yes and no, is 16 Mb big enough to be called "storage"? I did it, just to be able replace ramdisks even without booting to recovery. But newest boot scripts doesn't have it.
Click to expand...
Click to collapse
You are right , but I remember days that 1.44MB floppy disk was a large STORAGE and 16MB was HUGE
sry , I have another question , So can I remove its line from fstab to prevent mounting?
I'm confused
boot.img in kernel archive is recovery image that will extract on partition15 (kernel) , but what recovery.cpio exactly is that yu copy on partition17 (kernel2) ?
ace2nutzer said:
Ace 2 has 15 - 20 Partitions my Friend
Click to expand...
Click to collapse
Yes,With counting internal storage , 17 exactly , but thats not the point , I'm afraid.
sorset said:
sry , I have another question , So can I remove its line from fstab to prevent mounting?
Click to expand...
Click to collapse
just redownload bootscripts(kernel/ramdisks), as I said, newest scripts doesn't mount kernel2 partition.
boot.img in kernel archive is recovery image that will extract on partition15 (kernel) , but what recovery.cpio exactly is that yu copy on partition17 (kernel2) ?
Click to expand...
Click to collapse
I don't get it rephrase please
ChronoMonochrome said:
just redownload bootscripts(kernel/ramdisks), as I said, newest scripts doesn't mount kernel2 partition.
I don't get it rephrase please
Click to expand...
Click to collapse
I didn't too
There is an Image named boot.img in kernel flashable zip archive that extracts into partition 15 (named kernel) as I understood is recovery (TWRP or CWM) image and you wont touch linux orginal image , and your modified custom kernel is new modules for linux image that loads while booting (sry, I cant explain fine), So what is recovery.cpio that is in recovery flashable zip image that extracts into partition 17 (named kernel2) ?
sorset said:
as I understood is recovery (TWRP or CWM) image and you wont touch linux orginal image
Click to expand...
Click to collapse
originally kernel + recovery
, and your modified custom kernel is new modules for linux image that loads while booting (sry, I cant explain fine), So what is recovery.cpio that is in recovery flashable zip image that extracts into partition 17 (named kernel2) ?
Click to expand...
Click to collapse
In my mod kernel(mmcblk0p15) and recovery (mmcblk0p17) are splitted.
Thank you. I see.
This is probably the best (and only?) way to rebuild the ramdisk without having to compile anything, which is an excellent base for my NoUMS patches
:good:
<remove>

I need a help with ROM flashing.

Hey there!
I have a question: can Marshmallow device flash a ROM.zip, which has inside only system folder and boot.img?
I read somewhere that some Marshmallow devices can ONLY flash a ROM.zip which has inside system.new.dat, system.patch and file_transfer.
I tried to flash a ROM.zip with only system folder and boot.img, but the recovery gives me ERROR 7 and after modifying the ROM ERROR 6.
I don't know, if I set right mount points in META-INF.
Is it possible to install system folder and boot.img in a ROM.zip on Marshmallow?
Adreno306™ said:
Hey there!
I have a question: can Marshmallow device flash a ROM.zip, which has inside only system folder and boot.img?
I read somewhere that some Marshmallow devices can ONLY flash a ROM.zip which has inside system.new.dat, system.patch and file_transfer.
I tried to flash a ROM.zip with only system folder and boot.img, but the recovery gives me ERROR 7 and after modifying the ROM ERROR 6.
I don't know, if I set right mount points in META-INF.
Is it possible to install system folder and boot.img in a ROM.zip on Marshmallow?
Click to expand...
Click to collapse
If u have the correct recovery installed, it is possible to flash system and boot.img.(most of the mtk phones has system folder instead of system.dat)
for status 6 and 7 error follow this--
http://forum.xda-developers.com/showthread.php?t=2066565
BatDroid said:
If u have the correct recovery installed, it is possible to flash system and boot.img.(most of the mtk phones has system folder instead of system.dat)
for status 6 and 7 error follow this--
http://forum.xda-developers.com/showthread.php?t=2066565
Click to expand...
Click to collapse
Not working..
Odesláno z mého VFD 700

Fix Mi8 encryption bug first time changing Recovery

Hey, this is a weird bug but I found no solution online so I might just upload it myself
What's the bug?
Mi8 (Global Version) is encrypted by 'default', even though you didn't encrypted it and just use fingerprint for lockscreen.
What's the problem with that?
When you Unlock its bootloader and flash TWRP, every time you try it, /sdcard folder generates random folders named with numbers and letters. Doesn't get solved formatting data, or doing any kind of wipe, even favtory reset on the Official ROM before trying TWRP out.
That is a problem because you can't flash TWRP (nor the patch for avoiding MiRecovery to overwrite TWRP) from TWRP if your internal storage isn't available for you to flash from
Solution
I didn't know what to do so I just put the Patch, the TWRP.img and .zip in the Fastboot/Bootloader folder in my computer, launched CMD from there with mi 8 in Fastboot mode. Type 'adb devices' to see if all the drivers are ok and the phone is properly connected. Then I first flashed through cmd the .img from the folder into the phone.
Code:
adb devices
fastboot flash flash recovery [twrp name].img
fastboot boot [recovery name].img
This is the part where you can't flash TWRP from your Mi8 because your internal storage has been wiped because of encryption.
Code:
adb devices
adb push [twrp name].zip /sdcard/.
adp push [patch name].zip /sdcard/.
adb push [rom name].zip /sdcard/.
Even though your internal memory was wiped, now you have the TWRP zip, the PATCH zip and your ROM zip in the storage (you need to make sure you have those files in the same folder as your Fastboot drivers etc).
Then you can just follow the normal instructions and every time you need a file your phone wiped just copy it from the folder of your pc with cmd.
The patch I talk about is "Disable_Dm-Verity_FEC_v1.1.zip"
I have the same problem. When doing these steps, all the internal information of the phone is deleted?
the "bug" is wrong twrp version. Google some more
t0mas_ said:
the "bug" is wrong twrp version. Google some more
Click to expand...
Click to collapse
no it's not
Prisanejamik said:
no it's not
Click to expand...
Click to collapse
Using the latest TWRP, it can decrypt the data partition. GLOBAL STOCK encrypts the DATA partition on first boot by default. There is no 'Bug'. The Muli .eu ROM only encrypts SYSTEM, and not DATA by default. STOCK CHINA ROM encrypts the DATA partition on first boot by default also. Why are you calling this a 'BUG'?
Agimax said:
Using the latest TWRP, it can decrypt the data partition. GLOBAL STOCK encrypts the DATA partition on first boot by default. There is no 'Bug'. The Muli .eu ROM only encrypts SYSTEM, and not DATA by default. STOCK CHINA ROM encrypts the DATA partition on first boot by default also. Why are you calling this a 'BUG'?
Click to expand...
Click to collapse
Where can we find the latest TWRP? There doesn't seem to be official yet and I saw some on chinese forums..
It's un-official, but is updated often
https://forum.xda-developers.com/mi-8/development/recovery-twrp-3-2-3-1110-t3869729
Agimax said:
Using the latest TWRP, it can decrypt the data partition. GLOBAL STOCK encrypts the DATA partition on first boot by default. There is no 'Bug'.
Click to expand...
Click to collapse
Can you advise what is the password used when Global Stock encrypts the Data partition on first boot? I note that the usual "default_password" does not work on my phone.

[TOOL][riva] Appender for Redmi 5A

Bypass bootloader guide https://forum.xda-developers.com/xiaomi-redmi-5a/how-to/bypass-bootloader-lock-redmi-5ariva-t3772381 by dev @xaacnz.
A little bit of disclaimer......
Appender is for those who are currently using bypass bootloader hack above, so there is no need of manually appending blocks to boot image/recoevry image after every flash. Appender automatically appends the 4k bytes to boot image and recovery image.
NOTE: DO NOT QUOTE WHOLE POST OR I WILL IGNORE
Appender-v4 Download below
Changelog:
Appender-v4
*Fixed Appender on system-as-root boot images (Appender breaks GSI with system-as-root, don't use GSI)
*Improved overall code
Appender-v3
*Initial test version
Recommended twrp: Pitch black recovery
Link
Appender-v4.zip is for boot image
Appender-v4-rec.zip is for recovery image
Appender Usage
1. Flash rom
2. Flash magisk for root (skip if you don't need root)
3. Flash custom kernel (skip if you don't need custom kernel)
4. After that flash Appender-v4.zip
5. Reboot
Appender Recovery Version Usage
1. Flash recovery image
2. Flash Appender-v4-rec.zip
3. Reboot Recovery
CAUTION: Appender must be flashed EVERY time you modify boot image or recovery image.
And don't forget to press thanks if this tool has helped you
Reporting errors.
After flashing appender, send the file /cache/recovery/last_log if Appender didn't worked, and also metion the issue you are facing.
Credits and thanks
@osm0sis for Anykernel3
@xaacnz for bypass bl guide
steeldriver (stackexchange) for helping me with commands
busybox team
Old method
Note1: Even though no data is erased in this process it is recommended to take backup.
What this guide covers.
1. Rooting your device
2. Flashing custom kernel
All without need to unlock bootloader​
Well there are two ways with which you can do this
Requirements
For PC based method
1. Working twrp recovery (if you dont have twrp installed follow this guide)
2. Pc must have linux installed, if you have windows don't worry install WSL using this link
3. Android image kitchen for your respective OS.
4. Latest magisk zip from here
For Android only
1. Working twrp
2. Any hex editor(Note2) for android/windows (optional)
3. Latest Magisk manager app only (for root only)
4. Android Image kitchen- android, windows/linux (for custom kernel only)
Steps for PC based​1. Flash magisk zip or any kernel. Don't reboot system.
2. Go to backup senction in twrp and backup boot.
3. Connect your device to PC and look where you backed up boot and copy boot.emmc.win to Android image kitchen folder and rename to boot.img
4. Run unpackimg.sh or double click on unpackimg.bat. Then run repackimg.sh or double click on repackimg.bat. You will see image-new.img in the same folder
5. On windows hold Shift and right click in file manager with mouse, you will see open linux shell here, click it. OR if you have linux (specifically ubuntu) then right click and select open terminal here in Nautilus.
6. Run (to append 4k block, note that you can append block to any file specified by "of" parameter like of=twrp.img, of=boot.img etc)
Code:
printf 'x30x83x19x89x64' | dd of=image-new.img ibs=4096 conv=sync,notrunc oflag=append
7. Copy the image-new.img to your phone anywhere you prefer.
8. Flash image-new.img using twrp to boot partition.
9. Reboot
Steps for non-PC based (*outdated and some kernels won't work fully)​[/CENTER]
1. Extract boot.img from your currently installed rom and put it in internal storage of your phone (if you do not want to flash custom kernel skip to step 4)
*2. Download custom kernel you want to flash, extract zImage from the flashable kernel zip
*3. Unpack boot image using android image kitchen, in the split_img folder delete "boot.img-zImage" and put zImage you extracted in split_img folder and rename it to "boot.img-zImage"
*For custom kernel only
4. Install magisk manager apk on your phone
5. open magisk manager, you will see magisk is not installed select install (first one), a popup will appear telling to install magisk, select install, then select Patch a file, select the boot.img file that you extracted, then let magisk manager do the rest, after finishing the magisk-patched.img file will be stored in Downloads folder of your internal storage
6. Open the patched_boot.img in hex editor
7. To make the patched_boot.img to boot append(Note2) a 4k block which begins with 0x30, 0x83, 0x19, 0x89, 0x64 to patched_boot.img, and save the file
8. Boot into twrp and flash patched_boot.img
9. Done, reboot
Note2: On Linux you can use dd command to append
Code:
printf 'x30x83x19x89x64' | dd of=testfile ibs=4096 conv=sync,notrunc oflag=append
Note3: If you get error cannot mount twrp while flashing, use recommend twrp above
If you get error related to ramdisk compression, use Appender-v4 or above
XDA:DevDB Information
Appender for Redmi 5A (bypass bootloader), Tool/Utility for the Xiaomi Redmi 5A
Contributors
saurabh6377
Version Information
Status: Beta
Current Beta Version: 4
Beta Release Date: 2019-09-29
Created 2019-09-28
Last Updated 2019-09-29
Reserved
_saurabh__._ said:
As a followup to this guide https://forum.xda-developers.com/xiaomi-redmi-5a/how-to/bypass-bootloader-lock-redmi-5ariva-t3772381 by dev @xaacnz without him this guide might not be here, I am making this guide so you can root your device or flash any custom kernel without unlocking your device.
Code:
Your warranty will be void now
I am not responsible for anything wrong happens to your device
Note1: Even though no data is erased in this process it is recommended to take backup.
What this guide covers.
1. Rooting your device
2. Flashing custom kernel
All without need to unlock bootloader
Requirements
1. Working twrp recovery (if you dont have twrp installed follow this guide)
2. Any hex editor for android/linux/windows (yes you absolutely dont need a pc)
3. Latest Magisk manager app only (for root only)
4. Android Image kitchen- android, windows/linux (for custom kernel only)
Steps​1. Extract boot.img from your currently installed rom and put it in internal storage of your phone (if you do not want to flash custom kernel skip to step 4)
*2. Download custom kernel you want to flash, extract zImage from the flashable kernel zip
*3. Unpack boot image using android image kitchen, in the split_img folder delete "boot.img-zImage" and put zImage you extracted in split_img folder and rename it to "boot.img-zImage"
*For custom kernel only
4. Install magisk manager apk on your phone
5. open magisk manager, you will see magisk is not installed select install (first one), a popup will appear telling to install magisk, select install, then select Patch Boot Image File, select the boot.img file that you extracted, then let magisk manager do the rest, after finishing the patched_boot.img file will be stored in Downloads folder of your internal storage
6. Open the patched_boot.img in hex editor
7. To make the patched_boot.img to boot append a 4k block which begins with 0x30, 0x83, 0x19, 0x89, 0x64 to patched_boot.img, and save the file
8. Boot into twrp and flash patched_boot.img
9. Done, reboot
Note2: If you get error cannot mount twrp while flashing the image, use vendor twrp
Note3: If I get time I will later make a script that automates the process.
Click to expand...
Click to collapse
Thanks it worked but i didn't appended 4k block to patched_boot.img it worked without appending 4k block.
Sonu1123 said:
Thanks it worked but i didn't appended 4k block to patched_boot.img it worked without appending 4k block.
Click to expand...
Click to collapse
Let me verify this, I will update the guide once this is verified.
Sonu1123 said:
Thanks it worked but i didn't appended 4k block to patched_boot.img it worked without appending 4k block.
Click to expand...
Click to collapse
If you didn't append 4k block to patched_boot.img and you have locked bootloader then flashing magisk directly from twrp must work also because both processes are same. And likewise you can also flash custom kernel directly using twrp without extracting boot.img. In my case I have to append 4k block to patched_boot.img for system to boot.
_saurabh__._ said:
If you didn't append 4k block to patched_boot.img and you have locked bootloader then flashing magisk directly from twrp must work also because both processes are same. And likewise you can also flash custom kernel directly using twrp without extracting boot.img. In my case I have to append 4k block to patched_boot.img for system to boot.
Click to expand...
Click to collapse
I don't know how it worked but when i tried it again system crashed then i appended 4k block to patched_boot.img to get magisk intalled.
I have one more question what about xposed for pixel experience rom for riva and can i flash it directly without modifying it.
Edit:I am on pixel experience latest android pie version.
Sonu1123 said:
I don't know how it worked but when i tried it again system crashed then i appended 4k block to patched_boot.img to get magisk intalled.
I have one more question what about xposed for pixel experience rom for riva and can i flash it directly without modifying it.
Edit:I am on pixel experience latest android pie version.
Click to expand...
Click to collapse
Yes you can install xposed. Simple rule of thumb is that you can flash anything that does not touch boot image and xposed doesn't it only writes to /system partition so no issues.
Xposed is not available for pie yet, but the unofficial EdXposed magisk module was tested by me and it works good on pixel experience.
Kindly ask you to upload some zip file to your OP, containing following files:
- tmp\hack_splash.xml
- tmp\prog_emmc_firehose_8917_ddr.mbn
- tmp\recovery.img
- tmp\splash.img
- tmp\twrp.xml
- fh_loader.exe
- QSaharaServer.exe
- a text file containing steps 9-11 and link to xaacnz thread (for credits)
_saurabh__._ said:
As a followup to this guide https://forum.xda-developers.com/xiaomi-redmi-5a/how-to/bypass-bootloader-lock-redmi-5ariva-t3772381 by dev @xaacnz without him this guide might not be here, I am making this guide so you can root your device or flash any custom kernel without unlocking your device.
Code:
Your warranty will be void now
I am not responsible for anything wrong happens to your device
Note1: Even though no data is erased in this process it is recommended to take backup.
What this guide covers.
1. Rooting your device
2. Flashing custom kernel
All without need to unlock bootloader
Requirements
1. Working twrp recovery (if you dont have twrp installed follow this guide)
2. Any hex editor(Note2) for android/windows (yes you absolutely dont need a pc)
3. Latest Magisk manager app only (for root only)
4. Android Image kitchen- android, windows/linux (for custom kernel only)
Steps​1. Extract boot.img from your currently installed rom and put it in internal storage of your phone (if you do not want to flash custom kernel skip to step 4)
*2. Download custom kernel you want to flash, extract zImage from the flashable kernel zip
*3. Unpack boot image using android image kitchen, in the split_img folder delete "boot.img-zImage" and put zImage you extracted in split_img folder and rename it to "boot.img-zImage"
*For custom kernel only
4. Install magisk manager apk on your phone
5. open magisk manager, you will see magisk is not installed select install (first one), a popup will appear telling to install magisk, select install, then select Patch Boot Image File, select the boot.img file that you extracted, then let magisk manager do the rest, after finishing the patched_boot.img file will be stored in Downloads folder of your internal storage
6. Open the patched_boot.img in hex editor
7. To make the patched_boot.img to boot append(Note2) a 4k block which begins with 0x30, 0x83, 0x19, 0x89, 0x64 to patched_boot.img, and save the file
8. Boot into twrp and flash patched_boot.img
9. Done, reboot
Note2: On Linux you can use dd command to append
Code:
printf '\x30\x83\x19\x89\x64' | dd of=testfile ibs=4096 conv=sync,notrunc oflag=append
Note3: If you get error cannot mount twrp while flashing the image, use vendor twrp
Note4: If I get time I will later make a script that automates the process.
Click to expand...
Click to collapse
Please upload the patched files.
- hack_splash.xml
- recovery.img
- twrp.img
- splash.img
- twrp.xml
It really helps me to know how to append blocks.
Please upload these files for us.
Thanks and regards.
Anshu lakra said:
aIecxs said:
Dude, youre waiting for 2 months, wish i could help you... Maybe here more better luck?
https://forum.xda-developers.com/showthread.php?t=3911660
Click to expand...
Click to collapse
Have you flashed custom ROM ?
---------- Post added at 03:54 AM ---------- Previous post was at 03:52 AM ----------
Nobody is uploading or posting link.
Click to expand...
Click to collapse
Nope. I don't have this phone anymore. Just be patient, _saurabh__._ will upload patched files as soon as he has time, he's busy at moment
aIecxs said:
Nope. I don't have this phone anymore. Just be patient, _saurabh__._ will upload patched files as soon as he has time, he's busy at moment
Click to expand...
Click to collapse
Thanks sir i am waiting .
saurabh6377 said:
As a followup to this guide https://forum.xda-developers.com/xiaomi-redmi-5a/how-to/bypass-bootloader-lock-redmi-5ariva-t3772381 by dev @xaacnz without him this guide might not be here, I am making this guide so you can root your device or flash any custom kernel without unlocking your device.
NOTE: YOU NEED TO FOLLOW THE ABOVE GUIDE IF YOU HAVEN'T, THEN COME BACK HERE
Code:
Your warranty will be void now
I am not responsible for anything wrong happens to your device
Note1: Even though no data is erased in this process it is recommended to take backup.
What this guide covers.
1. Rooting your device
2. Flashing custom kernel
All without need to unlock bootloader​
Well there are two ways with which you can do this
Requirements
For PC based method
1. Working twrp recovery (if you dont have twrp installed follow this guide)
2. Pc must have linux installed, if you have windows don't worry install WSL using this link
3. Android image kitchen for your respective OS.
4. Latest magisk zip from here
For Android only
1. Working twrp
2. Any hex editor(Note2) for android/windows (optional)
3. Latest Magisk manager app only (for root only)
4. Android Image kitchen- android, windows/linux (for custom kernel only)
Steps for PC based​1. Flash magisk zip or any kernel. Don't reboot system.
2. Go to backup senction in twrp and backup boot.
3. Connect your device to PC and look where you backed up boot and copy boot.emmc.win to Android image kitchen folder and rename to boot.img
4. Run unpackimg.sh or double click on unpackimg.bat. Then run repackimg.sh or double click on repackimg.bat. You will see image-new.img in the same folder
5. On windows hold Shift and right click in file manager with mouse, you will see open linux shell here, click it. OR if you have linux (specifically ubuntu) then right click and select open terminal here in Nautilus.
6. Run (to append 4k block, note that you can append block to any file specified by "of" parameter like of=twrp.img, of=boot.img etc)
Code:
printf '\x30\x83\x19\x89\x64' | dd of=image-new.img ibs=4096 conv=sync,notrunc oflag=append
7. Copy the image-new.img to your phone anywhere you prefer.
8. Flash image-new.img using twrp to boot partition.
9. Reboot
Steps for non-PC based (*outdated and some kernels won't work fully)​[/CENTER]
1. Extract boot.img from your currently installed rom and put it in internal storage of your phone (if you do not want to flash custom kernel skip to step 4)
*2. Download custom kernel you want to flash, extract zImage from the flashable kernel zip
*3. Unpack boot image using android image kitchen, in the split_img folder delete "boot.img-zImage" and put zImage you extracted in split_img folder and rename it to "boot.img-zImage"
*For custom kernel only
4. Install magisk manager apk on your phone
5. open magisk manager, you will see magisk is not installed select install (first one), a popup will appear telling to install magisk, select install, then select Patch a file, select the boot.img file that you extracted, then let magisk manager do the rest, after finishing the magisk-patched.img file will be stored in Downloads folder of your internal storage
6. Open the patched_boot.img in hex editor
7. To make the patched_boot.img to boot append(Note2) a 4k block which begins with 0x30, 0x83, 0x19, 0x89, 0x64 to patched_boot.img, and save the file
8. Boot into twrp and flash patched_boot.img
9. Done, reboot
Note2: On Linux you can use dd command to append
Code:
printf '\x30\x83\x19\x89\x64' | dd of=testfile ibs=4096 conv=sync,notrunc oflag=append
Note3: If you get error cannot mount twrp while flashing the image, use vendor twrp
Note4: If I get time I will later make a script that automates the process.
Click to expand...
Click to collapse
script .you promised script. are looking forward to !!! You are welcome
If this is like an LG Bump situation you should just make a Pull Request to Magisk to add detection of the magic and to re-add it after automatically. I'll see about adding support for it to my Android Image Kitchen as well.
Edit: Also @saurabh6377 isn't using AK3 correctly.. he left in all the stuff from the example and edited the Backend to add the printf (which it clearly says not to do) instead of putting it in anykernel.sh.
not necessary there is official unlock tool from xiaomi
aIecxs said:
not necessary there is official unlock tool from xiaomi
Click to expand...
Click to collapse
This is for those who weren't successful unlocking via official method.
osm0sis said:
Edit: Also @saurabh6377 isn't using AK3 correctly.. he left in all the stuff from the example and edited the Backend to add the printf (which it clearly says not to do) instead of putting it in anykernel.sh.
Click to expand...
Click to collapse
Yeah, that is why I said experimental, I have my exams coming and I am just starting to learn all the stuff. It takes a lot of time figuring out everything (for beginner).
That is why I modified anykernel methods of flashing boot image.
EDIT: After my exams will be over, I will try to make another version of appender using anykernel correctly.
@osm0sis Also, the bytes must be appended to final boot.img before flashing, but ak3 builds and flashes boot image in same method (write_boot), so I have to modify that method. Correct me if I am wrong.
osm0sis said:
If this is like an LG Bump situation you should just make a Pull Request to Magisk to add detection of the magic and to re-add it after automatically. I'll see about adding support for it to my Android Image Kitchen as well.
Click to expand...
Click to collapse
Not really needed, people can just unlock, it is for those who are using bypass bootloader exploit because they cannot unlock (most likely in case if someone have bought from untrusted source). And append doesn't work always.
Sent from my Redmi Note 7 using XDA Labs
saurabh6377 said:
Yeah, that is why I said experimental, I have my exams coming and I am just starting to learn all the stuff. It takes a lot of time figuring out everything (for beginner).
That is why I modified anykernel methods of flashing boot image.
EDIT: After my exams will be over, I will try to make another version of appender using anykernel correctly.
@osm0sis Also, the bytes must be appended to final boot.img before flashing, but ak3 builds and flashes boot image in same method (write_boot), so I have to modify that method. Correct me if I am wrong.
Not really needed, people can just unlock, it is for those who are using bypass bootloader exploit because they cannot unlock (most likely in case if someone have bought from untrusted source). And append doesn't work always.
Click to expand...
Click to collapse
Cool. I just worry what that stuff intended for tuna (Galaxy Nexus) could do. If you don't need to touch the ramdisk you could just use split_boot; so it doesn't unpack the ramdisk unnecessarily.
You can use repack_ramdisk; (if unpacked) and flash_boot; instead of write_boot; to get more granular control and be able to act on the final image before flash. :good:
Good luck with your exams! :fingers-crossed:
@osm0sis thanks, I will make another version of appender soon.
I have one question though
I want to edit /vendor/etc/fstab.qcom to enable forceencrypt using anykernel
In fstab.qcom I have this
/dev/block/bootdevice/by-name/userdata /data ext4 rw,nosuid,nodev,noatime,noauto_da_alloc wait,formattable,check,encryptable=footer,quota
I want to change "encryptable" to "forceencrypt" using anykernel.
What is proper way?
Sent from my Redmi Note 7 using XDA Labs
saurabh6377 said:
@osm0sis thanks, I will make another version of appender soon.
I have one question though
I want to edit /vendor/etc/fstab.qcom to enable forceencrypt using anykernel
In fstab.qcom I have this
/dev/block/bootdevice/by-name/userdata /data ext4 rw,nosuid,nodev,noatime,noauto_da_alloc wait,formattable,check,encryptable=footer,quota
I want to change "encryptable" to "forceencrypt" using anykernel.
What is proper way?
Click to expand...
Click to collapse
Well that's not necessarily an AnyKernel "thing" because it's a vendor partition modification, but yeah you could do that somewhere in anykernel.sh as part of a flash if you want, just remember to mount vendor rw first and back to ro after. The AK3 patch_fstab function might work for you.
Hey ges any video for this step?
7. To make the patched_boot.img to boot append a 4k block which begins with 0x30, 0x83, 0x19, 0x89, 0x64 to patched_boot.img, and save the file

Are you using f2fs file system on Poco? Any benefits?

I'm thinking of changing to f2fs on userdata and cache partition and use it with LOS (or crDroid) with DFE. However, I would have to format my internal storage for that. So just wondering if its worth the effort. For people already using it @ccelik97 others, please comment
Just do it, it will boost your performance a bit.
Just remember flashing the fstab file (mount vendor before).
And only format /data and /cache NOT /system
ext4 has faster reading speeds which is better for /system
I would also recommend to use Orange Fox Recovery which disables FE itself when you install a vendor package
using it just because - since it hasnt cause me any issues yet. There's almost no improvement as far as daily usage goes, but maybe it's just because I didnt spend much time with ext4 since I got the phone
VC-34 said:
Just do it, it will boost your performance a bit.
Just remember flashing the fstab file (mount vendor before).
And only format /data and /cache NOT /system
ext4 has faster reading speeds which is better for /system
I would also recommend to use Orange Fox Recovery which disables FE itself when you install a vendor package
Click to expand...
Click to collapse
Which ROM are you using with F2FS ?
Tried it with lineage OS (unofficial build) but it did not boot. Flashed Sphinx Kernel also, but again same result.
Mafioso said:
Which ROM are you using with F2FS ?
Tried it with lineage OS (unofficial build) but it did not boot. Flashed Sphinx Kernel also, but again same result.
Click to expand...
Click to collapse
Im on 9.4.12 Xiaomi.eu ROM but it works on every ROM just follow this steps when you make a clean flash:
1. flash ROM
2. mount vendor, flash fstab.zip
3. flash the other files (kernel, magisk, gapps)
and now reboot
let me know if it doesnt works:fingers-crossed:
VC-34 said:
Im on 9.4.12 Xiaomi.eu ROM but it works on every ROM just follow this steps when you make a clean flash:
1. flash ROM
2. mount vendor, flash fstab.zip
3. flash the other files (kernel, magisk, gapps)
and now reboot
let me know if it doesnt works:fingers-crossed:
Click to expand...
Click to collapse
Yeah, pretty much did the same thing. However latest version of orangefox recovery from blitzfire3 doesn't format it to f2fs by reading from fstab file. You have to change to f2fs i mean data and cache through partition options in ofox recovery wipe menu, after which it gets changed. Will try some other rom.
VC-34 said:
Just remember flashing the fstab file (mount vendor before).
Click to expand...
Click to collapse
Hey, I Can't Find An fstab File For Enabling f2fs On My Poco X3 Pro. Help
Hashman9820 said:
Hey, I Can't Find An fstab File For Enabling f2fs On My Poco X3 Pro. Help
Click to expand...
Click to collapse
Look into your boot image!

Categories

Resources