编译kernel前需要一个配置相关的编译选项,最终的配置文件就是kernel根目录路下的 .config 文件
VERSION = 3 PATCHLEVEL = 1 SUBLEVEL = 10 EXTRAVERSION =
%config: scripts_basic outputmakefile FORCE ./mpatch_gen.sh $(Q)mkdir -p include/linux include/config $(Q)$(MAKE) $(build)=scripts/kconfig $@
PHONY += FORCE FORCE:
# Basic helpers built in scripts/ PHONY += scripts_basic scripts_basic: $(Q)$(MAKE) $(build)=scripts/basic $(Q)rm -f .tmp_quiet_recordmcount
### # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= # Usage: # $(Q)$(MAKE) $(build)=dir build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
$(Q)$(MAKE) -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj=scripts/basic
src := $(obj)
# The filename Kbuild has precedence over Makefile kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) $(subdir-ym) $(always) @:
PHONY += outputmakefile # outputmakefile generates a Makefile in the output directory, if using a # separate output directory. This allows convenient use of make in the # output directory. outputmakefile: ifneq ($(KBUILD_SRC),) $(Q)ln -fsn $(srctree) source $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) endif
$(Q)$(MAKE) -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj =scripts/kconfig menuconfig
menuconfig: $(obj)/mconf @scripts/checkconfig/check-config.sh @echo "*** jscese test ‘$(Kconfig)‘" $< $(Kconfig)
# mconf: Used for the menuconfig target # Utilizes the lxdialog package
ifdef KBUILD_KCONFIG Kconfig := $(KBUILD_KCONFIG) else Kconfig := Kconfig
# # For a description of the syntax of this configuration file, # see Documentation/kbuild/kconfig-language.txt. # mainmenu "Linux/$ARCH $KERNELVERSION Kernel Configuration" config SRCARCH string option env="SRCARCH" source "arch/$SRCARCH/Kconfig"
target_ARM = $(shell cat .config | sed -n ‘/CONFIG_ARM=/p‘ | wc -l ) ifeq ($(target_ARM),1) SUBARCH = arm endif ARCH ?= $(SUBARCH) SRCARCH := $(ARCH)
原文:http://blog.csdn.net/jscese/article/details/25147245