GitHub - newbit1/rootAVD: Script to root AVDs running with QEMU Emulator from Android Studio

PHOTO EMBED

Tue Mar 01 2022 22:40:53 GMT+0000 (Coordinated Universal Time)

Saved by @xxkovalxx

rootAVD A Script to root AVD by NewBit XDA

Usage:	rootAVD [DIR/ramdisk.img] [OPTIONS] | [EXTRA_CMDS]
or:	rootAVD [ARGUMENTS]

Arguments:
	ListAllAVDs			Lists Command Examples for ALL installed AVDs

	EnvFixTask			Requires Additional Setup fix
					- construct Magisk Environment manual
					- only works with an already Magisk patched ramdisk.img
					- without [DIR/ramdisk.img] [OPTIONS] [PATCHFSTAB]
					- needed since Android 12 (S) rev.1
					- not needed anymore since Android 12 (S) API 31 and Magisk Alpha
					- Grant Shell Su Permissions will pop up a few times
					- the AVD will reboot automatically

	InstallApps			Just install all APKs placed in the Apps folder

Main operation mode:
	DIR				a path to an AVD system-image
					- must always be the 1st Argument after rootAVD
	
ADB Path | Ramdisk DIR:
	[M]ac/Darwin:			export PATH=~/Library/Android/sdk/platform-tools:$PATH
					~/Library/Android/sdk/system-images/android-$API/google_apis_playstore/x86_64/
	
	[L]inux:			export PATH=~/Android/Sdk/platform-tools:$PATH
					~/Android/Sdk/system-images/android-$API/google_apis_playstore/x86_64/
	
	[W]indows:			set PATH=%LOCALAPPDATA%\Android\Sdk\platform-tools;%PATH%
					%LOCALAPPDATA%\Android\Sdk\system-images\android-$API\google_apis_playstore\x86_64\
	
	$API:				25,29,30,S,etc.
	
Except for EnvFixTask, ramdisk.img must be untouched (stock).
	
Options:
	restore				restore all existing .backup files, but doesn't delete them
					- the AVD doesn't need to be running
					- no other Argument after will be processed
	
	InstallKernelModules		install custom build kernel and its modules into ramdisk.img
					- kernel (bzImage) and its modules (initramfs.img) are inside rootAVD
					- both files will be deleted after installation
	
	InstallPrebuiltKernelModules	download and install an AOSP prebuilt kernel and its modules into ramdisk.img
					- similar to InstallKernelModules, but the AVD needs to be online
	
Options are exclusive, only one at the time will be processed.
	
Extra Commands:
	DEBUG				Debugging Mode, prevents rootAVD to pull back any patched file
	
	PATCHFSTAB			fstab.ranchu will get patched to automount Block Devices like /dev/block/sda1
					- other entries can be added in the script as well
					- a custom build Kernel might be necessary

	GetUSBHPmodZ			The USB HOST Permissions Module Zip will be downloaded into /sdcard/Download
	
Extra Commands can be combined, there is no particular order.
	
Notes: rootAVD will
- always create .backup files of ramdisk.img and kernel-ranchu
- replace both when done patching
- show a Menu, to choose the Magisk Version (Stable || Canary || Alpha), if the AVD is online
- make the choosen Magisk Version to its local
- install all APKs placed in the Apps folder
content_copyCOPY

https://github.com/newbit1/rootAVD