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.
This commit is contained in:
Daan De Meyer
2022-09-29 20:15:57 +02:00
parent 3e139a8e64
commit d12e9bdc76
9 changed files with 69 additions and 0 deletions
+20
View File
@@ -414,3 +414,23 @@ To debug systemd-boot in an IDE such as VSCode we can use a launch configuration
]
}
```
## Hacking on the kernel + systemd
If you're hacking on the kernel in tandem with systemd, you can clone a kernel repository in mkosi.kernel/ in
the systemd repository, and mkosi will automatically build that kernel and install it into the final image.
To prevent the distribution's kernel from being installed (which isn't necessary since we're building our
own kernel), you can add the following snippets to mkosi.default.d/20-local.conf:
(This snippet is for Fedora, the list of packages will need to be changed for other distributions)
```
[Distribution]
CacheInitrd=no
[Content]
BasePackages=conditional
Packages=systemd
util-linux
dracut
```