Ubuntu Core 16 for i.MX6 and i.MX7 platforms

Published on March 16, 2017

Archived Notice

This article has been archived and may contain broken links, photos and out-of-date information. If you have any questions, please Contact Us.

We are proud to share our first Ubuntu Core release for all our i.MX platforms.

For the impatient

You can download the OS image from here:

This image has been updated (20180404) with the following changes:

  • Update kernel to 4.9.x revision
  • Update bootscript to read core/kernel version dynamically
  • Update core to revision 4330

The image is a 1GB SD card image that can be restored using zcat and dd under Linux.

~$ zcat ubuntu-core-nitrogen-*.img.gz | sudo dd of=/dev/sdX oflag=sync

For Windows users, please use Alex Page’s USB Image Tool.

What is Ubuntu Core?

Ubuntu Core is a minimalist rendition of Ubuntu. It is a lightweight, transactionally updated OS, where every application is installed confined from others. It is designed to run securely on autonomous machines, devices and other internet-connected digital things.Compared to a "regular" Ubuntu image, it offers:

  • Faster, more reliable and stronger security guarantees for apps and users.
  • Atomic transactional upgrades for apps and the OS itself (with roll-back).
  • Snaps, a new and simple application packaging system.
  • Signature authentication to prove that what’s running is secure.

What are the requirements?

An Ubuntu SSO account is required to create the first user on an Ubuntu Core installation.

  1. Start by creating an Ubuntu SSO account
  2. Import an SSH Key into your Ubuntu SSO account on this page.
    • Instructions to generate an SSH Key on your computer can be found here.

Once the account is properly created you will be able to login to the image and installing or developing snap packages.

What are snap packages?

As the website puts it, a snap is:

  • a squashFS filesystem containing your app code and a snap.yaml file containing specific metadata. It has a read-only file-system and, once installed, a writable area.
  • self-contained. It bundles most of the libraries and runtimes it needs and can be updated and reverted without affecting the rest of the system.
  • confined from the OS and other apps through security mechanisms, but can exchange content and functions controlled by OS policies.

So every piece of software must be bundle into a snap package. For instance, the entire base OS is packaged inside the core snap.Then the kernel and its firmware and modules are packaged inside a specific kernel snap. Another mandatory snap package to boot a system is called gadget which contains bootloader environment to allow to boot the board.

How to build an application?

This will not be covered in this article since the Ubuntu Core website covers the subject very well:

How to build an OS image?

First, we provide all the source code required to build the gadget and kernel snaps to make an image that runs on all our platforms:

As the repository documentation says, it is highly recommended to build from Ubuntu 16.04 or later.You first need to install the following packages in order to build Ubuntu Core.

~$ sudo apt update
~$ sudo apt install -y build-essential u-boot-tools lzop gcc-arm-linux-gnueabihf
~$ sudo apt install -y snap snapcraft
~$ sudo snap install ubuntu-image --classic --edge

 Then the build is pretty straight-forward:

~$ git clone https://github.com/boundarydevices/ubuntu-core.git
~$ cd ubuntu-core
~/ubuntu-core$ make

The output file should be named ubuntu-core-nitrogen-stable-yyyymmdd.img.gz.

Getting started

Now that you've flashed the pre-built (or your own) image, you can start experiencing with the OS.This section will provide some information we think are important to get started with Ubuntu Core.

First Boot

  1. The system will boot then become ready to configure
  2. The device will display the prompt “Press enter to configure
  3. Press enter then select “Start” to begin configuring your network and an administrator account.
  4. Follow the instructions on the screen, you will be asked to configure your network and enter your Ubuntu SSO credentials.
  5. At the end of the process, you will see your credentials to access your Ubuntu Core machine.
ssh @

At this point, the SSH key registered to your Ubuntu SSO account is on the target and you should be able to access the platform without any other credential required.NOTE: at bootup a network.py warning can appear if your board has a WiFi module. This is a warning telling us the interface is busy, there's no harm but we are investigating a work-around.

Useful snap commands

The snap tool offers many features, here will be listed the one we used:

  • Use list to see the installed packages and their version
user@localhost$ snap list
Name Version Rev Tracking Developer Notes
core 16-2.32.1 4330 stable canonical core
nitrogen-gadget 16.04-1 1 stable boundary gadget
nitrogen-kernel 4.9.x-1 1 stable boundary kernel
snapweb 0.26-11 323 stable canonical -
  • Use info to learn about a specific snap
user@localhost$ snap info core
name: core
summary: snapd runtime environment
publisher: canonical
contact: snappy-canonical-storeaccount@canonical.com
license: unknown
description: |
 The core runtime environment for snapd
type: core
snap-id: 99T7MUlRhtI3U0QFgl5mXXESAiSwt776
tracking: stable
refreshed: 2018-03-26T19:58:36Z
installed: 16-2.32.1 (4330) 72MB core
channels: 
 stable: 16-2.31.2 (4209) 72MB -
 candidate: 16-2.32.1 (4330) 72MB -
 beta: 16-2.32.2 (4380) 76MB -
 edge: 16-2.32.2+git652.8634405 (4402) 76MB -
  • Use refresh to update your components
user@localhost$ snap refresh

NOTE: at the time of this writing, the beta (1443) became stable and breaks the boot, a snap refresh will most likely fail. We are investigating the issue with Canonical.

  • You can even change a snap package using refresh
user@localhost$ snap refresh core --edge
  • Use changes to learn about the system changes
user@localhost$ snap changes
ID Status Spawn Ready Summary
1 Done 2017-03-14T14:43:28Z 2017-03-14T14:48:10Z Initialize system state
2 Doing 2017-03-14T14:56:00Z - Initialize device
  • Use install to install a new package (like you would apt install)
user@localhost$ snap install bluez

Manage your device remotely

Our image comes with the snapweb package which allows you to manage your device via a web interface.Simply visit the https://:4201 and should see the following window.snapweb_tokenThis token needs to be generate by the device, so you need to run the following command via SSH:

user@localhost$ sudo snapweb.generate-token

Then enter the provided token and click on Submit.snapweb_homeYou can see above that the web page shows which packages are currently installed.On the top right corner can be seen a Browse Store button which allows you to see which snap can be installed.snapweb_storeAs an example, we will install the qrcode-terminal application.snapweb_installOnce installed, it is possible to generate QRCode on the platform as expected:

user@localhost$ sudo su -c "qrcode-terminal 'https://boundarydevives.com' > /dev/tty0"

qrcode_terminal

Setting up a WiFi connection

In order to setup a WiFi connection, you need to first enable the interface by creating a new configuration file:

user@localhost$ sudo vi /etc/network/interfaces.d/wlan0
auto wlan0
iface wlan0 inet dhcp
    wpa-conf /home//wireless-setup.conf

Then in your home folder, you create add known SSID to the wireless-setup.conf file.

user@localhost$ wpa_passphrase   >> wireless-setup.conf

You now need to reboot and the platform will connect automatically to the listed SSID. That's it, this post should be a good introduction to this OS and how to use it on our platforms.As usual, feel free to leave a comment below, letting us know what is your experience.