some simple(?) questions about Kbuild and installing kernel headers

Robert P. J. Day rpjday at crashcourse.ca
Fri May 27 07:53:00 EDT 2016


  for various reasons, i'm poring over the grotty details of the
installation of kernel headers, so a couple questions before i get any
further into the code.

  first, is there any value to a Kbuild file with no content? for
example, here's the entirety of
arch/cris/include/arch-v10/arch/Kbuild:

# CRISv10 arch

that is, one commented-out line, no references to any include files.
does such a file have any meaning? or can such files be deleted until
such time as they need to contain some content?

  next, with an example from that same directory, the "page.h" header
file:

#ifndef _CRIS_ARCH_PAGE_H
#define _CRIS_ARCH_PAGE_H

#ifdef __KERNEL__

... snip ...

#endif
#endif

  in other words, the *entirety* of the contents of that header file
are protected by "__KERNEL__". first, that seems silly given that we
know the Kbuild file is empty (but that's admittedly an obscure
situation).

  but even if the Kbuild file *wasn't* empty, there are two sub-cases.
first, if the "page.h" header file isn't being exported to user space,
there's no need for any use of __KERNEL__ to begin with since it's
exclusively a kernel header file.

  and if it *is* being exported, what ends up being exported is, well,
an empty header file, correct? which seems a bit silly, *unless* ...
are there cases where certain header files *must* exist in user space
just as placeholders, even if they're empty? that would explain it,
but it still seems yucky.

  one last query ... is there any value to an unexported header file
containing any __KERNEL__ protection? i'm assuming not; examples of
that are probably just leftovers that weren't cleaned up properly.

  more questions later as i get deeper into the code ...

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================




More information about the Kernelnewbies mailing list