mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
Merge pull request #21147 from DaanDeMeyer/hacking-docs
docs: Clean up HACKING.md
This commit is contained in:
commit
3c15860e9e
@ -8,8 +8,8 @@ SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
# Hacking on systemd
|
||||
|
||||
We welcome all contributions to systemd. If you notice a bug or a missing
|
||||
feature, please feel invited to fix it, and submit your work as a GitHub Pull
|
||||
Request (PR) at https://github.com/systemd/systemd/pull/new.
|
||||
feature, please feel invited to fix it, and submit your work as a
|
||||
[GitHub Pull Request (PR)](https://github.com/systemd/systemd/pull/new).
|
||||
|
||||
Please make sure to follow our [Coding Style](CODING_STYLE.md) when submitting
|
||||
patches. Also have a look at our [Contribution Guidelines](CONTRIBUTING.md).
|
||||
@ -32,23 +32,24 @@ run the relevant tool from the build directory.
|
||||
|
||||
For some components (most importantly, systemd/PID1 itself) this is not
|
||||
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` 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 the `mkosi` package (if not packaged for your distro, it can be
|
||||
downloaded from https://github.com/systemd/mkosi). `mkosi` will build an image
|
||||
for the host distro by default. It is sufficient to type `mkosi` in the systemd
|
||||
project directory to generate a disk image `image.raw` you can boot either in
|
||||
`systemd-nspawn` or in an UEFI-capable VM:
|
||||
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 the
|
||||
`mkosi` package (if not packaged for your distro, it can be downloaded from
|
||||
the [GitHub repository](https://github.com/systemd/mkosi). `mkosi` will build an
|
||||
image for the host distro by default. It is sufficient to type `mkosi` in the
|
||||
systemd project directory to generate a disk image `image.raw` you can boot either
|
||||
in `systemd-nspawn` or in an UEFI-capable VM:
|
||||
|
||||
```
|
||||
# mkosi boot
|
||||
```sh
|
||||
$ mkosi boot
|
||||
```
|
||||
|
||||
or:
|
||||
|
||||
```
|
||||
# mkosi qemu
|
||||
```sh
|
||||
$ mkosi qemu
|
||||
```
|
||||
|
||||
Every time you rerun the `mkosi` command a fresh image is built, incorporating
|
||||
@ -71,33 +72,39 @@ Cache=<full-path-to-package-manager-cache> # (e.g. /var/cache/dnf)
|
||||
|
||||
If you want to do a local build without mkosi, most distributions also provide
|
||||
very simple and convenient ways to install all development packages necessary
|
||||
to build systemd. For example, on Fedora the following command line should be
|
||||
sufficient to install all of systemd's build dependencies:
|
||||
to build systemd:
|
||||
|
||||
```
|
||||
# dnf builddep systemd
|
||||
```sh
|
||||
# Fedora
|
||||
$ sudo dnf builddep systemd
|
||||
# Debian/Ubuntu
|
||||
$ sudo apt-get builddep systemd
|
||||
# Arch
|
||||
$ sudo pacman install asp
|
||||
$ asp checkout systemd
|
||||
$ cd systemd/trunk
|
||||
$ makepkg -seoc
|
||||
```
|
||||
|
||||
Putting this all together, here's a series of commands for preparing a patch
|
||||
for systemd (this example is for Fedora):
|
||||
for systemd:
|
||||
|
||||
```sh
|
||||
$ sudo dnf builddep systemd # install build dependencies
|
||||
$ sudo dnf install mkosi # install tool to quickly build images
|
||||
# Install build dependencies (see above)
|
||||
# Install a recent version of mkosi (either via your distro's package manager if
|
||||
# available there or from the github repository otherwise)
|
||||
$ git clone https://github.com/systemd/systemd.git
|
||||
$ cd systemd
|
||||
$ git checkout -b <BRANCH> # where BRANCH is the name of the branch
|
||||
$ vim src/core/main.c # or wherever you'd like to make your changes
|
||||
$ meson build # configure the build
|
||||
$ meson compile -C build # build it locally, see if everything compiles fine
|
||||
$ meson test -C build # run some simple regression tests
|
||||
$ ln -s .mkosi/mkosi.fedora mkosi.default # Configure mkosi to build a fedora image
|
||||
$ sudo mkosi # build a test image
|
||||
$ sudo mkosi boot # boot up the test image
|
||||
$ git add -p # interactively put together your patch
|
||||
$ git commit # commit it
|
||||
$ git push REMOTE HEAD:refs/heads/BRANCH
|
||||
# where REMOTE is your "fork" on GitHub
|
||||
# and BRANCH is a branch name.
|
||||
$ git push -u <REMOTE> # where REMOTE is your "fork" on GitHub
|
||||
```
|
||||
|
||||
And after that, head over to your repo on GitHub and click "Compare & pull request"
|
||||
|
Loading…
Reference in New Issue
Block a user