What your image is made of
If you simply run
snap list on your Ubuntu Core image, you will see that your image is already composed of many snap. For instance, on our Intel Joule:
$ snap list
Name Version Rev Developer Notes
core 16.04.1 714 canonical -
joule 16.04-0.8+1 1 canonical -
joule-linux 4.4.0-1000-0+joule08-1 1 canonical -
You will always have at least 3 snaps installed on your Ubuntu device:
- A Core snap
- A Kernel snap
- A Gadget snap
Optionally, you will have default application snaps installed on your image. We are going to add one to our custom device image.
$ snap info core
summary: "snapd runtime environment"
The core runtime environment for snapd
installed: 16.04.1 (714) 79MB -
refreshed: 2016-12-16 04:28:38 +0000 UTC
stable: 16.04.1 (714) 0B -
candidate: 16.04.1 (714) 0B -
beta: 16.04.1 (714) 0B -
edge: 16.04.1 (866) 0B -
The Core snap (previously called Ubuntu Core snap) is the base system your system is running on. It contains for instance the init system, basic services like networking, default files and libraries like libc. It also has snapd installed and running within it, which is managing other snaps and reboot for the device. You can basically see this core snap as the “/” of your system.
You will not normally need to ship your own Core snap and rely on the maintained Ubuntu one.
$ snap info joule-linux
summary: "linux kernel for Intel Joule"
Kernel snap for Intel Joule
installed: 4.4.0-1000-0+joule08-1 (1) 140MB -
refreshed: 2016-12-11 12:03:09 +0000 UTC
candidate: 4.4.0-1000-0+joule08-1 (1) 0B -
beta: 4.4.0-1000-0+joule08-1 (1) 0B -
edge: 4.4.0-1000-0+joule08-1 (1) 0B -
The kernel snap ships the Ubuntu Core kernel, specific for a device hardware. It doesn’t limit itself to the kernel, as it includes other parts like drivers.
You can build your own kernel snap via snapcraft if desired, but most of the time, you won’t differentiate on the kernel and rely on the one provided for your device if already enabled. If not, you are more than welcome to build your own kernel snap and share it with the community of course!
We are going to reuse the one that is already provided in the store for our device.
$ snap info joule
summary: "Joule system package"
system configuration of Intel Joule platform
installed: 16.04-0.8+1 (1) 1MB -
refreshed: 2016-11-18 08:47:45 +0000 UTC
The gadget snap is a key snap for device boot, as it contains the description of the boot and file system layout, which is then used for image building. The gadget snap is also responsible for defining and manipulating the system properties which are specific to one or more devices (like default configuration for some services). You can thus have multiple devices with the exact same hardware, but different gadget snap for different level of use (beginner, intermediate, experts) or different kind of use (home router, enterprise configuration…).
You can as well build your own gadget snap, upload it to the store after signing it, but here, we are going to reuse the existing one as well.
The model is a json file that specifies which model you are building, what Ubuntu Core series you are tracking for which architecture, and what gadget and kernel snaps you are using in your image creation for your device. You can as well specify extra required snaps that will be installed by default on the image.
An assertion is a digitally signed document that expresses a fact or policy by a particular authority about a particular object in the snap universe. An assertion consists of a set of structured headers, which vary based on the type of assertion, an optional body (variable format, depends on type of assertion) and the signature.
We are thus going to create a model json file, and then sign it with our authority account to create a model assertion that will be accepted by ubuntu-image.
Let’s create those keys for signing before diving into the model itself!