Modifying an Android virtual machine system image

Source: Internet
Author: User

1. As we all know, Android is Linux at the bottom. Our operation of system.img here is also done under Linux. If you are using Windows, you can use a VMware virtual machine to install the Linux operating system. I'm using Ubuntu.

2, we can be in the/boot directory (or another directory, the following file name can also be modified) to create a new 3 folders:

New/boot/work: The main work space

New/boot/system: System.img image for mounting the SDK

New/boot/newsystem: Used to mount a newly crafted EXT4 format image

3. Download the Make_ext4fs tool online

A) Copy the Make_ext4fs, mkuserimg.sh, simg2img three files to the/boot/work directory.

b) Copy the system.img in the SDK to the/boot/work directory (for example, the path to system.img in my SDK is: \adt-bundle-windows-x86-20131030\sdk\system-images\ ANDROID-19\ARMEABI-V7A).

c) Create a new system blank image, below to make 300M newsystem.img as an example:

Generate image file: # dd If=/dev/zero of=newsystem.img count=614400

Making the image file Ext4 file system: #./make_ext4fs newsystem.img

Change permissions: #chmod 666 newsystem.img

All right, get ready to finish the job.

4. Mount Image

A) mount the image system.img to the/boot/system directory

# mount-t Ext4-o Loop System.img/boot/system

b) Mount the image newsystem.img to the/boot/newsystem directory

# mount-t Ext4-o Loop Newsystem.img/boot/newsystem

Once mounted, we'll just open the/boot/system and/boot/newsystem directories, and we'll see the corresponding class capacity in system.img and newsystem.img.

As you can see, there is a lot of content in system, and only lost+found in Newsystem. Now we can make any changes to the system (such as removing the APK from the app). After the modification, we use the CP command to copy the contents of system to the Newsystem file folder. Then, lift the mount.

At this point, the/boot/work directory of system.img and newsystem.img are modified to complete. The contents of the two mirrors are exactly the same, just the size of the system.img or the original size, while the newsystem.img is reduced to 300M. Of course, if you do not need to modify the size of the image, you can use system.img directly, newsystem.img do not have to create.

5, note: Userdata.img can also be produced by this method.

Modifying an Android virtual machine system image

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.