Documentation/translations/zh_CN/kbuild/headers_install.rst
Source file repositories/reference/linux-study-clean/Documentation/translations/zh_CN/kbuild/headers_install.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/translations/zh_CN/kbuild/headers_install.rst- Extension
.rst- Size
- 1887 bytes
- Lines
- 40
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: documentation
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
.. SPDX-License-Identifier: GPL-2.0
.. include:: ../disclaimer-zh_CN.rst
:Original: Documentation/kbuild/headers_install.rst
:Translator: 慕冬亮 Dongliang Mu <dzm91@hust.edu.cn>
============================
导出内核头文件供用户空间使用
============================
"make headers_install" 命令以适合于用户空间程序的形式导出内核头文件。
Linux 内核导出的头文件描述了用户空间程序尝试使用内核服务的 API。这些内核
头文件被系统的 C 库(例如 glibc 和 uClibc)用于定义可用的系统调用,以及
与这些系统调用一起使用的常量和结构。C 库的头文件包括来自 linux 子目录的
内核头文件。系统的 libc 头文件通常被安装在默认位置 /usr/include,而内核
头文件在该位置的子目录中(主要是 /usr/include/linux 和 /usr/include/asm)。
内核头文件向后兼容,但不向前兼容。这意味着使用旧内核头文件的 C 库构建的程序
可以在新内核上运行(尽管它可能无法访问新特性),但使用新内核头文件构建的程序
可能无法在旧内核上运行。
"make headers_install" 命令可以在内核源代码的顶层目录中运行(或使用标准
的树外构建)。它接受两个可选参数::
make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr
ARCH 表明为其生成头文件的架构,默认为当前架构。导出内核头文件的 linux/asm
目录是基于特定平台的,要查看支持架构的完整列表,使用以下命令::
ls -d include/asm-* | sed 's/.*-//'
INSTALL_HDR_PATH 表明头文件的安装位置,默认为 "./usr"。
该命令会在 INSTALL_HDR_PATH 中自动创建创建一个 'include' 目录,而头文件
会被安装在 INSTALL_HDR_PATH/include 中。
内核头文件导出的基础设施由 David Woodhouse <dwmw2@infradead.org> 维护。
Annotation
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.