Micro-tutorial on how to boot/run Manjaro ARM on Ugoos Am6 Plus (s922x-j):
I have tried these steps using the image for Khadas VIM3, release 20.06 (xfce and kde) :
(1) On your PC, burn Manjaro image to SD card and edit /boot/uEnv.ini so that the FDT variable refers to the dtb file meson-g12b-ugoos-am6.dtb
(2) On the Manjaro image, also copy u-boot.sd to u-boot.ext.
(3) Boot your Ugoos from the SD card. The Ugoos has multiboot enabled by default so this should work. (Possibly you have to “activate” multiboot with the “toothpick method”. I don’t remember exactly.)
(4) After the initial configurations in the Manjaro install, you should have a running system with graphical desktop (with Bluetooth), but without WiFi and possibly without ethernet and sound. To fix these things, see below. Note: There is some form of initialization issue with the Ugoos so that reboots have to be done as cold boots (turn off power/pull plug, wait until the light goes out, and then wait some more (the light flickers once more), then restart).
Sound: If sound doesn’t work, run (as root, I guess) the script /usr/bin/g12_sound.sh You might have to reboot and you should then have some “Analog” sound source in pulseaudio (which should also route through hdmi). (See what you have with aplay -L)
Ethenernet: I have only been able to get reliable ethernet with the speed set (e.g. via Network Manager) to 100Mbit/s. (You have to configure this manually, since with the default autonegation you will probably end up with 1GBit/s, which is not reliable, at least for me. Apparently, the meson dwmac driver/glue-code (for ethernet) has been problematic and is probably not quite finished in mainline.)
WiFi: To enable the built in WiFi (the chip is brcm 4359 in a AP6398S package, shared with the Bluetooth) you need to hack the dtb (preferrably natively, on the Ugoos): Decompile (with dtc) the dtb to dts and locate the section sd@ffe03000 { …}. Edit the line
max-frequency = < 0x5f5e100 >;
to read
max-frequency = < 0x2b594d1>;
(i.e lower the clock from 100MHz to 45.454545MHz). Compile the edited dts file to dtb and install in /boot/dtbs/amlogic and update uEnv.ini accordingly (if you use a new name for the new dtb). You also need to copy (or link) /lib/firmware/brcm/nvram_ap6398s.txt to /lib/firmware/brcm/brcmfmac4359sdio.ugoos,am6.txt
The reason for the clock hack seems (since it runs at almost 200MHz on Android) to be related to a speed cap in the current mainline mmc driver: The WiFi module communicates over the SDIO bus and appears there as an mmc device; see /sys/kernel/debug/mmc0/ios (The weird clock frequency 45.454545MHz (it was the highest I could get to work) seems to be due to Amlogic and their history.)
Manjaro/Khadas-image specific hacks:
The script /usr/bin/bluetooth-khadas.sh needs to be edited to reflect the Ugoos identifier for the 4359 chip (at least as it appears after the WiFi speed hack in dtb). The correct (chip) model string is now obtained from /sys/bus/mmc/devices/mmc0:0001/device
The Manjaro image probably lacks some firmware files for video (g12a_h264.bin, g12a_hevc_mmu.bin and g12a_vp9.bin).
The khadas systemd service (khadas-utils.service) can be disabled since it only relates to fans (the Ugoos is fanless).
Bonus points: The little system led can be polled/controlled with gpioget/gpioget from the package gpiod (until the leds get supported in the dtb):
gpioset gpiochip1 11=1 (gives red)
and
gpioset gpiochip1 11=0 (blue)
(I have not been able to get the nice strong white mode going.)
Thanks to @spikerguy an the Manjaro ARM community for the great work.