Jump to content

Quick Guide - Amlogic TV Boxes


queeks

Recommended Posts

The guide was created in response to the outdated or non-functional nature of much of the software provided by armbian-config->Software->Softy, particularly for TV boxes. It is tailored for advanced users who are adept at using commands, prefer manual installation, and favor the convenience of copying and pasting commands rather than searching for them on the armbian forum. While detailed explanations of each command's function won't be provided, I will include source links for each section, enabling you to conduct your own research. In this guide, I am using the latest ubuntu-based Armbian build: Armbian_23.11.1_Aml-s9xx-box_jammy_current_6.1.63_xfce_desktop.img.xz.

 

Table of Contents

  1. check dtb
  2. burn Armbian to SD card
  3. configure boot partition
  4. install Armbian on SD card
  5. flashing
    1. install-aml.sh script
    2. Amlogic USB Burning Tool
    3. Amlogic Burn Card Maker Tool
    4. SHORT PIN method
    5. Team Win Recovery Project
  6. software
    1. install docker
    2. install openWRT
    3. install pi-hole
    4. install portainer
    5. install RPi monitor
    6. install xfce
    7. install midori browser
    8. install full armbian firmware
    9. install USB LTE dongle
  7. backup SD card
  8. armbian commands
  9. android stock firmware

 

check dtb

  1. Install Device Info HW and open the app
  2. In the "SYSTEM" tab, you can find the "dtb" information for your box. This information is crucial for configuring the boot partition correctly. Please keep a note of your "dtb" (device tree blob) information for future boot partition configuration.

 

burn Armbian to SD card

  1. Mare sure to use good, reliable and fast SD card from SandDisk, class 10, A1
  2. Choose between ubuntu (jammy) and debian (bookworm) and download .xz file compressed image from the official Armbian archive. For advanced linux users who want a clean server (not even includes armbian-config), the "minimal" variant is recommended.
  3. Download burning tool balenaEtcher or USBImager and burn the compressed image to your SD card.

https://docs.armbian.com/User-Guide_Getting-Started/

 

configure boot partition

  1. Open extlinux/extlinux.conf and uncomment the correct dtb for your box. If you make a mistake here, you will fail to boot. Make sure only one line is uncommented (check your dtb, for s912 SoC its q200 or q201).
  2. Go back to armbi_boot partition, copy the correct u-boot file according to your SoC and rename it to u-boot.ext. If you dont know your SoC, boot into Android, install/open Device Info HW app and go to SOC tab. The app may need root access to read device specs.

 

install Armbian on SD card

To boot the system for the first time you have to use one from the following - sometimes only one way of doing this works! If your box is installed with libreElec/coreElec, then you can't boot into Armbian, because you have to flash stock Android firmware first.

  • Toothpick method: disconnect the power supply, insert card/drive, push reset button and connect the power while holding the button. Wait until Armbian logo appears and release the button.
  • Terminal method: boot to Android, insert SD card with Armbian, install Terminal Emulator app (either from Google Play or APKMirror), run it and type reboot update. Your box should reboot to Armbian.
  • Update&Backup: somewhere in the Android interface, perhaps the applications folder, you will find a program called Update OR Update&Backup, open it if you have "Update" app pre-installed, insert SD card with Armbian, select "Local" and choose ZIP file (aml_autoscript.zip) from the SD card; select "Update" and your box should reboot to Armbian.
  • Recovery method: boot into Android, insert card/thumb drive and choose Reboot to recovery. Your box should boot into Armbian.
  • ADB method: enable ADB (Google it) and run the following command in a terminal window: adb reboot update
  • Menu button method (works with very few devices): disconnect the power supply, insert card/drive, push menu button on your remote control and connect the power while holding the button. Wait until Armbian boot script appears and release the button.

 

install-aml.sh script

NOTE: This will overwrite the Android ROM on the eMMC flash and attempt to install Armbian on the internal eMMC storage. Before beginning, make sure you have a backup of the stock Android ROM in the event the installation fails or you want to revert back to Android in the future. Proceed at your own risk.

You can copy the working Armbian environment from SD card to eMMC using the install-aml.sh script. This file does a physical copy of whole system to eMMC. You can install Armbian to eMMC by running the shell script in the /root directory. Run the following commands in a terminal window:

sudo su
cd /root/
sudo ./install-aml.sh 

Once the Armbian finishes copying to the eMMC, shutdown Armbian, unplug power from the box, remove the SD card from the box, power the box back on to boot from the eMMC storage, if everything worked as expected, Armbian should boot from the internal eMMC storage and no longer require the SD/microSD card.

 

Amlogic USB Burning Tool

If you have a box with an Amlogic processor and need to update its firmware, install a custom ROM, or unbrick the box, the Amlogic USB Burning Tool is the recommended solution. It provides an easy-to-use interface for flashing firmware onto Amlogic-based devices. To use the Amlogic USB Burning Tool, follow these steps:

  1. Download the Amlogic USB tool zip file and extract it to the PC.
  2. In the folder, you have the InstallDriver.exe. This will install the required drivers for Amlogic TV boxes.
  3. Download the firmware file compatible with your box.
  4. Launch the Amlogic USB Burning Tool, change language and click “File” > “Import Image” to load the firmware file.
  5. Connect your box to your PC using a USB cable, ensuring the box is in recovery mode (toothpick method) or bootloader mode.
  6. The tool should detect your box, and you can click the “Start” button to begin the flashing process.
  7. Wait for the process to complete, and your box will reboot with the new firmware installed.

 

Amlogic Burn Card Maker Tool

With this method you can recover the device from a brick if you have no way to connect it to a PC. In this tutorial, we will guide you on using the burn card maker tool to create a bootable SD card for reinstalling Android Stock Firmware (ROM) on your box. You just need the correct firmware (ROM) for your specific box.

  1. Download Burn_Card_Maker v2.0.2 (3.96 MB).
  2. Extract the archive and run Burn_Card_Maker.exe file to run the tool.
  3. Click on upper left chinese menu and choose second option, check ‘English Version’ and restart the application.
  4. Choose disk then ‘Choose your image files’ to open image and select your specific .img firmware for your box.
  5. Press ‘Make’ button and wait to finish. Now insert the micro SD card in your box and power on while holding the reset AV button. You will be able to enter into recovery and the firmware will be flashed automatically. When the TV BOX reboots, remove the micro SD Card, this step is very important, wait 4-5 minutes and the update will completed.
  6. If your device fails to boot, your last option is to use the SHORT PIN method.

 

SHORT PIN method

Follow the steps outlined in the guide Amlogic Burn Card Maker Tool. If pressing the AV reset button doesn't work, it is likely that your device is unresponsive or "dead". In this case, you can try shorting out the PINS. Please note that at this point, you have little to lose in terms of further damage to the device. The SHORT PIN method can be used when other recovery methods and the Amlogic USB Burning Tool are not responsive. Please note that this method should only be attempted by those who fully understand the risks involved in handling electronics and take full responsibility for any potential issues that may arise.

  1. Dismantle: to proceed with the SHORT PIN method, you will need to dismantle your device. Remove the rubber placeholders on the back of the device to reveal screws. Unscrew these screws and carefully separate the device. Be cautious when removing the top part of the device, as the WIFI antenna is usually attached to it. Removing it too quickly may cause damage to the WIFI cable.
  2. NAND flash: locate the NAND flash chip, which is where the operating system is stored. Look closely at the PINS on the chip, as they are quite small. Identify two pins that are next to each other, and using a screwdriver, short them out by making them touch each other.
  3. Recovery menu: ensure that your SD card is inserted with the firmware image using the Burn Card Maker tool. Have your power supply and HDMI cable ready to be inserted. Now, slowly try different combinations of the PINS while applying power to the device. Eventually, you will find a combination that initiates the hardware and communicates with the SD card. This will initiate the boot sequence, and you should see a recovery menu on the screen. From there, the installation of Android will begin. Essentially, shorting out these two PINS is similar to holding the AV reset button.
  4. Again: Before applying power, hold down the two PINS and then apply power. Repeat this process until you see results or something on the screen. Sometimes, the screen may flash green or red, indicating that you have found the correct PINS but have the wrong firmware. In this case, return to your PC and find a different firmware image specific to your SoC. If you are unable to find the original stock ROM for your box, it is possible that your box is a clone of another well-known box. In this case, find the firmware for the box that is most closely related to yours.

You need to make your box boot once into recovery/update mode to reinstall firmware from SD card. The SHORT PIN method modifies normal boot procedure to make your box look for kernel and dtb on SD card before booting from internal memory.
https://inv.vern.cc/watch?v=CUfKNNgxb9E

 

Team Win Recovery Project

TWRP, short for Team Win Recovery Project, is a community-driven project that provides a custom recovery solution for Android devices. It supports backups, restoration, and custom ROM installation.
https://twrp.me/Devices/

 

install docker

ubuntu

Add the GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 

Add repository to APT sources:

sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update

Install Docker:

apt-get install docker-ce docker-ce-cli containerd.io 

Test the installation:

docker --version 

Install Docker Compose:

sudo curl -L "https://github.com/ubiquiti/docker-compose-aarch64/releases/download/1.22.0/docker-compose-Linux-aarch64" -o /usr/local/bin/docker-compose<br>
sudo chmod +x /usr/local/bin/docker-compose

Test Docker Compose installation:

docker-compose --version 

debian

apt-get remove docker docker-engine docker.io containerd runc
apt-get install ca-certificates curl gnupg lsb-release
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update
apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin 

If you would like to use Docker as a non-root user, you should now consider adding your user to the docker group with something like:

sudo usermod -aG docker $USER 

https://docs.armbian.com/User-Guide_Advanced-Features/#how-to-run-docker

 

install openWRT

On the host system, the full armbian firmware should be installed so you can use it on AP mode:

wget https://imola.armbian.com/apt/pool/main/a/armbian-firmware-full/armbian-firmware-full_21.08.6_all.deb
sudo dpkg -i armbian-firmware-full_21.08.6_all.deb 

Make sure your USB WIFI adapter supports AP mode:

iw list 

Set country regulations, for example, to Spain set:

iw reg set ES 

Make sure you are not runing wpa_supplicant on your host machine or docker container will tell messages like wlan0: Could not connect to kernel driver.

sudo systemctl stop wpa_supplicant
sudo systemctl disable wpa_supplicant 

Install dependencies:

sudo apt install iw iproute2 gettext dhcpcd5 

Initial configuration is performed using a config file, openwrt.conf. You can use the included openwrt.conf.example as a baseline, which explains the values. At the very least you’ll need to change the values of LAN_PARENT and WIFI_IFACE. Commands to download the repo and configure openwrt.conf

git clone https://github.com/oofnikj/docker-openwrt.git
cd docker-openwrt
cp openwrt.conf.example openwrt.conf
nano openwrt.conf 

Build the image:

make build 

Create the openwrt container:

make run 

If you arrive at * Ready, point your browser to LAN_DOMAIN and you should be presented with the login page. The default login is root with the password set as ROOT_PW. Any settings you configured or additional packages you installed will persist until you run:

make clean 

This will delete the container and all associated Docker networks so you can start fresh if you screw something up.

Installing will create and enable a service pointing to wherever you cloned this directory and execute run.sh on boot.

make install

 

https://forum.openwrt.org/t/running-openwrt-in-a-docker-container/56049
https://badgateway.qc.to/contain-your-router/
https://github.com/oofnikj/docker-openwrt

 

install pi-hole

Start by creating a directory where you will store the configuration file for the Pi-Hole docker container:

mkdir pihole
cd pihole
nano docker-compose.yml

Enter the following lines:

services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "80:80/tcp"
    environment:
      TZ: 'Europe/Berlin'
      WEBPASSWORD: '1234'
    networks:
      internal:
        ipv4_address: 192.168.16.10  # Assign a static IP within your router's subnet
    volumes:
      - './etc-pihole:/etc/pihole'
      - './etc-dnsmasq.d:/etc/dnsmasq.d'
    cap_add:
      - NET_ADMIN
    restart: unless-stopped
    networks:
      openwrt-lan:
        ipv4_address: 192.168.16.10  # Assign a static IP within your LAN subnet
networks:
  openwrt-lan: 

If you are using ubuntu to run the pi-hole docker container, you may need to disable the systemd-resolve service:

systemctl disable systemd-resolved.service
systemctl stop systemd-resolved

Then, you can bring your pi-hole up:

docker-compose up -d

As we managed our own router firmware using OpenWrt, you need to tell your router to send pi-hole IP as DNS server to client. Go to Interfaces -> Lan -> DHCP Server -> Advanced Settings, inside DHCP-Options enter value: 6,192.168.16.10. Apply changes and restart the LAN interface.

https://pimylifeup.com/pi-hole-docker/

https://firebog.net/

https://arstech.net/pi-hole-blocking-lists-2023/

https://avoidthehack.com/best-pihole-blocklists

 

install portainer

docker volume create portainer_data
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data --network=openwrt-lan portainer/portainer-ce 

 

install xfce

sudo apt-get -y install xorg lightdm xfce4 tango-icon-theme gnome-icon-theme dbus-x11
sudo startxfce4 

To disable the desktop environment and return to tty1 after installing xfce on Armbian, you can follow these steps:

  1. Press Ctrl + Alt + F1 to switch to tty1.
  2. Log in with your username and password.
  3. Stop the display manager service by running the following command:
    sudo service lightdm stop

    This will stop the graphical interface and return you to the command line interface. To prevent the display manager from starting automatically on boot, run the following command:

    sudo systemctl disable lightdm

     

 

install midori browser

sudo apt install midori 

 

install RPi monitor

The RPi monitor on port 8888 can also be installed for AMLOGIC boxes with the following command:

sudo armbianmonitor -r

 

install full armbian firmware

By default, the Armbian builds only include a limited set of firmwares out of the box. To address certain driver issues, you may need to install the complete Armbian firmware. There are two ways to do this: either through armbian-config -> software -> Full, or by manually installing the firmware via a USB device if you don't have internet connectivity on your box. To manually install the firmware, download it from the following link: https://imola.armbian.com/apt/pool/main/a/armbian-firmware-full/. Once downloaded, copy the firmware to your USB device. Then, insert the USB device into the Armbian box and navigate to your home folder.

cd ~ 

Check device identifier of your USB device:

lsblk 

Mount USB device at ./usbstick and install the package:

mkdir usbstick
sudo mount /dev/sdX1 ./usbstick
cd usbstick
dpkg --install armbian-firmware-full_*.deb

Replace sdX1 with your device identifier.

 

install USB LTE dongle

Armbian has a default setting that treats USB LTE Dongles as mass storage devices. However, in order for the dongle to be recognized as an Ethernet device, it needs to be switched from mass storage mode to network mode. To achieve this, we will need to install and configure usb-modeswitch.

sudo nano /etc/usb_modeswitch.conf 

Paste the following:

# Huawei E353 (3.se) and others
TargetVendor=0x12d1
TargetProductList="14db,14dc"
HuaweiNewMode=1
NoDriverLoading=1 

Install usb-modeswitch:

sudo apt-get update
sudo apt-get install usb-modeswitch 

Switch dongle to network mode:

sudo usb_modeswitch -v 12d1 -p 1f01 -c /etc/usb_modeswitch.conf 

You can now check if mass storage is removed:

lsusb 

https://askubuntu.com/questions/757638/can-not-connect-huawei-e3372-modem-on-ubuntu-15-10-please-help
https://installati.one/install-usb-modeswitch-ubuntu-20-04/

 

armbian commands

Configure system, network, timezone, language, hostname, keyboard, etc:

armbian-config 

Check temperature of SoC:

armbianmonitor -m 

Get boot logs for inspection and automatically upload it to an online pasteboard service:

armbianmonitor -u

 

backup SD card

  1. Identify the SD Card: First, you need to identify the device name of your SD card. You can use the lsblk or fdisk -l command to list all storage devices and identify the SD card.
  2. Backup with dd: Use the dd command to create a raw image of the SD card. Here's an example command:
    sudo dd if=/dev/sdX of=/path/to/backup.img bs=4M status=progress
    Replace /dev/sdX with the actual device name of your SD card and /path/to/backup.img with the desired backup location and filename.
  3. Restoring from Backup: To restore the backup to a new SD card, you can use either balenaEtcher or a similar command in reverse:
    sudo dd if=/path/to/backup.img of=/dev/sdX bs=4M status=progress

     

android stock firmware

x96

Tanix

Ugoos

Vontar

Mecool

Edited by queeks
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines