Commit graph

63 commits

Author SHA1 Message Date
Daan De Meyer 52842bb2c5 mkosi: Build a directory image by default
Both building and booting a directory image is much faster than
building or booting a disk image so let's default to a directory
image.

In CI, we stick to a disk image to make sure that keeps working as
well.

The only extra dependency this introduces is virtiofsd which is
packaged in all distributions except Debian stable. For users
hacking on systemd on Debian stable, a disk image can be built by
writing the following to mkosi.local.conf:

```
[Output]
Format=disk
```
2024-01-12 16:19:48 +01:00
Daan De Meyer c417615c12 mkosi: Drop building custom kernel logic
Now that mkosi-kernel is a thing, this logic in systemd is just mostly
bitrotting since I just use mkosi-kernel these days. If I ever need to
hack on systemd and the kernel in tandem, I'll just add support for
building systemd to mkosi-kernel instead, so let's drop the support for
building a custom kernel in systemd's mkosi configuration.
2023-11-29 15:00:34 +00:00
Daan De Meyer bcb335ac68 Update to mkosi v19
- Use mkosi.images/ instead of mkosi.presets/
- Use the .chroot suffix to run scripts in the image
- Use BuildSources= match for the kernel build
- Move 10-systemd.conf to mkosi.conf and rely on mkosi.local.conf
  for local configuration
2023-11-28 19:54:58 +01:00
Daan De Meyer ee7304df5d mkosi: Use RuntimeTrees= to mount sources
Instead of using ExtraTrees=, let's use the new RuntimeTrees= option
to mount the full repository into the VM/container. Let's also store
the sources under /usr/src/systemd and update the gdbinit file and
vscode HACKING guide section to match the new location.
2023-10-20 12:43:57 +02:00
Frantisek Sumsal d04af6aaca docs: update fuzzers docs 2023-10-14 17:55:29 +02:00
Daan De Meyer f478b6e97d Update HACKING instructions
Let's mention that we just need the latest stable release of mkosi,
not the latest git commit. We also split the instructions for building
on the host and the instructions for building with mkosi into two blocks,
as it's not required to build on the host anymore to build with mkosi.
2023-10-06 09:16:33 +02:00
Mike Yuan ba96ba0420 docs/HACKING: Arch has dropped asp in favor of pkgctl
Prompted by #29461

See also: https://wiki.archlinux.org/title/Arch_build_system#Using_the_pkgctl_tool
2023-10-05 17:54:37 +02:00
Daan De Meyer 2fe24cccde mkosi: Enable Incremental= mode by default
Since mkosi is now smart enough to drop the caches when the list of
packages changes, let's enable Incremental= mode by default to ensure
a good experience for anyone new to hacking on systemd with mkosi.
2023-06-29 13:11:39 +01:00
Zbigniew Jędrzejewski-Szmek badea0d6df sd-boot,sd-stub: also print version after the address
The kernel, systemd, and many other things print their version during boot.
sd-boot and sd-stub are also important, so let's print the version if EFI_DEBUG.
(If !EFI_DEBUG, continue to be quiet.)

When updating the docs, I saw that that the text in HACKING.md was out of date.
Instead of trying to update the instructions there, make it shorter and refer
the reader to tools/debug-sd-boot.sh for details.
2023-05-24 04:34:56 +09:00
Daan De Meyer 47e5e12866 mkosi: Package a erofs usr partition with signed verity
Let's start moving towards a more involved partitioning setup to
test our stuff more when using mkosi.

The root partition is generated on boot with systemd-repart.

CentOS supports neither erofs nor btrfs so we use squashfs and xfs
instead.

We also enable SecureBoot= locally for additional coverage. This
and the use of verity means users need to run `mkosi genkey` once
to generate the keys necessary to do secure boot and verity.
2023-05-13 10:49:17 +02:00
Klaus ab13274a19
docs: add correct pacman command (#27486)
The `pacman` command in order to install packages on Arch in the documentation is invalid.
This PR fixes the command.
2023-05-02 17:18:10 +08:00
Daan De Meyer 94c9855a18 mkosi: Update to latest
- Drop Netdev= as it was removed in mkosi
- Always install python-psutil in the final image (required for networkd tests)
- Always Install python-pytest in the final image (required for ukify tests)
- Use the narrow glob for all centos python packages
- Drop the networkd mkosi config files (the default image can be used instead)
- Use ".conf" as the mkosi config file suffix everywhere
- Copy src/ to /root/src in the final image and set gdb substitute path in
  .gdbinit to make gdb work properly
2023-03-29 13:27:19 +02:00
Daan De Meyer 1441a6a751 docs: Explicitly tell developers to enable mkosi required meson options
We need repart, bootctl, analyze and ukify for mkosi so let's make
sure those get built in the HACKING guide.
2023-03-23 13:09:09 +00:00
Daan De Meyer c84d14c525 docs: Fix vscode debugging section in HACKING.md
Let's account for the recent changes in mkosi in the debugging
with vscode section.
2023-03-21 17:47:51 +00:00
Daan De Meyer e9c47453d2 Drop mkosi + clang section from HACKING
We removed a few features that made this work, will be added back
in the future when we restructure the way mkosi does build images.
2023-02-16 20:06:27 +01:00
Daan De Meyer 2edcf8e7db Update HACKING for latest mkosi 2023-02-16 20:05:55 +01:00
Zbigniew Jędrzejewski-Szmek 7a17e41dcf test: drop whitespace after shell redirection operators
(The one case that is left unchanged is '< <(subcommand)'.)

This way, the style with no gap was already dominant. This way, the reader
immediately knows that ' < ' is a comparison operator and ' << ' is a shift.

In a few cases, replace custom EOF replacement by just EOF. There is no point
in using someting like "_EOL" unless "EOF" appears in the text.
2023-02-06 09:19:04 +01:00
Daan De Meyer 246fd4d2ed docs: Update HACKING.md to mention latest mkosi is needed
Let's require users to run mkosi from git so we can fix any issues
forward instead of trying to keep the configs working with older
versions.
2023-01-24 22:05:49 +01:00
William Roberts 026d249969 docs/HACKING.md: clarify some portions
Clarify portions of HACKING.md so folks don't spend as much time as I
did on it.

Signed-off-by: William Roberts <william.c.roberts@intel.com>
2022-10-31 20:56:37 +01:00
Daan De Meyer d12e9bdc76 mkosi: Optionally build a kernel image from mkosi.kernel/
If mkosi.kernel/ exists, the mkosi script will try to build a kernel
image from it. We use the architecture defconfig as a base and add
our own extra configuration on top.

We also add some extra tooling to the build image required to build
the kernel and include some documentation in HACKING.md on how to
use this new feature.

To avoid the kernel sources from being copied into the build or
final image (which we don't want because it takes a while), we put
the mkosi.kernel/ directory in .gitignore and use
"SourceFileTransfer=mount" so that the sources are still accessible
in the build image.
2022-09-29 20:15:57 +02:00
Daan De Meyer 2d92c35b35 docs: Add guide to debug binaries in vscode that need to run as root 2022-08-18 14:46:01 +02:00
Daan De Meyer d1e9a4244b docs: Recommend pkexec over using an askpass program with sudo
Less configuration required than downloading and configuring an
askpass program.
2022-08-18 14:17:07 +02:00
Sonali Srivastava 39e3135bc2 docs: mkosi-13 or newer required 2022-08-08 12:15:20 +01:00
Daan De Meyer 7ca9563ca1 mkosi: Remove usage of deprecated option names/sections 2022-07-18 16:54:58 +02:00
Daan De Meyer 69d638e67e mkosi: Changes to allow booting with sanitizers in mkosi
- Extra memory because ASAN needs it
- The environment variables to make the sanitizers more useful
- LD_PRELOAD because the ASAN DSO needs to be the first in the list
- The sanitizer library packages
- Disable syscall filters because they interfere with ASAN
- Disable systemd-hwdb-update because it's super slow when systemd-hwdb
  is built with sanitizers
- Take the value for meson's b_sanitize option from the SANITIZERS
  environment variable
2022-07-18 16:54:56 +02:00
Evgeny Vereshchagin 61ad4f25ed docs: mention how to build 32 bit fuzz targets 2022-05-29 09:12:38 +00:00
Evgeny Vereshchagin 39e63b441b docs: be more specific about the OSS-Fuzz toolchain 2022-05-26 15:22:50 +00:00
Benjamin Franzke 818e46ae7c docs: avoid multiple first-level headlines
One document should only contain one main
headline, both for structuring and for
visual reasons.

Relevant cases found via:

  git grep -A2 '^# ' docs/
2022-05-17 23:00:18 +02:00
Elias Probst 8f1a581e0d
Use consistent formatting for PID 1 across docs/ 2022-05-11 15:31:07 +02:00
Zbigniew Jędrzejewski-Szmek e8a688178c docs: stop recommending meson compile
With meson-0.60, meson compile stopped working with some targets:

$ meson compile -C build update-man-rules
ERROR: Can't invoke target `update-man-rules`: ambiguous name. Add target type and/or path: `PATH/NAME:TYPE`

This is obviously a regression in meson, but based on a chat with the
maintainers, it seems that there's some disagreement as to whether 'meson
compile' is useful and how exactly it should work. Since we're already at
meson 0.60.3 and this hasn't been fixed, and people generally don't seem to
consider this an issue, let's return to documenting the usual practice of
'ninja -C build' that just works everywhere.

(Since nobody has raised any fuss in systemd, it means that people are
generally using the shorter form during development too. I only noticed
because I pasted a command from the release docs when preparing -rc1.)
2022-04-12 12:35:44 +02:00
Lennart Poettering 4bb37359f6 docs: s/straight-forward/straightforward/
Inspired by https://github.com/systemd/systemd/pull/20156#discussion_r810878846
2022-03-15 22:46:09 +00:00
Jan Janssen 948d085e89 boot: Add gdb support and documentation
This will finally allow debugging issues in systemd without resorting to
Print() calls all over the place.
2022-01-04 17:23:01 +01:00
Yu Watanabe 4df5799f9b doc: fix typo in command
Follow-up for #21147.
2021-10-28 03:57:24 +09:00
Daan De Meyer b2c9da052a docs: Specify code block language for mkosi boot instructions 2021-10-27 12:27:16 +01:00
Daan De Meyer 4c71f971c1 docs: Make mkosi install instructions generic 2021-10-27 12:27:16 +01:00
Daan De Meyer b43ed972e0 docs: Extend builddep instructions to include more distros 2021-10-27 12:27:14 +01:00
Daan De Meyer 390a307665 docs: Remove mkosi symlink instruction from HACKING
mkosi automatically builds for the host distro which seems a much
better default to encourage since dnf won't be installed on any host
system that's not Fedora anyway.
2021-10-27 11:10:52 +01:00
Daan De Meyer ff7c07fb08 docs: Simplify git instructions in HACKING slightly 2021-10-27 11:10:52 +01:00
Daan De Meyer 540804827a docs: Clean up links in HACKING.md 2021-10-27 11:10:50 +01:00
Daan De Meyer 3f3bc1f2e7 docs: Fix value for "processId" in HACKING doc
This needs to be pickRemoteProcess to make sure the UI shows
the PIDs of processes in the mkosi container instead of processes
on the host system.
2021-10-18 15:02:05 +01:00
Zbigniew Jędrzejewski-Szmek 0aff7b7584 docs: add spdx tags to all .md files
I have no idea if this is going to cause rendering problems, and it is fairly
hard to check. So let's just merge this, and if it github markdown processor
doesn't like it, revert.
2021-09-27 09:19:02 +02:00
Zbigniew Jędrzejewski-Szmek d55ad7fe96 mkosi: move distro files to mkosi.default.d/
With this change, "mkosi build" will automatically build systemd for the
current distro without any further configuration. If people want to do a
cross-distro build by default, they can still create mkosi.default, but I
assume that this is relatively rare.

If people have symlinked mkosi.default to one of the files in .mkosi/, they'll
need to adjust the symlink.

(Building without configuration would always fail, since systemd has many many
required dependencies. I think it's nicer to do the most commonly expected
thing by default, i.e. rebuild for the current distro.)

Mkosi is nowadays packaged for most distros, so recommend installing of distro
packages as the primary installation mechanism.
2021-09-03 13:18:38 +02:00
Daan De Meyer 66dc9b4634 docs: Add documentation on how to use VSCode to debug systemd via mkosi 2021-08-21 10:31:32 +01:00
Zbigniew Jędrzejewski-Szmek ba777d019f docs: prettify two external links 2021-05-19 13:53:51 +02:00
Zbigniew Jędrzejewski-Szmek c9d311c787 docs: use {% raw %} to wrap jinja2 tags in documentation
As reported by @mrc0mmand:
> Since 89f52a780e (diff-b842e6ab4a95a695d9449d106f091e6a134d9eac8d2aee1cd8b169fcb6b3a98bR109)
> the GH pages fail to build, since they use the Liquid templating language,
> which coincidentally uses a very similar tags as jinja:
> https://shopify.github.io/liquid/tags/control-flow/
>
>> The tag elif on line 112 in HACKING.md is not a recognized Liquid tag.
2021-05-19 13:53:51 +02:00
Zbigniew Jędrzejewski-Szmek 89f52a780e docs/HACKING: add note about template engines 2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek 75e0990874 docs/HACKING: wrap long lines 2021-05-12 12:05:21 +02:00
Daan De Meyer c38667f70d docs: Update HACKING.md with the mkosi boot/qemu commands + options
Let's use the mkosi commands in HACKING.md and recommend some options
that speed up mkosi builds. Also includes some other small improvements.
2021-01-24 11:15:30 +00:00
Daan De Meyer 4cc06b8073 docs: Add a section to HACKING.md on using mkosi and clangd together
While it's perfectly possible today to completely rely on mkosi for
building and testing systemd, to get code completion and other IDE
niceties to work properly, it's still necessary to build systemd
locally.

Recently, mkosi gained the ability to allow external programs to
communicate with the build script. We can use this feature to run
the clangd language server in the mkosi build image via a custom
build script to provide IDE features in editors without requiring
developers to build systemd on the host or install any of systemd's
build dependencies locally.

This commit adds the necessary information on how to set this up
to HACKING.md.
2021-01-24 11:14:30 +00:00
Lennart Poettering 8b08be4052 tree-wide: suggest meson command lines instead of ninja ones
This only changes documentation. In various places we call "ninja"
directly. I figured it would be safer to leave those in place for now,
given the meson replacement commands lines appears to be supported in
newer meson versions only.
2020-12-17 16:51:48 +01:00