Home > AMLogic AML8726, Hardware, Linux, Testing, Ubuntu > How to Boot a Headless Linux Image on Amlogic S802 TV Boxes (Tronsmart Vega S89 Elite)

How to Boot a Headless Linux Image on Amlogic S802 TV Boxes (Tronsmart Vega S89 Elite)

As some of you already know, I’ve been playing around with Tronsmart Vega S89 Elite, an Android TV Box powered by Amlogic S802 quad core ARM Cortex A9r4 processor at 2 GHz. Today, I’ll show how to boot a headless Linux image on any Amlogic based S802 TV Box from the network. The instructions can mainly be used as a starting point for developers, as it requires access to a serial terminal via  UART, but if you’ve never done it before, the instructions should be easy enough to follow. Everything is loaded from the network, the kernel (via boot.img) is loaded via TFTP, and the rootfs (Linaro ALIP image) is mounted via NFS, so it’s nearly impossible to brick your device using the method provided. Linaro ALIP rootfs comes with LXDE, but at this stage the desktop environment is not showing, even through my HDMI TV is properly detected by the drivers. However, Ethernet, USB mass storage, and the micro SD seem to be working just fine.


If you want to skip the kernel compilation part, ramdisk modification, and just boot your Vega S89 Elite from network you can download vegas89eboot.img (compressed with bzip2), and skip steps 4 to 9 included. Please don’t just flash this image or use it without reading the post, as even if it should not brick your device, Android won’t boot at all if you don’t follow the right instructions.

Let’s get started

  1. Make sure you’ve connected a USB to serial board to your S802 based device.
  2. If not done already, you’ll need to install TFTP and NFS servers, and the get basic development tools in a Linux computer. All instructions here have been performed in a PC running Ubuntu 14.04 64-bit.
    • For the TFTP server, I installed and ran aftfpd as follows:
      sudo apt-get install atftpd
      sudo tftpd --daemon
    • Instructions to install an NFS server on Ubuntu/Debian.
    • You’ll need to install the build-essentials and other tools to successfully build Linux, something like:

      sudo apt-get install git-core build-essential zip curl g++-multilib cpio gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi

  3. Download a rootfs, and extract it to your NFS directory. For example:
    mkdir -p /srv/nfs/alip 
    pushd /srv/nfs/alip
    wget http://releases.linaro.org/14.04/openembedded/vexpress-lsk/linaro-image-alip-genericarmv7a-20140417-248.rootfs.tar.gz
    sudo tar xzvf linaro-image-alip-genericarmv7a-20140417-248.rootfs.tar.gz
  4. Get the device tree file (DTD) for your device from its firmware image or, if not available, directly from the NAND flash.
  5. Follow the instructions to get S802 kernel source and setup the source tree until after the step where you do
    make ARCH=arm meson8_defconfig
  6. Run “make ARCH=arm menuconfig” to enable NFS client support as shown below.
    Linux_3.10_NFSThen exit and save
  7. You’ll need to edit mk_m8.sh script for your device using the correct DTD file, which you need to copy to ./arch/arm/boot/dts/amlogic/ directory.  I’ve renamed the script to mk_vegas89e.sh, and edited it as follows:
    # Modify these four lines for your board
    make uImage -j8
    #make modules
    make ${DTDFILE}.dtd
    make ${DTDFILE}.dtb
    ./mkbootimg --kernel ./arch/arm/boot/uImage --ramdisk ./${ROOTFS} --second ${DTDFILE_PATH}/${DTDFILE}.dtb --output ./${BOOTIMG}
    ls -l ./${BOOTIMG}
    echo "${BOOTIMG} done"
  8. We also need to create and init to switch the root to NFS. Normally, we should be able to do  in the bootloader with “bootargs” but this did not work for me, probably because I missed some steps.
    1. Extract the ramdisk provided with the source code
      mkdir rootfs
      cd rootfs
      sudo cpio -i -F ../rootfs.cpio
    2. Delete sbin/init symlink to busybox, and create a new init file. Be very careful at this stage as if you inadvertently add a leading slash, you’ll mess up with your PC system.
      rm sbin/init
      sudo vi sbin/init
    3. Here’s the content of sbin/init. Replace by the IP address of your PC / NFS server, and /srv/nfs/alip by the path where you extracted your rootfs in the NFS directory.
      #!/bin/busybox sh
      echo "CNXSoft init script entered"
      echo "DHCP..."
      udhcpc eth0
      echo "Mounting NFS rootfs..."
      mount -t nfs -o proto=tcp -o nolock /mnt
      echo "Switching root..."
      exec switch_root /mnt /sbin/init
    4. Recreate the ramdisk
      find .| sudo cpio -o -H newc > ../rootfs.cpio
      cd ..
  9. Now we can finally build the kernel, and boot.img:
    chmod +x mk_vegas89e.sh
  10. It should take between a minute to a few minutes depending on your machine, and if everything works as planned you could get your boot.img, in my case vegas89eboot.img. Copy it to your tftp server directory
    sudo cp vegas89eboot.img /srv/tftp/boot.img
  11. Now start minicom connected to ttyUSB0 (115200 8N1), and power the TV box. Press the space bar, or any other key, during boot up to access U-boot command line. Let’s define IP addresses for the board, the TFTP server, and gateway (router), and save these to the U-boot environment:
    m8_k200_v1# setenv ipaddr
    m8_k200_v1# setenv serverip
    m8_k200_v1# setenv gatewayip
    m8_k200_v1# saveenv
  12. Setup the boot arguments for NFS. I know I should really have used fixed IP instead of dhcp, for consistency, and to shave off two or three seconds to boot time, but…

    m8_k200_v1# setenv bootargs 'root=/dev/nfs rootfstype=nfs nfsroot=,rw,nolock ip=dhcp rootwait init=/sbin/init no_console_suspend storage=4 logo=osd1,loaded,0x15100000,576cvbs,full hdmimode=720p cvbsmode=576cvbs androidboot.firstboot=0 hdmitx=cec0 console=ttyS0,115200n8'

    You could also use saveenv to save these, but then Android won’t boot anymore next time your start the board. Alternatively, you could create a bootargs2 and copy this to bootargs before running Linux.

  13. Load boot.img from the TFTP server
  14. Start the system

    Once you make sure boot.img loads properly from TFTP server, you could also combine both commands with “bootp; bootm

  15. You should now have access to the command line as root, no password required. An sshd daemon is already running so you can access it via ssh if you want. The board temperature will be outputted every second or so. There must be a way to disable that in the code, but in the meantime you can do:
    echo "3 3 3 3" > /proc/sys/kernel/printk

Let’s have a look at free memory, storage devices and more.

root@genericarmv7a:~# uname -a                                                  
Linux genericarmv7a 3.10.10 #2 SMP PREEMPT Tue May 13 17:14:29 ICT 2014 armv7l x
root@genericarmv7a:~# free -m                                                   
             total         used         free       shared      buffers          
Mem:          1578           91         1487            0            3          
-/+ buffers:                 87         1490                                    
Swap:            0            0            0                                    
root@genericarmv7a:~# df -h                                                     
Filesystem                Size      Used Available Use% Mounted on                                                          
                        901.0G    656.3G    199.0G  77% /                       
tmpfs                    40.0K         0     40.0K   0% /mnt/.psplash           
tmpfs                   789.3M    176.0K    789.1M   0% /run                    
tmpfs                   789.3M    128.0K    789.1M   0% /var/volatile           
none                    775.2M      4.0K    775.2M   0% /dev                    
/dev/sda1                 3.4G      2.7G    678.8M  80% /media/sda1             

There’s about 1.5GB ram free, I’ve got a lot of storage in the root as it is the 1TB hardware in my PC, and my 4GB USB flash drive was almost mounted automatically.

I’ll also through the CPU information for reference:

root@genericarmv7a:~# cat /proc/cpuinfo                                         
Processor       : ARMv7 Processor rev 1 (v7l)                                   
processor       : 0                                                             
BogoMIPS        : 12.65                                                         
processor       : 1                                                             
BogoMIPS        : 12.65                                                         
processor       : 2                                                             
BogoMIPS        : 12.65                                                         
processor       : 3                                                             
BogoMIPS        : 12.65                                                         
Features        : swp half thumb fastmult vfp edsp neon vfpv3 tls               
CPU implementer : 0x41                                                          
CPU architecture: 7                                                             
CPU variant     : 0x4                                                           
CPU part        : 0xc09                                                         
CPU revision    : 1                                                             
Hardware        : Amlogic Meson8 platform                                       
Revision        : 000b                                                          
Serial          : 1900000000000000

You should easily be able to adapt these instructions to boot from flash, by inserting boot.img into one of the available firmware update packages, and switching root to a USB flash or hard drive with the rootfs. I’m not sure how to access the flash partitions right now, as only the bootloader shows up in the MTD partition, but it;s the same thing in Android.

root@genericarmv7a:~# cat /proc/mtd                                             
dev:    size   erasesize  name                                                  
mtd0: 00060000 00001000 "bootloader"                                            
mtd1: 00010000 00001000 "ubootenv"                                              
root@genericarmv7a:~# ls /dev/block/ -l                                         
total 0                                                                         
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 254:0 -> ../zram0      
lrwxrwxrwx    1 root     root            12 Apr 17 15:21 31:0 -> ../mtdblock0   
lrwxrwxrwx    1 root     root            12 Apr 17 15:21 31:1 -> ../mtdblock1   
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:0 -> ../loop0        
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:1 -> ../loop1        
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:2 -> ../loop2        
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:3 -> ../loop3        
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:4 -> ../loop4        
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:5 -> ../loop5        
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:6 -> ../loop6        
lrwxrwxrwx    1 root     root             8 Apr 17 15:21 7:7 -> ../loop7        
lrwxrwxrwx    1 root     root             6 Apr 17 15:21 8:0 -> ../sda          
lrwxrwxrwx    1 root     root             7 Apr 17 15:21 8:1 -> ../sda1

I’m not sure I’ll go much further myself, but hopefully some people will pick up on this, and we’ll get a fully working easily installable Linux server and desktop images for Amlogic S802 based platforms.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

  1. m][sko
    May 15th, 2014 at 17:03 | #1

    XBMC build on pure buildroot use this to init video output

    fbset -g 1280 720 1280 1440 32
    At least it works for me on MX board
    But in most case x.org init and configure framebuffer correctly without fbset

    This it for hw accelerated compositing and and opengl support in applications.
    How to X.org on mali from arm mali directly :)

    But you will need
    mali drivers for x.org

  2. May 15th, 2014 at 19:04 | #2

    Hey, I ‘m here again :-) Thanks for maintaining such a awesome site! It always gives me surprise.

    So it ‘s *completely* possible to build a usable linux kernel on s802? By “completely” I mean USB support, cardreader support, gpu, and so on. I read your last post, device tree for s802 is available!

    If it ‘s possible to build a perfect kernel, then I ‘m going to give up the aml8726mx hack, and turn to s802 happily.

  3. m][sko
    May 15th, 2014 at 19:09 | #3

    But most of as will be still happy to see 3.10 kernel on aml8726mx devices :)

  4. May 15th, 2014 at 19:30 | #4

    USB support, card reader yes.
    GPU is more complicated. Having a desktop on the framebuffer should be feasible, but 2D/3D hardware acceleration is more tricky. Links provided by @m][sko should help.

    If these “pesky” RK3288 and AllWinner A80 were not hitting the market soon :), I’d be more confident a community could gather around S802. We’ll see.

  5. May 15th, 2014 at 20:08 | #5

    Hi, thanks for the link, a group of awesome person. :-)
    I ‘m quite new to linux on arm. Does it have to take so much effort to make it boot? I cannot run linux on my aml8726-mx now, I think just because there is no dtd file matching my device. Will my device be supported if these cool guys work things out?
    BTW, does it take special steps to boot a kernel consisting a dtb? I just load the boot.img and “bootm” as usual. Just to make sure :-)

  6. May 15th, 2014 at 20:16 | #6

    Oh god, I just saw my device is listed on their README!

    STVMX (G02REF) (mx_linux_stvmx_defconfig)
    JYNXM6 (G02REF) (mx_linux_jynxm6_defconfig)

    This is from my android firmware kernel log:
    [0.000000@0] Machine: Amlogic Meson6 g02 customer platform

    Though I don ‘t know which one to use…does it mean something special to me? I mean, Do they have dtd file or something?

  7. m][sko
    May 15th, 2014 at 20:42 | #7

    They use kernel 3.0 but no public kernel source :(
    But As I said.
    I still hope that you will solve kernel 3.10 for aml8726-mx :)

  8. May 15th, 2014 at 21:42 | #8

    Well without the dtd file it’s too hard for me to make it…I probably have to wait till the official android firmware go to 3.10…then I can get the dtd file. But it will never happen(a tvbox ‘s kernel needn’t to be up-to-date, haha).

  9. May 15th, 2014 at 21:55 | #9

    I’ll just clarify again:
    With Linux 3.0.5 – The hardware is defined with the board file (C language) + .config
    With linux 3.5 and greater – The hardware is defined via device tree files (DTS/DTB). Before I checked Amlogic source code, I never heard about DTD by the way.

    So since they are using 3.0.5 device tree file are not usable… as it’s not supported by the kernel.

    I really thought the source code was available. But after re-reading things like http://www.cnx-software.com/2012/08/18/amlogic-releases-aml8726-mx-linux-3-0-8-source-code/, the code appears to be incomplete so it’s not really usable, except maybe on some specific hardware. Am I correct?

  10. dhead
    May 15th, 2014 at 23:41 | #10


    If it possible please post a full kernel boot log and if there’s any debug output when running “ip” command or “ip addr” then please also post it.
    I’ve been trying getting ethernet working with kernel 3.10 on meson6 (Arch Linux, systemd) without luck ATM.

  11. m][sko
    May 16th, 2014 at 00:32 | #11
  12. Pigbait
    May 16th, 2014 at 05:04 | #12

    My stupid USB uart is broken, crappy deal, i will buy a new one asap, and give this a go. (m8 Square S802)

  13. May 16th, 2014 at 09:23 | #13

    Full boot log – http://pastebin.com/YzZYMpfz

    root@genericarmv7a:~# ip addr
    1: lo: mtu 65536 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
    valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
    valid_lft forever preferred_lft forever
    2: eth0: mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 6e:36:3d:06:44:bb brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
    valid_lft forever preferred_lft forever
    inet6 fe80::6c36:3dff:fe06:44bb/64 scope link
    valid_lft forever preferred_lft forever
    3: sit0: mtu 1480 qdisc noop
    link/sit brd
    4: ip6tnl0:
    mtu 1452 qdisc noop
    link/tunnel6 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 brd 00:00:00:00

    I’m not sure it’s relevant to your case, but when I used meson8_k200 dtd file from source, I had:
    compatible = “amlogic,meson-eth”;
    dev_name = “meson-eth”;
    status = “okay”;
    ethbaseaddr = <0xfe0c0000>;
    interruptnum = <40>;

    But in Vega S89 Elite DTD, it’s actually:
    meson-eth {
    compatible = “amlogic,meson-eth”;
    dev_name = “meson-eth”;
    status = “okay”;
    ethbaseaddr = <0xfe0c0000>;
    interruptnum = <0x28>;

    So I guess the inteerupnum is the number you may have to change here.

  14. May 16th, 2014 at 11:24 | #14

    Hi, I have one more question :-)
    Now I gave up on the attempt to 3.10.10, and turn back to 3.0. I get the source from here https://github.com/Stane1983/kernel-amlogic-mx
    I compiled the kernel, all things is perfect. But when I type ‘uptime’ to check the system load:

    Riaqn-MBox ~ # uptime
    18:25:19 up 1:14, 1 user, load average: 4.00, 4.01, 3.95

    It’s always greater than 4. But there isn ‘t any heavy program running:

    2343 root 20 0 3188 1316 960 R 0.7 0.2 0:00.03 top
    4 root 20 0 0 0 0 S 0.3 0.0 0:18.62 kworker/0:0
    1 root 20 0 1664 620 548 S 0.0 0.1 0:04.37 init
    2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd

    Is this a bug or something?

  15. dhead
    May 16th, 2014 at 11:35 | #15


    Thanks, I’m not sure why would this make any difference, it’s just the same value in hex instead of dec.
    From a brief look at the 3.0.50 source I think the intterupt num is the same for the meson6 (40 or 0×38) so I’ll give it a try (ethbaseaddr is not the same).
    Probably next week I’ll play a bit with the uboot sources and try get a FTD enabled uboot on my device to see if it would help.

  16. dhead
    May 16th, 2014 at 12:00 | #16

    dhead :
    Thanks, I’m not sure why would this make any difference, it’s just the same value in hex instead of dec.
    From a brief look at the 3.0.50 source I think the intterupt num is the same for the meson6 (40 or 0×38) so I’ll give it a try (ethbaseaddr is not the same).
    Probably next week I’ll play a bit with the uboot sources and try get a FTD enabled uboot on my device to see if it would help.
    I meant 0×28 of course.

  17. May 16th, 2014 at 13:25 | #17

    It must be a bug. I think I’ve some people talk about the same type of issues with Linux on the Wandboard (Freescale i.MX6)

    Oops that’s embarrassing… I thought both values were written in hex. So it’s definitely something else.

  18. May 16th, 2014 at 14:43 | #18

    That was not wandboard but GK802, and it was a bug in the kernel. It could be the same in your case.

  19. May 16th, 2014 at 15:43 | #19

    Thanks for your link, there ‘s a discussion here too, http://www.linuxquestions.org/questions/linux-server-73/server-with-high-load-average-and-no-obvious-reason-677824/
    I check my system with the command in the thread, it turns out to be 3 process related to hdmi and 1 process related to cardreader. I ‘ve reconfigure the kernel and disable the hdmi. Now the load go down to 1. Since the bug doesn’t affect the performance actually, so I just stop here.
    By the way, the kernel-3.0 Stane1983 maintained is perfect. :-) Though with only experimental nfsv4 support, but ‘unstable’ is better than ‘cannot boot’.

  20. m][sko
    May 16th, 2014 at 17:21 | #20
  21. gizmomelb
    May 16th, 2014 at 20:07 | #21

    breaking news – official S802 firmware source code ‘released’ including DTD for S802-H etc. – https://github.com/oman007/s82_kernel

  22. m][sko
    May 16th, 2014 at 20:15 | #22

    We don’t have problem with kernel sources
    We have problem with version as amlogic don’t release up to date version from their git for public

  23. dhead
    May 16th, 2014 at 21:46 | #23


    Kernel 3.10.33, missing mali and ump kernel modules (probably we can use Amlogic’s gpu 20140306 public release).

    I decided to create my own monstrous linux-meson repo just for kicks (I’m not much of developer and surely not kernel developer) and I pulled in also this kernel tree, will have fun next week with the sources.


    I also created a Github organization dubbed “not-aml” to mirror Amlogic OpenLinux GPL releases (still missing the filesystem releases with Amlogic misc libraries like amlplayer).


  24. May 16th, 2014 at 21:48 | #24

    and sometimes the “dtd files”, too, as amlogic doesn ‘t release dtd files of their customers’ board, some of which don’t have a firmware later than 3.5, from which we cannot get a dtd file.

  25. gizmomelb
    May 18th, 2014 at 05:31 | #25

    just curious if you’ve had a look at the source I linked… it’s the (leaked) same source and tools used to build the official 102K4 firmware for the Tronsmart S89 and Beelink M8 S802 Amlogic media players.

  26. dhead
    May 18th, 2014 at 06:23 | #26


    This kernel tree fixed my issues with ethernet on meson6, I now running Arch Linux on the g18.

  27. Al
    June 29th, 2014 at 05:19 | #27

    Is there any new info on this? Has anyone got full Linux booting?

  28. Mykhaylo Tyulchenko
    July 4th, 2014 at 16:46 | #28

    what about internal usb wifi on meson6_g18?
    I now try running Ubuntu precise with 3.10.33 amlogic kernel,
    there is no wifi device on usb device list (lsusb -t), only usb hosts…(on 3.0.101 kernel all ok)

  1. No trackbacks yet.