Wednesday 5 October 2016

Running Ubuntu on Intel Bay Trail and Cherry Trail Devices

UpdateThis work is superseded by my 'isorespin.sh' script which can respin an official ISO suitable for use on Intel Atom devices.

Intel Atom based mini PCs currently use Bay Trail and Cherry Trail SOCs. Whilst they perform satisfactorily under Windows attempts to use Linux based operating systems have resulted in the loss of HDMI audio, wifi and bluetooth. I've attempted to address this with a series of Ubuntu ISOs and kernel patches.
Official Ubuntu releases are provided as ISO images which are single files that represent an entire CD/DVD of software. An ISO image can be written to a USB to create a 'live' USB drive that containing a full operating system that can be booted or used as installation media. Ubuntu has recognized flavours with the difference being the set of packages included within the release:

  • Ubuntu uses Unity (a graphical shell for the GNOME desktop environment)
  • Lubuntu uses LXDE (the Lightweight X11 Desktop Environment)
  • Xubuntu uses the Xfce desktop environment
  • Kubuntu uses KDE's Plasma desktop environment
  • Ubuntu GNOME uses the GNOME desktop environment
  • Ubuntu MATE uses the MATE desktop environment

Ubuntu is well suited to mini PCs as the flavours provide the option of running a fast but lightweight operating system that can take advantage of the lesser hardware specifications.

By combining recent patches and source code and porting them with Ubuntu kernel source I've created ISO images that fully support HDMI audio, wifi and bluetooth on Intel Compute Sticks. They will work on other Atom Bay Trail and Cherry Trail with varying success in part due to the functionality provided by the device's BIOS which typically affects the success of bluetooth and assuming the device has either Realtek 8723BS or other officially support wifi including Intel.  I've also included the latest patches that try to reduce the random freezes that have been known to occur.

Because the ISOs include a patched kernel to provide the missing functionality it means no automatic Ubuntu kernel updates although other application packages will update as normal. Consequently I've also developed a manual patching process where a script can be downloaded and then executed to update the kernel to match the latest releases.

I've also configured the ISOs to both run and install using either a 32-bit or 64-bit bootloader to provide the ability to easily dual-boot without needing to modify the BIOS.

Each ISO can be written to a USB using either 'Rufus' in Windows or 'dd' in Linux. The USB can then be used to boot from after powering-on the device. For installation to the device's internal storage simply run the installer and follow the on-screen instructions.

Some cautionary advice: The initial menu screen takes slightly longer to appear than with the official ISOs. Depending on the speed of the USB drive used it can be anything from fifteen to forty-five seconds before anything appears on the screen. After installing with a 32-bit bootloader booting sometimes results just in a blank/coloured (e.g. purple) screen. To prevent this and to ensure a successful boot it is best boot through the BIOS menu followed by selecting the Ubuntu option. If dual booting with Windows I recommend installing/re-installing 64-bit Windows to circumvent this issue if your device supports it.

Previous Update: Whilst two ISO sets of various Ubuntu flavours for both 16.04.1 and 16.10 releases are provided, I recommend first trying one of the 16.10 ISOs as these are the most recent and incorporate the latest kernel, patch sets and fixes based on previous releases and feedback. In particular, the Yakkety 16.10 ISO kernels support micro SD cards (although with some limitations), includes a patch for I2C bus, has improved RTL8723BS wifi and bluetooth support and most recently I've included support for full disk encryption on Lubuntu and fixed the home directory encryption for all flavours. /Previous Update


Ubuntu 16.04.1 LTS


To try an ISO download it from one of the links below (in red) and write it to a USB using either 'Rufus' in Windows or 'dd' in Linux.

Ubuntu (superseded)
Ubuntu comes with everything. All the essential applications, like an office suite, browsers, email and media apps come pre-installed and thousands more games and applications are available in the Ubuntu Software Centre.


Lubuntu (superseded)
Lubuntu is a fast, energy saving and lightweight variant of Ubuntu using LXDE. It is popular with PC and laptop users running on low-spec hardware.


Xubuntu (superseded)
Xubuntu is an elegant and easy to use operating system. Xubuntu comes with Xfce, which is a stable, light and configurable desktop environment.


Kubuntu (superseded)
Kubuntu offers the KDE Plasma Workspace experience, a good-looking system for home and office use.


Ubuntu GNOME (superseded)
Ubuntu GNOME uses GNOME Shell along with a plethora of applications from the GNOME Desktop Environment.


Ubuntu MATE (superseded)
Ubuntu MATE expresses the simplicity of a classic desktop environment. MATE is the continuation of the GNOME 2 desktop which was Ubuntu's default desktop.



Alternatively you can just download a kernel and upgrade your existing installation. Note that the disadvantage of this approach is that you will need to find and install the wifi firmware files in order to get wifi working on a Bay Trail device.

To upgrade your kernel first download the shell script for the kernel version you require and after making it executable (enter 'chmod 755 <script>') you can install it as 'root' (by entering 'sudo <script>'). Once the script has finished executing the device will need to be rebooted to use the updated (patched) kernel.

4.4.0-31.50

4.4.0-38.57

4.4.0-42.62

4.4.0-45.66

4.4.0-53.74 (update: current latest Xenial kernel - superseded)

Previous Update: Thanks to a comment from Камлаю однако (sae762) a solution to the Cherry Trail device I2C bus kernel error is now known. However when I included it as a patch in the latest build of the v4.4 kernel (4.4.0-42.62) I subsequently discovered that some Cherry Trail devices failed to boot due to new errors being encountered. As a result I have excluded my patch from the v4.4 kernels and recommend Cherry Trail device owners to either install my Yakkety 16.10 ISO with kernel updates or try upgrading to the latest Yakkety kernel (v4.8.0-26.28) using the script below. As a result the ISO kernels will not be recompile with this patch although I am still planning on re-spinning the ISOs to include other fixes I have been working on.

Starting from the 4.4.0-42.62 kernel the source now includes an earlier patch 'Reduce Baytrail eMMC/SD/SDIO hangs' which previously was available in the v4.6 and later kernels which people still said hung. This will not be back-ported to the ISOs.

I have also created a new update script 4.4.0-45.66 containing the latest Xenial kernel build which has been released to address the 'Dirty COW bug' or CVE-2016-5195 (see http://dirtycow.ninja or http://people.canonical.com/~ubuntu-security/cve/2016/CVE-2016-5195.html) which is a privilege escalation vulnerability involving a race condition in handling copy-on-write breakage of private read-only memory mappings. /Previous Update

Latest Update: I have created a new update script 4.4.0-53.74 containing the latest Xenial kernel build. As noted above this does not include the Cherry Trail I2C bus kernel solution which can be found in the latest Yakkety and Zesty builds below. /Latest Update

One issue that has been reported with Linux kernel versions newer than 3.16 on Bay Trail processors is a random freeze where the whole system hangs. Unfortunately no complete fix currently exists however if you encounter freezes an accepted workaround is to limit the processor (CPU) to a certain power state, or 'C-state', if such freezes are encountered.

Open a terminal session and enter the following command (on a single line):
sudo sed -i 's/\(GRUB_CMDLINE_LINUX=\)""/\1"intel_idle.max_cstate=1"/' /etc/default/grub
To implement the change enter:
sudo update-grub
and then reboot the system by entering:
sudo reboot
The above change only needs to be made once, typically following installation to eMMC storage.


Ubuntu 16.10


To try an ISO download it from one of the links below (in red) and write it to a USB using either 'Rufus' in Windows or 'dd' in Linux.

Ubuntu (superseded)
Ubuntu comes with everything. All the essential applications, like an office suite, browsers, email and media apps come pre-installed and thousands more games and applications are available in the Ubuntu Software Centre.


Lubuntu (superseded)
Lubuntu is a fast, energy saving and lightweight variant of Ubuntu using LXDE. It is popular with PC and laptop users running on low-spec hardware.


Xubuntu (superseded)
Xubuntu is an elegant and easy to use operating system. Xubuntu comes with Xfce, which is a stable, light and configurable desktop environment.


Kubuntu (superseded)
Kubuntu offers the KDE Plasma Workspace experience, a good-looking system for home and office use.


Ubuntu GNOME (superseded)
Ubuntu GNOME uses GNOME Shell along with a plethora of applications from the GNOME Desktop Environment.


Ubuntu MATE (superseded)
Ubuntu MATE expresses the simplicity of a classic desktop environment. MATE is the continuation of the GNOME 2 desktop which was Ubuntu's default desktop.



Alternatively you can just download a kernel and upgrade your existing installation. Note that the disadvantage of this approach is that you will need to find and install the wifi firmware files in order to get wifi working on a Bay Trail device.

To upgrade your kernel first download the shell script for the kernel version you require and after making it executable (enter 'chmod 755 <script>') you can install it as 'root' (by entering 'sudo <script>'). Once the script has finished executing the device will need to be rebooted to use the updated (patched) kernel.

4.8.0-22.24

4.8.0-26.28

4.8.0-30.32 (update: current latest Yakkety kernel - superseded)

Previous Update: Thanks to a comment from Камлаю однако (sae762) a solution to the Cherry Trail device I2C bus kernel error is now known and I have included it as a patch starting with the 4.8.0-22.24 build of the v4.8 kernel. This kernel already includes the 'Reduce Baytrail eMMC/SD/SDIO hangs' patch mentioned above. however all the ISOs will need to be re-spun as they contain an unpatched 4.8.0-22.24 built of the v4.8 kernel.

I have also created a new update script 4.8.0-26.28 containing the latest Yakkety kernel build which has been released to address the 'Dirty COW bug' or CVE-2016-5195 (see http://dirtycow.ninja or http://people.canonical.com/~ubuntu-security/cve/2016/CVE-2016-5195.html) which is a privilege escalation vulnerability involving a race condition in handling copy-on-write breakage of private read-only memory mappings.

I have also re-spun the ISOs and the above links now point to the updated ISOs. These ISOs include the 4.8.0-22.24 build of the v4.8 kernel patched with the solution to the Cherry Trail device I2C bus kernel error. I've also included support for full disk encryption on Lubuntu and fixed the home directory encryption for all the Ubuntu flavours. I recommend that after installation the kernel update script (4.4.0-45.66) should be applied to upgrade to the latest kernel. /Previous Update

The Yakkety kernels brings SD card support to Cherry Trail devices although Sandisk card support is not complete and can fail completely. The random freeze issue is still present so if you encounter freezes use the workaround above to limit the processor (CPU) to a certain power state, or 'C-state'. Some devices hang on reboot or halting without powering off. The exact cause for this has not been identified. If bluetooth fails to initialize then toggling the device's power and rebooting has been found to work. Any other functionality issues should be re-checked using the equivalent official ISO as they maybe existing bugs or deficiencies.

Latest Update: I have created a new update script 4.8.0-30.32 containing the latest Yakkety kernel build which includes the Cherry Trail I2C bus kernel solution.

I've also built the first fully patched Zesty kernel update script 4.9.0-8.9 which may be of interested:

4.9.0-8.9 (update: current latest Zesty kernel - superseded)

This can be tested with either 16.04 or 16.10 as the official 17.04 release will not be available until April next year.

Finally to get audio running on a Mini PC with a headphone jack using the RT5640 codec (for example Tronsmart Ara) simply:

  1. Open the URL https://github.com/plbossart/UCM in a browser
  2. Click the green coloured 'Clone or Download' button on the right and download as a 'zip' file
  3. In a terminal window go to the download directory and enter 'unzip UCM-master.zip'
  4. Install by entering 'sudo cp -rf UCM-master/bytcr-rt5640 /usr/share/alsa/ucm'

Then reboot, plug in your headphones and select sound using 'Sound Settings' and choose 'Headphones playback'.  /Latest Update


Ubuntu 17.04 Alpha

Breaking News:

Pierre-Louis Bossart has been rewriting the HDMI audio patches with the intent to replace them entirely with a new HDMI LPE audio driver which enables support for HDMI LPE audio mode on Bay Trail and Cherry Trail devices when an HDaudio controller is not detected.

Once the driver has been approved upstream by the GFX team it will hopefully be mainlined possibly as early as 4.11.

Latest Update: I have been pointed to a set patches that better address the Cherry Trail PUNIT semaphore issue. They are from the Linux I2C development team and are currently ready for review. Consequently I've updated my 4.9 kernel and they are now included in both my kernel update script and 17.04 Alpha 131219 ISOs. /Latest Update

In order to ensure the success of this work I would like to provide feedback on any issues encountered through the early adoption of the driver. So I've decided to build my 4.9 kernels using this driver and provide kernel upgrade scripts to allow anyone to test on their own devices. I've also respun a recent daily Ubuntu Alpha build ISO so that the kernel and driver can be tested independently of whatever is currently installed.

4.9.0-11.12 (patched Zesty 4.9 kernel with including new HDMI LPE audio driver - superseded)

Ubuntu 17.04 Alpha 131216 (Daily Build) ISO (superseded)
Ubuntu comes with everything. All the essential applications, like an office suite, browsers, email and media apps come pre-installed and thousands more games and applications are available in the Ubuntu Software Centre.


In order to build up a list of what devices work with the new driver and document any issues identified please add a comment below detailing your experiences.

Reporting Issues

The best way to help when making a comment is to include the name of your device and a copy of the output from 'dmesg' (which is basically a log of kernel messages). The easiest way to share the log is by using the 'pastebinit' command (see https://help.ubuntu.com/community/Pastebinit). After installing the command by entering 'sudo apt install pastebinit' you can share the kernel messages log by entering 'dmesg | pastebinit'. This will paste a copy of the output from 'dmesg' to Ubuntu's Pastebin and provide an URL to access it.

So when reporting an issue please include:


/Breaking News



Ubuntu 16.10 Beta 2 (superseded)


The Beta 2 images and earlier are superseded by the final images above. The following section remains as an archive only.

The Ubuntu team has just announced the final beta release of Ubuntu 16.10 Desktop, Server, and Cloud products. Codenamed "Yakkety Yak" 16.10 the beta release also includes images for the Kubuntu, Lubuntu, Ubuntu GNOME, Ubuntu Kylin, Ubuntu MATE, and Ubuntu Studio flavours.

So I've created an Ubuntu 16.10 Beta 2 ISO suitable for Intel Atom devices. It can be downloaded from here and used as LiveUSB or it can be installed. Similarly I've created a Lubuntu 16.10 Beta 2 ISO here together with Yakkety kernel upgrade scripts:

4.8.0-14.15

4.8.0-17.19 (current latest Yakkety kernel)

The Yakkety kernel brings SD card support to Cherry Trail devices although Sandisk card support is not complete and can fail completely.

If installing the Lubuntu 16.10 Beta 2 ISO on the original Ubuntu Intel Compute Stick (STCK1A8LFC) you will loose the initial F10 boot option. The NVRAM entry the system creates doesn't match the installation as with the v4.8 kernel and ZRAM the storage device becomes /dev/mmcblk1. You can still manually boot by going through the EFI shell (once enabled in BIOS) and you can fix by deleting and then recreating the correct boot entry using 'efibootmgr'. So if you didn't understand this paragraph don't install it on the STCK1A8LFC and wait for me to find either a simpler solution or provide some additional instructions.

Acknowledgements:  Canonical Ltd. (Ubuntu), Pierre-Louis Bossart (HDMI audio), Linuxium (v4.8 HDMI audio), Daniel Bilik (C-state), Bastien Nocera (WiFi) and Larry Finger (Bluetooth).

Source code: GitHub (Linuxium).

Sunday 2 October 2016

Ubuntu 16.10 Beta 2 for Intel Baytrail and Cherrytrail Devices

UpdateThis work is superseded by my 'isorespin.sh' script which can respin an official ISO suitable for use on Intel Atom devices.

I've decided to re-spin my Ubuntu 16.10 Beta 2 ISO with a kernel that supports HDMI audio and wifi on any Intel Baytrail or Cherrytrail device. The kernel and ISO were developed for Intel Compute Sticks and this version hasn't been extensively tested on multiple devices simply due to the fact that I don't own them! As your mileage may vary depending upon device there are two options available.

The first option is to download my ISO and write to a USB (use 'Rufus' on Windows or 'dd' on Linux). You can then try Ubuntu and/or perform a fresh installation.

Ubuntu 16.10 Beta 2 ISO


The second option is to download just my kernel and upgrade your existing installation. First download the shell script and after making it executable (enter 'chmod 755 linuxium-install-yakkety-kernel-4.8.0-14-linuxium-linuxium.sh') you can install it as 'root' (by entering 'sudo ./linuxium-install-yakkety-kernel-4.8.0-14-linuxium-linuxium.sh'). Note that the disadvantage of this approach is that you will need to find and install the wifi firmware files in order to get wifi working on a Baytrail device. This is something I can look at fixing later.

Additionally I've released an upgraded kernel: 4.8.0-17.19 called 'linuxium-install-yakkety-kernel-4.8.0-17-linuxium-linuxium.sh' which can be downloaded for those wishing to be on the very latest release. Another thing I can look at removing is the abundance of the text 'linuxium' at a later stage.

Acknowledgements: Canonical Ltd. (Ubuntu), Pierre-Louis Bossart (HDMI audio), Linuxium (v4.8 HDMI audio), Daniel Bilik (C-state), Bastien Nocera (WiFi) and Larry Finger (Bluetooth).

Saturday 1 October 2016

Second Beta for Ubuntu 16.10 (Yakkety Yak) on Intel Compute Sticks Released

UpdateThis work is superseded by my 'isorespin.sh' script which can respin an official ISO suitable for use on Intel Atom devices.

The Ubuntu team has just announced the final beta release of Ubuntu 16.10 Desktop, Server, and Cloud products. Codenamed "Yakkety Yak" 16.10 the beta release also includes images for the Kubuntu, Lubuntu, Ubuntu GNOME, Ubuntu Kylin, Ubuntu MATE, and Ubuntu Studio flavours.

So that Intel Compute Stick owners do not miss out I have re-spun the official Ubuntu and

Ubuntu 16.10 Beta 2 Intel Compute Stick ISO

Lubuntu ISOs to include a modified kernel that supports HDMI audio and wifi on all Intel Compute Stick models which can be downloaded by clicking on the captions below the images.

Lubuntu 16.10 Beta 2 Intel Compute Stick ISO

The included kernel 4.8.0-14.15 can also be downloaded as an upgrade script by clicking on the link and installed after making it executable (enter 'chmod 755 linuxium-install-yakkety-kernel-4.8.0-14-linuxium-ics.sh') and then running it as 'root' ('sudo ./linuxium-install-yakkety-kernel-4.8.0-14-linuxium-ics.sh').

Additionally I've released an upgraded kernel: 4.8.0-17.19 called 'linuxium-install-yakkety-kernel-4.8.0-17-linuxium-ics.sh' for those wishing to be on the very latest release.

Acknowledgements: Canonical Ltd. (Ubuntu), Pierre-Louis Bossart (HDMI audio), Linuxium (v4.8 HDMI audio), Daniel Bilik (C-state), Bastien Nocera (WiFi) and Larry Finger (Bluetooth).