android-ramdisk.img analysis, recovery.img & boot.img execution

A, ramdisk Introduction

By facing ramdisk meaning it would be able to understand the meaning, ram disk virtual memory disk, the file system will ram modeled as hard to use. For conventional disk file system, the benefits of doing so is to greatly improve file access speed; but because of ram, so after a power failure, this part can not be saved. ramdisk file system is on the system load is powered directly from disk into memory one time, there will be no write-back operation during the entire operation, so after any changes are lost power down.

Two, ramdisk.img introduction

ramdisk.img is generated android packed, unpacked ramdisk.img contrast root root directory is very similar, so the ramdisk is a virtual file system. Here mainly on how to extract the ramdisk.img.

file ramdisk.img
--ramdisk.gz: gzip compressed data, from Unix   
-----可知ramdisk.img是gz的文件
mv ramdisk.img ramdisk.gz
-----更改后缀名
gunzip ramdisk.gz
-----解压,会生成ramdisk文件
file ramdisk
--ramdisk: ASCII cpio archive (SVR4 with no CRC)
cpio -i -F ramdisk

image

Third, the relationship between the ramdisk, boot.img, recovery.img

ramdisk.img will be packaged into boot.img and recovery.img (not the same ramdisk.img).

ramdisk.img the more important document is the "init", "init.rc", which is the init system / core / init / init.c compiled from, boot.img in ramdisk located in the init.rc system / core / init / init.rc, while the ramdisk recovery.img init.rc located in the bootable / recovery / etc / init.rc.

After the end of the kernel loads the first process is executed init, init will resolve init.rc file, and from the corresponding service. And this we can see the normal boot into recovery mode since the process is different.

The following code is bootable / recovery / etc / init.rc, can be seen, after entering the recovery mode execution sbin / recovery, this document is bootable / recovery / recovery.cpp generation (Android.mk view corresponding to the view catalog) .

service recovery /sbin/recovery
    seclabel u:r:recovery:s0

Guess you like

Origin www.cnblogs.com/linhaostudy/p/11543887.html