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.
This commit is contained in:
osm0sis committed 2016-11-26 10:25:15 -04:00
1 parent 8534510bf8
commit eeddea9c3b
1 file changed
+10
+10
View File
@@ -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 <text>