Current location - Quotes Website - Signature design - How to make Ext4 file system image
How to make Ext4 file system image
Finally, the compilation of Android source code uses make_Ext4 to generate ext 4 picture+signature (update: reasonable use of make _ Ext4 parameter will not lead to adding signature). If you need a pure ext 4 image, you need to remove the signature and use simg2img. These two tools were compiled when compiling the Android source code. If there is no Android source code compilation environment, of course, you can also use the tool set android-tools-fsutils compiled by Ubuntu community. The file list of this toolset is as follows: (from android-tools-fsutils/filelist).

/usr/bin/ext2simg

/usr/bin/ext4fixup

/usr/bin/img2simg

/usr/bin/make_ext4fs

/usr/bin/mkuserimg

/usr/bin/simg2img

/usr/bin/simg 2g simg

/usr/bin/simg_dump

/usr/bin/test_ext4fixup

Installation method of tool set:

Sudo apt-get install Android- tools -fsutils

1

1

Make an Ext4 file system image:

# Create test directory

mkdir/tmp/ext 4 & amp; & ampCD/tmp/ext 4 & amp; & amp

Mkdir test. & amp

echo "Hello Ext4 " >test/hello ext 4 . txt & amp; & amp

# Generate an Ext4 image named test.ext4

make _ ext 4 fs-l 5 12M test . ext 4 test & amp; & amp

# mount test.ext4 to test_mount test.

O cycle test. & amp

Ls test_mount || echo "Error!"

First, look for this tool in the (yourAndroid code path) /out/ directory.

Unyaffs: used to extract system.img

Mkyaffs2image: used to package system.img

Hehe, the find command will certainly, right? Find out/-name mkyaffs2image

Please remember this directory when you find it. Mine is (codepath)/out/host/Linux-x86/bin/

1. Create a system folder under any folder, and mine is built under home/ Changjiang/. This folder is used to store the files extracted from system.img, and then copy the two tools found, unyaffs and mkyaffs2image, to /changjiang/home/system.

2. Copy the compiled system.img or downloaded system.img to the system folder.

3. Enter the following command in the terminal (/home/changjiang/ replace with the path in your own computer, yours is not mine).

CD/home/ Changjiang/system

. /unya fs/home/changjiang/system/system. img (unzip system.img with unyafs command), and there are various applications and libraries. , you can modify or replace it.

Second, repackage system.img. Although I don't know why, I know it is possible.

Hehe, nothing is impossible for linux. North Korea's Red Star operating system is an example.

Specific measures are as follows

System/ This directory is used to generate system.img.

mkyaffs2image system/ system.img

The first time you use the mkyaffs2image command in Ubuntu, you will be prompted.

Mkyaffs2image: command not found.

You also need to install mkyaffs2image.

/p/fatplus/downloads/detail? name = yaffs 2-source . tar & amp; can = 2 & ampq=

Download yaffs2-source.tar.

After unzipping, enter the utils folder, and then make.

Copy the mkyaffs2image file generated after make to the /usr/bin directory.

$ su

# cp mkyaffs2image /usr/bin/

# chmod 777/usr/bin/mkyaffs 2 image

afterwards

$ mkyaffs2image

Mk Yaffs2Image: the image building tool of Yaffs2, which was built on 20th 1 216th.

Usage: mkyaffs 2 image dir image _ file [convert]

Directory tree to be converted

Image_file saves the output file of the image.

"Transform" to generate a big-end image from a small-end machine

Indicates that the installation is successful, and you can also see the usage of this command.

Mkyaffs2image image directory image file

For example:

Mk yaffs2imageam1808-fsam1808-fs.yaffs//create a jffs2 file.

Students who are engaged in Android often come into contact with system.img, but this file often appears in two formats: raw and sparse.

One is rawextx4 image, which is often called raw image. Observed by file: It is characterized by a complete EXTEX4partition image (including many invalid padding areas with all zeros), which can be directly mounted by mount, so it is relatively large (generally 1G or so).

[java] View Plain Text

$ file system.img

System. img: Linux rev1.0ext4 file system data, uuid = 57F8F4BC-ABF4-655f-BF67-946F0F9F2b (range) (large file).

The message is very clear.