Saturday, April 9, 2016

rom flashing - How to patch `system.img` using MagiskManager patch feature to root the device?


I have a treble and system-as-root but it is not an A/B device. I have rooted it with the help of the MagiskManager patch feature. My understanding is: MagiskManager has modified the following three files for rooting:



  1. boot.img to remove the signatures.


  2. vbmeta.img to remove the AVB checks(to stop flashing unauthorized binaries).

  3. recovery.img to actually root the device by patching init and adding some files like .backup/.magisk, .backup/.init(original init) etc..


Magisk has patched the recovery.img to boot the device into root mode if you release the recovery mode key combination at a splash screen.


But my requirement is to always boot as root without needing any key combinations.


I know Magisk needs to patch the SE-Policies and init file before the init process is actually started(as it will turn ON the enforcing mode). From treble device, my understanding is that the system partition is mounted before running the init script.


I think Magisk developers have patched the recover.img because they want to follow the systemless-root approach and support for the OTA updates.


So, I want to know if MagiskManager is capable of patching my system.img file to root the device?


I know the root will be lost if any OTA will come or maybe my device will fail to update the system but this is ok with me as long as I can root it again with the same method :)


This is also fine if instead of rooting on system.img, I will be able to patch the zImage to always boot in recovery as root mode.



Please suggest if it is feasible or not. If yes then how?




No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...