First, the android kernel is successfully uploaded through the kernel. Under normal conditions, the target is timed out/target. product/generic/(but some do not have generic files, such as freescale and iriver; but lonshinetech has this file, depending on the actual situation, you only need to find the three generated files. Example :~ Three files are generated under/freescale/R9.2/out/target/product/imx51_bbg $): ramdisk. img, system. img, userdata. img. The functions of these three files are as follows:
(1) ramdisk. img
A partition image file will be mounted in the only available mode when the kernel is triggered. This file only contains/init and some configuration files, this ramdisk is used to mount the real root file system with init.
# In fact, the content of ramdisk. img is the volume of the/out/target/product/generic/root category.
Method 1: ramdisk generated by the android distributed snapshot. img is a gzip file. Run the dig command # file ramdisk. img, you will get the => ramdisk. img: gzip compressed data, from Unix
When ramdisk.img is removed first, because the specified parameter is not .gz, use-S to select the parameter, # gunzip-S. img ramdisk. img
In this way, a new file ramdisk. img is obtained. Use the # file ramdisk viewing format to obtain the => ramdisk: ASCII cpio archive (SVR4 with no CRC)
It can be seen that the ramdisk generated by the solution is a file in cpio format. The solution is to prevent the file from being mixed up after the solution is released,
Create a project for the first time, such as: # mkdir rfs // rfs, which can be used to release the file after ramdisk decoding, and then import # cd rfs
Solution # cpio-I-F ../ramdisk
Method 2: Use the [ramdisk.img] command to rename ramdisk.img.gz. Then run the command # gunzip ramdisk.img.gz,
Then create a new file named mongoramdisk. Then, import the file and run the dig command # cpio-I-F ../ramdisk. img.
The result is as follows:
Drwxr-xr-x 8 root 4096 ./
Drwxr-xr-x 13 root 4096 ../
Drwxrwx -- x 2 root 4096 data/
-Rw-r -- 1 root 118 default. prop
Drwxr-xr-x 2 root 4096 dev/
-Rwxr-x --- 1 root 107784 init *
-Rwxr-x --- 1 root 492 init. freescale. rc *
-Rwxr-x --- 1 root 1677 init. goldfish. rc *
-Rwxr-x --- 1 root 18263 init. rc *
Drwxr-xr-x 2 root 4096 proc/
Drwxr-x --- 2 root 4096 sbin/
Drwxr-xr-x 2 root 4096 sys/
Drwxr-xr-x 2 root 4096 system/
# It can be seen that this file is exactly the same as the content in the root directory. In fact, it is the packaging and configuration of the root directory. You can use tree-L 1 to view the root object.
(2) system. img
It contains the entire system, android framework, application, and so on. It will be connected to "/" and contains all binary files in the system.
# System. img is out/target. A ing of the system category under product/generic/category, similar to an image of the root file system, with android applications, configuration files, and fonts.
Root @ root-OptiPlex-380 :~ /Lonshinetech/src/SPU_B0_R0_0/out/target/product/generic/system $ tree-L 1
.
| -- Bin
| -- Build. prop
| -- Etc
| -- Fonts
| -- Framework
| -- Lib
| -- Usr
-- Xbin
Repackage system. img software Samples
A) Search for this tool mkyaffs2image in the out object generated after android login.
# Find out/-name mkyaffs2image
Get out/host/linux-x86/bin/mkyaffs2image
B) The android website will generate the system/object, which is used to generate system. img.
# Mkyaffs2image system/system. img
(3) userdata. img
It will be connected to/data, including all the configuration files related to the application and the data records related to the application.
(4) Android notebook
The Android program will input an init program number by the UBOOT program, which develops the program for the first operation when the machine is started, it is the init program, which is stored in ramdisk. in img, you can analyze its generation tasks to see what kind of initialization tasks have been done in it. Its source files are in system/core/init. c.
It uses init. rc to initialize the file, which is in the out/target/product/generic/root directory.
Ramdisk is first added during android activation. img images, upload images to/targets, and perform a series of initialization actions, including creating various desired targets and initializing the console, activate the service. System. img specifies some upload commands in init. rc, which are parsed through init. c and written to/system under the root directory.