Tuesday, June 10, 2014

Minix Neo X8H HW tinkering first impressions

I just got my hands on a Minix Neo X8-H TV Box, along with an M1 airmouse, courtesy of Minix, with the aim of porting Linux to it (Amlogic Quad-Core processor this time).


First impressions


I won't bother you with the specs, which you can review at Minix' X8-H product page. However, from a subjective point of view I can say Android 4.4 Kitkat feels pretty fast and stable and, despite the youth of this processor, I haven't run into any problems while using it.

However nobody should be surprised here, since Minix was the one that honestly repudiated releasing for its devices the embarrassingly fake "Android Kitkat Betas" that plagged chinese Rockchip sticks at the beginning of this year.


One thing that I found immature though was the H/W video decoding, since using MX Player I was absolutely unable to avoid seeing the subtitles in MKV movies, no matter how many forced/unforced subtitles checkmarks I removed. This does not happen when using a Rockchip TV box, so a newer Amlogic firmware should have to fix this.


The M1 airmouse is small, looks slick, and has an accurate response, I really like it.

However, when I removed the USB receiver from the X8-H, I found myself with the plastic cap in one hand and the electronic PCB still connected to the USB port... so better handle it with care.




The serial console


That said and, after fellow developer Omegamoon dared open it first and find the UART pins, I went about to do the same since, as you may already know, the UART (or serial console) is necessary for first tinkering with ROMs/Linux, due to being the place where all debug output is dumped to, way before you get anything on screen. And, of course, no kernel compilation works the first time, at least not for me :P

Apart from that, and until flash reading/writing through USB from a PC Linux is provided with tools by Amlogic, the best way to flash and reflash this device is to use the "u-boot" bootloader, through the serial console. U-boot is what runs after power-on but just before any kernel, Android or Linux, is loaded. In fact, u-boot is in charge of loading the kernel.

Hitting Enter on the serial console while the X8-H boots is enough to get a u-boot prompt instead of booting to Android.



PCB inside Neo X8-H


Just as its smaller brother, the Neo X7, the internals of this device boasts quality. And you may say: Why?

Well, let me recount a few items that you will NOT find on other cheap TV boxes that usually suffer from reboots in the middle of your favorite movie:

- The processor has a large heatsink of quality metal on it (instead of crappy tapes)
- The memory has that large heatsink also over it. What? The memory also has a heatsink!
- The large heatsink has another heatsink on top of it! What? Yes, attached to the top of the box!


Minix Neo X8-H PCB

Not enough?
- There is an embedded battery to keep the RTC time while powered off
- Count the number of capacitors, coarsely that's a major plus for stability.
- They even soldered pins for the UART serial console!! (bottom left)

Yes, the UART pins are right there for us tinkerers:

UART RX/TX pins plus power pins


So, with just a 3 pin [low-profile] connector broken in two, I was able to get them out:

Black for Ground, Red for X8H's TX, Blue for RX.

With a rather ugly cutout at the back of the box (upssss):




And, finally, connecting it to my PC through a Serial2USB board, the full boot log was available, including access to the u-boot console (boot log here).




Quick tests


The u-boot version is reported as this bizarrerie: U-boot-00001-g473771c-dirty
As far as I know it should be the year followed by the version within that year, so I guess somebody must have changed it, obscuring the source code it's based on.

u-boot log on Minix Neo X8-H

Once booted, Android reports kernel version 3.10.33, which is the latest one openly provided by Amlogic, and which, after some comparisons I believe is based on Linaro Stable Kernel tree for Android, which currently has the same version.

Unfortunately, I have found a few of the same device-specific kernel source modifications by Amlogic people, so typical of Rockchip kernels. That is ugly, prevents mainlining (using the official kernel and easily updating it), and is really badly looked upon.


On the bright side, this kernel is very modern and, magnificently, it is device-tree based.

What's that you say? Well, a device-tree file would allow you to use the very same kernel (no recompiling ever!) among all devices using, at least, the same Amlogic processor.
You just need to flash a different device-tree file! It's like an index telling the kernel what does the box in question have inside and where to find it.

Previously, on the dark ages that Rockchip sent us to, every vendor wildly modified the kernel source with its own, often buggy, little specifics, which caused an explosion of RK kernels everywhere, a chaos where you used a different kernel for each device and went crazy to keep them all up to date.



I have done some quick tests like extracting the device-tree file. Here you can see the device-tree of Minix Neo X8-H, which you can compare to the one posted by CNX-Software for the Tronsmart Vega S89 device-tree, it's interesting!


Another thing I've done is test the capabilities of u-boot, like being a client for a TFTP server on my PC, where I plan to place my kernel compilations, to download and flash to the Neo X8-H, like in this example:

u-boot getting new file for the X8-H from a TFTP server

I have been told that Minix may soon be releasing the source code its TV box is using, which is again one of the nice things we can expect from Minix, who has already released it before.

Once that is done I'll go on to recompiling and trying to get Linux into this beast! Stay tuned for the instructions!