mkosi: Drop building custom kernel logic

Now that mkosi-kernel is a thing, this logic in systemd is just mostly
bitrotting since I just use mkosi-kernel these days. If I ever need to
hack on systemd and the kernel in tandem, I'll just add support for
building systemd to mkosi-kernel instead, so let's drop the support for
building a custom kernel in systemd's mkosi configuration.
This commit is contained in:
Daan De Meyer 2023-11-29 14:46:20 +01:00 committed by Luca Boccassi
parent 5fae156103
commit c417615c12
14 changed files with 0 additions and 355 deletions

View file

@ -337,23 +337,3 @@ 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.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
```

View file

@ -1,36 +0,0 @@
#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later
set -e
cd "$SRCDIR/kernel"
BUILDDIR="$BUILDDIR/kernel"
mkdir -p "$BUILDDIR"
# Prevent a distro's custom installkernel script from being used.
if [ -x /sbin/installkernel ]; then
mount --bind /dev/null /sbin/installkernel
fi
# Ensure fast incremental builds by fixating these values which usually change for each build.
export KBUILD_BUILD_TIMESTAMP="Fri Jun 5 15:58:00 CEST 2015"
export KBUILD_BUILD_HOST="mkosi"
scripts/kconfig/merge_config.sh -O "$BUILDDIR" \
../mkosi.kernel.config \
tools/testing/selftests/bpf/config.x86_64 \
tools/testing/selftests/bpf/config
# Make sure systemd-boot boots this kernel and not the distro provided one by overriding the version.
make O="$BUILDDIR" VERSION=99 -j "$(nproc)"
make O="$BUILDDIR" VERSION=99 -j "$(nproc)" headers
KERNEL_RELEASE=$(make O="$BUILDDIR" VERSION=99 -s kernelrelease)
mkdir -p "$DESTDIR/usr/lib/modules/$KERNEL_RELEASE"
make O="$BUILDDIR" VERSION=99 INSTALL_MOD_PATH="$DESTDIR/usr" modules_install
make O="$BUILDDIR" VERSION=99 INSTALL_PATH="$DESTDIR/usr/lib/modules/$KERNEL_RELEASE" install
mkdir -p "$DESTDIR/usr/lib/kernel/selftests"
make -C tools/testing/selftests -j "$(nproc)" O="$BUILDDIR" VERSION=99 KSFT_INSTALL_PATH="$DESTDIR/usr/lib/kernel/selftests" SKIP_TARGETS="hid" install
mkdir -p "$DESTDIR"/usr/bin
ln -sf /usr/lib/kernel/selftests/bpf/bpftool "$DESTDIR/usr/bin/bpftool"

View file

@ -1,19 +0,0 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
BuildSources=kernel/
[Content]
BuildPackages=
bc
binutils
bison
clang
flex
gcc
lld
llvm
make
make
rsync
tar

View file

@ -1,19 +0,0 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Distribution=arch
[Content]
Packages=
alsa-lib
fuse3
libcap
libcap-ng
libelf
libmnl
numactl
popt
BuildPackages=
pahole
python-docutils

View file

@ -1,34 +0,0 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Distribution=|centos
Distribution=|fedora
[Content]
Packages=
alsa-lib
elfutils-libelf
fuse3
glibc.i686
libcap
libcap-ng
libcap-ng-utils
libmnl
numactl-libs
popt
BuildPackages=
dwarves
glibc-devel.i686
glibc-static
glibc-static.i686
pkgconfig(alsa)
pkgconfig(fuse3)
pkgconfig(libcap-ng)
pkgconfig(libcap)
pkgconfig(libelf)
pkgconfig(libmnl)
pkgconfig(numa)
pkgconfig(openssl)
pkgconfig(popt)
python3-docutils

View file

@ -1,32 +0,0 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Distribution=|debian
Distribution=|ubuntu
[Content]
Packages=
fuse3
libasound2
libc6-i386
libcap-ng0
libcap2
libelf1
libmnl0
libnuma1
libpopt0
BuildPackages=
gcc-multilib
libasound-dev
libc6-dev
libc6-dev-i686
libcap-ng-dev
libcap-dev
libelf-dev
libfuse3-dev
libmnl-dev
libnuma-dev
libpopt-dev
pahole
python3-docutils

View file

@ -1,8 +0,0 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Distribution=fedora
[Content]
BuildPackages=
libcap-static

View file

@ -1,34 +0,0 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Distribution=opensuse
[Content]
Packages=
fuse3
glibc-32bit
libasound2
libcap-ng0
libcap2
libelf1
libmnl0
libnuma1
libpopt0
BuildPackages=
alsa-devel
dwarves
fuse3-devel
gcc-32bit
glibc-devel-32bit
glibc-devel-static-32bit
glibc-static
libcap-devel
libcap-ng-dev
libelf-devel
liblz4-dev
libmnl-dev
libnuma-devel
pcre-devel
popt-devel
python3-docutils

View file

@ -1,20 +0,0 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
PathExists=../../mkosi.kernel/
Distribution=arch
[Content]
Packages=
alsa-lib
fuse2
libcap
libcap-ng
libelf
libmnl
numactl
popt
BuildPackages=
pahole
python-docutils

View file

@ -1,35 +0,0 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
PathExists=../../mkosi.kernel/
Distribution=|centos
Distribution=|fedora
[Content]
Packages=
alsa-lib
elfutils-libelf
fuse
glibc.i686
libcap
libcap-ng
libcap-ng-utils
libmnl
numactl-libs
popt
BuildPackages=
dwarves
glibc-devel.i686
glibc-static
glibc-static.i686
pkgconfig(alsa)
pkgconfig(fuse)
pkgconfig(libcap-ng)
pkgconfig(libcap)
pkgconfig(libelf)
pkgconfig(libmnl)
pkgconfig(numa)
pkgconfig(openssl)
pkgconfig(popt)
python3-docutils

View file

@ -1,33 +0,0 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
PathExists=../../mkosi.kernel/
Distribution=|debian
Distribution=|ubuntu
[Content]
Packages=
fuse
libasound2
libc6-i386
libcap-ng0
libcap2
libelf1
libmnl0
libnuma1
libpopt0
BuildPackages=
gcc-multilib
libasound-dev
libc6-dev
libc6-dev-i686
libcap-ng-dev
libcap-dev
libelf-dev
libfuse-dev
libmnl-dev
libnuma-dev
libpopt-dev
pahole
python3-docutils

View file

@ -1,9 +0,0 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
PathExists=../../mkosi.kernel/
Distribution=fedora
[Content]
BuildPackages=
libcap-static

View file

@ -1,35 +0,0 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
PathExists=../../mkosi.kernel/
Distribution=opensuse
[Content]
Packages=
fuse
glibc-32bit
libasound2
libcap-ng0
libcap2
libelf1
libmnl0
libnuma1
libpopt0
BuildPackages=
alsa-devel
dwarves
fuse-devel
gcc-32bit
glibc-devel-32bit
glibc-devel-static-32bit
glibc-static
libcap-devel
libcap-ng-dev
libelf-devel
liblz4-dev
libmnl-dev
libnuma-devel
pcre-devel
popt-devel
python3-docutils

View file

@ -1,21 +0,0 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
PathExists=../../mkosi.kernel/
[Content]
BuildScript=mkosi.kernel.build
BuildSources=../..
BuildPackages=
bc
binutils
bison
clang
flex
gcc
lld
llvm
make
make
rsync
tar