[How To] Install run Manjaro ARM on Amlogic TV Boxes with S922X - S905X3 SOC

For x96Air P3 I just want to say that after the first boot using meson-g12a-sei510.dtb we need to change the dtb to TinyUpload.com - best file hosting solution, with no limits, totaly free (this is custom made by @TheMojoMan) to be able to use Ethernet and sound

@spikerguy micro-add-howto for Ugoos Am6 plus:

After installation, following the official How To, the Ugoos will have a working desktop, ethernet connection and sound (via HDMI). Moreover, Bluetooth may be able to detect devices but might not work properly and there will be no WiFi. (Screen glitches might also be present.) In order to fix these issues, the following (five) steps can be taken:

Note; reboots must often be done on this box as cold reboots, in order to get reliable results.

  1. Fix1 (SDIO clock): Decompile, edit and recompile the dtb as follows (a ready-made dtb is linked below). In the decompiled dts file, locate the section sd@ffe03000 { …}. There, edit the line
    max-frequency = < 0x5f5e100 >;
    to read
    max-frequency = < 0x2b594d1>;
    (This will lower the SDIO clock from 100MHz to 45.454545MHz.) Recompile and install the dtb (and edit accordingly in extlinux.conf).
  2. Fix2 (name of firmware file):
    cp /lib/firmware/brcm/nvram_ap6398s.txt /lib/firmware/brcm/brcmfmac4359-sdio.ugoos,am6.txt
  3. Fix3 (Bluetooth): The device number for the Bluetooth chip must be adapted to the Ugoos. The device will appear (after the SDIO fix above) as /sys/bus/mmc/devices/mmc0\:0001/mmc0\:0001\:1/device. This must be edited in the file /usr/bin/bluetooth-khadas.sh, along with the edits marked by ### (triple hashtag), like so:
Summary
#!/bin/bash

linux_ver=`uname -a | awk '{print $3}'`

###if linux-version compare $linux_ver ge 4.12; then
        ## Mainline kernel
        model=`cat /sys/bus/mmc/devices/mmc0\:0001/mmc0\:0001\:1/device`
        bt_tty="ttyAML1"

        exit 0
###else
###     ## Legacy kernel
###     model=`cat /sys/bus/mmc/devices/sdio:0001/sdio:0001:1/device`
###     bt_tty="ttyS1"
###fi

/usr/sbin/rfkill block 0
/bin/sleep 2
/usr/sbin/rfkill unblock 0

FIXME Delay

/bin/sleep 1

Attach HCI adapter

/usr/bin/hciattach -n -s 115200 /dev/$bt_tty bcm43xx 2000000

  1. Fix4 (CPU speed governor): The governor schedutil with explicit frequency settings can be installed and utilized as follows: (This is one way of fixing the screen glitches.) Install the cpupower package pacman -S cpupower Edit the following lines of /etc/default/cpupower like so:
Summary
# Define CPUs governor
# valid governors: ondemand, performance, powersave, conservative, userspace.
governor='schedutil'

# Limit frequency range
# Valid suffixes: Hz, kHz (default), MHz, GHz, THz
min_freq="1000MHz"
max_freq="1.99GHz"

Enable the associated systemd service: systemctl enable cpupower --now

  1. Reboot and check.

Notes:

  • A ready-made dtb with the edit above is here; meson-g12b-ugoos-am6-SDIO45MHz.dtb.
  • Sometimes the ethernet is unreliable when using default settings and 1GBits/s speed. (This is apparently an ongoing issue across many amlogic boards.) Setting the speed (e.g. in Network Manager) to 100MBits/s fixes this.
  • The khadas-utils service can be disabled (since it controls fans, and the Ugoos is fanless): systemctl disable khadas-utils.service --now
  • The analog output/mic does not work. The Ugoos Am6 plus has a rt5651 analog audio chip which is supported in the mainline kernel but not (yet) in the corresponding dtb.
  • For more info about these and similar tweaks, see the Manjaro ARM on TV Box thread.
  • Edit: The Alsa sound card definition shipped with the Manjaro VIM3 image is in the file /usr/share/alsa/cards/G12B-KHADAS-VIM3.conf There is a corresponding file (due to LibreElec) for the Ugoos named G12B-UGOOS-AM6.conf which will create a different set of audio devices in pulseaudio (e.g. S/PDIF outputs). It is included in some other distros.
1 Like

Thank you for the details instructions.

These won’t be needed once I receive the sample device from ugoos next week as I will create a ready to flash image for it with all the needed optimization.

Happy to have you in the community to help other users. :slight_smile:

1 Like

I’m using meson-g12a-sei510.dbt on Tanix TX3.

1 Like

I have 4GB/64GB version of X96 Max Plus, It has Gigabit Ethernet, dual band wifi and BT 4.0, I want to use it as a headless server.
I followed the instructions above and managed to boot using meson-g12a-x96-max-rmii.dtb, but ethernet (RTL8211f), wifi-BT (RTL8822CS), IR and usb 3.0 does not work.

  • Is there any dtb available for this box?
  • Is there any minimal/server image available?

Thanks

Hello and welcome to the forum.

Yes as per @TheMojoMan he got it to work with this dtb meson-sm1-sei610.dtb
As informed by him here

No but I can build one tomorrow.

Thank you for your prompt reply,
I tried that dtb, I can see in dmesg that the eth0 is detected as gigabit, it negotiates the speed with my switch, but failed at getting ip address from dhcp, setting static ip does not help, I can not ping the router, then after few seconds, it shows “connection deactivated”.

[   16.797502] meson8b-dwmac ff3f0000.ethernet eth0: PHY [0.0:00] driver [RTL8211F Gigabit Ethernet] (irq=POLL)
[   16.825178] meson8b-dwmac ff3f0000.ethernet eth0: No Safety Features support found
[   16.838497] meson8b-dwmac ff3f0000.ethernet eth0: PTP not supported by HW
[   16.853660] meson8b-dwmac ff3f0000.ethernet eth0: configuring for phy/rgmii-txid link mode
[   18.161190] kauditd_printk_skb: 25 callbacks suppressed
[   18.161197] audit: type=1131 audit(1601748793.867:37): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=bluetooth-khadas comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
[   60.298966]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.306272]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.312491]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.319198]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.326012]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.333387]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.341054]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.346455]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.353896]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.360919]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.367398]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.376100]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.381571]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.388381]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.395152]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.402583]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.410542]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.415680]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.423093]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.430052]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   60.436595]  fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0
[   21.039877] meson8b-dwmac ff3f0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[   21.042723] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 1051.033190] audit: type=1131 audit(1601749826.737:143): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ 1080.116038] meson8b-dwmac ff3f0000.ethernet eth0: Link is Down
[ 1080.252916] audit: type=1130 audit(1601749855.957:144): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ 1083.919488] meson8b-dwmac ff3f0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[ 1083.951167] meson8b-dwmac ff3f0000.ethernet eth0: Link is Down
[ 1088.086934] meson8b-dwmac ff3f0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off

Someone posted a dtb for this board in Armbian forum, tried it with Manjaro ARM, but it caused boot loop.

Thank you, appreciate it.

There is an ongoing issue (since some time) with the boards that have the rtl 8211 (search also for PHY and dwmac) and it can sometimes help to fix the speed at 100Mbit/s (e.g. in Network Manager).

1 Like

I found this topic on Armbian, someone managed to solve the gigabit issue, but I’m not sure if it works with Manjaro.

forum .armbian .com/topic/15376-methods-to-fix-x96-max-pluss905x3-gigabit-ethernet-problem
(I can’t post links, remove the spaces from url)

Thanks for the link. If I understand it correctly, the solution discussed in that thread is based on overwriting the resident bootloader which (as pointed out there) will prevent any resident Android from booting. The problem with the ethernet initialization/speed is being worked on, by several people/groups, so at least I will wait. (I’m pretty sure it will be solved/mitigated in a not too distant future.)

Thank you for sharing the link, I see that it needs a custom uboot which is not a good idea for normal users.
the overlay for 100m lan is fine. that can be patched outside.

Yes it is better to wait until a stable fix is pushed upstream.

Beelink GT King Pro works with meson-g12b-gtking-pro.dtb. Wifi, ethernet, sound available on linux-vim kernel and linux-5.9.12-3 kernel.

Good seeing more and more TV Box users on Manjaro.

2 Likes

Does it run on Gt King Pro without kernel panic or not?
Kernel version in the package list is linux-vim 5.9.0-2, where and how did you get linux-5.9.12-3 kernel.

It will work but fail with kernel panic.

This package is linux-vim which is build from balbes kernel branch.

This is upstream linux kernel with patches for supported boards

You can install it using sudo pacman -S linux linux-headers
Incase headers are needed.
Source for the same can be found on our git.

Hi Darkstar,

Kernel Panic still persist even Beelink latest firmware update 914P0 on mainline kernel. As far as I know, the linux-5.9.13-1 (sound working on GT King Pro on this kernel) is available to Manjaro Stable Branch Update (2020-12-16). In my case if I want to change kernel in the same Manjaro branch I use “pacman gui” to install the kernel.

Hi Darkstar,

I might have accidentally found a solution for GT King Pro kernel panic on mainline kernel. I am now on Manjaro_ARM-VIM3-XFCE release 20.12 but with linux-vim 5.10.1-1 and a new u-boot.ext from LibreElec for_linux-vim-5101.tar — Yandex.Disk . With this new u-boot.ext the kernel panic on GT King Pro with Mainline Kernel 5.10.1-1 seems to be resolved at least so far I have tested where with the old u-boot.ext it always causes kernel panic on GT King Pro. Please do Manjaro arm on Tv box?.

Since you have GT King Pro, if you can confirm with this new u-boot.ext from LibreElec also resolved kernel panic on your device and also to try it out on Debian/Ubuntu especially with kernel 5.10 built to see whether it is a universal solution. Look forward to input and new mainline kernel built.

Dear Spikerguy!

Thanks for your great work! I have followed the instructions above with my GT King rev. A and had the following results (Image Manjaro-ARM-kde-plasma-vim3-22-11-2020.img; balenaEtcher, 32Gb sd card)

  • I could boot from sd card without problems. I did not check all features, since I wanted to have the box as a smart home server
  • I tried to flash the installation of the sd card with the included script “install-aml-emmc.sh”. The installation ran up to “Copy USR” and stuck their
  • I tried the installation again, but it stuck at the same point even waiting for few hours
  • I booted again from the sd card and could mount the emmc partition and see the complete folder structures. I have checked carefully the boot data and all files are in
  • When I tried to run the installation from emmc with connected monitor it shows simply a black screen with no messages.
    I have been trying to run “Manjaro-ARM-kde-plasma-vim3-22-11-2020.img” and “GTKingPro_Debian-xfce-buster_Linux-4.9_arm64_SD-USB_V0.8.4-20200513” from the emmc with no success. Both worked fine out of the sd card.
    Do you have a idee, what am I doing wrong?
    Thanks

Yes,

The image is old and GtKing devices cause kernel panic when data transfer is heavy which is causing the device to get stuck.

If you want to use Manjaro on emmc then erase everything on emmc by formatting the emmc and dd the gt king pro mainline uboot image onto the emmc card.
For that you can flash the mainline uboot version image on sd and start the os and then copy thr same image to sd and flash it manually to the emmc.

I hope you understand what I mean.
Gt king pro image can be found here

Damned, completely missed this tutorial, as I was only watching the other thread.

Hopefully I’ll manage to get this going on my second X96 Air P3 (S905X3) once I finally find the time to dive in (my first X96 Air P3 is running CoreELEC in my home cinema, the second unit was supposed to be used as general purpose home server, but I held off so far because of conflicting info with mainline kernel, various DTBs and missing gigabit ethernet support).

Anyway, thanks for all the hard work put into this for making it work. There is just no cheaper way to a machine with this kind of capabiltities! :+1:

Dear spikerguy!

I have downloaded the indicated image and installed it onto the sd card. I could not find the appropriate dtb file for GT KING. I have used those dtb’s, which ran with the “Manjaro-ARM-kde-plasma-vim3-22-11-2020.img” successfully, but did not work. Which dtb file would you recommend?
which kernel version is used in Manjaro-ARM-kde-plasma-gtking-pro-Mainline.img.xz?
I have modified my script in order to follow your recommendation above, where uboot.bin is the uboot file from the image Manjaro-ARM-kde-plasma-gtking-pro-Mainline.img.xz. Is that the way it is supposed to be?

Thanks for your reply!

#!/bin/sh
if [ ! -f /boot/uboot.bin ] ; then
echo “Not found new u-boot /boot/uboot.bin !!! Stop install !!!”
exit 1
fi

echo “Start script create MBR and filesystem”

DEV_EMMC=/dev/mmcblk1

echo “Start backup u-boot default”

dd if="${DEV_EMMC}" of=/boot/u-boot-default.img bs=1M count=4
dd if=/dev/zero of="${DEV_EMMC}" bs=512 count=1
echo “Start create MBR and partittion”

parted -s “${DEV_EMMC}” mklabel msdos
parted -s “${DEV_EMMC}” mkpart primary fat32 4M 132M
parted -s “${DEV_EMMC}” mkpart primary ext4 133M 100%
echo “copy mainline u-boot”

dd if=/boot/uboot.bin of="${DEV_EMMC}" conv=fsync bs=1 count=442
dd if=/boot/uboot.bin of="${DEV_EMMC}" conv=fsync bs=512 skip=1 seek=1
sync

echo “Done”

echo “Start copy system onto eMMC.”