Merge pull request #30236 from DaanDeMeyer/mkosi

Update to mkosi v19
This commit is contained in:
Daan De Meyer
2023-11-28 23:39:41 +01:00
committed by GitHub
65 changed files with 222 additions and 86 deletions

View File

@@ -81,11 +81,11 @@ jobs:
echo 'deb http://azure.archive.ubuntu.com/ubuntu jammy-proposed restricted main universe' | sudo tee /etc/apt/sources.list.d/proposed.list
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: systemd/mkosi@16e63baaeadf7a5b100c5b5bf780c61c29878cfc
- uses: systemd/mkosi@bbe715f42911f9660712377a5b39335b9391ae22
- name: Configure
run: |
tee mkosi.conf <<- EOF
tee mkosi.local.conf <<- EOF
[Distribution]
Distribution=${{ matrix.distro }}
Release=${{ matrix.release }}
@@ -112,17 +112,17 @@ jobs:
# For erofs, we have to install linux-modules-extra-azure, but that doesn't match the running kernel
# version, so we can't load the erofs module. squashfs is a builtin module so we use that instead.
mkdir -p mkosi.presets/system/mkosi.repart/10-usr.conf.d
tee mkosi.presets/system/mkosi.repart/10-usr.conf.d/squashfs.conf <<- EOF
mkdir -p mkosi.images/system/mkosi.repart/10-usr.conf.d
tee mkosi.images/system/mkosi.repart/10-usr.conf.d/squashfs.conf <<- EOF
[Partition]
Format=squashfs
EOF
# The emergency shell is not useful in the CI, as it just blocks for a long time before the job
# eventually times out. Override it to just shutdown immediately.
mkdir -p mkosi.presets/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/
mkdir -p mkosi.presets/system/mkosi.extra/usr/lib/systemd/system/emergency.service.d/
tee mkosi.presets/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf <<- EOF
mkdir -p mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/
mkdir -p mkosi.images/system/mkosi.extra/usr/lib/systemd/system/emergency.service.d/
tee mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf <<- EOF
[Unit]
FailureAction=exit
[Service]
@@ -130,7 +130,7 @@ jobs:
ExecStart=
ExecStart=false
EOF
cp mkosi.presets/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf mkosi.presets/system/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf
cp mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf mkosi.images/system/mkosi.extra/usr/lib/systemd/system/emergency.service.d/poweroff.conf
- name: Generate secure boot key
run: mkosi --debug genkey

4
.gitignore vendored
View File

@@ -34,9 +34,7 @@ __pycache__/
/mkosi.installdir/
/mkosi.key
/mkosi.crt
# Ignore any mkosi config files with "local" in the name
/mkosi.conf.d/**/*local*.conf
mkosi.conf
mkosi.local.conf
/tags
.dir-locals-2.el
.vscode/

View File

@@ -35,7 +35,7 @@ possible, however. In order to simplify testing for cases like this we provide
a set of `mkosi` build files directly in the source tree.
[mkosi](https://github.com/systemd/mkosi) is a tool for building clean OS images
from an upstream distribution in combination with a fresh build of the project
in the local working directory. To make use of this, please install `mkosi` v18
in the local working directory. To make use of this, please install `mkosi` v19
or newer using your distribution's package manager or from the
[GitHub repository](https://github.com/systemd/mkosi). `mkosi` will build an
image for the host distro by default. First, run `mkosi genkey` to generate a key
@@ -60,8 +60,8 @@ Putting this all together, here's a series of commands for preparing a patch
for systemd:
```sh
$ git clone https://github.com/systemd/mkosi.git # If mkosi v18 or newer is not packaged by your distribution
$ ln -s $PWD/mkosi/bin/mkosi /usr/local/bin/mkosi # If mkosi v18 or newer is not packaged by your distribution
$ git clone https://github.com/systemd/mkosi.git # If mkosi v19 or newer is not packaged by your distribution
$ ln -s $PWD/mkosi/bin/mkosi /usr/local/bin/mkosi # If mkosi v19 or newer is not packaged by your distribution
$ git clone https://github.com/systemd/systemd.git
$ cd systemd
$ git checkout -b <BRANCH> # where BRANCH is the name of the branch
@@ -234,7 +234,7 @@ QEMU.
To allow VSCode's debugger to attach to systemd running in a mkosi image, we have to make sure it can access
the virtual machine spawned by mkosi where systemd is running. mkosi makes this possible via a handy SSH
option that makes the generated image accessible via SSH when booted. Thus you must build the image with
`mkosi --ssh`. The easiest way to set the option is to create a file `mkosi.conf` in the root of the
`mkosi --ssh`. The easiest way to set the option is to create a file `mkosi.local.conf` in the root of the
repository and add the following contents:
```
@@ -343,7 +343,7 @@ To debug systemd-boot in an IDE such as VSCode we can use a launch configuration
If you're hacking on the kernel in tandem with systemd, you can clone a kernel repository in mkosi.kernel/ in
the systemd repository, and mkosi will automatically build that kernel and install it into the final image.
To prevent the distribution's kernel from being installed (which isn't necessary since we're building our
own kernel), you can add the following snippets to mkosi.conf.d/20-local.conf:
own kernel), you can add the following snippets to `mkosi.local.conf`:
(This snippet is for Fedora, the list of packages will need to be changed for other distributions)

View File

@@ -15,8 +15,7 @@ compiler you want to use and which part of the test suite you want to run.
## mkosi
To build with sanitizers in mkosi, create a file 20-local.conf in mkosi.conf.d/ and add the following
contents:
To build with sanitizers in mkosi, create a file `mkosi.local.conf` and add the following contents:
```
[Content]

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Preset]
Presets=system
[Config]
Images=system
[Output]
OutputDirectory=mkosi.output

View File

@@ -5,13 +5,6 @@ set -e
# This is a build script for OS image generation using mkosi (https://github.com/systemd/mkosi).
# Simply invoke "mkosi" in the project directory to build an OS image.
if [ "${container:-}" != "mkosi" ]; then
exec mkosi-chroot "$SCRIPT" "$@"
fi
# Run commands as the user invoking mkosi.
SU="setpriv --reuid=${MKOSI_UID:-0} --regid=${MKOSI_GID:-0} --clear-groups"
# We don't want to install our build of systemd in the base image, but use it as an extra tree for the
# initrd and system images, so override DESTDIR to store it in the output directory so we can reference it as
# an extra tree in the initrd and system image builds.
@@ -206,10 +199,10 @@ if [ ! -f "$BUILDDIR"/build.ninja ]; then
)
fi
( set -x; $SU meson setup "$BUILDDIR" "$SRCDIR" "${CONFIGURE_OPTS[@]}" )
( set -x; meson setup "$BUILDDIR" "$SRCDIR" "${CONFIGURE_OPTS[@]}" )
fi
( set -x; $SU ninja -C "$BUILDDIR" "$@" )
( set -x; ninja -C "$BUILDDIR" "$@" )
if [ "$WITH_TESTS" = 1 ]; then
if [ -n "$SANITIZERS" ]; then
export ASAN_OPTIONS="$MKOSI_ASAN_OPTIONS"

View File

@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Preset]
[Config]
Dependencies=base
[Output]

Some files were not shown because too many files have changed in this diff Show More