2ND UPDATE - Success Running Twister OS Armbian on VIM3! Fan and AUDIO

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:

  1. Usual download img.xz file from hosting and burn by method of choice to MicroSD.
  2. 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 in armbianEnv.txt that I forgot to change to amlogic - but still booted successfully to full, desktop operation.
  1. Insert the MicroSD containing the Twister OS image in the VIM3, and boot normally.
  2. Enjoy!

What doesn’t work?

  1. ̶S̶o̶u̶n̶d̶. There’s a dummy output device, I haven’t yet tested external audio setups. FIXED - SEE UPDATE 2, BELOW.
  2. 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.

  1. The configuration files need to be copied and named correctly
  2. The ALSA sound system needs to be initialized with a script in /usr/bin each boot
  3. 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.

5 Likes

FYI: The Twister OS link for downloading their firmware image with checksums is here. Included are the full system description and instructions for flashing to intended RK3399 targets like Odroid, Pine, etc.
https://twisteros.com/twisterarmbian.html

2 Likes

APRIL FOOLS - IGNORE
I’m not myself a gamer, but what salva has done with Twister OS on RPi is stunning. He’s got Cyberpunk 2077 running on an RPi 4, in this video. 4K full motion.

The VIM3 won’t strain at this! What Khadas needs is a 4MB RAM VIM3L “Pro” - without the NPU.

https://www.youtube.com/watch?v=HTTFu0CXtsM

April fool is over so please don’t spread misinformation. Cyber 2077 cannot run on rpi4 or any such arm sbc. Thanks

P. S. This video is probably stadia or xbox live etc type of service. This is not something specific to any sbc. It was apparently an April fools video from PI labs.

By the way welcome to the community, sorry if my wording is harsh.

1 Like

Haha! I guess I got fooled! Thanks!

1 Like

Hi jeremiah,

Thanks for sharing the detailed procedure. Appreciated.

I’ll test as soon as i receive my board in hopefully a couple of days

Regards
Yasir

I doubt this as they have not shared any source till now. Even though salva and team is doing a good job but the way they do it is not a good way.
Including libwidevine in the repo is illegal and on explaining this to them they banned me from their discord which anyways is of no use to me being there. Not to forget that they used the chromium-dockers pkged and updated by me and the main developer who worked on it.

As said above this is illegal and if caught it will lead to legal trouble, hence we at Manjaro ARM Project don’t provide the binary directly.
Salva’s answer to this was he doesn’t care about the legality as Google cannot do anything to twister as it is not a company, forgetting that the hardware manufacturers are a company and if they host libwidevine binary then they can get in trouble too.

I am happy that they’re having good progress with Twister OS while re-using most of the work done by others. Good to see someone putting the effort in having a ready to use OS for gaming.

Good steps but too much to run an OS and maintaining the same will be hard too.
Good Luck with the project.

2 Likes

I agree with you @Spikerguy Illegal stuff should not be promoted even if it is convenient. Vim3 is a Google reference board and we have great official support from manjaro team too. Plus vim3 mainline support and panfrost is also getting better and better.

Also Igor @igorp mentioned that armbian is maybe considering to improve official support for khadas boards. In such a positive environment, i totally agree that bringing illegal components and modified non open source OS can breed trouble.

It can remain a hobby for them personally, but promoting it seems detrimental to the overall scene.

2 Likes

@Spikerguy I banned you bc you commanded something to my team (and was quite rude) for the second time in a row. We dont include libwidevine like on the past, only an script that installs it on a chroot (like many scripts on pine64/armbian forum) even on the old image of pbp.

Also, I am okay with your magnificent work, but arch its a very unfirendly linux family to my purpose… so I did not care a second…

This is not an official armbian image by any means. People worried about nonsenses should use plain armbian (that works amazing but its not that well known). At the end we promote armbian platform as desktop!

You are a developer @Spikerguy . Its very stupid to say we do not include source code when there is no compilable source code at all for us neither. Everything is “there”. The themes are not “compilable”, you can find them quite easily, including the scripts . At this point I dont know what you are talking. We have people like monka that also make unofficial Manjaro builds woth the twister themes… its quite easy to drag them… and we do not care, they can, the same we can not take care on making repos publishing something that already is available from the image. We wont loose time on nonsenses.

Also, I dont understand how much “legal” its to let people to extract libwidevine from chromeOS to use it without chromeOS to use it outside chromeos (that’s nochromeos too???) compared to just sharing the library (not included, just on the repo). Also, we are planning to use the vivaldi script available on github bc its far more efficient than your chroot implementation.

Take care on Manjaro buddy.

Who am I to command anyone including my team members, In open source there is no commanding.

It is stupid to think others are stupid, Just because you don’t want to document anything and do not want to share how to package stuff doesn’t mean that anyone can find source from the upstream content you use. You lie that it is an open source project when you don’t even share a single source of how you build the pkg. Never mind I am not interested in that anyways.

So you’re saying those who maintain codes which you reuse are wasting their time on something “Nonsenses”.

Thank you for the reply, The tone of your reply speaks a lot anyways.

Hahaha only if you have read vivaldi’s implementation. I already wrote to the person who wrote that script for vivaldi that they have mistaken hardware arch with the chromeos arch. They still ship 32bit os on 64bit hardware.

Anyways good luck with your project.

I can’t help but think that all of this contentiousness and difference of opinion could be discussed with greater willingness to collaborate, and a slower tendency to respond acrimoniously. It’s disappointing.

There are definitely larger issues about the packaging of IP, and the legal compliance with agreements for software licensing terms, such as those for Google’s proprietary binaries. Discussing the non-technical aspects is beyond the scope of a forum post for implementation guidance. I do think that calling a possible abuse of licensing terms, “breaking the law” is inaccurate and unnecessarily inflammatory. Unlike engineering, law, jurisdiction, intent and ownership are not binary calculations, and in the United States, much of this is not resolved, even though the DMCA was made a federal law in 1995.

As indicated, this is now moot regarding the presence of widevine libraries in the distributed binary system images!

Either way, I hope I have made successful configuration of Twister OS, and indeed, Armbian itself, easier for users of all experience levels. Again, I graciously thank all of the contributors for their efforts - those named and many not specifically identified earlier.

1 Like

Dear @Spikerguy . Yes, TwisterOS on RPI have a major userbase compared to manjaro on RPI. We are planning to do the same on rk3399. I did not said you were stupid. You just said something quite stupid. Yes, the themes are openly available to be used/drag/etc from the image we make. maybe not as clean as you like… but user friendly, something that manjaro isnt. We dont provide compiled software that its not available from github (for most parts). We never claim that software its entirely developed by us (the emulators are the most obvious example). We said that quite clear on the readme. This was made by multiple open source projects, even your chroot implementation that waste a lot of space from the hard drive. If there is a 64 bit libwidevine that works on arm linux we would love to know (but chromeOS isnt available on aarch64 afaik). But there isnt afaik and thats why you used a chroot wasting a lot of space just for widevine support. we dont add that thing preinstalled bc it waste a loooot of space just for something I really dont care that much (widevine support). bc we do multiarch we can just use vivaldi armhf (not open source, I know, but free and better performing than firefox) and provide an scrpt to do the all thing on a clean way just bc a manjaro dev… or we could just think on the user and move along your concerns… we will remove your “not amazing” implementation for now. another thing : your chroot idea its forced by the nature of manjaro not supporting armhf and multiarch. another not great idea from another not great OS.

thanks for your comments. we took your concerns quite seriously and we will remove your code.
we may publish the themes on github… maybe. but you are not a reference to us to consider twisteros less open source. our definition of open source its far different from yours (it seems). it’s not if its available on github or not, its if we only provide binaries that are not available as open source software and able to modify/edit/drag/etc… and that doesnt happens with the themes at all! we provide some software than it’s free but not open source like redream, but the most part of emulators are compiled from github (and we dont claim we dev them obviously) and the themes are not something “compiled”… they are…there. you can just drag them and we will not waste our time to publish something that it’s not “compiled” and it’s quite easy to read/modify. they are not C stuff closed in a binary that cant be read/modified! publish them on a repo at GitHub doesnt make them more open to us. it’s a just a work we dont care bc anyone with your concerns can do themes by themselves or just drag them from twisteros and modify them.

I also would like to know what the google legal team could say about your scripts bc I did not consider that clean neither! you still think we matter for google. we dont, that’s why that lib only provide low resolution drm content! if we were that important, then google would provide the lib like on potato4 (aka rpi4) and we will be happy, even on manjaro.

Good luck with manjaro arm.

You cant expect another answer than this one taking in count what you said. Its funny that you consider more legal to download cromeOS and extract the lib hahaha . we are just a mod. Not a real OS. The real thing its ubuntu/debian, then armbian. We are just a community driven image to enhance the desktop experience of ARM linux. But from there to say than we are illegal its just to far. The manners you choosed at that moment were not great and like I said, it was not the first time. I am pissed off with linux guru’s. They mostly use odroids and arch distros. I am interested on bring linux to the masses… as further away from them, the better.
I did not care that much on banned you bc as a manjaro dev you are largely not useful for us by any means, not even advicing.

@JeremiahCornelius How are we going with step 2 on your TO DO list. Any success so far booting from eMMC?

@JeremiahCornelius

Can you confirm what uboot should be in emmc for this twister os to boot via sdcard? I suppose it will need legacy uboot just like coreelec or Android… But if you can confirm, it will save me lot of time.

I have a fully working manjaro system in emmc with mainline uboot. I don’t wanna destroy it, just try twister on SD or udisk…

Yasir,
This Twister is a mainline kernel image, and the corresponding Fenix uBoot I built is also mainline, not legacy. You should be fine!

Yeah, I just finished that.Transfer to eMMC isn’t documented yet, but works great. The new uBoot copies to eMMC and provides a clean boot-experience. So far, I have left all original Khadas and Armbian startup logos intact.

It’s very fast on the eMMC. I know better speeds are possible with a USB3 connected SD-drive, but this makes a usable ARM workstation, running on internal storage.

2 Likes

Just posted a working image with mainline Fenix uBoot. Consider this a “community release”.
I will be updating on the TwisterOS Armbian Discord server soon.

Enjoy, and feedback welcome.

https://archive.org/download/twister-osarmbian-vim-3-v-2-0-1.img

1 Like

And if i want to only run this from sdcard/udisk and keep my emmc intact, i just download, flash to sd and boot using 3 press function key?

Specially asking about below instructions in 1st post:

* 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` in `armbianEnv.txt` that I forgot to change to `amlogic` - but still booted successfully to full, desktop operation.

Are they still needed?

If you have the multi-boot capable uBoot on your VIM3, this will boot straight from SD or USB, with no modifications needed to the image on the eMMC or its uBoot.

My image has all the configuration steps in the how-to, already completed. All histories, caches, logfiles and other personalization are cleaned, as you’d expect. Power management/screen disabling is turned off, as these interfered with my burn-ins. I use a NexDock as a terminal, and after a period of inactivity on the HDMI connector, it will power-off a connected SBC! I also chose a screensaver from the included collection, that complimented the default TwisterOS theme.

That said, this is provided as-is. I will help as much as time permits of course, and look for input. It works for me. :slight_smile:

By Multi boot capable, I can only assure I have mainline uboot on emmc. Ok I’m downloading the image right now, enough asking, time to test… Will report back later,

1 Like