From a40fe9c65b75c26e5f55e0064b1904c05c8bb26c Mon Sep 17 00:00:00 2001 From: osm0sis Date: Fri, 5 Apr 2019 21:21:46 -0300 Subject: AK2: add backwards compat for crazy devices hacking their mmcblk0 see comments here: https://github.com/osm0sis/AnyKernel2/pull/38#issuecomment-479577751 This will allow the current way people were adding arguments to dd via block= but also allow them to control this directly by adding customdd= to anykernel.sh. --- tools/ak2-core.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/ak2-core.sh b/tools/ak2-core.sh index 181b17a..c30a799 100755 --- a/tools/ak2-core.sh +++ b/tools/ak2-core.sh @@ -39,10 +39,16 @@ split_boot() { if [ ! -e "$(echo $block | cut -d\ -f1)" ]; then ui_print " "; ui_print "Invalid partition. Aborting..."; exit 1; fi; + if [ "$(echo $block | cut -d\ -f2-)" ]; then + block=$(echo $block | cut -d\ -f1); + customdd=$(echo $block | cut -d\ -f2-); + elif [ ! "$customdd" ]; then + local customdd="bs=1048576"; + fi; if [ -f "$bin/nanddump" ]; then $bin/nanddump -f /tmp/anykernel/boot.img $block; else - dd if=$block of=/tmp/anykernel/boot.img bs=1048576; + dd if=$block of=/tmp/anykernel/boot.img $customdd; fi; nooktest=$(strings /tmp/anykernel/boot.img | grep -E 'Red Loader|Green Loader|Green Recovery|eMMC boot.img|eMMC recovery.img|BauwksBoot'); if [ "$nooktest" ]; then @@ -356,6 +362,9 @@ flash_boot() { if [ -f "$bin/flash_erase" -a -f "$bin/nandwrite" ]; then $bin/flash_erase $block 0 0; $bin/nandwrite -p $block /tmp/anykernel/boot-new.img; + elif [ "$customdd" ]; then + dd if=/dev/zero of=$block $customdd 2>/dev/null; + dd if=/tmp/anykernel/boot-new.img of=$block $customdd; else cat /tmp/anykernel/boot-new.img /dev/zero > $block 2>/dev/null; fi; -- cgit v1.2.3