0

I want to know is it possible to edit a custom rom from zip and then zipping it again (flashable) to a device. Will it brick the device?
Thanx

  • Depends on what type of customization you make to the ROM. – Irfan Latif Mar 23 at 8:02
0

Depends on how the ROM is packaged and what you change in it before repacking. You should be able to unpack and make edits using suitable tools for unpacking the ROM.

A better option is to first flash it, then root and make your changes in the files as needed :-)

And yeah it can brick the device if you flash bad code 😁

  • What possible ways are there to pack / compile a rom... I mean there must be a universal way to extract the rom file the contents may vary within it... Care to explain a bit please 😀 – ghost_83 Mar 23 at 14:13
0

Well, the best would be to first flash the rom, test all of its functions and bugs and then, after testing, you can unzip the rom zip, make your own changes and then just rezip the files.But be careful for all the changes you make, a few changes can be like changing and removing if you want any system apps, change the default wallpapers and ringtones, but you shouldn't never touch any other files.

  • Is it possible to make a significant change like removing / adding preinstalled apps to rom or like changing the default launcher, status bar and other theming hacks... I know how to do all these with magisk modules nd xposed but I'm curious to make these changes to the rom so that j don't need to waste hours on flashing and then molding stuff 😀 – ghost_83 Mar 23 at 17:50
  • @ghost_83 theming hacks need the core framework to be modified which requires rebuilding ROM – Irfan Latif Mar 24 at 7:51
  • Can the rebuilding be done without syncing the aosp manifest or any other rom manifest? – ghost_83 Mar 24 at 8:08
  • No. You need source code obviously. – Irfan Latif Mar 24 at 16:57
0

Yes it is certainly possible. You need a Linux system however

First determine the format that has been used

If the zip has a system directory it's the old KitKat format Otherwise check system.transfer.list for the version

Anyway if it's just a system directory you can just extract the zip, add files, modify the updater-script and pack it back

The more complicated stuff:

Case 1: assume system.new.dat This is actually a sparse (iirc, not really sure) system image that you can extract with sdat2img You'll get a system.img Mount this as an ext4 loop device Perform your modifications Unmount the system image Use img2simg to convert system.img to a sparse image then flash it with fastboot like this

fastboot flash system system.img

Case 2: system.new.dat.br This is just a system.new.dat compressed with brotli. Do not directly run sdat2img on this First install brotli and decompress it to system.new.dat Follow everything as said in case 1

There is no easy way to convert it back to system.new.dat. You could use the AOSP build system to do so but if you want to make a flashable zip use the edify command "package_extract_file()" to extract the system.img from a flashable zip onto the system partition.

Also be careful. Remember that any files you add this way will have incorrect selinux contexts. You will have to use chcon to set the correct selinux contexts. Use ls -Z to check what contexts other files have and apply a suitable context

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.