Commit Graph

1120 Commits

Author SHA1 Message Date
Kai Lueke
de4eb8f755 Set up symlinks for same image artifacts to remove qemu/qemu_uefi_secure
The qemu and qemu_uefi_secure images have the same contents as the
qemu_uefi image which wastes space on the release server. A similar
case is the PXE vmlinuz which is the same as the regular one, too.

Set up symlinks for same images, and also detect this when compressing
to set up symlinks there as well. To reduce complexity, the qemu and
qemu_uefi_secure images are not supported anymore and the Jenkins or
GitHub CI will skip over them if specified. Users that build their own
images need to adapt, though.
2024-04-09 15:09:29 +02:00
Adrian Vladu
7d4917d67c image_to_vm: add support for hyper-v vhdx format
Add support for Gen 2 Hyper-V VMs.

`./image_to_vm` tool has now a new supported format: `hyperv_vhdx`,
that produces .vhdx dynamic disks.

How to use:

```bash
 ./image_to_vm.sh --from ../build/images/amd64-usr/developer-latest/ --format hyperv_vhdx
```

See: https://github.com/flatcar/Flatcar/issues/1009

Uses PR: https://github.com/flatcar/bootengine/pull/92

Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
2024-04-09 10:52:06 +03:00
Kai Lueke
5e7b4b6b3d qemu_template.sh: Allow parameters for kernel and initrd
With the PXE script it is easy to boot different versions from one
folder without any copies because the kernel and PXE initrd are always
"fresh".
Instead of only supporting hardcoded file names, support parameters for
the kernel and initrd file to be used.
2024-04-04 16:53:08 +09:00
Kai Lueke
9d3200bc47 build_library/qemu_template.sh: Add notes for swtpm init commands
For the swtpm version in Ubuntu some init command is required first.
2024-04-04 16:53:08 +09:00
Kai Lueke
71866e4824 qemu_template.sh: Allow parameters for VM pflash firmware
The qemu UEFI and regular qemu script only differ by having a default
value for the firmware. If one tries to switch between different
firmwares one normally would modify the script.
Make it easier to switch boot modes and use custom firmwares by
supporting a flag to set the pflash contents.
2024-04-04 12:55:37 +09:00
Kai Lueke
48780dc375 qemu_template.sh: Add support for attaching a software TPM
For testing TPM2-backed rootfs encryption it is handy to have a software
TPM option for the qemu script.
Add a flag for a software TPM with swtpm like kola also does. The user
has to specify a folder for the secret state and this won't be removed
because the same store should be able to be passed when booting the VM
again after shutdown.
2024-04-04 12:55:37 +09:00
Kai Lueke
7379db37e8 vm_image_util.sh: Bump default VM memory to 2 GB
While Flatcar itself runs fine with 1 GB, many workloads do not and
having to debug this is time consuming when one forgets to bump the VM
memory, e.g., in the Qemu script.
Default to 2 GB as known-good setting for things like Kubernetes or
setting up LUKS devices.
2024-04-04 12:55:37 +09:00
Kai Lueke
4d5e46432a qemu_template.sh: Allow parameters for VM image and memory
When testing multiple images one always has to copy them to the
expected file name, and when trying to run two VMs this means one needs
to either use separate directories or modify the qemu script. One also
needs to modify the qemu script to bump the memory for K8s or for LUKS.

Support parameters for the VM image name and the VM memory.
2024-04-04 12:55:37 +09:00
Kai Lueke
1513f3a966 Remove ACI image building bits
The ACI OEM container image was used with rkt for GCE. For long time
this has been migrated to systemd-nspawn and now systemd-sysext.
Remove the unused build library code.
2024-04-03 16:18:56 +09:00
Jeremi Piotrowski
9b50112c5a build_library: Reduce xattr spam when creating cpio
Mksquashfs running against a btrfs filesystem tries to capture btrfs specific
xattrs (btrfs.compression) generating a lot of spam. Remove the spam by
ignoring btrfs xattrs.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-03-15 09:26:36 +01:00
Jeremi Piotrowski
0eb0bb38e8 build_library: Use lbzip2 to decompress gcc binpkg
Speeds things up a bit.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-03-14 17:50:21 +00:00
Kai Lüke
e5867917ec
Merge pull request #1742 from flatcar/jepio/zfs-sysext
Build ZFS sysext with each release
2024-03-13 23:24:30 +01:00
Jeremi Piotrowski
61c3af32fa
Merge pull request #1730 from flatcar/jepio/btrfs-opt
Mount btrfs fs with rescue= option
2024-03-12 15:05:08 +01:00
Jeremi Piotrowski
1ec40b2dac build_library: create_prod_sysexts: Move artifacts to BUILD_DIR
Putting things in a sysexts subdir results in the same layout on
bincache and does not follow the expected url schema for fetching the
sysext.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-03-11 21:03:16 +01:00
Jeremi Piotrowski
79294342a9 build_library: Place EXTRA_SYSEXTS in a separate file
This allows it to be sourced from other scripts and used e.g. in
generating an image changes summary.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-03-11 12:51:09 +00:00
Jeremi Piotrowski
87262e4f91 build_library: Add mangle script for zfs sysext
There are two challenges with the sysext: it needs config files in /etc
and it needs udev rules for mounting during boot to work. The etc files
are placed in the standard flatcar etc overlay path but the overlay is
mounted from the initrd. So instead, we create a tmpfiles.d rule that
symlinks the best important files over. For the udev issue, we create a
drop-in in /etc that ensures udev runs after systemd-sysext.

We also can't rely on systemd presets to work, so instead parse the
preset file and statically create the service dependencies. For the
primary zfs.target we rely on an Upholds entry. Users can still disabled
unwanted services if they want.

We also removed unnecessary files:
- development files
- initramfs related scripts

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-03-11 11:57:45 +00:00
Jeremi Piotrowski
5d5dd59102 build_image: Build sysext store after image when requested
This function is meant to prebuild certain sysexts to be released along
with each release. These will not be built into the image, but instead
can be fetched by the user on demand.

The command to build sysexts would be:

  ./build_image prod sysext

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-03-11 11:57:45 +00:00
Jeremi Piotrowski
18265de9d8 disk_util: Mount btrfs fs with rescue= option
It looks like 'norecovery' is deprecated and has been removed in the v6.8-rc1
kernel. Replace it with 'rescue=nologreplay', which is a replacement
implemented since v5.9. The standalone 'nologreplay' option is also deprecated.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-03-05 17:35:55 +01:00
Mathieu Tortuyaux
1017216cbe
oem: provide scaleway images
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
2024-03-05 13:51:07 +01:00
Jeremi Piotrowski
e51a90d8ed build_library: Ignore btrfs xattrs
To prevent mksquashfs from spamming the console about btrfs.compression.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-02-28 12:25:06 +01:00
Sayan Chowdhury
52ce21a5ab grub_install.sh: ship mokmanager, and rename to grubx64
Signed-off-by: Sayan Chowdhury <schowdhury@microsoft.com>
2024-02-26 15:46:13 +01:00
Sayan Chowdhury
99bfcf5f32 shim, coreos-sb-keys, grub_install.sh: retab to spaces
Signed-off-by: Sayan Chowdhury <schowdhury@microsoft.com>
2024-02-26 12:01:10 +01:00
Sayan Chowdhury
04005652dd build_library: Drop redundant config from grub.cfg
Signed-off-by: Sayan Chowdhury <schowdhury@microsoft.com>
2024-02-26 12:01:10 +01:00
Sayan Chowdhury
c1bdbd9d90 build_image_util: Sign the vmlinuz with the shim key
Signed-off-by: Sayan Chowdhury <schowdhury@microsoft.com>
2024-02-26 12:01:10 +01:00
Jeremi Piotrowski
6ff9f8b098 Add support for secure boot in qemu_template.sh
We have an existing qemu_uefi_secure format definition, but it is
necessary to update it so that it actually works. Qemu needs to be
passed the correct flags to enable SMM, we need to switch to the Q35
machine, and we need to copy over the secboot variant of the OVMF
firmware.
2024-02-26 12:01:09 +01:00
Sayan Chowdhury
fc28e72322 sys-boot/grub: install file with sbat contents, add --sbat to script
This is just the contents of the section, but the section
itself is written by grub-mkimage. sbat.csv needs to be passed
with --sbat.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
Signed-off-by: Sayan Chowdhury <schowdhury@microsoft.com>
2024-02-26 12:01:09 +01:00
Jeremi Piotrowski
64556256db grub_install: switch to BOARD_GRUB by default
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-02-26 12:01:09 +01:00
Sayan Chowdhury
0479480ef1 grub_install.sh: Sign the GRUB/MM with the proper keys
Add the linux.mod file back

Signed-off-by: Sayan Chowdhury <schowdhury@microsoft.com>
2024-02-26 12:01:09 +01:00
Jeremi Piotrowski
8019f7fd9f vm_image_util.sh: update path to arm64 UEFI firmware
The arm64 firmware is now called AAVMF with the updated edk2-aarch64
ebuild.
2024-02-26 12:01:09 +01:00
Krzesimir Nowak
b7e13a2160
Merge pull request #1434 from flatcar/krnowak/debug-output
Print debug output on any error
2024-02-20 17:39:18 +01:00
Krzesimir Nowak
ab43658d60 overlay: Fix references to moved packages 2024-01-16 12:55:15 +01:00
Mathieu Tortuyaux
1cb7be951d
coreos-base/oem-gce: remove ACI built image
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
2023-12-04 18:16:06 +01:00
Mathieu Tortuyaux
5cfbf6e1eb
coreos-base/oem-gce: migrate gce to sysext format
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
2023-12-04 18:15:58 +01:00
Kai Lueke
5590da400e build_image_util: Store path list for recreating tmpfiles rules
The removal of files in the overlay present in the lowerdir creates
whiteout entries that mask the lowerdir entries. For those files that
have a tmpfile rule for creation, a reboot would cause the file to be
created in the upperdir, meaning this file is not updated from the
lowerdir when it changes. In addition we have filtered out some tmpfile
rules that caused upcopies (symlinks and directories) which meant that
removing the /etc/resolv.conf symlink didn't bring it back after reboot.
To make files from the lowerdir show up if they have a tmpfile rule that
normally would recreate them we keep a list of whiteout entries that we
clean up on boot. This also prevents freezing files because
systemd-tmpfiles does not need to recreate them in the upperdir.
2023-11-30 11:57:27 +01:00
Krzesimir Nowak
cc60a22da8 common: Print debugging info along the backtrace
Recently we had some problems with read-only filesystems, that pop up
in different places. It may be easier to catch if the debugging info
is printed in an error case instead of just one specific location.
2023-11-29 13:15:13 +01:00
Kai Lueke
317ad876e2 build_library/sysext_prod_builder: Add debug output
We see occasional failures due to a read-only filesystem on GitHub
Action runners:
  mkdir: cannot create directory ‘/home/sdk/trunk/src/scripts/artifacts/amd64-usr/developer-3790.0.0+nightly-20231116-2100-5-g49eb1a4c07-a1/rootfs/usr/share/flatcar/sysext’: Read-only file system

Add commands for a debug output.
2023-11-17 17:43:09 +01:00
Kai Lueke
87ff566aae Use OpenStack image for Brightbox
The special Brightbox image uses the OpenStack userdata in Ignition but
lacked Afterburn usage. It actually works to use the OpenStack image and
directly which also enables Afterburn, thus we can drop the special
image.
Don't build a special image for Brightbox but recommend to use OpenStack
images directly. A symlink is added to help with the download of
hardcoded user scripts.
2023-11-15 13:33:55 +01:00
Thilo Fromm
bea69017fa test_image_content.sh: remove 202209-12 exception (grub)
We updated grub to >=2.06 and thus 202209-12 can be removed from the
GLSA allowlist.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-11-08 09:19:05 +01:00
Thilo Fromm
456b3687ed sysext_prod_builder: Add suggestions from PR review
Co-authored-by: Krzesimir Nowak <knowak@microsoft.com>
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-30 17:21:26 +01:00
Thilo Fromm
383e6097dd build_library/sysext_prod_builder: improve error message
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-30 17:21:26 +01:00
Thilo Fromm
9f45ea05e9 app-containers: use upstream docker, containerd, runc
This change removes Flatcar specific builds of docker[-cli], containerd,
runc, and cri-tools and instead switches to upstream Gentoo ebuilds
added to portage-stable.

The change updates docker to 24.0.6.

NOTE that there currently is no upstream ebuild for containerd-1.7.7, so
this change adds that ebuild based on the upstream containerd-1.7.6
ebuild.

Flatcar customisations like systemd units etc. are now applied in the
manglefs script of the respective sysexts, based on file system trees in
coreos-overlay/coreos/sysext/(containerd|docker).

The build_sysext script has been extended by an option to strip all
binaries in a sysext; the option is active by default. This takes care
of removing debug symbols from docker and containerd - which are not
removed by the default Gentoo build. The overall size of both containerd
and docker sysext is reduced by ~50%.

Lastly, the sysext command line syntax of build_image has been extended
to allow specifying multiple packages for a sysext. This was necessary
because docker-cli and docker do not have any runtime relationships and
therefore must both be specified for installation to correctly mirror
Flatcar's own docker packaging.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-30 17:21:26 +01:00
Thilo Fromm
c2d1c13abd Apply bash scripting suggestions from code review
Thank you Krzesimir!

Co-authored-by: Krzesimir Nowak <knowak@microsoft.com>
2023-10-23 16:05:45 +02:00
Thilo Fromm
b775036a62 torcx removal: address PR comments
- updated github actions for runc, containerd, and docker to not handle
  nonexistent ebuilds in app-torcx/ anymore
- removed spurious package_run_dependencies from build_image_util.sh
- build_sysext: generate pkginfo before mangle script runs
  use zstd for compression; add cli flag to select compression
- ci_automation_common.sh: remove spurious `/` from match string
- coreos, board-packages, bootengine: bump ebuild revisions
- kernel commonconfig: add squashfs zstd support

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-23 16:05:45 +02:00
Thilo Fromm
6f651a298c build scripts: separate txt inventory; official naming for sysexts
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-23 16:05:45 +02:00
Thilo Fromm
89555ed2bd base OS sysexts: separate build script, inventory generation
This change refactors base OS sysext builds to use a separate build
script `build_library/sysext_prod_builder`, which is called from
`build_library/prod_image_util.sh` when `build_image` runs.

This allows for better separation of cleanup traps: prod image sysext
builds need its own trap / cleanup function for temporary build
directories and loopback mounts.

Prod sysext builds properly generate lincense and SBOM information, and
provide detailed file listings and disk space usage stats.

- SBOM / licenses JSON now include all packages of the
  final image, i.e. a combined list of base image and all base OS
  sysexts.
- Packages lists, files list and detailed files list include the sysext
  squashfs files for the base image, and separate sections with files /
  packages lists for each sysext.
- Disk usage contains both final disk image usage as well as usage of
  each individual sysext squashfs.
2023-10-23 16:05:45 +02:00
Thilo Fromm
8e01a2c8f9 build_image: add sysext command line option
This change refactors sysext builds during build_image and generalises
the code (no hard-coded containerd and docker anymore).

A command line option is added to build_image for sysexts to include in
the OS image. It defaults to containerd and docker but may be set to
arbitrary packages. The command line supports simple depenencies, i.e.
the "docker" sysext will re-use package information from the
"containerd" sysext and not include another containerd.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-23 16:05:45 +02:00
Thilo Fromm
8f8f262f19 torcx: remove from scripts, use docker+containerd sysexts
This change removes torcx libraries, references, and commandline options
from build automation scripts and from build_library/.

Containerd and docker are shipped via sysexts which are included in the
base image.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-23 16:05:45 +02:00
Thilo Fromm
aae3fd8260 prod_image_util.sh: remove pkgdb tarball (replaced by sysext)
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-23 16:05:45 +02:00
Thilo Fromm
9cede02f86 dev_container_util.sh: remove spurious DEVCONTAINER=1
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-10-23 16:05:45 +02:00
Krish Jain
cc029bb5ca use DEVCONTAINER=1 2023-10-23 16:05:45 +02:00