James Christopher Adduono | a6108c9 | 2016-06-26 20:26:08 -0400 | [diff] [blame] | 1 | --- |
| 2 | layout: device |
| 3 | title: "Android Emulator" |
| 4 | codename: twrp |
| 5 | downloadfolder: twrp |
| 6 | oldurl: http://teamw.in/project/twrp2/169 |
| 7 | supportstatus: Current |
| 8 | maintainer: Dees_Troy |
| 9 | oem: TWRP |
| 10 | devicetree: https://github.com/TeamWin/android_device_emulator_twrp |
| 11 | xdathread: "http://forum.xda-developers.com/showthread.php?p=32965365" |
| 12 | --- |
| 13 | |
| 14 | {% include supportstatus.html %} |
| 15 | |
| 16 | {% include download.html %} |
| 17 | |
| 18 | <p class="text">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.</p> |
| 19 | <p>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:</p> |
| 20 | <p><tt>./emulator -avd TWRP -ramdisk ~/cm_folder/out/target/product/twrp/ramdisk-recovery.img -kernel ~/cm_folder/device/emulator/twrp/goldfish_2.6_kernel</tt></p> |
| 21 | <p>(Note that you will have to change the paths to match the locations of the files that you have downloaded.)</p> |
| 22 | <p>After the first boot, wait for ADB to start up (usually ADB comes online about 15 seconds after TWRP boots), then:</p> |
| 23 | <p><tt>adb shell /sbin/create_partitions.sh</tt></p> |
| 24 | <p> |
| 25 | <p>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.</p> |
| 26 | <p>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:</p> |
| 27 | <div><tt>mkdir ramdisk</tt></div> |
| 28 | <div><tt>cd ramdisk</tt></div> |
| 29 | <div><tt>gzip -dc ../ramdisk.img | cpio -i</tt></div> |
| 30 | <p>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:</p> |
| 31 | <div><tt>on fs</tt></div> |
| 32 | <div><tt># mount emmc partitions</tt></div> |
| 33 | <div><tt> # Mount /system rw first to give the filesystem a chance to save a checkpoint</tt></div> |
| 34 | <div><tt> # mount yaffs2 mtd@system /system</tt></div> |
| 35 | <div><tt> # mount yaffs2 mtd@system /system ro remount</tt></div> |
| 36 | <div><tt> # mount yaffs2 mtd@userdata /data nosuid nodev</tt></div> |
| 37 | <div><tt> # mount yaffs2 mtd@cache /cache nosuid nodev</tt></div> |
| 38 | <div><tt> mount ext4 /dev/block/mmcblk0p3 /system wait ro</tt></div> |
| 39 | <div><tt> mount ext4 /dev/block/mmcblk0p5 /data wait noatime nosuid nodev</tt></div> |
| 40 | <div><tt> mount ext4 /dev/block/mmcblk0p4 /cache wait noatime nosuid nodev</tt></div> |
| 41 | <p>Save the changes and repack the ramdisk image as follows:</p> |
| 42 | <p><tt>find . | cpio -o -H newc > gzip > ../newramdisk.img</tt></p> |
| 43 | <p>Boot the emulator using -ramdisk path/to/newramdisk.img -kernel path/to/goldfish_2.6_kernel</p> |