diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2014-06-19 01:45:15 +0100 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-10-06 17:49:48 -0700 |
commit | 8319708635ced660b18c572eaf0e65ae879c3fd8 (patch) | |
tree | 0a8a50beb6dc747ef31f97c04da9837500223f4e /tools/releasetools/common.py | |
parent | 615cb5bf8f2ad98076b20bac6805173238025820 (diff) | |
download | build-8319708635ced660b18c572eaf0e65ae879c3fd8.zip build-8319708635ced660b18c572eaf0e65ae879c3fd8.tar.gz build-8319708635ced660b18c572eaf0e65ae879c3fd8.tar.bz2 |
ota: Let devices specify their own recovery-from-boot.p installer
Some devices apply transformations to the installed images, making
the sha1 checksums fail (or, worse, generating invalid images). If
"/system/etc/recovery-transform.sh" exists, run that instead, passing
the expected sizes and checksums as arguments in the form of
recovery-transform.sh <recovery_size> <recovery_sha1> <boot_size> <boot_sha1>
A direct emulation of the standard patcher could look like this, transformations
should be added as needed.
----------------
RECSIZE=$1
RECSHA1=$2
BOOTSIZE=$3
BOOTSHA1=$4
dd if=/dev/block/platform/msm_sdcc.1/by-name/recovery of=$C/recovery.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=$C/boot.img
if ! applypatch -c EMMC:$C/recovery.img:$RECSIZE:$RECSHA1; then
log -t recovery "Installing new recovery image"
applypatch -b /system/etc/recovery-resource.dat EMMC:$C/boot.img:$BOOTSIZE:$BOOTSHA1 EMMC:$C/recovery.img $RECSHA1 $RECSIZE $BOOTSHA1:/system/recovery-from-boot.p || exit 1
else
log -t recovery "Recovery image already installed"
fi
----------------
Conflicts:
tools/releasetools/ota_from_target_files
Change-Id: Ie601841ca1cdad6b8f3b16e593d2718a92e8ca09
Diffstat (limited to 'tools/releasetools/common.py')
-rw-r--r-- | tools/releasetools/common.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 3944af5..7196c48 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -1422,6 +1422,10 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img, return sh = """#!/system/bin/sh +if [ -f /system/etc/recovery-transform.sh ]; then + exec sh /system/etc/recovery-transform.sh %(recovery_size)d %(recovery_sha1)s %(boot_size)d %(boot_sha1)s +fi + if ! applypatch -c %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s; then applypatch %(bonus_args)s %(boot_type)s:%(boot_device)s:%(boot_size)d:%(boot_sha1)s %(recovery_type)s:%(recovery_device)s %(recovery_sha1)s %(recovery_size)d %(boot_sha1)s:/system/recovery-from-boot.p && log -t recovery "Installing new recovery image: succeeded" || log -t recovery "Installing new recovery image: failed" else |