Android recovery pipeline Process Analysis

Source: Internet
Author: User

For code analysis on recovery, see another article

Android
Recovery Pipeline Code Analysis


Make an upgrade program that supports SD card, USB flash drive, and Flash.

This upgrade application must be used together with the recovery under/recovery/sbin,

Firmware includes boot. IMG, recovery. IMG, system. IMG,

System. IMG is empty, and the packaging format of system. IMG must match recovery. IMG.

Use this program:

First, add librecovery. So to the rootfs file system library,

Add the application recovery_sample to a directory,

Then execute recovery_sample to implement the UPDATE function.

The document consists of four parts:

L update database and Application Files

L update usage and commands

L example of input command format

L update/recovery Interface


1. Update database and Application Files

File 1: Recovery

It exists in/gingerbread/bootable/and is used to generate the recovery executable file. After the file is generated, copy it to the updaterecoveryfs/recoveryfs/sbin/directory.

File 2: updatelibsample

The library file librecovery. So and the executable file recovery_sample used to generate the update application

File 3: updaterecoveryfs

Used to generate recovery. IMG. There are two formats: ramdisk and cramfs.

File 4: updaterootfs

Used to generate boot. IMG, which has two formats: ramdisk and cramfs

Ramdisk format:
./Mkbootfs recoveryfs |./minigzip> ramdisk-recovery.img &&\

./Mkkrnlimg ramdisk-recovery.img recovery. img

Rm ramdisk-recovery.img

Cramfs format:
./Mkfs. cramfs-N v1.01 recoveryfs recovery. img

The packaging formats of boot. IMG and recovery. IMG must be the same, which should be ramdisk or cramfs.

Flowchart

Two packaging formats

Ramdisk format:

./Mkbootfs recoveryfs |./minigzip> ramdisk-recovery.img &&\

./Mkkrnlimg ramdisk-recovery.img recovery. img

Rm ramdisk-recovery.img

Cramfs format:

./Mkfs. cramfs-N v1.01 recoveryfs recovery. img

2. Update usage and command

Enter./recovery_sample to view help

========================================================== ======================================

Shortcut equivalent command

2 -- wipe_cache format Cache

3 -- wipe_userdata format user data

4 -- wipe_udisk format USB disk data

6 -- recover_image = backup: update. IMG restores factory settings and restores all firmware files from backup.

7 -- update_image = sdcard: update. IMG default path, update from the firmware update. IMG under the root directory of the SD card

9 -- update_kernel upgrade the kernel separately and obtain the kernel firmware from the SD card update. IMG.

10 -- update_boot upgrade boot separately and obtain the boot firmware from the SD card update. IMG.

11 -- update_system upgrade system separately and obtain system firmware from SD card update. img

12 -- update_recovery upgrade recovery separately to obtain the recovery firmware from the SD card update. IMG.

13 -- update_backup separately upgrades the backup partition and copies the update. IMG of the SD card to the backup

14 -- update_parameter upgrade parameter separately to obtain parameter from SD card update. img

15 -- update_loader upgrade loader separately and obtain Loader from SD card update. img

16 (user define path name) manually enter the firmware update path and name

========================================================== ======================================

L 2-4 three functions enable the cache userdata udisk content to be erased independently or simultaneously

L 6 function recover_image = backup: update. IMG obtains update. IMG from the backup partition, extracts the recovery-Script script command, and executes the command to restore the firmware.

L from 9 to 15, the kernel, Boot, system, recovery, backup, parameter, and loader are upgraded. If the firmware update path and name are not specified, sdcard: update. IMG is used by default.

L 16 is the path and name of the firmware update.

3. input command format example

Ø format Cache

./Recovery_sample 2

Restore all firmware from backup

./Recovery_sample 6

Mix formatting and upgrade, separated by Spaces

./Recovery_sample 2 3 4 12

Enter the upgrade command to customize the firmware update path and name.

./Recovery_sample -- update_image = backup: update. img
./Recovery_sample -- update_image = sdcard:/rockchip/rkdroid. IMG 9
./Recovery_sample -- update_image = cache:/Cache/update. IMG 9 14

./Recovery_sample -- update_image = udisk: update. IMG 11

Note: Before upgrading from the MTD partition, mount the partition to a file and copy the firmware to the directory.

The names and information of the 10 MTD partitions are as follows:

# Cat proc/MTD

Dev: Size erasesize name

Mtd0: 00400000 00001000 "Misc"

Mtd1: 00800000 00001000 "kernel"

Mtd2: 00400000 00001000 "Boot"

Mtd3: 00800000 00001000 "recovery"

Mtd4: 10000000 00001000 "system"

Mtd5: 10400000 00001000 "backup"

Mtd6: 07400000 00001000 "cache"

Mtd7: 10000000 00001000 "userdata"

Mtd8: 00400000 00001000 "kpanic"

Mtd9: 3dd0000000001000 "user"

For example, to upgrade from a cache, You need to mount the cache to/dev/mtdblock6 to upgrade from the cache.

4. Recovery Interface Description

After reset, press the home + power key combination to directly access the recovery/update interface.

If you see

Recovery key is pressed

Combination key is pressed

Indicates that you are about to enter the recovery mode.

Buttons:

Note:

Vol +

Down, supports menu loop Selection

Vol-

Up, supports menu loop Selection

Play

Confirm current selection

You can customize the buttons to modify gingerbread/bootable/recovery/etc/int. RC.

Menu description:

Options

Name

Description

Reboot system now

Restart the system

Restart the system immediately

Factory reset

Restore factory settings

1. Obtain update. IMG from the backup partition

2. Restore firmware in all partitions except backup
3. Format userdata
4. format the cache

Update from sdcard

Upgrade from SD card

1. Obtain the upgrade command from "Update-script ".

2. Obtain the firmware update. Im from the root directory of the SD card.
3. Upgrade all firmware except the backup partition.
4. Do not erase user data

Update from udisk

Upgrade from USB flash drive

1. Obtain the upgrade command from "Update-script ".

2. Obtain upgrade fixed update. IMG from the udisk root directory
3. Upgrade all firmware except the backup partition.
4. Do not erase user data

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.