flatcar / sysext-bakery

Recipes for baking systemd-sysext images
Apache License 2.0
62 stars 29 forks source link

bake_flatcar_image.sh: Bake sysexts into Flatcar OS images #48

Closed t-lo closed 7 months ago

t-lo commented 7 months ago

This change introduces bake_flatcar_image.sh, a standalone script for creating Flatcar OS images with sysexts (from the bakery and other sources) included.

The script will download a generic Flatcar OS image (version can be specified), copy local sysexts into root or OEM partitions, and create respective symlinks to /etc/extensions.

By default, the script operates on local sysext files. However, the --fetch option may be specified to download sysext(s) from the latest Bakery release.

Optionally, vendor images can be created. If requested, the script will use the Flatcar SDK corresponding to the OS image version to generate vendor images from the generic image.

NOTE that building vendor images requires https://github.com/flatcar/scripts/pull/1682 . To test, apply https://github.com/flatcar/scripts/commit/28070022226970ff3e819516a60721d8648a0f23.diff right after the script checked out the scripts repo (can be done in parallel because the script will spend some time downloading SDK container and OS images before continuing).

How to use

Run the script:

./bake_flatcar_image.sh --fetch wasmtime:wasmtime-17.0.1-x86-64.raw

or

wget https://github.com/flatcar/sysext-bakery/releases/download/latest/wasmtime-17.0.1-x86-64.raw
wget https://github.com/flatcar/sysext-bakery/releases/download/latest/wasmtime.conf
./bake_flatcar_image.sh wasmtime:wasmtime-17.0.1-x86-64.raw

Then loopback-mount flatcar_production_image.bin (partition 9) to verify.

To build a bootable image, use

wget https://github.com/flatcar/scripts/commit/28070022226970ff3e819516a60721d8648a0f23.diff
./bake_flatcar_image.sh --vendor qemu wasmtime:wasmtime-17.0.1-x86-64.raw
# AFTER THE SDK WAS CHECKED OUT, in a separate terminal window, run
cd flatcar-os-image
patch -p1 <../28070022226970ff3e819516a60721d8648a0f23.diff
# after the build concluded, run
chmod 755 flatcar_production_qemu_uefi.sh
bunzip2 flatcar_production_qemu_uefi_image.img.bz2
./flatcar_production_qemu_uefi.sh -nographic -snapshot
# [ ... system boots ...]
wasmtime --version

Testing done