From 540804827a2e1a724d9032d6d0314a6ff48476e1 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 27 Oct 2021 10:50:19 +0100 Subject: [PATCH 1/6] docs: Clean up links in HACKING.md --- docs/HACKING.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/HACKING.md b/docs/HACKING.md index 1d84efc8ae..c769112956 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -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,14 +32,15 @@ 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 From ff7c07fb0884387619cfffd7ef1ee843280856cc Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 27 Oct 2021 10:54:24 +0100 Subject: [PATCH 2/6] docs: Simplify git instructions in HACKING slightly --- docs/HACKING.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/HACKING.md b/docs/HACKING.md index c769112956..40ed8b0b4f 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -87,6 +87,7 @@ $ sudo dnf builddep systemd # install build dependencies $ sudo dnf install mkosi # install tool to quickly build images $ git clone https://github.com/systemd/systemd.git $ cd systemd +$ git checkout -b # 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 @@ -96,9 +97,7 @@ $ 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 # where REMOTE is your "fork" on GitHub ``` And after that, head over to your repo on GitHub and click "Compare & pull request" From 390a3076656fb02aec1f275e3e5188f8ab1bc966 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 27 Oct 2021 10:54:53 +0100 Subject: [PATCH 3/6] 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. --- docs/HACKING.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/HACKING.md b/docs/HACKING.md index 40ed8b0b4f..f435d02b25 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -92,7 +92,6 @@ $ vim src/core/main.c # or wherever you'd like to make your $ 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 From b43ed972e0f9d0fa7b188ffdd97b64333718bd3e Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 27 Oct 2021 11:30:47 +0100 Subject: [PATCH 4/6] docs: Extend builddep instructions to include more distros --- docs/HACKING.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/HACKING.md b/docs/HACKING.md index f435d02b25..7e1a9f86eb 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -72,18 +72,25 @@ 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): ```sh -$ sudo dnf builddep systemd # install build dependencies +# Install build dependencies (see above) $ sudo dnf install mkosi # install tool to quickly build images $ git clone https://github.com/systemd/systemd.git $ cd systemd From 4c71f971c12f1fb0134af7f3452013ba6e2f6e7e Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 27 Oct 2021 12:08:59 +0100 Subject: [PATCH 5/6] docs: Make mkosi install instructions generic --- docs/HACKING.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/HACKING.md b/docs/HACKING.md index 7e1a9f86eb..c15f82701b 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -87,11 +87,12 @@ $ 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 # Install build dependencies (see above) -$ sudo dnf install mkosi # install tool to quickly build images +# 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 # where BRANCH is the name of the branch From b2c9da052a2cd1e1624f7ed835422c885f39c2a9 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 27 Oct 2021 12:21:57 +0100 Subject: [PATCH 6/6] docs: Specify code block language for mkosi boot instructions --- docs/HACKING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/HACKING.md b/docs/HACKING.md index c15f82701b..f626470317 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -42,14 +42,14 @@ 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