A small demonstration of Android System Image and its content.
Resources:
1. Gist by tonio-nucci
https://gist.github.com/tonio-nucci/8ff2894c42c6320a50dc4b70b32a716a
2. https://github.com/mirsamantajbakhsh/AndroidSystemModification
3. https://mstajbakhsh.ir/android-system-image-modification
4. https://youtu.be/yZgYIaSm2ZE
2. Headlines
Android’s System Image
System Modification
System and Platform Apps
SELinux and MAC Permissions
System Rebuild
OEM and Boot
3. Android System Image
All Android systems has a system.img which is the main OS including apps and configs
The system image is mountable since it is in ext4 file system usually.
But the image should be converted to raw image before mounting.
The Android’s Sparge image can be converted to Raw image using this tool:
https://github.com/anestisb/android-simg2img
4. System Modification
First of all, we should mount the raw image.
sudo mount –t ext4 –o loop system.img.raw MOUNT_POINT
Then all the system.img is modifiable.
One interesting folder is system📂which contains all system apps and private apps
5. System and Platform Apps
System apps are applications that placed in /system/ folder.
They can not be removed without root, but can be disabled.
If you’re root, you can move apps to /system folder, so change your app from third party app to
system app.
If the application has same signature as the system, therefore you’re platform app and then you
have a lots of abilities.
6. SELinux and MAC Permissions
All file and folders have their special SELinux permission.
The permission should be applied on your apps.
After applying the SELinux permission, you can renew the system signature by creating new
signature.
The new signature is placed in MAC.
7. System Rebuild
After changing the system, you can rebuild the system
After that, you can make the system.img for AP.tar
8. OEM and Boot
For flashing the system, you should firstly unlock the phone’s boot loader.
You can search the Internet for this matter.
After that, you can flash the custom AP.tar with custom vbmeta for ignoring boot signature of the
system.img.