From eeddea9c3b727bb494bd728caa68c7c3d4dbb059 Mon Sep 17 00:00:00 2001 From: osm0sis Date: Fri, 25 Nov 2016 08:34:22 -0400 Subject: [PATCH] AK2: add support for slot-based systems (ie. Pixel support!) - new shell variable "is_slot_device" to enable slot suffix detection ("block" shell variable remains the partition filepath minus the suffix) Notes: on slot-based systems now the boot.img contains only the recovery ramdisk, not rootfs, by default, but when rooted contains both, with rootfs in /boot. Since modifications to both recovery and (when rooted) boot ramdisks are now possible through AK2 no other behavior is changed so that the dev may modify what they wish, e.g. to add files to rooted boot ramdisk put them in AK2's ramdisk/ folder in a boot/ subfolder, and to make modifications to rooted boot files add "boot/" to the filenames used with the commands. --- anykernel.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/anykernel.sh b/anykernel.sh index 5e8b781..94a8741 100755 --- a/anykernel.sh +++ b/anykernel.sh @@ -16,6 +16,7 @@ device.name5= # shell variables block=/dev/block/platform/omap/omap_hsmmc.0/by-name/boot; +is_slot_device=0; ## end setup @@ -30,6 +31,15 @@ patch=/tmp/anykernel/patch; chmod -R 755 $bin; mkdir -p $ramdisk $split_img; +if [ "$is_slot_device" == 1 ]; then + slot=$(getprop ro.boot.slot_suffix 2>/dev/null); + test ! "$slot" && slot=$(grep -o 'androidboot.slot_suffix=.*$' /proc/cmdline | cut -d\ -f1 | cut -d= -f2); + test "$slot" && block=$block$slot; + if [ $? != 0 -o ! -e "$block" ]; then + ui_print " "; ui_print "Unable to determine active boot slot. Aborting..."; exit 1; + fi; +fi; + OUTFD=/proc/self/fd/$1; # ui_print