Sunday, 25 September 2016

Chromium OS for Intel Compute Sticks


Google's Chromium projects include Chromium and Chromium OS which are the open-source projects behind the Google Chrome browser and Google Chrome OS.  Chromium OS aims to provide a fast, simple and more secure computing experience for 'web-centric' orientated users.

I've previously tried Chromium OS on earlier Intel Compute Sticks as Google provides both the source-code and documentation to build and install Chromium OS on your own device. However I thought I'd revisit the project and incorporate the latest patches and fixes together with the most recent kernel.

The build results in an image that can be written to a USB and then booted on any of Intel's Compute Sticks giving you a pseudo Chromiumbit:

STCK1A8LFC
STCK1A32WFC
STK1AW32SC
STK2m3W64CC
Performance is dependent on your USB and with a Sandisk Ultra Fit USB3.0 for example it is pretty good:

STCK1A8LFC
STCK1A32WFC
STK1AW32SC
STK2m3W64CC
and runs YouTube at 1080p even on the basic model STCK1A8LFC:

STCK1A8LFC
Furthermore Crouton can be installed to provide a full Ubuntu OS:

STCK1A8LFC
STCK1A32WFC
STK1AW32SC
STK2m3W64CC
Interestingly whilst wifi works on each device audio is only available on the Core m devices even though the Intel HDMI driver is loaded:

STCK1A8LFC and STCK1A32WFC
STK1AW32SC
STK2m3W64CC
So it is back to using a USB audio adapter if sound is a mandatory requirement. If anyone can work out how to configure Chromium to use the Intel HDMI driver please comment below.

To try my latest Intel Compute Stick Chromium OS image you will first need to download it from here and after uncompressing it ('7z x linuxium-ics-chromiumos_image.bin.7z') write it to a USB ('dd if=linuxium-ics-chromiumos_image.bin of=/dev/sdX bs=4M' where 'X' is the appropriate drive letter).

Installation to your device's eMMC storage is also possible noting that it will overwrite the entire internal storage and a resize of the first partition is necessary to fully utilize all available storage space. See the following picture for all the necessary commands:


Acknowledgements: Google (Chromium), Pierre-Louis Bossart (HDMI audio), Daniel Bilik (C-state) and Bastien Nocera (WiFi).

Thursday, 15 September 2016

Yocto for Intel Compute Sticks



Most 'end-users' of 'consumer' products like the Intel Compute Stick who want to either use or at least try a Linux OS will often pick Ubuntu. However given the limited hardware configurations of affordable mini PCs, performance may not be optimal with resource hungry distributions. In the world of embedded systems rather than use a 'proprietary' Linux distribution typically the operating systems are developed from Linux build systems like Yocto, OpenEmbedded, Buildroot and OpenWrt etc.

Unfortunately trying a Yocto Linux build on an Intel Compute Stick is not necessarily that straight forward. It is probably too daunting for most owners to build an initial image just to see what Yocto is all about and most images available for download don't include key drivers or simple installation instructions.

So I've created a Yocto ISO with documentation specifically for Intel Compute Sticks to provide a very basic Linux operating system with wifi and audio support together with the capability to install some additional packages including the Chromium browser.

The ISO can be used either as a LiveUSB or to install Yocto. As the standard installation is to overwrite the entire storage device (i.e. no support for dual booting) I also provide a script to install to pre-existing partitions. The rationale being that you can temporarily replace a current Linux installation (for example Ubuntu) with Yocto and then replace it with the previous Linux installation without affecting any other installed operating systems like Windows etc. As booting the ISO directly on Baytrail models is extremely slow (once booted it works fine) I also provided a script to directly install to the device rather than try to use the LiveUSB approach. Finally I provide some templates to build a repository to allow updates (package installation) from another PC acting as a web server. I also provide the packages which can be installed from the web server or directly if preferred.

Let's get started.

First download my Yocto ISO 'core-image-sato-ics.iso'.

To use as a LiveUSB write the ISO to a USB using the 'dd' command. You can also use the LiveUSB to install from the GRUB boot menu or you can install using one of my installation scripts. For the later option download either 'make-install-mmcblk0.sh' or 'make-install-partition.sh' and copy this to a USB along with the Yocto ISO 'core-image-sato-ics.iso'. On a different USB download and write one of my latest Ubuntu ISOs for the Intel Compute Stick using the 'dd' command and boot your Intel Compute Stick using the Ubuntu LiveUSB. Once booted insert the other USB with the Yocto ISO and install script and change directory to where these files are. If you are installing to existing partitions use the 'lsblk' command or similar to confirm which partitions should be used in the installation. Alternatively you can make new partitions specifically for the Yocto installation. The script assumes that three partitions are available: one each for boot, the root file system and swap. Edit the script to ensure the correct partitions will be used (or modify the script as required). Then run the installation script as root/sudo and reboot your Intel Compute Stick to run Yocto.

Next create a web server on another Linux PC. It is really simple and easy to do. Chose a name for your Yocto repository web server (e.g. 'archive.linuxium.com.au'). Download my documentation/script to create the web server 'make-repository-server.sh' and replace all the occurances of the string '<repo.website.name>' with the name you chose. Now download the compressed Yocto repository 'yocto.7z'. If you are happy to 'rcp' this file to your Yocto repository web server you need to edit 'make-repository-server.sh' and update '<user@ip-address>' as appropriate or you can just delete these lines if you want to manually copy the file over after the next step. Now you can either manually run the commands in the file 'make-repository-server.sh' or run the file as a script and in both cases do so as root/sudo.


The next step is to set up wifi on Yocto. This is probably the hardest step as it involves configuring wifi from the command line and it will depend on your individual environment. If initially you don't feel confident enough to attempt this or in the worst case can't get it working then using a USB ethernet dongle is a quick and simple work around. Whilst there is a lot of information on the web on configuring wifi to help I've included some example files and a script to show how to set up a WPA2 wifi connection with a static address on a hidden network because this is probably the hardest to configure. Download onto a USB the following '_etc_network_interfaces'; '_etc_wpa_supplicant.conf' and 'start_wifi.sh' files. Edit  '_etc_network_interfaces' and for a static address update the IP address details or for a dynamic address change 'static' to 'dhcp' and delete the remaining lines. Copy the file to '/etc/network/interfaces' as root/sudo on your Intel Compute Stick running Yocto. Next run the command 'wpa_passphrase' to get your wifi network pre-shared key (psk). Update the file '_etc_wpa_supplicant.conf' with your wifi name and your psk and change the rest of the parameters according to your wifi network requirements (hint: google 'set up wpa_supplicant' with 'wep' or 'wpa' if you get stuck). Once finished copy the file to '/etc/wpa_supplicant.conf' as root/sudo. Finally run the script 'start_wifi.sh' on your Intel Compute Stick running Yocto. Hopefully this will start your wifi connection.

Once wifi is working (or ethernet if you cheated!) you can now set up access to your Yocto repository web server. As root/sudo edit the file '/etc/hosts' and add a line at the top with the IP address of your Yocto repository web server and its name (e.g. 'archive.linuxium.com.au') similar to how 'localhost' is defined. Now download the  file '_etc_apt_sources.list' and replace all the occurances of the string '<repo.website.name>' with the name of your Yocto repository web server. Then copy the file to '/etc/apt/sources.list' as root/sudo.


Having set up wifi (or ethernet) and your Yocto repository web server you can now update your packages and install new ones. I've built Yocto to use the Debian package manager so it is familiar for existing Ubuntu users. First update your sources as root/sudo with the usual 'apt-get update'. If you want to install Chromium simply enter 'apt-get install chromium'. You can also use 'apt-cache search' to see what other packages are available.

The performance of Chromium is very good on the basic 'Ubuntu' Intel Compute Stick (STCK1A8LFC) and allows you to watch 1080p YouTube.


Hopefully my ISO appeals as a primer for Yocto and similar building tools and encourages some to experiment further.

Acknowledgements: Yocto Project, OpenEmbedded, Emutex, O.S. Systems, Pierre-Louis Bossart and Bastien Nocera.

Monday, 29 August 2016

Lubuntu 16.10 Beta 1 Released for Intel Compute Sticks


There is not too much to see as it only contains a small selection of bug fixes and core application updates but there is a brand new default wallpaper.

My ISO can be downloaded from http://goo.gl/T7Y168 and supports all Intel Compute Stick models.

Also released is an updated kernel: 4.4.0-9136. You can download my update script from http://goo.gl/G9P78O and install after making it executable (enter 'chmod 755 <script>') and then running it as 'root' ('./<script>').


Once the script has finished executing GRUB will not update automatically so run 'update-grub' as 'root'. Your device will then need to be rebooted to use the new (patched) kernel.

Micro SD card support on Intel Compute Cherry Trail Sticks

The latest stable 4.7.2 Ubuntu kernel for Intel Compute Cherry Trail Sticks (STK1AW32SC/STK1A32SC) now supports micro SD cards albeit with limitations.


It seems most Class 10 and below cards from any manufacturer (update: except Sandisk - see comment below) work without problem.  However not all UHS cards work. I've found Samsung UHS Speed Class 3 and UHS Speed Class 1 work:


Whereas similar Sandisk cards fail, crashing the device sometimes on inserting or removing or erroring with:

        mmc1: error -110 whilst initialising SD card
        mmc1: card never left busy state

Still getting any micro SD cards working on these devices is a great forward step. I've patched the 4.7.2 Ubuntu kernel to make it work on Intel Compute Sticks and you can download the upgrade script from http://goo.gl/5gEyrf and install this latest kernel after making it executable (enter 'chmod 755 <script>') and then running it as 'root' ('./<script>'). Once the script has finished executing GRUB should update automatically but if it doesn't then simply run 'update-grub' as 'root'. Your device will then need to be rebooted to use the new (patched) kernel.

Tuesday, 16 August 2016

Is Fuchsia the new orange?


Google's new operating system Fuchsia (https://fuchsia.googlesource.com/fuchsia/) has been widely reported in the last few days. But how much fun would it be to stand round the water cooler and impress everyone with your hands-on experience in using it? Whilst you could compile it yourself you'd probably be disappointed with the result. That's because a new operating system is a bit like an egg. It's somewhat fragile and doesn't appear to do much. Like an egg a lot has happened before it was laid that wasn't particularly visible. Also a lot will happen that will not be particularly visible for most people before it hatches and the full operating system will emerge along with criticizers, sceptics, fans and zealots.

So how to give it a try, the easy way? If you are running Ubuntu (and I've tested this on 14.04 and 16.04) on x86-64 architecture (e.g. an Intel Compute Stick) then download this file, make it executable (enter 'chmod 700 linuxium-install-fuchsia.sh') and run it (enter 'sudo ./linuxium-install-fuchsia.sh') to install a version of Fuchsia that runs in a machine emulator (QEMU) and uses a prebuilt Magenta kernel and my vanilla build of the Fuchsia userspace.


It doesn't take up much space (less than 150 MB) and everything is installed under '/usr/local' and consists of a kernel image file, userspace image file, a couple of scripts to run the emulator and the license file.

Depending on the the processor speed, once you type 'fuchsia' to start the emulator you'll have to wait up to 30 seconds for the MXCONSOLE to load. Once loaded you will get a '> ' prompt (just press return a couple of times to confirm this).


You can then enter commands such as 'ls', 'fortune' or 'cowsay' although the options are somewhat limited at this stage.


Once finished enter 'ctrl-a x' to exit MXCONSOLE and terminate the emulation. If at any time you find yourself stuck with no response then simply run another terminal and enter 'ps -ef | grep qemu' to find the process ID (pid) for the emulator and kill it by entering 'sudo kill -HUP <pid>'.

Acknowledgements:  Google Inc.

Thursday, 4 August 2016

Running the latest Ubuntu on the Intel Compute Stick



The Intel Compute Stick has formalised a new standard for computing devices. Plugged into any HDMI TV or monitor and with a keyboard and mouse connected either wirelessly, via Bluetooth or by USB it becomes a fully functional mini PC. While the first ARM SOC 'sticks' that appeared were to facilitate the conversion to a smart TV, the re-purposing as a mini PC was hampered by the restrictive shortfall of lack of HD graphics due to closed source drivers. With Intel SOC 'sticks' and the availability of open-source software, a 'stick' mini PC is finally achievable. And because Intel fully support the Compute Stick with updated drivers and most importantly updated BIOS which are all available as downloads from the Intel website, it is my chosen device for development.

When Intel released their first Compute Stick with Ubuntu, an open-source operating system based on Debian, it was the restrictive hardware specification that impacted the performance needed to run productivity applications, stream media or play games. Trying to install Ubuntu on the more powerful Windows model resulted in the loss of HDMI audio, WiFi and Bluetooth. Fortunately the latest Core M Intel Compute Sticks address all of these issues and perform exceptionally well although they come at a cost.
The challenge now became how to use a lower cost Intel Compute Stick with fully working hardware and Ubuntu or a recognised flavour that uses Ubuntu as its foundation. Because having the option of running a fast but lightweight operating system can take advantage of the lesser hardware specifications.

The difference between Ubuntu flavours is the set of packages included within the release and I've concentrated on the following:
  • 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
Officially supported 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.

I've created ISO images specifically to work on the Intel Compute Stick with the latest 16.04.1 release by combining recent patches and source code and ported them with Canonical's kernel source to fully support HDMI audio, WiFi and Bluetooth. I've also included the latest patches that try to reduce the random freezes that have been known to occur. But because the ISOs include a patched kernel to provide the missing functionality it means no automatic kernel updates from Canonical although other application packages will update as standard. Consequently I've also developed a manual patching process where a script can be downloaded and then executed to update the kernel to match those provided by Canonical.

All ISOs work on all of the Intel Compute Stick models including the Core M models which are supported for the sake of completeness. Lubuntu being a lightweight Ubuntu is highly suitable for the minimalist STCK1A8LFC model especially as I've configured it to use ZRAM both in the ISO and once installed. I've also configured them all 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. The BIOS settings can be accessed by powering-on the Intel Compute Stick and pressing the 'F2' option. On the Atom models in the 'Configuration' page the 'Select Operating System' option can be toggled between 'Ubuntu 64-bit'/'Windows 64-bit' and 'Windows 32-bit'. Finally 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 by pressing the 'F10' option immediately 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 go through the BIOS using the F10 option followed by selecting the Ubuntu option. If dual booting on the latest Atom models (STK1A32SC and STK1AW32SC) I recommend installing/re-installing 64-bit Windows to circumvent this issue. Also the ISOs only work on Intel Compute Sticks but they can be used with any model (STCK1A8LFC, STCK1A32WFC, STK1AW32SC, STK1A32SC, STK2M3W64CC, STK2M364CC and STK2MV64CC). Occasionally the Baytrail systems (STCK1A8LFC and STCK1A32WFC) have been observed to sometimes hang or freeze randomly. Further details are posted below.

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


Ubuntu
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
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
Xubuntu is an elegant and easy to use operating system. Xubuntu comes with Xfce, which is a stable, light and configurable desktop environment.


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


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


Ubuntu MATE
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.


To upgrade the kernel to match a version released for Ubuntu 16.04 first download the upgrade script, make it is executable (use 'chmod 755 <script>') and then run as 'root' ('./<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-34-53

4.4.0-36-55

4.4.0-38-57 (Update: current latest Xenial)

One issue that has been reported with Linux kernel versions newer than 3.16 on Baytrail processors (i.e. not specific to just on the Intel Compute Stick or with the Z3735F SOC) 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.

I incorporate this solution along with disabling IPv6 system wide (which may or may not of use) through editing the boot options on STCK1A8LFC and STCK1A32WFC devices.

Open a terminal session and enter the following command (on a single line):

sudo sed -i 's/\(GRUB_CMDLINE_LINUX=\)""/\1"ipv6.disable=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.

I've also compiled the latest stable 4.7.x kernel with configs based on Ubuntu and provide as an update script for anyone who wants a bleeding edge kernel:

4.7.0-040700

Note that this kernel does not include the HDMI audio and C-state patches as they need further work on porting.

Update: The latest stable 4.7.2 Ubuntu kernel for Intel Compute Cherry Trail Sticks (STK1AW32SC/STK1A32SC) now supports micro SD cards albeit with limitations (see http://linuxiumcomau.blogspot.com.au/2016/08/micro-sd-card-support-on-intel-compute.html).

I've patched the 4.7.2 Ubuntu kernel to make it work on Intel Compute Sticks and the update script is available from:

4.7.2-040702 (current latest Stable)

And this kernel does include the HDMI audio.

Alternatively for anyone who wants to do additional testing my latest WIP v4.8-rc3 mainline build for Intel Compute Sticks is available from:

4.8-rc3 (Mainline)

Ignore the missing firmware issue (see https://bugzilla.kernel.org/show_bug.cgi?id=151911).

Finally Lubuntu Yakkety Yak Alpha 2 (i.e. 16.10) has just been released:


So I've also created a version suitable for Intel Compute Sticks. It can be downloaded from here and used as LiveUSB or it can be installed.

If you want to upgrade the Yakkety kernel from Alpha 1 to Alpha 2 then use the following script:

4.4.0-33-52

Update: Lubuntu 16.10 Beta 1 has now been released for Intel Compute Sticks together with an updated kernel:

4.4.0-9136 (current latest Yakkety 16.10 kernel)

Acknowledgements:  Linux Kernel Organization (kernel.org), Canonical Ltd. (Ubuntu), Pierre-Louis Bossart (HDMI audio), Daniel Bilik (C-state), Bastien Nocera (WiFi) and Larry Finger (Bluetooth).

Saturday, 30 July 2016

Dual booting Ubuntu and Windows on the CS125 Intel Compute Stick (STK1AW32SC)


Currently dual booting Ubuntu and Windows relies on using the BIOS's 32-bit bootloader. However booting sometimes results in a blank coloured (typicaly purple) screen so switching the OS requires a cold boot through the BIOS using the F10 option.

This 'F10' dependency can be removed by simply re-installing Windows as a 64-bit version and the switch is free (i.e. you don't have to pay for it) as long as you have a qualifying Windows license (see How to migrate to Windows 10 64-bit from 32-bit versions of Windows).

The whole process to configure dual booting is essentially straightforward and consists of three parts. First you need to prepare a USB for the Windows 10 64-bit installation. Then you need to install Windows 10 64-bit from the USB. Finally you need to download and install Ubuntu and configure dual boot.

Because the switch from 32-bit to 64-bit Windows requires a new installation (meanings files, applications and settings will be deleted) you will also have to install native 64-bit drivers. I've created a video of instructions with screenshots (see https://youtu.be/UQPCYwz-PK0) which covers the process in more detail and will assist anyone wanting to dual boot.


Before you start you will need:

1 x CS125 (STK1AW32SC) with Windows 10 installed
1 x USB
4 x hours
1 x backup (optional)

and the following links:

Windows ISO: https://www.microsoft.com/en-us/software-download/techbench
Intel Drivers: https://downloadcenter.intel.com
Rufus: https://rufus.akeo.ie
Ubuntu ISO: http://linuxiumcomau.blogspot.com/2016/06/running-ubuntu-on-intel-compute-stick.html

Remember to take a backup of any files you want to keep before you try this as otherwise they will be erased during the installation. And don't try going from Windows 8.1 to Windows 10 using this method as you'll probably end up having to pay for a Windows 10 license now that free upgrades have finished. Also this will not work on the first generation BayTrail Intel Compute Sticks (STCK1A32WFC) as the BIOS is not compatible with the Windows 64-bit ISO.