Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ff13a17 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

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
parent 6fceb2aa
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y
- mkap:     Builds the module(s) using mka and pushes them to the device.
- cmka:     Cleans and builds using mka.
- 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.

Look at the source to view more functions. The complete list is:
EOF
@@ -1306,6 +1308,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" ]