[转载] How to update the recovery.img in android

博客出处:https://community.nxp.com/docs/DOC-102674

In recovery mode, recovery may update /boot or /system, but it never overwrite itself. The update of /recovery is in the normal bootup. When system boot up, it will execute init.rc which will call install-recovery.sh.

 

The install-recovery.sh is in update.zip. when the system is in recovery mode, updater-script will  unzip update.zip, and the install-recovery.sh will be unzip into /system/etc/. So if you update your image through recovery mode, the install-recovery.sh will be unzip to /system/etc/ automatically.

 

If your update.zip do not include install-recovery.sh. You can edit it and copy it to /system/etc. the below is content in install-recovery.sh.

 

#!/system/bin/sh

if ! applypatch -c EMMC:/dev/block/mmcblk3p2:7762488:374c3807940a38d9497a4c5ef64a069e553bc218; then

  log -t recovery “Installing new recovery image”

  applypatch -b EMMC:/dev/block/mmcblk3p1:7203059:238a297e7e3c7197b2f5af646d0e7e49cef0fd9f EMMC:/dev/block/mmcblk3p2  374c3807940a38d9497a4c5ef64a069e553bc218 7762488 c3c9482c8616805ea4c071ee9184240936f260e5:/system/recovery-from-boot.p

else

  log -t recovery “Recovery image already installed”

fi

 

Explain of the install-recovery.sh:

1、 judge whether the recovery-imx6q.img’s sha1 is the same with mmcblk3p2 on board.

374c3807940a38d9497a4c5ef64a069e553bc218 is the new recovery-imx6q.img’s sha1. 7762488 is the length of recovery-imx6q.img.

2、 if not the same , that mean it was a new recovery-imx6q.img. make a new recovery-imx6q.img through patch recovery-from-boot.p on boot.img.

7203059 and 238a297e7e3c7197b2f5af646d0e7e49cef0fd9f is the length and sha1 of boot.img.     src-file

EMMC:/dev/block/mmcblk3p2 is the recovery partition.      tgt-file

c3c9482c8616805ea4c071ee9184240936f260e5 is the sha1 of recovery-from-boot.p which is in update.zip.

Note:

1、 recovery-from-boot.p is in update.zip. And it is unzip into /system. It is the patch of boot-imx6q.img and recovery-imx6q.img.

2、 for EMMC:/dev/block/mmcblk3p2 is the partition, you can check ./out/target/product/sabresd_6dq/recovery/root/etc/recovery.fstab to see detail partition.

 

Check whether recovery is updated, there are two ways to check:

1、 you can write printf() in file bootable/recovery/recovery.cpp. On the board you can check the file /cache/recovery/last_log. You can find what you printf if the recovery.img was updated.

2、 Also you can use the adb the pull the recovery file system to check whether the recovery was updated.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值