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