Customizing Ubuntu ISOs: Documentation and examples of how to use 'isorespin.sh'

posted 21 Apr 2017, 21:31 by Ian MORRISON   [ updated 28 Jun 2017, 09:26 ]


Normally Linux distribution ISOs work perfectly when written to a USB for booting as a 'Live USB' allowing both usage and installation of the distro. Unfortunately with the introduction of Intel Atom based mini PCs and tablets the issue of requiring a 32-bit bootloader to boot a 64-bit OS arose. Further complications were caused by the lack of 'mainline' support for HDMI audio and wifi/bluetooth resulting in the need for custom kernels. Although some Linux distros can work OOTB I found that for Ubuntu it wasn't that simple.

To solve the limitations of using a standard ISO I developed a script that allows an ISO to be respun and customized ("remastered") to create a new ISO. Being a script which you run locally it means you can both see and control how your ISO is respun. I wanted flexibility in the ability to:
  • Add a GRUB 32-bit bootloader to allow ISOs to boot on the many Intel Atom devices limited by their BIOS or to add the rEFInd boot manager to allow booting on Intel Apollo Lake devices.
  • Upgrade the kernel to the latest or to a specific version to benefit from recent patch functionality e.g. for audio and wifi/bluetooth.
  • Add (or remove) repositories, software packages, scripts and files to allow the installation of firmware and favourite programs.
  • Preseed or perform set-up commands and scripts and also change system defaults.
  • Add persistence so that the ISO can retain data, installed software packages and settings across reboots.
The result is my 'isorespin.sh' script which works with all official desktop 64-bit Ubuntu (http://releases.ubuntu.com) and Ubuntu flavoured ISOs (https://www.ubuntu.com/download/ubuntu-flavours), Linux Mint ISOs (https://www.linuxmint.com/download.php), KDE neon ISOs (https://neon.kde.org/download) and elementary OS ISOs (https://elementary.io).

It can be run using either the shell CLI (command line interface) in a the terminal or using its GUI (graphical user interface). Not only will it generate a new ISO but it will also produce a log file which includes the options used when respinning the ISO and serves to document the respun ISO.

Although it is expected to run the script on a Linux machine it also works on a Linux virtual machine on Windows (see below for further details). You will need certain packages like 'squashfs-tools' and 'xorriso' installed (use 'sudo apt-get install -y squashfs-tools xorriso' to install them) plus 'zenity' if you want to use the GUI. As different Linux distros have different packages installed by default the script will first check and notify you if any other packages are required. You will also need at least 10 GB of free space but this can be on external storage (e.g. a USB) as it can be specified as a location different to where the script is run from. For some options (such as updating the kernel) you will need a working internet connection as the script needs to download software. Finally as the script runs some commands (e.g. mount/umount) which require root access using the 'sudo' command you will initially be prompted for your password and must already have 'sudo' privileges.


Invocation

Running the script is really quite simple even though there are quite a lot of features or options making it look rather complex.

Usage: /usr/local/bin/isorespin.sh [ -h | -v ]
       /usr/local/bin/isorespin.sh -i <ISO> [ [ -u | -k <kernel> ] | -r "<repo> ... " | -p "<pkg> ... " | -l "<pkg.deb> ... " | -f "<file> | <directory> ... " | [ -s <size>MB | GB ] | [ -b GRUB | rEFInd ] ...
       /usr/local/bin/isorespin.sh ... -w <directory> | -d "<pkg> ... " | -e "<pkg> ... " | -c "<cmd> ... " | -o "<file> | <directory> ... " | -g "" | "<kernel boot parameter> ... " ]


Respinng an ISO is controlled by either running the script with flags and arguments (CLI) or selection options and values (GUI) and briefly these are as follows:

-h or --help will display the 'usage' message. 
-v or --version displays the version of the script. 
-i or --iso must be specified and is the name (including the full or relative path) of the ISO to be respun. 
-u or --update will update the kernel to the latest Ubuntu Kernel Team kernel builds located at http://kernel.ubuntu.com/~kernel-ppa/mainline
-k or --kernel replaces the kernel with the version specified by the argument or value which can be any of the Ubuntu Kernel Team kernel builds located at http://kernel.ubuntu.com/~kernel-ppa/mainline and is passed as the directory or folder name without the trailing '/' (e.g. '--kernel v4.11-rc7'). 
-r or --repository adds the specified repository to the respun ISO. 
-p or --package will install a single package or a set of packages (if enclosed in quotes) that are available to the ISO and would typically be installed using the 'apt-get install <package>' command. This option is very useful in preseeding your ISO with packages you always normally install immediately after booting and will help resolve the issue of the ISO running out of space as a result of multiple installations. For example I typically include "ssh openssh-server inxi" when respinning an ISO for personal use.
-l or --local allows local Debian binary packages to be installed within the respun ISO. Care must be taken in specifying the order of multiple packages to preserve any dependencies and of course all dependencies must be met for the packages to be successfully installed. 
-f or --file will copy either the specified files or directories to the respun ISO under '/usr/local/bin'. Although intended to allow local binaries or shell scripts to be saved on the respun ISO there is no limitation on the actual type of file that can be added. 
-s or --storage adds a specified amount of persistent storage to the respun ISO. A size must be specified although there is some flexibility on how much is allocated. The minimum size is 128MB which keeps the size of the ISO down but means that once a USB is created the persistence partition needs to be manually resized for normal usage. Alternatively a larger size can be specified to avoid the immediate need to resize as this can always be performed later. It is recommended to use a realistic amount somewhere between 1GB and 2GB to maintain the balance between a practical but usable ISO. When creating a respun ISO with persistence the rEFInd boot manager will automatically be selected. When using the GUI the persistence partition size can be defined using the slider which limits the size between 128MB and 2048MB.
-b or --boot will add either the GRUB boot loader (which is added by default) or the rEFInd boot manager which currently is required for booting on a lot of the current Intel Apollo Lake devices. 
-w or --work-directory is used to specify where the ISO will be respun. This is primarily for overcoming the lack of space associated with mini PCs and allows the respinning to be run on temporarily connected external storage media such as a drive or USB. Once the storage has been connected and mounted it can be passed as a parameter. Likewise if a directory is then created on the mounted storage this can be passed as the argument or value for this option to ensure there is sufficient space (i.e. at least 10 GB) for the script to run.
-d or --download will download Debian binary packages from the respun ISO using the 'apt-get download' command and save them under '/usr/src'. If combined with the '-o' option the Debian binary package will be accessible after respinning the ISO. 
-e or --erase will remove Debian binary packages from the respun ISO using the 'apt-get purge' command. 
-c or --command will execute the supplied argument as a 'bash' command. Care must be taken when embedding single or double quotes within the argument as they are subject to interpretation. For more complex commands it is often both advisable and easier to write a simple shell script and use the '-c' option to execute it as part of respinning. 
-o or --output will save either the specified files or directories to an output directory called 'isorespin'. This is very useful when wanting to extract files or packages that have been created or downloaded as part of respinning the ISO. 
-g or --grub will add the specified kernel boot parameters both to the GRUB/rEFInd boot menu and to the default GRUB settings or if an empty ("") argument is specified then the the ISO's initial kernel boot parameters will be removed.

The script can either be run as a local script or it can be installed by copying the script to '/usr/local/bin' where it will be accessible for all users. Depending on the options and their complexity the respinning will take quite a few minutes and the script provides updates on its progress whilst running. The respun ISO is created with a new name derived from the original ISO name and includes indicators of the options used like 'persistence' or the kernel version for example with full details being written to the log file.

Once the ISO has been respun it can be written to a USB using the standard 'dd' command.

The examples below illustrate the various options through scenarios and provide a basic tutorial to using the script. They are based on the script being installed to '/usr/local/bin':


The script's help is displayed using the command:

isorespin.sh -h


The version of the script can either be displayed by entering:

isorespin.sh -v


or it can be seen from the top of the script's 'main' menu:


or 'advanced' menu:


The script can be run using the CLI by specifying options with arguments in any order. If the script is started without any parameters it first checks to see if it can run the GUI and if so starts with the main selection menu where all required options should be selected. As seen above the GUI uses two menus with the first being a main menu of most frequently used options and an optional additional menu of the more advance options. For each option selected, a sub-menu will appear to allow the choice or value to be entered.


Respinning an ISO

The simplest usage is to respin an ISO which will automatically add the GRUB 32-bit bootloader allowing the respun ISO to boot on Intel Atom devices e.g.:

isorespin.sh -i ubuntu-17.04-desktop-amd64.iso

or by invoking the GUI:





Upgrading the kernel

To respin the ISO with the latest kernel the command would be:

 isorespin.sh -i ubuntu-17.04-desktop-amd64.iso -u

or



If a specific kernel was required for example 'v4.11.6' then the '-k' option would be used:

isorespin.sh -i ubuntu-17.04-desktop-amd64.iso -k v4.11.6

or



Adding local packages and running scripts

A more complex scenario of respinning an ISO is when you want to add packages and run scripts to fix functionality like wifi/bt and audio.

Due to current limitations of the official ISOs I've previously created scripts to add wifi/bt firmware and also add the ALSA UCM audio files:

rtl8723bs_4.12.0_amd64.deb
rtl8723bt_4.12.0_amd64.deb
linuxium-install-broadcom-drivers.sh
linuxium-install-UCM-files.sh

These can be incorporated when respinning an ISO. For the scripts you first add the file using the '-f' option and then execute the script using the '-c' option.

When I wrote the above scripts I originally intended them to be run post installation rather than as part of respinning an ISO. As a result they produce warnings and also need to be executed in the correct directory. Rather than writing a complex '-c' parameter to run them correctly it is simpler to write a further script (which I call a 'wrapper') which controls how the script is run. These 'wrappers' can then be included as part of respinning an ISO:

wrapper-linuxium-install-broadcom-drivers.sh
wrapper-linuxium-install-UCM-files.sh

For example the following command will respin the Ubuntu 17.04 ISO and upgrade the kernel to the latest version (which includes the RTL8723BS driver) installs the required RTL8723BS wifi/bt firmware and both adds and runs a script to include the UCM files for audio:

isorespin.sh -i ubuntu-17.04-desktop-amd64.iso -u -l rtl8723bs_4.12.0_amd64.deb
-f linuxium-install-UCM-files.sh -f wrapper-linuxium-install-UCM-files.sh
-c wrapper-linuxium-install-UCM-files.sh


While the script is running progress updates are displayed:


until it finally completes:


producing a log file which shows how the script was run:



A similar example but respinning the daily snapshot Ubuntu 17.10 (Artful) ISO and using the GUI starts by selecting the required options:


and then entering the values starting with the ISO. When selecting the ISO a 'file manager' styled window will be presented but only files ending with a '.iso' suffix will be displayed:


For the kernel upgrade option the choice is to upgrade to the latest mainline version:


Local packages are selected using the 'file manager' which only displays '.deb' files. To allow multiple entries you will be asked after each selection is made whether a further addition is required:



Next the two scripts are added using the 'file manager':





And finally the 'advanced' menu is displayed and after selecting the option to add a command:


the command is entered as a text string:


Now that all the selected options have been entered a confirmation screen is be displayed which shows the full command as it would look if the script had been run manually:


Having selected 'yes' the script runs and displays its progress:





until it finishes:


Similarly a log file is produced that shows how the script was run:



For a more complex example of using the script see Compiling your own kernel using 'isorespin.sh'.


Persistence

Adding persistence to an ISO is useful as it means that you can retain your data, installed software packages and settings between reboots. Persistence can be added as part of any ISO respinning simply by adding the '-s' option and defining the size of the storage to be permanently allocated in the ISO. As previously mentioned there is a balance between making it small and therefore resulting in a small ISO that requires resizing once booted (see below) verses a larger size and a corresponding larger ISO.

The following example respins the standard Ubuntu 17.04 ISO with the latest kernel and create a 2 GB persistence partition:

isorespin.sh -i ubuntu-17.04-desktop-amd64.iso -u -s 2 GB

Using the GUI it is created by:








As can be seen from looking at the size of the resulting ISO that it is large at around 3.8 GB but not too large to be totally impractical.


Kernel boot parameters

The following is an example showing both the removal of the default kernel boot parameters (quiet splash) and the inclusion of two new kernel boot parameters:

isorespin.sh -i ubuntu-17.04-desktop-amd64.iso -g "" -g "i915.fastboot=1 fbcon=rotate:1"

The default kernel boot parameters are first removed by selecting the delete option:


and the new kernel boot parameters are then added:


as text strings:



Once the script is running it will update the kernel boot parameters:


with the exact details being recorded in the log file:



Creating a LiveUSB

Once your respun ISO has been created you can write it to a USB using 'dd'. For example if your USB is '/dev/sdb' then enter:

dd if=linuxium-v4.12-rc6-ubuntu-17.04-desktop-amd64.iso of=/dev/sdb bs=4M

Make sure you select the correct device for the USB and always check first using commands like 'df', 'blkid' or 'lsblk' to confirm. ISOs can also be written to a USB using 'Rufus' on Windows if preferred.


Booting your respun ISO


Having created the USB with your respun ISO the following information may be useful when booting and running.

To boot your device select the USB's UEFI partition from the device's boot menu:


Normally you will then see a standard GRUB menu:



If the 'rEFInd' boot manger was installed (either through selection or automatically due to persistence) the following screen will be displayed for 64-bit bootloader devices:



otherwise for 32-bit bootloader devices the normal the GRUB menu screen is displayed and after selection a black screen with the following message is briefly displayed:

error: no suitable video mode found.
Booting in blind mode

before the normal Ubuntu splash screen appears and the device fully boots. This 'error' can safely be ignored.

Wifi issues

If your device uses a Broadcom wifi chip and wifi isn't working even after adding the firmware using my script then it may be missing an SDIO file. By running the command 'dmesg' immediately after booting and looking at the output if you see messages showing that the wifi firmware 'txt' file is missing it is possible to use the copy from the Windows driver that is stored in NVRAM. The file should look something like '/sys/firmware/efi/efivars/nvram-74b00bd9-805a-4d61-b51f-43268123d113' and you actually copy it using 'cat /sys/firmware/efi/efivars/nvram-74b00bd9-805a-4d61-b51f-43268123d113 > /lib/firmware/brcm/brcm/brcmfmac43241b4-sdio.txt' substituting the actual NVRAM filename on your device and the correct *sdio.txt name for your driver.

Bluetooth issues

On booting if bluetooth fails to work automatically and the firmware was installed using one of my scripts then the service can be manually started with the command:

sudo systemctl start rtl8723bsbt.service

or

sudo systemctl start brcmbt.service

depending on device's chip. If bluetooth is always required then the command could be included in '/etc/rc.local' to avoid this step. Note that this uses 'systemd' so earlier ISO releases without 'systemd' cannot use my scripts to provide bluetooth.


Resizing the persistence partition

Once booted use the 'gparted' command to resize the persistence partition. You will initially be prompted to fix the GPT to use all the available space so click 'Fix' 


and then continue with the resizing:



NVRAM sync issues

Sometimes after installing your device only boots to a black screen.  Typically this happens when the NVRAM and ESP are out of sync. This can be easily fixed by performing the following:

1. Start with the device switched off.
2. Connect your LiveUSB.
3. Power on the device and press the relevant function key or key sequence to boot from the LiveUSB.
4. Open a terminal windows and enter:
type efibootmgr 
5. If the 'efibootmgr' is not installed enter:
sudo apt-get update && sudo apt-get install -y efibootmgr
6. Next remove any boot entries that may have been created through the earlier installs by entering:

      for BOOTENTRY in 0 1 2 3 4 5 6 7 8 9
      do
          sudo efibootmgr -b ${BOOTENTRY} -B
      done

7. Now create an Ubuntu boot entry by entering:
sudo efibootmgr -c -d /dev/mmcblk0 -p 1 -l \\EFI\\ubuntu\\grubx64.efi -L Ubuntu
8. Remove the LiveUSB and reboot from the newly created Ubuntu entry.


Note: If you have a dual boot installation then the ESP partition may be the second partition so modify the '-p 1' in the command above to '-p 2' or to whatever the ESP partition is. Likewise for some devices the eMMC is '/dev/mmcblk1' and not '/dev/mmcblk0' so again modify the command as appropriate. If your device uses a 32-bootloader then use 'bootia32.efi' rather than 'grubx64.efi' in the command. It also sometimes doesn't work first time and requires all the steps to be repeated which should then fix the issue.


Additional information regarding the script

Minimizing repeated downloads

The rEFInd boot manager (http://www.rodsbooks.com/refind) can be downloaded from https://sourceforge.net/projects/refind/files into the same directory as the script is run from to prevent unnecessary repeated downloads if this is a concern and will make processing quicker.

Avoiding new windows opening when respinning

To prevent the file manager opening a window each time the script mounts a temporary file system I have run the command 'gsettings set org.gnome.desktop.media-handling automount-open false' first on my system.

Lock file

The script creates a lock file '.isorespin.sh.lock' in the directory where it is run from in order to ensure exclusive access to the run-time environment. If the script or machine crashes this lock file may need to be removed in order to rerun the script and you will be prompted should this occur. However it is not recommended to run the script in parallel from multiple directories as it is both CPU and I/O intensive and severe performance degradation would occur.

Running the script on Windows

First download and install Oracle's VirtualBox on Windows and then create a Linux VM from a standard Ubuntu 64-bit desktop ISO and install to a VDI of fixed size (minimum 20GB). Start the new Ubuntu VM and install 'Oracle VM VirtualBox Extension Pack'. You can then download my 'isorespin.sh' script to respin the Ubuntu-based ISO of choice. By installing the extension pack you will also be able to write the respun ISO to a USB using 'dd' from within the Ubuntu VM. Unfortunately 'Bash on Ubuntu on Windows' using 'Windows Subsystem for Linux' does not support 'loop' devices which are required by my script so an Ubuntu VM is the only working alternative at this time.


Miscellaneous issues not directly related to the script

The Linux mainline kernel

It is worth noting that certain releases of the mainline kernel include specific core functionality:

v4.9 includes the eMMC v5.0 driver required for accessing the internal storage in many devices.
v4.11 includes the HDMI audio driver.
v4.12 includes the RTL8723BS driver although you will still need the wifi/bt firmware.

Kernel freezes

Well known and well documented without a permanent fix or so it seems. Kernels after v3.16 seem to include something that caused them to randomly freeze on Intel Atom devices and then the whole system hangs. Subsequently an accepted workaround was recommended to limit the processor (CPU) to a certain power state or 'C-state' and if freezes are encountered then to pass 'intel_idle.max_cstate=1' as a boot parameter. Later kernels have included patches and the current state seems to be reliable enough to ignore the workaround. If however freezes still occur the easiest way to implement the workaround on an installed system is to edit the file '/boot/grub/grub.cfg' and modify to look like:


GRUB_CMDLINE_LINUX_DEFAULT="intel_idle.max_cstate=1"

Alternatively the following command can be entered:
sudo sed -i 's/\(GRUB_CMDLINE_LINUX=\)""/\1"intel_idle.max_cstate=1"/' /etc/default/grub
followed by:
sudo update-grub
and then a reboot as the change only needs to be made once typically following installation.

Micro SD card issues

Whilst micro SD cards have worked on Intel Atom Bay Trail devices it is only since the v4.7.2 kernel that Intel Atom Cherry Trail devices have had any form of success.

The typical error encountered is:

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

and although most Class 10 and below cards from any manufacturer except Sandisk work now without problem some UHS cards still fail. I've found Samsung UHS Speed Class 3 and UHS Speed Class 1 work whereas similar Sandisk cards fail crashing the device sometimes when inserting or removing the card.

No sound from headphones or internal speakers

Unfortunately some devices still require additional audio drivers or specific device quirks that have not been incorporated into the mainline kernel so sound may only work over HDMI and not through internal speakers or via the headphone jack even though the UCM files have been added. This is part of ongoing Linux development and future kernel releases hopefully will include the drivers required for currently non-working devices.

Suspend/Hibernate/Sleep issues

Suspend in general has been problematic on Intel Atom devices and while new patches are continually being applied to the mainline kernel it is currently not working or incorrectly working on a number of devices.

Brightness issues

Unfortunately as I don't have a tablet I cannot advise on the various screen related issues some users experience using Ubuntu. The best command appears to be 'xrandr' although its use is device specific. Many people have commented in previous posts with their solutions and I've included some of these below.

Most brightness suggestions include:

xrandr --output [device_name] --brightness floating_pvalue (0 <= x <= 1.0)

where you can determine your device by entering:

xrandr -q | grep "connected"

with the primary one being your device.

For example:

xrandr --output DSI-1 --brightness .${BRIGHTNESS}

where the variable BRIGHTNESS can take a value between 3 and 9.

Rotation issues

Some examples that users have posted include:

xrandr --output DSI-1 --rotate right
xinput set-prop <Device Touchscreen> 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1

and

xrandr -o right
xinput set-prop 'Goodix Capacitive TouchScreen' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1

Also others have reported that screen rotation during boot works with 'fbcon=rotate:1'.

Touchscreen issues

These seem to be related to rotation issues and another example of a solution includes:

xinput set-prop "Silead GSLx680 Touchscreen" "Coordinate Transformation Matrix" 1 0 0 0 -1 1 0 0 1

which can also be set when matching InputClass section in 'xorg.conf' with:

Option "TransformationMatrix" "1 0 0 0 -1 1 0 0 1"


Reporting issues

Comments are welcome but when discussing an issue please include the name of your device and use 'pastebinit' or similar to post a URL to a copy of the output from 'dmesg' (which is basically a log of kernel messages).

To use the 'pastebinit' command (see https://help.ubuntu.com/community/Pastebinit) first install the command by entering 'sudo apt-get install -y pastebinit' and then to share the kernel messages log enter 'dmesg | pastebinit'. This will paste a copy of the output from 'dmesg' to Ubuntu's Pastebin and provide a URL to access it.

So when reporting an issue please include:
  • Outline of issue
  • Name of device
  • URL from pastebin (e.g. http://paste.ubuntu.com/23646692/)


Donate

Please donate if you find the script useful using the following link http://goo.gl/nXWSGf as everything helps with development costs.

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

posted 31 Jul 2016, 00:33 by Ian MORRISON   [ updated 28 Feb 2017, 22:58 ]


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:


Microsoft have noted that 'The Microsoft Techbench web page might not be working at this time. If you are unable to load the Techbench web page, please use the Media Creation Tool.'


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.

Running Ubuntu on Intel Bay Trail and Cherry Trail Devices

posted 13 Jun 2016, 04:05 by Ian MORRISON   [ updated 23 Jun 2017, 03:49 ]



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 Budgie uses the Budgie 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.

Issues should be reported as comments on the associated development blog posting on www.linuxiumcomau.blogspot.com. The best way to help when reporting an issue 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:
As Canonical have released Ubuntu 16.04.2 with the rolling Hardware Enablement (HWE) kernels which aim to provide support for the latest hardware I've decided to provide a single kernel which is effectively a HWE 'edge' kernel specifically patched for Intel Atom SoCs in my ISOs to simplify kernel management and create a forward path for future migration to mainline kernels.


My kernel is based on Canonical's next 'zesty' kernel which is rebased to v4.10 and also available in 'xenial' as hwe-edge. Whilst v4.10 is the latest mainline kernel to be released the merge window for v4.11 now includes the revised HDMI LPE Audio Support patch set together with the AXP288 power supply patch set for Intel Atom SoCs. Because v4.11 will be released in a couple of months with the patches being included in Ubuntu hopefully by 17.10 I've added these latest patches from the merge window to my kernel. Besides the HDMI LPE patches from Pierre-Louis Bossart, Jerome Anand & Takashi Iwai and Hans de Goede's AXP288 patches I've also added Hans de Goede's PWM, I2C, CX2702X audio support, Silead touchscreen support and ASUS tablet function key support patches. Also included is Mika Kuoppalad's new anti-freeze patch, Pierre-Louis Bossart's PMC Platform Clock and Codecs patches, Ville Syrjälä atomic update fix, Bastien Nocera's wifi patch, Laszlo-Fiat's bluetooth patch, Jonas Aaberg bluetooth patch for the ASUS 100HA together with my bluetooth support which is based on a script from Larry Finger. The kernel source is available on my github.

At this stage I'm providing ten ISOs: 16.04.2 releases of Ubuntu, Lubuntu, Xubuntu, Ubuntu MATE, Ubuntu GNOME and Kubuntu all with kernel Ubuntu-lts-4.10.0-10.12~16.04.2 together with Ubuntu 17.04 pseudo Beta 1 and 17.04 Beta 1 releases of Lubuntu, Xubuntu and Ubuntu Budgie all with kernel Ubuntu-4.10.0-10.12. Technically the two kernels are the same with the 'xenial' LTS kernel being a backport of the 'zesty' kernel. Note that the Ubuntu 17.04 Beta 1 is a pseudo release because there is no official Beta 1 release so I have used the daily release provided the same day the official Beta 1 flavours were released. I've also included Ubuntu Budgie as it is now an official Ubuntu flavour and I thought there may be some interest. Further flavours will be added later although I am no longer going to provided updated 16.10 releases due to resource constraints. I am also providing the corresponding kernel update scripts and I will maintain the kernels with security patches and/or Intel Atom SoC added functionality/improvements.

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


16.04.2 LTS


Ubuntu 16.04.2 (superseded)
(sha256sum 72832bfc886b2e0beede4f33e7703b4c2c47ef0baae1a3064fb6ab70892ee689)
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 16.04.2 (superseded)
(sha256sum e1102f37c35d1e77f515cc0574388eec700831288ecc7e8fe73ca8755eb5a5ef)
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 16.04.2 (superseded)
(sha256sum c33862d036885b41e1cc0c438b0008a14fc3495b352f8f2240fbe3843ac1fc31)
Xubuntu is an elegant and easy to use operating system. Xubuntu comes with Xfce, which is a stable, light and configurable desktop environment.

Ubuntu MATE 16.04.2 (superseded)
(sha256sum d2d4e07cc2121a90617b94904800e60498792bf7f5736157cc7a833efe211947)
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.


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


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




17.04 Beta 1


Ubuntu 17.04 pseudo Beta 1 (superseded)
(sha256sum f38dcc8fc64f524422028b24e8e95ebe7635241aa24edbdafeeb55dd44c5d36c)
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 17.04 Beta 1 (superseded)
(sha256sum f8a8af2d453a58a8538f9f76ceac29a1e2477793c59d373f0bddda5c3338d35f)
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 17.04 Beta 1 (superseded)
(sha256sum 2a1770e0e51921328224d5c477027420fee3f9bfc715ddb741adf75409f20afb)
Xubuntu is an elegant and easy to use operating system. Xubuntu comes with Xfce, which is a stable, light and configurable desktop environment.
Ubuntu Budgie 17.04 Beta 1 (superseded)
(sha256sum bc92e6df5b4c298fc877743ab0303d7272ec87bc7a40e79ddf80f0883dc6c8ea)
Ubuntu Budgie is stable and easy to use that integrates the Budgie Desktop environment into Ubuntu. Whether you are using it on the old computer, or powerful workstation, Ubuntu Budgie is adaptable to any device, keeping them fast and usable.



If freezing persists follow Len Brown suggestion of adding "intel_idle.max_cstate=2" as a kernel boot parameter which enables Core-C6 but disables module/package-C6. 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=2"/' /etc/default/grub'. To implement the change enter 'sudo update-gruband then reboot the system by entering 'sudo reboot'. The above change only needs to be made once, typically following installation to eMMC storage. Prior to embarking on an encrypted LVM installation you should first open a terminal session and turn off swapping using the command 'sudo swapoff -a'. If there is no wifi after booting devices with a Broadcom chip then reload the driver: in a terminal window enter 'sudo modprobe -r brcmfmac' followed by 'sudo modprobe brcmfmac'. Occasionally on some devices bluetooth doesn't initially load so it is necessary to restart the service: for Broadcom chip devices enter 'sudo systemctl stop brcmbt.service' followed by 'sudo systemctl start brcmbt.service' and for Realtek chip devices enter 'sudo systemctl stop rtl8723bsbt.service' followed by 'sudo systemctl start rtl8723bsbt.service'. Some devices still do not reboot (or warm restart) correctly which can result in a purple screen or lack of wifi and/or bluetooth on reboot. In these circumstances cycle the power and boot the device from cold. Unfortunately as I don't have a tablet I cannot advise on the screen rotation issues however others have commented in previous posts with their solutions which I'd recommend reading. WIP includes improving backlight support for some devices and the ES8316 driver which is currently under development.

Kernel update scripts are provided for updating the kernel and require my ISOs to be installed as a pre-requisite otherwise you will be missing the 'userland' files required for audio, wifi and bluetooth. To upgrade the existing installed kernel to the later version provided by the script first download the script and after making it executable (enter 'chmod 755 ~/Downloads/<script>') install it as 'root' (by entering 'sudo ~/Downloads/<script>'). Once the script has finished executing the device will need to be rebooted to use the updated (patched) kernel. 

4.10.0-10.12 (superseded)
4.10.0-10.12~16.04.2 (superseded)


Acknowledgements:  Canonical Ltd. (Ubuntu), Pierre-Louis Bossart/Jerome Anand/Takashi Iwai (HDMI LPE Audio), Pierre-Louis Bossart (PMC Platform Clock and Audio Codecs), Hans de Goede (I2C/WiFi/PMC/AXP288/CX2702X/Silead/ASUS), Ville Syrjälä (Atomic Updates), Len Brown (C6 Auto-Demotion), Daniel Bilik (C-State), Mika Kuoppala (Anti-freeze), Bastien Nocera (WiFi), Larry Finger (Bluetooth), Jonas Aaberg (Bluetooth) and Laszlo Fiat (WiFi/Bluetooth).

Source code: GitHub (Linuxium).

Simple way to boot an ISO in Windows or Ubuntu without the need for external media

posted 11 Mar 2016, 06:03 by Ian MORRISON


Traditionally booting an ISO first requires the preparation of external media such as a USB using software before it can be used to boot from. But how simple would it be just to download the ISO and then be able to boot from it immediately? Although this is possible using virtualization or a hypervisor it still requires a virtual machine package to be installed.

Another issue that mini PCs users have encountered is that running a 64-bit kernel from a 32-bit UEFI bootloader doesn't work.

So I've created a simple bootloader that resolves these issues and only requires a minimal initial set-up and can then be used to boot ISOs directly after downloading them to the mini PC. And it works on both Windows and Ubuntu including dual-boot systems.
 

Initial set up for Windows users

Open a 'Command Prompt' as 'Administrator' and create a folder 'iso' under the C:\ drive:

mkdir c:\iso

Now download my bootloader (linuxium.zip) from https://drive.google.com/file/d/0B99O3A0dDe67OXBKakhuSUdVdFk and unzip the file under C:\iso

Next make a note of the first free drive letter e.g. 'T:' and enter:

mountvol t: /s

Then make a new folder under the existing 'EFI' folder:

mkdir t:\EFI\iso

Finally copy the file from 'C:\iso' corresponding to the UEFI bootloader being used ('linuxiumia32.efi' is for 32-bit and 'linuxiumx64.efi' is for 64-bit), e.g.

copy c:\iso\linuxiumia32.efi t:\EFI\iso

If you want you can now clean up 'C:\iso' e.g.

del c:\iso\*



And/Or Initial set up for Ubuntu users

Open a terminal session and create a directory 'iso' under the root directory '/':

sudo mkdir /iso

Download my bootloader (linuxium.zip) from https://drive.google.com/file/d/0B99O3A0dDe67OXBKakhuSUdVdFk and unzip the file to /iso

Check that your EFI partition is already mounted and mount if necessary (typically it will be mounted under /boot/efi)

Make a new directory under the existing 'EFI' directory:

sudo mkdir /boot/efi/EFI/iso

Copy the file from /iso corresponding to the UEFI bootloader being used ('linuxiumia32.efi' is for 32-bit and 'linuxiumx64.efi' is for 64-bit), e.g.

sudo cp /iso/linuxiumia32.efi /boot/efi/EFI/iso/

You can now clean up '/iso' e.g.

sudo rm /iso/*



Download an ISO ready for booting

Download an Ubuntu ISO (e.g. ubuntu-14.04.4-desktop-amd64.iso) and save it in the ISO directory ('c:\iso' or '/iso') as 'ubuntu-desktop-amd64.iso'

Although any ISO can be used it must be saved as a file called 'ubuntu-desktop-amd64.iso' so the bootloader can find it. I've included 'amd64' in the name as a reminder that it is better to use 64-bit ISOs. 


Booting the ISO

Reboot your mini PC and bring up the boot menu (typically F7 or F11 on mini PCs)

Select the option to boot called 'UEFI: Built-in EFI Shell'

Hit escape to get to the 'shell' prompt and enter the following command to start my bootloader (either 'linuxiumia32.efi' or 'linuxiumx64.efi' depending on above):

fs0:\efi\iso\linuxiumia32.efi 

You should now see a message saying 'Booting from (hdX, gptY)/iso/ubuntu-desktop-amd64.iso ...'

Shortly after you'll see various messages as the kernel starts up (I've deliberately removed 'quiet' so you can see what is happening) before the desktop appears. And that's it; all ready to use.

Because this is an ISO there is no persistence of data. And depending on the mini PC not everything like wifi and sound will work on a standard ISO. 

If you are feeling adventurous, you could create a permanent entry in the boot menu using 'efibootmgr' rather than boot using the UEFI EFI shell. First you'll need to install 'efibootmgr' (e.g. 'sudo apt-get install -y efibootmgr') and then the syntax for creating the boot entry for a mini PC with eMMC will be something like:

efibootmgr -c -d /dev/mmcblk0 -p 1 -l "\EFI\iso\linuxiumia32.efi" -L "Boot from ISO"

or for a mini PC with SSD:

efibootmgr -c -d /dev/sda -p 1 -l "\EFI\iso\linuxiumia32.efi" -L "Boot from ISO"

depending on your installation so please make sure the syntax of the command is correct for your mini PC.

And if you can I'd appreciate a donation through http://goo.gl/nXWSGf

Installing Ubuntu on the Braswell N3050 SOC based Intel NUC

posted 5 Mar 2016, 07:02 by Ian MORRISON   [ updated 5 Mar 2016, 07:04 ]


First install Ubuntu 14.04.3 LTS. Download 'ubuntu-14.04.3-desktop-amd64.iso' from http://releases.ubuntu.com/trusty/ and install from USB using 'dd' (or 'Rufus' on Windows).

Wifi will be missing. So upgrade the Linux kernel to 4.1 or greater. I suggest using the kernel issued with Ubuntu 15.10 Beta 1 (or later) by downloading the following files from http://mirrors.kernel.org/ubuntu/pool/main/l/linux/ using 'wget':

linux-headers-4.1.0-3_4.1.0-3.3_all.deb
linux-headers-4.1.0-3-generic_4.1.0-3.3_amd64.deb
linux-image-4.1.0-3-generic_4.1.0-3.3_amd64.deb
linux-image-extra-4.1.0-3-generic_4.1.0-3.3_amd64.deb

and this file from http://mirrors.kernel.org/ubuntu/pool/main/l/linux-signed/ again using 'wget':

linux-signed-image-4.1.0-3-generic_4.1.0-3.3_amd64.deb

Install by entering:

dpkg -i *.deb

Now reboot and then update and upgrade all packages to the latest release:

apt-get update
apt-get upgrade

Sound on the Intel Compute Stick (Sterling City)

posted 24 Feb 2016, 08:49 by Ian MORRISON   [ updated 23 Jun 2017, 03:52 ]

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

If you ever needed to understand the concept 'kernel mainlining' then you should look no further than the issue of HDMI audio support for Linux on Intel's Atom Bay Trail and Cherry Trail CPUs. 

Intel developed a source code patch for Ubuntu 14.04 to provide for Low Power Engine (LPE) Audio support on Bay Trail High-Definition Multimedia Interface (HDMI) (see https://01.org/ubuntu-hdmi). At the time the mainline kernel was 3.16.7-ckt3 and the patch was for the Ubuntu 'trusty linux-lts-utopic ' kernel 3.16.0-30.40. But because the source code was developed as a patch to a specific kernel, when Ubuntu 14.04 moved to the 'trusty linux-lts-vivid' kernel (or 3.19.0) it meant no more LPE Audio support for HDMI as the source code was a classic example of out-of-tree code.

Had the code been merged into the mainline kernel (the "mainline" being the kernel maintained by Linus Torvalds and used as a base by Linux distributors) then the code would have been available to all Linux users and more importantly would have been available in new kernels going forward.

Now it would be easy to therefore blame Intel for the lack of audio support given how these CPUs are being used in mini PCs however it must be remembered that companies have to make commercial decisions as contributing code incurs cost and expense. And Intel's current processor strategy excludes Linux support on “tablet” processors. Furthermore Intel is no exception in making decisions and reviewing them as required so we have to accept any implications for mini PCs at this time. Also there is also nothing to stop developers working with the kernel community to get the code into the mainline kernel. Except in this case we've kind of missed the boat. There's a lot of effort required now to port that patch ready for the current mainline kernel. And then the code would have to be back-ported to all the other kernel versions used by different distros, releases and development projects: like Android, OpenELEC, Chromium OS etc. But given that mini PCs have been in a steep development curve there is also question mark of whether it is worth it when a new CPU is just around the corner.

So for me it was a set of circumstances that has led me to an alternative solution. Having just replaced a monitor I noticed that the new one came with an audio 'line-in' allowing a 3.5mm jack to be inserted to enable the use of the monitor's internal speakers. And a local IT shop just happened to email a flyer that included a relatively cheap ($15) USB audio adapter claiming to be plug-and-play and supported by Linux. Well there was only one way to find out. Having bought the adapter pictured here:



I discovered it is just sufficiently wide to overlap the other USB port when plugged in. A solution was to either use an extension able such as:
     
USB3.0                                                    USB2.0


or plug the adapter into the USB hub I had connected to support my wired keyboard and mouse. Having side-stepped that drama the big question was would it work? This is what I saw in Ubuntu:




A quick speaker test confirmed that both left and right were working in Ubuntu. So then I tried with Android-x86 and yes there was ... sound.

Although not technically much of an achievement at least I have working audio. Which means that I can still try to get HDMI audio working through writing code but the pressure or urgency is no longer there. Plus I get to listen to some music now while I hack away at the code regardless of the OS I'm running.

Chromium OS on the Intel Compute Stick (Sterling City)

posted 23 Feb 2016, 22:43 by Ian MORRISON   [ updated 5 Mar 2016, 20:42 ]



Background

Chromebooks, boxes and most recently bits continue to proliferate partly due to their simplicity in providing an immediate connection to the web through Chrome without the hassle of lengthy boot-ups, enforced wait while automatic update install or having to navigate through menus to start a browser application.

So wouldn't it be nice to get similar functionality on an Intel Compute Stick (Sterling City) without necessarily having to install any software on it or replace your existing OS? Well whilst Google Chrome OS is the Google product that OEMs ship on Chromebooks/boxes/bits for general consumer use Google have released fundamentally the same code base as the Chromium OS open source project. Developers can then compile and build Chromium OS for specific hardware. And in some cases they then release their builds to the community for all to share.

I've tried some of the existing community builds of Chromium OS on the Intel Compute Stick (Sterling City) only to find that they wouldn't boot. So I've built and tested a specific version just for this device and packaged it to run on a USB. This means you can boot directly from a USB into Chromium OS and use like a regular OS as everything will be saved (as in persistence) when you shutdown allowing you to restart from where you left off.


Installation

First set the BIOS 'Select Operating System' to 'Windows 64 bit' and ensure USB booting is enabled so you can obviously boot from the USB. Note that if you want to reboot into Windows then you'll need to reset the BIOS 'Select Operating System' back to 'Windows 32 bit' if you are using the default supplied Windows installation.

Next download my Chromium OS image file from https://drive.google.com/file/d/0B99O3A0dDe67QWM4bHdrTE1na1k and uncompress it (e.g. in Linux enter '7z x linuxium-ics_sc-chromiumos_image.bin.7z').

Now write the image file to a USB (e.g. in Linux enter 'dd if=linuxium-ics_sc-chromiumos_image.bin of=/dev/sdX bs=4M' changing 'X' for the relevant drive letter (e.g. a for /dev/sda) corresponding to your USB.

Finally attached the USB to your device and rapidly hit F10 after power-up to show the boot menu options and then select the USB.

The first boot takes longer than subsequent boots while it loads everything so even it seems like nothing is happening just be patient. Finally a small screen will be displayed asking you to:
  • Select language (if required)
  • Connect to a network (this is required)
  • Login using your Google credentials
Now watch while the system panel appears along with the Chromium browser. As soon as your settings have finished being synced you're set to go!



Increasing the 'home' partition size

By keeping the installation image at a reasonable size it means that your Chromium OS 'home' directory will be relatively small as it will not use all of the available space on the USB you are running from. This can easily be fixed for Linux users by inserting the USB into a device running Linux, unmounting any of the partitions that may have automatically been mounted from the USB, and entering the following commands in a terminal window:
  • Increase STATE (/dev/sdX1) partition to maximum size
sudo sgdisk -e /dev/sdX
sudo gdisk /dev/sdX << EOF 
d
1
n 



0700
w
Y
EOF
  • Make sure STATE (/dev/sdX1) partition file system is clean
sudo e2fsck -f /dev/sdX1
  • Resize STATE (/dev/sdX1) partition to maximum size
sudo resize2fs /dev/sdX1

Again you should replace 'X' with the relevant drive letter (e.g. a for /dev/sda) corresponding to your USB. Also note that there are three blank lines in the above 'gdisk' command which must be included for the command to execute correctly. You can now reboot from the USB and run Chromium OS again.



Installing Ubuntu using Crouton

First make sure there is sufficient disk space by increasing the 'home' partition to utilize all the available space on the USB (see the above instructions).
Then go to https://github.com/dnschneid/crouton and read the 'README.md' or alternatively:

  • Click on the link at the top of that web page found in the line that reads 'Chromium OS Universal Chroot Environment https://goo.gl/fd3zc'.
  • Hit 'Ctrl-Alt-t' to bring up 'crosh' (the Chrome OS developer shell).
  • Type in:
        shell
  • And then enter:
        sudo sh ~/Downloads/crouton -t unity-desktop -r trusty
(Note: the password is 'p' i.e. a single lower-case letter p)
  • Now watch and wait for the installation to complete, entering your username and password when requested.
  • To start Ubuntu enter:

        sudo startunity
     
  • To end your session logout using system menu from top right of screen to returned back to the 'crosh' terminal


Minimal FAQ
  • The USB used for Chromium OS must be fast enough to ensure performance so don't use the oldest USB you can find lying around.
  • The minimum size for the USB is 4GB to run Chromium OS or 8GB if you are also going to install Ubuntu via Crouton.
  • I currently immediately stop 'powerd' (the system daemon that manages power states) on booting Chromium OS to prevent freezing and lockouts caused by being idle/inactive or entering sleep mode  From a 'crosh' window bring up a 'shell' and enter 'sudo stop powerd'.
  • The password for 'sudo' is 'p' i.e. a single lower-case letter p.

Useful keyboard shortcuts
 
Chromium OS:
Ctrl-Alt-t -> Brings up crosh (Chrome OS developer shell)
Ctrl-F5 -> Take a screenshot within ChromiumOS
Crouton:
Ctrl-Alt-F1 -> Switches window from Ubuntu to Chromium OS
Ctrl-Alt-Shift-F1 -> Switches window back from Chromium OS to Ubuntu


Acknowledgements

This is a development release of Chromium OS and is based on code released by Google (see https://www.chromium.org/chromium-os/developer-guide) compiled specifically for the Intel Compute Stick (Sterling City). It will not work on other devices. Whilst every effort has been made to make this release as stable as possible it is probably not advisable to use it in production systems.

Enjoy and please donate (http://goo.gl/nXWSGf) if you like my work to help cover the ongoing costs of bring you these exciting developments.

Android-x86 on the Intel Compute Stick (Sterling City)

posted 23 Feb 2016, 05:23 by Ian MORRISON   [ updated 5 Mar 2016, 20:45 ]

With the growing interest in Remix OS and the new Phoenix OS I thought it would be interesting to install these Android-x86 based systems together with the original Android-x86 on the latest Intel Compute Stick to be able to see what the key differences are.

The following instructions should be simple enough for anyone to follow and work on the new ICS STK1AW32SC. It is possible to multi-boot Windows, Linux and the Android based systems and I've previously posted instructions for dual-booting Windows and Ubuntu so I'm assuming that an Ubuntu installation is already understood.

So the starting point is to set the BIOS 'Select Operating System' to 'Windows 64 bit' and ensure USB booting is enabled so you can install Ubuntu from a USB. First create a LiveUSB with Ubuntu 15.10 and install on your ICS SC. Note that I did try 14.04 but it didn't work initially and I haven't investigated any further to determine if it would be possible.



Having installed and booted Ubuntu it is necessary to install the squash file system tools in order to improve the speed of the Android systems when running:

sudo apt-get install squashfs-tools


Initially you going to install the two latest versions of Android-x86 available from http://www.android-x86.org/download. Download the 'android-x86-4.4-r5.iso' ISO and to make a bootable Android-x86 enter:

sudo mkdir /boot/android-x86-4.4-r5
sudo mount android-x86-4.4-r5.iso /mnt
sudo cp /mnt/initrd.img /boot/android-x86-4.4-r5
sudo cp /mnt/kernel /boot/android-x86-4.4-r5
sudo cp /mnt/ramdisk.img /boot/android-x86-4.4-r5
sudo cp /mnt/system.sfs /boot/android-x86-4.4-r5
sudo unsquashfs -d /boot/android-x86-4.4-r5/system /boot/android-x86-4.4-r5/system.sfs
sudo mv /boot/android-x86-4.4-r5/system/system.img /boot/android-x86-4.4-r5
sudo rm -rf /boot/android-x86-4.4-r5/system /boot/android-x86-4.4-r5/system.sfs
sudo umount /mnt


Now download the 'android-x86_64-5.1-rc1.img' EFI image also from that site and 'install' by entering:

sudo mkdir /boot/android-x86_64-5.1-rc1
sudo kpartx -l android-x86_64-5.1-rc1.img | head -1 | sed 's/ .*//'

Make a note of the loop device (e.g. loop0p1) for the 'mount' command below:

sudo kpartx -a android-x86_64-5.1-rc1.img
sudo mount /dev/mapper/loop0p1 /mnt
sudo cp /mnt/initrd.img /boot/android-x86_64-5.1-rc1
sudo cp /mnt/kernel /boot/android-x86_64-5.1-rc1
sudo cp /mnt/ramdisk.img /boot/android-x86_64-5.1-rc1
sudo cp /mnt/system.sfs /boot/android-x86_64-5.1-rc1
sudo umount /mnt
sudo kpartx -d android-x86_64-5.1-rc1.img
sudo unsquashfs -d /boot/android-x86_64-5.1-rc1/system /boot/android-x86_64-5.1-rc1/system.sfs
sudo mv /boot/android-x86_64-5.1-rc1/system/system.img /boot/android-x86_64-5.1-rc1
sudo rm -rf /boot/android-x86_64-5.1-rc1/system /boot/android-x86_64-5.1-rc1/system.sfs


The next Android system to install is Phoenix OS and the installation image can be found at http://www.phoenixos.com/download_x86 so start by download the installation file 'PhoenixOSInstaller-1.0.3-beta.exe'. Although this is issued as a Windows executable we can still extract the files required on Linux by entering:
 
sudo mkdir /boot/phoenixos
sudo 7z x -o/boot/phoenixos PhoenixOSInstaller-1.0.3-beta.exe
sudo rm /boot/phoenixos/install.img
sudo unsquashfs -d /boot/phoenixos/system /boot/phoenixos/system.sfs
sudo mv /boot/phoenixos/system/system.img /boot/phoenixos
sudo rm -rf /boot/phoenixos/system /boot/phoenixos/system.sfs


Finally to install Remix OS you need to download the one marked EFI from http://www.jide.com/en/remixos-for-pc#downloadNow and enter:

sudo unzip Remix_OS_for_PC_64_B2016020201_Alpha_EFI.zip
sudo mkdir /boot/remixos
sudo kpartx -l Remix_OS_for_PC_64_B2016020201_Alpha_EFI.img | head -1 | sed 's/ .*//'

Again make a note of the loop device (e.g. loop0p1) for the 'mount' command below:

sudo kpartx -a Remix_OS_for_PC_64_B2016020201_Alpha_EFI.img
sudo mount /dev/mapper/loop0p1 /mnt
sudo cp /mnt/initrd.img /boot/remixos
sudo cp /mnt/kernel /boot/remixos
sudo cp /mnt/ramdisk.img /boot/remixos
sudo cp /mnt/system.sfs /boot/remixos
sudo umount /mnt
sudo kpartx -d Remix_OS_for_PC_64_B2016020201_Alpha_EFI.img
sudo unsquashfs -d /boot/remixos/system /boot/remixos/system.sfs
sudo mv /boot/remixos/system/system.img /boot/remixos
sudo rm -rf /boot/remixos/system /boot/remixos/system.sfs

None of the systems have a 'persistent' pseudo data partition at the stage so the next step is to create an empty 'data.img' file by entering:

sudo dd if=/dev/zero of=data.img bs=2G count=1
sudo mkfs.ext4 -F data.img
sudo fsck.ext4 -fp data.img

You could modify the 'count' if a larger file is required however I recommend 2GB as a minimum.

Now copy this 'data.img' file to each of the boot directories created above:

sudo cp data.img /boot/android-x86-4.4-r5
sudo cp data.img /boot/android-x86_64-5.1-rc1.img
sudo cp data.img /boot/phoenixos
sudo cp data.img /boot/remixos

You can now delete all the downloads and any files/directories created from the above commands to tidy up and save on space.

To boot each Android system you need to create the grub config files:

sudo cat <<EOF > /boot/grub/android-x86-4.4-r5.cfg
menuentry 'Android-x86 4.4-r5' --class android-x86 {
        search --file --no-floppy --set=root /boot/android-x86-4.4-r5/system.img
        linux /boot/android-x86-4.4-r5/kernel root=/dev/ram0 androidboot.hardware=android_x86 quiet DATA=/boot/android-x86-4.4-r5
        initrd /boot/android-x86-4.4-r5/initrd.img
}
EOF

sudo cat <<EOF > /boot/grub/android-x86_64-5.1-rc1.cfg
menuentry 'Android-x86 5.1-rc1' --class android-x86 {
        search --file --no-floppy --set=root /boot/android-x86_64-5.1-rc1/system.img
        linuxefi /boot/android-x86_64-5.1-rc1/kernel root=/dev/ram0 androidboot.hardware=android_x86_64 quiet DATA=/boot/android-x86_64-5.1-rc1
        initrdefi /boot/android-x86_64-5.1-rc1/initrd.img
}
EOF

sudo cat <<EOF > /boot/grub/phoenixos.cfg
menuentry 'Phoenix OS 1.0.3 Beta' --class phoenix {
        search --file --no-floppy --set=root /boot/phoenixos/system.img
        linuxefi /boot/phoenixos/kernel root=/dev/ram0 androidboot.hardware=android_x86 quiet DATA=/boot/phoenixos
        initrdefi /boot/phoenixos/initrd.img
}
EOF

sudo cat <<EOF > /boot/grub/remixos.cfg
menuentry 'Remix OS Alpha' --class android-x86 {
        search --file --no-floppy --set=root /boot/remixos/system.img
        linuxefi /boot/remixos/kernel root=/dev/ram0 androidboot.hardware=remix_x86_64 androidboot.selinux=permissive quiet DATA=/boot/remixos
        initrdefi /boot/remixos/initrd.img
}
EOF

If you are using 'cut&paste' to enter these commands then make sure to only copy and paste each section of seven lines at a time otherwise you might find the shell doesn't recognise the 'EOF' line due to trailing spaces and you'll end up just with one big file!

     

To make the boot options appear on the initial menu you need to edit '/etc/default/grub' and make sure the following lines are commented out:

#GRUB_HIDDEN_TIMEOUT=0
#GRUB_HIDDEN_TIMEOUT_QUIET=true

Then edit the file '/etc/grub.d/40_custom' and add the following lines which create the boot menu options:

source /boot/grub/android-x86-4.4-r5.cfg
source /boot/grub/android-x86_64-5.1-rc1.cfg
source /boot/grub/phoenixos.cfg
source /boot/grub/remixos.cfg

And lastly update grub so the options appear on the next boot:

sudo update-grub

Although the standard Phoenix system partition doesn't include Google Play Store you can address this by following https://www.reddit.com/r/PhoenixOS/comments/41flzt/phoenixos_rooted_systemimg and downloading the file 
'PhoenixOS-x86.1.0.3.rooted.gapps.resized.system.img.zip' from https://mega.nz/#!HgY3HIbK!AHzALibHdlrluCmTzwMmk2nuN_esDSMWA48bIQL1TVQ. To install the updated system image enter:

sudo unzip PhoenixOS-x86.1.0.3.rooted.gapps.resized.system.img.zip
sudo mv system.img /boot/phoenixos

Again you can now delete the download and any files/directories created from the above commands.

Similarly Remix OS also cannot include Google Play Store so by following http://liliputing.com/2016/01/remix-os-for-pc-how-to-install-the-google-play-store.html once you have booted Remix OS you can easily add it.


Finally reboot and select the Android-x86 system you wish to boot from the menu and enjoy!

Android on Chromium OS

posted 6 Dec 2015, 20:57 by Ian MORRISON   [ updated 5 Mar 2016, 20:43 ]

This is fun ... playing an Android game on Chromium OS running on a Windows Intel Compute Stick.


The game (Unblock Me) runs using the App Runtime for Chrome (ARC) ... more details about ARC Welder at https://developer.chrome.com/apps/getstarted_arc (and for the game at https://play.google.com/store/apps/details?id=com.kiragames.unblockmefree and wallpaper at http://lukaesenko.com/wp-content/uploads/2014/07/socdix08.jpg).

Not all games will run ... but certainly some of the old time-honoured favourites like Paper Toss, 4 Pics 1 Word, Hill Climb and even Angry Birds work!

A pseudo Intel Chromium Stick

posted 26 Oct 2015, 03:25 by Ian MORRISON   [ updated 5 Mar 2016, 20:43 ]


While waiting for a commercially built device you can always try Chromium OS on your Intel Compute Stick device (or similar) to get an approximation albeit with the (seemingly standard) caveats. 

As not all the readily available builds work flawlessly, I've built an image that includes wireless and also works with Crouton meaning you get two operating systems for the price of none! 

Yes that's right, Chromium OS and Ubuntu, and you can also run from a USB (or SD card on the Intel Compute Stick) meaning you won't affect your existing Windows installation. So three-in-one: that's got to be worth a donation surely? The bad news is that sound doesn't work (I have tried but it is complicated and I haven't succeeded yet) and I also haven't tried Bluetooth.


Basic installation steps

  1. Download my Chromium OS image file from https://drive.google.com/file/d/0B99O3A0dDe67ZlpDRXpCSXBJU1U and uncompress it (e.g. in Linux enter '7z x linuxium-chromiumos_image.bin.7z').
  2. If you will be running Chromium OS on an Intel Compute Stick (ICS) you can use either a USB or an SD card as media. For all other devices you'll be limited to a USB unless you modify the boot loader configuration.
  3. Put the media you want to run Chromium OS on into your device.
  4. Next depending on which OS you are currently running, use either Rufus (Windows) or 'dd' (Linux) to write the image to the media (e.g. in Linux enter 'dd if=linuxium-chromiumos_image.bin of=/dev/sdX bs=4M' changing 'X' for the relevant drive letter, e.g. /dev/sda).
  5. Then reboot the device and selecting the media from the boot menu options (rapidly hit F10 after power-up on the Intel Compute Stick to bring up this menu).
  6. Now patiently wait for everything to load. It will seem like nothing is happening so keep being patient. A perfect time to make a donation to me using your new smart phone!
  7. Finally a small screen will be displayed so:
  8. Select language (if required)
  9. Connect to a network (this is required)
  10. Login using your Google credentials
  11. Again wait patiently this time as everything is configured. Magically, and before your eyes, the system panel will update (including orientation) along with the Chromium browser as all your settings are synced.
  12. Initially no wallpaper will be defined so to complete the install you should update with your favourite picture (hint: I keep my on Google Drive so I first download the image and then 'Set wallpaper').

Increasing the 'home' partition size

By keeping the installation image at a reasonable size it means that your 'home' directory will be relatively small and will not use all of the available space on the media you are running from. This can easily be fixed for Linux users by inserting the media into a device running Linux, unmounting any of the partitions that may have automatically been mounted from the media, and entering the following commands in a terminal window:

  • Increase STATE (/dev/sdX1) partition to maximum size
sudo sgdisk -e /dev/sdX
sudo gdisk /dev/sdX << EOF 
d
1
n 



0700
w
Y
EOF
  • Make sure STATE (/dev/sdX1) partition file system is clean
sudo e2fsck -f /dev/sdX1
  • Resize STATE (/dev/sdX1) partition to maximum size
sudo resize2fs /dev/sdX1

Again change 'X' for the relevant drive letter, e.g. /dev/sda) and also note that there are three blank lines in the above 'gdisk' command which must be included for the command to execute correctly. You can now insert the media back into your initial device and boot from boot menu (F10 on the ICS).


Installing Ubuntu using Crouton

First make sure there is sufficient disk spare by increasing the 'home' partition to utilize all the available space on the media (see the above instructions).
Then go to https://github.com/dnschneid/crouton and read the 'README.md' or alternatively:

  1. Click on the link on the web page shown as 'Chromium OS Universal Chroot Environment https://goo.gl/fd3zc'.
  2. Hit 'Ctrl-Alt-t' to bring up 'crosh' (the Chrome OS developer shell).
  3. Type in:
    1. shell
  4. And then enter:
    1. sudo sh ~/Downloads/crouton -t unity -r trusty
  5. Once more, patiently wait for the installation to complete, entering your username and password when requested.
  6. Now enter:
    1. sudo startunity
  7. This will start Ubuntu bring up HUD (hit 'Alt') and type:
    1. terminal
  8. Select a terminal icon and then from with the terminal window type:
    1. sudo apt-get -y install ubuntu-desktop
  9. If you thought you had been patient before then this next wait while the installation completes will certainly test you. You definitely have time to go to another computer and make a donation to me.
  10. Now logout using system menu from top right of screen and you'll be returned back to the 'crosh' terminal.
  11. Finally re-enter:
    1. sudo startunity
    and Ubuntu with Unity will be displayed in all its full glory.

Minimal FAQ

  • The media used for Chromium OS (i.e. the USB or SD card) must be fast enough to ensure performance so don't use the oldest media you can find lying around.
  • The minimum size for the media is 4GB to run Chromium OS or 8GB if you are also going to install Ubuntu via Crouton.
  • Powerwash (see Settings/Show advanced settings) can be used to refresh your media to remove your current user settings and start afresh. But remember to select the media when each automatic reboot occurs during the powerwash process.
  • I currently immediately stop 'powerd' (the system daemon that manages power states) on booting to prevent freezing and lockouts caused by being idle/inactive or entering sleep mode (and I really need to look at 'set_power_policy --help' as an alternative). From the 'crosh' window and at the 'shell' prompt enter 'sudo stop powerd'.

Useful keyboard shortcuts
 
Chromium OS:
Ctrl-Alt-t -> Brings up crosh (Chrome OS developer shell)
Ctrl-F5 -> Take a screenshot within ChromiumOS
Crouton:
Ctrl-Alt-F1 -> Switches window from Ubuntu to Chromium OS
Ctrl-Alt-Shift-F1 -> Switches window back from Chromium OS to Ubuntu


Acknowledgements

This is a development release of Chromium OS and is based on code released by Google (see https://www.chromium.org/chromium-os/developer-guide) and hadess (see https://github.com/hadess). Whilst every effort has been made to make this release as stable as possible it is probably advisable not to use it in production systems. It has been extensively tested on the Intel Compute Stick.  YMMV on other similar hardware.

Enjoy and please donate (http://goo.gl/nXWSGf) if you like my work so I can continue next with Cherry Trail devices.

1-10 of 48