Skip to content

Commit

Permalink
Linux 6.10 compat: fix rpm-kmod and builtin
Browse files Browse the repository at this point in the history
The 6.10 kernel broke our rpm-kmod builds.  The 6.10 kernel really
want 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

Fixes: openzfs#16439
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
  • Loading branch information
tonyhutter authored and snajpa committed Aug 15, 2024
1 parent 66b8751 commit 0c0d385
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions module/Kbuild.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 24 additions & 0 deletions rpm/generic/zfs-kmod.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,30 @@ for kernel_version in %{?kernel_versions}; do
%{?kernel_cc} \
%{?kernel_ld} \
%{?kernel_llvm}

# WORKAROUND ALERT
#
# The 6.10 kernel broke our old way of doing kmod builds. The old way
# was to go into our '_kmod_build_${kernel_version%%___*}' directory, and
# then run ../zfs-source-dir/configure from one level down. This gave
# us our Kbuild and Makefile in our '_kmod_build_${kernel_version%%___*}'
# directory without any of the source code. We could then build the modules
# using some kind of magic (VPATH?) where we say 'I know our KBuild file is
# here, but our source code is actually in this other directory'. That
# doesn't seem to work anymore after the 6.10 kernel 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
#
# The workaround is to just hardlink a copy of the source into our
# build directory.
#
# See https://github.com/openzfs/zfs/issues/16439 for more info.
cp -lR ../%{module}-%{version}/module/* module/

make %{?_smp_mflags}
cd ..
done
Expand Down

0 comments on commit 0c0d385

Please sign in to comment.