└── run.sh /run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | #base=/hdd2/dumps/Samsung/SM-A515F_XEF/ 6 | #base=/hdd2/dumps/Samsung/SM-G781U 7 | #base=/home/phh/tmp/SM-G781U_SPR/ 8 | 9 | #cp $base/recovery.img . 10 | #off=$(grep -ab -o SEANDROIDENFORCE recovery.img |tail -n 1 |cut -d : -f 1) 11 | #dd if=recovery.img of=r.img bs=4k count=$off iflag=count_bytes 12 | cp recovery.img r.img 13 | 14 | if [ ! -f phh.pem ];then 15 | openssl genrsa -f4 -out phh.pem 4096 16 | fi 17 | 18 | rm -Rf d 19 | ( 20 | mkdir d 21 | cd d 22 | ../magiskboot unpack ../r.img 23 | ramdisk=ramdisk.cpio 24 | if [ -f vendor_ramdisk/recovery.cpio ];then 25 | ramdisk=vendor_ramdisk/recovery.cpio 26 | fi 27 | ../magiskboot cpio $ramdisk extract 28 | # Reverse fastbootd ENG mode check 29 | set +e 30 | ../magiskboot hexpatch system/bin/recovery e10313aaf40300aa6ecc009420010034 e10313aaf40300aa6ecc0094 # 20 01 00 35 31 | ../magiskboot hexpatch system/bin/recovery eec3009420010034 eec3009420010035 32 | ../magiskboot hexpatch system/bin/recovery 3ad3009420010034 3ad3009420010035 33 | ../magiskboot hexpatch system/bin/recovery 50c0009420010034 50c0009420010035 34 | ../magiskboot hexpatch system/bin/recovery 080109aae80000b4 080109aae80000b5 35 | ../magiskboot hexpatch system/bin/recovery 20f0a6ef38b1681c 20f0a6ef38b9681c 36 | ../magiskboot hexpatch system/bin/recovery 23f03aed38b1681c 23f03aed38b9681c 37 | ../magiskboot hexpatch system/bin/recovery 20f09eef38b1681c 20f09eef38b9681c 38 | ../magiskboot hexpatch system/bin/recovery 26f0ceec30b1681c 26f0ceec30b9681c 39 | ../magiskboot hexpatch system/bin/recovery 24f0fcee30b1681c 24f0fcee30b9681c 40 | ../magiskboot hexpatch system/bin/recovery 27f02eeb30b1681c 27f02eeb30b9681c 41 | ../magiskboot hexpatch system/bin/recovery b4f082ee28b1701c b4f082ee28b970c1 42 | ../magiskboot hexpatch system/bin/recovery 9ef0f4ec28b1701c 9ef0f4ec28b9701c 43 | ../magiskboot hexpatch system/bin/recovery 9ef00ced28b1701c 9ef00ced28b9701c 44 | ../magiskboot hexpatch system/bin/recovery 2001597ae0000054 2001597ae1000054 # ccmp w9, w25, #0, eq ; b.e #0x20 ===> b.ne #0x20 45 | ../magiskboot hexpatch system/bin/recovery 2001597ac0000054 2001597ac1000054 # ccmp w9, w25, #0, eq ; b.e #0x1c ===> b.ne #0x1c 46 | 47 | ../magiskboot hexpatch system/bin/recovery 9ef0fcec28b1701c 9ef0fced28b1701c 48 | ../magiskboot hexpatch system/bin/recovery 9ef00ced28b1701c 9ef00ced28b9701c 49 | 50 | ../magiskboot hexpatch system/bin/recovery 24f0f2ea30b1681c 24f0f2ea30b9681c 51 | ../magiskboot hexpatch system/bin/recovery e0031f2a8e000014 200080528e000014 52 | ../magiskboot hexpatch system/bin/recovery 41010054a0020012f44f48a9 4101005420008052f44f48a9 53 | 54 | cp system/bin/recovery ../reco-patched 55 | 56 | set -e 57 | ../magiskboot cpio $ramdisk 'add 0755 system/bin/recovery system/bin/recovery' 58 | ../magiskboot repack ../r.img new-boot.img 59 | cp new-boot.img ../r.img 60 | ) 61 | --------------------------------------------------------------------------------