This is an old revision of the document!
Table of Contents
Installing CoreELEC on the X96 Mini Android TV Box
I bought this little device for about 27 EUR in January 2022 from Aliexpress, I wish to use it as a TV Box, getting media from the LAN or from an external hard disk atthached via USB. It is based on the Amlogic S905W chip, equipped with 1 Gb of RAM and 16 Gb of flash storage.
The device is shipped with Android 9 and some apps installed on it. Among the installed apps you can find Kodi 18, Youtube, Netflix, etc. I want a better control of the hardware and of the operating system and I need only the Kodi app, so I decided to install a Kodi distribution on the SD card. Fortunately this device can boot from the SD card, leaving the original operating system on the flash memory untouched.
It seems that the best combination of Kodi and GNU/Linux operating system for this device is the one offered by CoreELEC.
From the download section I selected my options:
Device | X96 Mini |
---|---|
RAM Variant | 1G |
DTB | gxl_p281_1g |
SoC | S905W |
SD card preparation
I used mu GNU/Linux computer to prepare a 16 Gb micro SD card.
- Donwload the image CoreELEC-Amlogic-ng.arm-19.4-Matrix_rc2-Generic.img.gz and gunzip it.
- Copy the image over an SD card using the Linux command line tool dd:
dd if=CoreELEC-Amlogic-ng.arm-19.4-Matrix_rc2-Generic.img of=/dev/sdb bs=4M conv=fsync
- Mount the first partition on the SD card and copy the file device_trees/gxl_p281_1g.dtb into the root directory, renaming it to dtb.img.
First boot using the toothpick trick
The X96 Mini, like many other Amlogic devices, have an hidden reset button inside the AV jack. Get a wood toothpick, make it a bit rounded removing the tip and insert it into the AV jack, you should feel the click of the button. Do some experimentation with the device turned off until you are sure you can press it correctly.
- Remove the power jack from the device.
- Connect the HDMI cable to the TV.
- Press the reset button with the toothpick and keep it pressed.
- Connect the power jack, still keeping the reset button pressed.
- Wait some seconds until you see the CoreELEC screen. On the top-left corner you can see some writings about the ongoing writing process; you can release the reset button.
Configure the remote control
The remote control provided with my device does not work out-of-the-box in CoreELEC. I created a custom remote control keymap with the following procedure.
Connect to the CoreELEC box using SSH and stop kodi and infra-red services:
systemctl stop kodi systemctl stop eventlircd
To check if the remote is generating some events detected by the GNU/Linux infra-red subsystem, run the following command:
ir-keytable -p NEC,RC-5,RC-6,JVC,SONY -t
Press some keys on the remote; this is an example of the output when pressing the OK key on the remote:
CoreELEC:~ # ir-keytable -p NEC,RC-5,RC-6,JVC,SONY -t Protocols changed to rc-5 jvc sony nec rc-6 Testing events. Please, press CTRL-C to abort. 496.280087: event type EV_MSC(0x04): scancode = 0x113 496.280087: event type EV_SYN(0x00).
It turned out that my remote is using the NEC protocol (just experiment with the -p option above).
To get a list of valid button names run the command:
irrecord --list-namespace
The buttons that I mapped from my remote are:
KEY_0 ... KEY_9 KEY_LEFT KEY_RIGHT KEY_UP KEY_DOWN KEY_ENTER KEY_ESC KEY_MUTE KEY_BACKSPACE KEY_VOLUMEDOWN KEY_VOLUMEUP
To load the new key table:
ir-keytable -a /storage/.config/rc_maps.cfg -s rc0
You can verify that the key name is associated witht the scancode, e.g. pressing the left key you should get:
CoreELEC:~ # ir-keytable -p NEC -t Protocols changed to nec Testing events. Please, press CTRL-C to abort. 9641.553993: event type EV_MSC(0x04): scancode = 0x151 9641.553993: event type EV_KEY(0x01) key_down: KEY_LEFT(0x0069) 9641.553993: event type EV_SYN(0x00). 9641.565262: event type EV_MSC(0x04): scancode = 0x151 9641.565262: event type EV_SYN(0x00). 9641.692059: event type EV_MSC(0x04): scancode = 0x151 9641.692059: event type EV_SYN(0x00). 9641.948038: event type EV_KEY(0x01) key_up: KEY_LEFT(0x0069) 9641.948038: event type EV_SYN(0x00).
Finally you can restart infra-red and kodi services:
systemctl start eventlircd systemctl start kodi