Android TV


29 posts in this topic Last Reply

Recommended Posts

Just wondering if anyone has tried getting Android TV to work in KVM.  I think I'm going to start dabbling with this, but if anyone made any good headway prior, I'd like to join their work in progress. 

 

Considering the Android SDK emulator uses qemu, I think this is possible.  Biggest concern would be vid card and infrared receiver drivers.

 

 

Link to post

Just wondering if anyone has tried getting Android TV to work in KVM.  I think I'm going to start dabbling with this, but if anyone made any good headway prior, I'd like to join their work in progress. 

 

Considering the Android SDK emulator uses qemu, I think this is possible.  Biggest concern would be vid card and infrared receiver drivers.

 

This would be REALLY tricky by pretty slick.  Android is designed for use on ARM-based processors (like smart phones / tablets).  To run an ARM-based OS on Intel-based hardware is tricky enough, and though there is ARM-support in QEMU, I think it'd be a pretty big project to get this working in a VM.  Not saying impossible, but certainly not as easy as other operating systems.

Link to post

Maybe not as difficult as it used to be since they've been releasing intel x86 system images. 

 

I know people have been using these in emulators and even to dual boot machines to get intel hardware acceleration, particularly with KVM.

 

I'm just not sure if all the pieces/versions line up.

androidtv.jpg.04ad6727f718234adb7ba65b60e9caea.jpg

Link to post

Maybe not as difficult as it used to be since they've been releasing intel x86 system images. 

 

I know people have been using these in emulators and even to dual boot machines to get intel hardware acceleration, particularly with KVM.

 

I'm just not sure if all the pieces/versions line up.

 

LINK PLEASE!!  I WANT TO TRY!!

Link to post

I started here, but I haven't seen much about Android TV.

 

http://www.android-x86.org/

 

Youtube video. Lollipop, non-tv version, but still proof of concept.

 

 

4.4 install instructions, but probably still pretty similar.

 

http://forum.xda-developers.com/showthread.php?t=2703270

 

I have qemu-img files from the Android SDK, which you can get from here.  (Also where I got the screenshot)

 

https://developer.android.com/sdk/index.html

 

I do have the Android SDK emulator running Android TV in a VM, but no google play services just cause I don't know how to integrate them.  I'm very green on this Android Developer stuff.  But I was able to get the new Emby app for Android TV working in it (minus video playback for obvious reasons).

 

I found the API 21 was running better than the API 22, so I'd probably start with API 21.

 

 

Link to post

That is pretty awesome. Would love to run an android tv intel VM. All the virtualisation work done recently by the unRAID team and forum members makes it feel like christmas morning keeps coming again and again.

Link to post

Barebones Android Lollipop 5.0.2 is running on Unraid!  No hardware passthrough or anything.

 

Here is the xml:

 

<domain type='kvm' id='57'>
  <name>Android</name>
  <uuid>fc6b55c8-b219-49c2-368d-40bdb0076cdb</uuid>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='i686' machine='pc-q35-2.1'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='yes'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/disk/samsungvms/Android/Android.img'/>
      <backingStore/>
      <target dev='hda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/cache/iso/android_x86-5.0.2.iso'/>
      <backingStore/>
      <target dev='hdc' bus='sata'/>
      <readonly/>
      <alias name='sata0-0-2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb0'/>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='sata0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:cf:91:6d'/>
      <source bridge='br0'/>
      <target dev='vnet2'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/3'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/3'>
      <source path='/dev/pts/3'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes' websocket='5700' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='vmvga' vram='16384' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
    </memballoon>
  </devices>
</domain>

 

In order for it to boot properly, I needed to remove the input devices, otherwise, I pretty much made a stock image with VMman.

    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>

 

I used the Android x86 image from here:  https://drive.google.com/file/d/0B4VR-WNTOX0qVnkyWExEZHdLTms/view

I was directed there from guides, I did not upload that.  I also had to select Raw for the HD type.

 

The "Android is upgrading # of 66 apps" took over an hour to complete, and going through initial setup is terribly slow.  Trying to create a new vm with different settings to see if it performs better.  First one I used was with 32-bit settings, as I believe it is necessary.  Secondary one is 64-bit.  Thought I'd post an update.

 

ETA:  First boot after install, make sure to select Debug mode.  It'll hang at a few spots during loading.  Type "exit" to get past it. Basically, you can't remove Mouse and Keyboard from the XML and it can't load those drivers so it hangs.  If you type "exit" after it hangs, it bypasses the driver and continues!  Android is Upgrading now on 64-bit!

androidvm.jpg.7ae33e0e79020ad4417c395c2485251a.jpg

Link to post

You could use unraid as your cell phone!

 

But really, it's more of a "cause I can" thing.  My end goal is to get Android TV working in a VM with GPU passthrough so I don't need to buy a physical Android TV.  As much as I like Kodi, the lack of official apps for it like Netflix and HBO GO/Now, really kill the WAF.  Having an Android TV with native apps for those services, plus Emby as my personal media hub and live tv would finally provide me an all-in-one front end for media conception in front of the TV. 

 

So I used Android Lollipop as a jumping off point since that seemed the easiest to prove it could work, and I'll go from there trying to get Android TV to work.

Link to post

You could use unraid as your cell phone!

 

But really, it's more of a "cause I can" thing.  My end goal is to get Android TV working in a VM with GPU passthrough so I don't need to buy a physical Android TV.  As much as I like Kodi, the lack of official apps for it like Netflix and HBO GO/Now, really kill the WAF.  Having an Android TV with native apps for those services, plus Emby as my personal media hub and live tv would finally provide me an all-in-one front end for media conception in front of the TV. 

 

So I used Android Lollipop as a jumping off point since that seemed the easiest to prove it could work, and I'll go from there trying to get Android TV to work.

Thats pretty much exactly why I want to setup an Android TV VM. Should be easier on host resources than running another Win8.1 or Win10 VM for my secondary TV room. Looking forward to future updates on your progress.

Link to post

Barebones Android Lollipop 5.0.2 is running on Unraid!  No hardware passthrough or anything.

 

Here is the xml:

 

<domain type='kvm' id='57'>
  <name>Android</name>
  <uuid>fc6b55c8-b219-49c2-368d-40bdb0076cdb</uuid>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='i686' machine='pc-q35-2.1'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='yes'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/disk/samsungvms/Android/Android.img'/>
      <backingStore/>
      <target dev='hda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/cache/iso/android_x86-5.0.2.iso'/>
      <backingStore/>
      <target dev='hdc' bus='sata'/>
      <readonly/>
      <alias name='sata0-0-2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb0'/>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='sata0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:cf:91:6d'/>
      <source bridge='br0'/>
      <target dev='vnet2'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/3'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/3'>
      <source path='/dev/pts/3'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes' websocket='5700' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='vmvga' vram='16384' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
    </memballoon>
  </devices>
</domain>

 

In order for it to boot properly, I needed to remove the input devices, otherwise, I pretty much made a stock image with VMman.

    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>

 

I used the Android x86 image from here:  https://drive.google.com/file/d/0B4VR-WNTOX0qVnkyWExEZHdLTms/view

I was directed there from guides, I did not upload that.  I also had to select Raw for the HD type.

 

The "Android is upgrading # of 66 apps" took over an hour to complete, and going through initial setup is terribly slow.  Trying to create a new vm with different settings to see if it performs better.  First one I used was with 32-bit settings, as I believe it is necessary.  Secondary one is 64-bit.  Thought I'd post an update.

 

ETA:  First boot after install, make sure to select Debug mode.  It'll hang at a few spots during loading.  Type "exit" to get past it. Basically, you can't remove Mouse and Keyboard from the XML and it can't load those drivers so it hangs.  If you type "exit" after it hangs, it bypasses the driver and continues!  Android is Upgrading now on 64-bit!

I am just about to jump in and try this out. Wondering if you or anyone else has had any success/issues passing through a GPU?

Link to post

Life got in the way.  Furthest I got was working with VNC into it.  Havne't tried hardware passthrough.  Goodluck! Hoping to try more this weekend.

 

I did it today with my GTX 780 and it worked.  Sluggish as all hell though.  Not really usable yet.  Probably driver related or something else I'm missing.  That said, it did work.  I also didn't have to do debug mode because I was passing through USB KB+Mouse.

Link to post
  • 1 year later...
Not really looked into it, but would this not be more possible to use chromeOS as the base now it can run android apps? Is androidTV just a fancy launcher which could be set to launch on boot?

Just throwing ideas out there, not sure if its any help!

 

I dont think that android tv is just launcher

I did try to setup android as a linux but did not work

And i did try to setup remix os as a linux but did not pass the boot logo

Do you setup android as vm on unraid ? if yes maybe you can help me to setup mine

 

Link to post
  • 1 year later...
  • 10 months later...
  • 2 months later...
On 7/24/2018 at 6:07 PM, bnevets27 said:

Anymore info or details? Trying to get Android-x86_64-8.1-rc1.iso installed. I can get it to boot the menu and do through the install on local disk but it hangs at booting. I tried just running it live but it just loads to a black screen.

 

https://osdn.net/projects/android-x86/releases/69704

 

Forewarning: I don't know if this is the best way, but this is how I got it running.

 

I downloaded the 64bit VMDK from here:  https://www.osboxes.org/android-x86/#android-x86-8-vmware

 

image.png.df1872f3d12d83c755a7c0a486e0a6e9.png

 

I then extracted the VMDK, moved it to my domains folder and converted it through Terminal:

 

qemu-img convert -f vmdk /mnt/user/domains/Android/Android-x86_8.1.vmdk -O qcow2 /mnt/user/domains/Android/Android-x86_8.1.qcow2

sudo qemu-img resize /mnt/user/domains/Android/Android-x86_8.1.qcow2 +20G

 

I set up the VM as a Win7 box with the following settings:

 

image.thumb.png.02b9abeaac9e44fd90c16977abb5ce4e.png

 

The Primary vDisk Location points to the above /mnt/user/domains/Android/Android-x86_8.1.qcow2

 

image.thumb.png.83c940c7aca6bf40b427b6f7eef317c5.png

 

Again, not really sure if this is the best way.  I just applied what I learned installing HASS.io to a VM to this.

 

Mouse control in noVNC is still a pain.  I'm still trying to find something else I can use to control it.  You can navigate with the keyboard pretty well using the commands found here: http://paperlined.org/apps/android/hardware_keyboard.html

 

 

Link to post

Thanks kimocal! I got android installed by following your instructions. At first I accidently tried with 64bit and it wouldn't boot. Tried 32bit and it worked.

 

Navigation is a pain that's for sure so if anyone figures it out please report back. So for I've figured out you can see and move the cursor when clicking the left button but that does cause havoc.

 

After finding out 64bit didn't work with you instructions I went back and tried to install android-x86-8.1-rc2.iso from this iso:

https://osdn.net/projects/android-x86/releases/69704

 

I was able to use that iso is the install media, and install it to a vdisk. It boots and works the same. Except it seems I can't sign into google play store.

 

The main reason I wanted this was to use tunein radio to record a radio show but unfortunately tunein thinks there is no network connection. Can't seem to figure out why.

Edited by bnevets27
Link to post

The 64 bit VMDK worked for me as well as the internet & Play Store.  I was interested in running TinyCAM Pro to act as a web server for my WyzeCam on the Android VM.  After playing around with it though I didn't want to allocate the RAM and CPU resources for one program.  

Link to post

Yeah I don't know why the 64bit doesn't work for me.

Both VMs I do have internet, YouTube/chrome work. But tunein says it's offline so it's thinks there is no internet but there is. I have an feeling (with no evidence at all) that tunein is not seeing the app on a device it suspects and is preventing accessing the Internet. Which is really annoying.

The play store works fine in the image you used. It doesn't work however from the iso I tried for my other VM.

Unfortunately I haven't found many options to record streaming audio via a docker container. And I didn't want a full fledged win or Linux VM. And tunein is setup to record on a schedule which I want.


Link to post
  • 4 weeks later...

I got it working without any VMDK conversion on libvirt using QEMU 2.12 and q35/i440FX chipsets. 

 

Since the android 8.1 x64 rc2 is built with kernel 4.18, I decided to pass in a physical Nvidia GPU, GTX 970, this works for a little bit then the VM just freezes completely or reboots.

 

It would be nice to have this working with hardware decoding support, could serve as a very nice media player.

Link to post
  • 3 months later...

THANK ALL OF YOU!!! 

I got both Hass.io and Android x86 running in VMs thanks to this thread. I needed Android to host Tinycam Pro to feed my Wyze cams to Hass.  Mouse movements in the Android VM were a pain so it took some effort to get Tinycam setup but now that its set I am just going to leave the VM alone and I shouldn't have to touch it again for a while (hopefully).

Side note.. I think the Android VM might be easier to control if I could find a good remote desktop app for it.

Thx again. I couldn't have done it without this thread. 

Edited by BrBybee
Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.