[PATCH 1/2] kbuild: deb-pkg: set dependencies for kernel image package

From: Sascha Silbe
Date: Sun Oct 24 2021 - 10:08:52 EST


From: Sascha Silbe <x-linux@xxxxxxxxxxxxxx>

When built with module support, we'll need the kmod package to handle
the user space side of kernel module management.

When built with initramfs support but not building an initramfs
directly into the kernel, we'll need initramfs-tools to build the
initramfs that will be loaded.

If a the official kernel package of the distribution was installed
first the dependencies are already installed and it will happen to
work. However on a fresh install base system with just the kernel
package built by deb-pkg installed the dependencies will be missing
and the system will fail to boot.

Signed-off-by: Sascha Silbe <x-linux@xxxxxxxxxxxxxx>
---
scripts/package/mkdebian | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 60a2a63a5e900..a3becd9d402e1 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -132,6 +132,14 @@ else
echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly"
fi

+image_depends=
+if is_enabled MODULES; then
+ image_depends=kmod
+fi
+if is_enabled BLK_DEV_INITRD && ! is_enabled INITRAMFS_SOURCE; then
+ image_depends="${image_depends}${image_depends:+, }initramfs-tools | linux-initramfs-tool"
+fi
+
mkdir -p debian/source/
echo "1.0" > debian/source/format

@@ -180,6 +188,7 @@ Homepage: https://www.kernel.org/

Package: $packagename-$version
Architecture: $debarch
+Depends: $image_depends
Description: Linux kernel, version $version
This package contains the Linux kernel, modules and corresponding other
files, version: $version.
--
2.30.2