blob: f6c6b74a609c678ccde1e73cf15d17466497c089 [file] [log] [blame]
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -03001=============================================
Rob Landley451ad112007-10-16 23:31:16 -07002Exporting 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
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030026optional arguments::
Rob Landley451ad112007-10-16 23:31:16 -070027
Anish Bhatted45d402015-06-08 17:37:31 -070028 make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr
Rob Landley451ad112007-10-16 23:31:16 -070029
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
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030033the command::
Rob Landley451ad112007-10-16 23:31:16 -070034
35 ls -d include/asm-* | sed 's/.*-//'
36
Anish Bhatted45d402015-06-08 17:37:31 -070037INSTALL_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'.
Rob Landley451ad112007-10-16 23:31:16 -070042
Rob Landley451ad112007-10-16 23:31:16 -070043The kernel header export infrastructure is maintained by David Woodhouse
44<dwmw2@infradead.org>.