linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] kbuild: deb-pkg: fixes for use on Debian systems
@ 2021-10-24 13:58 Sascha Silbe
  2021-10-24 13:58 ` [PATCH 1/2] kbuild: deb-pkg: set dependencies for kernel image package Sascha Silbe
  2021-10-24 13:58 ` [PATCH 2/2] kbuild: deb-pkg: invoke linux-base scripts if installed Sascha Silbe
  0 siblings, 2 replies; 3+ messages in thread
From: Sascha Silbe @ 2021-10-24 13:58 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek, Nick Desaulniers
  Cc: linux-kbuild, linux-kernel

When building binary .deb packages directly from a source tree using
"make deb-pkg" or "make bindeb-pkg", they don't work as well as the
vendor-provided (i.e. Debian) kernel packages because some
dependencies and integrations are missing. This series fixes some of
the shortcomings so the locally built packages can be used in place of
the vendor-provided ones.

Sascha Silbe (2):
  kbuild: deb-pkg: set dependencies for kernel image package
  kbuild: deb-pkg: invoke linux-base scripts if installed

 scripts/package/builddeb | 22 ++++++++++++++++++++++
 scripts/package/mkdebian |  9 +++++++++
 2 files changed, 31 insertions(+)


base-commit: 9c0c4d24ac000e52d55348961d3a3ba42065e0cf
prerequisite-patch-id: d2d09cbe2907cd6c1ece0fcc6b576faf1ef8dd37
-- 
2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] kbuild: deb-pkg: set dependencies for kernel image package
  2021-10-24 13:58 [PATCH 0/2] kbuild: deb-pkg: fixes for use on Debian systems Sascha Silbe
@ 2021-10-24 13:58 ` Sascha Silbe
  2021-10-24 13:58 ` [PATCH 2/2] kbuild: deb-pkg: invoke linux-base scripts if installed Sascha Silbe
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Silbe @ 2021-10-24 13:58 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek, Nick Desaulniers
  Cc: linux-kbuild, linux-kernel

From: Sascha Silbe <x-linux@infra-silbe.de>

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@infra-silbe.de>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] kbuild: deb-pkg: invoke linux-base scripts if installed
  2021-10-24 13:58 [PATCH 0/2] kbuild: deb-pkg: fixes for use on Debian systems Sascha Silbe
  2021-10-24 13:58 ` [PATCH 1/2] kbuild: deb-pkg: set dependencies for kernel image package Sascha Silbe
@ 2021-10-24 13:58 ` Sascha Silbe
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Silbe @ 2021-10-24 13:58 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek, Nick Desaulniers
  Cc: linux-kbuild, linux-kernel

From: Sascha Silbe <x-linux@infra-silbe.de>

Kernel images built from source can be installed and used manually. On
systems where "flash-kernel" is used, new versions will be picked up
automatically and used on next boot. However on systems relying on
symlinks this does not happen as the symlinks are not updated, unlike
with stock Debian kernels.

To fix this invoke the scripts from linux-base if they are installed
just like the maintainer scripts of the stock Debian kernel packages
do.

Signed-off-by: Sascha Silbe <x-linux@infra-silbe.de>
---
 scripts/package/builddeb | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 91a502bb97e8a..69e0c51d324e0 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -202,6 +202,28 @@ export DEB_MAINT_PARAMS="\$*"
 # Tell initramfs builder whether it's wanted
 export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No)
 
+# Call linux-base scripts if they are installed
+if command -v linux-update-symlinks > /dev/null; then
+    if [ $script = preinst ] && [ "\$1" = install ]; then
+        mkdir -p /lib/modules/$version
+        touch /lib/modules/$version/.fresh-install
+    elif [ $script = postinst ] && [ "\$1" = configure ]; then
+        if [ -f /lib/modules/$version/.fresh-install ]; then
+            linux-update-symlinks install $version /$installed_image_path
+            rm /lib/modules/$version/.fresh-install
+        else
+            linux-update-symlinks upgrade $version /$installed_image_path
+        fi
+    elif [ $script = prerm ] && [ "\$1" = remove ]; then
+        linux-check-removal $version
+    elif [ $script = postrm ]; then
+        rm -f /lib/modules/$version/.fresh-install
+        if [ "\$1" != upgrade ]; then
+            linux-update-symlinks remove $version /$installed_image_path
+        fi
+    fi
+fi
+
 test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
 exit 0
 EOF
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-24 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-24 13:58 [PATCH 0/2] kbuild: deb-pkg: fixes for use on Debian systems Sascha Silbe
2021-10-24 13:58 ` [PATCH 1/2] kbuild: deb-pkg: set dependencies for kernel image package Sascha Silbe
2021-10-24 13:58 ` [PATCH 2/2] kbuild: deb-pkg: invoke linux-base scripts if installed Sascha Silbe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).