The Twister OS teams ported the system for broad support of ARM platforms, with a principal focus on Rockchip SoC boards. jtremblant and salva 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.
Procedure:
- 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.txt
in the FAT-formatted bootpart on the SD.
- This is a simple matter of changing the line specifying the DTB tree:
fdtfile=amlogic/meson-g12b-a311d-khadas-vim3.dtb
- 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
overlay_prefix=rockchip
inarmbianEnv.txt
that I forgot to change toamlogic
- but still booted successfully to full, desktop operation.
- Insert the MicroSD containing the Twister OS image in the VIM3, and boot normally.
- Enjoy!
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 /boot/armbianEnv.txt
file:
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.
UPDATE 1:
(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:
- linux-board-package-focal-vim3
- linux-dtb-current-meson64
- linux-firmware
- linux-image-current-meson64
Then remove:
- linux-image-current-rockchip64
UPDATE STEPS:
1. Add Khadas Fenix Repository
- Edit a new file:
/etc/apt/sources.list.d/fenix.list
with the contents:
deb https://dl.khadas.com/repos/vim3/ focal main
2. Add Khadas Repository Signing Key
-
pi@twisteros:~$
wget --quiet -O - https://dl.khadas.com/repos/fenix.key | sudo apt-key add -
3. Update Package Info
-
pi@twisteros:~$
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:
pi@twisteros:~$
sudo apt upgrade
-
Last install the Armbian Linux kernel image with DTBs, and Khadas board support:
pi@twisteros:~$
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 apt
and 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:
pi@twisteros:~$
uname -a
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
/boot
should look very similar to this:
pi@twisteros:~$
ls -lah /boot
total 152M
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
6. Cleanup
On your shiny new OS, remove the Rockchip kernel, itās now taking space and time, and confusing to updates.
-
pi@twisteros:~$
sudo apt remove linux-image-current-rockchip64
UPDATE 2:
(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.
UPDATE STEPS:
1. Clone @Spikerguy Repository From Manjaro Gitlab
- Ensure you have git installed with,
pi@twisteros:~$
sudo apt install git
- Make a destination subdirectory under /home/pi for git pulls and builds,
pi@twisteros:~$
mkdir ~/builds
- Change to your new ā
builds
ā directory,pi@twisteros:~$
cd ~/builds
- Clone local copies of the Manjaro files:
pi@twisteros:~$
git clone https://gitlab.manjaro.org/manjaro-arm/packages/community/khadas-utils
2. Copy Files to Their Correct Locations
-
pi@twisteros:~$
sudo cp ~/builds/khadas-utils/g12_sound.sh /usr/bin
-
pi@twisteros:~$
sudo cp ~/builds/khadas-utils/sound.service /usr/lib/systemd/system/
-
pi@twisteros:~$
sudo cp ~/builds/khadas-utils/G12B-KHADAS-VIM3.conf /usr/share/alsa/cards/
-
pi@twisteros:~$
sudo ln -s /usr/share/alsa/cards/G12B-KHADAS-VIM3.conf /usr/share/alsa/cards/G12BKHADASVIM3.conf
-
pi@twisteros:~$
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,
-
pi@twisteros:~$
ls -l /usr/bin/g12_sound.sh
Otherwise a quck chmod wonāt hurt:
-
pi@twisteros:~$
sudo chmod a+x /usr/bin/g12_sound.sh
3. Initialize the Systemd Sound Service Unit
pi@twisteros:~$
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Åā“ÅĆā¦
TO DO:
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. Safely write image to eMMC. At the point of producing a fully working system, I will supply confirmed steps for committing a Twister OS boot image to a board with already-working uBoot.