[PATCH] Look for ioctl definitions in the kernel build tree
Dmitry V. Levin
ldv at altlinux.org
Mon Nov 3 19:12:08 UTC 2014
On Mon, Nov 03, 2014 at 03:51:10PM +0100, Lubomir Rintel wrote:
> On Mon, 2014-11-03 at 17:28 +0300, Dmitry V. Levin wrote:
> > On Mon, Nov 03, 2014 at 02:51:42PM +0100, Lubomir Rintel wrote:
> > > On Sat, 2014-11-01 at 04:02 +0300, Dmitry V. Levin wrote:
> > > > Hi,
> > > >
> > > > On Thu, Oct 16, 2014 at 12:05:43PM +0200, Lubomir Rintel wrote:
> > > > > 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.
> > > >
> > > > $(shell uname -r) is ok, it is already used by news-check.
> > > >
> > > > > +# Candidates for kernel build tree
> > > > > +KERNEL_INCLUDE = /lib/modules/$(shell uname -r)/build/include
> > > >
> > > > Unfortunately, this is not sufficient: the system where I run "make-dist"
> > > > script does not provide /lib/modules/$(shell uname -r)/build/include/, so
> > > > I'll have to fix it myself.
> > >
> > > That's weird. How do you install the kernel?
> >
> > Did you mean kernel headers? We just use "make headers_install".
>
> I think headers_install installs the user-exposed part, in /usr/include.
> The internal headers, which we need too, are looked up in the kernel
> source tree. The link to the appropriate source tree is created with
> modules_install.
Yes, while most of ioctl-related kernel headers are now exported by
headers_install, some (linux/vm_sockets.h media/*.h net/bluetooth/*.h
scsi/scsi.h scsi/scsi_ioctl.h scsi/sg.h video/da8xx-fb.h video/kyro.h
video/mbxfb.h video/sstfb.h) are still modules_install only.
When preparing release tarballs, one has to use modules_install'ed headers,
to avoid issues like one you reported.
I agree it's a good idea to change Makefile.am so that it'll look for
ioctl definitions in a modules_install'ed tree by default. I had to tweak
your patch slightly to support systems where /lib/modules/ is not
available for unprivileged users:
--- a/Makefile.am
+++ b/Makefile.am
@@ -288,9 +288,16 @@
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
+KERNEL_RELEASE = $(shell uname -r)
+# Candidates for the kernel headers tree.
+KERNEL_INCLUDE = \
+ /lib/modules/$(KERNEL_RELEASE)/build/include \
+ /usr/src/linux-$(KERNEL_RELEASE)/include \
+ $(INCLUDEDIR)
+IOCTLDIR = $(shell find $(KERNEL_INCLUDE) -maxdepth 0 -type d -print -quit 2>/dev/null)
+IOCTLASM = $(INCLUDEDIR)/asm
+IOCTLSORT_INCLUDEDIR = $(INCLUDEDIR)
ioctlent_h_in = linux/ioctlent.h.in
Lubomir, would you like to update the description of your patch,
highlighting the difference between headers_install'ed and
modules_install'ed kernel headers?
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20141103/3338bb47/attachment.bin>
More information about the Strace-devel
mailing list