Commit 51148790 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Tom Rini

kconfig: switch to Kconfig

This commit enables Kconfig.
Going forward, we use Kconfig for the board configuration.
mkconfig will never be used. Nor will include/config.mk be generated.

Kconfig must be adjusted for U-Boot because our situation is
a little more complicated than Linux Kernel.
We have to generate multiple boot images (Normal, SPL, TPL)
from one source tree.
Each image needs its own configuration input.

Usage:

Run "make <board>_defconfig" to do the board configuration.

It will create the .config file and additionally spl/.config, tpl/.config
if SPL, TPL is enabled, respectively.

You can use "make config", "make menuconfig" etc. to create
a new .config or modify the existing one.

Use "make spl/config", "make spl/menuconfig" etc. for spl/.config
and do likewise for tpl/.config file.

The generic syntax of configuration targets for SPL, TPL is:

  <target_image>/<config_command>

Here, <target_image> is either 'spl' or 'tpl'
      <config_command> is 'config', 'menuconfig', 'xconfig', etc.

When the configuration is done, run "make".
(Or "make <board>_defconfig all" will do the configuration and build
in one time.)

For futher information of how Kconfig works in U-Boot,
please read the comment block of scripts/multiconfig.py.

By the way, there is another item worth remarking here:
coexistence of Kconfig and board herder files.

Prior to Kconfig, we used C headers to define a set of configs.

We expect a very long term to migrate from C headers to Kconfig.
Two different infractructure must coexist in the interim.

In our former configuration scheme, include/autoconf.mk was generated
for use in makefiles.
It is still generated under include/, spl/include/, tpl/include/ directory
for the Normal, SPL, TPL image, respectively.
Signed-off-by: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: default avatarSimon Glass <sjg@chromium.org>
parent 4ce99570
...@@ -53,8 +53,6 @@ ...@@ -53,8 +53,6 @@
# #
/include/config/ /include/config/
/include/generated/ /include/generated/
/include/spl-autoconf.mk
/include/tpl-autoconf.mk
# stgit generated dirs # stgit generated dirs
patches-* patches-*
......
...@@ -166,9 +166,6 @@ VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) ...@@ -166,9 +166,6 @@ VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
export srctree objtree VPATH export srctree objtree VPATH
MKCONFIG := $(srctree)/mkconfig
export MKCONFIG
# Make sure CDPATH settings don't interfere # Make sure CDPATH settings don't interfere
unexport CDPATH unexport CDPATH
...@@ -189,9 +186,6 @@ HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \ ...@@ -189,9 +186,6 @@ HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
export HOSTARCH HOSTOS export HOSTARCH HOSTOS
# Deal with colliding definitions from tcsh etc.
VENDOR=
######################################################################### #########################################################################
# set default to nothing for native builds # set default to nothing for native builds
...@@ -199,6 +193,9 @@ ifeq ($(HOSTARCH),$(ARCH)) ...@@ -199,6 +193,9 @@ ifeq ($(HOSTARCH),$(ARCH))
CROSS_COMPILE ?= CROSS_COMPILE ?=
endif endif
KCONFIG_CONFIG ?= .config
export KCONFIG_CONFIG
# SHELL used by kbuild # SHELL used by kbuild
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \ else if [ -x /bin/bash ]; then echo /bin/bash; \
...@@ -341,6 +338,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy ...@@ -341,6 +338,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump OBJDUMP = $(CROSS_COMPILE)objdump
AWK = awk AWK = awk
PERL = perl PERL = perl
PYTHON = python
DTC = dtc DTC = dtc
CHECK = sparse CHECK = sparse
...@@ -362,7 +360,7 @@ export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION ...@@ -362,7 +360,7 @@ export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION
export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR
export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
export CPP AR NM LDR STRIP OBJCOPY OBJDUMP export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
export MAKE AWK PERL export MAKE AWK PERL PYTHON
export HOSTCXX HOSTCXXFLAGS DTC CHECK CHECKFLAGS export HOSTCXX HOSTCXXFLAGS DTC CHECK CHECKFLAGS
export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS LDFLAGS export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS LDFLAGS
...@@ -460,31 +458,49 @@ ifeq ($(config-targets),1) ...@@ -460,31 +458,49 @@ ifeq ($(config-targets),1)
# *config targets only - make sure prerequisites are updated, and descend # *config targets only - make sure prerequisites are updated, and descend
# in scripts/kconfig to make the *config target # in scripts/kconfig to make the *config target
# Read arch specific Makefile to set KBUILD_DEFCONFIG as needed. KBUILD_DEFCONFIG := sandbox_defconfig
# KBUILD_DEFCONFIG may point out an alternative default configuration export KBUILD_DEFCONFIG KBUILD_KCONFIG
# used for 'make defconfig'
%_config:: outputmakefile config: scripts_basic outputmakefile FORCE
@$(MKCONFIG) -A $(@:_config=) +$(Q)$(PYTHON) $(srctree)/scripts/multiconfig.py $@
%config: scripts_basic outputmakefile FORCE
+$(Q)$(PYTHON) $(srctree)/scripts/multiconfig.py $@
else else
# =========================================================================== # ===========================================================================
# Build targets only - this includes vmlinux, arch specific targets, clean # Build targets only - this includes vmlinux, arch specific targets, clean
# targets and others. In general all targets except *config targets. # targets and others. In general all targets except *config targets.
# load ARCH, BOARD, and CPU configuration
-include include/config.mk
ifeq ($(dot-config),1) ifeq ($(dot-config),1)
# Read in config # Read in config
-include include/config/auto.conf
# Read in dependencies to all Kconfig* files, make sure to run
# oldconfig if changes are detected.
-include include/config/auto.conf.cmd
# To avoid any implicit rule to kick in, define an empty command
$(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
# If .config is newer than include/config/auto.conf, someone tinkered
# with it and forgot to run make oldconfig.
# if auto.conf.cmd is missing then we are probably in a cleaned tree so
# we execute the config step to be sure to catch updated Kconfig files
include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
$(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
-include include/autoconf.mk -include include/autoconf.mk
-include include/autoconf.mk.dep -include include/autoconf.mk.dep
# load other configuration # We want to include arch/$(ARCH)/config.mk only when include/config/auto.conf
# is up-to-date. When we switch to a different board configuration, old CONFIG
# macros are still remaining in include/config/auto.conf. Without the following
# gimmick, wrong config.mk would be included leading nasty warnings/errors.
autoconf_is_current := $(if $(wildcard $(KCONFIG_CONFIG)),$(shell find . \
-path ./include/config/auto.conf -newer $(KCONFIG_CONFIG)))
ifneq ($(autoconf_is_current),)
include $(srctree)/config.mk include $(srctree)/config.mk
ifeq ($(wildcard include/config.mk),)
$(error "System not configured - see README")
endif endif
# If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
...@@ -513,8 +529,8 @@ ifndef LDSCRIPT ...@@ -513,8 +529,8 @@ ifndef LDSCRIPT
endif endif
else else
# Dummy target needed, because used as prerequisite
include/config/auto.conf: ;
endif # $(dot-config) endif # $(dot-config)
KBUILD_CFLAGS += -Os #-fomit-frame-pointer KBUILD_CFLAGS += -Os #-fomit-frame-pointer
...@@ -563,7 +579,8 @@ KBUILD_CFLAGS += $(KCFLAGS) ...@@ -563,7 +579,8 @@ KBUILD_CFLAGS += $(KCFLAGS)
UBOOTINCLUDE := \ UBOOTINCLUDE := \
-Iinclude \ -Iinclude \
$(if $(KBUILD_SRC), -I$(srctree)/include) \ $(if $(KBUILD_SRC), -I$(srctree)/include) \
-I$(srctree)/arch/$(ARCH)/include -I$(srctree)/arch/$(ARCH)/include \
-include $(srctree)/include/linux/kconfig.h
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
CHECKFLAGS += $(NOSTDINC_FLAGS) CHECKFLAGS += $(NOSTDINC_FLAGS)
...@@ -1024,7 +1041,7 @@ define filechk_uboot.release ...@@ -1024,7 +1041,7 @@ define filechk_uboot.release
endef endef
# Store (new) UBOOTRELEASE string in include/config/uboot.release # Store (new) UBOOTRELEASE string in include/config/uboot.release
include/config/uboot.release: Makefile FORCE include/config/uboot.release: include/config/auto.conf FORCE
$(call filechk,uboot.release) $(call filechk,uboot.release)
...@@ -1042,8 +1059,8 @@ PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 ...@@ -1042,8 +1059,8 @@ PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
# 1) Check that make has not been executed in the kernel src $(srctree) # 1) Check that make has not been executed in the kernel src $(srctree)
prepare3: include/config/uboot.release prepare3: include/config/uboot.release
ifneq ($(KBUILD_SRC),) ifneq ($(KBUILD_SRC),)
@$(kecho) ' Using $(srctree) as source for u-boot' @$(kecho) ' Using $(srctree) as source for U-Boot'
$(Q)if [ -f $(srctree)/include/config.mk ]; then \ $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \
echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \ echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \
echo >&2 " in the '$(srctree)' directory.";\ echo >&2 " in the '$(srctree)' directory.";\
/bin/false; \ /bin/false; \
...@@ -1053,7 +1070,8 @@ endif ...@@ -1053,7 +1070,8 @@ endif
# prepare2 creates a makefile if using a separate output directory # prepare2 creates a makefile if using a separate output directory
prepare2: prepare3 outputmakefile prepare2: prepare3 outputmakefile
prepare1: prepare2 $(version_h) $(timestamp_h) prepare1: prepare2 $(version_h) $(timestamp_h) \
include/config/auto.conf
ifeq ($(__HAVE_ARCH_GENERIC_BOARD),) ifeq ($(__HAVE_ARCH_GENERIC_BOARD),)
ifeq ($(CONFIG_SYS_GENERIC_BOARD),y) ifeq ($(CONFIG_SYS_GENERIC_BOARD),y)
@echo >&2 " Your architecture does not support generic board." @echo >&2 " Your architecture does not support generic board."
...@@ -1095,29 +1113,6 @@ $(version_h): include/config/uboot.release FORCE ...@@ -1095,29 +1113,6 @@ $(version_h): include/config/uboot.release FORCE
$(timestamp_h): $(srctree)/Makefile FORCE $(timestamp_h): $(srctree)/Makefile FORCE
$(call filechk,timestamp.h) $(call filechk,timestamp.h)
#
# Auto-generate the autoconf.mk file (which is included by all makefiles)
#
# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
# the dep file is only include in this top level makefile to determine when
# to regenerate the autoconf.mk file.
quiet_cmd_autoconf_dep = GEN $@
cmd_autoconf_dep = $(CC) -x c -DDO_DEPS_ONLY -M $(c_flags) \
-MQ include/autoconf.mk $(srctree)/include/common.h > $@ || rm $@
include/autoconf.mk.dep: include/config.h include/common.h
$(call cmd,autoconf_dep)
quiet_cmd_autoconf = GEN $@
cmd_autoconf = \
$(CPP) $(c_flags) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
rm $@.tmp
include/autoconf.mk: include/config.h
$(call cmd,autoconf)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
PHONY += depend dep PHONY += depend dep
...@@ -1141,7 +1136,7 @@ spl/sunxi-spl.bin: spl/u-boot-spl ...@@ -1141,7 +1136,7 @@ spl/sunxi-spl.bin: spl/u-boot-spl
@: @:
tpl/u-boot-tpl.bin: tools prepare tpl/u-boot-tpl.bin: tools prepare
$(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all CONFIG_TPL_BUILD=y $(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all
TAG_SUBDIRS := $(patsubst %,$(srctree)/%,$(u-boot-dirs) include) TAG_SUBDIRS := $(patsubst %,$(srctree)/%,$(u-boot-dirs) include)
...@@ -1216,20 +1211,18 @@ include/license.h: tools/bin2header COPYING ...@@ -1216,20 +1211,18 @@ include/license.h: tools/bin2header COPYING
# Directories & files removed with 'make clean' # Directories & files removed with 'make clean'
CLEAN_DIRS += $(MODVERDIR) CLEAN_DIRS += $(MODVERDIR)
CLEAN_FILES += u-boot.lds include/bmp_logo.h include/bmp_logo_data.h \ CLEAN_FILES += u-boot.lds include/bmp_logo.h include/bmp_logo_data.h
include/autoconf.mk* include/spl-autoconf.mk \
include/tpl-autoconf.mk
# Directories & files removed with 'make clobber' # Directories & files removed with 'make clobber'
CLOBBER_DIRS += spl tpl CLOBBER_DIRS += $(foreach d, spl tpl, $(patsubst %,$d/%, \
$(filter-out include, $(shell ls -1 $d 2>/dev/null))))
CLOBBER_FILES += u-boot* MLO* SPL System.map CLOBBER_FILES += u-boot* MLO* SPL System.map
# Directories & files removed with 'make mrproper' # Directories & files removed with 'make mrproper'
MRPROPER_DIRS += include/config include/generated \ MRPROPER_DIRS += include/config include/generated spl tpl \
.tmp_objdiff .tmp_objdiff
MRPROPER_FILES += .config .config.old \ MRPROPER_FILES += .config .config.old include/autoconf.mk* include/config.h \
ctags etags cscope* GPATH GTAGS GRTAGS GSYMS \ ctags etags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
include/config.h include/config.mk
# clean - Delete most, but leave enough to build external modules # clean - Delete most, but leave enough to build external modules
# #
...@@ -1306,10 +1299,9 @@ help: ...@@ -1306,10 +1299,9 @@ help:
@echo ' mrproper - Remove all generated files + config + various backup files' @echo ' mrproper - Remove all generated files + config + various backup files'
@echo ' distclean - mrproper + remove editor backup and patch files' @echo ' distclean - mrproper + remove editor backup and patch files'
@echo '' @echo ''
# uncomment after adding Kconfig feature @echo 'Configuration targets:'
# @echo 'Configuration targets:' @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
# @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help @echo ''
# @echo ''
@echo 'Other generic targets:' @echo 'Other generic targets:'
@echo ' all - Build all necessary images depending on configuration' @echo ' all - Build all necessary images depending on configuration'
@echo ' u-boot - Build the bare u-boot' @echo ' u-boot - Build the bare u-boot'
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
# SPDX-License-Identifier: GPL-2.0+ # SPDX-License-Identifier: GPL-2.0+
# #
cfg=$(shell grep configs $(objtree)/include/config.h | sed 's/.*<\(configs.*\)>/\1/') cfg=$(srctree)/include/configs/$(CONFIG_SYS_CONFIG_NAME:"%"=%).h
is5208:=$(shell grep CONFIG_M5208 $(srctree)/include/$(cfg)) is5208:=$(shell grep CONFIG_M5208 $(cfg))
is5249:=$(shell grep CONFIG_M5249 $(srctree)/include/$(cfg)) is5249:=$(shell grep CONFIG_M5249 $(cfg))
is5253:=$(shell grep CONFIG_M5253 $(srctree)/include/$(cfg)) is5253:=$(shell grep CONFIG_M5253 $(cfg))
is5271:=$(shell grep CONFIG_M5271 $(srctree)/include/$(cfg)) is5271:=$(shell grep CONFIG_M5271 $(cfg))
is5272:=$(shell grep CONFIG_M5272 $(srctree)/include/$(cfg)) is5272:=$(shell grep CONFIG_M5272 $(cfg))
is5275:=$(shell grep CONFIG_M5275 $(srctree)/include/$(cfg)) is5275:=$(shell grep CONFIG_M5275 $(cfg))
is5282:=$(shell grep CONFIG_M5282 $(srctree)/include/$(cfg)) is5282:=$(shell grep CONFIG_M5282 $(cfg))
ifneq (,$(findstring CONFIG_M5208,$(is5208))) ifneq (,$(findstring CONFIG_M5208,$(is5208)))
PLATFORM_CPPFLAGS += -mcpu=5208 PLATFORM_CPPFLAGS += -mcpu=5208
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
# SPDX-License-Identifier: GPL-2.0+ # SPDX-License-Identifier: GPL-2.0+
# #
cfg=$(shell grep configs $(objtree)/include/config.h | sed 's/.*<\(configs.*\)>/\1/') cfg=$(srctree)/include/configs/$(CONFIG_SYS_CONFIG_NAME:"%"=%).h
is5301x:=$(shell grep CONFIG_MCF5301x $(srctree)/include/$(cfg)) is5301x:=$(shell grep CONFIG_MCF5301x $(cfg))
is532x:=$(shell grep CONFIG_MCF532x $(srctree)/include/$(cfg)) is532x:=$(shell grep CONFIG_MCF532x $(cfg))
ifneq (,$(findstring CONFIG_MCF5301x,$(is5301x))) ifneq (,$(findstring CONFIG_MCF5301x,$(is5301x)))
PLATFORM_CPPFLAGS += -mcpu=53015 -fPIC PLATFORM_CPPFLAGS += -mcpu=53015 -fPIC
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
# SPDX-License-Identifier: GPL-2.0+ # SPDX-License-Identifier: GPL-2.0+
# #
cfg=$(shell grep configs $(objtree)/include/config.h | sed 's/.*<\(configs.*\)>/\1/') cfg=$(srctree)/include/configs/$(CONFIG_SYS_CONFIG_NAME:"%"=%).h
is5441x:=$(shell grep CONFIG_MCF5441x $(srctree)/include/$(cfg)) is5441x:=$(shell grep CONFIG_MCF5441x $(cfg))
ifneq (,$(findstring CONFIG_MCF5441x,$(is5441x))) ifneq (,$(findstring CONFIG_MCF5441x,$(is5441x)))
PLATFORM_CPPFLAGS += -mcpu=54418 -fPIC PLATFORM_CPPFLAGS += -mcpu=54418 -fPIC
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
PLATFORM_CPPFLAGS += -DCONFIG_4xx -mstring -msoft-float PLATFORM_CPPFLAGS += -DCONFIG_4xx -mstring -msoft-float
cfg=$(shell grep configs $(objtree)/include/config.h | sed 's/.*<\(configs.*\)>/\1/') cfg=$(srctree)/include/configs/$(CONFIG_SYS_CONFIG_NAME:"%"=%).h
is440:=$(shell grep CONFIG_440 $(srctree)/include/$(cfg)) is440:=$(shell grep CONFIG_440 $(cfg))
ifneq (,$(findstring CONFIG_440,$(is440))) ifneq (,$(findstring CONFIG_440,$(is440)))
PLATFORM_CPPFLAGS += -Wa,-m440 -mcpu=440 PLATFORM_CPPFLAGS += -Wa,-m440 -mcpu=440
......
...@@ -20,6 +20,16 @@ LDFLAGS_FINAL := ...@@ -20,6 +20,16 @@ LDFLAGS_FINAL :=
OBJCOPYFLAGS := OBJCOPYFLAGS :=
######################################################################### #########################################################################
ARCH := $(CONFIG_SYS_ARCH:"%"=%)
CPU := $(CONFIG_SYS_CPU:"%"=%)
BOARD := $(CONFIG_SYS_BOARD:"%"=%)
ifneq ($(CONFIG_SYS_VENDOR),)
VENDOR := $(CONFIG_SYS_VENDOR:"%"=%)
endif
ifneq ($(CONFIG_SYS_SOC),)
SOC := $(CONFIG_SYS_SOC:"%"=%)
endif
# Some architecture config.mk files need to know what CPUDIR is set to, # Some architecture config.mk files need to know what CPUDIR is set to,
# so calculate CPUDIR before including ARCH/SOC/CPU config.mk files. # so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains # Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
......
...@@ -2,4 +2,3 @@ ...@@ -2,4 +2,3 @@
/bmp_logo.h /bmp_logo.h
/bmp_logo_data.h /bmp_logo_data.h
/config.h /config.h
/config.mk
...@@ -13,4 +13,4 @@ build_docproc: $(obj)/docproc ...@@ -13,4 +13,4 @@ build_docproc: $(obj)/docproc
@: @:
# Let clean descend into subdirs # Let clean descend into subdirs
subdir- += basic subdir- += basic kconfig
# This helper makefile is used for creating
# - symbolic links (arch/$ARCH/include/asm/arch
# - include/autoconf.mk, {spl,tpl}/include/autoconf.mk
# - include/config.h
#
# When our migration to Kconfig is done
# (= When we move all CONFIGs from header files to Kconfig)
# this makefile can be deleted.
# obj is "include" or "spl/include" or "tpl/include"
# for non-SPL, SPL, TPL, respectively
include $(obj)/config/auto.conf
include scripts/Kbuild.include
# Need to define CC and CPP again here in case the top Makefile did not
# include config.mk. Some architectures expect CROSS_COMPILE to be defined
# in arch/$(ARCH)/config.mk
CC = $(CROSS_COMPILE)gcc
CPP = $(CC) -E
include config.mk
UBOOTINCLUDE := \
-I$(obj) \
-Iinclude \
$(if $(KBUILD_SRC), -I$(srctree)/include) \
-I$(srctree)/arch/$(ARCH)/include \
-include $(srctree)/include/linux/kconfig.h
c_flags := $(KBUILD_CFLAGS) $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) \
$(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
quiet_cmd_autoconf_dep = GEN $@
cmd_autoconf_dep = $(CC) -x c -DDO_DEPS_ONLY -M -MP $(c_flags) \
-MQ include/config/auto.conf $(srctree)/include/common.h > $@ || { \
rm $@; false; \
}
include/autoconf.mk.dep: FORCE
$(call cmd,autoconf_dep)
# We are migrating from board headers to Kconfig little by little.
# In the interim, we use both of
# - include/config/auto.conf (generated by Kconfig)
# - include/autoconf.mk (used in the U-Boot conventional configuration)
# The following rule creates autoconf.mk
# include/config/auto.conf is grepped in order to avoid duplication of the
# same CONFIG macros
quiet_cmd_autoconf = GEN $@
cmd_autoconf = \
$(CPP) $(c_flags) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && { \
sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp | \
while read line; do \
if ! grep -q "$${line%=*}=" $(obj)/config/auto.conf; then \
echo "$$line"; \
fi \
done > $@; \
rm $@.tmp; \
} || { \
rm $@.tmp; false; \
}
$(obj)/autoconf.mk: FORCE
$(call cmd,autoconf)
include/autoconf.mk include/autoconf.mk.dep: include/config.h
# include/config.h
# Prior to Kconfig, it was generated by mkconfig. Now it is created here.
define filechk_config_h
(echo "/* Automatically generated - do not edit */"; \
for i in $$(echo $(CONFIG_SYS_EXTRA_OPTIONS) | sed 's/,/ /g'); do \
echo \#define CONFIG_$$i \
| sed '/=/ {s/=/ /;q; } ; { s/$$/ 1/; }'; \
done; \
echo \#define CONFIG_BOARDDIR board/$(if $(VENDOR),$(VENDOR)/)$(BOARD);\
echo \#include \<config_cmd_defaults.h\>; \
echo \#include \<config_defaults.h\>; \
echo \#include \<configs/$(CONFIG_SYS_CONFIG_NAME).h\>; \
echo \#include \<asm/config.h\>; \
echo \#include \<config_fallbacks.h\>; \
echo \#include \<config_uncmd_spl.h\>; )
endef
include/config.h: scripts/Makefile.autoconf create_symlink FORCE
$(call filechk,config_h)
# symbolic links
PHONY += create_symlink
create_symlink:
ifneq ($(KBUILD_SRC),)
$(Q)mkdir -p include/asm
endif
$(Q)ln -fsn $(srctree)/arch/$(ARCH)/include/asm/arch-$(if $(SOC),$(SOC),$(CPU)) \
$(if $(KBUILD_SRC),,arch/$(ARCH)/)include/asm/arch
PHONY += FORCE
FORCE:
.PHONY: $(PHONY)
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
# ========================================================================== # ==========================================================================
# Modified for U-Boot # Modified for U-Boot
ifeq ($(CONFIG_TPL_BUILD),y) prefix := tpl
src := $(patsubst tpl/%,%,$(obj)) src := $(patsubst $(prefix)/%,%,$(obj))
else ifeq ($(obj),$(src))
ifeq ($(CONFIG_SPL_BUILD),y) prefix := spl
src := $(patsubst spl/%,%,$(obj)) src := $(patsubst $(prefix)/%,%,$(obj))
else ifeq ($(obj),$(src))
src := $(obj) prefix := .
endif endif
endif endif
PHONY := __build PHONY := __build
...@@ -40,18 +40,9 @@ subdir-asflags-y := ...@@ -40,18 +40,9 @@ subdir-asflags-y :=
subdir-ccflags-y := subdir-ccflags-y :=
# Read auto.conf if it exists, otherwise ignore # Read auto.conf if it exists, otherwise ignore
-include include/config/auto.conf # Modified for U-Boot
-include $(prefix)/include/config/auto.conf
# Added for U-Boot: Load U-Boot configuration -include $(prefix)/include/autoconf.mk
ifeq ($(CONFIG_TPL_BUILD),y)
-include include/tpl-autoconf.mk
else
ifeq ($(CONFIG_SPL_BUILD),y)
-include include/spl-autoconf.mk
else
-include include/autoconf.mk
endif
endif
include scripts/Kbuild.include include scripts/Kbuild.include
......
...@@ -21,13 +21,10 @@ _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) ...@@ -21,13 +21,10 @@ _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
include $(srctree)/scripts/Kbuild.include include $(srctree)/scripts/Kbuild.include
CONFIG_SPL_BUILD := y UBOOTINCLUDE := -I$(obj)/include $(UBOOTINCLUDE)
export CONFIG_SPL_BUILD
KBUILD_CPPFLAGS += -DCONFIG_SPL_BUILD -include $(obj)/include/config/auto.conf
ifeq ($(CONFIG_TPL_BUILD),y) -include $(obj)/include/autoconf.mk
KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD
endif
ifeq ($(CONFIG_TPL_BUILD),y) ifeq ($(CONFIG_TPL_BUILD),y)
export CONFIG_TPL_BUILD export CONFIG_TPL_BUILD
...@@ -36,14 +33,6 @@ else ...@@ -36,14 +33,6 @@ else
SPL_BIN := u-boot-spl SPL_BIN := u-boot-spl
endif endif
include include/config.mk
ifeq ($(CONFIG_TPL_BUILD),y)
-include include/tpl-autoconf.mk
else
-include include/spl-autoconf.mk
endif
include $(srctree)/config.mk include $(srctree)/config.mk
# Enable garbage collection of un-used sections for SPL # Enable garbage collection of un-used sections for SPL
...@@ -53,20 +42,6 @@ LDFLAGS_FINAL += --gc-sections ...@@ -53,20 +42,6 @@ LDFLAGS_FINAL += --gc-sections
# FIX ME # FIX ME
cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \ cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \
$(NOSTDINC_FLAGS) $(NOSTDINC_FLAGS)
c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
# Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL)
quiet_cmd_autoconf = GEN $@
cmd_autoconf = \
$(CPP) $(c_flags) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
rm $@.tmp
include/tpl-autoconf.mk: include/config.h
$(call cmd,autoconf)
include/spl-autoconf.mk: include/config.h
$(call cmd,autoconf)
HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n) HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
......
...@@ -221,7 +221,11 @@ static void use_config(const char *m, int slen) ...@@ -221,7 +221,11 @@ static void use_config(const char *m, int slen)
define_config(m, slen, hash); define_config(m, slen, hash);
printf(" $(wildcard include/config/"); /* printf(" $(wildcard include/config/"); */
/* modified for U-Boot */
printf(" $(wildcard %sinclude/config/",
strncmp(depfile, "spl/", 4) ?
(strncmp(depfile, "tpl/", 4) ? "" : "tpl/") : "spl/");
for (i = 0; i < slen; i++) { for (i = 0; i < slen; i++) {
c = m[i]; c = m[i];
if (c == '_') if (c == '_')
......
...@@ -951,6 +951,14 @@ int conf_write_autoconf(void) ...@@ -951,6 +951,14 @@ int conf_write_autoconf(void)
FILE *out, *tristate, *out_h; FILE *out, *tristate, *out_h;
int i; int i;
/*
* Added for U-Boot SPL/TPL
*/
name = getenv("KCONFIG_OBJDIR");
if (name && name[0])
if (chdir(name))
return 1;
sym_clear_all_valid(); sym_clear_all_valid();
file_write_dep("include/config/auto.conf.cmd"); file_write_dep("include/config/auto.conf.cmd");
......
This diff is collapsed.
...@@ -193,7 +193,7 @@ endif # !LOGO_BMP ...@@ -193,7 +193,7 @@ endif # !LOGO_BMP
# Define _GNU_SOURCE to obtain the getline prototype from stdio.h # Define _GNU_SOURCE to obtain the getline prototype from stdio.h
# #
HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \ HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \
$(patsubst -I%,-idirafter%, $(UBOOTINCLUDE)) \ $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
-I$(srctree)/lib/libfdt \ -I$(srctree)/lib/libfdt \
-I$(srctree)/tools \ -I$(srctree)/tools \
-DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) \ -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) \
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
HOSTCC = $(CC) HOSTCC = $(CC)
# Compile for a hosted environment on the target # Compile for a hosted environment on the target
HOST_EXTRACFLAGS = $(patsubst -I%,-idirafter%, $(UBOOTINCLUDE)) \ HOST_EXTRACFLAGS = $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
-idirafter $(srctree)/tools/env \ -idirafter $(srctree)/tools/env \
-DUSE_HOSTCC \ -DUSE_HOSTCC \
-DTEXT_BASE=$(TEXT_BASE) -DTEXT_BASE=$(TEXT_BASE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment