From a69fc3f196f8c6df58937a807a9adfe36570ab8e Mon Sep 17 00:00:00 2001 From: newbit1 Date: Sun, 27 Aug 2023 16:38:35 +0200 Subject: [PATCH] Updated the creation of the fakeboot.img --- README.md | 1 + rootAVD.sh | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 61954e8..d2db374 100644 --- a/README.md +++ b/README.md @@ -373,6 +373,7 @@ rootAVD.bat system-images\android-25\google_apis_playstore\armeabi-v7a\ramdisk.i ### Change Logs #### [August 2023] +* [rootAVD.sh] - Updated the creation of the fakeboot.img * [rootAVD.sh] - Added another way of checking the AVDs Internet connection #### [July 2023] diff --git a/rootAVD.sh b/rootAVD.sh index 8a3958d..de3921f 100755 --- a/rootAVD.sh +++ b/rootAVD.sh @@ -276,10 +276,10 @@ create_fake_boot_img() { echo "[-] removing old $FBI" rm -f $FBI $RDF - printf "\x41\x4E\x44\x52\x4F\x49\x44\x21" > $FBHI # ANDROID! - printf "\x00\x00\x00\x00\x00\x00\x00\x00" >> $FBHI - printf "\x00\x00\x00\x00\x00\x00\x00\x00" >> $FBHI - printf "\x00\x00\x00\x00\x00\x00\x00\x00" >> $FBHI + printf "\x41\x4E\x44\x52\x4F\x49\x44\x21" > $FBHI # ANDROID! + printf "\x00\x00\x00\x00\x00\x00\x00\x00" >> $FBHI # HEADER_VER KERNEL_SZ + printf "\x00\x00\x00\x00\x00\x00\x00\x00" >> $FBHI # RAMDISK_SZ SECOND_SZ + printf "\x00\x00\x00\x00\x00\x00\x00\x00" >> $FBHI # EXTRA_SZ printf "\x00\x00\x00\x00\x00\x08\x00\x00" >> $FBHI # 00080000 (Pagesize 2048) echo "[!] Only a minimal header is required for Magisk to repack the ramdisk" #mv $RDF $CPIO @@ -289,6 +289,33 @@ create_fake_boot_img() { echo "[*] repacking ramdisk.img into $FBI" $BASEDIR/magiskboot repack $FBHI $FBI > /dev/null 2>&1 + + test -f "$FBI" + RESULT="$?" + if [[ "$RESULT" != "0" ]]; then + echo "[*] $FBI could not be created" + echo "[-] Magisk expects a more complete boot.img header as source" + # size can be omitted in the header, only a warning will be generated + for i in $(seq 1 251); + do + printf "\x00\x00\x00\x00\x00\x00\x00\x00" >> $FBHI # fill 00000000 (to Pagesize 2048) + done + + echo "[*] Adding $CPIO to fakeboot.img header" + cat $CPIO >> $FBHI + + echo "[-] repacking ramdisk.img into $FBI with the more complete header" + $BASEDIR/magiskboot repack $FBHI $FBI > /dev/null 2>&1 + + test -f "$FBI" + RESULT="$?" + if [[ "$RESULT" != "0" ]]; then + echo "[!] $FBI could not be created" + abort_script + fi + fi + echo "[!] $FBI created" + InstallMagiskTemporarily detecting_users runMagisk_to_Patch_fake_boot_img