mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-21 18:03:41 +03:00
Merge pull request #24629 from DaanDeMeyer/mkosi-kernel
mkosi: Optionally build a kernel image from mkosi.kernel/
This commit is contained in:
commit
beead603c5
@ -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
|
||||
```
|
||||
|
37
mkosi.build
37
mkosi.build
@ -259,3 +259,40 @@ fi
|
||||
# Make sure services aren't enabled by default on Debian/Ubuntu.
|
||||
mkdir -p "$DESTDIR/etc/systemd/system-preset"
|
||||
echo "disable *" > "$DESTDIR/etc/systemd/system-preset/99-mkosi.preset"
|
||||
|
||||
if [ -d mkosi.kernel/ ]; then
|
||||
cd "$SRCDIR/mkosi.kernel"
|
||||
mkdir -p "$BUILDDIR/mkosi.kernel"
|
||||
|
||||
make O="$BUILDDIR/mkosi.kernel" defconfig
|
||||
|
||||
scripts/config \
|
||||
--file $BUILDDIR/mkosi.kernel/.config \
|
||||
--enable BPF_SYSCALL \
|
||||
--enable BPF_JIT \
|
||||
--enable BPF_JIT_ALWAYS_ON \
|
||||
--enable BPF_JIT_DEFAULT_ON \
|
||||
--enable BPF_UNPRIV_DEFAULT_OFF \
|
||||
--enable USERMODE_DRIVER \
|
||||
--enable BPF_PRELOAD \
|
||||
--enable BPF_PRELOAD_UMD \
|
||||
--enable BPF_LSM \
|
||||
--enable BTRFS_FS \
|
||||
--enable BTRFS_FS_POSIX_ACL \
|
||||
--enable PSI \
|
||||
--enable CGROUPS \
|
||||
--enable CGROUP_BPF \
|
||||
--enable MEMCG \
|
||||
--enable MEMCG_SWAP \
|
||||
--enable MEMCG_KMEM
|
||||
|
||||
# Make sure all unset options are set to their default value.
|
||||
make O="$BUILDDIR/mkosi.kernel" olddefconfig
|
||||
|
||||
make O="$BUILDDIR/mkosi.kernel" -j "$(nproc)"
|
||||
|
||||
KERNEL_RELEASE="$(make O=$BUILDDIR/mkosi.kernel -s kernelrelease)"
|
||||
mkdir -p "$DESTDIR/usr/lib/modules/$KERNEL_RELEASE"
|
||||
make O="$BUILDDIR/mkosi.kernel" INSTALL_MOD_PATH="$DESTDIR/usr" modules_install
|
||||
make O="$BUILDDIR/mkosi.kernel" INSTALL_PATH="$DESTDIR/usr/lib/modules/$KERNEL_RELEASE" install
|
||||
fi
|
||||
|
@ -13,6 +13,7 @@ OutputDirectory=mkosi.output
|
||||
[Content]
|
||||
BuildDirectory=mkosi.builddir
|
||||
Cache=mkosi.cache
|
||||
SourceFileTransfer=mount
|
||||
SourceFileTransferFinal=copy-git-others
|
||||
Packages=
|
||||
acl
|
||||
@ -42,17 +43,23 @@ Packages=
|
||||
zsh
|
||||
|
||||
BuildPackages=
|
||||
bc
|
||||
binutils
|
||||
bison
|
||||
clang
|
||||
flex
|
||||
gcc
|
||||
gettext
|
||||
git
|
||||
gnu-efi
|
||||
gperf
|
||||
llvm
|
||||
make
|
||||
meson
|
||||
pkgconf
|
||||
rpm
|
||||
rsync
|
||||
tar
|
||||
zstd
|
||||
|
||||
[Host]
|
||||
|
@ -31,6 +31,7 @@ BuildPackages=
|
||||
docbook-xsl
|
||||
libxslt
|
||||
linux-api-headers
|
||||
pahole
|
||||
perl
|
||||
python-jinja
|
||||
python-lxml
|
||||
|
@ -38,6 +38,7 @@ Packages=
|
||||
BuildPackages=
|
||||
bpftool
|
||||
docbook-xsl
|
||||
dwarves
|
||||
gnu-efi-devel
|
||||
libgcrypt-devel # CentOS Stream 8 libgcrypt-devel doesn't ship a pkg-config file.
|
||||
libxslt
|
||||
|
@ -63,6 +63,7 @@ BuildPackages=
|
||||
libssl-dev
|
||||
libxkbcommon-dev
|
||||
libzstd-dev
|
||||
pahole
|
||||
python3-jinja2
|
||||
python3-lxml
|
||||
xsltproc
|
||||
|
@ -17,7 +17,6 @@ Packages=
|
||||
gnutls
|
||||
iproute
|
||||
iproute-tc
|
||||
kernel-modules-extra
|
||||
libbpf
|
||||
libfido2
|
||||
libmicrohttpd
|
||||
@ -34,6 +33,7 @@ Packages=
|
||||
BuildPackages=
|
||||
bpftool
|
||||
docbook-xsl
|
||||
dwarves
|
||||
gnu-efi-devel
|
||||
pam-devel
|
||||
pkgconfig # pkgconf shim to provide /usr/bin/pkg-config
|
||||
|
@ -35,6 +35,7 @@ BuildPackages=
|
||||
bpftool
|
||||
dbus-1-devel
|
||||
docbook-xsl-stylesheets
|
||||
dwarves
|
||||
fdupes
|
||||
gcc-c++
|
||||
glib2-devel
|
||||
|
@ -64,6 +64,7 @@ BuildPackages=
|
||||
libssl-dev
|
||||
libxkbcommon-dev
|
||||
libzstd-dev
|
||||
pahole
|
||||
python3-jinja2
|
||||
python3-lxml
|
||||
xsltproc
|
||||
|
Loading…
x
Reference in New Issue
Block a user