* [PATCH] backports: look for kernel headers in source dir too
@ 2026-11-26 0:42 Baoli Zhang
0 siblings, 0 replies; only message in thread
From: Baoli Zhang @ 2026-11-26 0:42 UTC (permalink / raw)
To: Miri Korenblit; +Cc: Johannes Berg, linux-wireless, Baoli Zhang
Debian splits the kernel headers: /lib/modules/<ver>/build only has
.config, Module.symvers and the generated headers, include/linux is
under /lib/modules/<ver>/source. The grep checks in compat/Kconfig
then can't find the headers and all evaluate to n, so on 7.3 we
redefine the spinlock_bh guards and fail to build.
Add KLIB_SRC for these checks. Use the build dir if it has
include/linux, otherwise its source symlink (O= builds), and only then
$(KLIB)/source, so that a custom KLIB_BUILD doesn't pick up the headers
of the running kernel. Warn if no headers are found at all, instead of
silently disabling the checks.
Fixes: e0449c805011 ("backports: auto-detect spinlock_bh guard()")
Fixes: e9e903010322 ("[BUGFIX] backports: Auto detect genlmsg_multicast_allns()")
Fixes: 6bd0558a1593 ("[FROMGIT] netfilter: flowtable: restore ieee80211 forward path")
Signed-off-by: Baoli Zhang <baoli.zhang@linux.intel.com>
---
Makefile | 14 +++++++++++++-
compat/Kconfig | 6 +++---
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 2b33a80c3..daba7181e 100644
--- a/Makefile
+++ b/Makefile
@@ -19,8 +19,13 @@ KLIB_BUILD ?= $(KLIB)/build/
KERNEL_CONFIG := $(KLIB_BUILD)/.config
KERNEL_MAKEFILE := $(KLIB_BUILD)/Makefile
CONFIG_MD5 := $(shell md5sum $(KERNEL_CONFIG) 2>/dev/null | sed 's/\s.*//')
+# Debian splits the headers, its build dir has no include/linux
+KLIB_SRC ?= $(patsubst %/include/linux,%,$(firstword $(wildcard \
+ $(KLIB_BUILD)/include/linux \
+ $(KLIB_BUILD)/source/include/linux \
+ $(KLIB)/source/include/linux)))
-export KLIB KLIB_BUILD BACKPORT_DIR KMODDIR KMODPATH_ARG
+export KLIB KLIB_BUILD KLIB_SRC BACKPORT_DIR KMODDIR KMODPATH_ARG
# disable built-in rules for this file
.SUFFIXES:
@@ -60,6 +65,13 @@ mrproper:
echo "| (that isn't currently running.)" ;\
echo "\\--" ;\
false)
+ @test -n "$(KLIB_SRC)" || ( \
+ echo "/--------------" ;\
+ echo "| WARNING: kernel headers (include/linux) not found in" ;\
+ echo "| $(KLIB_BUILD) or its source dir, kernel feature" ;\
+ echo "| detection will not work. Set KLIB_SRC to the kernel" ;\
+ echo "| source tree to fix this." ;\
+ echo "\\--")
@set -e ; if [ "$$(cat .kernel_config_md5 2>/dev/null)" != "$(CONFIG_MD5)" ] ;\
then \
echo -n "Generating local configuration database from kernel ..." ;\
diff --git a/compat/Kconfig b/compat/Kconfig
index 09663a8bc..e1db4dd71 100644
--- a/compat/Kconfig
+++ b/compat/Kconfig
@@ -74,13 +74,13 @@ config BP_MODULES
for the "modules" directive to control the 'm' state.
config KERNEL_HAS_SPINLOCK_BH_GUARD
- def_bool $(success,grep -q DEFINE_LOCK_GUARD_1\$(left_paren)spinlock_bh$(comma) $(KLIB_BUILD)/include/linux/spinlock.h)
+ def_bool $(success,grep -q DEFINE_LOCK_GUARD_1\$(left_paren)spinlock_bh$(comma) $(KLIB_SRC)/include/linux/spinlock.h)
config KERNEL_HAS_GENLMSG_MULTICAST_ALLNS_GFP
- def_bool $(success,grep -A5 'int genlmsg_multicast_allns' $(KLIB_BUILD)/include/net/genetlink.h | grep -q gfp_t)
+ def_bool $(success,grep -A5 'int genlmsg_multicast_allns' $(KLIB_SRC)/include/net/genetlink.h | grep -q gfp_t)
config KERNEL_HAS_DEV_PATH_IEEE80211
- def_bool $(success,grep -q DEV_PATH_IEEE80211 $(KLIB_BUILD)/include/linux/netdevice.h)
+ def_bool $(success,grep -q DEV_PATH_IEEE80211 $(KLIB_SRC)/include/linux/netdevice.h)
config BPAUTO_BUILD_NLATTR
def_bool y
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-26 0:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 0:42 [PATCH] backports: look for kernel headers in source dir too Baoli Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox