I saw a post https://github.com/topjohnwu/Magisk/issues/732
@topjohnwu says
“I run Magisk in emulators. Might release documentations on how to do it soon.” on 26.Feb,
But I didn't find how to install Magisk to emulator on documentations..
I love magisk and can't wait play fgo and pokemon go on My PC..
The basic idea is to find a way to replace init to magiskinit. There will not be a general guide for that since emulators does not have a clear standard.
I have successfully installed Magisk 20.1 on an Android Q Google Play x86_64 AVD (the emulator provided by Android Studio).
Update: it had some problems: #2112
I found no boot.img on this kind of AVD. I found ramdisk.img in [Android SDK Path]/system-images/android-29/google_apis_playstore/x86_64, which is in cpio.gz format.
I followed the hints of boot_patch.sh to patch this ramdisk.img file. (I didn't execute this file directly.) It turned out to be working.
I then abootimg-unpack-initrded the patched file out of curiosity (a fakeroot environment would be nice to do this job). I found that /init was replaced by magiskinit64, meanwhile, the original /init (together with /fstab.ranchu was moved into /.backup/. A config file (which described KEEPVERITY, KEEPFORCEENCRYPT etc) was also placed into /.backup with a new filename of .magisk.
I didn't patch the kernel, since it's not ARM at all, while the original patch pattern seemed to be ARM.
I then tried to install magisk on an Android 8.0 x86 AVD, which was unfortunately failed. The system didn't start at all, almost no I/O activity was observed.
Also, there was something wrong around "KEEPFORCEENCRYPT=false".
/fstab.ranchu of this Android 8.0 x86 AVD contains the following line:
/dev/block/vdc /data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,quota,forceencrypt=/dev/block/vdd
which was (erroneously) modified into this, by magiskboot:
/dev/block/vdc /data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,quota,=/dev/block/vdd
Android 7.0 x86 AVD seemed to be working fine with Magisk. The official Magisk module of Xposed worked fine with it, too.
Hi @andronoob ,
Could you share the patched ramdisk.img you created? I would really like to have root in my virtual device, but how to do this goes over my head.
@JudgeDread11 Sorry, but I didn't keep that file. I had deleted such patched ramdisk.img. You may follow these steps:
https://github.com/topjohnwu/Magisk/issues/2112#issuecomment-565340950
I have successfully installed Magisk 20.1 on an Android Q Google Play x86_64 AVD (the emulator provided by Android Studio).
Update: it had some problems: #2112
I found no boot.img on this kind of AVD. I found
ramdisk.imgin[Android SDK Path]/system-images/android-29/google_apis_playstore/x86_64, which is incpio.gzformat.I followed the hints of boot_patch.sh to patch this
ramdisk.imgfile. (I didn't execute this file directly.) It turned out to be working.I then
abootimg-unpack-initrded the patched file out of curiosity (afakerootenvironment would be nice to do this job). I found that/initwas replaced bymagiskinit64, meanwhile, the original/init(together with/fstab.ranchuwas moved into/.backup/. A config file (which describedKEEPVERITY,KEEPFORCEENCRYPTetc) was also placed into/.backupwith a new filename of.magisk.
Can I explain the process in detail for Genymotion?
Magisk on Android Studio Emulator (AVD or Android Virtual Device)
https://github.com/shakalaca/MagiskOnEmulator