I was moving some things at home and I found two old TV-Boxes. Right at the same time I thought how cool it would be if I could run Linux on them and make a clustered home server.
I started searching on Google "how to run linux on MXQPRO" and found a guide on Armbian's forum.
Basically, the guide above covers all the steps and different possibilities, but I will reproduce it more shortly with some more practical steps.
It is good to say in advance that I had one faulty board and I couldn't make it run. But at least I tried (a lot).
Discovering which hardware I have
According to the post on Armbian's forum, it is good to know which chip I have (RK3228a, RK3228b or RK3229) and must know the flash memory type (NAND, eMMC or eMCP), because the steps differ for boards with NAND memory. I decided to open both boards to check it. It was also necessary to remove the heat sinks in order to see the chips (and their names).
By a twist of fate, I have completely different specs on each board:
Board 1 [S905w]
It is written "MXQ_W_EMCP_V1.2" and a date of "2021-07-15", so I can conclude it is using eMCP.
After removing the heat sink, I could see that I have an "Amlogic S905w" and a "Kingston 08EMCP08-NL3DT227" (link), that is an 8GB eMMC plus 8GB DDR3 RAM (but after some further testing, it seems to be only 1GB RAM).
That is a problem! I was thinking I had two different flash types and CPU versions, but I have two different flash types and two different processors, so I can't even use the same preset image. For this one, I will need to use a different image: https://www.armbian.com/soc/s905w/;
Board 2 [RK3229]
The other one has just "R329Q_V7.0" and a date of "2019-04-18". Also, there is a paper label with "RK3229G-B" (with another date). So, I can easily know the chip, but not the flash memory type.
By checking what is written on the components, I have a "PFF62 - 10AL" (I didn't find a spec link, just this tablet's link referencing to a SpecTek NAND: link) and 4 * "NT5CB512M4BN-CG" (link), a 2GB DDR3 RAM (that sums to 8GB);
I was a little bit unlucky for having this board, because NAND flashes require more specific treatments.
Also, when I used to use this board (with the Android OS), it constantly restarted after a random period of usage - and I have forgotten that. During the process, I remembered this problem and realized that won't be possible to use this board. But all the steps to make it run will be written here.
Burning the image for Board 1 (S905W)
The guide present on Armbian's page for S905 seems to be much simpler than the one for RK3229: just make a bootable SD Card and boot from it. To install the OS in the internal flash storage (that is an eMMC chip), there is a script shipped with the image that must be executed after the first boot. Unfortunately, among all the Amlogic chips supported by this image, S905 is one on the list that doesn't allow installing Armbian in flash storage, making it necessary to always boot from the SD Card.
Steps:
- Download an image from https://www.armbian.com/amlogic-s9xx-tv-box/ (I chose the "Noble" version for being the smallest one);
- Alternatively, you can download images directly from the Github's repo: https://github.com/ophub/amlogic-s9xxx-armbian/releases (find a package with the "s905w" in the name);
- Burn the image into the SD card using Etcher (https://etcher.balena.io/);
- While the MXQPRO board is still turned off, plug the SD Card into it;
- Start pressing a button that is placed inside/behind the "AV" jack (you will need something thin that doesn't conduct electricity like a toothpick), then plug in the power cord;
- Armbian will start and you will be prompted to create an user and a password;
For other Amlogic CPUs (not including the s905 as said before) there is the extra step of installing Armbian into the flash storage by running the script: /root/install-aml.sh
.
Burning the image for Board 2 (RK3229)
This board was more difficult in many ways. The tutorial I followed recommends to install a bootable image on SD Card (that is not the OS itself) to "control" the installation of the image itself.
Since this board uses a NAND, it requires a legacy image build (that is harder to find). It is also required in some situations to upgrade the firmware. Both steps will be written below.
[Optional] Upgrading the firmware
There is a guide also available at the Armbian's forum.
Steps:
- download and build the rkflashtool: https://github.com/rk-unofficial-cfw/rkflashtool:
git clone https://github.com/ilmich/rkflashtool/
- run
make
inside the cloned folder;- it will be probably needed to install libusb (on ubuntu:
sudo apt-get install libusb-1.0-0-dev
)
- it will be probably needed to install libusb (on ubuntu:
- disconnect all peripherals from the board (hdmi, sdcard, usb... and also the power cable), plug it into the computer with a male-to-male USB cable into the OTG port (the USB port on the same side as the HDMI);
- run
lsusb
on the computer and confirm that there is a device with ID2207:320b
; - erase the flash memory by running:
./rkflashtool e 0 8192
(all calls to rkflashtool requires sudo because it runs the libusb lib); - remove the usb cable, wait some seconds and reconnect it in order to restart in maskrom mode;
- for me, it didn't worked, so I ran the command
./rkflashtool b 3
to force restarting in maskrom mode;
- for me, it didn't worked, so I ran the command
- upload the provided bootloader in
bin
folder with:./rkflashtool l bin/rk322x_loader_v1.10.238_256.bin
; - update the bootloader:
./rkflashtool a bin/rk322x_loader_v1.10.238_256.bin
;
Installing armbian into the flash memory
These steps cover everything you need to write Armbian into a NAND flash as described in the forum's post. The only difference from NAND to the others (eMMC and eMCP) is an option you select while installing it.
- go to the Armbian's Releases page on Github (https://github.com/armbian/community/releases/) and search for files with "rk322x" in the name;
- in the case of NAND, it needs "legacy kernel" version, that isn't present in latest versions;
- only for NAND, it is needed to download an older version built with legacy kernel from an archive (probably the most recent is 22.02.0), such as: https://users.armbian.com/jock/web/rk322x/armbian/stable/Armbian_22.02.0-trunk_Rk322x-box_bullseye_legacy_4.4.194_minimal.img.xz;
- download the multitool (that makes it possible to burn the image into the flash) from the provided link: https://users.armbian.com/jock/web/rk322x/multitool/multitool.img.xz;
- plug a MicroSD card into the computer;
- burn the multitool into the card using Etcher (https://etcher.balena.io/);
- remove the SD Card from the computer, put on the TV Box and switch it on while pressing the button inside/behind the "AV" jack (use a wood stick and hold while plugging in to the power);
- after switched on, a message will appear with some usage terms;
- during the first boot of the Multitool, a message says that the disk is being resized. This is important to be done before copying the image itself to the SD card.
- now that the SD Card disk is resized, put the SD card back into the computer and copy the Armbian image into the folder
images
from the partitionMULTITOOL
; - after copying, repeat the same process of plugging the SD card into the device, clicking the reset button and turning it on;
- after that, a Menu will show where you can select "Burn Armbian image via steP-nand" (for NAND) or "Burn image to flash";
Final words on RK322x
I did all the steps above and was constantly seeing the board restarting at some random point. I tried a lot of things before remembering that I was already facing restarts problems with the RK3229 board before.
I tried a mix of things further than the steps above:
- power on with a higher current power supply (I connected two of them in parallel);
- edit the .dtb files under
/boot/dtb
to disable NAND in all references; - physically remove the NAND chip - yes, I did it. After removing it, the boot process started to be made directly from the bootloader on the SD card (different from the one before), but it was still failing after some time.
I did all these options and was still having the restart problem. So the verdict is that I need to stop here and throw this thing back to the box where it was previously. It probably has some fault in the memory or CPU - but at least I tried with the "less permanent" option: by removing the NAND I would still have the SD Card interface for storage; the same "backup" doesn't exist for CPU and RAM.
Conclusion
After spending some hours of my much-awaited vacation, I'm ready to say: if you have a TV Box in your house and you also want to have a home server, better continue using it as a TV Box and buy something that has a simpler setup for running Linux, like an OrangePI. The problem on the RK3229 board consumed a lot of my time and I couldn't solve it, but at least I learned a lot of things and had some fun during the journey! Talking about the S905w board - which I could install Linux on - it doesn't have enough RAM to match the minimal requirements for K3S, so running it on a Kubernetes cluster (that was my initial idea) won't work. I imagine that for simpler and single services it can work, like running the DNS Adblocker that I wrote previously. But for my use, these boards don't meet the criteria and I will write more in the future about the Kubernetes cluster using only other boards (like the OrangePIs).