0

Phone: Mediatek Symphony V32(root privilleged)

My /system partition is messed up, I accidently deleted some system apps, and also some bin files. Although it's functioning properly, I pretty much want it to get back to it's original state. Hence I downloaded the stock firmware. The stock firmware came in a .zip extension. I also have twrp recovery on my phone. Is it possible to flash the entire thing using twrp? I unzipped the firmware.zip to see what's in there(I attached a screenshot of the file contents).

To view the contents of system.img, I did

mkdir system/

mount -o ro,loop system.img system/

Now, I could see all the contents of what's in there in the system.img, like app, bin, data, init.rc and such. I copied a few app to my desktop, and tried copying them back to my phone and it said, symlink could not be established. I can copy regular files to my phone. But only from system.img from pc to phone, it says symlink to found.

I was surfing the web, and came across a post where it said that the whole /system partition can be replaced with the original stock one if I had stock system.img using a dd command. In order to do that I got the block of my system partition using cat /proc/mounts which lead me to discover that the system partition is called from /dev/block/platform/mtk-msdc.0/by-name/system. This file is a symbolic link to /dev/block/mmcblk0p20 Hence, if I had to perform a dd command from the twrp terminal menu, I would have to do dd if=/storage/sdcard0/system.img of=/dev/block/platform/mtk-msdc.0/by-name/system bs=512k

If all goes well I should have a stock /system partition. Now, I'm trying to be careful since there are some nasty stuffs I read online that could go wrong while doing this. What are your experience with it? Have you tried doing it before? What suggestions would you like to give me to be successful while doing this? Will doing this with twrp command line be a safe way to do that? What are the possibilities that the whole thing could go wrong?

P.S. I am for the moment am not intending to use spflashtool since I am in no position to do so(I don't have the proper resources to run the program on my pc atm).

Screenshot of the file contents:

files files

7
  • 1
    I already explained to you the dd approach is very commonly used. Personally I've used it hundreds of times on Android device and PC. Just make sure the image you are going to write is the correct mountable partition image. And if you are that afraid create a backup dump of existing system partition before overwriting it. // If your zip file contains update-binary and updater-script files in META-INF/com/google/android/ directory, it's a recovery flashable zip. But even if you try to flash a non-flashable zip it won't do any harm. It'll throw an error and exit. – Irfan Latif Sep 18 '20 at 6:09
  • 1
    Manually copying files in /system should also work, but you need to retain files' metadata including ownership, permission mode and also SELinux context if SELinux is enforcing. // Recreating a flashable zip is simple. update-binary is a binary executable and updater-script is an Edify language script. Or you can replace update-binary with a shell script. You can find scores of examples of both approaches. Just extract any working flashable zip (like Magisk or AnyKernel) and read its contents. Edify syntax: source.android.com/devices/tech/ota/nonab/… – Irfan Latif Sep 18 '20 at 6:21
  • @Irfan Latif Thank you. SELinux is Enforcing on the phone. Should that be set to permissive while using dd. Im sorry if Im being paranoid, but since I know very little about these things, I'm trying to be careful. So far your help has been a tremendous nudge to the right place and I cant thank you enough! – silly goose Sep 18 '20 at 6:34
  • The zip file unfortunately does not have an updater script. – silly goose Sep 18 '20 at 6:35
  • @Irfan Latif Are there anything else I should be concerned about while issuing the dd command. I'm going in for the dd command. If there's anything like really small thing, I should make sure, please let me know. – silly goose Sep 18 '20 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.