diff options
| author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2014-06-18 18:28:43 +0100 |
|---|---|---|
| committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2014-07-02 02:11:29 +0100 |
| commit | 60e743663d06aba34681f7fefd25789716b85209 (patch) | |
| tree | 4f68e2414c987b9675924acdb0913e19c28b8f58 | |
| parent | 4cd8756689d5c9394d5f476c005c02082a26d293 (diff) | |
recovery: Add a loki script as a recovery transformation step
This is required to support generated-from-boot recovery installations
Change-Id: I739c99d8beb01110920ed3539d92cf053623c757
| -rw-r--r-- | device.mk | 3 | ||||
| -rw-r--r-- | releasetools/Android.mk | 10 | ||||
| -rw-r--r-- | releasetools/loki-recovery.sh | 33 |
3 files changed, 44 insertions, 2 deletions
@@ -181,7 +181,8 @@ PRODUCT_PROPERTY_OVERRIDES += \ # This hw ships locked, work around it with loki PRODUCT_PACKAGES += \ loki.sh \ - loki_tool + loki_tool_static_gpad \ + recovery-transform.sh PRODUCT_PROPERTY_OVERRIDES += \ ro.radio.noril=true \ diff --git a/releasetools/Android.mk b/releasetools/Android.mk index 46e43fc..f164b42 100644 --- a/releasetools/Android.mk +++ b/releasetools/Android.mk @@ -21,7 +21,8 @@ LOCAL_PATH := $(call my-dir) # build static binary include $(CLEAR_VARS) LOCAL_SRC_FILES := loki_flash.c loki_patch.c loki_find.c loki_unlok.c main.c -LOCAL_MODULE := loki_tool_static +#renamed to avoid conflicts with other parts of the source tree... +LOCAL_MODULE := loki_tool_static_gpad LOCAL_MODULE_STEM := loki_tool LOCAL_MODULE_TAGS := eng # LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin @@ -36,4 +37,11 @@ LOCAL_MODULE_PATH := $(TARGET_OUT)/bin LOCAL_SRC_FILES := loki.sh include $(BUILD_PREBUILT) +include $(CLEAR_VARS) +LOCAL_MODULE := recovery-transform.sh +LOCAL_MODULE_CLASS := ETC +LOCAL_MODULE_PATH := $(TARGET_OUT)/etc +LOCAL_SRC_FILES := loki-recovery.sh +include $(BUILD_PREBUILT) + endif diff --git a/releasetools/loki-recovery.sh b/releasetools/loki-recovery.sh new file mode 100644 index 0000000..79d94cf --- /dev/null +++ b/releasetools/loki-recovery.sh @@ -0,0 +1,33 @@ +#!/system/bin/sh +# +# This leverages the loki_patch utility created by djrbliss +# See here for more information on loki: https://github.com/djrbliss/loki +# + +export C=/data/local/tmp/loki_tmpdir +RECSIZE=$1 +RECSHA1=$2 +BOOTSIZE=$3 +BOOTSHA1=$4 + +rm -rf $C +mkdir -p $C + +dd if=/dev/block/platform/msm_sdcc.1/by-name/recovery of=$C/recovery.lok +/system/bin/loki_tool unlok $C/recovery.lok $C/recovery.img + +if ! applypatch -c EMMC:$C/recovery.img:$RECSIZE:$RECSHA1; then + log -t recovery "recovery is outdated. unloki-ing all the things" + dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=$C/boot.lok + dd if=/dev/block/platform/msm_sdcc.1/by-name/aboot of=$C/aboot.img + /system/bin/loki_tool unlok $C/boot.lok $C/boot.img + 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 + /system/bin/loki_tool patch recovery $C/aboot.img $C/recovery.img $C/recovery.lok || exit 1 + /system/bin/loki_tool flash recovery $C/recovery.lok || exit 1 +else + log -t recovery "Recovery image already installed" +fi + +rm -rf $C +exit 0 |
