In practice, explore the Android smartphone system-Rom Partition

Source: Internet
Author: User

The Android system is also an OS, and is based on the Linux kernel.ArticleFrom the perspective of operating system exploration, we can understand the Android system from practice, so as to better use the Android system and even transform it.

Lab environment:

Hardware: HTC G11 s710e Hong Kong edition + 16gbtf card

Android: miui for G11, S-off

Required Software: terminal Simulator

 

In practice, explore the Android smartphone system ------ Rom Partition

Disk partitioning is a static operating system. For example, Windows only needs one C disk partition, while Linux can use multiple partitions to mount different parts. Android uses the Linux kernel, but its device usually does not have a hard disk but Rom, so the partitions are also different. Open the terminal simulator on your phone and enter Su to obtain the root permission. Run DF-h to view the ROM partition information as follows:

$ Su
# DF-H
Filesystem size used available use % mounted on
Tmpfs 307.3 M 32.0 K 307.3 M 0%/dev
Tmpfs 307.3 M 0 307.3 M 0%/mnt/ASEC
Tmpfs 307.3 M 0 307.3 M 0%/mnt/OBB
/Dev/block/mmcblk0p25 549.2 M 165.4 M 355.9 M 32%/System
/Dev/block/mmcblk0p26 1.1G 115.1 M 982.7 M 10%/Data
/Dev/block/mmcblk0p2 290.5 MB 39.1 M 236.4 M 14%/Cache
/Dev/block/vold/179: 65 14.8g 428.8 M 14.4g 3%/mnt/sdcard
/Dev/block/vold/179: 65 14.8g 428.8 M 14.4g 3%/mnt/secure/ASEC
#

 

The first note is that the tmpfs file system is a virtual memory-based file system that does not occupy Rom space. The last two are SD cards and only the middle three are Rom partitions (marked in red ).

It can be seen that the Rom is divided into three areas, the size of which is 549.2 M, 1.1G, 290.5 m, respectively. This should be a 2 GB Rom. These three partitions are mounted to different paths, where/system is a system partition and/data is installed by the user.Program/Cache is the partition used by the system as the cache. The so-called Rom flushing is actually re-writing the/system partition without affecting the/Data Partition. Therefore, the program installed by the user still exists.

 

To further understand the mounting status during system running, run the mout command:

$ Export Path =/data/local/bin: $ path
$ Su
# Mount
Rootfs on/type rootfs (RO, relatime)
Tmpfs on/dev type tmpfs (RW, relatime, mode = 755)
Devpts on/dev/PTS type devpts (RW, relatime, model = 600)
Proc on/proc type proc (RW, relatime)
Sysfs on/sys type sysfs (RW, relatime)
None on/Acct type cgroup (RW, relatime, cpuacct)
Tmpfs on/mnt/ASEC type tmpfs (RW, relatime, mode = 755, gid = 1000)
Tmpfs on/mnt/OBB type tmpfs (RW, relatime, mode = 755, gid = 1000)
None on/dev/cpuctl type cgroup (RW, relatime, CPU)
/Dev/block/mmcblk0p25 on/system type ext4 (RO, relatime, barrier = 1, data = ordered)
/Dev/block/mmcblk0p26 on/Data Type ext4 (RW, nosuid, nodev, noatime, barrier = 1, data = ordered, noauto_da_alloc)
/Dev/block/mmcblk0p2 on/cache type ext4 (RW, nosuid, nodev, noatime, barrier = 1, data = ordered)
/Data/D on/data/D type debugfs (RW, relatime)
/Sys/kernel/debug on/sys/kernel/debug type debugfs (RW, relatime)
/Dev/block/vold/179: 65 on/mnt/sdcard type vfat (RW, dirsync, nosuid, nodev, noexec, relatime, uid = 1000, gid = 1015, fmask = 0602, dmask = 0602, allow_utime = 0020, codePage = cp437, iocharset = iso8859-1, shortname = mixed, utf8, errors = remount-Ro)
/Dev/block/vold/179: 65 on/mnt/secure/ASEC type vfat (RW, dirsync, nosuid, nodev, noexec, relatime, uid = 1000, gid = 1015, fmask = 0602, dmask = 0602, allow_utime = 0020, codePage = cp437, iocharset = iso8859-1, shortname = mixed, utf8, errors = remount-Ro)
Tmpfs on/mnt/sdcard/. android_secure type tmpfs (RO, relatime, size = 0 k, mode = 000)
#

Among them, rootfs is also a ram-based file system. We can see that android/is directly built on Ram. on PC, Linux usually requires rootfs during startup, then switch to the root file system on the disk, while Android directly uses rootfs, so the speed is fast, but after all, the RAM size is limited, so the root directory cannot store too many things.

Others, such as none, Proc, devpt, and tmpfs, are also non-device file systems. They are generally memory-based file systems.

From the content marked in red, we can see that the ROM partition uses the ext4 standard Linux file system type, and the SD card uses the file system that can be identified in Linux and Windows such as vfat, the content above can be read by the Windows desktop system.

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.