summaryrefslogtreecommitdiffstats
path: root/docs/HACKING.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:20:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:20:44 +0000
commitca5ecaae7a8f75e18ba85b29839752da76e3b7b9 (patch)
tree6f62ddc7fbe8ae132441a0b25e2a76e423e66e9f /docs/HACKING.md
parentReleasing progress-linux version 256.2-1~progress7.99u1. (diff)
downloadsystemd-ca5ecaae7a8f75e18ba85b29839752da76e3b7b9.tar.xz
systemd-ca5ecaae7a8f75e18ba85b29839752da76e3b7b9.zip
Merging upstream version 256.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/HACKING.md')
-rw-r--r--docs/HACKING.md41
1 files changed, 29 insertions, 12 deletions
diff --git a/docs/HACKING.md b/docs/HACKING.md
index 5b1e355..a905fc7 100644
--- a/docs/HACKING.md
+++ b/docs/HACKING.md
@@ -29,8 +29,7 @@ For some components (most importantly, systemd/PID 1 itself) this is not possibl
In order to simplify testing for cases like this we provide a set of `mkosi` config files directly in the source tree.
[mkosi](https://mkosi.systemd.io/)
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` v19 or newer using your distribution's package manager or from the
-[GitHub repository](https://github.com/systemd/mkosi).
+To make use of this, please install `mkosi` from the [GitHub repository](https://github.com/systemd/mkosi#running-mkosi-from-the-repository).
`mkosi` will build an image for the host distro by default.
First, run `mkosi genkey` to generate a key and certificate to be used for secure boot and verity signing.
After that is done, it is sufficient to type `mkosi` in the systemd project directory to generate a disk image you can boot either in `systemd-nspawn` or in a UEFI-capable VM:
@@ -45,6 +44,24 @@ or:
$ mkosi qemu
```
+By default, the tools from your host system are used to build the image. To have
+`mkosi` use the systemd tools from the `build/` directory, add the following to
+`mkosi.local.conf`:
+
+```conf
+[Host]
+ExtraSearchPaths=build/
+```
+
+And if you want `mkosi` to build a tools image and use the tools from there
+instead of looking for tools on the host, add the following to
+`mkosi.local.conf`:
+
+```conf
+[Host]
+ToolsTree=default
+```
+
Every time you rerun the `mkosi` command a fresh image is built, incorporating
all current changes you made to the project tree. To avoid having to build a new
image all the time when iterating on a patch, add the following to
@@ -52,21 +69,21 @@ image all the time when iterating on a patch, add the following to
```conf
[Host]
-RuntimeBuildSources=yes
+@RuntimeBuildSources=yes
```
After enabling this setting, the source and build directories will be mounted to
`/work/src` and `/work/build` respectively when booting the image as a container
or virtual machine. To build the latest changes and re-install after booting the
-image, run `mkosi -t none` in another terminal on the host and run one of the
-following commands in the container or virtual machine depending on the
-distribution:
+image, run one of the following commands in another terminal on your host (
+choose the right one depending on the distribution of the container or virtual
+machine):
```sh
-dnf upgrade --disablerepo="*" /work/build/*.rpm # CentOS/Fedora
-apt install --reinstall /work/build/*.deb # Debian/Ubuntu
-pacman -U /work/build/*.pkg.tar # Arch Linux
-zypper install --allow-unsigned-rpm /work/build/*.rpm # OpenSUSE
+mkosi -t none && mkosi ssh dnf upgrade --disablerepo="*" "/work/build/*.rpm" # CentOS/Fedora
+mkosi -t none && mkosi ssh apt install --reinstall "/work/build/*.deb" # Debian/Ubuntu
+mkosi -t none && mkosi ssh pacman -U "/work/build/*.pkg.tar" # Arch Linux
+mkosi -t none && mkosi ssh zypper install --allow-unsigned-rpm "/work/build/*.rpm" # OpenSUSE
```
and optionally restart the daemon(s) you're working on using
@@ -76,8 +93,8 @@ pid1 or `systemctl soft-reboot` to restart everything.
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 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/mkosi.git
+$ ln -s $PWD/mkosi/bin/mkosi /usr/local/bin/mkosi
$ git clone https://github.com/systemd/systemd.git
$ cd systemd
$ git checkout -b <BRANCH> # where BRANCH is the name of the branch