mri*_*dra 4 makefile build linux-kernel
我正在用我的自定义驱动程序构建内核。成功构建后,我发现了许多 build-in.o 文件。任何人都可以详细说明这些文件是如何在这里结束的吗?我只能怀疑这些与更高级别的 makefile 有关。
built-in.o 文件是未构建为模块的内核的每个目录目标的编译产物。
请参阅文档/kbuild/makefiles.txt
每个子目录都有一个 kbuild Makefile,它执行从上面传递下来的命令。kbuild Makefile 使用 .config 文件中的信息来构造 kbuild 用于构建任何内置或模块化目标的各种文件列表。
--- 3.1 目标定义
Run Code Online (Sandbox Code Playgroud)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
Run Code Online (Sandbox Code Playgroud)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.
归档时间: |
|
查看次数: |
5937 次 |
最近记录: |