]> git.ipfire.org Git - thirdparty/systemd.git/blame - HACKING
man/coredumpctl: document the new options -S/-U
[thirdparty/systemd.git] / HACKING
CommitLineData
e4a3e122
LP
1HACKING ON SYSTEMD
2
3We welcome all contributions to systemd. If you notice a bug or a missing
4feature, please feel invited to fix it, and submit your work as a github Pull
5Request (PR):
6
7 https://github.com/systemd/systemd/pull/new
8
9Please make sure to follow our Coding Style when submitting patches. See
10CODING_STYLE for details. Also have a look at our Contribution Guidelines:
11
12 https://github.com/systemd/systemd/blob/master/.github/CONTRIBUTING.md
13
14Please always test your work before submitting a PR. For many of the components
15of systemd testing is straight-forward as you can simply compile systemd and
16run the relevant tool from the build directory.
17
18For some components (most importantly, systemd/PID1 itself) this is not
19possible, however. In order to simplify testing for cases like this we provide
20a set of "mkosi" build files directly in the source tree. "mkosi" is a tool for
21building clean OS images from an upstream distribution in combination with a
22fresh build of the project in the local working directory. To make use of this,
23please acquire "mkosi" from https://github.com/systemd/mkosi first, unless your
24distribution has packaged it already and you can get it from there. After the
25tool is installed it is sufficient to type "mkosi" in the systemd project
26directory to generate a disk image "image.raw" you can boot either in
27systemd-nspawn or in an UEFI-capable VM:
28
29 # systemd-nspawn -bi image.raw
30
31or:
32
33 # qemu-kvm -m 512 -smp 2 -bios /usr/share/edk2/ovmf/OVMF_CODE.fd -hda image.raw
34
35Every time you rerun the "mkosi" command a fresh image is built, incorporating
36all current changes you made to the project tree.
37
38Alternatively, you may install the systemd version from your git check-out
39directly on top of your host system's directory tree. This mostly works fine,
40but of course you should know what you are doing as you might make your system
41unbootable in case of a bug in your changes. Also, you might step into your
42package manager's territory with this. Be careful!
43
44And never forget: most distributions provide very simple and convenient ways to
45install all development packages necessary to build systemd. For example, on
46Fedora the following command line should be sufficient to install all of
47systemd's build dependencies:
48
49 # dnf builddep systemd
50
51Putting this all together, here's a series of commands for preparing a patch
52for systemd (this example is for Fedora):
53
39988d11
ZJS
54 $ sudo dnf builddep systemd # install build dependencies
55 $ sudo dnf install mkosi # install tool to quickly build images
e4a3e122
LP
56 $ git clone https://github.com/systemd/systemd.git
57 $ cd systemd
58 $ vim src/core/main.c # or wherever you'd like to make your changes
e4a3e122
LP
59 $ ./autogen.sh c # configure the source tree
60 $ make -j `nproc` # build it locally, see if everything compiles fine
39988d11 61 $ make -j `nproc` check # run some simple regression tests
e4a3e122
LP
62 $ sudo mkosi # build a test image
63 $ sudo systemd-nspawn -bi image.raw # boot up the test image
64 $ git add -p # interactively put together your patch
65 $ git commit # commit it
66 $ ...
67
68And after that, please submit your branch as PR to systemd via github.
69
70Happy hacking!