Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 2.09 KB

File metadata and controls

36 lines (25 loc) · 2.09 KB

Automated Ubuntu image building for Raspberry Pi (POC)

This repository contains a simple script to automate the process of building custom Ubuntu images for the Raspberry Pi. It provides two ways of customizing the image:

  1. Script file: A script file to be run inside chroot during the image creation.
  2. Cloud-init configuration file: A configuration file to be applied by cloud-init once the system boots up for the first time.

Arguments

In this section, the arguments of the tool are described. All arguments are optional.

  1. -a [armhf|arm64]: Target architecture of image.
  2. -v [18.04.5|20.04.3]: Target version of Ubuntu.
  3. -h [raspi|raspi2|raspi3|raspi4]: Target hardware for image. It is important to provide the right value [raspi2|raspi3|raspi4] for Ubuntu 18.04.5 and [raspi] for Ubuntu 20.04.3. The value must align with available downloads from https://cdimage.ubuntu.com/releases/.
  4. -s [path]: Script file to customize image inside chroot.
  5. -c [path]: Cloud-init configuration file to customize image after system boot.
  6. -o [path]: Output image file.
  7. -q: Enable virtualization with QEMU (unstable).

Examples

In this section, two example usages are described.

  1. Build an Ubuntu 18.04.5 image with a cloud-init file.

    sudo ./build.sh -a arm64 -v 18.04.5 -h raspi4 -s ./examples/script.sh
  2. Build an Ubuntu 20.04.3 image with a script file and cloud-init file. Notice that the version of Raspberry Pi is not specified for Ubuntu 20.04.03.

    sudo ./build.sh -a arm64 -v 20.04.3 -h raspi -s ./examples/script.sh -c ./examples/cloud.cfg -q -o output.img.xz

Virtualization

Out-of-the-box virtualization is possible using QEMU. However, the virtualization support for actions such as apt-get upgrade and apt-get install is unstable and frequently hangs. It is recommended to run the tool on the target architecture.