xref: /linux/Documentation/kbuild/headers_install.rst (revision 24bce201d79807b668bf9d9e0aca801c5c0d5f78)
1=============================================
2Exporting kernel headers for use by userspace
3=============================================
4
5The "make headers_install" command exports the kernel's header files in a
6form suitable for use by userspace programs.
7
8The linux kernel's exported header files describe the API for user space
9programs attempting to use kernel services.  These kernel header files are
10used by the system's C library (such as glibc or uClibc) to define available
11system calls, as well as constants and structures to be used with these
12system calls.  The C library's header files include the kernel header files
13from the "linux" subdirectory.  The system's libc headers are usually
14installed at the default location /usr/include and the kernel headers in
15subdirectories under that (most notably /usr/include/linux and
16/usr/include/asm).
17
18Kernel headers are backwards compatible, but not forwards compatible.  This
19means that a program built against a C library using older kernel headers
20should run on a newer kernel (although it may not have access to new
21features), but a program built against newer kernel headers may not work on an
22older kernel.
23
24The "make headers_install" command can be run in the top level directory of the
25kernel source code (or using a standard out-of-tree build).  It takes two
26optional arguments::
27
28  make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr
29
30ARCH indicates which architecture to produce headers for, and defaults to the
31current architecture.  The linux/asm directory of the exported kernel headers
32is platform-specific, to see a complete list of supported architectures use
33the command::
34
35  ls -d include/asm-* | sed 's/.*-//'
36
37INSTALL_HDR_PATH indicates where to install the headers. It defaults to
38"./usr".
39
40An 'include' directory is automatically created inside INSTALL_HDR_PATH and
41headers are installed in 'INSTALL_HDR_PATH/include'.
42
43The kernel header export infrastructure is maintained by David Woodhouse
44<dwmw2@infradead.org>.
45