forked from hust-open-atom-club/TranslateProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac1f203
commit 0267a32
Showing
1 changed file
with
13 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,34 @@ | ||
--- | ||
status: translating | ||
status: translated | ||
title: "Exporting kernel headers for use by userspace" | ||
author: Linux Kernel Community | ||
collector: tttturtle-russ | ||
collected_date: 20240425 | ||
translator: RutingZhang0429 | ||
translated_date:20240510 | ||
link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/kbuild/headers_install.rst | ||
--- | ||
|
||
# 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). | ||
"make headers_install" 命令以适合用户空间程序使用的形式导出内核的头文件。 | ||
|
||
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. | ||
Linux 内核导出的头文件描述了用户空间程序尝试使用内核服务的 API。这些内核头文件被系统的 C 库(例如 glibc 和 uClibc)用于定义可用的系统调用,以及与这些系统调用一起使用的常量和结构。C 库的头文件包括来自 "linux" 子目录的内核头文件。系统的 libc 头文件通常被安装在默认位置 /usr/include,而内核头文件则在该位置的子目录下(尤其是 /usr/include/linux 和 /usr/include/asm)。 | ||
|
||
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: | ||
内核头文件向后兼容,但不向前兼容。这意味着使用旧内核头文件和C库构建的程序可以在新内核上运行(尽管它可能无法访问新功能),但使用新内核头文件构建的程序可能无法在旧内核上运行。 | ||
|
||
"make headers_install" 命令可以在内核源代码的顶层目录中运行(或使用标准的树外构建)。它接受两个可选参数: | ||
|
||
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: | ||
ARCH 指示为其生成头文件的架构,默认为当前架构。导出内核头文件的 linux/asm 目录是基于特定平台的,要查看支持架构的完整列表,使用以下命令: | ||
|
||
ls -d include/asm-* | sed 's/.*-//' | ||
|
||
INSTALL_HDR_PATH indicates where to install the headers. It defaults to | ||
\"./usr\". | ||
INSTALL_HDR_PATH 指示要安装头文件的位置。默认为 "./usr"。 | ||
|
||
一个 'include' 目录会自动被创建在 INSTALL_HDR_PATH 中,头文件会被安装在 INSTALL_HDR_PATH/include 中。 | ||
|
||
An \'include\' directory is automatically created inside | ||
INSTALL_HDR_PATH and headers are installed in | ||
\'INSTALL_HDR_PATH/include\'. | ||
内核头文件导出基础设施由 David Woodhouse <<dwmw2@infradead.org>> 维护。 | ||
|
||
The kernel header export infrastructure is maintained by David Woodhouse | ||
\<<dwmw2@infradead.org>\>. |