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 though 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
- Make sure you’ve connected a USB to serial board to your S802-based device.
- If not done already, you’ll need to install TFTP and NFS servers, and then get basic development tools installed on a Linux computer. All instructions here have been performed on a PC running Ubuntu 14.04 64-bit.
- For the TFTP server, I installed and ran aftfpd as follows:
12sudo apt-get install atftpdsudo 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:
1sudo apt-get install git-core build-essential zip curl g++-multilib cpio gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi
- For the TFTP server, I installed and ran aftfpd as follows:
- Download a rootfs, and extract it to your NFS directory. For example:
12345mkdir -p /srv/nfs/alippushd /srv/nfs/alipwget http://releases.linaro.org/14.04/openembedded/vexpress-lsk/linaro-image-alip-genericarmv7a-20140417-248.rootfs.tar.gzsudo tar xzvf linaro-image-alip-genericarmv7a-20140417-248.rootfs.tar.gzpopd - Get the device tree file (DTD) for your device from its firmware image or, if not available, directly from the NAND flash.
- Follow the instructions to get S802 kernel source and setup the source tree until after the step where you do
1make ARCH=arm meson8_defconfig - Run “make ARCH=arm menuconfig” to enable NFS client support as shown below.
Then exit and save
- 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:
123456789101112131415# Modify these four lines for your boardDTDFILE=meson8_vegas89eDTDFILE_PATH=./arch/arm/boot/dts/amlogic/BOOTIMG=vegas89eboot.imgROOTFS="rootfs.cpio"make uImage -j8#make modulesmake ${DTDFILE}.dtdmake ${DTDFILE}.dtb./mkbootimg --kernel ./arch/arm/boot/uImage --ramdisk ./${ROOTFS} --second ${DTDFILE_PATH}/${DTDFILE}.dtb --output ./${BOOTIMG}ls -l ./${BOOTIMG}echo "${BOOTIMG} done" - We also need to create an init to switch the root to NFS. Normally, we should be able to do this in the bootloader with “bootargs” but this did not work for me, probably because I missed some steps.
- Extract the ramdisk provided with the source code
123mkdir rootfscd rootfssudo cpio -i -F ../rootfs.cpio - 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.
12rm sbin/initsudo vi sbin/init - Here’s the content of sbin/init. Replace 192.168.0.104 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.
12345678910111213#!/bin/busybox shecho "CNXSoft init script entered"PATH="/bin:/sbin:/usr/bin:/usr/sbin"echo "DHCP..."udhcpc eth0echo "Mounting NFS rootfs..."mount -t nfs -o proto=tcp -o nolock 192.168.0.104:/srv/nfs/alip /mntecho "Switching root..."exec switch_root /mnt /sbin/init - Recreate the ramdisk
12find .| sudo cpio -o -H newc > ../rootfs.cpiocd ..
- Extract the ramdisk provided with the source code
- Now we can finally build the kernel, and boot.img:
12chmod +x mk_vegas89e.sh./mk_vegas89e.sh - 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
1sudo cp vegas89eboot.img /srv/tftp/boot.img - 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:
1234m8_k200_v1# setenv ipaddr 192.168.0.144m8_k200_v1# setenv serverip 192.168.0.104m8_k200_v1# setenv gatewayip 192.168.0.1m8_k200_v1# saveenv - 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…
1m8_k200_v1# setenv bootargs 'root=/dev/nfs rootfstype=nfs nfsroot=192.168.0.104:/srv/nfs/alip,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 any more next time you start the board. Alternatively, you could create a bootargs2 and copy this to bootargs before running Linux. - Load boot.img from the TFTP server
1bootp - Start the system
1bootm
Once you make sure boot.img loads properly from TFTP server, you could also combine both commands with “bootp; bootm“ - 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:
1echo "3 3 3 3" > /proc/sys/kernel/printk
Let’s have a look at free memory, storage devices and more.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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 192.168.0.104:/srv/nfs/alip 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 root@genericarmv7a:~# |
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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.

Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress