Skip to content

Instantly share code, notes, and snippets.

@aknik
Created June 6, 2018 16:43
Show Gist options
  • Save aknik/14bc4590b3efa19af70a08afc839a870 to your computer and use it in GitHub Desktop.
Save aknik/14bc4590b3efa19af70a08afc839a870 to your computer and use it in GitHub Desktop.
system.img android rom linux
Procedure:
1. UnZip Android or your present data.img file to your Home Folder. Or a folder of your liking (or even on your memory card!), just remember to cd before you do the following:
2. Open Terminal and Copy&Paste (Ctrl+C, Ctrl+Shift+V) this:
Code:
dd if=/dev/zero bs=1M count=XXX >> data.img
where XXX is the amount, in MB, by which data.img should be increased by.
My filesize started out as 256MB and I wanted a total of 512MB. That would mean I needed a extra 256MB, so I executed this:
Code:
dd if=/dev/zero bs=1M count=256 >> data.img
3. Run a file system check and file system resizer
Code:
e2fsck -f data.img
resize2fs data.img
e2fsck -f data.img
Procedure:
Place your system.img and the 2 binaries in one directory, and make sure the binaries have exec permission.
Part 1 – mount the file-system
mkdir sys
./simg2img system.img sys.raw
sudo mount -t ext4 -o loop sys.raw sys/
Then you have your system partition mounted in ‘sys/’ and you can modify whatever you want in ‘sys/’. For example de-odex apks and framework jars.
Part 2 – create a new flashable system image
sudo ./make_ext4fs -s -l 512M -a system new.img sys/
sudo umount sys
rm -fr sys
Now you can simply type:
fastboot flash system new.img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment