Merge tag 'for-linus-20190726-2' of git://git.kernel.dk/linux-block
[linux-2.6-block.git] / Documentation / kbuild / headers_install.rst
CommitLineData
cd238eff 1=============================================
451ad114
RL
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
cd238eff 26optional arguments::
451ad114 27
ed45d403 28 make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr
451ad114
RL
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
cd238eff 33the command::
451ad114
RL
34
35 ls -d include/asm-* | sed 's/.*-//'
36
ed45d403
AB
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'.
451ad114 42
451ad114
RL
43The kernel header export infrastructure is maintained by David Woodhouse
44<dwmw2@infradead.org>.