The Twister OS teams ported the system from RaspberryPI OS to Armbian, for broad support of ARM platforms, with a principal focus on Rockchip SoC boards. jtremblant, salva and Dangeruss26 on the Twister OS Armbian Discord channel have done a great job, creating a best-performing configuration of Panfrost for the Mali GPUs.
I was able to get this running with full graphics acceleration and networking running on the VIM3 with minimal effort, which surprised the Twister OS Team. They encouraged me to post this write-up for the Khadas community.
Twister OS is a non-commercial, free open-source distribution, originally based on Raspberry Pi OS. The Twister desktop experience is enhanced with pre-packaged theme combinations for a native look-and-feel, also those of several familiar commercial systems on different platforms.
The OS specializes itself for:
- A premium end-user desktop experience, with optimized graphics acceleration.
- A rich selection of media players, gaming emulators, Steam, and x86 emulation and virtualization with WINE support.
- Included out-of-the-box capability for widevine DRM in a configured Chromium browser.
- Good integration with Android mobile phones.
Basically, Twister OS has all the Mesa and Retropie goodness you’d want and more - in a 32-bit OS.
Having run the original Twister, and its predecessor iRaspbian, on an RPi 4/4GB with success, I was interested to try the port on my VIM3, with its knockout specs. Under the covers, Twister starts with a base of Armbian for boot environment and kernel support, coupled with an Ubuntu Focal (20.04) user world - a stable and mostly compatible basis for the enhancements to standard Raspberry Pi OS.
- Usual download img.xz file from hosting and burn by method of choice to MicroSD.
- Prepare the SD for booting on VIM3 by modifying
armbianEnv.txtin the FAT-formatted bootpart on the SD.
- This is a simple matter of changing the line specifying the DTB tree:
- I had to search on the Armbian site for the correct Amlogic DTB, because oddly, there are TWO files provided for the VIM3!
- Also interesting, there’s an
armbianEnv.txtthat I forgot to change to
amlogic- but still booted successfully to full, desktop operation.
- Insert the MicroSD containing the Twister OS image in the VIM3, and boot normally.
What doesn’t work?
- ̶S̶o̶u̶n̶d̶. There’s a dummy output device, I haven’t yet tested external audio setups. FIXED - SEE UPDATE 2, BELOW.
- F̶a̶n̶. FIXED - SEE UPDATE 1, BELOW.
Overall, I give this a 9/10 points for out-of-box operation. If I solve for my fan issues, I’m likely to burn this over onto the eMMC.
Here’s the content of my current
verbosity=1 bootlogo=true overlay_prefix=rockchip # honestly, change this to 'amlogic' when you can. fdtfile=amlogic/meson-g12b-a311d-khadas-vim3.dtb rootdev=UUID=f43869ab-391c-4c4b-98c0-2663c796d171 rootfstype=ext4 # fan_mode=auto # Unsuccessful effort to pass kernel argument for fan usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u,0x1058:0x25a2:u
I think the USB entries are intended to support operation of various USB3 to SATA adaptors. I haven’t experimented with these, and are as provided.
(Or how I got the fan to work)
Other than the DTB, the Twister OS Armbian image is still configured for Rock Pi/Rock 64, etc. This is confirmed running
uname -a and it’s a tribute to Balbas, etc. with Armbian, that we run a full system this way!
Rather than determine which modules needed to be created, and modifying kernel config and headers, I realized that an appropriate set of binary packages were probably already available from the Armbian repositories via
apt methods. This has proven true. All you need to do is update a few packages:
1. Add Khadas Fenix Repository
- Edit a new file:
/etc/apt/sources.list.d/fenix.listwith the contents:
deb https://dl.khadas.com/repos/vim3/ focal main
2. Add Khadas Repository Signing Key
wget --quiet -O - https://dl.khadas.com/repos/fenix.key | sudo apt-key add -
3. Update Package Info
sudo apt update
- Everything should update package info without errors.
4. Install Khadas Support and Armbian Kernel for VIM3
First ensure all installed packages are fully updated:
sudo apt upgrade
Last install the Armbian Linux kernel image with DTBs, and Khadas board support:
sudo apt -o Dpkg::Options::="--force-overwrite" install linux-board-package-focal-vim3 linux-dtb-current-meson64 linux-image-current-meson64 linux-firmware
NOTE: Pay attention to the options to "
force-overwrite" in the apt command. The new kernel package contains a file that is also present in the existing Twister OS Rockchip kernel package, that’s needed to configure the initrd in uBoot format. If you do error on install, it’s not fatal, but you will have to
sudo dpkg --configure -a to complete installation and return
dpkg to their usable state.
5. Reboot and Enjoy!
If you followed the previous steps correctly, your VIM3 will now start as before, on Twister OS - with support for the cooling fan and LEDs.
Verify your tasty goodness with:
Linux TwisterOS 5.10.21-meson64 #21.02.3 SMP PREEMPT Mon Mar 8 07:22:00 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
A directory listing of
/bootshould look very similar to this:
ls -lah /boot
drwxr-xr-x 6 root root 4.0K Apr 3 09:31 .
drwxr-xr-x 19 root root 4.0K Mar 21 15:38 ..
-rw-r--r-- 1 root root 243 Apr 3 09:31 armbianEnv.txt
-rw-r--r-- 1 root root 1.5K Nov 25 01:33 armbian_first_run.txt.template
-rw-r--r-- 1 root root 38K Nov 25 01:33 boot.bmp
-rw-r--r-- 1 root root 3.1K Nov 25 01:24 boot.cmd
-rw-rw-r-- 1 root root 3.2K Nov 25 01:34 boot.scr
-rw-r--r-- 1 root root 224K Mar 7 23:21 config-5.10.21-meson64
-rw-r--r-- 1 root root 217K Mar 7 17:05 config-5.10.21-rockchip64
lrwxrwxrwx 1 root root 19 Apr 3 09:30 dtb -> dtb-5.10.21-meson64
drwxr-xr-x 4 root root 4.0K Apr 3 09:26 dtb-5.10.21-meson64
drwxr-xr-x 6 root root 4.0K Mar 21 13:32 dtb-5.10.21-rockchip64
drwxr-xr-x 3 root root 4.0K Apr 3 09:26 dtb-5.7.0
lrwxrwxrwx 1 root root 22 Mar 21 13:34 dtb.old -> dtb-5.10.21-rockchip64
lrwxrwxrwx 1 root root 23 Apr 3 09:29 Image -> vmlinuz-5.10.21-meson64
-rw-r--r-- 1 root root 17M Apr 3 09:29 initrd.img-5.10.21-meson64
-rw-r--r-- 1 root root 16M Apr 3 09:29 initrd.img-5.10.21-rockchip64
-rw-r--r-- 1 root root 0 Apr 3 09:29 .next
-rw-r--r-- 1 root root 4.9M Mar 7 23:21 System.map-5.10.21-meson64
-rw-r--r-- 1 root root 5.6M Mar 7 17:05 System.map-5.10.21-rockchip64
-rw-r--r-- 1 root root 25M Apr 3 09:30 uImage
lrwxrwxrwx 1 root root 23 Apr 3 09:29 uInitrd -> uInitrd-5.10.21-meson64
-rw-r--r-- 1 root root 17M Apr 3 09:29 uInitrd-5.10.21-meson64
-rw-r--r-- 1 root root 16M Apr 3 09:29 uInitrd-5.10.21-rockchip64
-rw-r--r-- 1 root root 25M Mar 7 23:21 vmlinuz-5.10.21-meson64
-rw-r--r-- 1 root root 28M Mar 7 17:05 vmlinuz-5.10.21-rockchip64
On your shiny new OS, remove the Rockchip kernel, it’s now taking space and time, and confusing to updates.
sudo apt remove linux-image-current-rockchip64
(In which audio works with correct ALSA configurations)
Getting the G12 sound device in the Amlogic Meson builds seems to be a general problem on newer Mainline kernels. It doesn’t work OOB in Fenix 5.10-rc6, and it doesn’t work in Armbian. Balbes and Hyphop almost came to blows a year ago, with this as a stone that was thrown. Meanwhile, between breadcrumbs left in the Armbian and Khadas forums - not of them really describing the complete solution - I was able to figure this out. @chewitt had working configuration contributed to LibreElec, and @Spikerguy pumped him for the details, which emerged in a couple of different threads. Notably, @Spikerguy built the configuration as a community package for Manjaro Linux, noted here: Audio on VIMx.Debian.9.stretch.server.kernel-5.5.X.mainline.emmc.kresq - #4 by Spikerguy
With this information, we are off to the races.
- The configuration files need to be copied and named correctly
- The ALSA sound system needs to be initialized with a script in /usr/bin each boot
- A provided systemd unit file is provided to run this script in the init process.
NOTICE that some of my file names and steps differ from the Manjaro package in some details. This is what I had to do to get this working for the Armbian mainline current image. This was also duplicated to enable sound for a new Fenix mainline, which is similarly broken OOB.
1. Clone @Spikerguy Repository From Manjaro Gitlab
- Ensure you have git installed with,
sudo apt install git
- Make a destination subdirectory under /home/pi for git pulls and builds,
- Change to your new ‘
- Clone local copies of the Manjaro files:
git clone https://gitlab.manjaro.org/manjaro-arm/packages/community/khadas-utils
2. Copy Files to Their Correct Locations
sudo cp ~/builds/khadas-utils/g12_sound.sh /usr/bin
sudo cp ~/builds/khadas-utils/sound.service /usr/lib/systemd/system/
sudo cp ~/builds/khadas-utils/G12B-KHADAS-VIM3.conf /usr/share/alsa/cards/
sudo ln -s /usr/share/alsa/cards/G12B-KHADAS-VIM3.conf /usr/share/alsa/cards/G12BKHADASVIM3.conf
sudo cp ~/builds/khadas-utils/G12B-KHADAS-VIM3.conf /etc/asound.conf
Make sure that
/usr/bin/g12_sound.sh is executable. It should already be, and you can check with,
ls -l /usr/bin/g12_sound.sh
Otherwise a quck chmod won’t hurt:
sudo chmod a+x /usr/bin/g12_sound.sh
3. Initialize the Systemd Sound Service Unit
sudo systemctl enable sound.service
At this point, I tried manually running the script and killing/restarting Pulseaudio, but there’s an order to these things. It didn’t work immediately, so I rebooted, as you should now - just to test the system startup for audio.
If you duplicated these steps? SUCCESS!
On a reboot with TwisterOS automatic login, you should hear the default startup chime for the configured desktop theme of your choice. Have fun. The mixer is now working from the system tray, and will describe HDMI output as “Built-in Audio”. There’s a fix to label this HDMI and distinguish it from SPDIF, but ALSA is brittle and tweaky. Let’s leave things working as they are for now!
Thanks to everyone who left their clues, and I hope you appreciate my attempts to be thorough in documenting these operations in a way that will make the best opportunity for success by users of different experience levels.
Thanks again, to the TwisterOS Team, and their encouragement in getting this written up.
₩₳ł₮ł₦₲ ₣ØⱤ ₮ⱧɆ ₲ł₣₮ Ø₣ ₴ØɄ₦Đ ₳₦Đ Vł₴łØ₦
1.E̶n̶a̶b̶l̶e̶ ̶V̶I̶M̶3̶ ̶a̶u̶d̶i̶o̶.̶ ̶T̶h̶i̶s̶ ̶i̶s̶ ̶p̶r̶o̶b̶a̶b̶l̶y̶ ̶a̶ ̶p̶r̶o̶b̶l̶e̶m̶ ̶w̶i̶t̶h̶ ̶P̶u̶l̶s̶e̶a̶u̶d̶i̶o̶.̶ ̶I̶ ̶i̶n̶t̶e̶n̶d̶ ̶t̶o̶ ̶u̶p̶d̶a̶t̶e̶ ̶w̶i̶t̶h̶ ̶s̶t̶e̶p̶s̶ ̶t̶o̶ ̶r̶e̶m̶e̶d̶y̶. DONE!
2. S̶a̶f̶e̶l̶y̶ ̶w̶r̶i̶t̶e̶ ̶i̶m̶a̶g̶e̶ ̶t̶o̶ ̶e̶M̶M̶C̶.̶ ̶A̶t̶ ̶t̶h̶e̶ ̶p̶o̶i̶n̶t̶ ̶o̶f̶ ̶p̶r̶o̶d̶u̶c̶i̶n̶g̶ ̶a̶ ̶f̶u̶l̶l̶y̶ ̶w̶o̶r̶k̶i̶n̶g̶ ̶s̶y̶s̶t̶e̶m̶,̶ ̶I̶ ̶w̶i̶l̶l̶ ̶s̶u̶p̶p̶l̶y̶ ̶c̶o̶n̶f̶i̶r̶m̶e̶d̶ ̶s̶t̶e̶p̶s̶ ̶f̶o̶r̶ ̶c̶o̶m̶m̶i̶t̶t̶i̶n̶g̶ ̶a̶ ̶T̶w̶i̶s̶t̶e̶r̶ ̶O̶S̶ ̶b̶o̶o̶t̶ ̶i̶m̶a̶g̶e̶ ̶t̶o̶ ̶a̶ ̶b̶o̶a̶r̶d̶ ̶w̶i̶t̶h̶ ̶a̶l̶r̶e̶a̶d̶y̶-̶w̶o̶r̶k̶i̶n̶g̶ ̶u̶B̶o̶o̶t̶.̶ DONE!
System image can be destructively burned to eMMC with the Armbian
nand-sata-install tool, and if the initial sectors of the eMMC are blank, this tool will also separately write my clean-booting mainline uBoot to eMMC.
UPDATE 3 - NVMe!
Thanks to @jtremblant who is a storage performance maven. He just found out how to make almost every NVMe drive work well with TwisterOS Armbian 2.0.1 on VIM3. I agreed with him, an update on this was the best place to share widely for the Khadas community.
- Update to latest mainline u-boot included on latest Krescue (4-30-21)
- Turn VIM3 off cold
- Boot krescue again: Select
krescue kbioption and then selected option number 5
"Set port mode to PCIe"
“TwisterOS Armbian 2.0.1 on VIM3 Pro was able to detect automatically all my Samsung NVMe drives( 970 plus, 860 evo, and Samsung 980 Pro), including HP EX950 M.2 512GB and Acer VT500 without using a M2X extension. There wasn’t even need to manually mount NVMe like is required with all RK3399-based TwisterOS Armbian versions.”
The mainline uBoot was updated in the last few days:
DATE: Tue, 27 Apr 2021 12:33:58 +0800
Here’s JTremblant’s NVMe speeds (USB3) for VIM3 Pro. Not bad!
Jtremblant: “427Mb/s reading speeds and 414Mb/s writing speeds for Samsung Evo 970 Evo plus on Vim3 Pro. Fully stable for copying/writing large chunks of data with 5Gb video files and over.”
New image for TwisterOS v2.02 is now available. This one smooths out some wrinkles, and should accept forthcoming TwisterOS patch updates to future versions.