summaryrefslogtreecommitdiffstats
path: root/envsetup.sh
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2012-10-24 16:40:42 -0700
committerAdnan Begovic <adnan@cyngn.com>2015-10-06 16:12:06 -0700
commit83c03d57465db8c18ad8076fd18f484e364fe969 (patch)
treea96f704ff0b0bea19344e0b782ccf7bc265c53ee /envsetup.sh
parent9fc8c752b2fa05f6b2ce1df024b501b607931e5a (diff)
downloadbuild-83c03d57465db8c18ad8076fd18f484e364fe969.zip
build-83c03d57465db8c18ad8076fd18f484e364fe969.tar.gz
build-83c03d57465db8c18ad8076fd18f484e364fe969.tar.bz2
build: Add "installrecovery" command
* Similar to "installboot", add an "installrecovery" command which writes the recovery image to the correct partition of a running device. Change-Id: I1dcca44fd0d8afa08ece9e99cd914547acb99c83
Diffstat (limited to 'envsetup.sh')
-rw-r--r--envsetup.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/envsetup.sh b/envsetup.sh
index 81f8b74..b851370 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -26,6 +26,8 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y
- aospremote: Add git remote for matching AOSP repository
- mka: Builds using SCHED_BATCH on all processors
- reposync: Parallel repo sync using ionice and SCHED_BATCH
+- installboot: Installs a boot.img to the connected device.
+- installrecovery: Installs a recovery.img to the connected device.
Environemnt options:
- SANITIZE_HOST: Set to 'true' to use ASAN for all host modules. Note that
@@ -1610,6 +1612,39 @@ function installboot()
fi
}
+function installrecovery()
+{
+ if [ ! -e "$OUT/recovery/root/etc/recovery.fstab" ];
+ then
+ echo "No recovery.fstab found. Build recovery first."
+ return 1
+ fi
+ if [ ! -e "$OUT/recovery.img" ];
+ then
+ echo "No recovery.img found. Run make recoveryimage first."
+ return 1
+ fi
+ PARTITION=`grep "^\/recovery" $OUT/recovery/root/etc/recovery.fstab | awk {'print $3'}`
+ if [ -z "$PARTITION" ];
+ then
+ echo "Unable to determine recovery partition."
+ return 1
+ fi
+ adb start-server
+ adb root
+ sleep 1
+ adb wait-for-device
+ adb remount
+ adb wait-for-device
+ if (adb shell cat /system/build.prop | grep -q "ro.cm.device=$CM_BUILD");
+ then
+ adb push $OUT/recovery.img /cache/
+ adb shell dd if=/cache/recovery.img of=$PARTITION
+ echo "Installation complete."
+ else
+ echo "The connected device does not appear to be $CM_BUILD, run away!"
+ fi
+}
function makerecipe() {
if [ -z "$1" ]