我正在用我的自定义驱动程序构建内核。成功构建后,我发现了许多 build-in.o 文件。任何人都可以详细说明这些文件是如何在这里结束的吗?我只能怀疑这些与更高级别的 makefile 有关。
built-in.o 文件是未构建为模块的内核的每个目录目标的编译产物。
请参阅文档/kbuild/makefiles.txt
每个子目录都有一个 kbuild Makefile,它执行从上面传递下来的命令。 kbuild Makefile 使用信息
从 .config 文件构建 kbuild 使用的各种文件列表
构建任何内置或模块化目标。
--- 3.1 目标定义
Goal definitions are the main part (heart) of the kbuild Makefile.
These lines define the files to be built, any special compilation
options, and any subdirectories to be entered recursively.
The most simple kbuild makefile contains one line:
Example:
obj-y += foo.o
This tells kbuild that there is one object in that directory, named
foo.o. foo.o will be built from foo.c or foo.S.
If foo.o shall be built as a module, the variable obj-m is used.
Therefore the following pattern is often used:
Example:
obj-$(CONFIG_FOO) += foo.o
$(CONFIG_FOO) evaluates to either y (for built-in) or m (for module).
If CONFIG_FOO is neither y nor m, then the file will not be compiled
nor linked.
--- 3.2 内置对象目标 - obj-y
The kbuild Makefile specifies object files for vmlinux
in the $(obj-y) lists. These lists depend on the kernel
configuration.
Kbuild compiles all the $(obj-y) files. It then calls
"$(LD) -r" to merge these files into one built-in.o file.
built-in.o is later linked into vmlinux by the parent Makefile.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)