How to Run Headless Linux on Amlogic S905 Devices Such as MINI MX or K1 Plus

A few week ago, I had been informed that Amlogic S905 U-boot and Linux source code was released, and one person use the code and other resources to load a minimal Ubuntu 14.04 image to his K1 Plus TV box and released the installation instructions and the image (Thanks olin!). I also have K1 Plus here, but since I’ve just finished reviewing Beelink MINI MX, I decided to use the latter instead. The instructions below boot Linux from the (micro) SD card, and can still boot Android if you remove the SD card.

Modifying U-boot environment

The instructions include opening the box, and connecting or soldering a USB to TTL debug board to access U-boot and change some parameters. But later once an image with network is working, you could also build and load fw_setenv and fw_saveenv, and do the same steps with an Android shell and without the need to open the device.

Click to Enlarge
Serial connection to MINI MX (Click to Enlarge)

K1 Plus has the UART headers populated so you don’t have to solder anything, but MINI MX requires a little bit a soldering on the clearly marked Tx, Rx, GND pins.

Connect your USB to TTL debug board to your computer, configure minicom / putty / screen to 115200 8N1, start the board, and press the space bar to interrupt the boot:


You may want to run printenv in order to back the default settings:


Now you can change some settings in U-boot in order to allow for Linux to boot from SD card. If you are doing so directly in Android terminal via adb, you can replace setenv and saveenv by fw_setenv and fw_saveenv (no present in MINI MX firmware):

Flash Ubuntu image to the SD card

First download the Ubuntu image: ubuntu-14.04-headless-arm64.7z.

I’ve done this step in an Ubuntu computer, but you could also perform the same steps in Windows with 7pzip and Win32DiskImager. Install required tools and uncompress the image.


Insert the micro SD card (2GB or greater) in your computer, check the device with lsblk, and flash the image to your SD card by replacing /dev/sdX in the command below by your actual device.

Get the Device Tree File for Your device

If you are trying this on K1 Plus, you can skip that step, but if you are using another device, in my case Beelink MINI MX replacing the device tree file in /boot/dtb.img might be a good idea. For example, MINI MX would only get a Fast Ethernet connection with K1 Plus device tree file, but once I extracted the one from the Android firmware I got an Gigabit Ethernet connection.

If you’ll need to get boot.img either from some firmware update file, or directly from the NAND flash. I don’t have firmwre for MINI NX, so I dumped the boot partition with an adb shell:


Then I followed the instructions to extract a device tree file from Android, until I get boot.img-second.gz file, which I copied to the boot partition in the SD card with Ubuntu

Run Ubuntu in MINI MX

You may want to extend the rootfs partition in the SD card with gparted, or you’ll only have a small part of your SD card used. Now insert the SD into your Amlogic S905 TV box, and connect the power.

After some time getting wasted waiting for the network, you should be able to access to command line by logging in with user debian and password temppwd:


That’s a minimal image so there’s plenty of free space and memory:


All four cores are shown when I check the cpuinfo:


The kernel is build with Android’s option “CONFIG_ANDROID_PARANOID_NETWORK“, so all network configuration must be done with root:


So there’s some work to be done, but at least that’s a start.

[Update: It’s easy to put the case together with the serial wires by cutting the plastic case a little.

Beelink_MINI_MX_with_UART_cables]

 

Support CNX Software - Donate via PayPal, become a Patron on Patreon, or buy review samples
Subscribe
Notify of
guest
120 Comments
oldest
newest most voted
maz
maz
4 years ago

“Only one core is shown when I check the CPU however”

One core? You definitely have 4 being up here. It is just an ancient kernel with a deprecated format for /proc/cpuinfo.

olin
olin
4 years ago

Thanks for the write-up.

Regarded the CPU – the kernel config (meson64) has the hot-plug cpu governor set as default (which I was not aware of) so the ‘top’ utility really displayed only one core (after presing key ‘1’) – the rest of the cores was disabled. This also casued issues with installation of cpufreq tools (basically the apt-get install hanged), so I changed the default CPU governor to ondemand in my kernel build, which fixed the installation issue and hopefully might be more convenient for benchmarking purposes etc.

miniNodes
4 years ago

Excellent work Olin, nice to see Linux running on the S905!

m][sko
4 years ago

@olin
So I don’t need anything except original amlogic kernel + device tree file
to boot kernel on amlogic device ??

olin
olin
4 years ago

@m][sko
Correct. You also need a way how to start the kernel from the memory card – that’s what the u-boot scripts are for.

Methanoid
Methanoid
4 years ago

Headless or can we run an Ubuntu with a desktop manager (LXDE or MATE or similar) ??

fossxplorer
fossxplorer
4 years ago

, i have the usb-to-ttl i bought a while back, but where did you get the wiring that’s soldered into the board from? I need to buy it.

fossxplorer
fossxplorer
4 years ago


Awesome. Placing order now! Thx a lot.
Btw, is there a place to buy cheap soldering equips from? 🙂
Never soldered before though.

Movie78
Movie78
4 years ago


Can it run OpenElec or KodiBuntu?

gcsuri
gcsuri
4 years ago


good work!
Is it possible to write the device’s bootenv with booting a modified recovery SDcard?
There is a set_bootloader_env() function in the updater-script.

Whiterat
Whiterat
4 years ago

Should be able to place uboot autoscript commands into “aml_autoscript” on a fat partitioned sdcard or usb, when you hit the physical upgrade button (or IR codes?) while booting It’ll try “usb burning > sd burning > sd recovery > usb recovery” in that order.

loadrunner
loadrunner
4 years ago

Does the S/PDIF output work? What about bluetooth?
Thanks.

olin
olin
4 years ago

@Whiterat @gcsuri
thats a good idea. there is a way how to trigger upgrade from mmc by pressing menu (hamburger) button on the remote during boot, which loads the recovery.img kernel. the only issue right now is the framebuffer doesn’t seem to be working correctly, so virtual console and terminal doesn’t work (nothing is displayed on the screen connected via hdmi) – but maybe it’s just a matter of reconfiguring kernel. so for now ony serial console or ssh works.

Stefan
Stefan
4 years ago

Where to get firmware for Mini MX? I would like to buy that device and run Ubuntu with correct Device Tree File. So I need firmware image to extract it.

Stane1983
4 years ago


I sent you message on hangouts yesterday… 🙂

Amlogic released Linux SDK (Buildroot based) for S905 yesterday with updated kernel and drivers along with fb and x11 arm64 mali libs – http://openlinux.amlogic.com:8000/download/ARM/

gcsuri
gcsuri
4 years ago

@olin
I’ve just got my MXQ and Mini MX.
On MXQ I can use “setprop ubootenv.var.something val” command to change uboot variables from userspace.
It doesn’t work on MiniMX 🙁 – Is there any built-in utility in MiniMX to write /dev/block/env ?

gcsuri
gcsuri
4 years ago

@olin ,

OK, I got the solution to read/write the bootenv without jtag…

dumpsys system_control -b [ set | get ] bootenv [value]

for example:
dumpsys system_control -b get ubootenv.var.bootdelay

Methanoid
Methanoid
4 years ago

I’d love to see some noob friendly instructions to get Linux with desktop running on S905 boxes. Yes, Kodi would be great but for other uses. Or some dual boot instructions?

Stane1983
4 years ago

@Methanoid
That is very optimistic thinking I must say 🙂

One solution is to wait for Odroid C2 board and their emmc with preinstalled Lubuntu 🙂

Number 63
Number 63
4 years ago

Now amlogic have release a updated sdk

Does this mean we may see a openelec build for the mini mx soon?

m][sko
4 years ago

Amlogic has worst display, mali GPU and video decoder drivers
they can’t fix v-sync mali drivers problem since they first release buildroot/kernel
only android drivers are fine

Number 63
Number 63
4 years ago

Erm ok, so is that big up amlogic?

Stane1983
4 years ago

@Number 63
If someone is working on it then yes.

Number 63
Number 63
4 years ago

Thanks i will keep my fingers and toes crossed. Not a lover of android.

Number 63
Number 63
4 years ago

Do you know if anyone is working on it stane?

gcsuri
gcsuri
4 years ago


How did you open MiniMX box? 🙂

Number 63
Number 63
4 years ago

Its just clipped in underneath

mdel
mdel
4 years ago

very nice tutorial i’ll test that on my s802/s812 boxes, both run openelec images but i’d like to have regular distros. I’ve located the unpopulated rs232 headers on both boards, looks like most of them will have those debug pins. I wanted to know if you had a chance to test the gigabit performance (iperf) with that kernel on your mini mx box, and if you noticed the same duplex behavior as in your review. Also you mention the Android / Linux kernel, i’m a bit confused as to what amlogic actually released and if there’s a difference between the… Read more »

mdel
mdel
4 years ago

@Jean-Luc Aufranc (CNXSoft) i believe my s812 M8S box only has 100Mbit eth, but i’m quite familiar with those “usb gigabit” boards (pcduino), which are limited to usb bandwidth so 480Mbps at best, usually 300Mbps. I was going to buy an M8S+ box (s812 with “GBe”) but i can’t find the s812 block diagram to see if it has hardware GBe interface, apparently the S805 diagram has GBe. Thx for the kernel info, i’ll try building one for my S8xx boards and serial u-boot them over the weekend. A couple of questions more on topic : if a box can… Read more »

gcsuri
gcsuri
4 years ago

Could any “distro” run X in this box?

mdel
mdel
4 years ago

gcsuri : Could any “distro” run X in this box? My knowledge on the matter is quite limited, so @Jean-Luc Aufranc (CNXSoft) will probably tell you more. There are gpu drivers in the amlogic tarballs, so X should be able to run with some 2D acceleration, but “running” X does necessarily mean much, some basic use case could be barely functional (videos). But so far i was able to boot and ubuntu (lxde) filesystem, using an openelec 6 kernel, on an s805 box and the desktop was running “fine”. It also works on similar platforms like raspberry pi, odroid, orange… Read more »

gcsuri
gcsuri
4 years ago

ok, I got X and LXDE run on my MiniMX. X uses fbdev. There are some graphic error around fonts and window frames but it works. 🙂

gcsuri
gcsuri
4 years ago

I’ve just made a simple network perf test with nc.
nc 10.1.0.55 3333|dd of=/dev/null bs=1024 count=1024000
1 GB copied, 10.6484s, 98.4MB/s
I think the eth interface works on full bandwidth 😉

my SDcard reading speed is about 10MB/sec
internal mmc is around 40MB/s

mdel
mdel
4 years ago

@gcsuri
most impressive gigabit stats.
too bad s805 boxes don’t make use of the chip gigabit capabilities (according to hardkernel datasheet).

Concerning your X test, did you build a kernel with the gpu driver or use the image provided by olin ?
Not sure which module X should load with a working gpu driver but fbdev is not accelerated so..

gcsuri
gcsuri
4 years ago

I’m using fbdev on X. Windows moving fast enough. There is a bug in the amlogic fb code so 32bpp doesn’t work well (there are a lot of black area in the screen). I had to define 24bpp in x.conf and changed the kernel driver to 24bit init to get fbcon work perfectly.
Now I’m working on the USB boot because it’s 4x faster than cardreader…

luyi
luyi
4 years ago

@gcsuri
You can use following u-boot command to boot from usb.
usb start
fatload usb 0 0x1080000 kernel.img
fatload usb 0 0x1000000 dtb.img
boots 0x1080000

luyi
luyi
4 years ago

@gcsuri
Can you tell me how to get fbcon working?
I already compile kernel with fbcon.
I only see the boot logo after “echo 0 > /sys/class/graphics/fb0/blank”.

gcsuri
gcsuri
4 years ago

You need to map the console. fbcon=map:0

hxm
hxm
4 years ago

hi,

can it be possible to make the mini mx dual boot so we can launch openelec from SD card ?

AC
AC
4 years ago

Hi,
I am newbie, trying to run headless Ubuntu server on MQX (s805) with Odroid c1 Ubuntu release.
I used the above procedure with minor changes according to the Odroid boot.ini.
The MQX boots from the SD but I get some errors and it get stuck after 3 seconds.
Can anyone help?

Steeve Morin
Steeve Morin
4 years ago

Ok so I managed to boot the Ubuntu 16.04 from the ODROID C2 on an MXQ Pro. I can ssh to it fine but X11 doesn’t show up on the screen. Only the boot logo stays. I’ll release the image for people to test.

ss
ss
4 years ago

Hi, I’ve a geniatech box ATV495 with S905. Last night i used this doc(http://openlinux.amlogic.com:8000/download/doc/linux-3.14-buildroot-pkg-201512-release-v1.0.pdf) to flash buildroot linux from on nand. Its working fine. But now I want to test ubuntu on this box like u did. Here is what I found on ubuntu-14.04-headless-arm64.img $ fdisk -l ubuntu-14.04-headless-arm64.img Disk ubuntu-14.04-headless-arm64.img: 2002 MB, 2002780160 bytes 255 heads, 63 sectors/track, 243 cylinders, total 3911680 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000857db Device Boot Start End Blocks Id System ubuntu-14.04-headless-arm64.img1… Read more »

Advertisements