2021-04-21 20:33:25 +02:00
2021-04-18 23:28:08 +02:00
2021-01-19 22:53:03 +01:00
2021-04-10 20:44:02 +02:00
2021-04-21 20:33:25 +02:00
2021-04-21 20:33:25 +02:00

rootAVD

newbit @ xda-developers

A Script to root your Android Studio Virtual Device (AVD), with Magisk within seconds.

Install Magisk

Preconditions

  • the AVD is running
  • a working Internet connection for the Menu
  • a command prompt / terminal is opened
  • adb shell will connect to the running AVD

How To Use it

  • run rootAVD with a path to an AVDs ramdisk.img file
  • ramdisk.img gets a backup and will be replaced when done patching

How To Use it under Android S with Magisk v22.x

  • rootAVD needs to run twice
  • 1st - to patch the ramdisk.img
  • 2nd - after Shut-Down & Reboot the AVD:
    • Option 1 - re-run same script command
    • Option 2 - run script with EnvFixTask Argument
      • The "Additional Setup Required" will not be triggered in Android S by Magisk App in AVD,
      • this must be done manually on the 2nd run
      • Grant Shell Su Permissions will pop up a few times
      • rootAVD will reboot the AVD automatically
      • check Magisk App !!

Install / Update a custom build kernel and its modules

Preconditions

  • Install Magisk Preconditions
  • build a kernel (bzImage) and its modules (initramfs.img)
  • both files are placed inside the rootAVD directory
  • ramdisk.img must be untouched (stock)

How To Use it

  • run rootAVD with the additional InstallKernelModules parameter
  • the modules inside ramdisk.img will be replaced by the modules inside initramfs.img
  • kernel-ranchu gets a backup and will be placed with bzImage when done patching
  • bzImage and initramfs.img will be deleted after installation

Restore Backups of Ramdisk and kernel

Preconditions

  • none

How To Use it

  • run rootAVD with the additional restore parameter

XDA [GUIDE] How to [Build|Mod|Update] a custom AVD Kernel and its Modules

rootAVD command line parameters

Linux

./rootAVD.sh ~/Android/Sdk/system-images/android-S/google_apis_playstore/x86_64/ramdisk.img
./rootAVD.sh EnvFixTask
./rootAVD.sh ~/Android/Sdk/system-images/android-S/google_apis_playstore/x86_64/ramdisk.img restore
./rootAVD.sh ~/Android/Sdk/system-images/android-S/google_apis_playstore/x86_64/ramdisk.img InstallKernelModules

MacOS

export PATH=$PATH:~/Library/Android/sdk/platform-tools
./rootAVD.sh ~/Library/Android/sdk/system-images/android-S/google_apis_playstore/x86_64/ramdisk.img
./rootAVD.sh EnvFixTask
./rootAVD.sh ~/Library/Android/sdk/system-images/android-S/google_apis_playstore/x86_64/ramdisk.img restore
./rootAVD.sh ~/Library/Android/sdk/system-images/android-S/google_apis_playstore/x86_64/ramdisk.img InstallKernelModules

Windows

set PATH=%LOCALAPPDATA%\Android\Sdk\platform-tools;%PATH%
rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-S\google_apis_playstore\x86_64\ramdisk.img

Notes

  • Android 12 (S) rev.2 needs Magisk v22.1+ or Canary
  • With the new Menu, you can choose between the newest Magisk, Canary and Stable, Version.
  • Once choosen, the script will make that Version to your local one.

Options

  • Install all APKs placed in the Apps folder
  • If you set PATCHFSTAB=true
    • fstab.ranchu will get patched to automount Block Devices like /dev/block/sda1
    • !! a custom build Kernel is needed !!
  • If you set GetUSBHPmodZ=true
    • The USB HOST Permissions Module Zip will be downloaded into /sdcard/Download

Magisk v22.1+ Successfully tested with Stock Kernel on

Magisk v21.4 Successfully tested with Stock Kernel on

Change Logs

[Apr. 2021]

  • [rootAVD.sh] - Added Android S rev 3 support
  • [General] - Added "InstallKernelModules" update/install custom build kernel and modules
  • [rootAVD.sh] - Added update_lib_modules function
  • [General] - Added "restore" to put back your backup files
  • [General] - Updated local Magisk App v22.1
  • [rootAVD.sh] - Added Option to Download the USB HOST Permissions Module

[Mar. 2021]

  • [General] - Add a Download Manager Function for bad TLS record using wget
  • [rootAVD.bat] - Adjustments to run with the updated rootAVD.sh
  • [General] - Add a Menu to choose the Magisk Version to install
  • [rootAVD.sh] - Added EnvFixTask Argument to fix Requires Additional Setup in Android S
  • [General] - Changed to BusyBox (D)ASH Standalone
  • [General] - Re-Structured Script
  • [rootAVD.sh] - Added "Additional Setup Required" manually for Android S
  • [rootAVD.sh] - Updated shakalaca's Ramdisk Repack Routine
  • [rootAVD.sh] - Added Compression Detection for LZ4 and GZ
  • [General] - Fixed some bugs and typos
  • [General] - Updated to Magisk App v22.0

Credits

S
Description
Script to root AVDs running with QEMU Emulator from Android Studio
Readme GPL-3.0 72 MiB
Languages
Shell 81.4%
Batchfile 18.6%