From 9d64d1bfad3025fd9fa5f94408e04cead6fc1b63 Mon Sep 17 00:00:00 2001 From: Tony Hutter Date: Thu, 15 Aug 2024 14:00:18 -0700 Subject: [PATCH] Linux 6.10 compat: fix rpm-kmod and builtin The 6.10 kernel broke our rpm-kmod builds. The 6.10 kernel really wants the source files in the same directory as the object files. This workaround makes rpm-kmod work again. It also updates the builtin kernel codepath to work correctly with 6.10. See kernel commits: b1992c3772e6 kbuild: use $(src) instead of $(srctree)/$(src) for source directory 9a0ebe5011f4 kbuild: use $(obj)/ instead of $(src)/ for common pattern rules Reviewed-by: Brian Behlendorf Signed-off-by: Tony Hutter Closes #16439 Closes #16450 --- module/Kbuild.in | 4 ++-- rpm/generic/zfs-kmod.spec.in | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/module/Kbuild.in b/module/Kbuild.in index 87bd17cf5a..3d98081929 100644 --- a/module/Kbuild.in +++ b/module/Kbuild.in @@ -16,8 +16,8 @@ src = @abs_srcdir@ obj = @abs_builddir@ else zfs_include = $(srctree)/include/zfs -icp_include = $(srctree)/$(src)/icp/include -zstd_include = $(srctree)/$(src)/zstd/include +icp_include = $(src)/icp/include +zstd_include = $(src)/zstd/include ZFS_MODULE_CFLAGS += -include $(zfs_include)/zfs_config.h endif diff --git a/rpm/generic/zfs-kmod.spec.in b/rpm/generic/zfs-kmod.spec.in index 4cc075585d..30524474d1 100644 --- a/rpm/generic/zfs-kmod.spec.in +++ b/rpm/generic/zfs-kmod.spec.in @@ -145,6 +145,24 @@ for kernel_version in %{?kernel_versions}; do %{?kernel_cc} \ %{?kernel_ld} \ %{?kernel_llvm} + + # Pre-6.10 kernel builds didn't need to copy over the source files to the + # build directory. However we do need to do it though post-6.10 due to + # these commits: + # + # b1992c3772e6 kbuild: use $(src) instead of $(srctree)/$(src) for source + # directory + # + # 9a0ebe5011f4 kbuild: use $(obj)/ instead of $(src)/ for common pattern + # rules + # + # Note that kmodtool actually copies over the source into the build + # directory, so what we're doing here is normal. For efficiency reasons + # though we just use hardlinks instead of copying. + # + # See https://github.com/openzfs/zfs/issues/16439 for more info. + cp -lR ../%{module}-%{version}/module/* module/ + make %{?_smp_mflags} cd .. done