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 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.

Linux_Amlogic_S802

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 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:
    • 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:
  3. Download a rootfs, and extract it to your NFS directory. For example:
  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
  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:
  8. 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.
    1. Extract the ramdisk provided with the source code
    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.
    3. 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.
    4. Recreate the ramdisk
  9. Now we can finally build the kernel, and boot.img:
  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
  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:
  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…

    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.
  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:

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


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:


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.


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.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

Radxa Orion O6 Armv9 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
34 Comments
oldest
newest
Boardcon CM3588 Rockchip RK3588 System-on-Module designed for AI and IoT applications