问题
What does the cache/recovery folder hold in the android filesystem? I have a single file inside it - last_log
that seems to have the log infomation about the last bootup. Can somebody explain this in detail?
回答1:
/cache
contains dex information about the apps installed on your device. This information is populated at the very first boot of Android. Android uncompresses each app, optimizes its launch, and save it into /cache
. You should at least see one file per app with a weird name:
/recovery
contains files needed to boot in recovery mode. Recovery mode is a special boot mode that allow you to (not limited):
- wipe /data,
- wipe /cache,
- install an update package
Some files contain commands that the recovery tool would execute if you ask so. For example, recovery mode is entered when you select factory reset on your device. When doing so, Android writes some commands to a file in /recovery
and asks the system to reboot in recovery mode. When recovery program is being executed, it reads the file and executes the commands written. In this case (factory reset), it would erase /data
and /cache
and reboot.
Those links might be interesting to you:
- What are ODEX files in Android?
- http://www.androidcentral.com/what-recovery-android-z
- http://marakana.com/s/post/1065/updating_android_os_via_ota (AOSP)
- http://forum.xda-developers.com/showthread.php?t=1091508
- http://developer.android.com/reference/android/os/RecoverySystem.html (Java API)
回答2:
Make some supplements for m-ric's answer:
- Actually, when your device enter in recovery mode, recovery system will mount a swap partition named "tmp", which is half size of you device's RAM in general if you didn't set its size in fstab or any other places.
- Then all your logs in recovery will saved in tmp partition at first. But when you quit recovery mode and boot to normal Android system, the tmp will not mount and just disappear. So to let developers get the logs in recovery mode, before quitting recovery mode, the recovery itself will copy logs from tmp partition to cache partition(/cache/recovery/xxx). Now you can get the recovery log in Android system.
来源:https://stackoverflow.com/questions/10885670/cache-recovery-folder-in-android