TWRP for Android Emulator
Support Status: Current
Maintainer: Dees_Troy
Code Name: twrp
Support thread on xda-developers
Current and past versions of TWRP can be found at one of the mirrors below:
TWRP can be booted in the Android emulator. To use this you will need to download both the goldfish_2.6_kernel and the appropriate .img file from one of our mirrors above.
With the Android emulator make a new device based on a Galaxy Nexus. Allow it to have a hardware keyboard and a 1500MB sdcard. Give it a name like TWRP. Then from your android-sdk/tools folder run the following command:
./emulator -avd TWRP -ramdisk ~/cm_folder/out/target/product/twrp/ramdisk-recovery.img -kernel ~/cm_folder/device/emulator/twrp/goldfish_2.6_kernel
(Note that you will have to change the paths to match the locations of the files that you have downloaded.)
After the first boot, wait for ADB to start up (usually ADB comes online about 15 seconds after TWRP boots), then:
adb shell /sbin/create_partitions.sh
This script will partition the sdcard with a boot, recovery, system, cache, data, and removable sdcard partition. It's designed to work with a 1500MiB sdcard. If you want a different sdcard size then you will need to modify the script in the cm_folder/device/emulator/twrp/recovery/root/sbin/create_partitions.sh location to suit your needs. The script will also mount the old MTD system device to /system so that you can make a backup of the system image to restore to your new mmc-based system.
If you want to make the emulator boot up using the emmc partitions, you will need to modify the ramdisk.img. Locate the ramdisk.img in your android-sdk/system-images/android##/armeabi-v7a/ folder. To unpack it:
Modify the init.rc to mount your mmc based partitions instead of the mtd ones by locating the line in init.rc that says "on fs" and modifying it to look like this:
Save the changes and repack the ramdisk image as follows:
find . | cpio -o -H newc > gzip > ../newramdisk.img
Boot the emulator using -ramdisk path/to/newramdisk.img -kernel path/to/goldfish_2.6_kernel
- Ethan Yonker
2016-09-15T19:21:43Z
Update kernel The old kernel did not support the latest sepolicy so we update the kernel and get rid of the prebuilt init and sepolicy files. - bigbiff
2016-02-20T02:08:45Z
We don't need GPS makefile. - Ethan Yonker
2016-02-20T01:18:46Z
Updates for 6.0 - Ethan Yonker
2015-07-13T15:51:10Z
Updates for Android 5.1.1 - Ethan Yonker
2014-08-15T02:53:19Z
Update for 4.4 and Omni