New take on installing Linux on Beelink Mini MX S905 android TV box
In 2021 I have already installed Linux on my Beelink Mini MX and published an article about it here.
Now I wanted to use it and turned out that WiFi and Bluetooth is not working 😢. So I have started again and figured out, how to make it work.
Here you have the results of my experiences with CoreELEC, LibreELEC and Armbian. It was not easy, it took me approximately 2 month to get the best possible out of this little and now outdated hardware.
I have the version of Mini MX with 1 G RAM, 8 G EMMC, 1 Gigabit Ethernet and an RTL8723BS for WiFi and Bluetooth. It has the version Nexteon MINI MX_V2.0_201511116.
CoreELEC
Installing CoreELEC is rather simple, but you can only use the Legacy version. I have downloaded the 9.2.8 version which is quite outdated from 2021, but this is the one which works.
To install it, download the image, then copy it on a microSD card. I used HDDRawCopy Portable which is a very simple program, but I like it, exactly because of this.
After copying the image to the SD card you have to copy the file from the SD card /device_trees/gxbb_p200_1G_1Gbit_RealtekWiFi.dtb to /dtb.img and then the SD is ready.
Now put the SD card in the Mini MX and power it on, while holding the reset putton pushed. (The reset button is in the bottom of the device, near the power connector.) When the boot starts you can release the button and the device will boot to CoreELEC.
CoreELEC works out of the box, WiFi and Bluetooth is working. You can use it as a media player only with serious limitations, because it comes with an old version of Kodi, and some of the plugins are already not compatible (for example the media data fetcher plugin 🙁). You may try to compile the software with a newer version of Kodi, but I have not tried this.
If you want to use it as a Linux server, you can install Entware, that makes it possible to install additional packages.
CoreELEC is working well, because it uses kernel 3.14.29, which has an amlogic specific driver to handle the RTL 8723BS, and the DTB is created accordingly.
LibreELEC
LibreELEC has an up to date version which supports Amlogic S905. To start with, you should download the Amlogic Generic Box Image.
The install procedure here is very similar:
- Download the image
- Copy the image an SD card, here you can again use HDDRawCopy
- Edit the uEnv.ini file on the SD card. You should set the dtb_name=/dtb/meson-gxbb-vega-s95-telos.dtb, which identifies the dtb of the hardware
- Insert the SD card into the Mini MX
- Restart Mini MX with the reset button pressed
Editing DTB
The reason why it is not working is because this dtb is for the Broadcom WiFi and not for the Realtek WiFi version. Here we need to edit the device tree.
Device tree is a structured data, which contains information about the hardware of our device, and when Linux boots, the device drivers are looking up this file, to figure out, what hardware is present and which drivers should be loaded.
In Linux there is a command called dtc (Device Tree Compiler), which can be used to translate between binary device tree format (.dtb) and textual device tree format (.dts). If you want same simple changes you can convert the binary to textual, then edit what you need and then compile it back to binary.
Examples of compiling from binary to text and back:
dtc -I dtb -O dts -o meson-gxbb-test.dts meson-gxbb-test.dtb
dtc -I dts -O dtc -o meson-gxbb-laco.dtb meson-gxbb-laco.dts
The -O and -I gives the format of the input and output, the -o is the output file and the last parameter is the input file.
These dtb files are in the Linux kernel sources, so I took a more complex approach to edit them. I downloaded the Linux sources, then started a new device tree file, based on the vega-s95-telos. To compile the original sources you need to run a C preprocessor on the file. I used the following script to compile my file:
#!/bin/bash
cpp -nostdinc -I /srv/minimx-device-tree/linux/include -undef -x assembler-with-cpp meson-gxbb-mini-mx-1G-1Gbps-RealtekWiFi.dts meson-gxbb-mini-mx-1G-1Gbps-RealtekWiFi.dts.preprocessed
dtc -I dts -O dtb -o meson-gxbb-test.dtb meson-gxbb-mini-mx-1G-1Gbps-RealtekWiFi.dts.preprocessed
dtc -s -I dtb -O dts -o meson-gxbb-test.dts meson-gxbb-test.dtb
First run the preprocessor, then compile the file, then compile it back to source, just to have a control point, to check what got in reality compiled. /srv/minimx-device-tree/linux/ is the path where I have downloaded the Linux kernel source files.
Next after a lot of experimenting I concluded with the following dts file:
/dts-v1/;
#include "meson-gxbb-vega-s95.dtsi"
/ {
compatible = "beelink,mini-mx-realtek", "tronsmart,vega-s95", "amlogic,meson-gxbb";
model = "Beeling MiniMX 1G RAM, Gigabit Ethernet, RTL8723bs ";
memory@0 {
device_type = "memory";
reg = <0x0 0x0 0x0 0x40000000>;
};
reserved-memory {
linux,cma {
size = <0x00 0x38000000>;
};
};
system-suspend {
compatible = "amlogic,meson-gx-pm";
};
leds {
led-blue {
gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>;
};
};
};
ðmac {
amlogic,tx-delay-ns = <4>;
};
/delete-node/ &brcmf;
&sd_emmc_a {
wifi@1 {
reg = <0x01>;
compatible = "realtek,rtl8723bs";
};
};
&uart_A {
clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_UART0>;
/delete-node/ bluetooth;
bluetooth {
compatible = "realtek,rtl8723bs-bt";
host-wake-gpios = <&gpio GPIOX_7 GPIO_ACTIVE_LOW>;
enable-gpios = <&gpio GPIOX_20 GPIO_ACTIVE_HIGH>;
clocks = <&wifi32k>;
clock-names = "lpo";
};
};
I imported the vega-s95 device tree, where most of the settings were correct and then
- Changed the name of the system
- Changed memory to 1 G
- Changed led to active low (Mini MX uses a combined red/blue led, of it is high then it is red, if it is low, then it is blue, I prefer blue when it is operating normally.)
- Added the tx-delay to the Ethernet card, this is needed for stable operation
- Deleted the node about Broadcom WiFi
- Added a node for the Realtek WiFi
- Changed the uart_A settings for Realtek Bluetooth
After compiling it to binary, you have to copy the new file to the SD card and change the DTB line in uEnv.ini to point to it.
Here you can download the compiled dtb.
After changing the dtb, Bluetooth started to work, but WiFi sometimes worked sometimes not. If you try to connect with the correct password to WiFi, but it says, that the password is missing, this mean, that it is not working. I could not solve this, if you need a stable WiFi, the you can plug in an USB WiFi dongle.
The reason for WiFi not working correctly is that the RTL8723BS WiFi driver is not fully compatible with newer Linux kernels.
Armbian
Armbian is the most important operating system as this is a full fledged up-to-date server operating system.
The installation is similar to the other operating systems:
- In the site https://github.com/ophub/amlogic-s9xxx-armbian go to releases and download the version you like. Usually you can find the two latest ubuntu and debian releases and usually some different kernel versions. I have downloaded
Armbian_24.2.0_amlogic_s905_jammy_6.1.66_server_2023.12.08
where S905 is the chip on Mini MX, jammy is the 22.04 Ubuntu version, 6.1.66 is the kernel version and 2023.12.08 is the build date of the image. - Copy the image to a micro SD card
- Copy the device tree binary (dtb) discussed in the previous chapter to the dtb directory of the SD card
- Copy u-boot-s905.bin to u-boot.ext in the root of the SD card
- Edit the file extlinux/extlinux.conf
- in the line with fdt add the path of the dtb file
- remove the loglevel=1 from the line starting with append
- Insert the SD card in the Mini MX and plug in the power, while holding the reset button.
You have to remove the loglevel specification, because it seems that there is a bug in the display driver, and if you keep that setting, sometimes the log is displayed, when the display driver is not yet ready, and the system hangs at boot.
For next boots you don't need to press the reset button, the system will boot without that to Armbian.
Now Ethernet and Bluetooth is working, but WiFi is still not working, and when you tray to connect with Network Manager, the system often hangs.
What I have found is, that the RTL 8723BS WiFi driver is not compatible with Network Manager, so you have to set up the WiFi connection manually.
To do that first you have to disable the management of the WiFi interface by Network Manager, you can do that following this article: Network Manager ignore interface
Then you have to create a manual configuration:
I have followed this guide.
To scan the available WiFi network you can use:
iw wifi0 scan
To create a wpa_supplicant config, do this as root, where SSID is your WiFi name:
wpa_passphrase SSID >> /etc/wpa_supplicant.conf
Then you can start the WiFi connection with the following 2 commands:
wpa_supplicant -B -D nl80211 -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
dhclient wlan0
To make this permanent, I have created a script to start the WiFi and a Systemd service to start this script when booting the machine.
Since I did these changes Armbian is running flawlessly on by MiniMX and I can use it as a general purpose Linux server.
The plan is that I will use it to read out temperatures from Bluetooth temperature sensors and feed it into my Home Assistant system.
Good luck in setting up your device.
Comments