summaryrefslogtreecommitdiffstats
path: root/envsetup.sh
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2012-09-23 23:46:55 -0700
committerAdnan Begovic <adnan@cyngn.com>2015-10-06 16:12:04 -0700
commitf00e7d98980890c53a3e3289f9317cae8102147d (patch)
tree1f88696f4b91afe96457d66512757e35b3d687d4 /envsetup.sh
parent2c031b2dba7db882e70c44549544414614ba8a61 (diff)
downloadbuild-f00e7d98980890c53a3e3289f9317cae8102147d.zip
build-f00e7d98980890c53a3e3289f9317cae8102147d.tar.gz
build-f00e7d98980890c53a3e3289f9317cae8102147d.tar.bz2
build: Add "installboot" command to install boot images
* For devices that lack fastboot, this command will copy the boot image to a running device, write it out to the correct partition with dd, copy the modules and set the correct permissions. * Field surveys have discovered that a specific CM device maintainer is handling two devices, one with boot partition p7 and one at p8. * Extensive research has unveiled the fact that mixing up these partitions across these two specific devices will cause corruption of the TZ firmware, which cannot be restored and results in an unrecoverable brick. * Automate the process so this idiot (me) stops breaking shit. Change-Id: I0dc5449daf128181e2e349ea26ad5741cc87bfe7
Diffstat (limited to 'envsetup.sh')
-rw-r--r--envsetup.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/envsetup.sh b/envsetup.sh
index 8c82b8d..49746c4 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1624,6 +1624,46 @@ function aospremote()
}
export -f aospremote
+function installboot()
+{
+ if [ ! -e "$OUT/recovery/root/etc/recovery.fstab" ];
+ then
+ echo "No recovery.fstab found. Build recovery first."
+ return 1
+ fi
+ if [ ! -e "$OUT/boot.img" ];
+ then
+ echo "No boot.img found. Run make bootimage first."
+ return 1
+ fi
+ PARTITION=`grep "^\/boot" $OUT/recovery/root/etc/recovery.fstab | awk {'print $3'}`
+ if [ -z "$PARTITION" ];
+ then
+ echo "Unable to determine boot 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/boot.img /cache/
+ for i in $OUT/system/lib/modules/*;
+ do
+ adb push $i /system/lib/modules/
+ done
+ adb shell dd if=/cache/boot.img of=$PARTITION
+ adb shell chmod 644 /system/lib/modules/*
+ echo "Installation complete."
+ else
+ echo "The connected device does not appear to be $CM_BUILD, run away!"
+ fi
+}
+
+
function makerecipe() {
if [ -z "$1" ]
then