Hacking an Android TV stick, the sequel

jeremy@rk3066:~$ uname -a
Linux rk3066 3.0.36-rt58 #1 SMP PREEMPT RT Thu Jul 4 13:18:23 CEST
2013 armv7l GNU/Linux

Managed to compile and run a real-time kernel on the Android TV stick with the RK3066 SoC. Packaged the latest version of amSynth (1.4.0 which has been released recently), installed it, fired up JACK and amSynth and so far no xruns, nothing. And this is with -p64!

jackd -P84 -p32 -t2000 -dalsa -dhw:Device -n3 -p64 -r44100 -s -P

I should measure the latency of the $2 USB audio interface I’m using to find out what the total latency of this set-up is. Well, at least I got the system latency for usage with softsynths like amSynth down to 64/44100*2=3ms. Now that’s a usable situation.

jeremy@rk3066:~$ lsusb | grep -i c-media
Bus 002 Device 006: ID 0d8c:000e C-Media Electronics, Inc. Audio Adapter (Planet
UP-100, Genius G-Talk)
jeremy@rk3066:~$ cat /proc/asound/cards 0 [RK29RK1000 ]: RK29_RK1000 - RK29_RK1000 RK29_RK1000 1 [HDMI ]: ROCKCHIP_HDMI - ROCKCHIP HDMI ROCKCHIP HDMI 2 [Device ]: USB-Audio - Generic USB Audio Device Generic USB Audio Device at usb-usb20_host-1.1, full speed

A big pro of this stick is that it suffers less from SD card corruption than my RPi. Yesterday evening I wrecked up yet another SD card when testing my RPi with a real-time kernel, it’s getting a bit cumbersome. Speaking of real-time kernels, it was quite some work to apply the RT patchset to the RockChip kernel source. Had to add stuff by hand and when I finally got everything in place it wouldn’t compile. But I managed to solve all the build errors. After flashing the kernel image the TV stick wouldn’t boot of course, it hung at some point. But I quickly saw that the issue was with the SD card reader and that it was similar to the SD card reader issue on the RPi for which I found a workaround. So I added an #ifdef clause to the RockChip SD card reader driver, recompiled, reflashed and wham, it continued booting. Now I have to clean up my build directory and get a usable diff of it against the pristine RK3066 kernel sources.

Hacking an Android TV stick, the sequel

More ARM goodies

Bought another Android TV stick based on the RK3066 SoC, the MK808 which is as far as I’ve understood kind of the default board to hack on.


MK808 Android TV stick

Also bought a BeagleBone Black development board. Why? Because apparently JACK runs well on it, also with USB interfaces (no need for the ALSA softmode option!) so I assume the USB implementation is better than those of the Raspberry Pi and the RK3066 based board I currently own. And I could get it cheaper over here in The Netherlands than other viable alternatives like the pcDuino or Cubieboard, also because of a coupon code I found on tweakers.net so I got a price reduction of a few Euros. Another reason why I bought it are the so-called capes that are available for this board. These capes are basically add-on boards and the cape that has my most attention is the audio cape. I’m thinking about buying that specific cape, solder two Neutriks on the audio in and out and turn it into the easiest DIY guitar effect box ever. Of course with guitarix loaded on it, the devs have done an incredible amount of work recently to get guitarix running flawlessly and painlessly on ARM dev boards like the BeagleBone Black.


BeagleBone Black


BeagleBone Audio Cape

More ARM goodies

Bricking the UG802 Android TV stick

Pulled out my soldering iron, soldered a reset button and a switch to boot into recovery on the PCB and connected my UG802 clone/revision to my TV. Nothing. lsusb. Crap, it boots in flash mode. Let’s try reflashing the whole bloody thing. Well that works so the NAND is not defective or anything. Reboot. Nothing, lsusb still reports the device is in flash mode. So I removed all my soldering efforts which I really regretted because it was quite nicely done given my poor soldering skills and tried again. Still nothing. Arrrggghhhh. Enjoyed a cold Warsteiner and let it rest.

Today I brought the device with me to the office. Hooked it up to a Windows machine, ran the ROM flash tool from Finless’ custom ROM package for this device and powered it up. I was greeted with the most ugly Android boot animation I had ever seen. But at least the device works again so thanks Finless!

So now I can move on again. I had Jack1 running on it so it should be possible to turn this device into a very cheap, yet powerful alternative to do real-time, low-latency audio. Compared to the Raspberry Pi JACK already consumed way less CPU (12% on the RPi compared to 2% on the RK3066 device with the same JACK settings) and I noticed the device has some more IRQ’s so if I could get all of those threaded that should give me some more flexibility to get everything working in a more stable way. I did have to disable WiFi otherwise the whole USB stack crashed after starting JACK. Also tried with an external WiFi dongle, same issue. I can even generate xruns when pressing keys on an attached keyboard. So it’d be really nice if I had serial console access to this thing. But I’ll figure that out too. And maybe the USB part of the kernel can be tweaked to improve things on the USB level.

Bricking the UG802 Android TV stick

Hacking the UG802 Android TV stick

Lucky me. Brought the Android TV stick with me to work after I got it in the mail. Showed it to my boss and he immediately ordered one too, not a UG802 though but a RK3188 based device. The RK3188 is a quad core ARM CPU while the UG802 comes with a RK3066 dual core CPU. The goal is to hack this RK3188 based device to see if it can be used for one of the projects we’re working on. Only very recently (about two weeks ago) the kernel source has been released and people managed to run Linux on it just a few days ago. Can’t wait to hack it. During working hours. Awesome.

Unlucky me. Apparently the TV stick I purchased is some kind of UG802 revision or clone. Very confusing. But I can boot Linux on it as it’s a RK3066 based device so I’m ok. I think I’ll order another TV stick but then one with better community support, like the MK808.

Unlike the RK3188 based devices the RK3066 based devices have been available a while longer so there is quite some useful information available on how to get Linux running on it. First thing is to get a Linux kernel on it that allows you to boot into a Linux rootfs that resides on a MicroSD card. For the Linux rootfs I’ve chosen to use Debian Wheezy. For the kernel I used Galland’s concise yet effective howto. All the details on how I set up the TV stick in order to boot it with Linux can be found on the Installing Linux on a RK3066 based device page.

Hacking the UG802 Android TV stick

More DX goodies!

Just in, a Beitai SNT-D06 mini PC which set me back a whopping €33,-! What do you get for this price:

Chipset Rockchip RK3066
CPU CORTEX-A9
Processor Frequency 1.2GHz
GPU Mali 400
Memory DDR3 1GB
Storage 4GB
Wi-Fi IEEE 802.11b/g/n
Video Output HDMI
Audio Output HDMI
Other Interface

1 x USB host, 1 x Mini USB port, 1 x TF card slot

Let’s see if we can get Picuntu running on it and turn this baby into a Raspberry Pi killer.

Edit: I could’ve just bought an UG802 but at least I got it with an EU adapter. Other than that the device seems exactly the same. Debian Wheezy runs like a charm on it. More on that later.

More DX goodies!

Het Karmische Koalabeertje

Omdat de Nvidia drivers of Compiz niet lekker werkten onder 9.04 op mijn notebook heb ik er gisteren maar 9.10 op gezet. En tot nu toe draait het lekker! En het start ook nog eens allemaal zo’n 15 seconden sneller op. Kan volgens mij nog sneller, het opstarten van mijn notebook blijft namelijk even hangen op een bug:

[    3.240007] pci 0000:00:1a.7: EHCI: BIOS handoff failed (BIOS bug?) 01010001
[    5.240007] pci 0000:00:1d.7: EHCI: BIOS handoff failed (BIOS bug?) 01010001

Onder 9.04 bleef de boel hier veel langer op hangen, een seconde of 8, en dat is dus teruggebracht naar 2 seconden. Zou dan toch deze patch in de Karmic kernel zitten?1 Dat zou betekenen dat het nog sneller kan. Wat me verder opviel na de installatie was dat er een hoop icoontjes misten nadat ik de Tango icoontjes had geïnstalleerd. Bleek dat onder System – Preferences – Appearance – Interface – Show icons in menus stond uitgevinkt. Ook moest ik even wennen aan de nieuwere Gnome-Do, zat te zoeken naar de optie dat Gnome-Do altijd het bovenste venster is maar dat is voor het Docky theme vervangen door “intellihide”. Werkt best lekker. Ook kreeg ik Guake niet lekker draaiende, druk je op F12 en verschijnt dat ding op de onderste helft van het scherm terwijl ik het bovenin wil hebben. Dit heb ik op kunnen lossen met de Place Windows plugin van Compiz. En ik vind FF 3.5 best traag, maar daar schijn je een add-on voor te hebben. FF doet er nogal lang over om URL’s te resolven, geen idee waarom dat zo veel langer moet duren dan met 3.0.x.2 Voor de rest ben ik geen rare dingen tegengekomen, ziet er allemaal goed uit en vooralsnog draait het prima. Ben benieuwd hoe het beertje zich houdt als hij de nodige data van externe geluidskaarten en MIDI controllers te verstouwen krijgt en daar tegelijkertijd ook nog eens wat mee moet gaan doen.

1 Heb de ehci_ho_to parameter inmiddels getest maar die doet niks dus waarschijnlijk is de Karmic kernel niet voorzien van deze patch.
2 Kan aan ipv6 instellingen liggen. En FF3.5 kun je nog het nodige tweaken.

Het Karmische Koalabeertje