3 # A wrapper script to adjust Kconfig for U-Boot
5 # This file will be removed after cleaning up defconfig files
9 # SPDX-License-Identifier: GPL-2.0+
14 # Make a configuration target
16 # run_make_config <target> <objdir>
17 # <target>: Make target such as "config", "menuconfig", "defconfig", etc.
19 # Linux expects defconfig files in arch/$(SRCARCH)/configs/ directory,
20 # but U-Boot has them in configs/ directory.
21 # Give SRCARCH=.. to fake scripts/kconfig/Makefile.
22 $MAKE -f $srctree/scripts/Makefile.build obj=scripts/kconfig SRCARCH=.. $1
25 do_silentoldconfig () {
26 run_make_config silentoldconfig
28 # If the following part fails, include/config/auto.conf should be
29 # deleted so "make silentoldconfig" will be re-run on the next build.
30 $MAKE -f $srctree/scripts/Makefile.autoconf || {
31 rm -f include/config/auto.conf
35 # include/config.h has been updated after "make silentoldconfig".
36 # We need to touch include/config/auto.conf so it gets newer
37 # than include/config.h.
38 # Otherwise, 'make silentoldconfig' would be invoked twice.
39 touch include/config/auto.conf
42 cleanup_after_defconfig () {
43 rm -f configs/.tmp_defconfig
44 # ignore 'Directory not empty' error
45 # without using non-POSIX option '--ignore-fail-on-non-empty'
46 rmdir arch configs 2>/dev/null || true
50 # do_board_defconfig <board>_defconfig
51 do_board_defconfig () {
52 defconfig_path=$srctree/configs/$1
54 if [ ! -r $defconfig_path ]; then
56 echo >&2 "*** Can't find default configuration \"configs/$1\"!"
62 # prefix "*:" is deprecated. Drop it simply.
63 sed -e 's/^[+A-Z]*://' $defconfig_path > configs/.tmp_defconfig
65 run_make_config .tmp_defconfig || {
66 cleanup_after_defconfig
70 cleanup_after_defconfig
73 do_board_felconfig () {
74 do_board_defconfig ${1%%_felconfig}_defconfig
75 if ! grep -q CONFIG_ARCH_SUNXI=y .config || ! grep -q CONFIG_SPL=y .config ; then
76 echo "$progname: Cannot felconfig a non-sunxi or non-SPL platform" >&2
79 sed -i -e 's/\# CONFIG_SPL_FEL is not set/CONFIG_SPL_FEL=y\nCONFIG_UART0_PORT_F=n/g' \
87 progname=$(basename $0)
92 do_board_defconfig $target;;
94 do_board_felconfig $target;;
96 # backward compatibility
97 do_board_defconfig ${target%_config}_defconfig;;