Do not apply: tools: add genkconfig

 ========================================
 Do not apply this patch to the main line
 ========================================

 What is this tool?
 ------------------

This tool converts boards.cfg to defconfig and Kconfig files.

It automatically generates
 - arch/${ARCH}/Kconfig
 - board/${VENDOR}/${BOARD}/Kconfig
 - board/${BOARD}/Kconfig
 - configs/*_defconfig

 How to use?
 -----------

Open tools/print_allconfigs with an editor.

Adjust cross compilers part for your environment.

  # Specify your favoriate cross tools
  CROSS_COMPILE_ARC=arc-linux-
  CROSS_COMPILE_AARCH64=aarch64-linux-gnu-
  CROSS_COMPILE_ARM=arm-unknown-linux-gnueabi-
   [snip]
  CROSS_COMPILE_X86=i386-linux-

And then, run "tools/genkconfig".

 Why is this patch here?
 -----------------------

The file boards.cfg is touched very frequently.
All the time, new/old boards are being added/removed.

The next commit was generated based on the u-boot/master at the time
I posted it.
It will become out-dated soon.

You can update it with this tool.

Series-changes: 2
 - Do not generate defconfig files for SPL and TPL
 - Do not output CONFIG_BOARD_MAINTAINERS and CONFIG_BOARD_STATUS
 - Delete board/Kconfig and instead, move "source board/*/*/Kconfig"
   statements to arch/*/Kconfig.
kconfig: add board Kconfig and defconfig files

This commit adds
 - arch/*/Kconfig: provide a menu to select target boards
 - board/*/Kconfig: set CONFIG macros to the appropriate values
        for each board
 - configs/*_defconfig: default setting of each board

(This commit was automatically generated by a conversion script
based on boards.cfg)

In Linux Kernel, defconfig files are located under
arch/${ARCH}/configs/ directory.
It works in Linux Kernel because ARCH is always given from the
command line for cross compile.

But in U-Boot, ARCH is not given from the command line.
Which means we cannot know ARCH before the board configuration.
That is why "*_defconfig" files over all architectures should be
gathered into one directory ./configs/.
(The problem is configs/ directory contains about 1200 files!)

Besides, we must configure boards for SPL and TPL too
if they are supported.
For those boards, defconfig files with the same name are placed
in configs/spl/, configs/tpl/ directories.
kconfig: add basic Kconfig files

This commit adds more Kconfig files, which were written by hand.
include: define CONFIG_SPL and CONFIG_TPL as 1

We are about to switch to Kconfig in the next commit.
But there are something to get done beforehand.

In Kconfig, include/generated/autoconf.h defines boolean
CONFIG macros as 1.

CONFIG_SPL and CONFIG_TPL, if defined, must be defined as 1.
Otherwise, when switching to Kconfig, the build log
would be sprinkled with warning messages like this:
  warning: "CONFIG_SPL" redefined [enabled by default]

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
kconfig: switch to Kconfig

This commit enables Kconfig.
Going forward, we use Kconfig for 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 3 images at most: Main image, SPL, TPL.
And each of them can have a different set of CONFIG macros.

In order to keep this scheme in Kconfig, some files must be modified.
But the modification should be minimum.

The location of Kconfig related files is as follows:

 [1] Main
   - .config                          (saved CONFIG list)
   - include/config/auto.conf         (for use in makefiles)
   - include/generated/autoconf.h     (for use in C sources)
   - include/config/*                 (for if_changed_dep)

 [2] SPL
   - spl/.config                      (saved CONFIG list)
   - spl/include/config/auto.conf     (for use in makefiles)
   - spl/include/generated/autoconf.h (for use in C sources)
   - spl/include/config/*             (for if_changed_dep)

 [3] TPL
   - tpl/.config                      (saved CONFIG list)
   - tpl/include/config/auto.conf     (for use in makefiles)
   - tpl/include/generated/autoconf.h (for use in C sources)
   - tpl/include/config/*             (for if_changed_dep)

Usage:

Execute "make <board>_defconfig" to configure board and then run "make".
Or "make <board>_defconfig all" to configure and build in one time.

To modify configuration, run "make config", "make menuconfig", etc.
To see the other configuration targets execute "make help".

In Kconfig for U-boot, the configuration is done on three levels at most.

"make menuconfig" will show a menu with a blue background for the
main configuration.

Enable "Build SPL image", "Build TPL image" under "General setup"
to build SPL, TPL, respectively.

After modifying settings, choose <Exit>.
CONFIG macros will be saved into ".config" file.

If SPL build is enabled, the second menu for SPL configuration
will come up.

And if TPL build is also enabled, the third menu for TPL will
be displayed.

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

To define the set of CONFIG macros, we have used C headers.

We expect long term to move existing CONFIG macros to Kconfig.
Two different infractructure must coexist in the interim.

Prior to Kconfig, include/autoconf.mk, include/spl-autoconf.mk,
include/tpl-autoconf.mk were generated from the config header
for the use in makefiles.

They are still supported in Kconfig for U-Boot.
They are created at the beginning of the build and merged into
include/config/auto.conf, spl/include/config/auto.conf,
tpl/include/config/auto.conf, respectively.
Don't send: do not clean scripts/kconfig/* by make mrproper
MAKEALL: adjust for Kconfig

Use "make <board>_defconfig" instead of "make <board>_config".

WARNING
This adjustment is not enough.
MAKEALL should parse defconfig files instead of boards.cfg.
This commit has not got this rework done yet.
buildman: adjust for Kconfig

Use "make <board>_defconfig" instead of "make <board>_config".

WARNING
This adjustment is not enough.
MAKEALL should parse defconfig files instead of boards.cfg.
This commit has not got this rework done yet.
MAKEALL: Show configuration
kconfig: delete redundant CONFIG_${ARCH} definition

CONFIG_${ARCH} is defined by Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
kbuild: remove CONFIG_SPL/CONFIG_TPL definition in config headers

CONFIG_SPL and CONFIG_TPL are defined in Kconfig.

Remove the redundant definition in config headers.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
kconfig: remove old script

mkconfig is no longer used in Kconfig.
kconfig: add CONFIG_CROSS_COMPILE

Copy from Linux Kernel (with a few adjustments in comments).
kconfig: Add CONFIG_CC_OPTIMIZE_FOR_SIZE
Do not apply: tools: add updatedefconfig
Do not apply: tools: move_config
split CONFIG_SPL_TEXT_BASE and CONFIG_TPL_TEXT_BASE
move CONFIG_SPL_TEXT_BASE to defconfig
move CONFIG_TPL_TEXT_BASE to defconfig
remove CONFIG_{SPL,TPL}_TEXT_BASE from config headers