I compared 2 devices; one running Android v5.1.1 and other v9.0. So I noticed that files under /proc
are same in both.
Can anyone explain why there is no difference even though OEM's are different and SDK versions are poles apart?
Why files/directories under Android's root filesystem don't change across different version updates?
-
What kind of changes you expect with the difference of SDK versions?– Irfan LatifCommented Mar 21, 2019 at 9:16
1 Answer
Android OS has two parts: kernel and userspace binaries, libraries, configuration etc. Android's kernel is taken from Linux, slightly modified and rarely gets major updates in years (other than critical security patches), while the second part gets frequent changes and updates, particularly with version releases.
The procfs is Linux kernel's virtual filesystem which:
contains (among other things) one sub-directory for each process running on the system, which is named after the process ID (PID)
So it's not directly affected by changes made to AOSP by OEMs or Google itself.
Since Android is based on Linux, its filesystem hierarchy also resembles Linux distributions. So there are least chances of it being changed with Android version updates. What Android (Google or OEM) changes resides mostly in /system
and /vendor
partitions. Libraries (native or java), executable and configuration files may possibly change but most of the changes related to Graphical User Interface or Android's internal API's are only within source code and don't reflect at filesystem level.
ANDROID'S ROOTFS:
Android's root filesystem is extracted from RAM disk which is a part of boot partition. boot.img
that also contains kernel binary is built along with ROM (Android OS for a specific device). Starting with Android Pie for non-A/B devices, contents of RAM disk are moved to /system
partition, making system.img
essentially the root filesystem. See System-as-root.
- One important file in root directory is
/init
executable binary which is the very first process started by kernel. It's the supervisor of all subsequently starting and stopping processes./*.rc
files are its configuration files. - Some other necessary binaries are included in
/sbin
. /sepolicy
is the SELinux policy file that's loaded before starting any services and processes on boot./cache
,/data
,/dsp
,/firmware
,/persist
,/odm
,/system
and/vendor
are mountpoints where different block devices are mounted. Last three contain most of the Android OS stuff while/data
contains settings and user's media./system
has a partial rootfs hierarchy of a standard Linux distro./cache
holds temporary files./dsp
(directory or symlink to/vendor/dsp
) and/firmware
(directory or symlink to/vendor/firmware_mnt
) hold some read-only firmware related to SoC (Qualcomm) and/persist
(directory or symlink to/mnt/vendor/persist
) has configurations that are rarely changed./config
,/mnt
and/storage
are also mountpoints of virtual filesystems to manage mounting of SD cards and external storage. Details here./proc
is a pseudo filesystem as stated above./sys
is also a similar filesystem./dev
is also a virtul filesystem (tmpfs
) which is populated fromsysfs
and contains interfaces to all available devices./acct
is one of Android'scontrol group
implementation to control load-balancing of CPUs. Other cgroups are mounted on/dev/memcg
,/dev/cpuctl
and/dev/cpuset
to control usage of hardware resources./root
is the traditionalhome
directory of Linux'sroot
user, not used on Android./default.prop
is a file or symlink to/etc/default.prop
which contains some of default Android System Properties.- To retain compatibility,
/sdcard
is a symlink to/storage/emulated/0
,/bin
to/system/bin
andd
to/sys/kernel/debug
. The traditional Linux's configuration directory/etc
is a symlink to/system/etc
.
Almost all of this filesystem hierarchy is the backbone of Android OS and there are very least chances of it being largely affected by Android's internal changes that occur to native services/daemons or Java-based framework.
For more details: ANDROID DEVICE PARTITIONS and FILESYSTEMS
-
Thanx a lot for youe response and detailed answer.. Please can you also guide for how to extract boot img and other images from boot partition... I tried that (dd if and of) method but got a bit confused bw snapdragon and mediatek stuff my device is based on SD... Thanx in advance ;)– ghost_83Commented Mar 21, 2019 at 11:31
-