Friday 1 December 2017

Linux on MINIX NEO Z83-4 and Z83-4 Pro

(update)

The final piece of the jigsaw is now in place for running Linux on the MINIX NEO Z83-4 and Z83-4 Pro devices with the mainline kernel now patched to support wifi, audio and bluetooth.

It has been an interesting kernel journey with:

v4.9 including the eMMC v5.0 driver required for accessing the internal storage
v4.11 including the HDMI audio driver.
v4.12 recognizing the BCM43455 wifi driver but suffered a regression with the release of v4.13
v4.13.2/v4.14 including a fix for BCM43455 wifi driver
v4.14 including a fix for the headphone audio driver
v4.15-rc1 now includes a fix for the bluetooth driver

However to run fully working Ubuntu on either device still requires additional steps.

Previously: The Canonical v4.15-rc1 mainline build was built using a patched config using default settings and does not include the changes required for including Intel ASoC Audio Drivers or the Serial Device Bus with serial drivers.

(previously)

So first it is necessary to create a new config and compile the kernel.

Update: The latest development kernel for Bionic ('unstable') now includes the required config changes and is available in the 'daily' Canonical build.

Then it is just respinning the official Ubuntu ISO using my 'isorespin.sh' script to add this kernel the compiled packages providing the latest kernel, the required UCM files and missing wifi firmware.

Unfortunately the most recent UCM file for the headphone audio driver isn't compatible so I've had to modify it specifically to work with these devices.

Also the wifi firmware file first needs to be extracted from the Windows installation where it is located at 'C:\Windows\System32\drivers\4345r6nvram.txt'.

Two additional files are required and they can be downloaded from:
and then rename 'MINIX-Z83-4_wrapper-linuxium-install-UCM-files.sh' as 'wrapper-linuxium-install-UCM-files.sh' and make it executable ('sudo chmod 755 wrapper-linuxium-install-UCM-files.sh').

Once everything is prepared the following respin command was used to create the Ubuntu ISO as shown above:

isorespin.sh -i ubuntu-17.04-desktop-amd64.iso -l "linux-headers-4.15.0-rc1-linuxium_4.15.0~rc1~linuxium_amd64.deb linux-image-4.15.0-rc1-linuxium_4.15.0~rc1~linuxium_amd64.deb" -f "linuxium-install-broadcom-drivers.sh wrapper-linuxium-install-broadcom-drivers.sh" -c wrapper-linuxium-install-broadcom-drivers.sh -f 4345r6nvram.txt -c "mv /usr/local/bin/4345r6nvram.txt /lib/firmware/brcm/brcmfmac43455-sdio.txt" -f HdmiLpeAudio.conf -c "mv /usr/local/bin/HdmiLpeAudio.conf /usr/share/alsa/cards" -f MINIX-Z83-4-chtrt5645.conf -c "mv /usr/local/bin/MINIX-Z83-4-chtrt5645.conf /usr/share/alsa/ucm/chtrt5645/chtrt5645.conf" -f MINIX-Z83-4-chtrt5645-HiFi.conf -c "mv /usr/local/bin/MINIX-Z83-4-chtrt5645-HiFi.conf /usr/share/alsa/ucm/chtrt5645/HiFi.conf"

isorespin.sh -i ubuntu-16.04.3-desktop-amd64.iso --atom -k daily \
-f 4345r6nvram.txt \
-c "mv /usr/local/bin/4345r6nvram.txt /lib/firmware/brcm/brcmfmac43455-sdio.txt" \
-f MINIX-Z83-4_usr_share_alsa_ucm_chtrt5645_HiFi.conf \
-f wrapper-linuxium-install-UCM-files.sh

At this stage it is still very early in the release cycle and there is still work to be undertaken to simplify the respinning of ISOs for these devices.

However the key point is that the mainline kernel now supports MINIX NEO Z83-4 and Z83-4 Pro devices. Meaning over time as various distros and OS migrate to the v4.15 kernel and later versions they should work flawlessly on them.

Please donate if you find my work useful using the following link http://goo.gl/nXWSGf.

46 comments:

MaxC said...

Hi Linuxium,
I have some questions, some generic some other specific to my laptop:

1. How can I apply the patch, that you install to the kernel during the isorespin process, in an already installed linux ?

2. in your post you say that audio is working on 4.14 but it doesn't work for me. It didn't work also with the kernel that come from the isorespin process.
[ 8.256512] bytcht_es8316 bytcht_es8316: ASoC: CODEC DAI ES8316 HiFi not registered
[ 8.256526] bytcht_es8316 bytcht_es8316: snd_soc_register_card failed -517

I don't know if this lines are related to the audio, but the word "CODEC" let me think that.

I tried to copy UCM files from https://github.com/kernins/linux-chwhi12/tree/master/configs/audio/ucm/bytcht-es8316 and to put them in /usr/share/alsa/ucm/bytcht-es8316 but the results when I try it are:
# alsaucm -c bytcht-es8316 set _verb HiFi set _disdev HSMic set _enadev IntMic
ALSA lib main.c:432:(execute_sequence) unable to open ctl device 'hw:bytchtes8316'
ALSA lib main.c:1698:(set_verb_user) error: failed to initialize new use case: HiFi
alsaucm: error failed to set _verb=HiFi: No such device

3. also touchpad doesn't work. The only reaction I obtained is moving 3 fingers on it. The reaction obtained is like ALT-TAB : switching by windows.
4. no battery management

Every suggestions is welcome.


Thank you.
Best regards.

MaxC

Linuxium said...

It is difficult to provide specific answers as you haven't specified your device nor included a 'dmesg' however:

1. Respinning doesn't apply any patch to the kernel so what patch are you referring to?

2. As the post is specific to MINIX NEO Z83-4 and Z83-4 Pro devices YMMV with the v4.14 kernel on different devices. Try editing the resultant file '/usr/share/alsa/ucm/bytcht-es8316' (see the comment on lines 135/136) and remove the comment hash ('#') from line 138 through to line 156 then reboot (if installed) or respin ISO with equivalent modification and post the result.

3. Have you added the Silead touchpad driver or equivalent depending on your device?

4. Dependant on device AFAIK at the moment.

Dangagi said...

Hi Linuxium, you are my saviour! I had lost the hope of installing linux on the Minix but you helped me to regain it, thank you.

Just one question: where can I find all the files you used to rebuild the ISO... I mean all .conf , because I can't find them even "googling".

I would like to build an ISO based on Lubuntu or Peppermint.
Are they preliminary or optional to make the distro works (wifi, audio, hdmi etc.)?

Thanks in advance
Gabriele

Dangagi said...

Ok, I found all files in your tutorial except:
1 - MINIX-Z83-4-chtrt5645-HiFi.conf
2 - HdmiLpeAudio.conf (can I use the one on takaswie alsa-lib github?)

SRyoung said...

This sound driver was put in to the script already so you should not need to download it

Joe K said...

Hello,
It looks like you have put a great piece of work into getting Ubuntu running on this device. I notices in you example that you used Ubuntu 17.04, will this work also for Lubuntu 16.04.3, I am a newby on this respin process, and i will have to go through your tutorial here, but before I do this I would like to know the chances for success.
Thanx in Advance for your inputs
Regards
Joe

Linuxium said...

I'm still developing what is required to respin an ISO for these devices and will post a solution later.

Linuxium said...

I'm still developing what is required to respin an ISO for these devices and will post a solution later.

strangeMinds said...

Hello Linuxium,
good job, but where can i buy or download the iso-image?

CU mike

Linuxium said...

At the moment I am waiting for Canonical to update their config used in the mainline builds however this is probably a low priority for them at the moment.

Unknown said...

Does your script add support for using the TF port on the machine? No matter how I format my SD card, I can't get Linux Mint to recognize it.

Linuxium said...

In the past there was a problem with SD cards depending on the kernel version and even with later kernels Sandisk SD cards still had problems. What kernel/SD card combo are you using?

Linux-ish said...

A couple of questions:

1. I wiped windows from my device before grabbing the firmware file. Is there another source for this?

2. Is it really necessary to rebuild the kernel? I have no idea how to do that...

Linuxium said...

1. http://www.minixforum.com/threads/z83-4-windows-10-drivers.14297/
2. Yes or wait for Canonical to patch their kernel (I've raised a request).

Unknown said...

Linixium, you're fantastic for your work on this. My wearable robotics work is waiting on a functional Ubuntu install (Ideally 16.04 for ROS Kinetic) on my Minix, and because it relies heavily on wifi for non-emergency messaging the old no-wifi constraint is not workable.

Is there anywhere specific we need to advocate for your fixes integration to be prioritized? I can point to a whole autonomous robotics class worth of minix Pros that are eagerly awaiting functional wifi, if it'd help!

Also, in your post you mention having to modify the headphone audio driver, and your respin command references multiple files I am not finding available anywhere. While we wait for the changes to make it into mainline, is there anywhere I can find the various files you respun it with?

Thank you, again!
-Hani

Unknown said...

When I run your script, I keep getting errors pertaining to files not being found. After Googling some of the names, I was able to grab a few of them, but when still cannot find the HdmiLpeAudio.conf file. Can you point me in the direction?

Linuxium said...

If everyone adds to the 'bug' report (https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1739939) that it 'affects me' the visibility will be improved.

Once the kernel config is fixed I'll either release a specific 'MINIX-Z83-4-chtrt5645-HiFi.conf' or raise a CR for the existing UCM files depending on which way works the best.

Linuxium said...

As mentioned I'm still developing what is required to respin an ISO for these devices and will post a solution later. Currrently it is dependent on the config change to be made (see https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1739939).

Unknown said...

Hello, Linuxium

I have a Z83-4, I just need to run the above steps, get the iso file and install you can get wifi, audio, Bluetooth? Thank you very much for your answer.

Thanks,
Hu

Linuxium said...

Once Canonical update their config so the kernel works I'll retest and issue updated instructions.

Linuxium said...

I've updated the instructions with the files and commands that can be used to respin an ISO with working wifi, audio and bluetooth.

Joe K said...

hi
Thanx for all infos great work!

"However the key point is that the mainline kernel now supports MINIX NEO Z83-4 and Z83-4 Pro devices. Meaning over time as various distros and OS migrate to the v4.15 kernel and later versions they should work flawlessly on them."

I have installed Lubuntu 16.04.3 plus Mainline Kernel 4.15.3, Bluetooth works but not wifi. I understood that with kernel + 4.15 the respin should be not neccessary anymore, isn't it ?

Joe K said...

I found out whats the problem the file brcmfmac43455-sdio.txt is missing in /lib/firmware/brcm/. The solution is to copy the file 4345r6nvram.txt from the Windows driver to /lib/firmware/brcm/ and rename it to brcmfmac43455-sdio.txt and reboot the device.

Linuxium said...

The respin instructions above includes this step and another step to fix audio so respinning is still required unless you do these steps manually.

Unknown said...

where?

Linuxium said...

In the post above!

Unknown said...

Hey Linixium,

First I want to say thank you. I am a total noob with this stuff and thanks to you it looks like i may be able to convert my z83-4 to a fully functional linux.

Without knowing the difficulties I would run into, I wiped windows and installed the latest version of xubuntu on my device. I have been really enjoying the OS on the whole, but I found myself without headphone jack functionality, no wi-fi, no bluetooth, and most importantly to me, no ability to turn off my hdmi connected tv monitor without it freezing my computer on a blank black screen. The reason I know it's still running is that when i go to shut it down via the z83 button I see the xubuntu screen flash quick before the shutdown is completed.

So I am a bit confused on the exact process I need to take here. Please Forgive my noobiness.

1. I download this iso? bionic-desktop-amd64.iso

2.I download your respin script - isorespin.sh

3.I download the windows drivers which I see you have posted in the comments

4. I download MINIX-Z83-4_usr_share_alsa_ucm_chtrt5645_HiFi.conf and
MINIX-Z83-4_wrapper-linuxium-install-UCM-files.sh

5. I then rename 'MINIX-Z83-4_wrapper-linuxium-install-UCM-files.sh' as 'wrapper-linuxium-install-UCM-files.sh' and make it executable ('sudo chmod 755 wrapper-linuxium-install-UCM-files.sh').

6. Now I do not know how to run your script or to apply this

isorespin.sh -i ubuntu-16.04.3-desktop-amd64.iso --atom -k daily \
-f 4345r6nvram.txt \
-c "mv /usr/local/bin/4345r6nvram.txt /lib/firmware/brcm/brcmfmac43455-sdio.txt" \
-f MINIX-Z83-4_usr_share_alsa_ucm_chtrt5645_HiFi.conf \
-f wrapper-linuxium-install-UCM-files.sh

DO i do this in the terminal and point to the exact location of the isorespin.sh and the iso? I am a bit lost at this point.

Thanks again for your help and patience.

Thanks,

Eric

Unknown said...

I installed the xubuntu beta 18.04 and it works like a charm now. doh. thank you!

-Eric

Linuxium said...

Do you understand the steps now? Step 6 above is how you run my script which you do in a terminal and use './isorespin.sh' rather than 'isorespin.sh' unless you've previously copied the script to '/usr/local/bin'. If you need the Windows file 'C:\Windows\System32\drivers\4345r6nvram.txt' then check the MINIX forums as MINIX has posted the firmware file in one of the comments.

Unknown said...

Thank you, that does clarify things. However, I did not in fact respin the iso. I simply installed the given version of xubuntu 18.04 beta. The freeze sleep/hibernate screen problem was eliminated, the headphone jack is recognized, and the bluetooth is recognized (although was so bad as to not work at all with my bluetooth speaker. I never tested it when I had Windows 10 installed previously.) The only thing that hasn't worked is the wi-fi, understandbly. I now have the txt file, and have tried to tinker around a bit to try and apply it or put it in the right place to no avail. Its honestly of no consequence to me, though, since I am hard wired in. Thanks for your help!

Eric

Linuxium said...

If you have the wifi file then simply copy it like 'cp 4345r6nvram.txt /lib/firmware/brcm/brcmfmac43455-sdio.txt' and then restart networking.

Unknown said...

Hi Linuxium, I have a Z83-4,I want to use Lubuntu 16.03, but it seems the sound cannot work, any suggest?

Linuxium said...

Can you post the output of your 'isorespin.log' together with a link to your booted 'dmesg'?

Unknown said...

You have done great work. Is there a set of instructions to get audio working on an existing 16.04 install? I am unable to run 18.04 at this time.

Thank you

Linuxium said...

On 16.04 if you upgrade your kernel to either the 'hwe' or 'hwe-edge' you should get all the necessary patches than make everything work on the MINIX NEO Z83-4 and Z83-4 Pro.

Reza said...

HI @Linuxium,

I just installed Ubuntu 18.04.1 LTS and I also went and updated the Kernel to v4.17. I found that the audio playback was defaulting to internal vs analog stereo and found a way to change the default playback device.

My issue still lies with the WiFi adapter. When i open settings, it says no WiFi adapter detected but it was working in Win10 just prior to the Ubuntu installation. I saw your guide too late and didn't grab the wifi file from WIndows but i did manage to find the brcmfmac43455-sdio.txt file somewhere and tried to get that into the driver folder and followed instructions i could find online and at your site etc without success.

Let me know what logs you need me to share with you and I'll do my best as i am new to this OS

Reza said...

found the .txt file i needed wifi is working now but Ubuntu is not recognizing the 5ghz band that my router is broadcasting. Any solutions for that? Thanks again for your guide

Linuxium said...

Did you get your brcmfmac43455-sdio.txt file from your Windows installation or somewhere else? If somewhere else that could be your problem. The required file is posted on the www.miniforum.com however this seems to have been down for a while now. Maybe drop MINIX support an email and ask them to send you the file?

Reza said...

Hey, Thanks for the response. I actually found the drivers for a clean install at this site (http://www.minisforum.com/showthread.php?tid=50) and from there was able to get the 4345r6nvram.txt file from the wireless driver folder followed your step of copying it to and changing the file name /lib/firmware/brcm/ and rename it to brcmfmac43455-sdio.txt.

WiFi works but my 5g SSID is not showing. i installed net-tools and see that some of the frequency commands shows 5g is accessible.

I have done like 10 fresh installs of Ubuntu to make everything work and i am almost there :) at the moment trying to remember how i made my default audio output the stereo analog vs internal speakers :)

Linuxium said...

As it is a different device I would still drop MINIX support an email and ask them to send you the file.

Reza said...

Will do, thanks so much for your help

Jorge said...

Hi
I am new in linux so I hope that you can give some more details. Because I cant run your indications. I have the Minix z-83-4. What I have done

1. I download this iso linuxmint-19.1-cinnamon-64bit.iso or ubuntu-18.04.1-desktop-amd64.iso (but with this I had allot of problems)

2.I download your respin script - isorespin.sh

3.I have the windows drivers - this one 4345r6nvram.txt

4. I download MINIX-Z83-4_usr_share_alsa_ucm_chtrt5645_HiFi.conf and
MINIX-Z83-4_wrapper-linuxium-install-UCM-files.sh

5. I then rename 'MINIX-Z83-4_wrapper-linuxium-install-UCM-files.sh' as 'wrapper-linuxium-install-UCM-files.sh'

6. Now I do not know how to run your script or to apply this:

isorespin.sh -i ubuntu-16.04.3-desktop-amd64.iso --atom -k daily \
-f 4345r6nvram.txt \
-c "mv /usr/local/bin/4345r6nvram.txt /lib/firmware/brcm/brcmfmac43455-sdio.txt" \
-f MINIX-Z83-4_usr_share_alsa_ucm_chtrt5645_HiFi.conf \
-f wrapper-linuxium-install-UCM-files.sh
A) Where do I put the files these files ( In what folder)? Do I need to put in the same folder the linux OS iso?

B) Each line above should be run in terminal one at a time right?

C) If the OS used is the 18.04.1 the first line should read like
isorespin.sh -i linuxmint-19.1-cinnamon-64bit.iso --atom -k daily \
or
isorespin.sh -i ubuntu-18.04.1-desktop-amd64.iso --atom -k daily \

7 - After I make a new ISO I should then install the OS again with the new ISO right?

Linuxium said...

Try using Minix's official Ubuntu image from 'https://theminixforum.com/index.php?threads/neo-z83-4-pro-ubuntu-18-04-01-build.228/'

Reza said...

Interesting. When I posted above about issues and reached out to Minix, they said they did not support anything other than Windows. very pleased to see this and thanks for updating us. I will def be giving this a try soon.

Jorge said...

I try to respin a linuxmint image (the ubuntu is not an option because is not user friendly, which is a pity)but i always get errors. Then manually i installed linux mint and all the files so minix z83-4 could work (wifi, and all the rest apparently was working properlly). However now after a wile iam getting some system craches (in two different minix box) and when this happens the audio icon is missing (i belive the problem is related with HDMI audio). Can you get me a linux mint iso image so I can properlly test the system please. Any issue has been reported regarding this system craches? It seems some sord of bug related with audio but Iam not shure untill I get a proper linux mint iso.

Linuxium said...

What errors do you get when respinning a Linux Mint image?

Post a Comment