kconfig: convert Kconfig helper script into a shell script

Commit 51148790 added scripts/multiconfig.py written in Python 2
to adjust Kconfig for U-Boot.

It has been hard for Python 3 users because Python 2 and Python 3
are not compatible with each other.

We are not happy about adding a new host tool dependency
(in this case, Python version dependency) for the core build process.
After some discussion, we decided to use only basic tools.

The script may get a bit more unreadable by shell scripting,
but we believe it is worthwhile.

In addition, this commit revives "<board>_config" target that is
equivalent to "<board>_defconfig" for backwards compatibility.
It is annoying to adjust various projects which use U-Boot.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Suggested-by: Igor Grinberg <grinberg@compulab.co.il>
Tested-by: Igor Grinberg <grinberg@compulab.co.il>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Cc: Jeroen Hofstee <jeroen@myspectrum.nl>
Cc: Stephen Warren <swarren@nvidia.com>
Series-cc: Igor Grinberg <grinberg@compulab.co.il>
Series-cc: Simon Glass <sjg@chromium.org>
Series-version: 3
Series-changes: 3
  - More comments based on Simon's suggestion  (purely cosmetic changes)

Series-changes: 2
  - Update git-description to mention the support for "<board>_config"

Commit-notes:

To apply this patch cleanly, the following is needed:
http://patchwork.ozlabs.org/patch/380316/

END
kconfig: remove DEFCONFIG_LIST

CONFIG_DEFCONFIG_LIST specifies the default defconfig.
It is used by "make savedefconfig" when .config is missing.
But that's it.  I could not find other useful cases.

As a side effect, CONFIG_DEFCONFIG_LIST="configs/sandbox_defconfig"
is contained in .config of every target board, which some people
think is odd.  So, let's remove it.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Michal Simek <michal.simek@xilinx.com>
kconfig: add CONFIG_LOCALVERSION and CONFIG_LOCALVERSION_AUTO

Copy Kconfig options from "init/Kconfig" of Linux v3.16 tag
and adjust some parts of the help document.

Move CONFIG_SPL, CONFIG_TPL, ... etc. to "Boot images" menu.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
scripts: refetch scripts/setlocalversion from Linux 3.16

Now we have CONFIG_LOCALVERSION and CONFIG_LOCALVERSION_AUTO
in Kconfig so we can use scripts/setlocalversion without
any adjustment.  Copy it from Linux 3.16 as is.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
kconfig: add CONFIG_CC_OPTIMIZE_FOR_SIZE

Copy the Kconfig option from "init/Kconfig" of Linux v3.16 tag
and adjust the help document.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
kconfig: move
cosmetic: Kconfig: fix a typo

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
kconfig: add CONFIG_CROSS_COMPILE

Copy from Linux Kernel (with a few adjustments in comments).
tools: move_config
scripts/Lindent: import from Linux 3.16

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
tools/genboardscfg.py: Do not output SPLCPU field

Prior to Kconfig, the CPU field of boards.cfg could optionally have
":SPLCPU", like "armv7:arm720t".
(Actually this syntax was only used for Tegra platform.)

Now it is not necessary at all because CPU is defined by
CONFIG_SYS_CPU in Kconfig.

For Tegra platform, the Kconfig option is described as follows:

  config SYS_CPU
          string
          default "arm720t" if SPL_BUILD
          default "armv7" if !SPL_BUILD

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Series-cc: sjg
tools/genboardscfg.py: ignore defconfigs starting with a dot

Kconfig in U-Boot creates a temporary file configs/.tmp_defconfig
during processing "make <board>_defconfig".  The temporary file
might be left over for some reasons.

Just in case, tools/genboardscfg.py should make sure to
not read such garbage files.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Series-cc: sjg
Series-cc: trini
Cover-letter:
tools/genboardscfg.py: various fixes and performance improvement

This series depends on the following prerequisites

http://patchwork.ozlabs.org/patch/380316/
http://patchwork.ozlabs.org/patch/376222/

END
tools/genboardscfg.py: be tolerant of missing MAINTAINERS

tools/genboardscfg.py expects all the boards have MAINTAINERS.
If someone adds a new board but misses to add its MAINTAINERS file,
tools/genboardscfg.py fails to generate the boards.cfg file.
It is annoying for the other developers.

This commit allows tools/genboardscfg.py to display warning messages
and continue processing even if some MAINTAINERS files are missing
or have broken formats.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
tools/genboardscfg.py: be tolerant of insane Kconfig

The tools/genboardscfg.py expects all the Kconfig and defconfig are
written correctly.  Imagine someone accidentally has broken a board.
Error-out just for one broken board is annoying for the other
developers.  Let the tool skip insane boards and continue processing.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
tools/genboardscfg.py: wait for unfinished subprocesses before error-out

When an error occurs or the program is terminated by the user
on the way, the destructer __del__ of class Slot is invoked and
the work directories are removed.

We have to make sure there are no subprocesses (in this case,
"make O=<work_dir> ...") using the work directories before
removing them.  Otherwise the subprocess spits a bunch of error
messages possibly causing more problems.  Perhaps some users
may get upset to see too many error messages.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
tools/genboardscfg.py: fix minor problems on termination

This tool deletes the incomplete boards.cfg
if it encounters an error or is is terminated by the user.

I notice some problems even though they rarely happen.

[1] The boards.cfg is removed if the program is terminated
during __gen_boards_cfg() function but before boards.cfg
is actually touched.  In this case, the previous boards.cfg
should be kept as it is.

[2] If an error occurs while deleting the incomplete boards.cfg,
the program throws another exception.  This hides the privious
exception and we will not be able to know the real cause.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
tools/genboardscfg.py: check if the boards.cfg is up to date

It looks silly to regenerate the boards.cfg even when it is
already up to date.

The tool should exit with doing nothing if the boards.cfg is newer
than any of defconfig, Kconfig and MAINTAINERS files.

Specify -f (--force) option to get the boards.cfg regenerated
regardless its time stamp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
tools/genboardscfg.py: improve performance

I guess some developers are already getting sick of this tool
because it takes a few minites to generate the boards.cfg
on reasonable computers.

This commit makes it about 4 times faster.
You might not be satisfied at all, but better than now.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Commit-notes:

On my computer (Core i7 2700K + 16GB memory),

60 sec --> 14 sec

This commit does not solve the root cause at all.
We still need to find a better way to replace this patch.

END
tools: moveconfig.py
Do not send: Kconfiglib

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>