我又回来了,上次不是说到~Documentation/kbuild/kconfig.txt中去看看吗,顾名思义,就是配置文件。先别急,我发现这个kbuild目录下面有个也有个00-INDEX文件,显然,肯定又是将该目录下文件作用的,应该先瞅瞅这个。
00-INDEX
- this file: info on the kernel build process
kbuild.txt
- developer information on kbuild
kconfig.txt
- usage help for make *config
kconfig-language.txt
- specification of Config Language, the language in Kconfig files
makefiles.txt
- developer information for linux kernel makefiles
modules.txt
- how to build modules and to install them
怎么没翻译,呵呵,这么短,直接看算了。先看看kbuild.txt吧。这里得说说什么个kbuild了,网上一搜,一堆啊!找了经典来。
关于kBuild
kBuild是一个makefile框架,用于使编写简单的makefiles文件来完成复杂的任务
当前kBuild设计
kBuild框架的目标
1.在所有支持的平台具有相似的行为
2.灵活,不会产生不需要的阻止特别方案的约束
3.Makefile能够很容易地编写和维护
在当前kBuild观念中有4个概念
1.一个配置文件能够自动包含子目录树
2.有目标配置文件模板作为makefile简化的主要机制
3.有工具和SDKs(Software Development Kit )来使模板具有灵活性
4.通过使用子makefiles来实现非递归makefile方法
读了后什么感觉,可以这样理解什么时kbuild,即一种另类的makefile,一种嵌套了kbuild框架语法的makefile,这样的makefile会使内核编译起来变得更加简单,因此采用这样的方案。
看看kbuild.txt里面讲了些什么:
Output files
modules.order
--------------------------------------------------
This file records the order in which modules appear in Makefiles. This
is used by modprobe to deterministically resolve aliases that match
multiple modules.
这个文件记录了出现在Makefiles中的顺序。解决了模块重名问题。
modules.builtin
--------------------------------------------------
This file lists all modules that are built into the kernel. This is used
by modprobe to not fail when trying to load something builtin.
这个文件列出了被编译进built-in.o的模块。解决加载问题。
Environment variables(环境变量)
KCPPFLAGS
--------------------------------------------------
Additional options to pass when preprocessing. The preprocessing options
will be used in all cases where kbuild does preprocessing including
building C files and assembler files.
在kbuild处理C和汇编文件前的一些附加选项。
KAFLAGS
--------------------------------------------------
Additional options to the assembler (for built-in and modules).
汇编文件的附加选项(用于build-in和模块)。
AFLAGS_MODULE
--------------------------------------------------
Addtional module specific options to use for $(AS).
使用$(AS)的附加模块选项。
AFLAGS_KERNEL
--------------------------------------------------
Addtional options for $(AS) when used for assembler
code for code that is compiled as built-in.
将汇编代码编译到build-in.o时使用$(AS)的附加选项。
KCFLAGS
--------------------------------------------------
Additional options to the C compiler (for built-in and modules).
编译C时的附加选项(用于build-in和模块)。
CFLAGS_KERNEL
--------------------------------------------------
Addtional options for $(CC) when used to compile
code that is compiled as built-in.
编译进build-in.o时使用了$(CC)时的附加选项。
CFLAGS_MODULE
--------------------------------------------------
Addtional module specific options to use for $(CC).
使用$(CC)时的附加模块选项。
LDFLAGS_MODULE
--------------------------------------------------
Additional options used for $(LD) when linking modules.
链接模块时使用$(LD)的附加选项。
KBUILD_VERBOSE
--------------------------------------------------
Set the kbuild verbosity. Can be assigned same values as "V=...".
See make help for the full list.
Setting "V=..." takes precedence over KBUILD_VERBOSE.
KBUILD_EXTMOD
--------------------------------------------------
Set the directory to look for the kernel source when building external
modules.
The directory can be specified in several ways:
1) Use "M=..." on the command line
2) Environment variable KBUILD_EXTMOD
3) Environment variable SUBDIRS
The possibilities are listed in the order they take precedence.
Using "M=..." will always override the others.
寻找源代码时所设置的目录,按照优先顺序:
1)使用“M...”在命令行中
2)使用KBUILD_EXTMOD环境变量
3)使用SUBDIRS环境变量
KBUILD_OUTPUT
--------------------------------------------------
Specify the output directory when building the kernel.
The output directory can also be specified using "O=...".
Setting "O=..." takes precedence over KBUILD_OUTPUT.
建立输出目录,使用“O=...”命令,也可以使用KBUILD_OUTPUT环境变量,
但优先级没有前者高。
ARCH
--------------------------------------------------
Set ARCH to the architecture to be built.
In most cases the name of the architecture is the same as the
directory name found in the arch/ directory.
But some architectures such as x86 and sparc have aliases.
x86: i386 for 32 bit, x86_64 for 64 bit
sparc: sparc for 32 bit, sparc64 for 64 bit
设置机器目录。
CROSS_COMPILE
--------------------------------------------------
Specify an optional fixed part of the binutils filename.
CROSS_COMPILE can be a part of the filename or the full path.
CROSS_COMPILE is also used for ccache in some setups.
CF
--------------------------------------------------
Additional options for sparse.
CF is often used on the command-line like this:
make CF=-Wbitwise C=2
INSTALL_PATH
--------------------------------------------------
INSTALL_PATH specifies where to place the updated kernel and system map
images. Default is /boot, but you can set it to other values.
设置安装目录。
INSTALLKERNEL
--------------------------------------------------
Install script called when using "make install".
The default name is "installkernel".
The script will be called with the following arguments:
$1 - kernel version
$2 - kernel image file
$3 - kernel map file
$4 - default install path (use root directory if blank)
The implementation of "make install" is architecture specific
and it may differ from the above.
INSTALLKERNEL is provided to enable the possibility to
specify a custom installer when cross compiling a kernel.
设置安装内核时的脚本文件:
$1 - 内核版本
$2 - 内核映像
$3 - 内核符号表文件
$4 - 默认安装目录
MODLIB
--------------------------------------------------
Specify where to install modules.
The default value is:
$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
The value can be overridden in which case the default value is ignored.
设置模块安装目录。
INSTALL_MOD_PATH
--------------------------------------------------
INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
relocations required by build roots. This is not defined in the
makefile but the argument can be passed to make if needed.
MODLIB的前缀,用于模块安装的目录,makefile没有定义,如果需要可以通过make定义。
INSTALL_MOD_STRIP
--------------------------------------------------
INSTALL_MOD_STRIP, if defined, will cause modules to be
stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
the default option --strip-debug will be used. Otherwise,
INSTALL_MOD_STRIP will used as the options to the strip command.
如果变量定义了为1,那么默认选项“--strip-debug”就会使用。
INSTALL_FW_PATH
--------------------------------------------------
INSTALL_FW_PATH specifies where to install the firmware blobs.
The default value is:
$(INSTALL_MOD_PATH)/lib/firmware
The value can be overridden in which case the default value is ignored.
特指用来安装firmware模块的路径。
INSTALL_HDR_PATH
--------------------------------------------------
INSTALL_HDR_PATH specifies where to install user space headers when
executing "make headers_*".
The default value is:
$(objtree)/usr
$(objtree) is the directory where output files are saved.
The output directory is often set using "O=..." on the commandline.
The value can be overridden in which case the default value is ignored.
这个路径用来特指安装用户空间时的,使用“O=...”命令即可设置输出目录。
KBUILD_MODPOST_WARN
--------------------------------------------------
KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
symbols in the final module linking stage. It changes such errors
into warnings.
这个变量将在链接阶段避免没有定义的符号发生错误,它可以将error变成warning。
KBUILD_MODPOST_NOFINAL
--------------------------------------------------
KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
This is solely useful to speed up test compiles.
这个变量用来跳过链接模块,加速编译。
KBUILD_EXTRA_SYMBOLS
--------------------------------------------------
For modules that use symbols from other modules.
See more details in modules.txt.
使用另外的模块的符号,更多信息看“modules.txt”文件。
ALLSOURCE_ARCHS
--------------------------------------------------
For tags/TAGS/cscope targets, you can specify more than one arch
to be included in the databases, separated by blank space. E.g.:
$ make ALLSOURCE_ARCHS="x86 mips arm" tags
To get all available archs you can also specify all. E.g.:
$ make ALLSOURCE_ARCHS=all tags
看完了没,好像时kbuild的一些输出文件信息。什么时候会出现呢?内核配置完后,还是在编译阶段产生的,还是...不晓得。其实如果你在*目录下试试“make menuconfig”,即按照菜单方式配置内核,也就是README里面:
"make menuconfig" Text based color menus, radiolists & dialogs.
有颜色的文本菜单,按钮列表和对话框
呵 呵,记起来了吧,然后编辑后保存一下,在目录中使用“ls -a”,会发现有几个陌生人,有个文件“.config”,显然就是配置后生成的,看看“cat .config | more”,发现没有,变量名前面都会有CONFIG_,就是配置的意思,和上面kbuild.txt文件里面变量比较一下,说明这些输出文件不是内核配 置完后的,排除了一个,呵呵!万事开头难啊!
那么这些到底怎么来的,有什么用,估计现在没法知道啊!还得继续分析着走。。。