In Android 10 and 11,
the first stage ramdisk
contains the first stage init binary (which performs early mounting as specified
by fstab entries) and vendor fstab files. (As in Android 9 and lower,
system.img
contains the contents of $TARGET_ROOT_OUT
.)
-
For devices with a boot-ramdisk (non-A/B), first stage init is a static executable located at
/init
. These devices mountsystem.img
as/system
, then perform a switch root operation to move the mount at/system
to/
. The contents of the ramdisk are freed after mounting has completed. -
For devices that use recovery as a ramdisk, first stage init is located at
/init
within the recovery ramdisk. These devices first switch root to/first_stage_ramdisk
to remove the recovery components from the environment, then proceed the same as devices with a boot-ramdisk (that is, mountsystem.img
as/system
, switch root to move that mount to/
, and free ramdisk contents after mounting). Ifandroidboot.force_normal_boot=1
is present in the kernel command line (or bootconfig from Android 12 onward), devices boot normally (into Android) instead of booting into recovery mode.
After first stage init finishes, it executes /system/bin/init
with the
selinux_setup
argument to compile and load SELinux onto the system. Finally,
init executes /system/bin/init
again with the second_stage
argument. At this
point, the main phase of init runs and continues the boot process using the
init.rc
scripts.
The following sections detail differences in partition layouts for non-A/B devices before and after Android 10.
Partition layouts (non-A/B devices)
The following sections detail differences in partition layouts for non-A/B devices before and after Android 10.
boot.img
Ramdisk (Android 8.x and lower) |
System as root (Android 9) |
Ramdisk (Android 10 and 11) |
---|---|---|
Contains a kernel and a ramdisk.img -/ - init.rc - init - etc -> /system/etc - system/ (mount point) - vendor/ (mount point) - odm/ (mount point) ... |
Contains a normal boot kernel only. | Contains a kernel and ramdisk.img -/ - init - vendor fstab files - system/ (mount point) - vendor/ (mount point) - odm/ (mount point) ... |
recovery.img
Contains a recovery kernel and a recovery ramdisk.img
system.img
Ramdisk (Android 8.x and lower) |
System as root (Android 9) |
Ramdisk (Android 10 and 11) |
---|---|---|
Contains a system.img -/ - bin/ - etc - vendor -> /vendor - ... |
Contains the merged contents of system.img -/ - init.rc - init - etc -> /system/etc - system/ - bin/ - etc/ - vendor -> /vendor - ... - vendor/ (mount point) - odm/ (mount point) ... |
Contains the merged contents of system.img -/ - init.rc - init -> /system/bin/init - etc -> /system/etc - system/ - bin/ - etc/ - vendor -> /vendor - ... - vendor/ (mount point) - odm/ (mount point) ... |
Partition layouts (A/B devices)
The following sections detail differences in partition layouts for A/B devices before and after Android 10.
boot.img
System as root (Android 9) |
Ramdisk (Android 10 and 11) |
---|---|
Contains normal boot kernel and recovery-ramdisk
(BOARD_USES_RECOVERY_AS_BOOT := true ).Recovery-ramdisk is used only to boot into recovery. |
Contains normal boot kernel and recovery-ramdisk
(BOARD_USES_RECOVERY_AS_BOOT := true ). Recovery-ramdisk is used to boot into both recovery and Android. ramdisk.img -/ - init -> /system/bin/init - first_stage_ramdisk - vendor fstab files - etc -> /system/etc - system/ (mount point) - vendor/ (mount point) - odm/ (mount point) ... |
system.img
Contains the merged contents of $TARGET_SYSTEM_OUT
and $TARGET_ROOT_OUT
.
system.img
-/
- init.rc
- init -> /system/bin/init
- etc -> /system/etc
- system/
- bin/
- etc/
- vendor -> /vendor
- ...
- vendor/ (mount point)
- odm/ (mount point)
...