UTM icon indicating copy to clipboard operation
UTM copied to clipboard

Add Android Go VM to UTM Gallery

Open samarthkharbanda opened this issue 4 years ago • 11 comments

Can we use android go version for android on iPadOS? Or some custom rom like lineages os ? That require less than 2gb ram as that the max ram we can allot to android vm running on iPadOS.

Kindly add support images for Android Go Lineage OS

As android 9 images is currently stuck on bootloop

Also some useful links: https://www.androidpolice.com/2020/07/22/new-devices-with-2gb-of-ram-or-less-must-run-android-go-according-to-leaked-documents/amp/

https://www.android-x86.org

samarthkharbanda avatar Dec 22 '21 03:12 samarthkharbanda

I believe your questions are:

  1. Can we use Android Go in UTM on iPadOS?
  2. Can we use LineageOS in UTM on iPadOS?

I believe that it requires a custom boot loader and firmware image to be supplied, then maybe the ARM version of Android (or LineageOS) could run in UTM (slowly due to emulation). Androidx86 should work in UTM, however on iPad it will also be slow.

I will close this as "wont fix" because the topic has come up many times and no-one has been able to get an ARM version of Android working.

conath avatar Dec 25 '21 20:12 conath

I believe your questions are:

  1. Can we use Android Go in UTM on iPadOS?
  2. Can we use LineageOS in UTM on iPadOS?

I believe that it requires a custom boot loader and firmware image to be supplied, then maybe the ARM version of Android (or LineageOS) could run in UTM (slowly due to emulation). Androidx86 should work in UTM, however on iPad it will also be slow.

> I will close this as "wont fix" because the topic has come up many times and no-one has been able to get an ARM version of Android working.

And that's exactly why he referenced the Android-X86 Project at the end. He means support for any custom light roms, which there are tons.

V6ser avatar Jan 20 '22 01:01 V6ser

It’s been tried and nobody got it working well. Android (even x86 android) depends heavily on gpu acceleration.

osy avatar Jan 20 '22 02:01 osy

The Android ARM image in the Android developer app runs great on Apple M1 machines, and uses qemu to do it. I could be wrong, but it might not take much reverse-engineering to duplicate whatever qemu config is being used there.

jlg89 avatar Apr 10 '22 19:04 jlg89

Screen Shot showing QEMU in the title bar while running android emulator on macOS

Indeed. 🤔 (this is running the "Android Emulator" binary with the name of a specific device passed.

Emulator path: ~/Library/Android/sdk/emulator/emulator Data path: ~/.android/avd/<Virtual Device Name>.avd/

conath avatar Apr 10 '22 20:04 conath

Did some digging. The QEMU used in my copy of the Android Emulator (might be some months old) reports itself as 2.12.0 from 2018. This can be verified by running:

~/Library/Android/sdk/emulator/emulator -qemu -h

Generally you supposedly can pass the -qemu parameter to the emulator and everything after that will be passed along to the QEMU it launches. I tried to pass the -qemu -D ~/Desktop/avd.txt parameter to enable QEMU log but it does not create the log file. I believe the emulator program only accepts overriding QEMU parameters it uses itself (like -kernel).

Interestingly, this seems to be added to the QEMU help output:

-android-ports <consoleport>,<adbport> TCP ports used for the emulator instance and adb bridge
-android-wifi-client-port <client port> TCP port used to connect to another emulator running as a WiFi server.
 This allows WiFi traffic to pass between two emulators, one acting as a
 client and one as a server. The decision which is the server and which
 is the client does not affect WiFi functionality
-android-wifi-server-port <server port> TCP port to listen on that another emulator can connect to as a WiFi
 client. This allows WiFi traffic to pass between two emulators, one
 acting as a client and one as a server. The decision which is the
 server and which is the client does not affect WiFi functionality
-android-report-console <socket> report console port to remote socket
-dns-server <servers> use this DNS server(s) in the emulated system
-android-hw <file>
                specify the hw config ini file location
-skip-adb-auth  skip adb authentication dialogue
-timezone <timezone> use this timezone instead of host's default
-net-tap <tap interface> use the provided TAP interface for networking
-net-tap-script-up <script> script to run when TAP interface goes up
-net-tap-script-down <script> script to run when TAP interface goes down
-mem-file-shared (use with -mem-path) initializes RAM backing file (specified in -mem-path) as a shared mapping
-read-only mark the session as read-only and abandon all snapshot or any disk changes at exit.
-fuchsia Fuchsia kernel/image run. Only standard QEMU options are allowed after, and emulator does not start Android virtual devices automatically.-allow-host-audio Allows sending of audio from audio input devices. Otherwise, zeroes out audio.-restart-when-stalled Allows restarting guest when it is stalled.-perf-stat <file> Run periodic perf stat reporter in the background and write output to specified file.-multidisplay config a number of (MAX 3) multidisplays-google-maps-key Provide an API key to use with Google maps GUI-no-location-ui Disables the location UI in the extended window-record-session Screen record the emulator session-legacy-fake-camera emulates fake camera by legacy camera HAL-crostini Turn on optimizations for running in a VM on Chrome OS-wear-auto-forward automatically forward tcp:5601 on the host to tcp:5601 on a connected phone if a connected virtual watch is detected.
During emulation, the following keys are useful:
ctrl-alt-f      toggle full screen
ctrl-alt-n      switch to virtual console 'n'
ctrl-alt        toggle mouse and keyboard grab

From looking at the open source licenses, it appears both MoltenVK and/or SwiftShader are used to enable 3D graphics.

And the following is found in the emulator binary, probably from the disk images help page:

  The emulator needs several key image files to run appropriately.
  Their exact location depends on whether you're using the emulator
  from the Android SDK, or not (more details below).
  The minimal required image files are the following:
    kernel-qemu      the emulator-specific Linux kernel image
    ramdisk.img      the ramdisk image used to boot the system
    system.img       the *initial* system image
    vendor.img       the *initial* vendor image
    userdata.img     the *initial* data partition image
  It will also use the following writable image files:
    userdata-qemu.img  the persistent data partition image
    system-qemu.img    an *optional* persistent system image
    vendor-qemu.img    an *optional* persistent vendor image
    cache.img          an *optional* cache partition image
    sdcard.img         an *optional* SD Card partition image
    snapshots.img      an *optional* state snapshots image
  If you use a virtual device, its content directory should store
  all writable images, and read-only ones will be found from the
  corresponding platform/add-on directories. See -help-sdk-images
  for more details.

Further down the strings, I found this series of what looks like it might be QEMU parameters.

autoconfig: -sysdir %s
-image
autoconfig: -system %s
-vendor
autoconfig: -vendor %s
-kernel
autoconfig: -kernel %s
-ramdisk
autoconfig: -ramdisk %s
autoconfig: -datadir %s
%s/userdata-qemu.img

Shortly after, some CPU models (but they are 32 bit):

qemu32
Auto-config: -qemu -cpu %s
cortex-a8
mips32r6-generic
P5600

Finally, there are references in the strings to "Mac Camera capture" but I did not find such feature in the actual running emulator or its settings. The module name might be com.google.goldfish.mac.camera.capture.

Unfortunately, my reverse engineering skills don't go further than strings. I wasn't able to use UTM to boot the Android Emulator files (~/Library/Android/sdk/system-images/android-32/google_apis/arm64-v8a/). I've attached the output of a "get open files and ports" from Activity Monitor as well as the strings run on the emulator binary:

emulator-avd-strings.txt emulator-avd-open-files-and-ports.txt

conath avatar Apr 10 '22 21:04 conath

I'm running Android Studio 2021.1 on an M1 MacBook Pro. I've set up a Pixel 2 API 31 virtual device, Android 12.0, arm64, with Google Play. Looks like it's using qemu 2.25202.12.0. I'd be happy to provide whatever image files would be useful out of this setup.

Contents of the hardware-qemu.ini file:

hw.cpu.arch = arm64
hw.cpu.ncore = 4
hw.ramSize = 2048
hw.screen = multi-touch
hw.mainKeys = false
hw.trackBall = false
hw.keyboard = true
hw.keyboard.lid = false
hw.keyboard.charmap = qwerty2
hw.dPad = false
hw.rotaryInput = false
hw.gsmModem = true
hw.gps = true
hw.battery = true
hw.accelerometer = true
hw.gyroscope = true
hw.audioInput = true
hw.audioOutput = true
hw.sdCard = true
disk.cachePartition = true
disk.cachePartition.path = /Users/jon/.android/avd/Pixel_2_API_31.avd/cache.img
disk.cachePartition.size = 66m
test.quitAfterBootTimeOut = -1
test.delayAdbTillBootComplete = 0
test.monitorAdb = 0
hw.lcd.width = 1080
hw.lcd.height = 1920
hw.lcd.depth = 16
hw.lcd.density = 420
hw.lcd.backlight = true
hw.lcd.vsync = 60
hw.gltransport = pipe
hw.gltransport.asg.writeBufferSize = 1048576
hw.gltransport.asg.writeStepSize = 4096
hw.gltransport.asg.dataRingSize = 32768
hw.gltransport.drawFlushInterval = 800
hw.displayRegion.0.1.xOffset = -1
hw.displayRegion.0.1.yOffset = -1
hw.displayRegion.0.1.width = 0
hw.displayRegion.0.1.height = 0
hw.displayRegion.0.2.xOffset = -1
hw.displayRegion.0.2.yOffset = -1
hw.displayRegion.0.2.width = 0
hw.displayRegion.0.2.height = 0
hw.displayRegion.0.3.xOffset = -1
hw.displayRegion.0.3.yOffset = -1
hw.displayRegion.0.3.width = 0
hw.displayRegion.0.3.height = 0
hw.display1.width = 0
hw.display1.height = 0
hw.display1.density = 0
hw.display1.xOffset = -1
hw.display1.yOffset = -1
hw.display1.flag = 0
hw.display2.width = 0
hw.display2.height = 0
hw.display2.density = 0
hw.display2.xOffset = -1
hw.display2.yOffset = -1
hw.display2.flag = 0
hw.display3.width = 0
hw.display3.height = 0
hw.display3.density = 0
hw.display3.xOffset = -1
hw.display3.yOffset = -1
hw.display3.flag = 0
hw.gpu.enabled = true
hw.gpu.mode = host
hw.initialOrientation = Portrait
hw.camera.back = virtualscene
hw.camera.front = emulated
vm.heapSize = 512
hw.sensors.light = true
hw.sensors.pressure = true
hw.sensors.humidity = true
hw.sensors.proximity = true
hw.sensors.magnetic_field = true
hw.sensors.magnetic_field_uncalibrated = true
hw.sensors.gyroscope_uncalibrated = true
hw.sensors.orientation = true
hw.sensors.temperature = true
hw.sensor.hinge = true
hw.sensor.hinge.count = 0
hw.sensor.hinge.type = 0
hw.sensor.hinge.sub_type = 0
hw.sensor.hinge.fold_to_displayRegion.0.1_at_posture = 1
hw.sensor.roll = false
hw.sensor.roll.count = 0
hw.sensor.roll.resize_to_displayRegion.0.1_at_posture = 6
hw.sensor.roll.resize_to_displayRegion.0.2_at_posture = 6
hw.sensor.roll.resize_to_displayRegion.0.3_at_posture = 6
hw.sensors.heart_rate = false
hw.useext4 = true
hw.arc = false
hw.arc.autologin = false
kernel.path = /Users/jon/Library/Android/sdk/system-images/android-31/google_apis_playstore/arm64-v8a//kernel-ranchu
kernel.newDeviceNaming = yes
kernel.supportsYaffs2 = no
disk.ramdisk.path = /Users/jon/Library/Android/sdk/system-images/android-31/google_apis_playstore/arm64-v8a//ramdisk.img
disk.systemPartition.initPath = /Users/jon/Library/Android/sdk/system-images/android-31/google_apis_playstore/arm64-v8a//system.img
disk.systemPartition.size = 2619m
disk.vendorPartition.initPath = /Users/jon/Library/Android/sdk/system-images/android-31/google_apis_playstore/arm64-v8a//vendor.img
disk.vendorPartition.size = 800m
disk.dataPartition.path = /Users/jon/.android/avd/Pixel_2_API_31.avd/userdata-qemu.img
disk.dataPartition.size = 6g
disk.encryptionKeyPartition.path = /Users/jon/.android/avd/Pixel_2_API_31.avd/encryptionkey.img
PlayStore.enabled = true
avd.name = Pixel_2_API_31
avd.id = Pixel_2_API_31
fastboot.forceColdBoot = false
android.sdk.root = /Users/jon/Library/Android/sdk
android.avd.home = /Users/jon/.android/avd

Directory listing of the AVD subdirectory:

% ls -sla
total 13780152
       0 drwxr-xr-x  23 jon  staff         736 Apr 11 10:58 .
       0 drwxr-xr-x   5 jon  staff         160 Dec 21 13:46 ..
       8 -rw-r--r--   1 jon  staff         146 Apr 11 10:58 AVD.conf
   10432 -rw-r--r--   1 jon  staff    69206016 Dec 21 13:45 cache.img
     648 -rw-r--r--   1 jon  staff      327749 Mar 26 11:03 cache.img.qcow2
       8 -rw-r--r--   1 jon  staff        1255 Dec 21 13:45 config.ini
       0 drwxr-xr-x   3 jon  staff          96 Feb 11 19:22 data
       8 -rw-r--r--   1 jon  staff         140 Apr 11 10:57 emu-launch-params.txt
       8 -rw-r--r--   1 jon  staff          50 Apr 11 10:58 emulator-user.ini
   36864 -rw-r--r--   1 jon  staff    18874368 Dec 21 13:45 encryptionkey.img
  415744 -rw-r--r--   1 jon  staff   212860928 Apr 11 10:57 encryptionkey.img.qcow2
       8 -rw-r--r--@  1 jon  staff        3672 Apr 11 10:57 hardware-qemu.ini
    8320 -rw-r--r--   1 jon  staff     4018924 Apr 11 10:57 initrd
       0 drwxr-xr-x   6 jon  staff         192 Dec 21 13:46 modem_simulator
       0 -rw-r--r--   1 jon  staff           0 Apr 11 10:57 multiinstance.lock
       0 -rw-r--r--   1 jon  staff           0 Apr 11 10:57 read-snapshot.txt
 1048576 -rw-r--r--   1 jon  staff   536870912 Dec 21 13:45 sdcard.img
       0 drwxr-xr-x   2 jon  staff          64 Mar 26 11:03 snapshots
       0 drwxr-xr-x   7 jon  staff         224 Apr 11 10:58 tmpAdbCmds
  205760 -rw-r--r--   1 jon  staff  6442450944 Dec 21 13:45 userdata-qemu.img
12051712 -rw-r--r--   1 jon  staff  6153961472 Apr 11 10:58 userdata-qemu.img.qcow2
    2048 -rw-r--r--   1 jon  staff     1048576 Dec  9 15:10 userdata.img
       8 -rw-r--r--   1 jon  staff           8 Dec 21 13:45 version_num.cache

jlg89 avatar Apr 11 '22 16:04 jlg89

hate to necropost but @jlg89 the android developer website says that the qemu version they use is downstream with a couple of modifications so i dont know if it's possible to actually boot into that image without said modifications

rullinoiz avatar Feb 13 '23 20:02 rullinoiz

I'm running Android Studio 2021.1 on an M1 MacBook Pro. I've set up a Pixel 2 API 31 virtual device, Android 12.0, arm64, with Google Play. Looks like it's using qemu 2.25202.12.0. I'd be happy to provide whatever image files would be useful out of this setup.

Contents of the hardware-qemu.ini file:

hw.cpu.arch = arm64
hw.cpu.ncore = 4
hw.ramSize = 2048
hw.screen = multi-touch
hw.mainKeys = false
hw.trackBall = false
hw.keyboard = true
hw.keyboard.lid = false
hw.keyboard.charmap = qwerty2
hw.dPad = false
hw.rotaryInput = false
hw.gsmModem = true
hw.gps = true
hw.battery = true
hw.accelerometer = true
hw.gyroscope = true
hw.audioInput = true
hw.audioOutput = true
hw.sdCard = true
disk.cachePartition = true
disk.cachePartition.path = /Users/jon/.android/avd/Pixel_2_API_31.avd/cache.img
disk.cachePartition.size = 66m
test.quitAfterBootTimeOut = -1
test.delayAdbTillBootComplete = 0
test.monitorAdb = 0
hw.lcd.width = 1080
hw.lcd.height = 1920
hw.lcd.depth = 16
hw.lcd.density = 420
hw.lcd.backlight = true
hw.lcd.vsync = 60
hw.gltransport = pipe
hw.gltransport.asg.writeBufferSize = 1048576
hw.gltransport.asg.writeStepSize = 4096
hw.gltransport.asg.dataRingSize = 32768
hw.gltransport.drawFlushInterval = 800
hw.displayRegion.0.1.xOffset = -1
hw.displayRegion.0.1.yOffset = -1
hw.displayRegion.0.1.width = 0
hw.displayRegion.0.1.height = 0
hw.displayRegion.0.2.xOffset = -1
hw.displayRegion.0.2.yOffset = -1
hw.displayRegion.0.2.width = 0
hw.displayRegion.0.2.height = 0
hw.displayRegion.0.3.xOffset = -1
hw.displayRegion.0.3.yOffset = -1
hw.displayRegion.0.3.width = 0
hw.displayRegion.0.3.height = 0
hw.display1.width = 0
hw.display1.height = 0
hw.display1.density = 0
hw.display1.xOffset = -1
hw.display1.yOffset = -1
hw.display1.flag = 0
hw.display2.width = 0
hw.display2.height = 0
hw.display2.density = 0
hw.display2.xOffset = -1
hw.display2.yOffset = -1
hw.display2.flag = 0
hw.display3.width = 0
hw.display3.height = 0
hw.display3.density = 0
hw.display3.xOffset = -1
hw.display3.yOffset = -1
hw.display3.flag = 0
hw.gpu.enabled = true
hw.gpu.mode = host
hw.initialOrientation = Portrait
hw.camera.back = virtualscene
hw.camera.front = emulated
vm.heapSize = 512
hw.sensors.light = true
hw.sensors.pressure = true
hw.sensors.humidity = true
hw.sensors.proximity = true
hw.sensors.magnetic_field = true
hw.sensors.magnetic_field_uncalibrated = true
hw.sensors.gyroscope_uncalibrated = true
hw.sensors.orientation = true
hw.sensors.temperature = true
hw.sensor.hinge = true
hw.sensor.hinge.count = 0
hw.sensor.hinge.type = 0
hw.sensor.hinge.sub_type = 0
hw.sensor.hinge.fold_to_displayRegion.0.1_at_posture = 1
hw.sensor.roll = false
hw.sensor.roll.count = 0
hw.sensor.roll.resize_to_displayRegion.0.1_at_posture = 6
hw.sensor.roll.resize_to_displayRegion.0.2_at_posture = 6
hw.sensor.roll.resize_to_displayRegion.0.3_at_posture = 6
hw.sensors.heart_rate = false
hw.useext4 = true
hw.arc = false
hw.arc.autologin = false
kernel.path = /Users/jon/Library/Android/sdk/system-images/android-31/google_apis_playstore/arm64-v8a//kernel-ranchu
kernel.newDeviceNaming = yes
kernel.supportsYaffs2 = no
disk.ramdisk.path = /Users/jon/Library/Android/sdk/system-images/android-31/google_apis_playstore/arm64-v8a//ramdisk.img
disk.systemPartition.initPath = /Users/jon/Library/Android/sdk/system-images/android-31/google_apis_playstore/arm64-v8a//system.img
disk.systemPartition.size = 2619m
disk.vendorPartition.initPath = /Users/jon/Library/Android/sdk/system-images/android-31/google_apis_playstore/arm64-v8a//vendor.img
disk.vendorPartition.size = 800m
disk.dataPartition.path = /Users/jon/.android/avd/Pixel_2_API_31.avd/userdata-qemu.img
disk.dataPartition.size = 6g
disk.encryptionKeyPartition.path = /Users/jon/.android/avd/Pixel_2_API_31.avd/encryptionkey.img
PlayStore.enabled = true
avd.name = Pixel_2_API_31
avd.id = Pixel_2_API_31
fastboot.forceColdBoot = false
android.sdk.root = /Users/jon/Library/Android/sdk
android.avd.home = /Users/jon/.android/avd

Directory listing of the AVD subdirectory:

% ls -sla
total 13780152
       0 drwxr-xr-x  23 jon  staff         736 Apr 11 10:58 .
       0 drwxr-xr-x   5 jon  staff         160 Dec 21 13:46 ..
       8 -rw-r--r--   1 jon  staff         146 Apr 11 10:58 AVD.conf
   10432 -rw-r--r--   1 jon  staff    69206016 Dec 21 13:45 cache.img
     648 -rw-r--r--   1 jon  staff      327749 Mar 26 11:03 cache.img.qcow2
       8 -rw-r--r--   1 jon  staff        1255 Dec 21 13:45 config.ini
       0 drwxr-xr-x   3 jon  staff          96 Feb 11 19:22 data
       8 -rw-r--r--   1 jon  staff         140 Apr 11 10:57 emu-launch-params.txt
       8 -rw-r--r--   1 jon  staff          50 Apr 11 10:58 emulator-user.ini
   36864 -rw-r--r--   1 jon  staff    18874368 Dec 21 13:45 encryptionkey.img
  415744 -rw-r--r--   1 jon  staff   212860928 Apr 11 10:57 encryptionkey.img.qcow2
       8 -rw-r--r--@  1 jon  staff        3672 Apr 11 10:57 hardware-qemu.ini
    8320 -rw-r--r--   1 jon  staff     4018924 Apr 11 10:57 initrd
       0 drwxr-xr-x   6 jon  staff         192 Dec 21 13:46 modem_simulator
       0 -rw-r--r--   1 jon  staff           0 Apr 11 10:57 multiinstance.lock
       0 -rw-r--r--   1 jon  staff           0 Apr 11 10:57 read-snapshot.txt
 1048576 -rw-r--r--   1 jon  staff   536870912 Dec 21 13:45 sdcard.img
       0 drwxr-xr-x   2 jon  staff          64 Mar 26 11:03 snapshots
       0 drwxr-xr-x   7 jon  staff         224 Apr 11 10:58 tmpAdbCmds
  205760 -rw-r--r--   1 jon  staff  6442450944 Dec 21 13:45 userdata-qemu.img
12051712 -rw-r--r--   1 jon  staff  6153961472 Apr 11 10:58 userdata-qemu.img.qcow2
    2048 -rw-r--r--   1 jon  staff     1048576 Dec  9 15:10 userdata.img
       8 -rw-r--r--   1 jon  staff           8 Dec 21 13:45 version_num.cache

Are there also Android Go images? Because the regular android has the limitation of requiring at least 2GB of RAM, thus cannot run on iOS where apps cannot allocate so much memory (from my understanding).

piereligio avatar Jun 05 '23 10:06 piereligio

I follow the lineageOS official wiki (https://wiki.lineageos.org/utm-vm-on-apple-silicon-mac) and build a 64bit only image for UTM. Anyone who is interested in this can download it directly. download link: https://drive.google.com/file/d/17oK9tk3mZQvep8hh71YvyjXxmi3TUdHX/view?usp=sharing The desktop runs smoothly, but can't play video and play games.

DapengWei avatar Apr 04 '25 15:04 DapengWei

I follow the lineageOS official wiki (https://wiki.lineageos.org/utm-vm-on-apple-silicon-mac) and build a 64bit only image for UTM. Anyone who is interested in this can download it directly. download link: https://drive.google.com/file/d/17oK9tk3mZQvep8hh71YvyjXxmi3TUdHX/view?usp=sharing The desktop runs smoothly, but can't play video and play games.

Doesn't work on iPad with Jit (crashed while booting)

brawlmodlol avatar May 07 '25 18:05 brawlmodlol