요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
=============================================
Exporting kernel headers for use by userspace
=============================================
The "make headers_install" command exports the kernel's header files in a
form suitable for use by userspace programs.
The linux kernel's exported header files describe the API for user space
programs attempting to use kernel services. These kernel header files are
used by the system's C library (such as glibc or uClibc) to define available
system calls, as well as constants and structures to be used with these
system calls. The C library's header files include the kernel header files
from the "linux" subdirectory. The system's libc headers are usually
installed at the default location /usr/include and the kernel headers in
subdirectories under that (most notably /usr/include/linux and
/usr/include/asm).
Kernel headers are backwards compatible, but not forwards compatible. This
means that a program built against a C library using older kernel headers
should run on a newer kernel (although it may not have access to new
features), but a program built against newer kernel headers may not work on an
older kernel.
The "make headers_install" command can be run in the top level directory of the
kernel source code (or using a standard out-of-tree build). It takes two
optional arguments::
make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr
ARCH indicates which architecture to produce headers for, and defaults to the
current architecture. The linux/asm directory of the exported kernel headers
is platform-specific, to see a complete list of supported architectures use
the command::
ls -d include/asm-* | sed 's/.*-//'
INSTALL_HDR_PATH indicates where to install the headers. It defaults to
"./usr".
An 'include' directory is automatically created inside INSTALL_HDR_PATH and
headers are installed in 'INSTALL_HDR_PATH/include'.
The kernel header export infrastructure is maintained by David Woodhouse
<dwmw2@infradead.org>.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
사용자 공간 kernel header와 호환성
1-22`make headers_install`은 kernel header file을 사용자 공간 program이 사용할 수 있는 형태로 export합니다.
Export된 Linux kernel header는 kernel service를 이용하려는 사용자 공간 program의 API를 설명합니다. glibc나 uClibc 같은 system C library는 이 header로 사용 가능한 system call과 그 call에 필요한 constant·structure를 정의합니다.
C library header는 `linux` 하위 directory의 kernel header를 include합니다. System libc header는 보통 `/usr/include`에 설치되고 kernel header는 그 아래의 `/usr/include/linux`와 `/usr/include/asm` 같은 directory에 설치됩니다.
Kernel UAPI header가 C library를 거쳐 application에 제공됩니다.
Kernel header는 backward compatible이지만 forward compatible은 아닙니다. 오래된 kernel header를 쓰는 C library에 맞춰 build한 program은 새 기능을 이용하지 못할 수 있어도 더 새 kernel에서 실행되어야 합니다. 반대로 새 kernel header에 맞춰 build한 program은 오래된 kernel에서 동작하지 않을 수 있습니다.
Build에 사용한 header와 실행 kernel의 시간 방향이 중요합니다.
=============================================
Exporting kernel headers for use by userspace
=============================================
The "make headers_install" command exports the kernel's header files in a
form suitable for use by userspace programs.
The linux kernel's exported header files describe the API for user space
programs attempting to use kernel services. These kernel header files are
used by the system's C library (such as glibc or uClibc) to define available
system calls, as well as constants and structures to be used with these
system calls. The C library's header files include the kernel header files
from the "linux" subdirectory. The system's libc headers are usually
installed at the default location /usr/include and the kernel headers in
subdirectories under that (most notably /usr/include/linux and
/usr/include/asm).
Kernel headers are backwards compatible, but not forwards compatible. This
means that a program built against a C library using older kernel headers
should run on a newer kernel (although it may not have access to new
features), but a program built against newer kernel headers may not work on an
older kernel.
`headers_install` argument와 설치 위치
23-44`make headers_install`은 kernel source top-level directory에서 실행하거나 표준 out-of-tree build로 실행할 수 있습니다. 선택 argument는 `ARCH`와 `INSTALL_HDR_PATH`이며 예제는 `make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr`입니다.
Architecture 선택과 설치 root를 독립적으로 지정합니다.
Exported header의 `linux/asm` directory는 platform별입니다. 지원 architecture 전체 목록은 `ls -d include/asm-* | sed 's/.*-//'`로 확인합니다.
`INSTALL_HDR_PATH` 안에는 `include` directory가 자동으로 만들어지고 header는 `INSTALL_HDR_PATH/include`에 설치됩니다. 예제처럼 `/usr`를 지정하면 결과는 `/usr/include` 아래에 놓입니다.
지정한 root에 `include`가 자동으로 붙습니다.
Kernel header export infrastructure의 maintainer는 David Woodhouse `<dwmw2@infradead.org>`입니다.
The "make headers_install" command can be run in the top level directory of the
kernel source code (or using a standard out-of-tree build). It takes two
optional arguments::
make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr
ARCH indicates which architecture to produce headers for, and defaults to the
current architecture. The linux/asm directory of the exported kernel headers
is platform-specific, to see a complete list of supported architectures use
the command::
ls -d include/asm-* | sed 's/.*-//'
INSTALL_HDR_PATH indicates where to install the headers. It defaults to
"./usr".
An 'include' directory is automatically created inside INSTALL_HDR_PATH and
headers are installed in 'INSTALL_HDR_PATH/include'.
The kernel header export infrastructure is maintained by David Woodhouse
<dwmw2@infradead.org>.
요약·해설
headers_install.rst:1-44`make headers_install`은 C library와 사용자 program이 사용할 kernel UAPI header를 export합니다. 오래된 header로 build한 program은 새 kernel에서 동작해야 하지만 새 header로 build한 program은 오래된 kernel에서 동작하지 않을 수 있습니다.
`INSTALL_HDR_PATH`에 `include`가 자동으로 추가됩니다.