CoreImageBuild

Snappy Core Image Build Process

Description and steps required to produce the snappy core image.

Triggering a new build

Currently the cdimage server is the machine responsible for triggering a new build for the core rootfs. The build is part of the cdimage cronjob, and currently built with the following parameters:

SUBPROJECT=system-image EXTRA_PPAS=snappy-dev/image for-project ubuntu-core cron.daily-preinstalled --live

Once the build is triggered by cdimage, it calls launchpad to execute the livecd-rootfs code. You can find more about this logic at http://bazaar.launchpad.net/~ubuntu-cdimage/ubuntu-cdimage/mainline/view/head:/lib/cdimage/livefs.py

livecd-rootfs build jobs

The build jobs for live-cdrootfs are currently part of launchpad, and you can find the logs for ubuntu-core (vivid) at https://launchpad.net/~ubuntu-cdimage/+livefs/ubuntu/vivid/ubuntu-core-system-image/

Example of a build log: https://launchpadlibrarian.net/205921575/buildlog_ubuntu_vivid_amd64_ubuntu-core-system-image_BUILDING.txt.gz

At this stage the livecd-rootfs code that will be executed is the one provided by the livecd-rootfs source package (for the same series). For vivid we have package changes that are not available in the archive, so you might find more information at the livecd-rootfs src package available at https://launchpad.net/~snappy-dev/+archive/ubuntu/image

For the hooks and changes required for ubuntu-core, please also check http://bazaar.launchpad.net/~ubuntu-core-dev/livecd-rootfs/trunk/files/head:/live-build/ubuntu-core/

cdimage rootfs output

Once built, there is also a small logic in cdimage (http://bazaar.launchpad.net/~ubuntu-cdimage/ubuntu-cdimage/mainline/view/head:/lib/cdimage/livefs.py) to publish the resulted files.

The artifacts are published at the public cdimage server, and for ubuntu-core you can find them at http://cdimage.ubuntu.com/ubuntu-core/daily-preinstalled/pending/

System Image import

The plain rootfs that gets built as a result of livecd-rootfs doesn't yet contain all the required files for a working snappy core rootfs. This extra logic gets added once the rootfs tarball gets imported by the system-image server code, making it available at the public system-image instance at http://system-image.ubuntu.com

You can find out more details about the system-image specific customizations at http://bazaar.launchpad.net/~ubuntu-system-image/ubuntu-system-image/server/view/head:/lib/systemimage/generators.py#L369 (look for if options.get("product", "touch") == "core" for ubuntu-core specific changes).

Building the final image

After the image is finally built and imported by cdimage, you can just call ubuntu-device-flash to generate the final image for your target.

For x86/KVM:

$ sudo ubuntu-device-flash core 15.04 --channel edge --output x86.img
Determining oem configuration
Starting download of generic-amd64
40.93 KB / 40.93 KB [===] 100.00 % 97.50 KB/s 
Done
Fetching information from server...
Downloading and setting up...
41.86 MB / 41.86 MB [===] 100.00 % 1.69 MB/s 
95.74 MB / 95.74 MB [===] 100.00 % 1.35 MB/s 
Installing generic-amd64
Starting download of generic-amd64
40.93 KB / 40.93 KB [===] 100.00 % 46.92 KB/s 
Done
New image complete
Summary:
 Output: x86.img
 Architecture: amd64
 Channel: edge
 Version: 57
Launch by running: kvm -m 768 x86.img

Steps required to locally reproduce the above steps

  1. Find the right arguments/scripts required to run livecd-rootfs by hand (if you don't have access to launchpad)
  2. Reproduce the system-image server modifications locally
  3. Add an option to ubuntu-device-flash to support flashing a custom rootfs

Snappy/CoreImageBuild (last edited 2015-05-11 23:40:42 by bade21f9)