mkosi: Drop building custom kernel logic
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 29 Nov 2023 13:46:20 +0000 (14:46 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 29 Nov 2023 15:00:34 +0000 (15:00 +0000)
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.

14 files changed:
docs/HACKING.md
mkosi.images/system/kernel/mkosi.build.chroot [deleted file]
mkosi.images/system/kernel/mkosi.conf [deleted file]
mkosi.images/system/kernel/mkosi.conf.d/10-arch.conf [deleted file]
mkosi.images/system/kernel/mkosi.conf.d/10-centos-fedora.conf [deleted file]
mkosi.images/system/kernel/mkosi.conf.d/10-debian-ubuntu.conf [deleted file]
mkosi.images/system/kernel/mkosi.conf.d/10-fedora.conf [deleted file]
mkosi.images/system/kernel/mkosi.conf.d/10-opensuse.conf [deleted file]
mkosi.images/system/mkosi.conf.d/20-kernel-arch.conf [deleted file]
mkosi.images/system/mkosi.conf.d/20-kernel-centos-fedora.conf [deleted file]
mkosi.images/system/mkosi.conf.d/20-kernel-debian-ubuntu.conf [deleted file]
mkosi.images/system/mkosi.conf.d/20-kernel-fedora.conf [deleted file]
mkosi.images/system/mkosi.conf.d/20-kernel-opensuse.conf [deleted file]
mkosi.images/system/mkosi.conf.d/20-kernel.conf [deleted file]

index c089216..feec6b4 100644 (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
-```
diff --git a/mkosi.images/system/kernel/mkosi.build.chroot b/mkosi.images/system/kernel/mkosi.build.chroot
deleted file mode 100755 (executable)
index 1b33ed9..0000000
+++ /dev/null
@@ -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"
diff --git a/mkosi.images/system/kernel/mkosi.conf b/mkosi.images/system/kernel/mkosi.conf
deleted file mode 100644 (file)
index 5117d76..0000000
+++ /dev/null
@@ -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
diff --git a/mkosi.images/system/kernel/mkosi.conf.d/10-arch.conf b/mkosi.images/system/kernel/mkosi.conf.d/10-arch.conf
deleted file mode 100644 (file)
index bf8ac9c..0000000
+++ /dev/null
@@ -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
diff --git a/mkosi.images/system/kernel/mkosi.conf.d/10-centos-fedora.conf b/mkosi.images/system/kernel/mkosi.conf.d/10-centos-fedora.conf
deleted file mode 100644 (file)
index e4f2d5e..0000000
+++ /dev/null
@@ -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
diff --git a/mkosi.images/system/kernel/mkosi.conf.d/10-debian-ubuntu.conf b/mkosi.images/system/kernel/mkosi.conf.d/10-debian-ubuntu.conf
deleted file mode 100644 (file)
index 4542dba..0000000
+++ /dev/null
@@ -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
diff --git a/mkosi.images/system/kernel/mkosi.conf.d/10-fedora.conf b/mkosi.images/system/kernel/mkosi.conf.d/10-fedora.conf
deleted file mode 100644 (file)
index 866c1ed..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1-or-later
-
-[Match]
-Distribution=fedora
-
-[Content]
-BuildPackages=
-        libcap-static
diff --git a/mkosi.images/system/kernel/mkosi.conf.d/10-opensuse.conf b/mkosi.images/system/kernel/mkosi.conf.d/10-opensuse.conf
deleted file mode 100644 (file)
index 0647767..0000000
+++ /dev/null
@@ -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
diff --git a/mkosi.images/system/mkosi.conf.d/20-kernel-arch.conf b/mkosi.images/system/mkosi.conf.d/20-kernel-arch.conf
deleted file mode 100644 (file)
index c97f5de..0000000
+++ /dev/null
@@ -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
diff --git a/mkosi.images/system/mkosi.conf.d/20-kernel-centos-fedora.conf b/mkosi.images/system/mkosi.conf.d/20-kernel-centos-fedora.conf
deleted file mode 100644 (file)
index 14b1872..0000000
+++ /dev/null
@@ -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
diff --git a/mkosi.images/system/mkosi.conf.d/20-kernel-debian-ubuntu.conf b/mkosi.images/system/mkosi.conf.d/20-kernel-debian-ubuntu.conf
deleted file mode 100644 (file)
index f9413f1..0000000
+++ /dev/null
@@ -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
diff --git a/mkosi.images/system/mkosi.conf.d/20-kernel-fedora.conf b/mkosi.images/system/mkosi.conf.d/20-kernel-fedora.conf
deleted file mode 100644 (file)
index 9709185..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1-or-later
-
-[Match]
-PathExists=../../mkosi.kernel/
-Distribution=fedora
-
-[Content]
-BuildPackages=
-        libcap-static
diff --git a/mkosi.images/system/mkosi.conf.d/20-kernel-opensuse.conf b/mkosi.images/system/mkosi.conf.d/20-kernel-opensuse.conf
deleted file mode 100644 (file)
index 6d25af5..0000000
+++ /dev/null
@@ -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
diff --git a/mkosi.images/system/mkosi.conf.d/20-kernel.conf b/mkosi.images/system/mkosi.conf.d/20-kernel.conf
deleted file mode 100644 (file)
index 838ab00..0000000
+++ /dev/null
@@ -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