diff options
author | osm0sis <osm0sis@outlook.com> | 2019-04-05 21:21:46 -0300 |
---|---|---|
committer | osm0sis <osm0sis@outlook.com> | 2019-04-05 21:24:52 -0300 |
commit | a40fe9c65b75c26e5f55e0064b1904c05c8bb26c (patch) | |
tree | b49fe22ceecaf6e449c9f6fd2d5a7ef73caa236e /tools | |
parent | 3998baa52950c2c044ff6bc66e8f0a2a0d72a1fb (diff) |
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.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/ak2-core.sh | 11 |
1 files changed, 10 insertions, 1 deletions
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; |