Skip to main content

Create GSIs(generic system image)



What is GSI?

GSI stands for generic system image, The GSI contains all directories and files same as implemented in android system, GSIs can have many types of encryption for different devices but sparse GSI can be flashed on any android. Android System image mainly contains following directories app, bin, etc, fonts, framwork, lib, lib64, media, priv-app, usr, vendor, xbin, build.prop, manifest.xml, etc.


Requirements to create system image from android device

  • Android device with SU binaries installed(Rooted device)
  • Windows/Linux PC with adb and fastboot installed 
  • USB cable for connection of android device with PC
Steps to create system image (system.img) 

Step 1- Enable Developer mode and USB debugging from settings 

  • click 7 times on about phone to enable Developer Mode 
  • search for Developer mode and enable USB Debugging 




Step 2- Connect Android device with PC in debugging mode, Type the following command in Command prompt/ Terminal  to check your device connected properly with PC 
  • "adb devices"

 

It will show your device's id number and a pop up menu will show in android device Allow adb connection on that menu 


Step 3- Enter in adb shell and run it with SU (super user/administrator) privileges, Type the following commands in Terminal/command prompt 

  •  adb shell     
  •  su 
  •  cd /dev/block/by-name     //this path may be different in your device
  •  dd if=system of=/storage/self/primary/system.img          //This will generate unencrypted/unsparse system image in your device storage
 Step 4- Copy the generated system.img to your PC and mount it and make desired changes to system image and then unmount it


Step 5- This modified image can be reinstalled in device by reversing the dd command, copy the modified image in internal storage of the device
  • dd if=/storage/self/primary/system.img of=/dev/block/by-name/system

The changes will be applied to system, format device to apply changes

                                                                    OR

 Step 6- To flash image trough fastboot a sparse image will required, To convert the modified system.img to sparse format, linux users can use "simg2img" utility software and for windows users some software are available like "imgextractor" 

  • install simg2img using command in Terminal "sudo apt-get install simg2img
  •  To convert the modified system.img in sparse format type the following command
  • "img2simg < input non sparse image file name > < output sparse image name>"

  • Flash the sparse image using fastboot mode in android device using following command
  • "fastboot flash system <image file name>"




By customrom.co.in

Comments