编译xxxx_defconfig
在顶层Makefile中,有如下规则编译xxxx_defconfig。这和编译menuconfig的过程是一样的,请参考u-boot-2014.10编译menuconfig
<span style="font-family:Microsoft YaHei;">%config: scripts_basic outputmakefile FORCE +$(Q)$(CONFIG_SHELL) $(srctree)/scripts/multiconfig.sh $@</span>在3个依赖编译完成后,会调用scripts/multiconfig.sh,参数为xxxx_defconfig。multiconfig.sh会调用do_board_defconfig --> run_make_config --> build
在build中会引入scripts/kconfig/Makefile,有如下规则:
这里要注意,我们送给顶层Makefile的目标是xxxx_defconfig,而在multiconfig.sh中,送给scripts/kconfig/Makefile的目标是.tmp_defconfig。为了编译xxxx_defconfig,我们调用了multiconfig.sh,而实际上,最终的输出时.tmp_defconfig --> .config,并没有真正生成xxxx_defconfig。上面的规则最终会输出这样的指令:<span style="font-family:Microsoft YaHei;">%_defconfig: $(obj)/conf $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)</span>scripts/kconfig/conf --defconfig=arch/../configs/.tmp_defconfig Kconfig
我没有去读conf.c的源码,只是看了它的简单描述。
" --defconfig <file> New config with default defined in <file>\n"
本文深入解读了U-Boot在编译过程中如何使用defconfig配置文件进行自定义设置,以及编译流程中关键步骤的执行顺序。通过分析顶层Makefile和scripts/multiconfig.sh脚本,揭示了如何从xxxx_defconfig生成最终的.config文件,从而实现灵活且高效的内核定制。
797

被折叠的 条评论
为什么被折叠?



