ТВ-приставки Amlogic
ТВ-приставки Amlogic
Общий отказ от ответственности и предупреждение
Можно установить и запустить Manjaro на нескольких доступных ТВ-боксах с Android, использующих чипсеты Amlogic, такие как процессоры серий S905, S922 и A311. Эти ТВ-боксы можно приобрести за меньшую цену, чем одноплатный компьютер аналогичного класса, в комплекте с корпусом, пультом дистанционного управления и кабелями, но есть несколько недостатков, о которых следует знать.
Рынок ТВ-боксов Android изобилует подделками и клонами. Известны случаи, когда производители повторяли название одной и той же модели, но при этом использовали другой чипсет WiFi/Bluetooth или совершенно другую SoC. Например, существует как минимум восемь версий X96 Air, но все они имеют абсолютно одинаковый корпус. Производители ТВ-приставок редко или вообще никогда не предоставляют обновления для своих ОС на базе Android и оказывают нулевую поддержку пользователям, желающим запустить альтернативные операционные системы, поэтому добиться полной поддержки для каждой приставки практически невозможно.
Качество сборки - еще одна частая проблема ТВ-боксов, особенно часто встречаются плохие тепловые характеристики. Возможно, вам придется прорезать пару отверстий в корпусе и установить вентилятор с питанием от USB над SoC, чтобы добиться максимальной производительности ТВ-бокса, но для нормального использования это не требуется. Большинство ТВ-боксов на базе Amlogic оказались достаточно надежными.
Идентификация вашей коробки
В Android перейдите в Настройки -> Система -> О телефоне.
Имя устройства, указанное в разделе О телефоне, часто является наилучшим для идентификации вашего устройства, но вы также можете выполнить:
Под терминалом Android, чтобы показать идентификатор дерева устройства бокса.
Установка
Manjaro can be installed from and to micro uSD card or USB disk. After installation it is possible to use /boot/install-aml-emmc.sh to copy your installation onto eMMC on some Amlogic TV boxes. Beelink S922x based boxes are known not to currently work with this script and there are likely other models that also won't work booting from eMMC so use the script at your own risk.
Configure uEnv.ini
After using a disk imaging tool such as balenaEthcher or gnome-disks to write one of the AM6 Plus or GT King Pro Manjaro ARM images to an SD card or USB disk, mount the disk and edit BOOT_MNJRO/uEnv.ini. You must edit the line that begins with dtb_name= to point to the dtb file that you wish to use to configure your device tree.
If there isn't an exact match dtb for your box within the dtbs folder and you can't find a suitable dtb on this wiki or in the Manjaro forums then you should try meson-g12a-x96-max.dtb, meson-g12a-sei510.dtb or meson-sm1-sei610.dtb first:
dtb_name=/dtbs/amlogic/meson-g12a-x96-max.dtb
Booting from USB
If you are booting Manjaro from a USB disk or via a USB SATA adapter/enclosure, there is a good chance that you will be required to add a usb-storage.quirks kernel parameter to the APPEND statement in extlinux.conf like so:
APPEND root=PARTUUID=5418e4d8-02 rootflags=data=writeback rw console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0 quiet splash plymouth.ignore-serial-consoles usb-storage.quirks=152d:1561:u
You must replace 152d:1561 with the correct USB vendor and product IDs for your USB device. You can find these identifiers by running lsusb when you have your disk or adapter connected to a Linux box. It is recommended you boot from USB without setting the USB storage quirks parameter where possible.
Enable multi-boot mode
If this is your first time attempting to boot from an SD card or USB disk, you must enable multi-boot mode. Insert your Manjaro micro SD card or attach the Manjaro USB disk then hold down the button in the AV port by inserting a paper clip, a pin or something similar and keep it depressed while powering the device on. Keep the button pressed until you see the boot screen of your box. After a few seconds it should reboot off your SD card or USB disk. You are only required to do this once unless you reflash your eMMC.
Reflashing Android
In emergency situations, like when Manjaro stops booting due to your bootloader having been modified or corrupted, you may need to reflash Android. If you have a suitable installation image for your box and a USB A to A cable then you can use aml-flash-tool to reflash your TV box.
WARNING You must back up everything stored on your TV box before flashing an image because all data stored on the eMMC will be wiped. Be careful to only flash images built specifically for your box or you could 'brick' your box, which means it won't boot and you can't enable multi-boot mode.
Installing aml-flash-tool
aml-flash-tool requires that you install the old (0.1.x) libusb libraries. Debian and Ubuntu users have to install libusb-dev whilst Arch and Manjaro Linux users have to install libusb-compat.
Clone the aml-flash-tool repo:
Copy aml_image_v2_packer and the amlogic update program into your path:
You are now prepared to run flash-tool.sh
Reflashing with flash-tool.sh
Disconnect the power from your TV box and plug a USB A to USB A cable into your TV box. It varies which port to use but usually only one port will work for reflashing. Now insert a pin or similar into the AV hole, depress the button and keep it pressed as you connect the USB A to A cable to your other machine. You will know when your TV box is ready to be flashed with flash-tool.sh because you will see an Amlogic device listed when you run lsusb.
When you can see your TV box is connected, you can flash it using a command such as:
Replacing X96AIR_Q1000_20210127-2121.img with the path to the image you wish to flash. You do not need to run flash-tool.sh as root.
External Amlogic TV box firmware download links
Download and flash these firmware files at your own risk! These sites and manufacturers are in no way connected to Manjaro and so the Manjaro developers will not provide any support for installing these.
Evolution TV has firmware downloads for several TV boxes.
SLIMBOX is a custom Android firmware for Amlogic TV boxes.
Rooting Android
Having root access under Android is useful because this lets you copy your dtb file(s). Whilst you cannot use Android dtbs with the Manjaro mainline kernels, you can decompile them to dts files and this info can be useful when customising dts/dtb files that work with your kernel, if you have the skills and time to dedicate towards developing or modifying device tree files.
Some TV boxes come pre-rooted whilst others include an app to easily enable root/sudo access. You can use the Android Root Checker app to test if you have root access. If your TV box doesn't offer any root support then you can use TWRP and Magisk to root it. Note this isn't a permanent root solution and you will be required to boot off a Magisk modified SD card to enable root access.
Download the latest X96 Max (u212) build of TWRP. This build of TWRP should boot on most Amlogic TV boxes, not just the X96 Max.
Format a micro SD card as FAT32 and copy the twrp image (twrp-3.5.2_9-0-u212.img) onto it and rename it to recovery.img. Insert the micro SD into your TV box then hold in the multiboot AV button in whilst inserting the power until you see the boot screen. Your TV box should then reboot into TWRP.
Swipe (drag the button with your USB mouse) to allow modifications. On the main TWRP menu, choose Backup. The only partition we want to backup is the Boot partition, which should already be selected. Deselect the Data partition if that is auto-selected then click Select Storage, choose the Micro SD card then swipe to backup the boot partition. It should only take a few seconds before you are given the option to reboot.
Next, install and run Magisk under Android. When installing Magisk, choose Recovery mode then select the Select and Patch a File method. You will then be asked to locate the backup of the boot partition we created with TWRP so navigate to SD card/TWRP/BACKUPS/1234567890/SOMEDATE/boot.emmc.win and double-click the boot partition image file then choose Let's go. Magisk will then patch the ramdisk within the boot image and create a new recovery image called magisk_patched-something.img that gets saved to your Android Downloads directory. Copy this new image file from Downloads onto a micro SD card and rename it recovery.img so that you can multiboot from it, rooted.
dtb files
A DTB file is a Linux Device Tree Blob. Device Tree Compiler (dtc) converts between the human editable device tree source "dts" format and the compact device tree blob "dtb" representation usable by the Linux kernel. A DTB file is required on ARM Linux devices to configure and enable certain types of hardware supported by the Linux kernel.
The Ugoo AM6 images use the linux-khadas kernel by default. You are more likely to get your TV box's onboard wifi working by installing the linux-odroid kernel instead.
Recommended .dtb files
This is a list of Amlogic TV boxes and the dtbs that offer the best support. Please provide a download link if the dtb is not packaged with the Manjaro vim or aml kernel.
A95X F2 - meson-g12a-u200.dtb - Boots but no ethernet, wifi or bluetooth.
Beelink GT King Pro - meson-g12b-gtkingpro-pro.dtb or meson-g12b-ugoos-am6.dtb - works with the older linux-vim 5.9.y or 5.10.y series and current mainline linux 5.12.y kernels.
X92 v2 - meson-gxm-q201.dtb
X96 Air Q1000 - meson-sm1-sei610-qca9377-bt - Tested with linux-aml kernel 5.12. Working gigabit ethernet, WiFi and HDMI audio. No support for onboard audio or LED display. Onboard bluetooth was working but it has stopped working under recent Manjaro releases.
X96 Max Plus - meson-sm1-x96maxplus-vim100m.dtb - There are several versions of the X96 Max Plus. This dtb is configured for those with the rtl8822cs WiFi chipset in which case you should get HDMI audio, WiFi, Bluetooth and 100Mb ethernet if you install the rtl8822cs DKMS kernel module package.
Useful device tree commands
Decompile dtb to dts:
Compile a dts to a dtb:
DTB extractor - Tool to split a kernel image with appended dtbs into separated kernel and dtb files.
dtb/SoC code names
This is the dtb naming scheme used for the various Amlogic SoC's, which may help you find a working dtb:
gxbb → S905 gxl → S905X g12a → S905X2 g12b → S922X gxm → S912 sm1 → S905X3
Tips and tricks
Enable graphics acceleration
Edit /etc/X11/xorg.conf.d/01-panfrost.conf and change AccelMethod from none to glamor.
The mesa Mali driver, Panfrost, is optimised for use under Wayland so you should get better GPU performance using Wayland-based desktops.
Hardware accelerated video playback
The meson-vdec kernel module offers support for decoding MPEG 1/2/4, h264, h265/HEVC and VP9 in hardware but it currently only seems to work with mpv for some codecs up to Full HD / 1080p resolution @ 30 fps, despite the hardware supporting 4K.
You can add these options to ~/.config/mpv/mpv.conf to avoid typing them every time you run mpv.
CH340-fan-control
CH340-fan-control is a python script to control a USB fan.
HDMI audio script
Some users have reported running g12_sound.sh has fixed their HDMI audio. If you are having HDMI audio issues, you will likely already have g12_sound.sh installed so run the script then:
Reboot and test!
Unbricking
If you've bricked your AMlogic TV box but suspect the hardware is still OK you could try creating a bootable recovery uSD card to or you could try using the Amlogic burn card maker tool under Windows to re-flash your firmware from a uSD card but I've not had any success with these methods.
The best bet for unbricking your TV box is to search for the location of the maskrom contact pads or pins as you can usually revive your box by shorting a couple of contact pads or chip legs on the motherboard. This requires opening your TV box which will likely invalidate your warranty, if you have one.