Android File System Analysis

Source: Internet
Author: User

Article Source http://code.google.com/p/androidteam/wiki/AndroidFileSystemAnalysis1Android File System Analysis
  • System Environment: ubuntu9.10
  • Date: 03/09/2010

After compiling the android source code/Home/zhaoruijia/zhaoandroid/out/target/product/genericThree image files generated after compilation are found in the directory: system. IMG, ramdisk. IMG, userdata. IMG, where system. IMG includes the main packages, libraries, and other files, userdata. IMG includes some user data. After the simulator loads these three image files
System and data are loaded to the system and Data Directories In the ramdisk file system respectively. The ramdisk. IMG is the file system of the simulator. You can input the following:

zhaoruijia@zhaoruijia-ubunut:~$ androidemu zhaoruijia@zhaoruijia-ubunut:~$ adb shell
# lssqlite_stmt_journalsconfigcachesdcarddetcsystemsyssbinprocinit.rcinit.goldfish.rcinitdefault.propdatarootdev

It is observed that the shell Regan File System Structure in the simulator is essential for Kernel transplantation. Currently, there are two ways to obtain a root file system, one way is to drag out the file system in the simulator by packaging, and then use busybox to re-create a root file system. Another way is to use ramdisk. all files in IMG are copied out. IMG and userdata. IMG decompress the files to the system and Data Directories In the ramdisk file system. IMG, userdata. besides IMG, system and
Data folder, so you do not need to decompress them. You only need to copy them out and then mount the android file system using the Network File System. The steps are as follows:

1. Copy ramdisk. IMG to the/home/zhaoruijia/workspace1directory and change its name to ramdisk.img.gz.

 zhaoruijia@zhaoruijia-ubunut:~/workspace1$ mv ramdisk.img ramdisk.img.gz

And use the command

zhaoruijia@zhaoruijia-ubunut:~/workspace1$ gunzip ramdisk.img.gz zhaoruijia@zhaoruijia-ubunut:~/workspace1$ lsramdisk  ramdisk.img

2. Create a ramdisk folder and enter the following:

Zhaoruijia @ zhaoruijia-mongout :~ /Workspace1 $ mkdir ramdiskzhaoruijia @ zhaoruijia-Rule ut :~ /Workspace1 $ CD ramdiskzhaoruijia @ zhaoruijia-example ut :~ /Workspace1/ramdisk $ cpio-I-f/home/zhaoruijia/workspace1/ramdisk. img494

3. copy the files in system and data generated after Android source code compilation to ramdisk/system and ramdisk/data. In this way, a file system is obtained.

Zhaoruijia @ zhaoruijia-mongout :~ /Workspace1/ramdisk $ LS-L total usage 152drwxrwx -- X 2 zhaoruijia 4096 2010-03-10 data-RW-r -- 1 zhaoruijia 118 2010-03-10 default. propdrwxr-XR-x 2 zhaoruijia release 4096 2010-03-10 Dev-rwxr-x --- 1 too far 103184 2010-03-10 init-rwxr-x --- 1 zhaoruijia 1677 2010-03-10 init. goldfish. RC-rwxr-x --- 1 zhaoruijia 12215 2010-03-10 init. rcdrwxr-XR-x 2 release 4096 2010-03-10 procdrwxr-x --- 2 release 4096 2010-03-10 sbindrwxr-XR-x 2 release 4096 2010-03-10 sysdrwxr-XR-x 10 release zhaoruijia 4096 System

4. We need to mount the android file system using the Network File System. Therefore, we need to create the/nfsroot directory, create the/nfsroot/androidfs directory, and rename the android file system as androidfs, link to/nfsroot/androidfs

5. After the android kernel is mounted to/nfsroot/androidfs, initialize and load the system library and program according to init. RC and init. Goldfish. RC until the boot is complete. The init. RC Script includes many file system initialization and loading processes. As for the specific startup process, I will analyze it in the next article with the init. C source code.

Legacy problems:It is still unknown whether or not the kernel can be mounted through the Network File System is not successfully transplanted. This article is just a reference. I am more optimistic about obtaining the root file system from the simulator and customizing it through busybox.

Http://home.eeworld.com.cn/my/space.php? Uid = 181697 & Do = Blog & id = 42953

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.