summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.autoconf55
-rw-r--r--scripts/Makefile.build3
-rw-r--r--scripts/Makefile.spl12
-rw-r--r--scripts/Makefile.uncmd_spl18
-rwxr-xr-xscripts/multiconfig.sh261
5 files changed, 74 insertions, 275 deletions
diff --git a/scripts/Makefile.autoconf b/scripts/Makefile.autoconf
index 8e9d71f..f054081 100644
--- a/scripts/Makefile.autoconf
+++ b/scripts/Makefile.autoconf
@@ -7,9 +7,17 @@
# (= 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
+__all: include/autoconf.mk include/autoconf.mk.dep
+
+ifeq ($(shell grep -q '^CONFIG_SPL=y' include/config/auto.conf 2>/dev/null && echo y),y)
+__all: spl/include/autoconf.mk
+endif
+
+ifeq ($(shell grep -q '^CONFIG_TPL=y' include/config/auto.conf 2>/dev/null && echo y),y)
+__all: tpl/include/autoconf.mk
+endif
+
+include include/config/auto.conf
include scripts/Kbuild.include
@@ -22,7 +30,6 @@ CPP = $(CC) -E
include config.mk
UBOOTINCLUDE := \
- -I$(obj) \
-Iinclude \
$(if $(KBUILD_SRC), -I$(srctree)/include) \
-I$(srctree)/arch/$(ARCH)/include \
@@ -48,10 +55,10 @@ include/autoconf.mk.dep: FORCE
# same CONFIG macros
quiet_cmd_autoconf = GEN $@
cmd_autoconf = \
- $(CPP) $(c_flags) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && { \
+ $(CPP) $(c_flags) $2 -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 \
+ if ! grep -q "$${line%=*}=" include/config/auto.conf; then \
echo "$$line"; \
fi \
done > $@; \
@@ -60,10 +67,19 @@ quiet_cmd_autoconf = GEN $@
rm $@.tmp; false; \
}
-$(obj)/autoconf.mk: FORCE
+include/autoconf.mk: FORCE
$(call cmd,autoconf)
-include/autoconf.mk include/autoconf.mk.dep: include/config.h
+spl/include/autoconf.mk: FORCE
+ $(Q)mkdir -p $(dir $@)
+ $(call cmd,autoconf,-DCONFIG_SPL_BUILD)
+
+tpl/include/autoconf.mk: FORCE
+ $(Q)mkdir -p $(dir $@)
+ $(call cmd,autoconf,-DCONFIG_SPL_BUILD -DCONFIG_TPL_BUILD)
+
+include/autoconf.mk include/autoconf.mk.dep \
+ spl/include/autoconf.mk tpl/include/autoconf.mk: include/config.h
# include/config.h
# Prior to Kconfig, it was generated by mkconfig. Now it is created here.
@@ -75,25 +91,36 @@ define filechk_config_h
done; \
echo \#define CONFIG_BOARDDIR board/$(if $(VENDOR),$(VENDOR)/)$(BOARD);\
echo \#include \<config_defaults.h\>; \
+ echo \#include \<config_uncmd_spl.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\>; )
+ echo \#include \<config_fallbacks.h\>;)
endef
include/config.h: scripts/Makefile.autoconf create_symlink FORCE
$(call filechk,config_h)
# symbolic links
+# If arch/$(ARCH)/mach-$(SOC)/include/mach exists,
+# make a symbolic link to that directory.
+# Otherwise, create a symbolic link to arch/$(ARCH)/include/asm/arch-$(SOC).
PHONY += create_symlink
create_symlink:
ifneq ($(KBUILD_SRC),)
$(Q)mkdir -p include/asm
- $(Q)ln -fsn $(KBUILD_SRC)/arch/$(ARCH)/include/asm/arch-$(if $(SOC),$(SOC),$(CPU)) \
- include/asm/arch
+ $(Q)if [ -d $(KBUILD_SRC)/arch/$(ARCH)/mach-$(SOC)/include/mach ]; then \
+ dest=arch/$(ARCH)/mach-$(SOC)/include/mach; \
+ else \
+ dest=arch/$(ARCH)/include/asm/arch-$(if $(SOC),$(SOC),$(CPU)); \
+ fi; \
+ ln -fsn $(KBUILD_SRC)/$$dest include/asm/arch
else
- $(Q)ln -fsn arch-$(if $(SOC),$(SOC),$(CPU)) \
- arch/$(ARCH)/include/asm/arch
+ $(Q)if [ -d arch/$(ARCH)/mach-$(SOC)/include/mach ]; then \
+ dest=../../mach-$(SOC)/include/mach; \
+ else \
+ dest=arch-$(if $(SOC),$(SOC),$(CPU)); \
+ fi; \
+ ln -fsn $$dest arch/$(ARCH)/include/asm/arch
endif
PHONY += FORCE
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 14cf092..ac0554e 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -41,8 +41,9 @@ subdir-ccflags-y :=
# Read auto.conf if it exists, otherwise ignore
# Modified for U-Boot
--include $(prefix)/include/config/auto.conf
+-include include/config/auto.conf
-include $(prefix)/include/autoconf.mk
+include scripts/Makefile.uncmd_spl
include scripts/Kbuild.include
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index e4b9881..fcacb7f 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -21,13 +21,15 @@ _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
include $(srctree)/scripts/Kbuild.include
-UBOOTINCLUDE := -I$(obj)/include $(UBOOTINCLUDE)
-
--include $(obj)/include/config/auto.conf
+-include include/config/auto.conf
-include $(obj)/include/autoconf.mk
+KBUILD_CPPFLAGS += -DCONFIG_SPL_BUILD
+ifeq ($(CONFIG_TPL_BUILD),y)
+KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD
+endif
+
ifeq ($(CONFIG_TPL_BUILD),y)
-export CONFIG_TPL_BUILD
SPL_BIN := u-boot-tpl
else
SPL_BIN := u-boot-spl
@@ -154,10 +156,8 @@ ALL-y += $(obj)/$(BOARD)-spl.bin
endif
ifdef CONFIG_SUNXI
-ifndef CONFIG_SPL_FEL
ALL-y += $(obj)/sunxi-spl.bin
endif
-endif
ifeq ($(CONFIG_SYS_SOC),"at91")
ALL-y += boot.bin
diff --git a/scripts/Makefile.uncmd_spl b/scripts/Makefile.uncmd_spl
new file mode 100644
index 0000000..343c3fc
--- /dev/null
+++ b/scripts/Makefile.uncmd_spl
@@ -0,0 +1,18 @@
+# Makefile version of include/config_uncmd_spl.h
+#
+# TODO: Invent a better way
+
+ifdef CONFIG_SPL_BUILD
+CONFIG_OF_CONTROL=
+
+ifndef CONFIG_SPL_DM
+CONFIG_DM_SERIAL=
+CONFIG_DM_GPIO=
+CONIFG_DM_I2C=
+CONFIG_DM_SPI=
+CONFIG_DM_SPI_FLASH=
+endif
+
+CONFIG_DM_DEVICE_REMOVE=
+
+endif
diff --git a/scripts/multiconfig.sh b/scripts/multiconfig.sh
index 366e8fa..cc8a787 100755
--- a/scripts/multiconfig.sh
+++ b/scripts/multiconfig.sh
@@ -2,11 +2,7 @@
#
# A wrapper script to adjust Kconfig for U-Boot
#
-# Instead of touching various parts under the scripts/kconfig/ directory,
-# pushing necessary adjustments into this single script would be better
-# for code maintainance. All the make targets related to the configuration
-# (make %config) should be invoked via this script.
-# See doc/README.kconfig for further information of Kconfig.
+# This file will be removed after cleaning up defconfig files
#
# Copyright (C) 2014, Masahiro Yamada <yamada.m@jp.panasonic.com>
#
@@ -15,77 +11,23 @@
set -e
-# Set "DEBUG" enavironment variable to show debug messages
-debug () {
- if [ $DEBUG ]; then
- echo "$@"
- fi
-}
-
-# Useful shorthands
-build () {
- debug $progname: $MAKE -f $srctree/scripts/Makefile.build obj="$@"
- $MAKE -f $srctree/scripts/Makefile.build obj="$@"
-}
-
-autoconf () {
- debug $progname: $MAKE -f $srctree/scripts/Makefile.autoconf obj="$@"
- $MAKE -f $srctree/scripts/Makefile.autoconf obj="$@"
-}
-
# Make a configuration target
# Usage:
# run_make_config <target> <objdir>
# <target>: Make target such as "config", "menuconfig", "defconfig", etc.
-# <objdir>: Target directory where the make command is run.
-# Typically "", "spl", "tpl" for Normal, SPL, TPL, respectively.
run_make_config () {
- target=$1
- objdir=$2
-
# Linux expects defconfig files in arch/$(SRCARCH)/configs/ directory,
# but U-Boot has them in configs/ directory.
# Give SRCARCH=.. to fake scripts/kconfig/Makefile.
- options="SRCARCH=.. KCONFIG_OBJDIR=$objdir"
- if [ "$objdir" ]; then
- options="$options KCONFIG_CONFIG=$objdir/$KCONFIG_CONFIG"
- mkdir -p $objdir
- fi
-
- build scripts/kconfig $options $target
-}
-
-# Parse .config file to detect if CONFIG_SPL, CONFIG_TPL is enabled
-# and returns:
-# "" if neither CONFIG_SPL nor CONFIG_TPL is defined
-# "spl" if CONFIG_SPL is defined but CONFIG_TPL is not
-# "spl tpl" if both CONFIG_SPL and CONFIG_TPL are defined
-get_enabled_subimages() {
- if [ ! -r "$KCONFIG_CONFIG" ]; then
- # This should never happen
- echo "$progname: $KCONFIG_CONFIG not found" >&2
- exit 1
- fi
-
- # CONFIG_SPL=y -> spl
- # CONFIG_TPL=y -> tpl
- sed -n -e 's/^CONFIG_SPL=y$/spl/p' -e 's/^CONFIG_TPL=y$/tpl/p' \
- $KCONFIG_CONFIG
+ $MAKE -f $srctree/scripts/Makefile.build obj=scripts/kconfig SRCARCH=.. $1
}
do_silentoldconfig () {
run_make_config silentoldconfig
- subimages=$(get_enabled_subimages)
-
- for obj in $subimages
- do
- mkdir -p $obj/include/config $obj/include/generated
- run_make_config silentoldconfig $obj
- done
# If the following part fails, include/config/auto.conf should be
# deleted so "make silentoldconfig" will be re-run on the next build.
- autoconf include include/autoconf.mk include/autoconf.mk.dep || {
+ $MAKE -f $srctree/scripts/Makefile.autoconf || {
rm -f include/config/auto.conf
exit 1
}
@@ -95,14 +37,6 @@ do_silentoldconfig () {
# than include/config.h.
# Otherwise, 'make silentoldconfig' would be invoked twice.
touch include/config/auto.conf
-
- for obj in $subimages
- do
- autoconf $obj/include $obj/include/autoconf.mk || {
- rm -f include/config/auto.conf
- exit 1
- }
- done
}
cleanup_after_defconfig () {
@@ -116,7 +50,6 @@ cleanup_after_defconfig () {
# do_board_defconfig <board>_defconfig
do_board_defconfig () {
defconfig_path=$srctree/configs/$1
- tmp_defconfig_path=configs/.tmp_defconfig
if [ ! -r $defconfig_path ]; then
echo >&2 "***"
@@ -126,42 +59,17 @@ do_board_defconfig () {
fi
mkdir -p arch configs
- # defconfig for Normal:
- # pick lines without prefixes and lines starting '+' prefix
- # and rip the prefixes off.
- sed -n -e '/^[+A-Z]*:/!p' -e 's/^+[A-Z]*://p' $defconfig_path \
- > configs/.tmp_defconfig
+ # prefix "*:" is deprecated. Drop it simply.
+ sed -e 's/^[+A-Z]*://' $defconfig_path > configs/.tmp_defconfig
run_make_config .tmp_defconfig || {
cleanup_after_defconfig
exit 1
}
- for img in $(get_enabled_subimages)
- do
- symbol=$(echo $img | cut -c 1 | tr '[a-z]' '[A-Z]')
- # defconfig for SPL, TPL:
- # pick lines with 'S', 'T' prefix and rip the prefixes off
- sed -n -e 's/^[+A-Z]*'$symbol'[A-Z]*://p' $defconfig_path \
- > configs/.tmp_defconfig
- run_make_config .tmp_defconfig $img || {
- cleanup_after_defconfig
- exit 1
- }
- done
-
cleanup_after_defconfig
}
-do_defconfig () {
- if [ "$KBUILD_DEFCONFIG" ]; then
- do_board_defconfig $KBUILD_DEFCONFIG
- echo "*** Default configuration is based on '$KBUILD_DEFCONFIG'"
- else
- run_make_config defconfig
- fi
-}
-
do_board_felconfig () {
do_board_defconfig ${1%%_felconfig}_defconfig
if ! grep -q CONFIG_ARCH_SUNXI=y .config || ! grep -q CONFIG_SPL=y .config ; then
@@ -169,162 +77,11 @@ do_board_felconfig () {
exit 1
fi
sed -i -e 's/\# CONFIG_SPL_FEL is not set/CONFIG_SPL_FEL=y\nCONFIG_UART0_PORT_F=n/g' \
- .config spl/.config
+ .config
}
-do_savedefconfig () {
- if [ -r "$KCONFIG_CONFIG" ]; then
- subimages=$(get_enabled_subimages)
- else
- subimages=
- fi
-
- run_make_config savedefconfig
-
- output_lines=
-
- # -r option is necessay because some string-type configs may include
- # backslashes as an escape character
- while read -r line
- do
- output_lines="$output_lines%$line"
- done < defconfig
-
- for img in $subimages
- do
- run_make_config savedefconfig $img
-
- symbol=$(echo $img | cut -c 1 | tr '[a-z]' '[A-Z]')
- unmatched=
-
- while read -r line
- do
- tmp=
- match=
-
- # "# CONFIG_FOO is not set" should not be divided.
- # Use "%" as a separator, instead of a whitespace.
- # "%" is unlikely to appear in defconfig context.
- save_IFS=$IFS
- IFS=%
- # coalesce common lines together
- for i in $output_lines
- do
- case "$i" in
- [+A-Z]*:$line)
- tmp="$tmp%$unmatched"
- i=$(echo "$i" | \
- sed -e "s/^\([^:]*\)/\1$symbol/")
- tmp="$tmp%$i"
- match=1
- ;;
- $line)
- tmp="$tmp%$unmatched"
- tmp="$tmp%+$symbol:$i"
- match=1
- ;;
- *)
- tmp="$tmp%$i"
- ;;
- esac
- done
-
- # Restore the default separator for the outer for loop.
- IFS=$save_IFS
-
- if [ "$match" ]; then
- output_lines="$tmp"
- unmatched=
- else
- unmatched="$unmatched%$symbol:$line"
- fi
- done < defconfig
-
- output_lines="$output_lines%$unmatched"
- done
-
- rm -f defconfig
- touch defconfig
-
- save_IFS=$IFS
- IFS=%
-
- for line in $output_lines
- do
- case "$line" in
- "")
- # do not output blank lines
- ;;
- *)
- echo $line >> defconfig
- ;;
- esac
- done
-
- IFS=$save_IFS
-}
-
-# Some sanity checks before running "make <objdir>/<target>",
-# where <objdir> should be either "spl" or "tpl".
-# Doing "make spl/menuconfig" etc. on a non-SPL board makes no sense.
-# It should be allowed only when ".config" exists and "CONFIG_SPL" is enabled.
-#
-# Usage:
-# check_enabled_sumbimage <objdir>/<target> <objdir>
-check_enabled_subimage () {
-
- case $2 in
- spl|tpl) ;;
- *)
- echo >&2 "***"
- echo >&2 "*** \"make $1\" is not supported."
- echo >&2 "***"
- exit 1
- ;;
- esac
- test -r "$KCONFIG_CONFIG" && get_enabled_subimages | grep -q $2 || {
- config=CONFIG_$(echo $2 | tr '[a-z]' '[A-Z]')
-
- echo >&2 "***"
- echo >&2 "*** Create \"$KCONFIG_CONFIG\" with \"$config\" enabled"
- echo >&2 "*** before \"make $1\"."
- echo >&2 "***"
- exit 1
- }
-}
-
-# Usage:
-# do_others <objdir>/<target>
-# The field "<objdir>/" is typically empy, "spl/", "tpl/" for Normal, SPL, TPL,
-# respectively.
-# The field "<target>" is a configuration target such as "config",
-# "menuconfig", etc.
do_others () {
- target=${1##*/}
-
- if [ "$target" = "$1" ]; then
- objdir=
- else
- objdir=${1%/*}
- check_enabled_subimage $1 $objdir
-
- if [ -f "$objdir/$KCONFIG_CONFIG" ]; then
- timestamp_before=$(stat --printf="%Y" \
- $objdir/$KCONFIG_CONFIG)
- fi
- fi
-
- run_make_config $target $objdir
-
- if [ "$timestamp_before" -a -f "$objdir/$KCONFIG_CONFIG" ]; then
- timestamp_after=$(stat --printf="%Y" $objdir/$KCONFIG_CONFIG)
-
- if [ "$timestamp_after" -gt "$timestamp_before" ]; then
- # $objdir/.config has been updated.
- # touch .config to invoke "make silentoldconfig"
- touch $KCONFIG_CONFIG
- fi
- fi
+ run_make_config $1
}
progname=$(basename $0)
@@ -340,10 +97,6 @@ case $target in
do_board_defconfig ${target%_config}_defconfig;;
silentoldconfig)
do_silentoldconfig;;
-defconfig)
- do_defconfig;;
-savedefconfig)
- do_savedefconfig;;
*)
do_others $target;;
esac