Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Commit

Permalink
No need for broken magiskboot anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Zackptg5 committed May 2, 2018
1 parent a6a826e commit 4d6bdb4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
14 changes: 5 additions & 9 deletions anykernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ dump_boot;


# begin ramdisk changes
case $(grep_prop ro.product.cpu.abi) in
arm*) mv -f $bin/magiskboot_arm $bin/magiskboot;;
x86*) mv -f $bin/magiskboot_x86 $bin/magiskboot;;
*) ui_print "Unsupported CPU architecture!"; ui_print "Unable to patch dtb in ramdisk"; ui_print "and/or fstab in dtbo!";;
esac

[ -f dtb ] && list="${list} dtb"
for i in fstab.*; do
[ -f "$i" ] || continue
list="${list} $i"
Expand All @@ -60,6 +53,7 @@ if [ $(grep_prop ro.build.version.sdk) -ge 26 ]; then
patch_prop $overlay/default.prop ro.config.dmverity false
rm -f verity_key sbin/firmware_key.cer
fi
[ -f dtb ] && list="${list} dtb"

ui_print "Disabling forced encryption in the fstab..."
found_fstab=false
Expand Down Expand Up @@ -90,13 +84,15 @@ for fstab in $fstabs; do
done
$found_fstab || ui_print "Unable to find the fstab!"

[ -f $overlay/dtb ] && $bin/magiskboot --dtb-patch $overlay/dtb && ui_print "Patching fstab in dtb to remove dm-verity"
# remove dm_verity from dtb and dtbo
patch_dtb $split_img/boot.img-zImage
[ -f $overlay/dtb ] && patch_dtb $overlay/dtb
[ ! -z $dtboimage ] && { cp -f $dtboimage /tmp/anykernel/dtbo.img; patch_dtb /tmp/anykernel/dtbo.img; }

# end ramdisk changes

ui_print " "
ui_print "Repacking boot image..."
write_boot;
patch_dtbo_image

## end install
13 changes: 5 additions & 8 deletions tools/ak2-core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ flash_boot() {
fi;
done;
if [ "$dtbo" ]; then
dtbo_block=/dev/block/bootdevice/by-name/dtbo$slot;
dtbo_block=`find /dev/block -iname dtbo$slot | head -n 1`;
if [ ! -e "$(echo $dtbo_block)" ]; then
ui_print " "; ui_print "dtbo partition could not be found. Aborting..."; exit 1;
fi;
Expand Down Expand Up @@ -599,13 +599,10 @@ grep_prop() { grep "^$1" "/system/build.prop" | cut -d= -f2; }

device_check() { test "$(getprop ro.product.device)" == "$1" -o "$(getprop ro.build.product)" == "$1" && return 0 || return 1; }

patch_dtbo_image() {
if [ ! -z $dtboimage ]; then
if $bin/magiskboot --dtb-test $dtboimage; then
ui_print "Patching fstab in dtbo to remove avb-verity"
$bin/magiskboot --dtb-patch $dtboimage
return 0
fi
patch_dtb() {
if [ "$(sed -n '/\x76\x65\x72\x69\x66\x79/p' $1)" ]; then
ui_print "Patching $(basename $1) to remove dm-verity..."
sed -i -e 's/\x2c\x76\x65\x72\x69\x66\x79/\x00\x00\x00\x00\x00\x00\x00/g' -e 's/\x76\x65\x72\x69\x66\x79\x2c/\x00\x00\x00\x00\x00\x00\x00/g' -e 's/\x76\x65\x72\x69\x66\x79/\x00\x00\x00\x00\x00\x00/g' $1
fi
}

Expand Down
Binary file removed tools/magiskboot_arm
Binary file not shown.
Binary file removed tools/magiskboot_x86
Binary file not shown.

0 comments on commit 4d6bdb4

Please sign in to comment.