What structure does the android file system have? How can we separate this file system? How can I mount a file system? All these questions will be answered in the article.
Friends who have used Linux may have a very good impression on open-source systems. In the increasingly mature mobile operating system, is there an open-source system like Linux? Google withdrew from a Linux-based Android
Operating system to meet people's needs. Here you can first learn about the android file system.
1. Structure of the android File System
After the android source code is compiled, the system. IMG, ramdisk. IMG, and userdata. IMG image files are obtained. Ramdisk. IMG is the file system of emulator. IMG includes the main packages, libraries, and other files, userdata. IMG includes some user data. After the emulator loads these three image files, it loads system and userdata to the system and userdata directories in the ramdisk file system respectively. Therefore, we can copy all the files in ramdisk. IMG and extract system. IMG and userdata. IMG
The system and userdata directories in the ramdisk file system.
2. Separate the android File System
The system. IMG, ramdisk. IMG, and userdata. IMG image files are packaged using cpio and compressed using gzip. You can run the file command to verify that:
- file ramdisk.img
Output:
- ramdisk.img: gzip compressed data, from Unix, last modified: Wed Mar 18 17:16:10 2009
After the android source code is compiled, in addition to system. IMG and userdata. IMG, the system and userdata folders are generated, so you do not need to decompress them. After the android source code is compiled, the root folder is generated. In fact, the files under root are the same as those in ramdisk. IMG. But here we will introduce how to decompress ramdisk. IMG:
Copy ramdisk.imgto another directory, change its name to ramdisk.img.gz, and run the command
- gunzip ramdisk.img.gz
Create a folder named ramdisk.
- cpio -i -F ../ramdisk.img
Now you can see and operate the content in ramdisk.
Copy the files in system and userdata generated after compiling the android source code to ramdisk/system and ramdisk/userdata. In this way, a file system is obtained.
3. Mount the android File System Using a Network File System
Therefore, we need to create the/nfsroot directory, create the/nfsroot/androidfs directory, change the android File System to androidfs, and link to/nfsroot/androidfs.
4. Android file system kernel boot file system
After mounting the android kernel/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. The main work of init. RC is:
1) set some environment variables
2) create directories such as system, sdcard, data, and Cache
3) mount some file systems to some directories, for example, Mount tmpfs/sqlite_stmt_journals
4) set user groups and permissions for some files
5) set some thread parameters
6) set the TCP cache size
Share:
Friends who have used Linux may have a very good impression on open-source systems. In the increasingly mature mobile operating system, is there an open-source system like Linux? Google withdrew from a Linux-based Android
Operating system to meet people's needs. Here you can first learn about the android file system.
1. Structure of the android File System
After the android source code is compiled, the system. IMG, ramdisk. IMG, and userdata. IMG image files are obtained. Ramdisk. IMG is the file system of emulator. IMG includes the main packages, libraries, and other files, userdata. IMG includes some user data. After the emulator loads these three image files, it loads system and userdata to the system and userdata directories in the ramdisk file system respectively. Therefore, we can copy all the files in ramdisk. IMG and extract system. IMG and userdata. IMG
The system and userdata directories in the ramdisk file system.
2. Separate the android File System
The system. IMG, ramdisk. IMG, and userdata. IMG image files are packaged using cpio and compressed using gzip. You can run the file command to verify that:
- file ramdisk.img
Output:
- ramdisk.img: gzip compressed data, from Unix, last modified: Wed Mar 18 17:16:10 2009
After the android source code is compiled, in addition to system. IMG and userdata. IMG, the system and userdata folders are generated, so you do not need to decompress them. After the android source code is compiled, the root folder is generated. In fact, the files under root are the same as those in ramdisk. IMG. But here we will introduce how to decompress ramdisk. IMG:
Copy ramdisk.imgto another directory, change its name to ramdisk.img.gz, and run the command
- gunzip ramdisk.img.gz
Create a folder named ramdisk.
- cpio -i -F ../ramdisk.img
Now you can see and operate the content in ramdisk.
Copy the files in system and userdata generated after compiling the android source code to ramdisk/system and ramdisk/userdata. In this way, a file system is obtained.
3. Mount the android File System Using a Network File System
Therefore, we need to create the/nfsroot directory, create the/nfsroot/androidfs directory, change the android File System to androidfs, and link to/nfsroot/androidfs.
4. Android file system kernel boot file system
After mounting the android kernel/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. The main work of init. RC is:
1) set some environment variables
2) create directories such as system, sdcard, data, and Cache
3) mount some file systems to some directories, for example, Mount tmpfs/sqlite_stmt_journals
4) set user groups and permissions for some files
5) set some thread parameters
6) set the TCP cache size