[PATCH] Look for ioctl definitions in the kernel build tree
Lubomir Rintel
lkundrak at v3.sk
Thu Oct 16 10:05:43 UTC 2014
The kernel's headers are not installed into /usr/include, nor are the Kbuild
files. Howerver, if linux/ioctlent.sh doesn't see the Kbuild file, it wrongly
assumes we just have an old tree and happily proceeds, leaving many ioctl
definitions out.
Let's look into the build tree instead. Kernel makes a symlink from moduledir
after modules_install into the build tree -- let's use that one. This also
plays nicely with distribution packaged kernel build trees. Prefer one for the
running kernel, pick any other if not found and fall back to old behavior.
Signed-off-by: Lubomir Rintel <lkundrak at v3.sk>
---
This ought to fix the broken distribution issue reported downstream [1].
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1149126
For a proper tarball being generated one needs to either install kernel from
source using make modules_install headers_install or install distribution
packages (pkcon install kernel-devel kernel-headers).
I'm not sure the patch is good as it is; it introduces a GNU Make-ism ($(shell
)), I'm not sure whether that's okay. Feel free to improve.
Makefile.am | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index a30ac1c..2f044a5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -282,9 +282,13 @@ $(srcdir)/CREDITS: $(srcdir)/CREDITS.in $(srcdir)/.mailmap \
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner --mode=go-w,go+rX
-IOCTLDIR = /usr/include
-IOCTLASM = asm
-IOCTLSORT_INCLUDEDIR = $(IOCTLDIR)
+INCLUDEDIR = /usr/include
+# Candidates for kernel build tree
+KERNEL_INCLUDE = /lib/modules/$(shell uname -r)/build/include
+KERNEL_INCLUDE += /lib/modules/*/build/include
+KERNEL_INCLUDE += $(INCLUDEDIR)
+IOCTLDIR = $(shell find $(KERNEL_INCLUDE) -maxdepth 0 -type d -print -quit 2>/dev/null)
+IOCTLASM = $(INCLUDEDIR)/asm
ioctlent_h_in = linux/ioctlent.h.in
@@ -293,7 +297,7 @@ BUILT_SOURCES += $(ioctlent_h_in)
$(srcdir)/$(ioctlent_h_in): ioctlsort
$(<D)/$(<F) > $@
ioctlsort: $(srcdir)/linux/ioctlsort.c ioctls.h ioctldefs.h
- $(filter-out -I%,$(LINK.c)) -I. -I$(IOCTLSORT_INCLUDEDIR) \
+ $(filter-out -I%,$(LINK.c)) -I. -I$(INCLUDEDIR) \
$(filter -I%,$(LINK.c)) \
-o $@ $<
ioctls.h: $(srcdir)/linux/ioctlent.sh
--
1.9.3
More information about the Strace-devel
mailing list