image build and composition scripts for Flatcar Container Linux
Go to file
flatcar-ci 5cc0d8c40c New version: main-4417.0.0-nightly-20250804-2100
Signed-off-by: flatcar-ci <infra+ci@flatcar-linux.org>
2025-08-04 21:00:26 +00:00
.github/workflows .github: sign commits from common scripts 2025-07-28 14:32:36 +02:00
build_library Merge pull request #3043 from invis-z/podman-subid 2025-07-25 10:05:10 +02:00
changelog sys-kernel/coreos-sources: Update from 6.12.40 to 6.12.41 2025-08-02 07:07:10 +00:00
ci-automation ci_automation_common.sh: use long option name 2025-07-24 09:33:10 +02:00
contrib Use new website flatcar.org 2022-09-14 14:32:49 +02:00
data sdk: add download_payloads 2024-01-23 17:09:49 +01:00
jenkins Delete (almost) all of the jenkins directory 2024-11-26 11:53:19 +00:00
lib/shflags Move cros_vm_constants to build_library 2021-08-27 14:20:54 +02:00
oem 2345.0.0 2019-12-04 14:59:11 +01:00
pkg_auto pkg-auto: Fix occurences generation 2025-05-09 09:24:10 +02:00
sdk_container New version: main-4417.0.0-nightly-20250804-2100 2025-08-04 21:00:26 +00:00
sdk_lib eclass/coreos-kernel,sys-kernel/coreos-modules: 2025-04-30 14:55:32 +02:00
workon Drop cros-workon.eclass and replace with git-r3.eclass 2024-06-21 10:47:50 +01:00
.dockerignore sdk-container: add scripts for containerised SDK 2021-11-26 17:54:43 +01:00
.gitignore .gitignore: Ignore ci-cleanup.sh 2023-07-17 17:08:26 +02:00
bash_completion Drop cros-workon.eclass and replace with git-r3.eclass 2024-06-21 10:47:50 +01:00
boot_nspawn fix(*): use /media/state and overlays dir 2013-07-26 08:44:47 -07:00
bootstrap_sdk Drop lots of obsolete release signing and upload code 2024-11-26 14:58:24 +00:00
bootstrap_sdk_container bootstrap_sdk_container: Fix a check for an official build 2022-09-08 14:57:21 +02:00
build_dev_binpkgs build_dev_binpkgs: Only build packages available to the board profile 2025-04-22 13:13:59 +01:00
build_image sysext: Change the sysext seperator from : to | 2025-05-13 11:26:09 +02:00
build_packages sysext: don't build nvidia-drivers on ARM 2025-05-13 11:26:09 +02:00
build_sdk_container_image build_sdk_container_image: force removal of running container 2022-01-06 21:28:30 +01:00
build_sysext sysext: Allow per-sysext USE flags 2025-05-13 11:26:09 +02:00
build_toolchains Drop lots of obsolete release signing and upload code 2024-11-26 14:58:24 +00:00
CHANGELOG.md changelog: Add placeholder directory to add the changelogs 2021-11-24 22:50:02 +05:30
checkout checkout: omit checking for tags in submodules 2022-01-10 15:23:25 +01:00
clean_loopback_devices
code-of-conduct.md Update code-of-conduct.md 2023-07-24 18:20:39 +02:00
CODEOWNERS Add CODEOWNERS file for automated reviewer assignment 2025-07-29 14:24:23 +02:00
common.sh common: Print debugging info along the backtrace 2023-11-29 13:15:13 +01:00
CONTRIBUTING.md CONTRIBUTING: add a section about not emailing maintainers 2014-06-18 18:38:28 -07:00
core_sign_update Drop coreos-devel/fero-client and any usage of it 2024-06-17 10:44:40 +01:00
DCO chore(contributing): clean up CONTRIBUTING.md and split out DCO 2014-04-04 10:40:37 -07:00
find_overlay_dups *: add script to check for duplicate pkgs 2018-03-07 14:25:45 -08:00
flatcar_workon flatcar_workon: Simplify condition 2024-07-02 12:51:32 +02:00
generate_payload generate_payload: add 2025 image signing subkey 2025-03-13 16:52:04 +01:00
get_latest_image.sh
get_package_list
image_to_vm.sh Drop lots of obsolete release signing and upload code 2024-11-26 14:58:24 +00:00
LICENSE ROADMAP: add initial overall CoreOS roadmap document 2015-04-30 16:58:53 -07:00
MAINTAINERS.md Sync maintainers file from flatcar/flatcar repository 2022-11-03 15:37:25 +01:00
NOTICE feat(*): initial commit 2014-01-19 12:25:11 -08:00
PREFIX.md Update documentation and ebuilds to reference 'main' branch instead of 'flatcar-master' 2025-05-26 18:04:26 +02:00
prune_images prune_images: keep newer-than-latest builds 2015-11-24 13:40:09 -08:00
README.md Update README.md 2025-06-06 16:41:10 +02:00
rebuild_packages Drop lots of obsolete release signing and upload code 2024-11-26 14:58:24 +00:00
retag-for-jenkins scripts, CI, workflows: remove submodule handling (main) 2023-04-13 12:26:36 +02:00
run_local_tests.sh Switch from raw (.fd) EDK2 firmware images to QCOW2, plus 4MB on amd64 2024-11-12 11:59:40 +00:00
run_sdk_container run_sdk_container: mount tmpfs on /tmp 2025-04-30 14:55:32 +02:00
sbsign_image Delay generating test update payload in official builds 2024-12-20 16:29:32 +00:00
set_official *: Expand short emerge flags and use bash arrays 2023-02-16 13:57:05 +01:00
set_shared_user_password.sh
set_version Drop obsolete SETTING_BINPKG_SERVER_DEV variable 2025-04-22 17:59:39 +01:00
settings.env Drop obsolete SETTING_BINPKG_SERVER_DEV variable 2025-04-22 17:59:39 +01:00
setup_board Drop all references to a toolchain-specific binpkg host 2025-04-22 17:59:38 +01:00
setup_prefix Flatcar SDK: add experimental prefix builds 2023-09-29 15:22:45 +02:00
tag_release 2317.0.1 2019-11-07 19:40:01 +01:00
test-nightly-tagging.sh test-nightly-tagging: new script for testing nightly tagging 2025-07-11 13:48:53 +02:00
update_chroot dev-lang/rust: Drop our custom package in favour of upstream Gentoo's 2024-08-15 16:54:11 +01:00
update_distfiles Drop lots of obsolete release signing and upload code 2024-11-26 14:58:24 +00:00
update_ebuilds update_ebuilds: Fix support for rsync of eclass 2024-03-11 11:57:45 +00:00
update_metadata Upgrade to Catalyst 4 2024-07-15 14:27:59 +01:00
update_sdk_container_image pr-comment-build-dispatcher.yaml: dispatch SDK and OS image builds 2023-05-09 17:29:31 +02:00

Flatcar Container Linux SDK scripts

Flatcar OS Matrix Slack Twitter Follow Mastodon Follow Bluesky

Welcome to the scripts repo, your starting place for most things here in the Flatcar Container Linux SDK. To get started you can find our documentation on the Flatcar docs website.

The SDK can be used to

  • Patch or update applications or libraries included in the Flatcar OS image
  • Add or remove applications and / or libraries
  • Modify the kernel configuration and add or remove kernel modules included with Flatcar
  • Build OS images for a variety of targets (qemu, bare metal, AWS, Azure, VMWare, etc.)
  • And lastly, the SDK can be used to upgrade SDK packages and to build new SDKs

Using the scripts repository

The repository is meant to be the entry point for Flatcar builds and development. Ebuilds for all packages reside in one of 2 subdirectories - coreos-overlay and portage-stable:

scripts
   +--sdk_container
          +---------src
                     +--third_party
                             +------coreos-overlay
                             +------portage-stable

portage-stable is kept in alignment with upstream Gentoo and should not contain any modifications (with only minor, well-justified exceptions). Consider it a small sub-set of Gentoo.

coreos-overlay contains significantly modified or even entirely self-written ebuilds.

The scripts repository makes ample use of tags to mark releases. Sometimes, local and origin tags can diverge (e.g. when re-tagging something locally to test a build). Also, git pull and git fetch do not automatically pull new tags, so long-standing local sourcetrees may lack newer versions. To fetch and update all tags and to remove tags locally which have been deleted upstream, do

$ git pull --all --tags --prune --prune-tags

If upstream retagged (of if a tag was changed locally) the corresponding upstream tag will not be pulled so the local tag remains. In order to override local tags with upstream, run

$ git pull --all --tags --prune --prune-tags --force

Using the SDK container

We provide a containerised SDK via https://github.com/orgs/flatcar/packages. The container comes in 3 flavours:

  • Full SDK initialised with both architectures supported by Flatcar (amd64 and arm64). This is the largest container, it's about 8GB in size (~3 GB compressed).
  • AMD64 SDK initialised for building AMD64 OS images. About 6GB in size (2GB compressed).
  • ARM64 SDK initialised for building ARM64 OS images on AMD64 hosts. Also about 6GB in size. While work on a native ARM64 native SDK is ongoing, it's unfortunately not ready yet. If you want to help, patches are welcome!

The container can be run in one of two ways - "standalone", or integrated with the scripts repo:

  • Standalone mode will use no host volumes and will allow you to play with the SDK in a sandboxed throw-away environment. In standalone mode, you interface with Docker directly to use the SDK container.
  • Integrated mode will closely integrate with the scripts repo directory and bind-mount it as well as the portage-stable and coreos-overlay directories into the container. Integrated mode uses wrapper scripts to interact with the SDK container. This is the recommended way for developing patches for Flatcar.

Standalone mode

In standalone mode, the SDK is just another Docker container. Interaction with the container happens via use of docker directly. Use for experimenting and for throw-away work only, otherwise please use integrated mode (see below).

  • Check the list of available versions and pick a version to use. The SDK Major versions correspond to Flatcar Major release versions. List of images: https://github.com/orgs/flatcar/packages/container/package/flatcar-sdk-all For the purpose of this example we'll use version 3033.0.0.
  • Fetch the container image: docker pull ghcr.io/flatcar/flatcar-sdk-all:3033.0.0
  • Start the image in interactive (tty) mode: docker run -ti ghcr.io/flatcar/flatcar-sdk-all:3033.0.0 You are now inside the SDK container (the hostname will likely differ): sdk@f236fda982a4 ~/trunk/src/scripts $
  • Initialise the SDK in self-contained mode. This needs to be done once per container and will check out the scripts repository into the container. sdk@f236fda982a4 ../sdk_init_selfcontained.sh

You can now work with the SDK container.

Privileged mode when building images

In order to build OS images (via ./build_image and ./image_to_vm) the SDK tooling requires privileged access to /dev. This is necessary because the SDK currently employs loop devices to create and to partition OS images.

To start a container in privileged mode with /dev available use:

  • docker run -ti --privileged -v /dev:/dev ghcr.io/flatcar/flatcar-sdk-all:3033.0.0

Integrated mode

This is the preferred mode of working with the SDK. Interaction with the container happens via wrapper scripts from the scripts repository. Both the host's scripts repo as well as the ebuild paths (portage-stable and coreos-overlay) are made available in the container, allowing for work on these directly. The wrapper scripts will re-use existing containers instead of creating new ones to preserve your work in the container, enabling consistency.

To clone the scripts repo and pick a version:

  • Clone the scripts repo: git clone https://github.com/flatcar/scripts.git
  • Optionally, check out a release tag to base your work on
    • list releases (e.g. all Alpha releases): git tag -l alpha-*
    • check out the release version, e.g. 3033.0.0: git checkout 3033.0.0

Working with forks

When using GitHub's "fork" feature, please make sure to fork all branches, not just main. Forking only main is the default on GitHub.

The SDK container wrapper script run_sdk_container requires release tags in our release branches and fails to start if no release branch is present (see e.g. https://github.com/flatcar/Flatcar/issues/1705). If you have forked manually, please make sure to include all tags. You can retrofit upstream tags to a fork by using e.g.:

git remote add upstream https://github.com/flatcar/scripts.git
git fetch --tags upstream

This is necessary because the SDK uses git describe --tags to determine the current version, and forks don't include the original repository's tags by default.

To use the SDK container:

  • Fetch image and start the SDK container: ./run_sdk_container -t This will fetch the container image of the "scripts" repo's release version you checked out. The -t command line flag will allocate a TTY, which is preferred for interactive use. The command will put you into the SDK container: sdk@sdk-container ~/trunk/src/scripts $
  • Alternatively, you can run individual commands in the SDK container using ./run_sdk_container <command> (e.g. ./run_sdk_container ./build_packages).

Subsequent calls to ./run_sdk_container will re-use the container (as long as the local release version check-out the scripts repo does not change). Check out docker container ls --all and you'll see something like

CONTAINER ID   IMAGE                                            COMMAND                  CREATED       STATUS                         PORTS     NAMES
19ea3b6d00ad   ghcr.io/flatcar/flatcar-sdk-all:3033.0.0   "/bin/sh -c /home/sd…"   4 hours ago   Exited (0) About an hour ago             flatcar-sdk-all-3033.0.0_os-3033.0.0

Re-use of containers happens on a per-name basis. The above example's container name flatcar-sdk-all-3033.0.0_os-3033.0.0 is generated automatically. Using docker container rm the container can be discarded - a subsequent call to ./run_sdk_container will create a new one. Custom containers can be created by use of the -n <name> command line option; these will be re-used in subsequent calls to ./run_sdk_container when using the same <name>.

The local sourcetree can also be used with an entirely custom SDK container image. Users must ensure that the image is either fetch-able or present locally. The custom image can be specified using -C <custom-image>. This option is useful e.g. for building the local sourcetree with different SDK versions.

Check out ./run_sdk_container -h for more information on command line options.

Building a new SDK container

Building an SDK container is done using ./build_sdk_container_image <tarball>. The tarball input is the result of an SDK bootstrap (see below). Version information for both OS as well as for the SDK will be extracted from the tarball name. The version file will be updated accordingly before the SDK container is built. During the build, toolchain packages will be built and installed into the SDK container image. Both supported boards (amd64-usr and arm64-usr) will be initialised in the container image.

Bootstrapping a new SDK tarball using the SDK container

The script ./bootstrap_sdk_container bootstraps a new SDK tarball using an existing SDK container and seed tarball. Specifying the seed version as well as the designated new SDK version is required for this script.

Automation stubs for continuous integration

Script stubs for various build stages can be found in the ci-automation folder. These are helpful for gluing Flatcar Container Linux builds to a continuous integration system.