History log of /u-boot/config.mk
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 1ddda37b 27-Mar-2022 Simon Glass <sjg@chromium.org>

Makefile: Avoid resetting link flags in config.mk

This makes it impossible to change them elsewhere. The default value is
'empty' anyway, so just drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 86b9c3e4 21-Oct-2021 Simon Glass <sjg@chromium.org>

env: Allow U-Boot scripts to be placed in a .env file

At present U-Boot environment variables, and thus scripts, are defined
by CONFIG_EXTRA_ENV_SETTINGS. It is painful to add large amounts of text
to this file and dealing with quoting and newlines is harder than it
should be. It would be better if we could just type the script into a
text file and have it included by U-Boot.

Add a feature that brings in a .env file associated with the board
config, if present. To use it, create a file in a board/<vendor>
directory, typically called <board>.env and controlled by the
CONFIG_ENV_SOURCE_FILE option.

The environment variables should be of the form "var=value". Values can
extend to multiple lines. See the README under 'Environment Variables:'
for more information and an example.

In many cases environment variables need access to the U-Boot CONFIG
variables to select different options. Enable this so that the environment
scripts can be as useful as the ones currently in the board config files.
This uses the C preprocessor, means that comments can be included in the
environment using /* ... */

Also support += to allow variables to be appended to. This is needed when
using the preprocessor.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Tested-by: Marek Behún <marek.behun@nic.cz>

# 18138ab2 06-May-2020 Trevor Woerner <twoerner@gmail.com>

rename symbol: CONFIG_TEGRA -> CONFIG_ARCH_TEGRA

Have this symbol follow the pattern of all other such symbols.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>

# 587e4a42 27-Mar-2020 Tom Rini <trini@konsulko.com>

kconfig / kbuild: Re-sync with Linux 4.19

Align Kconfig and Kbuild logic to Linux 4.19 release with minimal impact
on files outside of this scope.

Our previous Kconfig sync was done by commit 5972ff077e0f ("kconfig /
kbuild: re-sync with Linux 4.18").

In this particular re-sync in order to keep clang support working a
number of related changes needed to be pulled in that had been missed
previously. Not all of these changes we easily traceable and so have
been omitted from the list below.

The imported Linux commits are:
[From prior to v4.18]
9f3f1fd29976 kbuild: Add __cc-option macro
d7f14c66c273 kbuild: Enable Large File Support for hostprogs
6d79a7b424a5 kbuild: suppress warnings from 'getconf LFS_*'
24403874316a Shared library support
86a9df597cdd kbuild: fix linker feature test macros when cross compiling with Clang
0294e6f4a000 kbuild: simplify ld-option implementation

[From v4.18 to v4.19]
96f14fe738b6 kbuild: Rename HOSTCFLAGS to KBUILD_HOSTCFLAGS
10844aebf448 kbuild: Rename HOSTCXXFLAGS to KBUILD_HOSTCXXFLAGS
b90a368000ab kbuild: Rename HOSTLDFLAGS to KBUILD_HOSTLDFLAGS
8377bd2b9ee1 kbuild: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS
f92d19e0ef9b kbuild: Use HOST*FLAGS options from the command line
4ab3b80159d4 kconfig: check for pkg-config on make {menu,n,g,x}config
693359f7ac90 kconfig: rename SYMBOL_AUTO to SYMBOL_NO_WRITE
f60b992e30ff kbuild: replace $(LDFLAGS) $(ldflags-y) with $(ld_flags)
2fb9279f2c3e kbuild: change ld_flags to contain LDFLAGS_$(@F)
c931d34ea085 arm64: build with baremetal linker target instead of Linux when available
5accd7f3360e kconfig: handle format string before calling conf_message_callback()
a2ff4040151a kconfig: rename file_write_dep and move it to confdata.c
0608182ad542 kconfig: split out useful helpers in confdata.c
adc18acf42a1 kconfig: remove unneeded directory generation from local*config
79123b1389cc kconfig: create directories needed for syncconfig by itself
16952b77d8b5 kconfig: make syncconfig update .config regardless of sym_change_count
d6c6ab93e17f kbuild: remove deprecated host-progs variable
56869d45e364 kconfig: fix the rule of mainmenu_stmt symbol
c151272d1687 kconfig: remove unused sym_get_env_prop() function
1880861226c1 kconfig: remove P_ENV property type
e3fd9b5384f3 scripts/dtc: consolidate include path options in Makefile
4bf6a9af0e91 kconfig: add build-only configurator targets
f1575595d156 kconfig: error out when seeing recursive dependency
5e8c5299d315 kconfig: report recursive dependency involving 'imply'
f498926c47aa kconfig: improve the recursive dependency report
98a4afbfafd2 kconfig: fix "Can't open ..." in parallel build
9a9ddcf47831 kconfig: suppress "configuration written to .config" for syncconfig
87a32e624037 kbuild: pass LDFLAGS to recordmcount.pl
d503ac531a52 kbuild: rename LDFLAGS to KBUILD_LDFLAGS
217c3e019675 disable stringop truncation warnings for now
bc8d2e20a3eb kconfig: remove a spurious self-assignment
fd65465b7016 kconfig: do not require pkg-config on make {menu,n}config
5a4630aadb9a ftrace: Build with CPPFLAGS to get -Qunused-arguments

Note that this adds new cleanup work to do in that we should adapt the
shared library support we have to what is now upstream.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>

# 1d3b97c9 23-Sep-2018 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

Kbuild: add LDFLAGS_STANDALONE

Introduce a new Makefile variable for passing LDFLAGS to standalone
programs. Currently the variable CONFIG_STANDALONE_LOAD_ADDR is
misued on some archs to pass a specific linker script.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 9865543a 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove CONFIG_USE_STDINT

You do not need to use the typedefs provided by compiler.

Our compilers are either IPL32 or LP64. Hence, U-Boot can/should
always use int-ll64.h typedefs like Linux kernel, whatever the
typedefs the compiler internally uses.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# e020c88a 31-Jul-2015 Simon Glass <sjg@chromium.org>

Allow objcopy to work without filling gaps with 0xff

This is currently done for all targets, since 0xff is the default erased
value for most flash devices. In some cases this is not what we want (e.g.
for EFI images) so provide a command to do a vanilla objcopy.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e02ee254 24-Feb-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: switch to single .config configuration

When Kconfig for U-boot was examined, one of the biggest issues was
how to support multiple images (Normal, SPL, TPL). There were
actually two options, "single .config" and "multiple .config".
After some discussions and thought experiments, I chose the latter,
i.e. to create ".config", "spl/.config", "tpl/.config" for Normal,
SPL, TPL, respectively.

It is true that the "multiple .config" strategy provided us the
maximum flexibility and helped to avoid duplicating CONFIGs among
Normal, SPL, TPL, but I have noticed some fatal problems:

[1] It is impossible to share CONFIG options across the images.
If you change the configuration of Main image, you often have to
adjust some SPL configurations correspondingly. Currently, we
cannot handle the dependencies between them. It means one of the
biggest advantages of Kconfig is lost.

[2] It is too painful to change both ".config" and "spl/.config".
Sunxi guys started to work around this problem by creating a new
configuration target. Commit cbdd9a9737cc (sunxi: kconfig: Add
%_felconfig rule to enable FEL build of sunxi platforms.) added
"make *_felconfig" to enable CONFIG_SPL_FEL on both images.
Changing the configuration of multiple images in one command is a
generic demand. The current implementation cannot propose any
good solution about this.

[3] Kconfig files are getting ugly and difficult to understand.
Commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN to
Kconfig) has sprinkled "if !SPL_BUILD" over the Kconfig files.

[4] The build system got more complicated than it should be.
To adjust Linux-originated Kconfig to U-Boot, the helper script
"scripts/multiconfig.sh" was introduced. Writing a complicated
text processor is a shell script sometimes caused problems.

Now I believe the "single .config" will serve us better. With it,
all the problems above would go away. Instead, we will have to add
some CONFIG_SPL_* (and CONFIG_TPL_*) options such as CONFIG_SPL_DM,
but we will not have much. Anyway, this is what we do now in
scripts/Makefile.spl.

I admit my mistake with my apology and this commit switches to the
single .config configuration.

It is not so difficult to do that:

- Remove unnecessary processings from scripts/multiconfig.sh
This file will remain for a while to support the current defconfig
format. It will be removed after more cleanups are done.

- Adjust some makefiles and Kconfigs

- Add some entries to include/config_uncmd_spl.h and the new file
scripts/Makefile.uncmd_spl. Some CONFIG options that are not
supported on SPL must be disabled because one .config is shared
between SPL and U-Boot proper going forward. I know this is not
a beautiful solution and I think we can do better, but let's see
how much we will have to describe them.

- update doc/README.kconfig

More cleaning up patches will follow this.

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

# 0d296cc2 15-Oct-2014 Gabe Black <gabeblack@chromium.org>

Provide option to avoid defining a custom version of uintptr_t.

There's a definition in stdint.h (provided by gcc) which will be more correct
if available.

Define CONFIG_USE_STDINT to use this feature, or USE_STDINT=1 on the 'make'
commmand.

This adjusts the settings for x86 and sandbox, with both have 64-bit options.

Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@google.com>
Rewritten to be an option, since stdint.h is often available only in glibc.
Changed to preserve a clear boundary between stdint and non-stdint
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5b3ee386 20-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: clear VENDOR variable to fix build error on tcsh

Since the environment "VENDOR" is set in tcsh, it must be cleared in our
makefile. Otherwise, boards without CONFIG_SYS_VENDOR fail to build:

> make CROSS_COMPILE=arm-linux-gnueabi- wandboard_quad_defconfig all
[ snip ]
AR arch/arm/lib/lib.a
CC arch/arm/lib/eabi_compat.o
scripts/Makefile.build:55: /home/foo/u-boot/board/unknown/wandboard/ \
Makefile: No such file or directory
make[2]: *** No rule to make target `/home/foo/u-boot/board/unknown/ \
wandboard/Makefile'. Stop.
make[1]: *** [board/unknown/wandboard] Error 2
make: *** [__build_one_by_one] Error 2

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reported-by: Tom Everett <tom@khubla.com>
Reported-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# b8450521 14-Sep-2014 Simon Glass <sjg@chromium.org>

Reactivate the tracing feature

This was lost sometime in the Kbuild conversion. Add it back.

Check that the trace test now passes:

$ ./test/trace/test-trace.sh
Simple trace test / sanity check using sandbox

/tmp/filemHKPGw
Build sandbox
O=sandbox FTRACE=1
GEN /home/sjg/c/src/third_party/u-boot/files/sandbox/Makefile
Configuring for sandbox board...
Check results
Test passed

Signed-off-by: Simon Glass <sjg@chromium.org>

# 51148790 29-Jul-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

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: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a8b0f9b6 24-Jun-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

build: define CPU only when arch/${ARCH}/cpu/${CPU} exists

The directory arch/${ARCH}/cpu/${CPU} does not exist
in avr32, blackfin, microblaze, nios2, openrisc, sandbox, x86.

These architectures have only one CPU type.
Defining CPU should not be required for such architectures.

This commit allows cpu field (= the 3rd field of boards.cfg)
to be kept blank.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Andreas Bießmann <andreas.devel@googlemail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Sonic Zhang <sonic.zhang@analog.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>

# 01286329 10-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: rename SRCTREE to srctree

Prior to Kbuild, $(TOPDIR) or $(SRCTREE) was used for
pointing to the top of source directory.
(No difference between the two.)

In Kbuild style, $(srctree) is used for instead.
This commit renames SRCTREE to srctree and deletes the
defition of SRCTREE.

Note that SRCTREE in scripts/kernel-doc, scripts/docproc.c,
doc/DocBook/Makefile should be keep.

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

# 4379ac61 10-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: rename TOPDIR to stctree

Prior to Kbuild, $(TOPDIR) or $(SRCTREE) was used for
pointing to the top of source directory.
(No difference between the two.)

In Kbuild style, $(srctree) is used instead.
This commit renames TOPDIR to srctree and delete the
defition of TOPDIR.

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

# 026f9cf2 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: improve Kbuild speed

Kbuild brought about many advantages for us but a significant
performance regression was reported by Simon Glass.

After some discussions and analysis, it turned out
its main cause is in $(call cc-option,...).

Historically, U-Boot parses all config.mk
(arch/*/config.mk and board/*/config.mk)
every time descending into subdirectories.
That means cc-options are evaluated over and over again.

$(call cc-option,...) is useful but costly.
So we want to evaluate them only in ./Makefile
and spl/Makefile and export compiler flags.

This commit changes the build system as follows:

- Modify scripts/Makefile.build to not include config.mk
Instead, add $(PLATFORM_CPPFLAGS) to asflags-y, ccflags-y,
cppflags-y.

- Export many variables
Going forward, Kbuild will not parse config.mk files
when it descends into subdirectories.
If we want to set variables in config.mk and use them
in subdirectories, they must be exported.

This is the list of variables to get exported:
PLATFORM_CPPFLAGS
CPUDIR
BOARDDIR
OBJCOPYFLAGS
LDFLAGS
LDFLAGS_FINAL
(used in nand_spl/board/*/*/Makefile)
CONFIG_STANDALONE_LOAD_ADDR
(used in examples/standalone/Makefile)
SYM_PREFIX
(used in examples/standalone/Makefile)
RELFLAGS
(used in examples/standalone/Makefile)

- Delete CPPFLAGS
This variable has been replaced with PLATFORM_CPPFLAGS

- Copy gcclibdir from example/standalone/Makefile
to arch/sparc/config.mk
The reference in CONFIG_STANDALONE_LOAD_ADDR must be
resolved before it is exported.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reported-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> [on Sandbox]
Tested-by: Stephen Warren <swarren@nvidia.com> [on Tegra]

# 33a02da0 03-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: allow empty board directories

U-Boot has compelled all boards to have
board/${BOARD}/ or board/${VENDOR}/${BOARD}/ directory.

Sometimes it does not seem suitable for some boards,
for example Sandbox. (Is it a board?)

And arcangel4 board has nothing to compile
under the board directory.

This commit makes the build system more flexible:
If '<none>' is given to the 6th column (=Board name) of boards.cfg,
Kbuild will not descend into the board directory.

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

# 57181573 25-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

config.mk: Delete unused variable BCURDIR

This variable was abolished by Kbuild series.
I forgot to delete it.

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

# 95ddcd68 23-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: rename OBJCFLAGS to OBJCOPYFLAGS

Rename OBJCFLAGS to OBJCOPYFLAGS beforehand to use
"cmd_objcopy" in scripts/Makefile.lib in an upcoming commit.

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

# 01072b44 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: move include directives of board configuration files

This commit changes the location of include directives
of board configuration files.

The purpose of this change is:
- Slim down $(TOPDIR)/config.mk
- Prevent $(TOPDIR)/Makefile from including the same
configuration file twice
- Do not include include/config.mk multiple times
because ARCH, CPU, BOARD, VENDOR, SOC are exported

Before this commit:

- include/autoconf.mk was included from $(TOPDIR)/Makefile
and $(TOPDIR)/config.mk
(This means $(TOPDIR)/Makefile included include/autoconf.mk twice)

- include/{spl,tpl}-autoconf.mk was included from $(TOPDIR)/config.mk

- include/config.mk was included from $(TOPDIR)/Makefile
and $(TOPDIR)/config.mk
(This means $(TOPDIR)/Makefile included include/config.mk twice)

After this commit:

- include/autoconf.mk is included from $(TOPDIR)/Makefile
and $(TOPDIR)/scripts/Makefile.build

- include/{spl,tpl}-autoconf.mk is included from $(TOPDIR)/spl/Makefile
and $(TOPDIR)/scripts/Makefile.build

- include/config.mk is included from $(TOPDIR)/config.mk and
$(TOPDIR)/spl/Makefile

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

# 6825a95b 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: use Linux Kernel build scripts

Now we are ready to switch over to real Kbuild.

This commit disables temporary scripts:
scripts/{Makefile.build.tmp, Makefile.host.tmp}
and enables real Kbuild scripts:
scripts/{Makefile.build,Makefile.host,Makefile.lib}.

This switch is triggered by the line in scripts/Kbuild.include
-build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj
+build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj

We need to adjust some build scripts for U-Boot.
But smaller amount of modification is preferable.

Additionally, we need to fix compiler flags which are
locally added or removed.

In Kbuild, it is not allowed to change CFLAGS locally.
Instead, ccflags-y, asflags-y, cppflags-y,
CFLAGS_$(basetarget).o, CFLAGS_REMOVE_$(basetarget).o
are prepared for that purpose.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>

# 9e414032 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: change out-of-tree build

This commit changes the working directory
where the build process occurs.

Before this commit, build process occurred under the source
tree for both in-tree and out-of-tree build.

That's why we needed to add $(obj) prefix to all generated
files in makefiles like follows:
$(obj)u-boot.bin: $(obj)u-boot

Here, $(obj) is empty for in-tree build, whereas it points
to the output directory for out-of-tree build.

And our old build system changes the current working directory
with "make -C <sub-dir>" syntax when descending into the
sub-directories.

On the other hand, Kbuild uses a different idea
to handle out-of-tree build and directory descending.

The build process of Kbuild always occurs under the output tree.
When "O=dir/to/store/output/files" is given, the build system
changes the current working directory to that directory and
restarts the make.

Kbuild uses "make -f $(srctree)/scripts/Makefile.build obj=<sub-dir>"
syntax for descending into sub-directories.
(We can write it like "make $(obj)=<sub-dir>" with a shorthand.)
This means the current working directory is always the top
of the output directory.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>

# d9580025 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Makefile: move some flags to examples makefiles

This commit moves some flags which are used
under examples/ directory only.

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

# e0d5d9f8 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Makefile: move some flags to spl/Makefile

Some flags are used for SPL (and TPL) build only.
This commit moves them from config.mk to spl/Makefile.

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

# ced0715d 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Makefile: move more stuff to top Makefile

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

# fea1ca8e 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Makefile: refactor include path settings

This commit merges commonly-used header include paths
to UBOOTINCLUDE and NOSTDINC_FLAGS variables, which are placed
at the top Makefile.

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

# 2b3c9d3d 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Makefile: move more flags to the top Makefile

Before this commit, most of compiler flags were defined in config.mk.
But it is redundant because config.mk is included from all recursive make.

This commit moves many complier flags to the top Makefile
and export them.
And we use new vaiarables to store them:
KBUILD_CPPFLAGS, KBUILD_CFLAGS, KBUILD_AFLAGS.
This will allow us to switch more smoothly to Kbuild.

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

# bf4b3de1 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: Use Kbuild.include

This commit adjusts some files to use Kbuild.include.

- Use cc-option defined in Kbuild.include
(Delete cc-option in config.mk)
- Use cc-version defined in
(Delete cc-version in config.mk)
- Move binutils-version and dtc-version to Kbuild.include
by analogy to cc-version

This commit also adds srctree (same as SRCTREE)
to use Kbuild scripts.

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

# 34bd0507 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Makefile: move BFD_ROOT_DIR to tools/gdb/Makefile

BFD_ROOT_DIR is used only in tools/gdb/Makefile

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

# f6322eb7 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Makefile: move some variable definitions to the top Makefile

This commit moves some variable definitions from config.mk
to the top Makefile:

- HOSTCC, HOSTCFLAGS, HOSTLDFLAGS
- AS, LD, CC, CPP, etc.
- SHELL (renamed to CONFIG_SHELL)

I'd like to slim down config.mk file
because it is included from all recursive make.
It is redundant to re-define the variables
every time descending into sub directories.
We should rather define them at the top Makefile
and export them.

U-Boot makefiles has been used "SHELL" variable to store shell
chosen for the user, whereas Linux Kernel uses "CONFIG_SHELL".

We should never use "SHELL" variable because it is
a special variable for GNU Make.
Changing SHELL may cause unpredictable side effects
whose root cause is usually difficult to find.
We should use a generic variable name "CONFIG_SHELL".

We should not use the syntax as follows either:

rm -f $(obj)tools/env/{fw_printenv,fw_setenv}

This depends on "bash" although GNU Make generally
invokes "sh" to run the each rule.

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

# 5651ccff 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Makfile: move suffix rules to Makefile.build

This commit moves suffix rules from config.mk
to scripts/Makefile.build, which will allow us
to switch smoothly to real Kbuild.

Note1:
post/lib_powerpc/fpu/Makefile has
its own rule to compile C sources.
We need to tweak it to keep the same behavior.

Note2:
There are two file2 with the same name:
arch/arm/lib/crt0.S and eamples/api/crt0.S.
To keep the same build behavior,
examples/api/Makefile also has to be treaked.

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

# 940db16d 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

tools: convert makefiles to kbuild style

Before this commit, makefiles under tools/ directory
were implemented with their own way.

This commit refactors them by using "hostprogs-y" variable.

Several C sources have been added to wrap other C sources
to simplify Makefile.
For example, tools/crc32.c includes lib/crc32.c

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

# 3d83efbc 26-Nov-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

sandbox: Use system headers first for sandbox's os.c in a different way

Commit cbe5cdfcd changed config.mk and arch/sandbox/cpu/Makefile
to use -idirafter instead of -I and remove -nostdinc.

But
* Sandbox-specific code dirties config.mk
* os.c is compiled without such compiler flags as:
-Wall -Wstrict-prototypes -Wno-format-security
-fno-builtin -ffreestanding -fno-stack-protector
-fstack-usage -Wno-format-nonliteral

This commit use -idirafter and remove the -nostdinc
differently and more simply.

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

# dd88ab32 28-Nov-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

Makefile: Move some scripts imported from Linux

We have some scripts imported from Linux Kernel:
setlocalversion, checkstack.pl, checkpatch.pl, cleanpatch

They are located under tools/ directory in U-Boot now.
But they were originally located under scripts/ directory
in Linux Kernel.

This commit moves them to the original location.

It is true that binutils-version.sh and dtc-version.sh
do not originate in Linux Kernel, but they should
be moved by analogy to gcc-version.sh.

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

# cbe5cdfc 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Use system headers first for sandbox's os.c

This file must be compiled with system headers, even if U-Boot has headers
of the same name. The existing solution for this is good enough for libfdt,
but fails when we have headers like stdint.h in U-Boot.

Use -idirafter instead of -I, and remove the -nostdinc and other things
that we don't want for this file. The best way to do this is to keep a
copy of the original flags, rather than trying to filter them later.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 74307f20 10-Nov-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

config.mk: delete unnecessary lines

SPL_BIN is already defined in spl/Makefile
and it is used only in spl/Makefile.

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

# bb02c536 31-Oct-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

Makefile: do not create a symbolic link to arch/${ARCH}/include/asm

In-tree build:
- Do not create a symbolic link
from include/asm to arch/${ARCH}/include/asm
- Add ${SRCTREE}/arch/arm/include into the header search path

Out-of-tree build:
- Do not create a directory ${OBJTREE}/include2
- Do not create a symbolic link
from ${OBJTREE}/include2/asm to ${SRCTREE}/arch/${ARCH}/include/asm
- Add ${SRCTREE}/arch/arm/include into the header search path

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

# 93e14596 04-Oct-2013 Wolfgang Denk <wd@denx.de>

Coding Style cleanup: replace leading SPACEs by TABs

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Drop changes for PEP 4 following python tools]
Signed-off-by: Tom Rini <trini@ti.com>

# 47f75cf2 06-Sep-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm


# 1affd4d4 01-Sep-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

cam_enc_4xx: Move CONFIG_SPL_PAD_TO to a config header

For most boards which define CONFIG_SPL_PAD_TO,
it is defined in config header files.
Currently, there exists only one exception, cam_enc_4xx board.

This patch moves CONFIG_SPL_PAD_TO definition
from board/ait/cam_enc_4xx/config.mk
to include/configs/cam_enc_4xx.h.

With this modification, we can delete a glue code
in the top level config.mk:

ifneq ($(CONFIG_SPL_PAD_TO),)
CPPFLAGS += -DCONFIG_SPL_PAD_TO=$(CONFIG_SPL_PAD_TO)
endif

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Heiko Schocher <hs@denx.de>

# cb4ef5ba 01-Sep-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

config.mk: Delete unnecessary code

Currently no makefiles (board-specific config.mk)
set the following variables:

CONFIG_SPL_TEXT_BASE
CONFIG_UBOOT_PAD_TO
CONFIG_RESET_VECTOR_ADDRESS
CONFIG_TPL_PAD_TO

For all target boards using above macros
they are set in header files (include/configs/*.h),
so we do not need to set them as CPPFLAGS.

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

# 19d829fa 05-Sep-2013 Albert ARIBAUD <albert.u.boot@aribaud.net>

Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'

Conflicts:
drivers/serial/serial.c

The conflict above was a trivial case of adding one init
function in each branch, and manually resolved in merge.


# bce88370 26-Aug-2013 Marek Vasut <marex@denx.de>

ARM: mxs: tools: Add mkimage support for MXS bootstream

Add mkimage support for generating and verifying MXS bootstream.
The implementation here is mostly a glue code between MXSSB v0.4
and mkimage, but the long-term goal is to rectify this and merge
MXSSB with mkimage more tightly. Once this code is properly in
U-Boot, MXSSB shall be deprecated in favor of mkimage-mxsimage
support.

Note that the mxsimage generator needs libcrypto from OpenSSL, I
therefore enabled the libcrypto/libssl unconditionally.

MXSSB: http://git.denx.de/?p=mxssb.git;a=summary

The code is based on research presented at:
http://www.rockbox.org/wiki/SbFileFormat

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>

# 3aa29de0 16-Aug-2013 Ying Zhang <b40530@freescale.com>

TPL : introduce the TPL based on the SPL

Due to the nand SPL on some board(e.g. P1022DS)has a size limit, it can
not be more than 4K. So, the SPL cannot initialize the DDR with the SPD
code. This patch introduces TPL to enable a loader stub that is loaded
by the code from the SPL. It initializes the DDR with the SPD or other
operations.

The TPL's size is sizeable, the maximum size is decided by the memory's
size that TPL runs. It initializes the DDR through SPD code, and copys
final uboot image to DDR. So there are three stage uboot images:
* spl_boot, * tpl_boot, * final uboot image

Signed-off-by: Ying Zhang <b40530@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 39bc12dd 19-Aug-2013 Joel Fernandes <joelf@ti.com>

SPL: Makefile: Build a separate autoconf.mk for SPL

SPL defines CONFIG_SPL_BUILD but this does not percolate to the
autoconf.mk Makefile. As a result the build breaks when
CONFIG_SPL_BUILD is used in the board-specific include header file. With
this, there is a possibility of having a CONFIG option defined in the
header file but not defined in the Makefile causing all kinds of build
failure and problems.

It also messes things for up, for example, when one might want to
undefine options to keep the SPL small and doesn't want to be stuck with
the CONFIG options used for U-boot. Lastly, this also avoids defining
special CONFIG_SPL_ variables for cases where some options are required
in U-boot but not in SPL.

We add a spl-autoconf.mk rule that is generated for SPL with the
CONFIG_SPL_BUILD flag and conditionally include it for SPL builds.

Signed-off-by: Joel Fernandes <joelf@ti.com>
Signed-off-by: Ying Zhang <b40530@freescale.com>

# 501ebdf2 24-Jul-2013 Stephen Warren <swarren@nvidia.com>

Validate dtc is new enough

Subsequent patches assume that dtc supports various recent features.
These are available in dtc 1.4.0. Validate that dtc is at least that
version.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>

# eca3aeb3 21-Jun-2013 Wolfgang Denk <wd@denx.de>

Licenses: introduce SPDX Unique Lincense Identifiers

Like many other projects, U-Boot has a tradition of including big
blocks of License headers in all files. This not only blows up the
source code with mostly redundant information, but also makes it very
difficult to generate License Clearing Reports. An additional problem
is that even the same lincenses are referred to by a number of
slightly varying text blocks (full, abbreviated, different
indentation, line wrapping and/or white space, with obsolete address
information, ...) which makes automatic processing a nightmare.

To make this easier, such license headers in the source files will be
replaced with a single line reference to Unique Lincense Identifiers
as defined by the Linux Foundation's SPDX project [1]. For example,
in a source file the full "GPL v2.0 or later" header text will be
replaced by a single line:

SPDX-License-Identifier: GPL-2.0+

We use the SPDX Unique Lincense Identifiers here; these are available
at [2].

Note: From the legal point of view, this patch is supposed to be only
a change to the textual representation of the license information,
but in no way any change to the actual license terms. With this patch
applied, all files will still be licensed under the same terms they
were before.

Note 2: The apparent difference between the old "COPYING" and the new
"Licenses/gpl-2.0.txt" only results from switching to the upstream
version of the license which is differently formatted; there are not
any actual changes to the content.

Note 3: There are some recurring questions about linense issues, such
as:
- Is a "All Rights Reserved" clause a problem in GPL code?
- Are files without any license header a problem?
- Do we need license headers at all?

The following excerpt from an e-mail by Daniel B. Ravicher should help
with these:

| Message-ID: <4ADF8CAA.5030808@softwarefreedom.org>
| Date: Wed, 21 Oct 2009 18:35:22 -0400
| From: "Daniel B. Ravicher" <ravicher@softwarefreedom.org>
| To: Wolfgang Denk <wd@denx.de>
| Subject: Re: GPL and license cleanup questions
|
| Mr. Denk,
|
| Wolfgang Denk wrote:
| > - There are a number of files which do not include any specific
| > license information at all. Is it correct to assume that these files
| > are automatically covered by the "GPL v2 or later" clause as
| > specified by the COPYING file in the top level directory of the
| > U-Boot source tree?
|
| That is a very fact specific analysis and could be different across the
| various files. However, if the contributor could reasonably be expected
| to have known that the project was licensed GPLv2 or later at the time
| she made her contribution, then a reasonably implication is that she
| consented to her contributions being distributed under those terms.
|
| > - Do such files need any clean up, for example should we add GPL
| > headers to them, or is this not needed?
|
| If the project as a whole is licensed under clear terms, you need not
| identify those same terms in each file, although there is no harm in
| doing so.
|
| > - There are other files, which include both a GPL license header
| > _plus_ some copyright note with an "All Rights Reserved" clause. It
| > has been my understanding that this is a conflict, and me must ask
| > the copyright holders to remove such "All Rights Reserved" clauses.
| > But then, some people claim that "All Rights Reserved" is a no-op
| > nowadays. License checking tools (like OSLC) seem to indicate this is
| > a problem, but then we see quite a lot of "All rights reserved" in
| > BSD-licensed files in gcc and glibc. So what is the correct way to
| > deal with such files?
|
| It is not a conflict to grant a license and also reserve all rights, as
| implicit in that language is that you are reserving all "other" rights
| not granted in the license. Thus, a file with "Licensed under GPL, All
| Rights Reserved" would mean that it is licensed under the GPL, but no
| other rights are given to copy, modify or redistribute it.
|
| Warm regards,
| --Dan
|
| Daniel B. Ravicher, Legal Director
| Software Freedom Law Center (SFLC) and Moglen Ravicher LLC
| 1995 Broadway, 17th Fl., New York, NY 10023
| (212) 461-1902 direct (212) 580-0800 main (212) 580-0898 fax
| ravicher@softwarefreedom.org www.softwarefreedom.org

[1] http://spdx.org/
[2] http://spdx.org/licenses/

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 971c450a 17-Jul-2013 Simon Glass <sjg@chromium.org>

mkimage: Use board config to get CONFIG_FIT_SIGNATURE value

The value of this config variable is not available to image.h on the host,
since the board config is not actually included. Bring this in so that
mkimage will be built with image-signing support for sandbox at least.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 29ce737d 27-Jun-2013 Simon Glass <sjg@chromium.org>

mkimage: Build signing only if board has CONFIG_FIT_SIGNATURE

At present mkimage is set up to always build with image signing support.
This means that the SSL libraries (e.g. libssl-dev) are always required.

Adjust things so that mkimage can be built with and without image signing,
controlled by the presence of CONFIG_FIT_SIGNATURE in the board config file.

If CONFIG_FIT_SIGNATURE is not enabled, then mkimage will report a warning
that signing is not supported. If the option is enabled, but libraries are
not available, then a build error similar to this will be shown:

lib/rsa/rsa-sign.c:26:25: fatal error: openssl/rsa.h: No such file or directory

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19c402af 13-Jun-2013 Simon Glass <sjg@chromium.org>

image: Add RSA support for image signing

RSA provides a public key encryption facility which is ideal for image
signing and verification.

Images are signed using a private key by mkimage. Then at run-time, the
images are verified using a private key.

This implementation uses openssl for the host part (mkimage). To avoid
bringing large libraries into the U-Boot binary, the RSA public key
is encoded using a simple numeric representation in the device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5c2aeac5 11-Jun-2013 Simon Glass <sjg@chromium.org>

Support tracing in config.mk when enabled

Use -finstrument-functions when tracing is enabled (make FTRACE=1).
Tracing is not currently supported by SPL even if sufficient memory is
available.

When tracing is enabled, we #define FTRACE. This can be used by
board config files to conditionally enable the tracing options.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d642c467 27-Apr-2013 Marek Vasut <marex@denx.de>

build: Pull -DBUILD_TAG into separate ifdef

Currently the base setting for CFLAGS is split in two possibilities,
one with -DBUILD_TAG appended at the end and one without, the rest of
CFLAGS is the same in both cases. Change this so CFLAGS are always set
and the -DBUILD_TAG is appended in separate ifdef.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Tom Rini <trini@ti.com>
Reviewed-by: Otavio Salvador <otavio@ossystems.com.br>

# fada9e20 20-Apr-2013 Simon Glass <sjg@chromium.org>

Trigger generic board error only when building

At present the generic board error can occur when configuring U-Boot, or
during distclean, but this is incorrect. The existing autoconf.mk may come
from an earlier U-Boot configuration which is about to be overwritten.

Make the error conditional so that it will only be triggered when we are
actually building U-Boot.

This avoids a problem where the system is being reconfigured to remove
CONFIG_SYS_GENERIC_BOARD on an architecture that does not support it.
Currently this will print an error and require the manual removal of
include/autoconf.mk.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ecddccd0 22-Feb-2013 Stefan Roese <sr@denx.de>

Makefile: Add target for combined u-boot.img & spl/u-boot.bin

This new make target "u-boot-img-spl-at-end.bin" consists of the
the real, full-blown U-Boot image and the U-Boot SPL binary
directly attached to it. The full-blown U-Boot image has the
mkimage header included, with its load-address and entry-point.

This will be used by the upcoming lwmon5 PPC440EPx derivate board
port.

Signed-off-by: Stefan Roese <sr@denx.de>

# 120ae609 11-Apr-2013 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Makefile: Move SHELL setup to config.mk

make never uses the SHELL variable from the environment. Instead, it
uses /bin/sh, or the value assigned to the SHELL variable by the Makefile. This
makes the export of the SHELL variable useless for sub-makes (but still useful
for the environment of recipes). However, we want all makes to use the same
shell.

This patch fixes this issue by moving the SHELL variable setup and export to the
top config.mk, so that all Makefile-s including it use the same shell.

Since BASH is used by default, this makes it possible to use things
like 'echo -e ...' in sub-makes, which would otherwise fail e.g. with /bin/sh
symlinked to /bin/dash on Ubuntu.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 0ce033d2 17-Mar-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Albert's rework of the linker scripts conflicted with Simon's making
everyone use __bss_end. We also had a minor conflict over
README.scrapyard being added to in mainline and enhanced in
u-boot-arm/master with proper formatting.

Conflicts:
arch/arm/cpu/ixp/u-boot.lds
arch/arm/cpu/u-boot.lds
arch/arm/lib/Makefile
board/actux1/u-boot.lds
board/actux2/u-boot.lds
board/actux3/u-boot.lds
board/dvlhost/u-boot.lds
board/freescale/mx31ads/u-boot.lds
doc/README.scrapyard
include/configs/tegra-common.h

Build tested for all of ARM and run-time tested on am335x_evm.

Signed-off-by: Tom Rini <trini@ti.com>


# 5c1a7ea6 08-Mar-2013 Simon Glass <sjg@chromium.org>

__HAVE_ARCH_GENERIC_BOARD controls availabilty of generic board

We are introducing a new unified board setup. Add a check to make sure that
board config files do not define CONFIG_SYS_GENERIC_BOARD unless their
architecture defines __HAVE_ARCH_GENERIC_BOARD

__HAVE_ARCH_GENERIC_BOARD will currently not be the default setting, but
we can switch this later when most architecture support generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ef123c52 24-Feb-2013 Albert ARIBAUD <albert.u.boot@aribaud.net>

Refactor linker-generated arrays

Refactor linker-generated array code so that symbols
which were previously linker-generated are now compiler-
generated. This causes relocation records of type
R_ARM_ABS32 to become R_ARM_RELATIVE, which makes
code which uses LGA able to run before relocation as
well as after.

Note: this affects more than ARM targets, as linker-
lists span possibly all target architectures, notably
PowerPC.

Conflicts:
arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
arch/arm/cpu/arm926ejs/spear/u-boot-spl.lds
arch/arm/cpu/armv7/omap-common/u-boot-spl.lds
board/ait/cam_enc_4xx/u-boot-spl.lds
board/davinci/da8xxevm/u-boot-spl-da850evm.lds
board/davinci/da8xxevm/u-boot-spl-hawk.lds
board/vpac270/u-boot-spl.lds

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 97b24d3d 18-Oct-2012 Marek Vasut <marex@denx.de>

common: Add symbol handling for generic lists into Makefile

This patch adds essential components for generation of the contents of
the linker section that is used by the linker-generated array. All of
the contents is held in a separate file, u-boot.lst, which is generated
at runtime just before U-Boot is linked.

The purpose of this code is to especially generate the appropriate
boundary symbols around each subsection in the section carrying the
linker-generated arrays. Obviously, the interim linker code for actual
placement of the variables into the section is generated too. The
generated file, u-boot.lst, is included into u-boot.lds via the linker
INCLUDE directive in u-boot.lds .

Adjustments are made in the Makefile and spl/Makefile so that the
u-boot.lds and u-boot-spl.lds depend on their respective .lst files.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@gmail.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Tested-by: Joe Hershberger <joe.hershberger@ni.com>

# 4ab64933 20-Sep-2012 Kim Phillips <kim.phillips@freescale.com>

add check infrastructure, default sparse

Add support for running source code checkers on u-boot source, e.g.,
using sparse to aid with typechecking. This comes in especially
handy as SoC vendors mix and match cores and devices with different
endianness, thus here we add CHECK_ENDIAN to the otherwise linux
kernel default CHECKFLAGS.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

# c1f5805a 14-Sep-2012 Marek Vasut <marex@denx.de>

serial: Compile drivers/serial/serial.c by default

Compile drivers/serial/serial.c by default both into SPL and into
non-SPL builds, since CONFIG_SERIAL_MULTI is now the default state.
Also having common/serial.c in by default now, it's pointless to keep
-DCONFIG_SERIAL_MULTI in CPPFLAGS any longer, so remove it as well.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>

# 82dda962 14-Sep-2012 Marek Vasut <marex@denx.de>

serial: Unconditionally enable CONFIG_SERIAL_MULTI

Enable CONFIG_SERIAL_MULTI for all builds of U-Boot. That includes
both SPL builds and non-SPL builds, everything. To avoid poluting
this patch with removal of ifdef-endif constructions containing
CONFIG_SERIAL_MULTI, the CONFIG_SERIAL_MULTI is temporarily added
into CPPFLAGS in config.mk . This will be again removed in following
patch.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>

# 2051ff34 15-Aug-2012 Allen Martin <amartin@nvidia.com>

tools, config.mk: add binutils-version

Modeled after gcc-version, add function to get binutils version.

Signed-off-by: Allen Martin <amartin@nvidia.com>
Acked-by: Wolfgang Denk <wd@denx.de>

# 7cb714a5 02-Aug-2012 Khem Raj <raj.khem@gmail.com>

config: Always use GNU ld

This patch makes sure that we always use the GNU ld. U-Boot uses certain
construct e.g. OVERLAY which are not implemented in gold therefore it
always needs GNU ld for linking.

It works well if default linker in toolchain is GNU ld but in some
cases we can have gold to be the default linker and also ship GNU ld
but not as default in such cases its called $(PREFIX)ld.bfd, with this
patch we make sure that if $(PREFIX)ld.bfd exists than we use that for
our ld.

This way it does not matter what the default ld is.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 94aebe6c 05-Jan-2012 Stefan Roese <sr@denx.de>

Makefile: Add u-boot.spr build target (SPEAr)

On x600 (SPEAr600) U-Boot is appended to U-Boot SPL. Both images are
created using mkimage (crc etc), so that the ROM bootloader can check
its integrity. Padding needs to be done to the SPL image (with
mkimage header) and not the binary. Otherwise the resulting image
which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
The resulting image containing both U-Boot images is called u-boot.spr.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Amit Virdi <amit.virdi@st.com>
Cc: Vipin Kumar <vipin.kumar@st.com>

# 19a695f8 15-Mar-2012 Tom Rini <trini@konsulko.com>

tools, config.mk: Add gcc-version.sh, cc-version test from Linux

Added from Linux - commit fde7d9049e55ab85a390be7f415d74c9f62dd0f9

Signed-off-by: Tom Rini <trini@ti.com>

# 4a30f1e8 20-Feb-2012 Tom Rini <trini@konsulko.com>

config.mk: Check for -fstack-usage support

Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Tom Rini <trini@ti.com>

# 6f4acc17 14-Feb-2012 Tom Rini <trini@konsulko.com>

config.mk: Make cc-option create a file under include/generated

Testing for -fstack-usage requires the creation of an output file, which
isn't possible with /dev/null.

Signed-off-by: Tom Rini <trini@ti.com>

# b6a467d7 06-Nov-2011 Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

config.mk: use memoization in cc-option macro to speed up compilation

Apply memoization to cc-option macro by caching the results of the
gcc calls. This macro is called very often so using cached results
leads to faster compilation times.

The old behaviour can be restored by defining the config option
CONFIG_CC_OPT_CACHE_DISABLE=y.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

# cca4e4ae 01-Nov-2011 Wolfgang Denk <wd@denx.de>

Reduce build times

U-Boot Makefiles contain a number of tests for compiler features etc.
which so far are executed again and again. On some architectures
(especially ARM) this results in a large number of calls to gcc.

This patch makes sure to run such tests only once, thus largely
reducing the number of "execve" system calls.

Example: number of "execve" system calls for building the "P2020DS"
(Power Architecture) and "qong" (ARM) boards, measured as:
-> strace -f -e trace=execve -o /tmp/foo ./MAKEALL <board>
-> grep execve /tmp/foo | wc -l

Before: After: Reduction:
==================================
P2020DS 20555 15205 -26%
qong 31692 14490 -54%

As a result, built times are significantly reduced, typically by
30...50%.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Albert Aribaud <albert.aribaud@free.fr>
cc: Graeme Russ <graeme.russ@gmail.com>
cc: Mike Frysinger <vapier@gentoo.org>
Tested-by: Graeme Russ <graeme.russ@gmail.com>
Tested-by: Matthias Weisser <weisserm@arcor.de>
Tested-by: Sanjeev Premi <premi@ti.com>
Tested-by: Simon Glass <sjg@chromium.org>
Tested-by: Macpaul Lin <macpaul@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# bbb0b128 14-Oct-2011 Simon Glass <sjg@chromium.org>

fdt: Add support for embedded device tree (CONFIG_OF_EMBED)

This new option allows U-Boot to embed a binary device tree into its image
to allow run-time control of peripherals. This device tree is for U-Boot's
own use and is not necessarily the same one as is passed to the kernel.

The device tree compiler output should be placed in the $(obj)
rooted tree. Since $(OBJCOPY) insists on adding the path to the
generated symbol names, to ensure consistency it should be
invoked from the directory where the .dtb file is located and
given the input file name without the path.

This commit contains my entry for the ugliest Makefile / shell interaction
competition.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5968adc4 12-Oct-2011 Mike Frysinger <vapier@gentoo.org>

build: force migration away from $(AR)

People keep adding new code that still uses $(AR) instead of
$(cmd_link_o_target), so turn it into a build time error.

We still use $(AR) locally, but we don't use $(ARFLAGS).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 47508843 07-Oct-2011 Simon Glass <sjg@chromium.org>

Adjust dependency rules to permit per-file flags

The dependency rules are currently done in a shell 'for' loop. This does not
permit Makefile variables to adjust preprocessor flags as is done with normal
compile flags, using the CFLAGS_path/file.o syntax.

This change moves the dependency generation into the Makefile itself, and
permits a CPPFLAGS_path/file.o to adjust preprocessor flags on a file or
directory basis.

The CPPFLAGS_... variable is also folded into CFLAGS during the build.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6262e4e7 25-Apr-2011 Mike Frysinger <vapier@gentoo.org>

disable security warning flags when possible

Some toolchains enable security warning flags by default, but these don't
really make sense in the u-boot world. Such as forcing changes like:
-printf(foo);
+printf("%s", foo);

So disable the flags when the compiler supports them. Linux has already
merged a similar change in their build system.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# c8f9c302 18-Jul-2011 Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

Extend build-system for SPL framework

Signed-off-by: Aneesh V <aneesh@ti.com>
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

# d51dfff7 19-Jun-2011 Ilya Yanok <yanok@emcraft.com>

config.mk: move LDSCRIPT processing to the top-level Makefile

LDSCRIPT is used only from the top-level Makefile and only when the
system is configured so we can move LDSCRIPT and CONFIG_SYS_LDSCRIPT
related logic into the top level Makefile and under configured condition
to avoid errors when building tools from unconfigured tree.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 83b7e2a7 06-Apr-2011 Scott Wood <scottwood@freescale.com>

Handle most LDSCRIPT setting centrally

Currently, some linker scripts are found by common code in config.mk.
Some are found using CONFIG_SYS_LDSCRIPT, but the code for that is
sometimes in arch config.mk and sometimes in board config.mk. Some
are found using an arch-specific rule for looking in CPUDIR, etc.

Further, the powerpc config.mk rule relied on CONFIG_NAND_SPL
when it really wanted CONFIG_NAND_U_BOOT -- which covered up the fact
that not all NAND_U_BOOT builds actually wanted CPUDIR/u-boot-nand.lds.

Replace all of this -- except for a handful of boards that are actually
selecting a linker script in a unique way -- with centralized ldscript
finding.

If board code specifies LDSCRIPT, that will be used.
Otherwise, if CONFIG_SYS_LDSCRIPT is specified, that will be used.

If neither of these are specified, then the central config.mk will
check for the existence of the following, in order:

$(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT)
$(TOPDIR)/$(CPUDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT)
$(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
$(TOPDIR)/$(CPUDIR)/u-boot.lds

Some boards (sc3, cm5200, munices) provided their own u-boot.lds that
were dead code, because they were overridden by a CPUDIR u-boot.lds under
the old powerpc rules. These boards' own u-boot.lds have bitrotted and
no longer work -- these lds files have been removed.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Tested-by: Graeme Russ <graeme.russ@gmail.com>

# 6dc1eceb 22-Feb-2011 Haiying Wang <Haiying.Wang@freescale.com>

Introduce a new linker flag LDFLAGS_FINAL

commit 8aba9dceebb14144e07d19593111ee3a999c37fc
Divides variable of linker flags to LDFLAGS-u-boot and LDFLAGS

breaks the usage of --gc-section to build nand_spl. We still need linker option
--gc-section for every uboot image, not only the main one. LDFLAGS_FINAL passes
the --gc-sections to each uboot image.

To get the proper linker flags, we use LDFLAGS and LDFLAGS_FINAL to replace
PLATFORM_LDFLAGS in the Makefile of each nand_spl board.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>

# 5e987ddf 17-Jan-2011 Joakim Tjernlund <Joakim.Tjernlund@transmode.se>

Top config.mk: add include/config.mk

Seems to me that the top level config.mk should include
the auto generated include/config.mk so that all Makefile's
pickup those definitions.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>

# 8aba9dce 05-Jan-2011 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

Divides variable of linker flags to LDFLAGS-u-boot and LDFLAGS

Linker needs to use the proper endian/bfd flags even when doing partial linking.
LDFLAGS_u-boot sets linker option which is called it when U-boot is built
(u-boot final).
LDFLAGS sets necessary option by partial linking (use in cmd_link_o_target).

CC: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

# 326a6945 15-Dec-2010 Mike Frysinger <vapier@gentoo.org>

config.mk: unify duplicated flag setting

Multiple rules are using the expanded AFLAGS/CFLAGS settings and some are
getting so long that the rules need to be line wrapped. So unify them in
one variable, use that variable in the rule, and then unwrap things. This
makes the actual `make` output nicer as it doesn't have line continuations
in it anymore.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 844f07d8 27-Nov-2010 Wolfgang Denk <wd@denx.de>

Coding Style (white space) cleanup

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 6d8962e8 05-Nov-2010 Sebastien Carlier <sebastien.carlier@gmail.com>

Switch from archive libraries to partial linking

Before this commit, weak symbols were not overridden by non-weak symbols
found in archive libraries when linking with recent versions of
binutils. As stated in the System V ABI, "the link editor does not
extract archive members to resolve undefined weak symbols".

This commit changes all Makefiles to use partial linking (ld -r) instead
of creating library archives, which forces all symbols to participate in
linking, allowing non-weak symbols to override weak symbols as intended.
This approach is also used by Linux, from which the gmake function
cmd_link_o_target (defined in config.mk and used in all Makefiles) is
inspired.

The name of each former library archive is preserved except for
extensions which change from ".a" to ".o". This commit updates
references accordingly where needed, in particular in some linker
scripts.

This commit reveals board configurations that exclude some features but
include source files that depend these disabled features in the build,
resulting in undefined symbols. Known such cases include:
- disabling CMD_NET but not CMD_NFS;
- enabling CONFIG_OF_LIBFDT but not CONFIG_QE.

Signed-off-by: Sebastien Carlier <sebastien.carlier@gmail.com>

# 14d0a02a 07-Oct-2010 Wolfgang Denk <wd@denx.de>

Rename TEXT_BASE into CONFIG_SYS_TEXT_BASE

The change is currently needed to be able to remove the board
configuration scripting from the top level Makefile and replace it by
a simple, table driven script.

Moving this configuration setting into the "CONFIG_*" name space is
also desirable because it is needed if we ever should move forward to
a Kconfig driven configuration system.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# f534c7cd 03-Aug-2010 Mike Frysinger <vapier@gentoo.org>

config.mk: avoid -traditional-cpp on OS X 10.5

Simply trying to include a basic header file like stdlib.h on OS X 10.5
and then building with -traditional-cpp fails with lots of errors like:
In file included from /usr/include/stdlib.h:63,
from test.c:3:
/usr/include/available.h:85: error: stray '#' in program
/usr/include/available.h:85: error: syntax error before numeric constant
/usr/include/available.h:86: error: stray '#' in program

In the past, I hadn't noticed because the old logic for these flags were
restricted to Darwin running on PowerPC systems while I'm running on an
Intel system. But after some recent clean ups and changes, the flag was
being applied to all Darwin systems and my host tools broke.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 1117cbf2 27-May-2010 Thomas Chou <thomas@wytron.com.tw>

nios: remove nios-32 arch

The nios-32 arch is obsolete and broken. So it is removed.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# c7da8c19 22-May-2010 Andreas Bießmann <andreas.devel@googlemail.com>

config.mk: use different host compiler for OS X 10.6

Compiling tools subdirectory on Mac OS X 10.6 (Snow Leopard) complains about
wrong syntax in system includes.

In file included from /usr/include/stdio.h:444,
from ../source/u-boot/include/compiler.h:26,
from ../source/u-boot/lib/crc32.c:15:
/usr/include/secure/_stdio.h:46: error: syntax error in macro parameter list

This can be fixed by reverting the workaround for prior OS X releases in
config.mk conditionally for OS X 10.6+.

Signed-off-by: Andreas Bie�mann <andreas.devel@googlemail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8d1f2682 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

ppc: Move cpu/$CPU to arch/ppc/cpu/$CPU

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# ea0364f1 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Move lib_$ARCH directories to arch/$ARCH/lib

Also move lib_$ARCH/config.mk to arch/$ARCH/config.mk

This change is intended to clean up the top-level directory structure
and more closely mimic Linux's directory organization.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# 89f39e17 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Change directory-specific CFLAGS to use full path

Previously, a specific file or directory could be compiled with custom
CFLAGS by adding a Makefile variable such as:
CFLAGS_dlmalloc.o = <custom flags for common/dlmalloc.c>
or
CFLAGS_lib = <custom flags for lib directory>

This method breaks down once multiple files or directories share the
same path. Eg FLAGS_fileA = <custom flags> would incorrectly result in
both dir1/fileA.c and dir2/fileA.c being compiled with <custom flags>.

This change allows finer grained control which we need once we move
lib_$ARCH to arch/$ARCH/lib/ and lib_generic/ to lib/. Without this
change all lib/ directories would share the same custom CFLAGS.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# 03b7004d 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Create CPUDIR variable

The CPUDIR variable points to the location of a target's CPU directory.
Currently, it is set to cpu/$CPU. However, using $CPUDIR will allow for
more flexibility in the future. It lays the groundwork for reorganizing
U-Boot's directory structure to support a layout such as:

arch/$ARCH/cpu/$CPU/* (architecture with multiple CPU types)
arch/$ARCH/cpu/* (architecture with one CPU type)

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# d984fed0 04-Nov-2009 Scott Wood <scottwood@freescale.com>

makefiles: fixes for building build tools

Currently, some of the tools instead set CC to be HOSTCC in order to re-use
some pattern rules -- but this fails when the user overrides CC on the make
command line. Also, the HOSTCFLAGS in tools/Makefile are currently not
being used because config.mk overwrites them.

This patch adds static pattern rules for files that have been requested to
be built with the native compiler using $(HOSTSRCS) and $(HOSTOBJS), and
converts the tools to use them.

It restores easylogo to using the host compiler, which was broken by commit
38d299c2db81bd889c601b5dfc12c4e83ef83333 (if this was an intentional change,
please let me know -- but it seems to be a build tool).

It restores -pedantic and the special flags for darwin and cygwin that were
requested in tools/makefile (but keeps the flags added by config.mk) --
hopefully someone can test this on those platforms. It no longer
conditionalizes -pedantic on not being darwin; it wasn't clear that that was
intentional, and unless there's a real problem it's just inviting people to
contribute non-pedantic patches to those files (I'm not a fan of -pedantic
personally, but if it's on for one platform it should be on for all).

HOST_LDFLAGS is renamed HOSTLDFLAGS for consistency with the previous
HOST_CFLAGS to HOSTCFLAGS rename. A new HOSTCFLAGS_NOPED is made available
for those files which currently cannot be built with -pedantic, and replaces
the old FIT_CFLAGS.

imls now uses the cross compiler properly, rather than by trying to
reconstruct CC using the typoed $(CROSS_COMPILER).

envcrc.c is now dependency-processed unconditionally -- previously it would
be built without being on (HOST)SRCS if CONFIG_ENV_IS_EMBEDDED was not
selected.

Signed-off-by: Scott Wood <scottwood@freescale.com>

# 6c97a20d 09-Sep-2009 Kumar Gala <galak@kernel.crashing.org>

ppc/85xx: Introduce RESET_VECTOR_ADDRESS to handle non-standard link address

Some board ports place TEXT_BASE at a location that would cause the
RESET_VECTOR_ADDRESS not to be at 0xfffffffc when we link. By default
we assume RESET_VECTOR_ADDRESS will be 0xfffffffc if the board doesn't
explicitly set it.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Wolfgang Denk <wd@denx.de>

# 6ac9f479 23-Aug-2009 Mike Frysinger <vapier@gentoo.org>

start a linker script helper file

Start a common header file for common linker script code (such as
workarounds for older linkers) rather than doing this in the build system.

As fallout, we no longer execute the linker every time config.mk is
included by a build file (which can easily be 70+ times), but rather only
execute it once.

This also fixes a bug in the major version checking by creating a macro to
easily compare versions and keep people from making the same common
mistake (forgetting to check major and minor together).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 1aada9cd 17-Aug-2009 Wolfgang Denk <wd@denx.de>

Fix all linker scripts for older binutils versions (pre-2.16)

Commit f62fb99941c6 fixed handling of all rodata sections by using a
wildcard combined with calls to ld's builtin functions SORT_BY_ALIGNMENT()
and SORT_BY_NAME(). Unfortunately these functions were only
introduced with biunutils version 2.16, so the modification broke
building with all tool chains using older binutils.

This patch makes it work again. This is done by omitting the use of
these functions for such old tool chains. This will result in
slightly larger target binaries, as the rodata sections are no longer
in optimal order alignment-wise which reauls in unused gaps, but the
effect was found to be insignificant - especially compared to the fact
that you cannot build U-Boot at all in the current state.

As ld seems to have no support for conditionals we run the linker
script through the C preprocessor which can be easily used to remove
the unwanted function calls.

Note that the C preprocessor must be run with the "-ansi" (or a
"-std=") option to make sure all the system-specific predefined
macros outside the reserved namespace are suppressed. Otherise, cpp
might for example substitute "powerpc" to "1", thus corrupting for
example "OUTPUT_ARCH(powerpc)" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>

# f772acf8 17-Aug-2009 Wolfgang Denk <wd@denx.de>

ARM: compiler options cleanup - improve tool chain support

For some time there have been repeated reports about build problems
with some ARM (cross) tool chains. Especially issues about
(in)compatibility with the tool chain provided runtime support
library libgcc.a caused to add and support a private implementation
of such runtime support code in U-Boot. A closer look at the code
indicated that some of these issues are actually home-made. This
patch attempts to clean up some of the most obvious problems and make
building of U-Boot with different tool chains easier:

- Even though all ARM systems basicy used the same compiler options
to select a specific ABI from the tool chain, the code for this was
distributed over all cpu/*/config.mk files. We move this one level
up into lib_arm/config.mk instead.

- So far, we only checked if "-mapcs-32" was supported by the tool
chain; if yes, this was used, if not, "-mabi=apcs-gnu" was
selected, no matter if the tool chain actually understood this
option. There was no support for EABI conformant tool chains.
This patch implements the following logic:

1) If the tool chain supports
"-mabi=aapcs-linux -mno-thumb-interwork"
we use these options (EABI conformant tool chain).
2) Otherwise, we check first if
"-mapcs-32"
is supported, and then check for
"-mabi=apcs-gnu"
If one test succeeds, we use the first found option.
3) In case 2), we also test if "-mno-thumb-interwork", and use
this if the test succeeds. [For "-mabi=aapcs-linux" we set
"-mno-thumb-interwork" mandatorily.]

This way we use a similar logic for the compile options as the
Linux kernel does.

- Some EABI conformant tool chains cause external references to
utility functions like raise(); such functions are provided in the
new file lib_arm/eabi_compat.c

Note that lib_arm/config.mk gets parsed several times, so we must
make sure to add eabi_compat.o only once to the linker list.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Dirk Behme <dirk.behme@googlemail.com>
Cc: Magnus Lilja <lilja.magnus@gmail.com>
Cc: Tom Rix <Tom.Rix@windriver.com>
Cc: Prafulla Wadaskar <prafulla@marvell.com>
Acked-by: Sergey Kubushyn <ksi@koi8.net>
Tested-by: Magnus Lilja <lilja.magnus@gmail.com>
Tested-by: Andrzej Wolski <awolski@poczta.fm>
Tested-by: Gaye Abdoulaye Walsimou <walsimou@walsimou.com>
Tested-by: Tom Rix <Tom.Rix@windriver.com>
Tested-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# b220c64d 10-Jul-2009 Peter Tyser <ptyser@xes-inc.com>

Move architecture specific config.mk files into subdirs

This cleans up U-Boot's toplevel directory a bit and makes the
architecture 'config.mk' file naming and location similar to board
and cpu 'config.mk' files

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# cff80f2c 20-Jun-2009 Shinya Kuribayashi <skuribay@pobox.com>

config.mk: Remove unused HPATH

This variable is not unused anywhere.

Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>

# 12e9043c 20-Jun-2009 Shinya Kuribayashi <skuribay@pobox.com>

config.mk: Remove $(PCI_CLOCK) reference

The following commit introduced $(PCI_CLOCK) reference so that
we could tweak `PCI_66M' definition via an environment variable.

> commit f046ccd15c8bc9613bfd72916b761a127d36e5c6
> Author: Eran Liberty <liberty@freescale.com>
> Date: Thu Jul 28 10:08:46 2005 -0500
>
> * Patch by Eran Liberty
> Add support for the Freescale MPC8349ADS board.

But I suggest a removal of it for the following reasons:

* In 2006, MPC8349ADS was merged into MPC8349EMDS port,
and it seems that MPC8349EMDS port is PCI_66M free.

* OTOH, PCI_66M is used by MPC832XEMDS an MPC8360EMDS ports,
but they don't need $(PCI_CLOCK) environment variable at all.
PCI_66M is automatically configured via $(BOARD)_config names
with the help of $(findstring _66_,$@).

* Unfortunately $(PCI_CLOCK) has been undocumented anywhere,
so only a few people know the existence of it these days.

* Keep config.mk independent from $(BOARD) as much as possible.

Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# 31f30c9e 14-Jun-2009 Mike Frysinger <vapier@gentoo.org>

add %.c->%.i and %.c->%.s rules

The Linux kernel has some helper rules which allow you to quickly produce
some of the intermediary files from C source. Specifically, you can
create .i files which is the preprocessed output and you can create .s
files which is the assembler output. This is useful when you are trying
to track down header/macro expansion errors or inline assembly errors.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 5ec5529b 14-Jun-2009 Mike Frysinger <vapier@gentoo.org>

allow boards to customize compiler options on a per-file/dir basis

With our Blackfin boards, we like to build the compression routines with
-O2 as our tests show a pretty good size/speed tradeoff. For the rest of
U-Boot though, we want to stick with the default -Os as that is mostly
control code. So in our case, we would add a line like so to the board
specific config.mk file:
CFLAGS_lib_generic += -O2

Now all files under lib_generic/ will have -O2 appended to their build.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 3112030a 22-May-2009 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

config.mk: remove un-needed REMOTE_BUILD check

as $(obj) is empty when in tree build

%.s: %.S
$(CPP) $(AFLAGS) -o $@ $<

and

$(obj)%.s: %.S
$(CPP) $(AFLAGS) -o $@ $<

are the same

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 4cda4378 17-Jan-2009 Mike Frysinger <vapier@gentoo.org>

build system: treat all Darwin's alike

The x86 based version of Darwin behaves the same quirky way as the powerpc
Darwin, so only check HOSTOS when setting up Darwin workarounds.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 434c51a5 12-Nov-2008 Peter Tyser <ptyser@xes-inc.com>

Remove unneeded CONFIG_SHELL references

Make should be using the bash shell by default which makes
CONFIG_SHELL unnecessary

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# 03db5333 11-Sep-2008 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

make: Remove redundant __ARM__ addition when cross-compiling on *BSD

__ARM__ is given by arm_config.mk automatically.

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

# 6b971c73 30-Aug-2008 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

config.mk: Move arch-specific condition to $(ARCH)_config.mk

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

# 28eab0d7 18-May-2008 Haavard Skinnemoen <hskinnemoen@atmel.com>

Conditionally add -fno-stack-protector to CFLAGS

When compile-testing on powerpc, I get errors like this:

net/nfs.c:422: undefined reference to `__stack_chk_fail_local'

This seems to be because -fstack-protector is on by default, so
let's explicitly disable it on all architectures that support the
option.

The Ubuntu toolchain is affected by this problem, and according to
Mike Frysinger, Gentoo has been running with SSP enabled for years.
More and more distros are turning SSP on by default, so this problem
is likely to get worse in the future.

Also, powerpc just happens to be one of the arches I do
compile-testing on. There may be other arches affected by this too.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>

# 53677ef1 20-May-2008 Wolfgang Denk <wd@denx.de>

Big white-space cleanup.

This commit gets rid of a huge amount of silly white-space issues.
Especially, all sequences of SPACEs followed by TAB characters get
removed (unless they appear in print statements).

Also remove all embedded "vim:" and "vi:" statements which hide
indentation problems.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# c4e5f52a 03-May-2008 Wolfgang Denk <wd@denx.de>

config.mk: use correct (cross) compiler

Some config.mk files reference $(CC) to test for specific tool chain
features, so make sure $(CC) gets set before including any such
config files.

This patch replaces commit b7166e05a5 ("ColdFire: Get information from
the correct GCC").

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 755c35f5 18-Feb-2008 Mike Frysinger <vapier@gentoo.org>

include autoconf.mk before any other .mk files

This bumps the autoconf.mk include step above board/cpu/arch/etc... so that
those .mk files can have make if statements based on the current config.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 6f99eec3 14-Feb-2008 Wolfgang Denk <wd@denx.de>

Merge branch 'master' of git://www.denx.de/git/u-boot-blackfin

Conflicts:

Makefile
doc/README.standalone

Signed-off-by: Wolfgang Denk <wd@denx.de>


# 161b2af4 28-Jan-2008 Mike Frysinger <vapier@gentoo.org>

Only use TEXT_BASE if defined by the board

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 94a91e24 04-Feb-2008 Mike Frysinger <vapier@gentoo.org>

generate u-boot.ldr for Blackfin targets

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 2f155f6c 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

[BUILD] Generate include/autoconf.mk from board config files

Use cpp and sed to postprocess config.h and import the defined values
into include/autoconf.mk. autoconf.mk is then included by config.mk to
give 'make' access to the board configuration.

Doing this enables conditional compilation at the Makefile level instead
of by wrapping every .c file with #ifdef/#endif wrappers.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# ad845bee 30-Oct-2007 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

blackfin: Move `-D__BLACKFIN__' to $(ARCH)_config.mk

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

# ef26a08f 08-Mar-2007 Aubrey.Li <aubrey.adi@gmail.com>

[Blackfin][PATCH-2/2] Common files changed to support bf533 platform

# 1954be6e 28-Oct-2006 Wolfgang Denk <wd@denx.de>

Automatically adjust ARFLAGS so "make -s" is really silent.

# e11887a7 26-Oct-2006 Haavard Skinnemoen <hskinnemoen@atmel.com>

Don't pass any debug options directly to the assembler

When passing the -g option to gcc, gcc automatically selects a
suitable --g<format> option to pass on to the assembler.
Thus, there's no point in forcing a specific debug option on the
assembler using the -Wa mechanism.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>

# 2da2d9a4 24-Oct-2006 Wolfgang Denk <wd@denx.de>

Use -g instead of -gstabs in AFLAGS_DEBUG
Patch by Haavard Skinnemoen, 30 Aug 2006

In config.mk, -Wa,-gstabs is unconditionally appended to AFLAGS no
matter what the target's preferred debugging format is. This patch
simply replaces -gstabs with -g, so that the default debugging format
for the architecture is used.

# 2b208f53 08-Oct-2006 Wolfgang Denk <wd@denx.de>

Move "ar" flags to config.mk to allow for silent "make -s"
Based on patch by Mike Frysinger, 20 Jun 2006

# 511d0c72 08-Oct-2006 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# 887e2ec9 07-Sep-2006 Stefan Roese <sr@denx.de>

Add support for AMCC Sequoia PPC440EPx eval board
- Add support for PPC440EPx & PPC440GRx
- Add support for PPC440EP(x)/GR(x) NAND controller
in cpu/ppc4xx directory
- Add NAND boot functionality for Sequoia board,
please see doc/README.nand-boot-ppc440 for details
- This Sequoia NAND image doesn't support environment
in NAND for now. This will be added in a short while.
Patch by Stefan Roese, 07 Sep 2006

# f9328639 01-Sep-2006 Marian Balakowicz <m8@semihalf.com>

Add support for a saving build objects in a separate directory.
Modifications are based on the linux kernel approach and
support two use cases:

1) Add O= to the make command line
'make O=/tmp/build all'

2) Set environement variable BUILD_DIR to point to the desired location
'export BUILD_DIR=/tmp/build'
'make'

The second approach can also be used with a MAKEALL script
'export BUILD_DIR=/tmp/build'
'./MAKEALL'

Command line 'O=' setting overrides BUILD_DIR environent variable.

When none of the above methods is used the local build is performed and
the object files are placed in the source directory.

# 4176c799 10-Jun-2006 Wolfgang Denk <wd@denx.de>

Merge with /home/hs/U-Boot/u-boot-dev


# b62fa913 16-May-2006 Marian Balakowicz <m8@semihalf.com>

Fix gcc 3.4.x AFLAGS setting for m68k platform.

# 483a0cf8 09-May-2006 Marian Balakowicz <m8@semihalf.com>

Fixes for gcc 3.4 based m68k toolchain,
based on patch by Jate Sujjavanich.

# 9acb626f 20-Apr-2006 Heiko Schocher <hs@pollux.denx.de>

Add MCF5282 support (without preloader)
relocate ichache_State to ram
u-boot can run from internal flash
Add EB+MCF-EV123 board support.
Add m68k Boards to MAKEALL
Patch from Jens Scharsig, 08 Aug 2005

# 0afe519a 11-Mar-2006 Wolfgang Denk <wd@denx.de>

Add ADI Blackfin support
- add support for Analog Devices Blackfin BF533 CPU
- add support for the ADI BF533 Stamp uClinux board
- add support for the ADI BF533 EZKit board
Patches by Richard Klingler, June 11th 2005:

# 0be248fa 06-Mar-2006 Wolfgang Denk <wd@denx.de>

Cleanup (get rid of debug code that sneaked in)

# 00c35bd2 28-Feb-2006 Markus Klotzb�cher <Markus Klotzb�mk@pollux.(none)>

Added GPIO initialization of DF signal. Still not working.

# e0269579 07-Feb-2006 Markus Klotzb�cher <Markus Klotzb�mk@pollux.(none)>

This is the first commit for the u-boot zylonite port. The following has be
done so far:

* created zylonite board dir (based on lubbock)
* extended some - but not all pxa sources and headers for Intel
Monahans support (CONFIG_CPU_MONAHANS)
* created Makefile zylonite target + MAKEALL entry
* added some debug nonsense, remove later, grep for mk@tbd

Status: compiles (eldk-4.0), and can be started with BDI, but runs forever
and doesn't halt at breakpoints. Hmmm...

# 9b880bd4 04-Oct-2005 Wolfgang Denk <wd@denx.de>

Update ARM Integrator boards:
Correct addessing errors in platform files.
Split off common core module data from Integrator header files to
include/armcoremodule.h.
Patch by Peter Pearse, 04 Oct 2005

# 1820d4c7 04-Oct-2005 Wolfgang Denk <wd@denx.de>

Make sure only supported compiler options are used
Import "cc-option" shell function from kernel and
use it to get the correct ARM GCC options for individual CPUs
Patch by Peter Pearse, 30 Jun 2005

# f046ccd1 28-Jul-2005 Eran Liberty <liberty@freescale.com>

* Patch by Eran Liberty
Add support for the Freescale MPC8349ADS board.

# 1d9f4105 09-Oct-2004 Wolfgang Denk <wd@denx.de>

Patch by Steven Scholz, 16 Aug 2004:
- Introducing the concept of SoCs "./cpu/$(CPU)/$(SOC)"
- creating subdirs for SoCs ./cpu/arm920t/imx and ./cpu/arm920t/s3c24x0
- moving SoC specific code out of cpu/arm920t/ into cpu/arm920t/$(SOC)/
- moving drivers/s3c24x0_i2c.c and drivers/serial_imx.c out of drivers/
into cpu/arm920t/$(SOC)/

# e4cc71aa 19-May-2004 Wolfgang Denk <wd@denx.de>

Patch by Scott McNutt, 25 Apr 2004:
Add Nios GDB/JTAG Console support:
- Add stubs to support gdb via JTAG.
- Add support for console over JTAG.
- Minor cleanup.

# c40b2956 13-Mar-2004 Wolfgang Denk <wd@denx.de>

* Patch by Rune Torgersen, 27 Feb 2004:
- Added LBA48 support (CONFIG_LBA48 & CFG_64BIT_LBA)
- Added support for 64bit printing in vsprintf (CFG_64BIT_VSPRINTF)
- Added support for 64bit strtoul (CFG_64BIT_STRTOUL)

* Patch by Masami Komiya, 27 Feb 2004:
Fix rarpboot: add autoload by NFS

* Patch by Dan Eisenhut, 26 Feb 2004:
fix flash_write return value in saveenv

* Patch by Stephan Linz, 11 Dec 2003
expand config.mk to avoid trigraph warnings on NIOS

* Rename "BMS2003" board into "HMI10"

# 4aeb251f 16-Sep-2003 Wolfgang Denk <wd@denx.de>

* Modify XLB arbiter priorities on MPC5200 so all devices use same
priority; configure critical interrupts to be handled like external
interrupts

# 27b207fd 24-Jul-2003 Wolfgang Denk <wd@denx.de>

* Implement new mechanism to export U-Boot's functions to standalone
applications: instead of using (PPC-specific) system calls we now
use a jump table; please see doc/README.standalone for details

* Patch by Dave Westwood, 24 Jul 2003:
added support for Unity OS (a proprietary OS)

# b783edae 25-Jun-2003 Wolfgang Denk <wd@denx.de>

* Header file cleanup for ARM

* Patch by Murray Jensen, 24 Jun 2003:
- make sure to use only U-boot provided header files
- fix problems with ".rodata.str1.4" section as used by GCC-3.x

# 592c5cab 20-Jun-2003 Wolfgang Denk <wd@denx.de>

Patch by Murray Jensen, 20 Jun 2003:
- hymod update
- cleanup (especially for gcc-3.x compilers)

# 6dd652fa 19-Jun-2003 Wolfgang Denk <wd@denx.de>

Patches by Murray Jensen, 17 Jun 2003:
- Hymod board database mods: add "who" field and new xilinx chip types
- provide new "init_cmd_timeout()" function so code external to
"common/main.c" can use the "reset_cmd_timeout()" function before
entering the main loop
- add DTT support for adm1021 (new file dtt/adm1021.c; config
slightly different. see include/configs/hymod.h for an example
(requires CONFIG_DTT_ADM1021, CONFIG_DTT_SENSORS, and
CFG_DTT_ADM1021 defined)
- add new "eeprom_probe()" function which has similar args and
behaves in a similar way to "eeprom_read()" etc.
- add 8260 FCC ethernet loopback code (new "eth_loopback_test()"
function which is enabled by defining CONFIG_ETHER_LOOPBACK_TEST)
- gdbtools copyright update
- ensure that set_msr() executes the "sync" and "isync" instructions
after the "mtmsr" instruction in cpu/mpc8260/interrupts.c
- 8260 I/O ports fix: Open Drain should be set last when configuring
- add SIU IRQ defines for 8260
- allow LDSCRIPT override and OBJCFLAGS initialization: change to
config.mk to allow board configurations to override the GNU
linker script, selected via the LDSCRIPT, make variable, and to
give an initial value to the OBJCFLAGS make variable
- 8260 i2c enhancement:
o correctly extends the timeout depending on the size of all
queued messages for both transmit and receive
o will not continue with receive if transmit times out
o ensures that the error callback is done for all queued tx
and rx messages
o correctly detects both tx and rx timeouts, only delivers one to
the callback, and does not overwrite an earlier error
o logic in i2c_probe now correct
- add "vprintf()" function so that "panic()" function can be
technically correct
- many Hymod board changes

# ea909b76 21-Nov-2002 Wolfgang Denk <wd@denx.de>

* Added support for both PCMCIA slots (at the same time!) on MPC8xx

* Patch by Rod Boyce, 21 Nov 2002:
fix PCMCIA on MBX8xx board

* Patch by Pierre Aubert , 21 Nov 2002
Add CFG_CPM_POST_WORD_ADDR to make the offset of the
bootmode word in DPRAM configurable

# 7f6c2cbc 10-Nov-2002 Wolfgang Denk <wd@denx.de>

* Vince Husovsky, 7 Nov 2002:
Add "-n" to linker options to get rid of "Not enough room for
program headers" problem

* Patch by David M�ller, 05 Nov 2002
Rename CONFIG_PLL_INPUT_FREQ to CONFIG_SYS_CLK_FREQ
so we can use an already existing name

* Patch by Pierre Aubert, 05 Nov 2002
Hardware related improvements in FDC boot code

* Patch by Holger Schurig, 5 Nov 2002:
Make the PXA really change it's frequency

* Patch by Pierre Aubert, 05 Nov 2002
Add support for slave serial Spartan 2 FPGAs

* Fix uninitialized memory (MAC address) in 8xx SCC/FEC ethernet
drivers

# e2211743 02-Nov-2002 Wolfgang Denk <wd@denx.de>

Initial revision

# 86b9c3e4 21-Oct-2021 Simon Glass <sjg@chromium.org>

env: Allow U-Boot scripts to be placed in a .env file

At present U-Boot environment variables, and thus scripts, are defined
by CONFIG_EXTRA_ENV_SETTINGS. It is painful to add large amounts of text
to this file and dealing with quoting and newlines is harder than it
should be. It would be better if we could just type the script into a
text file and have it included by U-Boot.

Add a feature that brings in a .env file associated with the board
config, if present. To use it, create a file in a board/<vendor>
directory, typically called <board>.env and controlled by the
CONFIG_ENV_SOURCE_FILE option.

The environment variables should be of the form "var=value". Values can
extend to multiple lines. See the README under 'Environment Variables:'
for more information and an example.

In many cases environment variables need access to the U-Boot CONFIG
variables to select different options. Enable this so that the environment
scripts can be as useful as the ones currently in the board config files.
This uses the C preprocessor, means that comments can be included in the
environment using /* ... */

Also support += to allow variables to be appended to. This is needed when
using the preprocessor.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Tested-by: Marek Behún <marek.behun@nic.cz>

# 18138ab2 06-May-2020 Trevor Woerner <twoerner@gmail.com>

rename symbol: CONFIG_TEGRA -> CONFIG_ARCH_TEGRA

Have this symbol follow the pattern of all other such symbols.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>

# 587e4a42 27-Mar-2020 Tom Rini <trini@konsulko.com>

kconfig / kbuild: Re-sync with Linux 4.19

Align Kconfig and Kbuild logic to Linux 4.19 release with minimal impact
on files outside of this scope.

Our previous Kconfig sync was done by commit 5972ff077e0f ("kconfig /
kbuild: re-sync with Linux 4.18").

In this particular re-sync in order to keep clang support working a
number of related changes needed to be pulled in that had been missed
previously. Not all of these changes we easily traceable and so have
been omitted from the list below.

The imported Linux commits are:
[From prior to v4.18]
9f3f1fd29976 kbuild: Add __cc-option macro
d7f14c66c273 kbuild: Enable Large File Support for hostprogs
6d79a7b424a5 kbuild: suppress warnings from 'getconf LFS_*'
24403874316a Shared library support
86a9df597cdd kbuild: fix linker feature test macros when cross compiling with Clang
0294e6f4a000 kbuild: simplify ld-option implementation

[From v4.18 to v4.19]
96f14fe738b6 kbuild: Rename HOSTCFLAGS to KBUILD_HOSTCFLAGS
10844aebf448 kbuild: Rename HOSTCXXFLAGS to KBUILD_HOSTCXXFLAGS
b90a368000ab kbuild: Rename HOSTLDFLAGS to KBUILD_HOSTLDFLAGS
8377bd2b9ee1 kbuild: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS
f92d19e0ef9b kbuild: Use HOST*FLAGS options from the command line
4ab3b80159d4 kconfig: check for pkg-config on make {menu,n,g,x}config
693359f7ac90 kconfig: rename SYMBOL_AUTO to SYMBOL_NO_WRITE
f60b992e30ff kbuild: replace $(LDFLAGS) $(ldflags-y) with $(ld_flags)
2fb9279f2c3e kbuild: change ld_flags to contain LDFLAGS_$(@F)
c931d34ea085 arm64: build with baremetal linker target instead of Linux when available
5accd7f3360e kconfig: handle format string before calling conf_message_callback()
a2ff4040151a kconfig: rename file_write_dep and move it to confdata.c
0608182ad542 kconfig: split out useful helpers in confdata.c
adc18acf42a1 kconfig: remove unneeded directory generation from local*config
79123b1389cc kconfig: create directories needed for syncconfig by itself
16952b77d8b5 kconfig: make syncconfig update .config regardless of sym_change_count
d6c6ab93e17f kbuild: remove deprecated host-progs variable
56869d45e364 kconfig: fix the rule of mainmenu_stmt symbol
c151272d1687 kconfig: remove unused sym_get_env_prop() function
1880861226c1 kconfig: remove P_ENV property type
e3fd9b5384f3 scripts/dtc: consolidate include path options in Makefile
4bf6a9af0e91 kconfig: add build-only configurator targets
f1575595d156 kconfig: error out when seeing recursive dependency
5e8c5299d315 kconfig: report recursive dependency involving 'imply'
f498926c47aa kconfig: improve the recursive dependency report
98a4afbfafd2 kconfig: fix "Can't open ..." in parallel build
9a9ddcf47831 kconfig: suppress "configuration written to .config" for syncconfig
87a32e624037 kbuild: pass LDFLAGS to recordmcount.pl
d503ac531a52 kbuild: rename LDFLAGS to KBUILD_LDFLAGS
217c3e019675 disable stringop truncation warnings for now
bc8d2e20a3eb kconfig: remove a spurious self-assignment
fd65465b7016 kconfig: do not require pkg-config on make {menu,n}config
5a4630aadb9a ftrace: Build with CPPFLAGS to get -Qunused-arguments

Note that this adds new cleanup work to do in that we should adapt the
shared library support we have to what is now upstream.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>

# 1d3b97c9 23-Sep-2018 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

Kbuild: add LDFLAGS_STANDALONE

Introduce a new Makefile variable for passing LDFLAGS to standalone
programs. Currently the variable CONFIG_STANDALONE_LOAD_ADDR is
misued on some archs to pass a specific linker script.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 9865543a 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove CONFIG_USE_STDINT

You do not need to use the typedefs provided by compiler.

Our compilers are either IPL32 or LP64. Hence, U-Boot can/should
always use int-ll64.h typedefs like Linux kernel, whatever the
typedefs the compiler internally uses.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# e020c88a 31-Jul-2015 Simon Glass <sjg@chromium.org>

Allow objcopy to work without filling gaps with 0xff

This is currently done for all targets, since 0xff is the default erased
value for most flash devices. In some cases this is not what we want (e.g.
for EFI images) so provide a command to do a vanilla objcopy.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e02ee254 24-Feb-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: switch to single .config configuration

When Kconfig for U-boot was examined, one of the biggest issues was
how to support multiple images (Normal, SPL, TPL). There were
actually two options, "single .config" and "multiple .config".
After some discussions and thought experiments, I chose the latter,
i.e. to create ".config", "spl/.config", "tpl/.config" for Normal,
SPL, TPL, respectively.

It is true that the "multiple .config" strategy provided us the
maximum flexibility and helped to avoid duplicating CONFIGs among
Normal, SPL, TPL, but I have noticed some fatal problems:

[1] It is impossible to share CONFIG options across the images.
If you change the configuration of Main image, you often have to
adjust some SPL configurations correspondingly. Currently, we
cannot handle the dependencies between them. It means one of the
biggest advantages of Kconfig is lost.

[2] It is too painful to change both ".config" and "spl/.config".
Sunxi guys started to work around this problem by creating a new
configuration target. Commit cbdd9a9737cc (sunxi: kconfig: Add
%_felconfig rule to enable FEL build of sunxi platforms.) added
"make *_felconfig" to enable CONFIG_SPL_FEL on both images.
Changing the configuration of multiple images in one command is a
generic demand. The current implementation cannot propose any
good solution about this.

[3] Kconfig files are getting ugly and difficult to understand.
Commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN to
Kconfig) has sprinkled "if !SPL_BUILD" over the Kconfig files.

[4] The build system got more complicated than it should be.
To adjust Linux-originated Kconfig to U-Boot, the helper script
"scripts/multiconfig.sh" was introduced. Writing a complicated
text processor is a shell script sometimes caused problems.

Now I believe the "single .config" will serve us better. With it,
all the problems above would go away. Instead, we will have to add
some CONFIG_SPL_* (and CONFIG_TPL_*) options such as CONFIG_SPL_DM,
but we will not have much. Anyway, this is what we do now in
scripts/Makefile.spl.

I admit my mistake with my apology and this commit switches to the
single .config configuration.

It is not so difficult to do that:

- Remove unnecessary processings from scripts/multiconfig.sh
This file will remain for a while to support the current defconfig
format. It will be removed after more cleanups are done.

- Adjust some makefiles and Kconfigs

- Add some entries to include/config_uncmd_spl.h and the new file
scripts/Makefile.uncmd_spl. Some CONFIG options that are not
supported on SPL must be disabled because one .config is shared
between SPL and U-Boot proper going forward. I know this is not
a beautiful solution and I think we can do better, but let's see
how much we will have to describe them.

- update doc/README.kconfig

More cleaning up patches will follow this.

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

# 0d296cc2 15-Oct-2014 Gabe Black <gabeblack@chromium.org>

Provide option to avoid defining a custom version of uintptr_t.

There's a definition in stdint.h (provided by gcc) which will be more correct
if available.

Define CONFIG_USE_STDINT to use this feature, or USE_STDINT=1 on the 'make'
commmand.

This adjusts the settings for x86 and sandbox, with both have 64-bit options.

Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@google.com>
Rewritten to be an option, since stdint.h is often available only in glibc.
Changed to preserve a clear boundary between stdint and non-stdint
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5b3ee386 20-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: clear VENDOR variable to fix build error on tcsh

Since the environment "VENDOR" is set in tcsh, it must be cleared in our
makefile. Otherwise, boards without CONFIG_SYS_VENDOR fail to build:

> make CROSS_COMPILE=arm-linux-gnueabi- wandboard_quad_defconfig all
[ snip ]
AR arch/arm/lib/lib.a
CC arch/arm/lib/eabi_compat.o
scripts/Makefile.build:55: /home/foo/u-boot/board/unknown/wandboard/ \
Makefile: No such file or directory
make[2]: *** No rule to make target `/home/foo/u-boot/board/unknown/ \
wandboard/Makefile'. Stop.
make[1]: *** [board/unknown/wandboard] Error 2
make: *** [__build_one_by_one] Error 2

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reported-by: Tom Everett <tom@khubla.com>
Reported-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# b8450521 14-Sep-2014 Simon Glass <sjg@chromium.org>

Reactivate the tracing feature

This was lost sometime in the Kbuild conversion. Add it back.

Check that the trace test now passes:

$ ./test/trace/test-trace.sh
Simple trace test / sanity check using sandbox

/tmp/filemHKPGw
Build sandbox
O=sandbox FTRACE=1
GEN /home/sjg/c/src/third_party/u-boot/files/sandbox/Makefile
Configuring for sandbox board...
Check results
Test passed

Signed-off-by: Simon Glass <sjg@chromium.org>

# 51148790 29-Jul-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

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: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a8b0f9b6 24-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

build: define CPU only when arch/${ARCH}/cpu/${CPU} exists

The directory arch/${ARCH}/cpu/${CPU} does not exist
in avr32, blackfin, microblaze, nios2, openrisc, sandbox, x86.

These architectures have only one CPU type.
Defining CPU should not be required for such architectures.

This commit allows cpu field (= the 3rd field of boards.cfg)
to be kept blank.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Andreas Bießmann <andreas.devel@googlemail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Sonic Zhang <sonic.zhang@analog.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>

# 01286329 10-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: rename SRCTREE to srctree

Prior to Kbuild, $(TOPDIR) or $(SRCTREE) was used for
pointing to the top of source directory.
(No difference between the two.)

In Kbuild style, $(srctree) is used for instead.
This commit renames SRCTREE to srctree and deletes the
defition of SRCTREE.

Note that SRCTREE in scripts/kernel-doc, scripts/docproc.c,
doc/DocBook/Makefile should be keep.

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

# 4379ac61 10-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: rename TOPDIR to stctree

Prior to Kbuild, $(TOPDIR) or $(SRCTREE) was used for
pointing to the top of source directory.
(No difference between the two.)

In Kbuild style, $(srctree) is used instead.
This commit renames TOPDIR to srctree and delete the
defition of TOPDIR.

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

# 026f9cf2 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: improve Kbuild speed

Kbuild brought about many advantages for us but a significant
performance regression was reported by Simon Glass.

After some discussions and analysis, it turned out
its main cause is in $(call cc-option,...).

Historically, U-Boot parses all config.mk
(arch/*/config.mk and board/*/config.mk)
every time descending into subdirectories.
That means cc-options are evaluated over and over again.

$(call cc-option,...) is useful but costly.
So we want to evaluate them only in ./Makefile
and spl/Makefile and export compiler flags.

This commit changes the build system as follows:

- Modify scripts/Makefile.build to not include config.mk
Instead, add $(PLATFORM_CPPFLAGS) to asflags-y, ccflags-y,
cppflags-y.

- Export many variables
Going forward, Kbuild will not parse config.mk files
when it descends into subdirectories.
If we want to set variables in config.mk and use them
in subdirectories, they must be exported.

This is the list of variables to get exported:
PLATFORM_CPPFLAGS
CPUDIR
BOARDDIR
OBJCOPYFLAGS
LDFLAGS
LDFLAGS_FINAL
(used in nand_spl/board/*/*/Makefile)
CONFIG_STANDALONE_LOAD_ADDR
(used in examples/standalone/Makefile)
SYM_PREFIX
(used in examples/standalone/Makefile)
RELFLAGS
(used in examples/standalone/Makefile)

- Delete CPPFLAGS
This variable has been replaced with PLATFORM_CPPFLAGS

- Copy gcclibdir from example/standalone/Makefile
to arch/sparc/config.mk
The reference in CONFIG_STANDALONE_LOAD_ADDR must be
resolved before it is exported.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reported-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> [on Sandbox]
Tested-by: Stephen Warren <swarren@nvidia.com> [on Tegra]

# 33a02da0 03-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: allow empty board directories

U-Boot has compelled all boards to have
board/${BOARD}/ or board/${VENDOR}/${BOARD}/ directory.

Sometimes it does not seem suitable for some boards,
for example Sandbox. (Is it a board?)

And arcangel4 board has nothing to compile
under the board directory.

This commit makes the build system more flexible:
If '<none>' is given to the 6th column (=Board name) of boards.cfg,
Kbuild will not descend into the board directory.

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

# 57181573 25-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

config.mk: Delete unused variable BCURDIR

This variable was abolished by Kbuild series.
I forgot to delete it.

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

# 95ddcd68 23-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: rename OBJCFLAGS to OBJCOPYFLAGS

Rename OBJCFLAGS to OBJCOPYFLAGS beforehand to use
"cmd_objcopy" in scripts/Makefile.lib in an upcoming commit.

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

# 01072b44 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: move include directives of board configuration files

This commit changes the location of include directives
of board configuration files.

The purpose of this change is:
- Slim down $(TOPDIR)/config.mk
- Prevent $(TOPDIR)/Makefile from including the same
configuration file twice
- Do not include include/config.mk multiple times
because ARCH, CPU, BOARD, VENDOR, SOC are exported

Before this commit:

- include/autoconf.mk was included from $(TOPDIR)/Makefile
and $(TOPDIR)/config.mk
(This means $(TOPDIR)/Makefile included include/autoconf.mk twice)

- include/{spl,tpl}-autoconf.mk was included from $(TOPDIR)/config.mk

- include/config.mk was included from $(TOPDIR)/Makefile
and $(TOPDIR)/config.mk
(This means $(TOPDIR)/Makefile included include/config.mk twice)

After this commit:

- include/autoconf.mk is included from $(TOPDIR)/Makefile
and $(TOPDIR)/scripts/Makefile.build

- include/{spl,tpl}-autoconf.mk is included from $(TOPDIR)/spl/Makefile
and $(TOPDIR)/scripts/Makefile.build

- include/config.mk is included from $(TOPDIR)/config.mk and
$(TOPDIR)/spl/Makefile

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

# 6825a95b 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: use Linux Kernel build scripts

Now we are ready to switch over to real Kbuild.

This commit disables temporary scripts:
scripts/{Makefile.build.tmp, Makefile.host.tmp}
and enables real Kbuild scripts:
scripts/{Makefile.build,Makefile.host,Makefile.lib}.

This switch is triggered by the line in scripts/Kbuild.include
-build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj
+build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj

We need to adjust some build scripts for U-Boot.
But smaller amount of modification is preferable.

Additionally, we need to fix compiler flags which are
locally added or removed.

In Kbuild, it is not allowed to change CFLAGS locally.
Instead, ccflags-y, asflags-y, cppflags-y,
CFLAGS_$(basetarget).o, CFLAGS_REMOVE_$(basetarget).o
are prepared for that purpose.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>

# 9e414032 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: change out-of-tree build

This commit changes the working directory
where the build process occurs.

Before this commit, build process occurred under the source
tree for both in-tree and out-of-tree build.

That's why we needed to add $(obj) prefix to all generated
files in makefiles like follows:
$(obj)u-boot.bin: $(obj)u-boot

Here, $(obj) is empty for in-tree build, whereas it points
to the output directory for out-of-tree build.

And our old build system changes the current working directory
with "make -C <sub-dir>" syntax when descending into the
sub-directories.

On the other hand, Kbuild uses a different idea
to handle out-of-tree build and directory descending.

The build process of Kbuild always occurs under the output tree.
When "O=dir/to/store/output/files" is given, the build system
changes the current working directory to that directory and
restarts the make.

Kbuild uses "make -f $(srctree)/scripts/Makefile.build obj=<sub-dir>"
syntax for descending into sub-directories.
(We can write it like "make $(obj)=<sub-dir>" with a shorthand.)
This means the current working directory is always the top
of the output directory.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>

# d9580025 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move some flags to examples makefiles

This commit moves some flags which are used
under examples/ directory only.

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

# e0d5d9f8 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move some flags to spl/Makefile

Some flags are used for SPL (and TPL) build only.
This commit moves them from config.mk to spl/Makefile.

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

# ced0715d 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move more stuff to top Makefile

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

# fea1ca8e 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: refactor include path settings

This commit merges commonly-used header include paths
to UBOOTINCLUDE and NOSTDINC_FLAGS variables, which are placed
at the top Makefile.

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

# 2b3c9d3d 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move more flags to the top Makefile

Before this commit, most of compiler flags were defined in config.mk.
But it is redundant because config.mk is included from all recursive make.

This commit moves many complier flags to the top Makefile
and export them.
And we use new vaiarables to store them:
KBUILD_CPPFLAGS, KBUILD_CFLAGS, KBUILD_AFLAGS.
This will allow us to switch more smoothly to Kbuild.

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

# bf4b3de1 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: Use Kbuild.include

This commit adjusts some files to use Kbuild.include.

- Use cc-option defined in Kbuild.include
(Delete cc-option in config.mk)
- Use cc-version defined in
(Delete cc-version in config.mk)
- Move binutils-version and dtc-version to Kbuild.include
by analogy to cc-version

This commit also adds srctree (same as SRCTREE)
to use Kbuild scripts.

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

# 34bd0507 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move BFD_ROOT_DIR to tools/gdb/Makefile

BFD_ROOT_DIR is used only in tools/gdb/Makefile

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

# f6322eb7 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move some variable definitions to the top Makefile

This commit moves some variable definitions from config.mk
to the top Makefile:

- HOSTCC, HOSTCFLAGS, HOSTLDFLAGS
- AS, LD, CC, CPP, etc.
- SHELL (renamed to CONFIG_SHELL)

I'd like to slim down config.mk file
because it is included from all recursive make.
It is redundant to re-define the variables
every time descending into sub directories.
We should rather define them at the top Makefile
and export them.

U-Boot makefiles has been used "SHELL" variable to store shell
chosen for the user, whereas Linux Kernel uses "CONFIG_SHELL".

We should never use "SHELL" variable because it is
a special variable for GNU Make.
Changing SHELL may cause unpredictable side effects
whose root cause is usually difficult to find.
We should use a generic variable name "CONFIG_SHELL".

We should not use the syntax as follows either:

rm -f $(obj)tools/env/{fw_printenv,fw_setenv}

This depends on "bash" although GNU Make generally
invokes "sh" to run the each rule.

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

# 5651ccff 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makfile: move suffix rules to Makefile.build

This commit moves suffix rules from config.mk
to scripts/Makefile.build, which will allow us
to switch smoothly to real Kbuild.

Note1:
post/lib_powerpc/fpu/Makefile has
its own rule to compile C sources.
We need to tweak it to keep the same behavior.

Note2:
There are two file2 with the same name:
arch/arm/lib/crt0.S and eamples/api/crt0.S.
To keep the same build behavior,
examples/api/Makefile also has to be treaked.

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

# 940db16d 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

tools: convert makefiles to kbuild style

Before this commit, makefiles under tools/ directory
were implemented with their own way.

This commit refactors them by using "hostprogs-y" variable.

Several C sources have been added to wrap other C sources
to simplify Makefile.
For example, tools/crc32.c includes lib/crc32.c

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

# 3d83efbc 26-Nov-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

sandbox: Use system headers first for sandbox's os.c in a different way

Commit cbe5cdfcd changed config.mk and arch/sandbox/cpu/Makefile
to use -idirafter instead of -I and remove -nostdinc.

But
* Sandbox-specific code dirties config.mk
* os.c is compiled without such compiler flags as:
-Wall -Wstrict-prototypes -Wno-format-security
-fno-builtin -ffreestanding -fno-stack-protector
-fstack-usage -Wno-format-nonliteral

This commit use -idirafter and remove the -nostdinc
differently and more simply.

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

# dd88ab32 28-Nov-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: Move some scripts imported from Linux

We have some scripts imported from Linux Kernel:
setlocalversion, checkstack.pl, checkpatch.pl, cleanpatch

They are located under tools/ directory in U-Boot now.
But they were originally located under scripts/ directory
in Linux Kernel.

This commit moves them to the original location.

It is true that binutils-version.sh and dtc-version.sh
do not originate in Linux Kernel, but they should
be moved by analogy to gcc-version.sh.

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

# cbe5cdfc 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Use system headers first for sandbox's os.c

This file must be compiled with system headers, even if U-Boot has headers
of the same name. The existing solution for this is good enough for libfdt,
but fails when we have headers like stdint.h in U-Boot.

Use -idirafter instead of -I, and remove the -nostdinc and other things
that we don't want for this file. The best way to do this is to keep a
copy of the original flags, rather than trying to filter them later.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 74307f20 10-Nov-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

config.mk: delete unnecessary lines

SPL_BIN is already defined in spl/Makefile
and it is used only in spl/Makefile.

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

# bb02c536 31-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: do not create a symbolic link to arch/${ARCH}/include/asm

In-tree build:
- Do not create a symbolic link
from include/asm to arch/${ARCH}/include/asm
- Add ${SRCTREE}/arch/arm/include into the header search path

Out-of-tree build:
- Do not create a directory ${OBJTREE}/include2
- Do not create a symbolic link
from ${OBJTREE}/include2/asm to ${SRCTREE}/arch/${ARCH}/include/asm
- Add ${SRCTREE}/arch/arm/include into the header search path

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

# 93e14596 04-Oct-2013 Wolfgang Denk <wd@denx.de>

Coding Style cleanup: replace leading SPACEs by TABs

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Drop changes for PEP 4 following python tools]
Signed-off-by: Tom Rini <trini@ti.com>

# 47f75cf2 06-Sep-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm


# 1affd4d4 01-Sep-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

cam_enc_4xx: Move CONFIG_SPL_PAD_TO to a config header

For most boards which define CONFIG_SPL_PAD_TO,
it is defined in config header files.
Currently, there exists only one exception, cam_enc_4xx board.

This patch moves CONFIG_SPL_PAD_TO definition
from board/ait/cam_enc_4xx/config.mk
to include/configs/cam_enc_4xx.h.

With this modification, we can delete a glue code
in the top level config.mk:

ifneq ($(CONFIG_SPL_PAD_TO),)
CPPFLAGS += -DCONFIG_SPL_PAD_TO=$(CONFIG_SPL_PAD_TO)
endif

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Heiko Schocher <hs@denx.de>

# cb4ef5ba 01-Sep-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

config.mk: Delete unnecessary code

Currently no makefiles (board-specific config.mk)
set the following variables:

CONFIG_SPL_TEXT_BASE
CONFIG_UBOOT_PAD_TO
CONFIG_RESET_VECTOR_ADDRESS
CONFIG_TPL_PAD_TO

For all target boards using above macros
they are set in header files (include/configs/*.h),
so we do not need to set them as CPPFLAGS.

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

# 19d829fa 05-Sep-2013 Albert ARIBAUD <albert.u.boot@aribaud.net>

Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'

Conflicts:
drivers/serial/serial.c

The conflict above was a trivial case of adding one init
function in each branch, and manually resolved in merge.


# bce88370 26-Aug-2013 Marek Vasut <marex@denx.de>

ARM: mxs: tools: Add mkimage support for MXS bootstream

Add mkimage support for generating and verifying MXS bootstream.
The implementation here is mostly a glue code between MXSSB v0.4
and mkimage, but the long-term goal is to rectify this and merge
MXSSB with mkimage more tightly. Once this code is properly in
U-Boot, MXSSB shall be deprecated in favor of mkimage-mxsimage
support.

Note that the mxsimage generator needs libcrypto from OpenSSL, I
therefore enabled the libcrypto/libssl unconditionally.

MXSSB: http://git.denx.de/?p=mxssb.git;a=summary

The code is based on research presented at:
http://www.rockbox.org/wiki/SbFileFormat

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>

# 3aa29de0 16-Aug-2013 Ying Zhang <b40530@freescale.com>

TPL : introduce the TPL based on the SPL

Due to the nand SPL on some board(e.g. P1022DS)has a size limit, it can
not be more than 4K. So, the SPL cannot initialize the DDR with the SPD
code. This patch introduces TPL to enable a loader stub that is loaded
by the code from the SPL. It initializes the DDR with the SPD or other
operations.

The TPL's size is sizeable, the maximum size is decided by the memory's
size that TPL runs. It initializes the DDR through SPD code, and copys
final uboot image to DDR. So there are three stage uboot images:
* spl_boot, * tpl_boot, * final uboot image

Signed-off-by: Ying Zhang <b40530@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 39bc12dd 19-Aug-2013 Joel Fernandes <joelf@ti.com>

SPL: Makefile: Build a separate autoconf.mk for SPL

SPL defines CONFIG_SPL_BUILD but this does not percolate to the
autoconf.mk Makefile. As a result the build breaks when
CONFIG_SPL_BUILD is used in the board-specific include header file. With
this, there is a possibility of having a CONFIG option defined in the
header file but not defined in the Makefile causing all kinds of build
failure and problems.

It also messes things for up, for example, when one might want to
undefine options to keep the SPL small and doesn't want to be stuck with
the CONFIG options used for U-boot. Lastly, this also avoids defining
special CONFIG_SPL_ variables for cases where some options are required
in U-boot but not in SPL.

We add a spl-autoconf.mk rule that is generated for SPL with the
CONFIG_SPL_BUILD flag and conditionally include it for SPL builds.

Signed-off-by: Joel Fernandes <joelf@ti.com>
Signed-off-by: Ying Zhang <b40530@freescale.com>

# 501ebdf2 24-Jul-2013 Stephen Warren <swarren@nvidia.com>

Validate dtc is new enough

Subsequent patches assume that dtc supports various recent features.
These are available in dtc 1.4.0. Validate that dtc is at least that
version.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>

# eca3aeb3 21-Jun-2013 Wolfgang Denk <wd@denx.de>

Licenses: introduce SPDX Unique Lincense Identifiers

Like many other projects, U-Boot has a tradition of including big
blocks of License headers in all files. This not only blows up the
source code with mostly redundant information, but also makes it very
difficult to generate License Clearing Reports. An additional problem
is that even the same lincenses are referred to by a number of
slightly varying text blocks (full, abbreviated, different
indentation, line wrapping and/or white space, with obsolete address
information, ...) which makes automatic processing a nightmare.

To make this easier, such license headers in the source files will be
replaced with a single line reference to Unique Lincense Identifiers
as defined by the Linux Foundation's SPDX project [1]. For example,
in a source file the full "GPL v2.0 or later" header text will be
replaced by a single line:

SPDX-License-Identifier: GPL-2.0+

We use the SPDX Unique Lincense Identifiers here; these are available
at [2].

Note: From the legal point of view, this patch is supposed to be only
a change to the textual representation of the license information,
but in no way any change to the actual license terms. With this patch
applied, all files will still be licensed under the same terms they
were before.

Note 2: The apparent difference between the old "COPYING" and the new
"Licenses/gpl-2.0.txt" only results from switching to the upstream
version of the license which is differently formatted; there are not
any actual changes to the content.

Note 3: There are some recurring questions about linense issues, such
as:
- Is a "All Rights Reserved" clause a problem in GPL code?
- Are files without any license header a problem?
- Do we need license headers at all?

The following excerpt from an e-mail by Daniel B. Ravicher should help
with these:

| Message-ID: <4ADF8CAA.5030808@softwarefreedom.org>
| Date: Wed, 21 Oct 2009 18:35:22 -0400
| From: "Daniel B. Ravicher" <ravicher@softwarefreedom.org>
| To: Wolfgang Denk <wd@denx.de>
| Subject: Re: GPL and license cleanup questions
|
| Mr. Denk,
|
| Wolfgang Denk wrote:
| > - There are a number of files which do not include any specific
| > license information at all. Is it correct to assume that these files
| > are automatically covered by the "GPL v2 or later" clause as
| > specified by the COPYING file in the top level directory of the
| > U-Boot source tree?
|
| That is a very fact specific analysis and could be different across the
| various files. However, if the contributor could reasonably be expected
| to have known that the project was licensed GPLv2 or later at the time
| she made her contribution, then a reasonably implication is that she
| consented to her contributions being distributed under those terms.
|
| > - Do such files need any clean up, for example should we add GPL
| > headers to them, or is this not needed?
|
| If the project as a whole is licensed under clear terms, you need not
| identify those same terms in each file, although there is no harm in
| doing so.
|
| > - There are other files, which include both a GPL license header
| > _plus_ some copyright note with an "All Rights Reserved" clause. It
| > has been my understanding that this is a conflict, and me must ask
| > the copyright holders to remove such "All Rights Reserved" clauses.
| > But then, some people claim that "All Rights Reserved" is a no-op
| > nowadays. License checking tools (like OSLC) seem to indicate this is
| > a problem, but then we see quite a lot of "All rights reserved" in
| > BSD-licensed files in gcc and glibc. So what is the correct way to
| > deal with such files?
|
| It is not a conflict to grant a license and also reserve all rights, as
| implicit in that language is that you are reserving all "other" rights
| not granted in the license. Thus, a file with "Licensed under GPL, All
| Rights Reserved" would mean that it is licensed under the GPL, but no
| other rights are given to copy, modify or redistribute it.
|
| Warm regards,
| --Dan
|
| Daniel B. Ravicher, Legal Director
| Software Freedom Law Center (SFLC) and Moglen Ravicher LLC
| 1995 Broadway, 17th Fl., New York, NY 10023
| (212) 461-1902 direct (212) 580-0800 main (212) 580-0898 fax
| ravicher@softwarefreedom.org www.softwarefreedom.org

[1] http://spdx.org/
[2] http://spdx.org/licenses/

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 971c450a 17-Jul-2013 Simon Glass <sjg@chromium.org>

mkimage: Use board config to get CONFIG_FIT_SIGNATURE value

The value of this config variable is not available to image.h on the host,
since the board config is not actually included. Bring this in so that
mkimage will be built with image-signing support for sandbox at least.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 29ce737d 27-Jun-2013 Simon Glass <sjg@chromium.org>

mkimage: Build signing only if board has CONFIG_FIT_SIGNATURE

At present mkimage is set up to always build with image signing support.
This means that the SSL libraries (e.g. libssl-dev) are always required.

Adjust things so that mkimage can be built with and without image signing,
controlled by the presence of CONFIG_FIT_SIGNATURE in the board config file.

If CONFIG_FIT_SIGNATURE is not enabled, then mkimage will report a warning
that signing is not supported. If the option is enabled, but libraries are
not available, then a build error similar to this will be shown:

lib/rsa/rsa-sign.c:26:25: fatal error: openssl/rsa.h: No such file or directory

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19c402af 13-Jun-2013 Simon Glass <sjg@chromium.org>

image: Add RSA support for image signing

RSA provides a public key encryption facility which is ideal for image
signing and verification.

Images are signed using a private key by mkimage. Then at run-time, the
images are verified using a private key.

This implementation uses openssl for the host part (mkimage). To avoid
bringing large libraries into the U-Boot binary, the RSA public key
is encoded using a simple numeric representation in the device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5c2aeac5 11-Jun-2013 Simon Glass <sjg@chromium.org>

Support tracing in config.mk when enabled

Use -finstrument-functions when tracing is enabled (make FTRACE=1).
Tracing is not currently supported by SPL even if sufficient memory is
available.

When tracing is enabled, we #define FTRACE. This can be used by
board config files to conditionally enable the tracing options.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d642c467 27-Apr-2013 Marek Vasut <marex@denx.de>

build: Pull -DBUILD_TAG into separate ifdef

Currently the base setting for CFLAGS is split in two possibilities,
one with -DBUILD_TAG appended at the end and one without, the rest of
CFLAGS is the same in both cases. Change this so CFLAGS are always set
and the -DBUILD_TAG is appended in separate ifdef.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Tom Rini <trini@ti.com>
Reviewed-by: Otavio Salvador <otavio@ossystems.com.br>

# fada9e20 20-Apr-2013 Simon Glass <sjg@chromium.org>

Trigger generic board error only when building

At present the generic board error can occur when configuring U-Boot, or
during distclean, but this is incorrect. The existing autoconf.mk may come
from an earlier U-Boot configuration which is about to be overwritten.

Make the error conditional so that it will only be triggered when we are
actually building U-Boot.

This avoids a problem where the system is being reconfigured to remove
CONFIG_SYS_GENERIC_BOARD on an architecture that does not support it.
Currently this will print an error and require the manual removal of
include/autoconf.mk.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ecddccd0 22-Feb-2013 Stefan Roese <sr@denx.de>

Makefile: Add target for combined u-boot.img & spl/u-boot.bin

This new make target "u-boot-img-spl-at-end.bin" consists of the
the real, full-blown U-Boot image and the U-Boot SPL binary
directly attached to it. The full-blown U-Boot image has the
mkimage header included, with its load-address and entry-point.

This will be used by the upcoming lwmon5 PPC440EPx derivate board
port.

Signed-off-by: Stefan Roese <sr@denx.de>

# 120ae609 11-Apr-2013 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Makefile: Move SHELL setup to config.mk

make never uses the SHELL variable from the environment. Instead, it
uses /bin/sh, or the value assigned to the SHELL variable by the Makefile. This
makes the export of the SHELL variable useless for sub-makes (but still useful
for the environment of recipes). However, we want all makes to use the same
shell.

This patch fixes this issue by moving the SHELL variable setup and export to the
top config.mk, so that all Makefile-s including it use the same shell.

Since BASH is used by default, this makes it possible to use things
like 'echo -e ...' in sub-makes, which would otherwise fail e.g. with /bin/sh
symlinked to /bin/dash on Ubuntu.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 0ce033d2 17-Mar-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Albert's rework of the linker scripts conflicted with Simon's making
everyone use __bss_end. We also had a minor conflict over
README.scrapyard being added to in mainline and enhanced in
u-boot-arm/master with proper formatting.

Conflicts:
arch/arm/cpu/ixp/u-boot.lds
arch/arm/cpu/u-boot.lds
arch/arm/lib/Makefile
board/actux1/u-boot.lds
board/actux2/u-boot.lds
board/actux3/u-boot.lds
board/dvlhost/u-boot.lds
board/freescale/mx31ads/u-boot.lds
doc/README.scrapyard
include/configs/tegra-common.h

Build tested for all of ARM and run-time tested on am335x_evm.

Signed-off-by: Tom Rini <trini@ti.com>


# 5c1a7ea6 08-Mar-2013 Simon Glass <sjg@chromium.org>

__HAVE_ARCH_GENERIC_BOARD controls availabilty of generic board

We are introducing a new unified board setup. Add a check to make sure that
board config files do not define CONFIG_SYS_GENERIC_BOARD unless their
architecture defines __HAVE_ARCH_GENERIC_BOARD

__HAVE_ARCH_GENERIC_BOARD will currently not be the default setting, but
we can switch this later when most architecture support generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ef123c52 24-Feb-2013 Albert ARIBAUD <albert.u.boot@aribaud.net>

Refactor linker-generated arrays

Refactor linker-generated array code so that symbols
which were previously linker-generated are now compiler-
generated. This causes relocation records of type
R_ARM_ABS32 to become R_ARM_RELATIVE, which makes
code which uses LGA able to run before relocation as
well as after.

Note: this affects more than ARM targets, as linker-
lists span possibly all target architectures, notably
PowerPC.

Conflicts:
arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
arch/arm/cpu/arm926ejs/spear/u-boot-spl.lds
arch/arm/cpu/armv7/omap-common/u-boot-spl.lds
board/ait/cam_enc_4xx/u-boot-spl.lds
board/davinci/da8xxevm/u-boot-spl-da850evm.lds
board/davinci/da8xxevm/u-boot-spl-hawk.lds
board/vpac270/u-boot-spl.lds

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 97b24d3d 18-Oct-2012 Marek Vasut <marex@denx.de>

common: Add symbol handling for generic lists into Makefile

This patch adds essential components for generation of the contents of
the linker section that is used by the linker-generated array. All of
the contents is held in a separate file, u-boot.lst, which is generated
at runtime just before U-Boot is linked.

The purpose of this code is to especially generate the appropriate
boundary symbols around each subsection in the section carrying the
linker-generated arrays. Obviously, the interim linker code for actual
placement of the variables into the section is generated too. The
generated file, u-boot.lst, is included into u-boot.lds via the linker
INCLUDE directive in u-boot.lds .

Adjustments are made in the Makefile and spl/Makefile so that the
u-boot.lds and u-boot-spl.lds depend on their respective .lst files.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@gmail.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Tested-by: Joe Hershberger <joe.hershberger@ni.com>

# 4ab64933 20-Sep-2012 Kim Phillips <kim.phillips@freescale.com>

add check infrastructure, default sparse

Add support for running source code checkers on u-boot source, e.g.,
using sparse to aid with typechecking. This comes in especially
handy as SoC vendors mix and match cores and devices with different
endianness, thus here we add CHECK_ENDIAN to the otherwise linux
kernel default CHECKFLAGS.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

# c1f5805a 14-Sep-2012 Marek Vasut <marex@denx.de>

serial: Compile drivers/serial/serial.c by default

Compile drivers/serial/serial.c by default both into SPL and into
non-SPL builds, since CONFIG_SERIAL_MULTI is now the default state.
Also having common/serial.c in by default now, it's pointless to keep
-DCONFIG_SERIAL_MULTI in CPPFLAGS any longer, so remove it as well.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>

# 82dda962 14-Sep-2012 Marek Vasut <marex@denx.de>

serial: Unconditionally enable CONFIG_SERIAL_MULTI

Enable CONFIG_SERIAL_MULTI for all builds of U-Boot. That includes
both SPL builds and non-SPL builds, everything. To avoid poluting
this patch with removal of ifdef-endif constructions containing
CONFIG_SERIAL_MULTI, the CONFIG_SERIAL_MULTI is temporarily added
into CPPFLAGS in config.mk . This will be again removed in following
patch.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>

# 2051ff34 15-Aug-2012 Allen Martin <amartin@nvidia.com>

tools, config.mk: add binutils-version

Modeled after gcc-version, add function to get binutils version.

Signed-off-by: Allen Martin <amartin@nvidia.com>
Acked-by: Wolfgang Denk <wd@denx.de>

# 7cb714a5 02-Aug-2012 Khem Raj <raj.khem@gmail.com>

config: Always use GNU ld

This patch makes sure that we always use the GNU ld. U-Boot uses certain
construct e.g. OVERLAY which are not implemented in gold therefore it
always needs GNU ld for linking.

It works well if default linker in toolchain is GNU ld but in some
cases we can have gold to be the default linker and also ship GNU ld
but not as default in such cases its called $(PREFIX)ld.bfd, with this
patch we make sure that if $(PREFIX)ld.bfd exists than we use that for
our ld.

This way it does not matter what the default ld is.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 94aebe6c 05-Jan-2012 Stefan Roese <sr@denx.de>

Makefile: Add u-boot.spr build target (SPEAr)

On x600 (SPEAr600) U-Boot is appended to U-Boot SPL. Both images are
created using mkimage (crc etc), so that the ROM bootloader can check
its integrity. Padding needs to be done to the SPL image (with
mkimage header) and not the binary. Otherwise the resulting image
which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
The resulting image containing both U-Boot images is called u-boot.spr.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Amit Virdi <amit.virdi@st.com>
Cc: Vipin Kumar <vipin.kumar@st.com>

# 19a695f8 15-Mar-2012 Tom Rini <trini@ti.com>

tools, config.mk: Add gcc-version.sh, cc-version test from Linux

Added from Linux - commit fde7d9049e55ab85a390be7f415d74c9f62dd0f9

Signed-off-by: Tom Rini <trini@ti.com>

# 4a30f1e8 20-Feb-2012 Tom Rini <trini@ti.com>

config.mk: Check for -fstack-usage support

Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Tom Rini <trini@ti.com>

# 6f4acc17 14-Feb-2012 Tom Rini <trini@ti.com>

config.mk: Make cc-option create a file under include/generated

Testing for -fstack-usage requires the creation of an output file, which
isn't possible with /dev/null.

Signed-off-by: Tom Rini <trini@ti.com>

# b6a467d7 06-Nov-2011 Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

config.mk: use memoization in cc-option macro to speed up compilation

Apply memoization to cc-option macro by caching the results of the
gcc calls. This macro is called very often so using cached results
leads to faster compilation times.

The old behaviour can be restored by defining the config option
CONFIG_CC_OPT_CACHE_DISABLE=y.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

# cca4e4ae 01-Nov-2011 Wolfgang Denk <wd@denx.de>

Reduce build times

U-Boot Makefiles contain a number of tests for compiler features etc.
which so far are executed again and again. On some architectures
(especially ARM) this results in a large number of calls to gcc.

This patch makes sure to run such tests only once, thus largely
reducing the number of "execve" system calls.

Example: number of "execve" system calls for building the "P2020DS"
(Power Architecture) and "qong" (ARM) boards, measured as:
-> strace -f -e trace=execve -o /tmp/foo ./MAKEALL <board>
-> grep execve /tmp/foo | wc -l

Before: After: Reduction:
==================================
P2020DS 20555 15205 -26%
qong 31692 14490 -54%

As a result, built times are significantly reduced, typically by
30...50%.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Albert Aribaud <albert.aribaud@free.fr>
cc: Graeme Russ <graeme.russ@gmail.com>
cc: Mike Frysinger <vapier@gentoo.org>
Tested-by: Graeme Russ <graeme.russ@gmail.com>
Tested-by: Matthias Weisser <weisserm@arcor.de>
Tested-by: Sanjeev Premi <premi@ti.com>
Tested-by: Simon Glass <sjg@chromium.org>
Tested-by: Macpaul Lin <macpaul@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# bbb0b128 14-Oct-2011 Simon Glass <sjg@chromium.org>

fdt: Add support for embedded device tree (CONFIG_OF_EMBED)

This new option allows U-Boot to embed a binary device tree into its image
to allow run-time control of peripherals. This device tree is for U-Boot's
own use and is not necessarily the same one as is passed to the kernel.

The device tree compiler output should be placed in the $(obj)
rooted tree. Since $(OBJCOPY) insists on adding the path to the
generated symbol names, to ensure consistency it should be
invoked from the directory where the .dtb file is located and
given the input file name without the path.

This commit contains my entry for the ugliest Makefile / shell interaction
competition.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5968adc4 12-Oct-2011 Mike Frysinger <vapier@gentoo.org>

build: force migration away from $(AR)

People keep adding new code that still uses $(AR) instead of
$(cmd_link_o_target), so turn it into a build time error.

We still use $(AR) locally, but we don't use $(ARFLAGS).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 47508843 07-Oct-2011 Simon Glass <sjg@chromium.org>

Adjust dependency rules to permit per-file flags

The dependency rules are currently done in a shell 'for' loop. This does not
permit Makefile variables to adjust preprocessor flags as is done with normal
compile flags, using the CFLAGS_path/file.o syntax.

This change moves the dependency generation into the Makefile itself, and
permits a CPPFLAGS_path/file.o to adjust preprocessor flags on a file or
directory basis.

The CPPFLAGS_... variable is also folded into CFLAGS during the build.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6262e4e7 25-Apr-2011 Mike Frysinger <vapier@gentoo.org>

disable security warning flags when possible

Some toolchains enable security warning flags by default, but these don't
really make sense in the u-boot world. Such as forcing changes like:
-printf(foo);
+printf("%s", foo);

So disable the flags when the compiler supports them. Linux has already
merged a similar change in their build system.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# c8f9c302 18-Jul-2011 Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

Extend build-system for SPL framework

Signed-off-by: Aneesh V <aneesh@ti.com>
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

# d51dfff7 19-Jun-2011 Ilya Yanok <yanok@emcraft.com>

config.mk: move LDSCRIPT processing to the top-level Makefile

LDSCRIPT is used only from the top-level Makefile and only when the
system is configured so we can move LDSCRIPT and CONFIG_SYS_LDSCRIPT
related logic into the top level Makefile and under configured condition
to avoid errors when building tools from unconfigured tree.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 83b7e2a7 06-Apr-2011 Scott Wood <scottwood@freescale.com>

Handle most LDSCRIPT setting centrally

Currently, some linker scripts are found by common code in config.mk.
Some are found using CONFIG_SYS_LDSCRIPT, but the code for that is
sometimes in arch config.mk and sometimes in board config.mk. Some
are found using an arch-specific rule for looking in CPUDIR, etc.

Further, the powerpc config.mk rule relied on CONFIG_NAND_SPL
when it really wanted CONFIG_NAND_U_BOOT -- which covered up the fact
that not all NAND_U_BOOT builds actually wanted CPUDIR/u-boot-nand.lds.

Replace all of this -- except for a handful of boards that are actually
selecting a linker script in a unique way -- with centralized ldscript
finding.

If board code specifies LDSCRIPT, that will be used.
Otherwise, if CONFIG_SYS_LDSCRIPT is specified, that will be used.

If neither of these are specified, then the central config.mk will
check for the existence of the following, in order:

$(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT)
$(TOPDIR)/$(CPUDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT)
$(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
$(TOPDIR)/$(CPUDIR)/u-boot.lds

Some boards (sc3, cm5200, munices) provided their own u-boot.lds that
were dead code, because they were overridden by a CPUDIR u-boot.lds under
the old powerpc rules. These boards' own u-boot.lds have bitrotted and
no longer work -- these lds files have been removed.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Tested-by: Graeme Russ <graeme.russ@gmail.com>

# 6dc1eceb 22-Feb-2011 Haiying Wang <Haiying.Wang@freescale.com>

Introduce a new linker flag LDFLAGS_FINAL

commit 8aba9dceebb14144e07d19593111ee3a999c37fc
Divides variable of linker flags to LDFLAGS-u-boot and LDFLAGS

breaks the usage of --gc-section to build nand_spl. We still need linker option
--gc-section for every uboot image, not only the main one. LDFLAGS_FINAL passes
the --gc-sections to each uboot image.

To get the proper linker flags, we use LDFLAGS and LDFLAGS_FINAL to replace
PLATFORM_LDFLAGS in the Makefile of each nand_spl board.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>

# 5e987ddf 17-Jan-2011 Joakim Tjernlund <Joakim.Tjernlund@transmode.se>

Top config.mk: add include/config.mk

Seems to me that the top level config.mk should include
the auto generated include/config.mk so that all Makefile's
pickup those definitions.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>

# 8aba9dce 05-Jan-2011 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

Divides variable of linker flags to LDFLAGS-u-boot and LDFLAGS

Linker needs to use the proper endian/bfd flags even when doing partial linking.
LDFLAGS_u-boot sets linker option which is called it when U-boot is built
(u-boot final).
LDFLAGS sets necessary option by partial linking (use in cmd_link_o_target).

CC: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

# 326a6945 15-Dec-2010 Mike Frysinger <vapier@gentoo.org>

config.mk: unify duplicated flag setting

Multiple rules are using the expanded AFLAGS/CFLAGS settings and some are
getting so long that the rules need to be line wrapped. So unify them in
one variable, use that variable in the rule, and then unwrap things. This
makes the actual `make` output nicer as it doesn't have line continuations
in it anymore.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 844f07d8 27-Nov-2010 Wolfgang Denk <wd@denx.de>

Coding Style (white space) cleanup

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 6d8962e8 05-Nov-2010 Sebastien Carlier <sebastien.carlier@gmail.com>

Switch from archive libraries to partial linking

Before this commit, weak symbols were not overridden by non-weak symbols
found in archive libraries when linking with recent versions of
binutils. As stated in the System V ABI, "the link editor does not
extract archive members to resolve undefined weak symbols".

This commit changes all Makefiles to use partial linking (ld -r) instead
of creating library archives, which forces all symbols to participate in
linking, allowing non-weak symbols to override weak symbols as intended.
This approach is also used by Linux, from which the gmake function
cmd_link_o_target (defined in config.mk and used in all Makefiles) is
inspired.

The name of each former library archive is preserved except for
extensions which change from ".a" to ".o". This commit updates
references accordingly where needed, in particular in some linker
scripts.

This commit reveals board configurations that exclude some features but
include source files that depend these disabled features in the build,
resulting in undefined symbols. Known such cases include:
- disabling CMD_NET but not CMD_NFS;
- enabling CONFIG_OF_LIBFDT but not CONFIG_QE.

Signed-off-by: Sebastien Carlier <sebastien.carlier@gmail.com>

# 14d0a02a 07-Oct-2010 Wolfgang Denk <wd@denx.de>

Rename TEXT_BASE into CONFIG_SYS_TEXT_BASE

The change is currently needed to be able to remove the board
configuration scripting from the top level Makefile and replace it by
a simple, table driven script.

Moving this configuration setting into the "CONFIG_*" name space is
also desirable because it is needed if we ever should move forward to
a Kconfig driven configuration system.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# f534c7cd 03-Aug-2010 Mike Frysinger <vapier@gentoo.org>

config.mk: avoid -traditional-cpp on OS X 10.5

Simply trying to include a basic header file like stdlib.h on OS X 10.5
and then building with -traditional-cpp fails with lots of errors like:
In file included from /usr/include/stdlib.h:63,
from test.c:3:
/usr/include/available.h:85: error: stray '#' in program
/usr/include/available.h:85: error: syntax error before numeric constant
/usr/include/available.h:86: error: stray '#' in program

In the past, I hadn't noticed because the old logic for these flags were
restricted to Darwin running on PowerPC systems while I'm running on an
Intel system. But after some recent clean ups and changes, the flag was
being applied to all Darwin systems and my host tools broke.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 1117cbf2 27-May-2010 Thomas Chou <thomas@wytron.com.tw>

nios: remove nios-32 arch

The nios-32 arch is obsolete and broken. So it is removed.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# c7da8c19 22-May-2010 Andreas Bießmann <andreas.devel@googlemail.com>

config.mk: use different host compiler for OS X 10.6

Compiling tools subdirectory on Mac OS X 10.6 (Snow Leopard) complains about
wrong syntax in system includes.

In file included from /usr/include/stdio.h:444,
from ../source/u-boot/include/compiler.h:26,
from ../source/u-boot/lib/crc32.c:15:
/usr/include/secure/_stdio.h:46: error: syntax error in macro parameter list

This can be fixed by reverting the workaround for prior OS X releases in
config.mk conditionally for OS X 10.6+.

Signed-off-by: Andreas Bie�mann <andreas.devel@googlemail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8d1f2682 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

ppc: Move cpu/$CPU to arch/ppc/cpu/$CPU

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# ea0364f1 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Move lib_$ARCH directories to arch/$ARCH/lib

Also move lib_$ARCH/config.mk to arch/$ARCH/config.mk

This change is intended to clean up the top-level directory structure
and more closely mimic Linux's directory organization.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# 89f39e17 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Change directory-specific CFLAGS to use full path

Previously, a specific file or directory could be compiled with custom
CFLAGS by adding a Makefile variable such as:
CFLAGS_dlmalloc.o = <custom flags for common/dlmalloc.c>
or
CFLAGS_lib = <custom flags for lib directory>

This method breaks down once multiple files or directories share the
same path. Eg FLAGS_fileA = <custom flags> would incorrectly result in
both dir1/fileA.c and dir2/fileA.c being compiled with <custom flags>.

This change allows finer grained control which we need once we move
lib_$ARCH to arch/$ARCH/lib/ and lib_generic/ to lib/. Without this
change all lib/ directories would share the same custom CFLAGS.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# 03b7004d 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Create CPUDIR variable

The CPUDIR variable points to the location of a target's CPU directory.
Currently, it is set to cpu/$CPU. However, using $CPUDIR will allow for
more flexibility in the future. It lays the groundwork for reorganizing
U-Boot's directory structure to support a layout such as:

arch/$ARCH/cpu/$CPU/* (architecture with multiple CPU types)
arch/$ARCH/cpu/* (architecture with one CPU type)

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# d984fed0 04-Nov-2009 Scott Wood <scottwood@freescale.com>

makefiles: fixes for building build tools

Currently, some of the tools instead set CC to be HOSTCC in order to re-use
some pattern rules -- but this fails when the user overrides CC on the make
command line. Also, the HOSTCFLAGS in tools/Makefile are currently not
being used because config.mk overwrites them.

This patch adds static pattern rules for files that have been requested to
be built with the native compiler using $(HOSTSRCS) and $(HOSTOBJS), and
converts the tools to use them.

It restores easylogo to using the host compiler, which was broken by commit
38d299c2db81bd889c601b5dfc12c4e83ef83333 (if this was an intentional change,
please let me know -- but it seems to be a build tool).

It restores -pedantic and the special flags for darwin and cygwin that were
requested in tools/makefile (but keeps the flags added by config.mk) --
hopefully someone can test this on those platforms. It no longer
conditionalizes -pedantic on not being darwin; it wasn't clear that that was
intentional, and unless there's a real problem it's just inviting people to
contribute non-pedantic patches to those files (I'm not a fan of -pedantic
personally, but if it's on for one platform it should be on for all).

HOST_LDFLAGS is renamed HOSTLDFLAGS for consistency with the previous
HOST_CFLAGS to HOSTCFLAGS rename. A new HOSTCFLAGS_NOPED is made available
for those files which currently cannot be built with -pedantic, and replaces
the old FIT_CFLAGS.

imls now uses the cross compiler properly, rather than by trying to
reconstruct CC using the typoed $(CROSS_COMPILER).

envcrc.c is now dependency-processed unconditionally -- previously it would
be built without being on (HOST)SRCS if CONFIG_ENV_IS_EMBEDDED was not
selected.

Signed-off-by: Scott Wood <scottwood@freescale.com>

# 6c97a20d 09-Sep-2009 Kumar Gala <galak@kernel.crashing.org>

ppc/85xx: Introduce RESET_VECTOR_ADDRESS to handle non-standard link address

Some board ports place TEXT_BASE at a location that would cause the
RESET_VECTOR_ADDRESS not to be at 0xfffffffc when we link. By default
we assume RESET_VECTOR_ADDRESS will be 0xfffffffc if the board doesn't
explicitly set it.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Wolfgang Denk <wd@denx.de>

# 6ac9f479 23-Aug-2009 Mike Frysinger <vapier@gentoo.org>

start a linker script helper file

Start a common header file for common linker script code (such as
workarounds for older linkers) rather than doing this in the build system.

As fallout, we no longer execute the linker every time config.mk is
included by a build file (which can easily be 70+ times), but rather only
execute it once.

This also fixes a bug in the major version checking by creating a macro to
easily compare versions and keep people from making the same common
mistake (forgetting to check major and minor together).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 1aada9cd 17-Aug-2009 Wolfgang Denk <wd@denx.de>

Fix all linker scripts for older binutils versions (pre-2.16)

Commit f62fb99941c6 fixed handling of all rodata sections by using a
wildcard combined with calls to ld's builtin functions SORT_BY_ALIGNMENT()
and SORT_BY_NAME(). Unfortunately these functions were only
introduced with biunutils version 2.16, so the modification broke
building with all tool chains using older binutils.

This patch makes it work again. This is done by omitting the use of
these functions for such old tool chains. This will result in
slightly larger target binaries, as the rodata sections are no longer
in optimal order alignment-wise which reauls in unused gaps, but the
effect was found to be insignificant - especially compared to the fact
that you cannot build U-Boot at all in the current state.

As ld seems to have no support for conditionals we run the linker
script through the C preprocessor which can be easily used to remove
the unwanted function calls.

Note that the C preprocessor must be run with the "-ansi" (or a
"-std=") option to make sure all the system-specific predefined
macros outside the reserved namespace are suppressed. Otherise, cpp
might for example substitute "powerpc" to "1", thus corrupting for
example "OUTPUT_ARCH(powerpc)" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>

# f772acf8 17-Aug-2009 Wolfgang Denk <wd@denx.de>

ARM: compiler options cleanup - improve tool chain support

For some time there have been repeated reports about build problems
with some ARM (cross) tool chains. Especially issues about
(in)compatibility with the tool chain provided runtime support
library libgcc.a caused to add and support a private implementation
of such runtime support code in U-Boot. A closer look at the code
indicated that some of these issues are actually home-made. This
patch attempts to clean up some of the most obvious problems and make
building of U-Boot with different tool chains easier:

- Even though all ARM systems basicy used the same compiler options
to select a specific ABI from the tool chain, the code for this was
distributed over all cpu/*/config.mk files. We move this one level
up into lib_arm/config.mk instead.

- So far, we only checked if "-mapcs-32" was supported by the tool
chain; if yes, this was used, if not, "-mabi=apcs-gnu" was
selected, no matter if the tool chain actually understood this
option. There was no support for EABI conformant tool chains.
This patch implements the following logic:

1) If the tool chain supports
"-mabi=aapcs-linux -mno-thumb-interwork"
we use these options (EABI conformant tool chain).
2) Otherwise, we check first if
"-mapcs-32"
is supported, and then check for
"-mabi=apcs-gnu"
If one test succeeds, we use the first found option.
3) In case 2), we also test if "-mno-thumb-interwork", and use
this if the test succeeds. [For "-mabi=aapcs-linux" we set
"-mno-thumb-interwork" mandatorily.]

This way we use a similar logic for the compile options as the
Linux kernel does.

- Some EABI conformant tool chains cause external references to
utility functions like raise(); such functions are provided in the
new file lib_arm/eabi_compat.c

Note that lib_arm/config.mk gets parsed several times, so we must
make sure to add eabi_compat.o only once to the linker list.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Dirk Behme <dirk.behme@googlemail.com>
Cc: Magnus Lilja <lilja.magnus@gmail.com>
Cc: Tom Rix <Tom.Rix@windriver.com>
Cc: Prafulla Wadaskar <prafulla@marvell.com>
Acked-by: Sergey Kubushyn <ksi@koi8.net>
Tested-by: Magnus Lilja <lilja.magnus@gmail.com>
Tested-by: Andrzej Wolski <awolski@poczta.fm>
Tested-by: Gaye Abdoulaye Walsimou <walsimou@walsimou.com>
Tested-by: Tom Rix <Tom.Rix@windriver.com>
Tested-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# b220c64d 10-Jul-2009 Peter Tyser <ptyser@xes-inc.com>

Move architecture specific config.mk files into subdirs

This cleans up U-Boot's toplevel directory a bit and makes the
architecture 'config.mk' file naming and location similar to board
and cpu 'config.mk' files

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# cff80f2c 20-Jun-2009 Shinya Kuribayashi <skuribay@pobox.com>

config.mk: Remove unused HPATH

This variable is not unused anywhere.

Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>

# 12e9043c 20-Jun-2009 Shinya Kuribayashi <skuribay@pobox.com>

config.mk: Remove $(PCI_CLOCK) reference

The following commit introduced $(PCI_CLOCK) reference so that
we could tweak `PCI_66M' definition via an environment variable.

> commit f046ccd15c8bc9613bfd72916b761a127d36e5c6
> Author: Eran Liberty <liberty@freescale.com>
> Date: Thu Jul 28 10:08:46 2005 -0500
>
> * Patch by Eran Liberty
> Add support for the Freescale MPC8349ADS board.

But I suggest a removal of it for the following reasons:

* In 2006, MPC8349ADS was merged into MPC8349EMDS port,
and it seems that MPC8349EMDS port is PCI_66M free.

* OTOH, PCI_66M is used by MPC832XEMDS an MPC8360EMDS ports,
but they don't need $(PCI_CLOCK) environment variable at all.
PCI_66M is automatically configured via $(BOARD)_config names
with the help of $(findstring _66_,$@).

* Unfortunately $(PCI_CLOCK) has been undocumented anywhere,
so only a few people know the existence of it these days.

* Keep config.mk independent from $(BOARD) as much as possible.

Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# 31f30c9e 14-Jun-2009 Mike Frysinger <vapier@gentoo.org>

add %.c->%.i and %.c->%.s rules

The Linux kernel has some helper rules which allow you to quickly produce
some of the intermediary files from C source. Specifically, you can
create .i files which is the preprocessed output and you can create .s
files which is the assembler output. This is useful when you are trying
to track down header/macro expansion errors or inline assembly errors.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 5ec5529b 14-Jun-2009 Mike Frysinger <vapier@gentoo.org>

allow boards to customize compiler options on a per-file/dir basis

With our Blackfin boards, we like to build the compression routines with
-O2 as our tests show a pretty good size/speed tradeoff. For the rest of
U-Boot though, we want to stick with the default -Os as that is mostly
control code. So in our case, we would add a line like so to the board
specific config.mk file:
CFLAGS_lib_generic += -O2

Now all files under lib_generic/ will have -O2 appended to their build.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 3112030a 22-May-2009 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

config.mk: remove un-needed REMOTE_BUILD check

as $(obj) is empty when in tree build

%.s: %.S
$(CPP) $(AFLAGS) -o $@ $<

and

$(obj)%.s: %.S
$(CPP) $(AFLAGS) -o $@ $<

are the same

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 4cda4378 17-Jan-2009 Mike Frysinger <vapier@gentoo.org>

build system: treat all Darwin's alike

The x86 based version of Darwin behaves the same quirky way as the powerpc
Darwin, so only check HOSTOS when setting up Darwin workarounds.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 434c51a5 12-Nov-2008 Peter Tyser <ptyser@xes-inc.com>

Remove unneeded CONFIG_SHELL references

Make should be using the bash shell by default which makes
CONFIG_SHELL unnecessary

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# 03db5333 11-Sep-2008 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

make: Remove redundant __ARM__ addition when cross-compiling on *BSD

__ARM__ is given by arm_config.mk automatically.

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

# 6b971c73 30-Aug-2008 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

config.mk: Move arch-specific condition to $(ARCH)_config.mk

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

# 28eab0d7 18-May-2008 Haavard Skinnemoen <hskinnemoen@atmel.com>

Conditionally add -fno-stack-protector to CFLAGS

When compile-testing on powerpc, I get errors like this:

net/nfs.c:422: undefined reference to `__stack_chk_fail_local'

This seems to be because -fstack-protector is on by default, so
let's explicitly disable it on all architectures that support the
option.

The Ubuntu toolchain is affected by this problem, and according to
Mike Frysinger, Gentoo has been running with SSP enabled for years.
More and more distros are turning SSP on by default, so this problem
is likely to get worse in the future.

Also, powerpc just happens to be one of the arches I do
compile-testing on. There may be other arches affected by this too.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>

# 53677ef1 20-May-2008 Wolfgang Denk <wd@denx.de>

Big white-space cleanup.

This commit gets rid of a huge amount of silly white-space issues.
Especially, all sequences of SPACEs followed by TAB characters get
removed (unless they appear in print statements).

Also remove all embedded "vim:" and "vi:" statements which hide
indentation problems.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# c4e5f52a 03-May-2008 Wolfgang Denk <wd@denx.de>

config.mk: use correct (cross) compiler

Some config.mk files reference $(CC) to test for specific tool chain
features, so make sure $(CC) gets set before including any such
config files.

This patch replaces commit b7166e05a5 ("ColdFire: Get information from
the correct GCC").

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 755c35f5 18-Feb-2008 Mike Frysinger <vapier@gentoo.org>

include autoconf.mk before any other .mk files

This bumps the autoconf.mk include step above board/cpu/arch/etc... so that
those .mk files can have make if statements based on the current config.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 6f99eec3 14-Feb-2008 Wolfgang Denk <wd@denx.de>

Merge branch 'master' of git://www.denx.de/git/u-boot-blackfin

Conflicts:

Makefile
doc/README.standalone

Signed-off-by: Wolfgang Denk <wd@denx.de>


# 161b2af4 28-Jan-2008 Mike Frysinger <vapier@gentoo.org>

Only use TEXT_BASE if defined by the board

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 94a91e24 04-Feb-2008 Mike Frysinger <vapier@gentoo.org>

generate u-boot.ldr for Blackfin targets

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 2f155f6c 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

[BUILD] Generate include/autoconf.mk from board config files

Use cpp and sed to postprocess config.h and import the defined values
into include/autoconf.mk. autoconf.mk is then included by config.mk to
give 'make' access to the board configuration.

Doing this enables conditional compilation at the Makefile level instead
of by wrapping every .c file with #ifdef/#endif wrappers.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# ad845bee 30-Oct-2007 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

blackfin: Move `-D__BLACKFIN__' to $(ARCH)_config.mk

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

# ef26a08f 08-Mar-2007 Aubrey.Li <aubrey.adi@gmail.com>

[Blackfin][PATCH-2/2] Common files changed to support bf533 platform

# 1954be6e 28-Oct-2006 Wolfgang Denk <wd@pollux.denx.de>

Automatically adjust ARFLAGS so "make -s" is really silent.

# e11887a7 26-Oct-2006 Haavard Skinnemoen <hskinnemoen@atmel.com>

Don't pass any debug options directly to the assembler

When passing the -g option to gcc, gcc automatically selects a
suitable --g<format> option to pass on to the assembler.
Thus, there's no point in forcing a specific debug option on the
assembler using the -Wa mechanism.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>

# 2da2d9a4 24-Oct-2006 Wolfgang Denk <wd@pollux.denx.de>

Use -g instead of -gstabs in AFLAGS_DEBUG
Patch by Haavard Skinnemoen, 30 Aug 2006

In config.mk, -Wa,-gstabs is unconditionally appended to AFLAGS no
matter what the target's preferred debugging format is. This patch
simply replaces -gstabs with -g, so that the default debugging format
for the architecture is used.

# 2b208f53 08-Oct-2006 Wolfgang Denk <wd@atlas.denx.de>

Move "ar" flags to config.mk to allow for silent "make -s"
Based on patch by Mike Frysinger, 20 Jun 2006

# 511d0c72 08-Oct-2006 Wolfgang Denk <wd@atlas.denx.de>

Coding style cleanup

# 887e2ec9 07-Sep-2006 Stefan Roese <sr@denx.de>

Add support for AMCC Sequoia PPC440EPx eval board
- Add support for PPC440EPx & PPC440GRx
- Add support for PPC440EP(x)/GR(x) NAND controller
in cpu/ppc4xx directory
- Add NAND boot functionality for Sequoia board,
please see doc/README.nand-boot-ppc440 for details
- This Sequoia NAND image doesn't support environment
in NAND for now. This will be added in a short while.
Patch by Stefan Roese, 07 Sep 2006

# f9328639 01-Sep-2006 Marian Balakowicz <m8@semihalf.com>

Add support for a saving build objects in a separate directory.
Modifications are based on the linux kernel approach and
support two use cases:

1) Add O= to the make command line
'make O=/tmp/build all'

2) Set environement variable BUILD_DIR to point to the desired location
'export BUILD_DIR=/tmp/build'
'make'

The second approach can also be used with a MAKEALL script
'export BUILD_DIR=/tmp/build'
'./MAKEALL'

Command line 'O=' setting overrides BUILD_DIR environent variable.

When none of the above methods is used the local build is performed and
the object files are placed in the source directory.

# 4176c799 10-Jun-2006 Wolfgang Denk <wd@pollux.denx.de>

Merge with /home/hs/U-Boot/u-boot-dev


# b62fa913 16-May-2006 Marian Balakowicz <m8@semihalf.com>

Fix gcc 3.4.x AFLAGS setting for m68k platform.

# 483a0cf8 09-May-2006 Marian Balakowicz <m8@semihalf.com>

Fixes for gcc 3.4 based m68k toolchain,
based on patch by Jate Sujjavanich.

# 9acb626f 20-Apr-2006 Heiko Schocher <hs@pollux.denx.de>

Add MCF5282 support (without preloader)
relocate ichache_State to ram
u-boot can run from internal flash
Add EB+MCF-EV123 board support.
Add m68k Boards to MAKEALL
Patch from Jens Scharsig, 08 Aug 2005

# 0afe519a 11-Mar-2006 Wolfgang Denk <wd@pollux.denx.de>

Add ADI Blackfin support
- add support for Analog Devices Blackfin BF533 CPU
- add support for the ADI BF533 Stamp uClinux board
- add support for the ADI BF533 EZKit board
Patches by Richard Klingler, June 11th 2005:

# 0be248fa 06-Mar-2006 Wolfgang Denk <wd@atlas.denx.de>

Cleanup (get rid of debug code that sneaked in)

# 00c35bd2 28-Feb-2006 Markus Klotzb�cher <Markus Klotzb�mk@pollux.(none)>

Added GPIO initialization of DF signal. Still not working.

# e0269579 07-Feb-2006 Markus Klotzb�cher <Markus Klotzb�mk@pollux.(none)>

This is the first commit for the u-boot zylonite port. The following has be
done so far:

* created zylonite board dir (based on lubbock)
* extended some - but not all pxa sources and headers for Intel
Monahans support (CONFIG_CPU_MONAHANS)
* created Makefile zylonite target + MAKEALL entry
* added some debug nonsense, remove later, grep for mk@tbd

Status: compiles (eldk-4.0), and can be started with BDI, but runs forever
and doesn't halt at breakpoints. Hmmm...

# 9b880bd4 04-Oct-2005 Wolfgang Denk <wd@pollux.denx.de>

Update ARM Integrator boards:
Correct addessing errors in platform files.
Split off common core module data from Integrator header files to
include/armcoremodule.h.
Patch by Peter Pearse, 04 Oct 2005

# 1820d4c7 04-Oct-2005 Wolfgang Denk <wd@pollux.denx.de>

Make sure only supported compiler options are used
Import "cc-option" shell function from kernel and
use it to get the correct ARM GCC options for individual CPUs
Patch by Peter Pearse, 30 Jun 2005

# f046ccd1 28-Jul-2005 Eran Liberty <liberty@freescale.com>

* Patch by Eran Liberty
Add support for the Freescale MPC8349ADS board.

# 1d9f4105 09-Oct-2004 Wolfgang Denk <wdenk>

Patch by Steven Scholz, 16 Aug 2004:
- Introducing the concept of SoCs "./cpu/$(CPU)/$(SOC)"
- creating subdirs for SoCs ./cpu/arm920t/imx and ./cpu/arm920t/s3c24x0
- moving SoC specific code out of cpu/arm920t/ into cpu/arm920t/$(SOC)/
- moving drivers/s3c24x0_i2c.c and drivers/serial_imx.c out of drivers/
into cpu/arm920t/$(SOC)/

# e4cc71aa 19-May-2004 Wolfgang Denk <wdenk>

Patch by Scott McNutt, 25 Apr 2004:
Add Nios GDB/JTAG Console support:
- Add stubs to support gdb via JTAG.
- Add support for console over JTAG.
- Minor cleanup.

# c40b2956 13-Mar-2004 Wolfgang Denk <wdenk>

* Patch by Rune Torgersen, 27 Feb 2004:
- Added LBA48 support (CONFIG_LBA48 & CFG_64BIT_LBA)
- Added support for 64bit printing in vsprintf (CFG_64BIT_VSPRINTF)
- Added support for 64bit strtoul (CFG_64BIT_STRTOUL)

* Patch by Masami Komiya, 27 Feb 2004:
Fix rarpboot: add autoload by NFS

* Patch by Dan Eisenhut, 26 Feb 2004:
fix flash_write return value in saveenv

* Patch by Stephan Linz, 11 Dec 2003
expand config.mk to avoid trigraph warnings on NIOS

* Rename "BMS2003" board into "HMI10"

# 4aeb251f 16-Sep-2003 Wolfgang Denk <wdenk>

* Modify XLB arbiter priorities on MPC5200 so all devices use same
priority; configure critical interrupts to be handled like external
interrupts

# 27b207fd 24-Jul-2003 Wolfgang Denk <wdenk>

* Implement new mechanism to export U-Boot's functions to standalone
applications: instead of using (PPC-specific) system calls we now
use a jump table; please see doc/README.standalone for details

* Patch by Dave Westwood, 24 Jul 2003:
added support for Unity OS (a proprietary OS)

# b783edae 25-Jun-2003 Wolfgang Denk <wdenk>

* Header file cleanup for ARM

* Patch by Murray Jensen, 24 Jun 2003:
- make sure to use only U-boot provided header files
- fix problems with ".rodata.str1.4" section as used by GCC-3.x

# 592c5cab 20-Jun-2003 Wolfgang Denk <wdenk>

Patch by Murray Jensen, 20 Jun 2003:
- hymod update
- cleanup (especially for gcc-3.x compilers)

# 6dd652fa 19-Jun-2003 Wolfgang Denk <wdenk>

Patches by Murray Jensen, 17 Jun 2003:
- Hymod board database mods: add "who" field and new xilinx chip types
- provide new "init_cmd_timeout()" function so code external to
"common/main.c" can use the "reset_cmd_timeout()" function before
entering the main loop
- add DTT support for adm1021 (new file dtt/adm1021.c; config
slightly different. see include/configs/hymod.h for an example
(requires CONFIG_DTT_ADM1021, CONFIG_DTT_SENSORS, and
CFG_DTT_ADM1021 defined)
- add new "eeprom_probe()" function which has similar args and
behaves in a similar way to "eeprom_read()" etc.
- add 8260 FCC ethernet loopback code (new "eth_loopback_test()"
function which is enabled by defining CONFIG_ETHER_LOOPBACK_TEST)
- gdbtools copyright update
- ensure that set_msr() executes the "sync" and "isync" instructions
after the "mtmsr" instruction in cpu/mpc8260/interrupts.c
- 8260 I/O ports fix: Open Drain should be set last when configuring
- add SIU IRQ defines for 8260
- allow LDSCRIPT override and OBJCFLAGS initialization: change to
config.mk to allow board configurations to override the GNU
linker script, selected via the LDSCRIPT, make variable, and to
give an initial value to the OBJCFLAGS make variable
- 8260 i2c enhancement:
o correctly extends the timeout depending on the size of all
queued messages for both transmit and receive
o will not continue with receive if transmit times out
o ensures that the error callback is done for all queued tx
and rx messages
o correctly detects both tx and rx timeouts, only delivers one to
the callback, and does not overwrite an earlier error
o logic in i2c_probe now correct
- add "vprintf()" function so that "panic()" function can be
technically correct
- many Hymod board changes

# ea909b76 21-Nov-2002 Wolfgang Denk <wdenk>

* Added support for both PCMCIA slots (at the same time!) on MPC8xx

* Patch by Rod Boyce, 21 Nov 2002:
fix PCMCIA on MBX8xx board

* Patch by Pierre Aubert , 21 Nov 2002
Add CFG_CPM_POST_WORD_ADDR to make the offset of the
bootmode word in DPRAM configurable

# 7f6c2cbc 10-Nov-2002 Wolfgang Denk <wdenk>

* Vince Husovsky, 7 Nov 2002:
Add "-n" to linker options to get rid of "Not enough room for
program headers" problem

* Patch by David M�ller, 05 Nov 2002
Rename CONFIG_PLL_INPUT_FREQ to CONFIG_SYS_CLK_FREQ
so we can use an already existing name

* Patch by Pierre Aubert, 05 Nov 2002
Hardware related improvements in FDC boot code

* Patch by Holger Schurig, 5 Nov 2002:
Make the PXA really change it's frequency

* Patch by Pierre Aubert, 05 Nov 2002
Add support for slave serial Spartan 2 FPGAs

* Fix uninitialized memory (MAC address) in 8xx SCC/FEC ethernet
drivers

# e2211743 02-Nov-2002 Wolfgang Denk <wdenk>

Initial revision

# 18138ab2 06-May-2020 Trevor Woerner <twoerner@gmail.com>

rename symbol: CONFIG_TEGRA -> CONFIG_ARCH_TEGRA

Have this symbol follow the pattern of all other such symbols.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>

# 587e4a42 27-Mar-2020 Tom Rini <trini@konsulko.com>

kconfig / kbuild: Re-sync with Linux 4.19

Align Kconfig and Kbuild logic to Linux 4.19 release with minimal impact
on files outside of this scope.

Our previous Kconfig sync was done by commit 5972ff077e0f ("kconfig /
kbuild: re-sync with Linux 4.18").

In this particular re-sync in order to keep clang support working a
number of related changes needed to be pulled in that had been missed
previously. Not all of these changes we easily traceable and so have
been omitted from the list below.

The imported Linux commits are:
[From prior to v4.18]
9f3f1fd29976 kbuild: Add __cc-option macro
d7f14c66c273 kbuild: Enable Large File Support for hostprogs
6d79a7b424a5 kbuild: suppress warnings from 'getconf LFS_*'
24403874316a Shared library support
86a9df597cdd kbuild: fix linker feature test macros when cross compiling with Clang
0294e6f4a000 kbuild: simplify ld-option implementation

[From v4.18 to v4.19]
96f14fe738b6 kbuild: Rename HOSTCFLAGS to KBUILD_HOSTCFLAGS
10844aebf448 kbuild: Rename HOSTCXXFLAGS to KBUILD_HOSTCXXFLAGS
b90a368000ab kbuild: Rename HOSTLDFLAGS to KBUILD_HOSTLDFLAGS
8377bd2b9ee1 kbuild: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS
f92d19e0ef9b kbuild: Use HOST*FLAGS options from the command line
4ab3b80159d4 kconfig: check for pkg-config on make {menu,n,g,x}config
693359f7ac90 kconfig: rename SYMBOL_AUTO to SYMBOL_NO_WRITE
f60b992e30ff kbuild: replace $(LDFLAGS) $(ldflags-y) with $(ld_flags)
2fb9279f2c3e kbuild: change ld_flags to contain LDFLAGS_$(@F)
c931d34ea085 arm64: build with baremetal linker target instead of Linux when available
5accd7f3360e kconfig: handle format string before calling conf_message_callback()
a2ff4040151a kconfig: rename file_write_dep and move it to confdata.c
0608182ad542 kconfig: split out useful helpers in confdata.c
adc18acf42a1 kconfig: remove unneeded directory generation from local*config
79123b1389cc kconfig: create directories needed for syncconfig by itself
16952b77d8b5 kconfig: make syncconfig update .config regardless of sym_change_count
d6c6ab93e17f kbuild: remove deprecated host-progs variable
56869d45e364 kconfig: fix the rule of mainmenu_stmt symbol
c151272d1687 kconfig: remove unused sym_get_env_prop() function
1880861226c1 kconfig: remove P_ENV property type
e3fd9b5384f3 scripts/dtc: consolidate include path options in Makefile
4bf6a9af0e91 kconfig: add build-only configurator targets
f1575595d156 kconfig: error out when seeing recursive dependency
5e8c5299d315 kconfig: report recursive dependency involving 'imply'
f498926c47aa kconfig: improve the recursive dependency report
98a4afbfafd2 kconfig: fix "Can't open ..." in parallel build
9a9ddcf47831 kconfig: suppress "configuration written to .config" for syncconfig
87a32e624037 kbuild: pass LDFLAGS to recordmcount.pl
d503ac531a52 kbuild: rename LDFLAGS to KBUILD_LDFLAGS
217c3e019675 disable stringop truncation warnings for now
bc8d2e20a3eb kconfig: remove a spurious self-assignment
fd65465b7016 kconfig: do not require pkg-config on make {menu,n}config
5a4630aadb9a ftrace: Build with CPPFLAGS to get -Qunused-arguments

Note that this adds new cleanup work to do in that we should adapt the
shared library support we have to what is now upstream.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>

# 1d3b97c9 23-Sep-2018 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

Kbuild: add LDFLAGS_STANDALONE

Introduce a new Makefile variable for passing LDFLAGS to standalone
programs. Currently the variable CONFIG_STANDALONE_LOAD_ADDR is
misued on some archs to pass a specific linker script.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 9865543a 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove CONFIG_USE_STDINT

You do not need to use the typedefs provided by compiler.

Our compilers are either IPL32 or LP64. Hence, U-Boot can/should
always use int-ll64.h typedefs like Linux kernel, whatever the
typedefs the compiler internally uses.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# e020c88a 31-Jul-2015 Simon Glass <sjg@chromium.org>

Allow objcopy to work without filling gaps with 0xff

This is currently done for all targets, since 0xff is the default erased
value for most flash devices. In some cases this is not what we want (e.g.
for EFI images) so provide a command to do a vanilla objcopy.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e02ee254 24-Feb-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: switch to single .config configuration

When Kconfig for U-boot was examined, one of the biggest issues was
how to support multiple images (Normal, SPL, TPL). There were
actually two options, "single .config" and "multiple .config".
After some discussions and thought experiments, I chose the latter,
i.e. to create ".config", "spl/.config", "tpl/.config" for Normal,
SPL, TPL, respectively.

It is true that the "multiple .config" strategy provided us the
maximum flexibility and helped to avoid duplicating CONFIGs among
Normal, SPL, TPL, but I have noticed some fatal problems:

[1] It is impossible to share CONFIG options across the images.
If you change the configuration of Main image, you often have to
adjust some SPL configurations correspondingly. Currently, we
cannot handle the dependencies between them. It means one of the
biggest advantages of Kconfig is lost.

[2] It is too painful to change both ".config" and "spl/.config".
Sunxi guys started to work around this problem by creating a new
configuration target. Commit cbdd9a9737cc (sunxi: kconfig: Add
%_felconfig rule to enable FEL build of sunxi platforms.) added
"make *_felconfig" to enable CONFIG_SPL_FEL on both images.
Changing the configuration of multiple images in one command is a
generic demand. The current implementation cannot propose any
good solution about this.

[3] Kconfig files are getting ugly and difficult to understand.
Commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN to
Kconfig) has sprinkled "if !SPL_BUILD" over the Kconfig files.

[4] The build system got more complicated than it should be.
To adjust Linux-originated Kconfig to U-Boot, the helper script
"scripts/multiconfig.sh" was introduced. Writing a complicated
text processor is a shell script sometimes caused problems.

Now I believe the "single .config" will serve us better. With it,
all the problems above would go away. Instead, we will have to add
some CONFIG_SPL_* (and CONFIG_TPL_*) options such as CONFIG_SPL_DM,
but we will not have much. Anyway, this is what we do now in
scripts/Makefile.spl.

I admit my mistake with my apology and this commit switches to the
single .config configuration.

It is not so difficult to do that:

- Remove unnecessary processings from scripts/multiconfig.sh
This file will remain for a while to support the current defconfig
format. It will be removed after more cleanups are done.

- Adjust some makefiles and Kconfigs

- Add some entries to include/config_uncmd_spl.h and the new file
scripts/Makefile.uncmd_spl. Some CONFIG options that are not
supported on SPL must be disabled because one .config is shared
between SPL and U-Boot proper going forward. I know this is not
a beautiful solution and I think we can do better, but let's see
how much we will have to describe them.

- update doc/README.kconfig

More cleaning up patches will follow this.

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

# 0d296cc2 15-Oct-2014 Gabe Black <gabeblack@chromium.org>

Provide option to avoid defining a custom version of uintptr_t.

There's a definition in stdint.h (provided by gcc) which will be more correct
if available.

Define CONFIG_USE_STDINT to use this feature, or USE_STDINT=1 on the 'make'
commmand.

This adjusts the settings for x86 and sandbox, with both have 64-bit options.

Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@google.com>
Rewritten to be an option, since stdint.h is often available only in glibc.
Changed to preserve a clear boundary between stdint and non-stdint
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5b3ee386 20-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: clear VENDOR variable to fix build error on tcsh

Since the environment "VENDOR" is set in tcsh, it must be cleared in our
makefile. Otherwise, boards without CONFIG_SYS_VENDOR fail to build:

> make CROSS_COMPILE=arm-linux-gnueabi- wandboard_quad_defconfig all
[ snip ]
AR arch/arm/lib/lib.a
CC arch/arm/lib/eabi_compat.o
scripts/Makefile.build:55: /home/foo/u-boot/board/unknown/wandboard/ \
Makefile: No such file or directory
make[2]: *** No rule to make target `/home/foo/u-boot/board/unknown/ \
wandboard/Makefile'. Stop.
make[1]: *** [board/unknown/wandboard] Error 2
make: *** [__build_one_by_one] Error 2

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reported-by: Tom Everett <tom@khubla.com>
Reported-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# b8450521 14-Sep-2014 Simon Glass <sjg@chromium.org>

Reactivate the tracing feature

This was lost sometime in the Kbuild conversion. Add it back.

Check that the trace test now passes:

$ ./test/trace/test-trace.sh
Simple trace test / sanity check using sandbox

/tmp/filemHKPGw
Build sandbox
O=sandbox FTRACE=1
GEN /home/sjg/c/src/third_party/u-boot/files/sandbox/Makefile
Configuring for sandbox board...
Check results
Test passed

Signed-off-by: Simon Glass <sjg@chromium.org>

# 51148790 29-Jul-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

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: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a8b0f9b6 24-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

build: define CPU only when arch/${ARCH}/cpu/${CPU} exists

The directory arch/${ARCH}/cpu/${CPU} does not exist
in avr32, blackfin, microblaze, nios2, openrisc, sandbox, x86.

These architectures have only one CPU type.
Defining CPU should not be required for such architectures.

This commit allows cpu field (= the 3rd field of boards.cfg)
to be kept blank.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Andreas Bießmann <andreas.devel@googlemail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Sonic Zhang <sonic.zhang@analog.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>

# 01286329 10-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: rename SRCTREE to srctree

Prior to Kbuild, $(TOPDIR) or $(SRCTREE) was used for
pointing to the top of source directory.
(No difference between the two.)

In Kbuild style, $(srctree) is used for instead.
This commit renames SRCTREE to srctree and deletes the
defition of SRCTREE.

Note that SRCTREE in scripts/kernel-doc, scripts/docproc.c,
doc/DocBook/Makefile should be keep.

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

# 4379ac61 10-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: rename TOPDIR to stctree

Prior to Kbuild, $(TOPDIR) or $(SRCTREE) was used for
pointing to the top of source directory.
(No difference between the two.)

In Kbuild style, $(srctree) is used instead.
This commit renames TOPDIR to srctree and delete the
defition of TOPDIR.

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

# 026f9cf2 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: improve Kbuild speed

Kbuild brought about many advantages for us but a significant
performance regression was reported by Simon Glass.

After some discussions and analysis, it turned out
its main cause is in $(call cc-option,...).

Historically, U-Boot parses all config.mk
(arch/*/config.mk and board/*/config.mk)
every time descending into subdirectories.
That means cc-options are evaluated over and over again.

$(call cc-option,...) is useful but costly.
So we want to evaluate them only in ./Makefile
and spl/Makefile and export compiler flags.

This commit changes the build system as follows:

- Modify scripts/Makefile.build to not include config.mk
Instead, add $(PLATFORM_CPPFLAGS) to asflags-y, ccflags-y,
cppflags-y.

- Export many variables
Going forward, Kbuild will not parse config.mk files
when it descends into subdirectories.
If we want to set variables in config.mk and use them
in subdirectories, they must be exported.

This is the list of variables to get exported:
PLATFORM_CPPFLAGS
CPUDIR
BOARDDIR
OBJCOPYFLAGS
LDFLAGS
LDFLAGS_FINAL
(used in nand_spl/board/*/*/Makefile)
CONFIG_STANDALONE_LOAD_ADDR
(used in examples/standalone/Makefile)
SYM_PREFIX
(used in examples/standalone/Makefile)
RELFLAGS
(used in examples/standalone/Makefile)

- Delete CPPFLAGS
This variable has been replaced with PLATFORM_CPPFLAGS

- Copy gcclibdir from example/standalone/Makefile
to arch/sparc/config.mk
The reference in CONFIG_STANDALONE_LOAD_ADDR must be
resolved before it is exported.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reported-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> [on Sandbox]
Tested-by: Stephen Warren <swarren@nvidia.com> [on Tegra]

# 33a02da0 03-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: allow empty board directories

U-Boot has compelled all boards to have
board/${BOARD}/ or board/${VENDOR}/${BOARD}/ directory.

Sometimes it does not seem suitable for some boards,
for example Sandbox. (Is it a board?)

And arcangel4 board has nothing to compile
under the board directory.

This commit makes the build system more flexible:
If '<none>' is given to the 6th column (=Board name) of boards.cfg,
Kbuild will not descend into the board directory.

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

# 57181573 25-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

config.mk: Delete unused variable BCURDIR

This variable was abolished by Kbuild series.
I forgot to delete it.

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

# 95ddcd68 23-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: rename OBJCFLAGS to OBJCOPYFLAGS

Rename OBJCFLAGS to OBJCOPYFLAGS beforehand to use
"cmd_objcopy" in scripts/Makefile.lib in an upcoming commit.

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

# 01072b44 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: move include directives of board configuration files

This commit changes the location of include directives
of board configuration files.

The purpose of this change is:
- Slim down $(TOPDIR)/config.mk
- Prevent $(TOPDIR)/Makefile from including the same
configuration file twice
- Do not include include/config.mk multiple times
because ARCH, CPU, BOARD, VENDOR, SOC are exported

Before this commit:

- include/autoconf.mk was included from $(TOPDIR)/Makefile
and $(TOPDIR)/config.mk
(This means $(TOPDIR)/Makefile included include/autoconf.mk twice)

- include/{spl,tpl}-autoconf.mk was included from $(TOPDIR)/config.mk

- include/config.mk was included from $(TOPDIR)/Makefile
and $(TOPDIR)/config.mk
(This means $(TOPDIR)/Makefile included include/config.mk twice)

After this commit:

- include/autoconf.mk is included from $(TOPDIR)/Makefile
and $(TOPDIR)/scripts/Makefile.build

- include/{spl,tpl}-autoconf.mk is included from $(TOPDIR)/spl/Makefile
and $(TOPDIR)/scripts/Makefile.build

- include/config.mk is included from $(TOPDIR)/config.mk and
$(TOPDIR)/spl/Makefile

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

# 6825a95b 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: use Linux Kernel build scripts

Now we are ready to switch over to real Kbuild.

This commit disables temporary scripts:
scripts/{Makefile.build.tmp, Makefile.host.tmp}
and enables real Kbuild scripts:
scripts/{Makefile.build,Makefile.host,Makefile.lib}.

This switch is triggered by the line in scripts/Kbuild.include
-build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj
+build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj

We need to adjust some build scripts for U-Boot.
But smaller amount of modification is preferable.

Additionally, we need to fix compiler flags which are
locally added or removed.

In Kbuild, it is not allowed to change CFLAGS locally.
Instead, ccflags-y, asflags-y, cppflags-y,
CFLAGS_$(basetarget).o, CFLAGS_REMOVE_$(basetarget).o
are prepared for that purpose.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>

# 9e414032 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: change out-of-tree build

This commit changes the working directory
where the build process occurs.

Before this commit, build process occurred under the source
tree for both in-tree and out-of-tree build.

That's why we needed to add $(obj) prefix to all generated
files in makefiles like follows:
$(obj)u-boot.bin: $(obj)u-boot

Here, $(obj) is empty for in-tree build, whereas it points
to the output directory for out-of-tree build.

And our old build system changes the current working directory
with "make -C <sub-dir>" syntax when descending into the
sub-directories.

On the other hand, Kbuild uses a different idea
to handle out-of-tree build and directory descending.

The build process of Kbuild always occurs under the output tree.
When "O=dir/to/store/output/files" is given, the build system
changes the current working directory to that directory and
restarts the make.

Kbuild uses "make -f $(srctree)/scripts/Makefile.build obj=<sub-dir>"
syntax for descending into sub-directories.
(We can write it like "make $(obj)=<sub-dir>" with a shorthand.)
This means the current working directory is always the top
of the output directory.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>

# d9580025 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move some flags to examples makefiles

This commit moves some flags which are used
under examples/ directory only.

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

# e0d5d9f8 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move some flags to spl/Makefile

Some flags are used for SPL (and TPL) build only.
This commit moves them from config.mk to spl/Makefile.

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

# ced0715d 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move more stuff to top Makefile

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

# fea1ca8e 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: refactor include path settings

This commit merges commonly-used header include paths
to UBOOTINCLUDE and NOSTDINC_FLAGS variables, which are placed
at the top Makefile.

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

# 2b3c9d3d 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move more flags to the top Makefile

Before this commit, most of compiler flags were defined in config.mk.
But it is redundant because config.mk is included from all recursive make.

This commit moves many complier flags to the top Makefile
and export them.
And we use new vaiarables to store them:
KBUILD_CPPFLAGS, KBUILD_CFLAGS, KBUILD_AFLAGS.
This will allow us to switch more smoothly to Kbuild.

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

# bf4b3de1 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: Use Kbuild.include

This commit adjusts some files to use Kbuild.include.

- Use cc-option defined in Kbuild.include
(Delete cc-option in config.mk)
- Use cc-version defined in
(Delete cc-version in config.mk)
- Move binutils-version and dtc-version to Kbuild.include
by analogy to cc-version

This commit also adds srctree (same as SRCTREE)
to use Kbuild scripts.

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

# 34bd0507 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move BFD_ROOT_DIR to tools/gdb/Makefile

BFD_ROOT_DIR is used only in tools/gdb/Makefile

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

# f6322eb7 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move some variable definitions to the top Makefile

This commit moves some variable definitions from config.mk
to the top Makefile:

- HOSTCC, HOSTCFLAGS, HOSTLDFLAGS
- AS, LD, CC, CPP, etc.
- SHELL (renamed to CONFIG_SHELL)

I'd like to slim down config.mk file
because it is included from all recursive make.
It is redundant to re-define the variables
every time descending into sub directories.
We should rather define them at the top Makefile
and export them.

U-Boot makefiles has been used "SHELL" variable to store shell
chosen for the user, whereas Linux Kernel uses "CONFIG_SHELL".

We should never use "SHELL" variable because it is
a special variable for GNU Make.
Changing SHELL may cause unpredictable side effects
whose root cause is usually difficult to find.
We should use a generic variable name "CONFIG_SHELL".

We should not use the syntax as follows either:

rm -f $(obj)tools/env/{fw_printenv,fw_setenv}

This depends on "bash" although GNU Make generally
invokes "sh" to run the each rule.

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

# 5651ccff 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makfile: move suffix rules to Makefile.build

This commit moves suffix rules from config.mk
to scripts/Makefile.build, which will allow us
to switch smoothly to real Kbuild.

Note1:
post/lib_powerpc/fpu/Makefile has
its own rule to compile C sources.
We need to tweak it to keep the same behavior.

Note2:
There are two file2 with the same name:
arch/arm/lib/crt0.S and eamples/api/crt0.S.
To keep the same build behavior,
examples/api/Makefile also has to be treaked.

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

# 940db16d 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

tools: convert makefiles to kbuild style

Before this commit, makefiles under tools/ directory
were implemented with their own way.

This commit refactors them by using "hostprogs-y" variable.

Several C sources have been added to wrap other C sources
to simplify Makefile.
For example, tools/crc32.c includes lib/crc32.c

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

# 3d83efbc 26-Nov-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

sandbox: Use system headers first for sandbox's os.c in a different way

Commit cbe5cdfcd changed config.mk and arch/sandbox/cpu/Makefile
to use -idirafter instead of -I and remove -nostdinc.

But
* Sandbox-specific code dirties config.mk
* os.c is compiled without such compiler flags as:
-Wall -Wstrict-prototypes -Wno-format-security
-fno-builtin -ffreestanding -fno-stack-protector
-fstack-usage -Wno-format-nonliteral

This commit use -idirafter and remove the -nostdinc
differently and more simply.

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

# dd88ab32 28-Nov-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: Move some scripts imported from Linux

We have some scripts imported from Linux Kernel:
setlocalversion, checkstack.pl, checkpatch.pl, cleanpatch

They are located under tools/ directory in U-Boot now.
But they were originally located under scripts/ directory
in Linux Kernel.

This commit moves them to the original location.

It is true that binutils-version.sh and dtc-version.sh
do not originate in Linux Kernel, but they should
be moved by analogy to gcc-version.sh.

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

# cbe5cdfc 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Use system headers first for sandbox's os.c

This file must be compiled with system headers, even if U-Boot has headers
of the same name. The existing solution for this is good enough for libfdt,
but fails when we have headers like stdint.h in U-Boot.

Use -idirafter instead of -I, and remove the -nostdinc and other things
that we don't want for this file. The best way to do this is to keep a
copy of the original flags, rather than trying to filter them later.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 74307f20 10-Nov-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

config.mk: delete unnecessary lines

SPL_BIN is already defined in spl/Makefile
and it is used only in spl/Makefile.

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

# bb02c536 31-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: do not create a symbolic link to arch/${ARCH}/include/asm

In-tree build:
- Do not create a symbolic link
from include/asm to arch/${ARCH}/include/asm
- Add ${SRCTREE}/arch/arm/include into the header search path

Out-of-tree build:
- Do not create a directory ${OBJTREE}/include2
- Do not create a symbolic link
from ${OBJTREE}/include2/asm to ${SRCTREE}/arch/${ARCH}/include/asm
- Add ${SRCTREE}/arch/arm/include into the header search path

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

# 93e14596 04-Oct-2013 Wolfgang Denk <wd@denx.de>

Coding Style cleanup: replace leading SPACEs by TABs

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Drop changes for PEP 4 following python tools]
Signed-off-by: Tom Rini <trini@ti.com>

# 47f75cf2 06-Sep-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm


# 1affd4d4 01-Sep-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

cam_enc_4xx: Move CONFIG_SPL_PAD_TO to a config header

For most boards which define CONFIG_SPL_PAD_TO,
it is defined in config header files.
Currently, there exists only one exception, cam_enc_4xx board.

This patch moves CONFIG_SPL_PAD_TO definition
from board/ait/cam_enc_4xx/config.mk
to include/configs/cam_enc_4xx.h.

With this modification, we can delete a glue code
in the top level config.mk:

ifneq ($(CONFIG_SPL_PAD_TO),)
CPPFLAGS += -DCONFIG_SPL_PAD_TO=$(CONFIG_SPL_PAD_TO)
endif

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Heiko Schocher <hs@denx.de>

# cb4ef5ba 01-Sep-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

config.mk: Delete unnecessary code

Currently no makefiles (board-specific config.mk)
set the following variables:

CONFIG_SPL_TEXT_BASE
CONFIG_UBOOT_PAD_TO
CONFIG_RESET_VECTOR_ADDRESS
CONFIG_TPL_PAD_TO

For all target boards using above macros
they are set in header files (include/configs/*.h),
so we do not need to set them as CPPFLAGS.

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

# 19d829fa 05-Sep-2013 Albert ARIBAUD <albert.u.boot@aribaud.net>

Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'

Conflicts:
drivers/serial/serial.c

The conflict above was a trivial case of adding one init
function in each branch, and manually resolved in merge.


# bce88370 26-Aug-2013 Marek Vasut <marex@denx.de>

ARM: mxs: tools: Add mkimage support for MXS bootstream

Add mkimage support for generating and verifying MXS bootstream.
The implementation here is mostly a glue code between MXSSB v0.4
and mkimage, but the long-term goal is to rectify this and merge
MXSSB with mkimage more tightly. Once this code is properly in
U-Boot, MXSSB shall be deprecated in favor of mkimage-mxsimage
support.

Note that the mxsimage generator needs libcrypto from OpenSSL, I
therefore enabled the libcrypto/libssl unconditionally.

MXSSB: http://git.denx.de/?p=mxssb.git;a=summary

The code is based on research presented at:
http://www.rockbox.org/wiki/SbFileFormat

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>

# 3aa29de0 16-Aug-2013 Ying Zhang <b40530@freescale.com>

TPL : introduce the TPL based on the SPL

Due to the nand SPL on some board(e.g. P1022DS)has a size limit, it can
not be more than 4K. So, the SPL cannot initialize the DDR with the SPD
code. This patch introduces TPL to enable a loader stub that is loaded
by the code from the SPL. It initializes the DDR with the SPD or other
operations.

The TPL's size is sizeable, the maximum size is decided by the memory's
size that TPL runs. It initializes the DDR through SPD code, and copys
final uboot image to DDR. So there are three stage uboot images:
* spl_boot, * tpl_boot, * final uboot image

Signed-off-by: Ying Zhang <b40530@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 39bc12dd 19-Aug-2013 Joel Fernandes <joelf@ti.com>

SPL: Makefile: Build a separate autoconf.mk for SPL

SPL defines CONFIG_SPL_BUILD but this does not percolate to the
autoconf.mk Makefile. As a result the build breaks when
CONFIG_SPL_BUILD is used in the board-specific include header file. With
this, there is a possibility of having a CONFIG option defined in the
header file but not defined in the Makefile causing all kinds of build
failure and problems.

It also messes things for up, for example, when one might want to
undefine options to keep the SPL small and doesn't want to be stuck with
the CONFIG options used for U-boot. Lastly, this also avoids defining
special CONFIG_SPL_ variables for cases where some options are required
in U-boot but not in SPL.

We add a spl-autoconf.mk rule that is generated for SPL with the
CONFIG_SPL_BUILD flag and conditionally include it for SPL builds.

Signed-off-by: Joel Fernandes <joelf@ti.com>
Signed-off-by: Ying Zhang <b40530@freescale.com>

# 501ebdf2 24-Jul-2013 Stephen Warren <swarren@nvidia.com>

Validate dtc is new enough

Subsequent patches assume that dtc supports various recent features.
These are available in dtc 1.4.0. Validate that dtc is at least that
version.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>

# eca3aeb3 21-Jun-2013 Wolfgang Denk <wd@denx.de>

Licenses: introduce SPDX Unique Lincense Identifiers

Like many other projects, U-Boot has a tradition of including big
blocks of License headers in all files. This not only blows up the
source code with mostly redundant information, but also makes it very
difficult to generate License Clearing Reports. An additional problem
is that even the same lincenses are referred to by a number of
slightly varying text blocks (full, abbreviated, different
indentation, line wrapping and/or white space, with obsolete address
information, ...) which makes automatic processing a nightmare.

To make this easier, such license headers in the source files will be
replaced with a single line reference to Unique Lincense Identifiers
as defined by the Linux Foundation's SPDX project [1]. For example,
in a source file the full "GPL v2.0 or later" header text will be
replaced by a single line:

SPDX-License-Identifier: GPL-2.0+

We use the SPDX Unique Lincense Identifiers here; these are available
at [2].

Note: From the legal point of view, this patch is supposed to be only
a change to the textual representation of the license information,
but in no way any change to the actual license terms. With this patch
applied, all files will still be licensed under the same terms they
were before.

Note 2: The apparent difference between the old "COPYING" and the new
"Licenses/gpl-2.0.txt" only results from switching to the upstream
version of the license which is differently formatted; there are not
any actual changes to the content.

Note 3: There are some recurring questions about linense issues, such
as:
- Is a "All Rights Reserved" clause a problem in GPL code?
- Are files without any license header a problem?
- Do we need license headers at all?

The following excerpt from an e-mail by Daniel B. Ravicher should help
with these:

| Message-ID: <4ADF8CAA.5030808@softwarefreedom.org>
| Date: Wed, 21 Oct 2009 18:35:22 -0400
| From: "Daniel B. Ravicher" <ravicher@softwarefreedom.org>
| To: Wolfgang Denk <wd@denx.de>
| Subject: Re: GPL and license cleanup questions
|
| Mr. Denk,
|
| Wolfgang Denk wrote:
| > - There are a number of files which do not include any specific
| > license information at all. Is it correct to assume that these files
| > are automatically covered by the "GPL v2 or later" clause as
| > specified by the COPYING file in the top level directory of the
| > U-Boot source tree?
|
| That is a very fact specific analysis and could be different across the
| various files. However, if the contributor could reasonably be expected
| to have known that the project was licensed GPLv2 or later at the time
| she made her contribution, then a reasonably implication is that she
| consented to her contributions being distributed under those terms.
|
| > - Do such files need any clean up, for example should we add GPL
| > headers to them, or is this not needed?
|
| If the project as a whole is licensed under clear terms, you need not
| identify those same terms in each file, although there is no harm in
| doing so.
|
| > - There are other files, which include both a GPL license header
| > _plus_ some copyright note with an "All Rights Reserved" clause. It
| > has been my understanding that this is a conflict, and me must ask
| > the copyright holders to remove such "All Rights Reserved" clauses.
| > But then, some people claim that "All Rights Reserved" is a no-op
| > nowadays. License checking tools (like OSLC) seem to indicate this is
| > a problem, but then we see quite a lot of "All rights reserved" in
| > BSD-licensed files in gcc and glibc. So what is the correct way to
| > deal with such files?
|
| It is not a conflict to grant a license and also reserve all rights, as
| implicit in that language is that you are reserving all "other" rights
| not granted in the license. Thus, a file with "Licensed under GPL, All
| Rights Reserved" would mean that it is licensed under the GPL, but no
| other rights are given to copy, modify or redistribute it.
|
| Warm regards,
| --Dan
|
| Daniel B. Ravicher, Legal Director
| Software Freedom Law Center (SFLC) and Moglen Ravicher LLC
| 1995 Broadway, 17th Fl., New York, NY 10023
| (212) 461-1902 direct (212) 580-0800 main (212) 580-0898 fax
| ravicher@softwarefreedom.org www.softwarefreedom.org

[1] http://spdx.org/
[2] http://spdx.org/licenses/

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 971c450a 17-Jul-2013 Simon Glass <sjg@chromium.org>

mkimage: Use board config to get CONFIG_FIT_SIGNATURE value

The value of this config variable is not available to image.h on the host,
since the board config is not actually included. Bring this in so that
mkimage will be built with image-signing support for sandbox at least.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 29ce737d 27-Jun-2013 Simon Glass <sjg@chromium.org>

mkimage: Build signing only if board has CONFIG_FIT_SIGNATURE

At present mkimage is set up to always build with image signing support.
This means that the SSL libraries (e.g. libssl-dev) are always required.

Adjust things so that mkimage can be built with and without image signing,
controlled by the presence of CONFIG_FIT_SIGNATURE in the board config file.

If CONFIG_FIT_SIGNATURE is not enabled, then mkimage will report a warning
that signing is not supported. If the option is enabled, but libraries are
not available, then a build error similar to this will be shown:

lib/rsa/rsa-sign.c:26:25: fatal error: openssl/rsa.h: No such file or directory

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19c402af 13-Jun-2013 Simon Glass <sjg@chromium.org>

image: Add RSA support for image signing

RSA provides a public key encryption facility which is ideal for image
signing and verification.

Images are signed using a private key by mkimage. Then at run-time, the
images are verified using a private key.

This implementation uses openssl for the host part (mkimage). To avoid
bringing large libraries into the U-Boot binary, the RSA public key
is encoded using a simple numeric representation in the device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5c2aeac5 11-Jun-2013 Simon Glass <sjg@chromium.org>

Support tracing in config.mk when enabled

Use -finstrument-functions when tracing is enabled (make FTRACE=1).
Tracing is not currently supported by SPL even if sufficient memory is
available.

When tracing is enabled, we #define FTRACE. This can be used by
board config files to conditionally enable the tracing options.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d642c467 27-Apr-2013 Marek Vasut <marex@denx.de>

build: Pull -DBUILD_TAG into separate ifdef

Currently the base setting for CFLAGS is split in two possibilities,
one with -DBUILD_TAG appended at the end and one without, the rest of
CFLAGS is the same in both cases. Change this so CFLAGS are always set
and the -DBUILD_TAG is appended in separate ifdef.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Tom Rini <trini@ti.com>
Reviewed-by: Otavio Salvador <otavio@ossystems.com.br>

# fada9e20 20-Apr-2013 Simon Glass <sjg@chromium.org>

Trigger generic board error only when building

At present the generic board error can occur when configuring U-Boot, or
during distclean, but this is incorrect. The existing autoconf.mk may come
from an earlier U-Boot configuration which is about to be overwritten.

Make the error conditional so that it will only be triggered when we are
actually building U-Boot.

This avoids a problem where the system is being reconfigured to remove
CONFIG_SYS_GENERIC_BOARD on an architecture that does not support it.
Currently this will print an error and require the manual removal of
include/autoconf.mk.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ecddccd0 22-Feb-2013 Stefan Roese <sr@denx.de>

Makefile: Add target for combined u-boot.img & spl/u-boot.bin

This new make target "u-boot-img-spl-at-end.bin" consists of the
the real, full-blown U-Boot image and the U-Boot SPL binary
directly attached to it. The full-blown U-Boot image has the
mkimage header included, with its load-address and entry-point.

This will be used by the upcoming lwmon5 PPC440EPx derivate board
port.

Signed-off-by: Stefan Roese <sr@denx.de>

# 120ae609 11-Apr-2013 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Makefile: Move SHELL setup to config.mk

make never uses the SHELL variable from the environment. Instead, it
uses /bin/sh, or the value assigned to the SHELL variable by the Makefile. This
makes the export of the SHELL variable useless for sub-makes (but still useful
for the environment of recipes). However, we want all makes to use the same
shell.

This patch fixes this issue by moving the SHELL variable setup and export to the
top config.mk, so that all Makefile-s including it use the same shell.

Since BASH is used by default, this makes it possible to use things
like 'echo -e ...' in sub-makes, which would otherwise fail e.g. with /bin/sh
symlinked to /bin/dash on Ubuntu.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 0ce033d2 17-Mar-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Albert's rework of the linker scripts conflicted with Simon's making
everyone use __bss_end. We also had a minor conflict over
README.scrapyard being added to in mainline and enhanced in
u-boot-arm/master with proper formatting.

Conflicts:
arch/arm/cpu/ixp/u-boot.lds
arch/arm/cpu/u-boot.lds
arch/arm/lib/Makefile
board/actux1/u-boot.lds
board/actux2/u-boot.lds
board/actux3/u-boot.lds
board/dvlhost/u-boot.lds
board/freescale/mx31ads/u-boot.lds
doc/README.scrapyard
include/configs/tegra-common.h

Build tested for all of ARM and run-time tested on am335x_evm.

Signed-off-by: Tom Rini <trini@ti.com>


# 5c1a7ea6 08-Mar-2013 Simon Glass <sjg@chromium.org>

__HAVE_ARCH_GENERIC_BOARD controls availabilty of generic board

We are introducing a new unified board setup. Add a check to make sure that
board config files do not define CONFIG_SYS_GENERIC_BOARD unless their
architecture defines __HAVE_ARCH_GENERIC_BOARD

__HAVE_ARCH_GENERIC_BOARD will currently not be the default setting, but
we can switch this later when most architecture support generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ef123c52 24-Feb-2013 Albert ARIBAUD <albert.u.boot@aribaud.net>

Refactor linker-generated arrays

Refactor linker-generated array code so that symbols
which were previously linker-generated are now compiler-
generated. This causes relocation records of type
R_ARM_ABS32 to become R_ARM_RELATIVE, which makes
code which uses LGA able to run before relocation as
well as after.

Note: this affects more than ARM targets, as linker-
lists span possibly all target architectures, notably
PowerPC.

Conflicts:
arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
arch/arm/cpu/arm926ejs/spear/u-boot-spl.lds
arch/arm/cpu/armv7/omap-common/u-boot-spl.lds
board/ait/cam_enc_4xx/u-boot-spl.lds
board/davinci/da8xxevm/u-boot-spl-da850evm.lds
board/davinci/da8xxevm/u-boot-spl-hawk.lds
board/vpac270/u-boot-spl.lds

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 97b24d3d 18-Oct-2012 Marek Vasut <marex@denx.de>

common: Add symbol handling for generic lists into Makefile

This patch adds essential components for generation of the contents of
the linker section that is used by the linker-generated array. All of
the contents is held in a separate file, u-boot.lst, which is generated
at runtime just before U-Boot is linked.

The purpose of this code is to especially generate the appropriate
boundary symbols around each subsection in the section carrying the
linker-generated arrays. Obviously, the interim linker code for actual
placement of the variables into the section is generated too. The
generated file, u-boot.lst, is included into u-boot.lds via the linker
INCLUDE directive in u-boot.lds .

Adjustments are made in the Makefile and spl/Makefile so that the
u-boot.lds and u-boot-spl.lds depend on their respective .lst files.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@gmail.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Tested-by: Joe Hershberger <joe.hershberger@ni.com>

# 4ab64933 20-Sep-2012 Kim Phillips <kim.phillips@freescale.com>

add check infrastructure, default sparse

Add support for running source code checkers on u-boot source, e.g.,
using sparse to aid with typechecking. This comes in especially
handy as SoC vendors mix and match cores and devices with different
endianness, thus here we add CHECK_ENDIAN to the otherwise linux
kernel default CHECKFLAGS.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

# c1f5805a 14-Sep-2012 Marek Vasut <marex@denx.de>

serial: Compile drivers/serial/serial.c by default

Compile drivers/serial/serial.c by default both into SPL and into
non-SPL builds, since CONFIG_SERIAL_MULTI is now the default state.
Also having common/serial.c in by default now, it's pointless to keep
-DCONFIG_SERIAL_MULTI in CPPFLAGS any longer, so remove it as well.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>

# 82dda962 14-Sep-2012 Marek Vasut <marex@denx.de>

serial: Unconditionally enable CONFIG_SERIAL_MULTI

Enable CONFIG_SERIAL_MULTI for all builds of U-Boot. That includes
both SPL builds and non-SPL builds, everything. To avoid poluting
this patch with removal of ifdef-endif constructions containing
CONFIG_SERIAL_MULTI, the CONFIG_SERIAL_MULTI is temporarily added
into CPPFLAGS in config.mk . This will be again removed in following
patch.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>

# 2051ff34 15-Aug-2012 Allen Martin <amartin@nvidia.com>

tools, config.mk: add binutils-version

Modeled after gcc-version, add function to get binutils version.

Signed-off-by: Allen Martin <amartin@nvidia.com>
Acked-by: Wolfgang Denk <wd@denx.de>

# 7cb714a5 02-Aug-2012 Khem Raj <raj.khem@gmail.com>

config: Always use GNU ld

This patch makes sure that we always use the GNU ld. U-Boot uses certain
construct e.g. OVERLAY which are not implemented in gold therefore it
always needs GNU ld for linking.

It works well if default linker in toolchain is GNU ld but in some
cases we can have gold to be the default linker and also ship GNU ld
but not as default in such cases its called $(PREFIX)ld.bfd, with this
patch we make sure that if $(PREFIX)ld.bfd exists than we use that for
our ld.

This way it does not matter what the default ld is.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 94aebe6c 05-Jan-2012 Stefan Roese <sr@denx.de>

Makefile: Add u-boot.spr build target (SPEAr)

On x600 (SPEAr600) U-Boot is appended to U-Boot SPL. Both images are
created using mkimage (crc etc), so that the ROM bootloader can check
its integrity. Padding needs to be done to the SPL image (with
mkimage header) and not the binary. Otherwise the resulting image
which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
The resulting image containing both U-Boot images is called u-boot.spr.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Amit Virdi <amit.virdi@st.com>
Cc: Vipin Kumar <vipin.kumar@st.com>

# 19a695f8 15-Mar-2012 Tom Rini <trini@ti.com>

tools, config.mk: Add gcc-version.sh, cc-version test from Linux

Added from Linux - commit fde7d9049e55ab85a390be7f415d74c9f62dd0f9

Signed-off-by: Tom Rini <trini@ti.com>

# 4a30f1e8 20-Feb-2012 Tom Rini <trini@ti.com>

config.mk: Check for -fstack-usage support

Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Tom Rini <trini@ti.com>

# 6f4acc17 14-Feb-2012 Tom Rini <trini@ti.com>

config.mk: Make cc-option create a file under include/generated

Testing for -fstack-usage requires the creation of an output file, which
isn't possible with /dev/null.

Signed-off-by: Tom Rini <trini@ti.com>

# b6a467d7 06-Nov-2011 Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

config.mk: use memoization in cc-option macro to speed up compilation

Apply memoization to cc-option macro by caching the results of the
gcc calls. This macro is called very often so using cached results
leads to faster compilation times.

The old behaviour can be restored by defining the config option
CONFIG_CC_OPT_CACHE_DISABLE=y.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

# cca4e4ae 01-Nov-2011 Wolfgang Denk <wd@denx.de>

Reduce build times

U-Boot Makefiles contain a number of tests for compiler features etc.
which so far are executed again and again. On some architectures
(especially ARM) this results in a large number of calls to gcc.

This patch makes sure to run such tests only once, thus largely
reducing the number of "execve" system calls.

Example: number of "execve" system calls for building the "P2020DS"
(Power Architecture) and "qong" (ARM) boards, measured as:
-> strace -f -e trace=execve -o /tmp/foo ./MAKEALL <board>
-> grep execve /tmp/foo | wc -l

Before: After: Reduction:
==================================
P2020DS 20555 15205 -26%
qong 31692 14490 -54%

As a result, built times are significantly reduced, typically by
30...50%.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Albert Aribaud <albert.aribaud@free.fr>
cc: Graeme Russ <graeme.russ@gmail.com>
cc: Mike Frysinger <vapier@gentoo.org>
Tested-by: Graeme Russ <graeme.russ@gmail.com>
Tested-by: Matthias Weisser <weisserm@arcor.de>
Tested-by: Sanjeev Premi <premi@ti.com>
Tested-by: Simon Glass <sjg@chromium.org>
Tested-by: Macpaul Lin <macpaul@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# bbb0b128 14-Oct-2011 Simon Glass <sjg@chromium.org>

fdt: Add support for embedded device tree (CONFIG_OF_EMBED)

This new option allows U-Boot to embed a binary device tree into its image
to allow run-time control of peripherals. This device tree is for U-Boot's
own use and is not necessarily the same one as is passed to the kernel.

The device tree compiler output should be placed in the $(obj)
rooted tree. Since $(OBJCOPY) insists on adding the path to the
generated symbol names, to ensure consistency it should be
invoked from the directory where the .dtb file is located and
given the input file name without the path.

This commit contains my entry for the ugliest Makefile / shell interaction
competition.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5968adc4 12-Oct-2011 Mike Frysinger <vapier@gentoo.org>

build: force migration away from $(AR)

People keep adding new code that still uses $(AR) instead of
$(cmd_link_o_target), so turn it into a build time error.

We still use $(AR) locally, but we don't use $(ARFLAGS).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 47508843 07-Oct-2011 Simon Glass <sjg@chromium.org>

Adjust dependency rules to permit per-file flags

The dependency rules are currently done in a shell 'for' loop. This does not
permit Makefile variables to adjust preprocessor flags as is done with normal
compile flags, using the CFLAGS_path/file.o syntax.

This change moves the dependency generation into the Makefile itself, and
permits a CPPFLAGS_path/file.o to adjust preprocessor flags on a file or
directory basis.

The CPPFLAGS_... variable is also folded into CFLAGS during the build.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6262e4e7 25-Apr-2011 Mike Frysinger <vapier@gentoo.org>

disable security warning flags when possible

Some toolchains enable security warning flags by default, but these don't
really make sense in the u-boot world. Such as forcing changes like:
-printf(foo);
+printf("%s", foo);

So disable the flags when the compiler supports them. Linux has already
merged a similar change in their build system.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# c8f9c302 18-Jul-2011 Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

Extend build-system for SPL framework

Signed-off-by: Aneesh V <aneesh@ti.com>
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

# d51dfff7 19-Jun-2011 Ilya Yanok <yanok@emcraft.com>

config.mk: move LDSCRIPT processing to the top-level Makefile

LDSCRIPT is used only from the top-level Makefile and only when the
system is configured so we can move LDSCRIPT and CONFIG_SYS_LDSCRIPT
related logic into the top level Makefile and under configured condition
to avoid errors when building tools from unconfigured tree.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 83b7e2a7 06-Apr-2011 Scott Wood <scottwood@freescale.com>

Handle most LDSCRIPT setting centrally

Currently, some linker scripts are found by common code in config.mk.
Some are found using CONFIG_SYS_LDSCRIPT, but the code for that is
sometimes in arch config.mk and sometimes in board config.mk. Some
are found using an arch-specific rule for looking in CPUDIR, etc.

Further, the powerpc config.mk rule relied on CONFIG_NAND_SPL
when it really wanted CONFIG_NAND_U_BOOT -- which covered up the fact
that not all NAND_U_BOOT builds actually wanted CPUDIR/u-boot-nand.lds.

Replace all of this -- except for a handful of boards that are actually
selecting a linker script in a unique way -- with centralized ldscript
finding.

If board code specifies LDSCRIPT, that will be used.
Otherwise, if CONFIG_SYS_LDSCRIPT is specified, that will be used.

If neither of these are specified, then the central config.mk will
check for the existence of the following, in order:

$(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT)
$(TOPDIR)/$(CPUDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT)
$(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
$(TOPDIR)/$(CPUDIR)/u-boot.lds

Some boards (sc3, cm5200, munices) provided their own u-boot.lds that
were dead code, because they were overridden by a CPUDIR u-boot.lds under
the old powerpc rules. These boards' own u-boot.lds have bitrotted and
no longer work -- these lds files have been removed.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Tested-by: Graeme Russ <graeme.russ@gmail.com>

# 6dc1eceb 22-Feb-2011 Haiying Wang <Haiying.Wang@freescale.com>

Introduce a new linker flag LDFLAGS_FINAL

commit 8aba9dceebb14144e07d19593111ee3a999c37fc
Divides variable of linker flags to LDFLAGS-u-boot and LDFLAGS

breaks the usage of --gc-section to build nand_spl. We still need linker option
--gc-section for every uboot image, not only the main one. LDFLAGS_FINAL passes
the --gc-sections to each uboot image.

To get the proper linker flags, we use LDFLAGS and LDFLAGS_FINAL to replace
PLATFORM_LDFLAGS in the Makefile of each nand_spl board.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>

# 5e987ddf 17-Jan-2011 Joakim Tjernlund <Joakim.Tjernlund@transmode.se>

Top config.mk: add include/config.mk

Seems to me that the top level config.mk should include
the auto generated include/config.mk so that all Makefile's
pickup those definitions.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>

# 8aba9dce 05-Jan-2011 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

Divides variable of linker flags to LDFLAGS-u-boot and LDFLAGS

Linker needs to use the proper endian/bfd flags even when doing partial linking.
LDFLAGS_u-boot sets linker option which is called it when U-boot is built
(u-boot final).
LDFLAGS sets necessary option by partial linking (use in cmd_link_o_target).

CC: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

# 326a6945 15-Dec-2010 Mike Frysinger <vapier@gentoo.org>

config.mk: unify duplicated flag setting

Multiple rules are using the expanded AFLAGS/CFLAGS settings and some are
getting so long that the rules need to be line wrapped. So unify them in
one variable, use that variable in the rule, and then unwrap things. This
makes the actual `make` output nicer as it doesn't have line continuations
in it anymore.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 844f07d8 27-Nov-2010 Wolfgang Denk <wd@denx.de>

Coding Style (white space) cleanup

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 6d8962e8 05-Nov-2010 Sebastien Carlier <sebastien.carlier@gmail.com>

Switch from archive libraries to partial linking

Before this commit, weak symbols were not overridden by non-weak symbols
found in archive libraries when linking with recent versions of
binutils. As stated in the System V ABI, "the link editor does not
extract archive members to resolve undefined weak symbols".

This commit changes all Makefiles to use partial linking (ld -r) instead
of creating library archives, which forces all symbols to participate in
linking, allowing non-weak symbols to override weak symbols as intended.
This approach is also used by Linux, from which the gmake function
cmd_link_o_target (defined in config.mk and used in all Makefiles) is
inspired.

The name of each former library archive is preserved except for
extensions which change from ".a" to ".o". This commit updates
references accordingly where needed, in particular in some linker
scripts.

This commit reveals board configurations that exclude some features but
include source files that depend these disabled features in the build,
resulting in undefined symbols. Known such cases include:
- disabling CMD_NET but not CMD_NFS;
- enabling CONFIG_OF_LIBFDT but not CONFIG_QE.

Signed-off-by: Sebastien Carlier <sebastien.carlier@gmail.com>

# 14d0a02a 07-Oct-2010 Wolfgang Denk <wd@denx.de>

Rename TEXT_BASE into CONFIG_SYS_TEXT_BASE

The change is currently needed to be able to remove the board
configuration scripting from the top level Makefile and replace it by
a simple, table driven script.

Moving this configuration setting into the "CONFIG_*" name space is
also desirable because it is needed if we ever should move forward to
a Kconfig driven configuration system.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# f534c7cd 03-Aug-2010 Mike Frysinger <vapier@gentoo.org>

config.mk: avoid -traditional-cpp on OS X 10.5

Simply trying to include a basic header file like stdlib.h on OS X 10.5
and then building with -traditional-cpp fails with lots of errors like:
In file included from /usr/include/stdlib.h:63,
from test.c:3:
/usr/include/available.h:85: error: stray '#' in program
/usr/include/available.h:85: error: syntax error before numeric constant
/usr/include/available.h:86: error: stray '#' in program

In the past, I hadn't noticed because the old logic for these flags were
restricted to Darwin running on PowerPC systems while I'm running on an
Intel system. But after some recent clean ups and changes, the flag was
being applied to all Darwin systems and my host tools broke.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 1117cbf2 27-May-2010 Thomas Chou <thomas@wytron.com.tw>

nios: remove nios-32 arch

The nios-32 arch is obsolete and broken. So it is removed.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# c7da8c19 22-May-2010 Andreas Bießmann <andreas.devel@googlemail.com>

config.mk: use different host compiler for OS X 10.6

Compiling tools subdirectory on Mac OS X 10.6 (Snow Leopard) complains about
wrong syntax in system includes.

In file included from /usr/include/stdio.h:444,
from ../source/u-boot/include/compiler.h:26,
from ../source/u-boot/lib/crc32.c:15:
/usr/include/secure/_stdio.h:46: error: syntax error in macro parameter list

This can be fixed by reverting the workaround for prior OS X releases in
config.mk conditionally for OS X 10.6+.

Signed-off-by: Andreas Bie�mann <andreas.devel@googlemail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8d1f2682 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

ppc: Move cpu/$CPU to arch/ppc/cpu/$CPU

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# ea0364f1 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Move lib_$ARCH directories to arch/$ARCH/lib

Also move lib_$ARCH/config.mk to arch/$ARCH/config.mk

This change is intended to clean up the top-level directory structure
and more closely mimic Linux's directory organization.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# 89f39e17 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Change directory-specific CFLAGS to use full path

Previously, a specific file or directory could be compiled with custom
CFLAGS by adding a Makefile variable such as:
CFLAGS_dlmalloc.o = <custom flags for common/dlmalloc.c>
or
CFLAGS_lib = <custom flags for lib directory>

This method breaks down once multiple files or directories share the
same path. Eg FLAGS_fileA = <custom flags> would incorrectly result in
both dir1/fileA.c and dir2/fileA.c being compiled with <custom flags>.

This change allows finer grained control which we need once we move
lib_$ARCH to arch/$ARCH/lib/ and lib_generic/ to lib/. Without this
change all lib/ directories would share the same custom CFLAGS.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# 03b7004d 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Create CPUDIR variable

The CPUDIR variable points to the location of a target's CPU directory.
Currently, it is set to cpu/$CPU. However, using $CPUDIR will allow for
more flexibility in the future. It lays the groundwork for reorganizing
U-Boot's directory structure to support a layout such as:

arch/$ARCH/cpu/$CPU/* (architecture with multiple CPU types)
arch/$ARCH/cpu/* (architecture with one CPU type)

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# d984fed0 04-Nov-2009 Scott Wood <scottwood@freescale.com>

makefiles: fixes for building build tools

Currently, some of the tools instead set CC to be HOSTCC in order to re-use
some pattern rules -- but this fails when the user overrides CC on the make
command line. Also, the HOSTCFLAGS in tools/Makefile are currently not
being used because config.mk overwrites them.

This patch adds static pattern rules for files that have been requested to
be built with the native compiler using $(HOSTSRCS) and $(HOSTOBJS), and
converts the tools to use them.

It restores easylogo to using the host compiler, which was broken by commit
38d299c2db81bd889c601b5dfc12c4e83ef83333 (if this was an intentional change,
please let me know -- but it seems to be a build tool).

It restores -pedantic and the special flags for darwin and cygwin that were
requested in tools/makefile (but keeps the flags added by config.mk) --
hopefully someone can test this on those platforms. It no longer
conditionalizes -pedantic on not being darwin; it wasn't clear that that was
intentional, and unless there's a real problem it's just inviting people to
contribute non-pedantic patches to those files (I'm not a fan of -pedantic
personally, but if it's on for one platform it should be on for all).

HOST_LDFLAGS is renamed HOSTLDFLAGS for consistency with the previous
HOST_CFLAGS to HOSTCFLAGS rename. A new HOSTCFLAGS_NOPED is made available
for those files which currently cannot be built with -pedantic, and replaces
the old FIT_CFLAGS.

imls now uses the cross compiler properly, rather than by trying to
reconstruct CC using the typoed $(CROSS_COMPILER).

envcrc.c is now dependency-processed unconditionally -- previously it would
be built without being on (HOST)SRCS if CONFIG_ENV_IS_EMBEDDED was not
selected.

Signed-off-by: Scott Wood <scottwood@freescale.com>

# 6c97a20d 09-Sep-2009 Kumar Gala <galak@kernel.crashing.org>

ppc/85xx: Introduce RESET_VECTOR_ADDRESS to handle non-standard link address

Some board ports place TEXT_BASE at a location that would cause the
RESET_VECTOR_ADDRESS not to be at 0xfffffffc when we link. By default
we assume RESET_VECTOR_ADDRESS will be 0xfffffffc if the board doesn't
explicitly set it.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Wolfgang Denk <wd@denx.de>

# 6ac9f479 23-Aug-2009 Mike Frysinger <vapier@gentoo.org>

start a linker script helper file

Start a common header file for common linker script code (such as
workarounds for older linkers) rather than doing this in the build system.

As fallout, we no longer execute the linker every time config.mk is
included by a build file (which can easily be 70+ times), but rather only
execute it once.

This also fixes a bug in the major version checking by creating a macro to
easily compare versions and keep people from making the same common
mistake (forgetting to check major and minor together).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 1aada9cd 17-Aug-2009 Wolfgang Denk <wd@denx.de>

Fix all linker scripts for older binutils versions (pre-2.16)

Commit f62fb99941c6 fixed handling of all rodata sections by using a
wildcard combined with calls to ld's builtin functions SORT_BY_ALIGNMENT()
and SORT_BY_NAME(). Unfortunately these functions were only
introduced with biunutils version 2.16, so the modification broke
building with all tool chains using older binutils.

This patch makes it work again. This is done by omitting the use of
these functions for such old tool chains. This will result in
slightly larger target binaries, as the rodata sections are no longer
in optimal order alignment-wise which reauls in unused gaps, but the
effect was found to be insignificant - especially compared to the fact
that you cannot build U-Boot at all in the current state.

As ld seems to have no support for conditionals we run the linker
script through the C preprocessor which can be easily used to remove
the unwanted function calls.

Note that the C preprocessor must be run with the "-ansi" (or a
"-std=") option to make sure all the system-specific predefined
macros outside the reserved namespace are suppressed. Otherise, cpp
might for example substitute "powerpc" to "1", thus corrupting for
example "OUTPUT_ARCH(powerpc)" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>

# f772acf8 17-Aug-2009 Wolfgang Denk <wd@denx.de>

ARM: compiler options cleanup - improve tool chain support

For some time there have been repeated reports about build problems
with some ARM (cross) tool chains. Especially issues about
(in)compatibility with the tool chain provided runtime support
library libgcc.a caused to add and support a private implementation
of such runtime support code in U-Boot. A closer look at the code
indicated that some of these issues are actually home-made. This
patch attempts to clean up some of the most obvious problems and make
building of U-Boot with different tool chains easier:

- Even though all ARM systems basicy used the same compiler options
to select a specific ABI from the tool chain, the code for this was
distributed over all cpu/*/config.mk files. We move this one level
up into lib_arm/config.mk instead.

- So far, we only checked if "-mapcs-32" was supported by the tool
chain; if yes, this was used, if not, "-mabi=apcs-gnu" was
selected, no matter if the tool chain actually understood this
option. There was no support for EABI conformant tool chains.
This patch implements the following logic:

1) If the tool chain supports
"-mabi=aapcs-linux -mno-thumb-interwork"
we use these options (EABI conformant tool chain).
2) Otherwise, we check first if
"-mapcs-32"
is supported, and then check for
"-mabi=apcs-gnu"
If one test succeeds, we use the first found option.
3) In case 2), we also test if "-mno-thumb-interwork", and use
this if the test succeeds. [For "-mabi=aapcs-linux" we set
"-mno-thumb-interwork" mandatorily.]

This way we use a similar logic for the compile options as the
Linux kernel does.

- Some EABI conformant tool chains cause external references to
utility functions like raise(); such functions are provided in the
new file lib_arm/eabi_compat.c

Note that lib_arm/config.mk gets parsed several times, so we must
make sure to add eabi_compat.o only once to the linker list.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Dirk Behme <dirk.behme@googlemail.com>
Cc: Magnus Lilja <lilja.magnus@gmail.com>
Cc: Tom Rix <Tom.Rix@windriver.com>
Cc: Prafulla Wadaskar <prafulla@marvell.com>
Acked-by: Sergey Kubushyn <ksi@koi8.net>
Tested-by: Magnus Lilja <lilja.magnus@gmail.com>
Tested-by: Andrzej Wolski <awolski@poczta.fm>
Tested-by: Gaye Abdoulaye Walsimou <walsimou@walsimou.com>
Tested-by: Tom Rix <Tom.Rix@windriver.com>
Tested-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# b220c64d 10-Jul-2009 Peter Tyser <ptyser@xes-inc.com>

Move architecture specific config.mk files into subdirs

This cleans up U-Boot's toplevel directory a bit and makes the
architecture 'config.mk' file naming and location similar to board
and cpu 'config.mk' files

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# cff80f2c 20-Jun-2009 Shinya Kuribayashi <skuribay@pobox.com>

config.mk: Remove unused HPATH

This variable is not unused anywhere.

Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>

# 12e9043c 20-Jun-2009 Shinya Kuribayashi <skuribay@pobox.com>

config.mk: Remove $(PCI_CLOCK) reference

The following commit introduced $(PCI_CLOCK) reference so that
we could tweak `PCI_66M' definition via an environment variable.

> commit f046ccd15c8bc9613bfd72916b761a127d36e5c6
> Author: Eran Liberty <liberty@freescale.com>
> Date: Thu Jul 28 10:08:46 2005 -0500
>
> * Patch by Eran Liberty
> Add support for the Freescale MPC8349ADS board.

But I suggest a removal of it for the following reasons:

* In 2006, MPC8349ADS was merged into MPC8349EMDS port,
and it seems that MPC8349EMDS port is PCI_66M free.

* OTOH, PCI_66M is used by MPC832XEMDS an MPC8360EMDS ports,
but they don't need $(PCI_CLOCK) environment variable at all.
PCI_66M is automatically configured via $(BOARD)_config names
with the help of $(findstring _66_,$@).

* Unfortunately $(PCI_CLOCK) has been undocumented anywhere,
so only a few people know the existence of it these days.

* Keep config.mk independent from $(BOARD) as much as possible.

Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# 31f30c9e 14-Jun-2009 Mike Frysinger <vapier@gentoo.org>

add %.c->%.i and %.c->%.s rules

The Linux kernel has some helper rules which allow you to quickly produce
some of the intermediary files from C source. Specifically, you can
create .i files which is the preprocessed output and you can create .s
files which is the assembler output. This is useful when you are trying
to track down header/macro expansion errors or inline assembly errors.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 5ec5529b 14-Jun-2009 Mike Frysinger <vapier@gentoo.org>

allow boards to customize compiler options on a per-file/dir basis

With our Blackfin boards, we like to build the compression routines with
-O2 as our tests show a pretty good size/speed tradeoff. For the rest of
U-Boot though, we want to stick with the default -Os as that is mostly
control code. So in our case, we would add a line like so to the board
specific config.mk file:
CFLAGS_lib_generic += -O2

Now all files under lib_generic/ will have -O2 appended to their build.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 3112030a 22-May-2009 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

config.mk: remove un-needed REMOTE_BUILD check

as $(obj) is empty when in tree build

%.s: %.S
$(CPP) $(AFLAGS) -o $@ $<

and

$(obj)%.s: %.S
$(CPP) $(AFLAGS) -o $@ $<

are the same

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 4cda4378 17-Jan-2009 Mike Frysinger <vapier@gentoo.org>

build system: treat all Darwin's alike

The x86 based version of Darwin behaves the same quirky way as the powerpc
Darwin, so only check HOSTOS when setting up Darwin workarounds.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 434c51a5 12-Nov-2008 Peter Tyser <ptyser@xes-inc.com>

Remove unneeded CONFIG_SHELL references

Make should be using the bash shell by default which makes
CONFIG_SHELL unnecessary

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# 03db5333 11-Sep-2008 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

make: Remove redundant __ARM__ addition when cross-compiling on *BSD

__ARM__ is given by arm_config.mk automatically.

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

# 6b971c73 30-Aug-2008 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

config.mk: Move arch-specific condition to $(ARCH)_config.mk

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

# 28eab0d7 18-May-2008 Haavard Skinnemoen <hskinnemoen@atmel.com>

Conditionally add -fno-stack-protector to CFLAGS

When compile-testing on powerpc, I get errors like this:

net/nfs.c:422: undefined reference to `__stack_chk_fail_local'

This seems to be because -fstack-protector is on by default, so
let's explicitly disable it on all architectures that support the
option.

The Ubuntu toolchain is affected by this problem, and according to
Mike Frysinger, Gentoo has been running with SSP enabled for years.
More and more distros are turning SSP on by default, so this problem
is likely to get worse in the future.

Also, powerpc just happens to be one of the arches I do
compile-testing on. There may be other arches affected by this too.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>

# 53677ef1 20-May-2008 Wolfgang Denk <wd@denx.de>

Big white-space cleanup.

This commit gets rid of a huge amount of silly white-space issues.
Especially, all sequences of SPACEs followed by TAB characters get
removed (unless they appear in print statements).

Also remove all embedded "vim:" and "vi:" statements which hide
indentation problems.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# c4e5f52a 03-May-2008 Wolfgang Denk <wd@denx.de>

config.mk: use correct (cross) compiler

Some config.mk files reference $(CC) to test for specific tool chain
features, so make sure $(CC) gets set before including any such
config files.

This patch replaces commit b7166e05a5 ("ColdFire: Get information from
the correct GCC").

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 755c35f5 18-Feb-2008 Mike Frysinger <vapier@gentoo.org>

include autoconf.mk before any other .mk files

This bumps the autoconf.mk include step above board/cpu/arch/etc... so that
those .mk files can have make if statements based on the current config.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 6f99eec3 14-Feb-2008 Wolfgang Denk <wd@denx.de>

Merge branch 'master' of git://www.denx.de/git/u-boot-blackfin

Conflicts:

Makefile
doc/README.standalone

Signed-off-by: Wolfgang Denk <wd@denx.de>


# 161b2af4 28-Jan-2008 Mike Frysinger <vapier@gentoo.org>

Only use TEXT_BASE if defined by the board

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 94a91e24 04-Feb-2008 Mike Frysinger <vapier@gentoo.org>

generate u-boot.ldr for Blackfin targets

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 2f155f6c 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

[BUILD] Generate include/autoconf.mk from board config files

Use cpp and sed to postprocess config.h and import the defined values
into include/autoconf.mk. autoconf.mk is then included by config.mk to
give 'make' access to the board configuration.

Doing this enables conditional compilation at the Makefile level instead
of by wrapping every .c file with #ifdef/#endif wrappers.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# ad845bee 30-Oct-2007 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

blackfin: Move `-D__BLACKFIN__' to $(ARCH)_config.mk

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

# ef26a08f 08-Mar-2007 Aubrey.Li <aubrey.adi@gmail.com>

[Blackfin][PATCH-2/2] Common files changed to support bf533 platform

# 1954be6e 28-Oct-2006 Wolfgang Denk <wd@pollux.denx.de>

Automatically adjust ARFLAGS so "make -s" is really silent.

# e11887a7 26-Oct-2006 Haavard Skinnemoen <hskinnemoen@atmel.com>

Don't pass any debug options directly to the assembler

When passing the -g option to gcc, gcc automatically selects a
suitable --g<format> option to pass on to the assembler.
Thus, there's no point in forcing a specific debug option on the
assembler using the -Wa mechanism.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>

# 2da2d9a4 24-Oct-2006 Wolfgang Denk <wd@pollux.denx.de>

Use -g instead of -gstabs in AFLAGS_DEBUG
Patch by Haavard Skinnemoen, 30 Aug 2006

In config.mk, -Wa,-gstabs is unconditionally appended to AFLAGS no
matter what the target's preferred debugging format is. This patch
simply replaces -gstabs with -g, so that the default debugging format
for the architecture is used.

# 2b208f53 08-Oct-2006 Wolfgang Denk <wd@atlas.denx.de>

Move "ar" flags to config.mk to allow for silent "make -s"
Based on patch by Mike Frysinger, 20 Jun 2006

# 511d0c72 08-Oct-2006 Wolfgang Denk <wd@atlas.denx.de>

Coding style cleanup

# 887e2ec9 07-Sep-2006 Stefan Roese <sr@denx.de>

Add support for AMCC Sequoia PPC440EPx eval board
- Add support for PPC440EPx & PPC440GRx
- Add support for PPC440EP(x)/GR(x) NAND controller
in cpu/ppc4xx directory
- Add NAND boot functionality for Sequoia board,
please see doc/README.nand-boot-ppc440 for details
- This Sequoia NAND image doesn't support environment
in NAND for now. This will be added in a short while.
Patch by Stefan Roese, 07 Sep 2006

# f9328639 01-Sep-2006 Marian Balakowicz <m8@semihalf.com>

Add support for a saving build objects in a separate directory.
Modifications are based on the linux kernel approach and
support two use cases:

1) Add O= to the make command line
'make O=/tmp/build all'

2) Set environement variable BUILD_DIR to point to the desired location
'export BUILD_DIR=/tmp/build'
'make'

The second approach can also be used with a MAKEALL script
'export BUILD_DIR=/tmp/build'
'./MAKEALL'

Command line 'O=' setting overrides BUILD_DIR environent variable.

When none of the above methods is used the local build is performed and
the object files are placed in the source directory.

# 4176c799 10-Jun-2006 Wolfgang Denk <wd@pollux.denx.de>

Merge with /home/hs/U-Boot/u-boot-dev


# b62fa913 16-May-2006 Marian Balakowicz <m8@semihalf.com>

Fix gcc 3.4.x AFLAGS setting for m68k platform.

# 483a0cf8 09-May-2006 Marian Balakowicz <m8@semihalf.com>

Fixes for gcc 3.4 based m68k toolchain,
based on patch by Jate Sujjavanich.

# 9acb626f 20-Apr-2006 Heiko Schocher <hs@pollux.denx.de>

Add MCF5282 support (without preloader)
relocate ichache_State to ram
u-boot can run from internal flash
Add EB+MCF-EV123 board support.
Add m68k Boards to MAKEALL
Patch from Jens Scharsig, 08 Aug 2005

# 0afe519a 11-Mar-2006 Wolfgang Denk <wd@pollux.denx.de>

Add ADI Blackfin support
- add support for Analog Devices Blackfin BF533 CPU
- add support for the ADI BF533 Stamp uClinux board
- add support for the ADI BF533 EZKit board
Patches by Richard Klingler, June 11th 2005:

# 0be248fa 06-Mar-2006 Wolfgang Denk <wd@atlas.denx.de>

Cleanup (get rid of debug code that sneaked in)

# 00c35bd2 28-Feb-2006 Markus Klotzb�cher <Markus Klotzb�mk@pollux.(none)>

Added GPIO initialization of DF signal. Still not working.

# e0269579 07-Feb-2006 Markus Klotzb�cher <Markus Klotzb�mk@pollux.(none)>

This is the first commit for the u-boot zylonite port. The following has be
done so far:

* created zylonite board dir (based on lubbock)
* extended some - but not all pxa sources and headers for Intel
Monahans support (CONFIG_CPU_MONAHANS)
* created Makefile zylonite target + MAKEALL entry
* added some debug nonsense, remove later, grep for mk@tbd

Status: compiles (eldk-4.0), and can be started with BDI, but runs forever
and doesn't halt at breakpoints. Hmmm...

# 9b880bd4 04-Oct-2005 Wolfgang Denk <wd@pollux.denx.de>

Update ARM Integrator boards:
Correct addessing errors in platform files.
Split off common core module data from Integrator header files to
include/armcoremodule.h.
Patch by Peter Pearse, 04 Oct 2005

# 1820d4c7 04-Oct-2005 Wolfgang Denk <wd@pollux.denx.de>

Make sure only supported compiler options are used
Import "cc-option" shell function from kernel and
use it to get the correct ARM GCC options for individual CPUs
Patch by Peter Pearse, 30 Jun 2005

# f046ccd1 28-Jul-2005 Eran Liberty <liberty@freescale.com>

* Patch by Eran Liberty
Add support for the Freescale MPC8349ADS board.

# 1d9f4105 09-Oct-2004 Wolfgang Denk <wdenk>

Patch by Steven Scholz, 16 Aug 2004:
- Introducing the concept of SoCs "./cpu/$(CPU)/$(SOC)"
- creating subdirs for SoCs ./cpu/arm920t/imx and ./cpu/arm920t/s3c24x0
- moving SoC specific code out of cpu/arm920t/ into cpu/arm920t/$(SOC)/
- moving drivers/s3c24x0_i2c.c and drivers/serial_imx.c out of drivers/
into cpu/arm920t/$(SOC)/

# e4cc71aa 19-May-2004 Wolfgang Denk <wdenk>

Patch by Scott McNutt, 25 Apr 2004:
Add Nios GDB/JTAG Console support:
- Add stubs to support gdb via JTAG.
- Add support for console over JTAG.
- Minor cleanup.

# c40b2956 13-Mar-2004 Wolfgang Denk <wdenk>

* Patch by Rune Torgersen, 27 Feb 2004:
- Added LBA48 support (CONFIG_LBA48 & CFG_64BIT_LBA)
- Added support for 64bit printing in vsprintf (CFG_64BIT_VSPRINTF)
- Added support for 64bit strtoul (CFG_64BIT_STRTOUL)

* Patch by Masami Komiya, 27 Feb 2004:
Fix rarpboot: add autoload by NFS

* Patch by Dan Eisenhut, 26 Feb 2004:
fix flash_write return value in saveenv

* Patch by Stephan Linz, 11 Dec 2003
expand config.mk to avoid trigraph warnings on NIOS

* Rename "BMS2003" board into "HMI10"

# 4aeb251f 16-Sep-2003 Wolfgang Denk <wdenk>

* Modify XLB arbiter priorities on MPC5200 so all devices use same
priority; configure critical interrupts to be handled like external
interrupts

# 27b207fd 24-Jul-2003 Wolfgang Denk <wdenk>

* Implement new mechanism to export U-Boot's functions to standalone
applications: instead of using (PPC-specific) system calls we now
use a jump table; please see doc/README.standalone for details

* Patch by Dave Westwood, 24 Jul 2003:
added support for Unity OS (a proprietary OS)

# b783edae 25-Jun-2003 Wolfgang Denk <wdenk>

* Header file cleanup for ARM

* Patch by Murray Jensen, 24 Jun 2003:
- make sure to use only U-boot provided header files
- fix problems with ".rodata.str1.4" section as used by GCC-3.x

# 592c5cab 20-Jun-2003 Wolfgang Denk <wdenk>

Patch by Murray Jensen, 20 Jun 2003:
- hymod update
- cleanup (especially for gcc-3.x compilers)

# 6dd652fa 19-Jun-2003 Wolfgang Denk <wdenk>

Patches by Murray Jensen, 17 Jun 2003:
- Hymod board database mods: add "who" field and new xilinx chip types
- provide new "init_cmd_timeout()" function so code external to
"common/main.c" can use the "reset_cmd_timeout()" function before
entering the main loop
- add DTT support for adm1021 (new file dtt/adm1021.c; config
slightly different. see include/configs/hymod.h for an example
(requires CONFIG_DTT_ADM1021, CONFIG_DTT_SENSORS, and
CFG_DTT_ADM1021 defined)
- add new "eeprom_probe()" function which has similar args and
behaves in a similar way to "eeprom_read()" etc.
- add 8260 FCC ethernet loopback code (new "eth_loopback_test()"
function which is enabled by defining CONFIG_ETHER_LOOPBACK_TEST)
- gdbtools copyright update
- ensure that set_msr() executes the "sync" and "isync" instructions
after the "mtmsr" instruction in cpu/mpc8260/interrupts.c
- 8260 I/O ports fix: Open Drain should be set last when configuring
- add SIU IRQ defines for 8260
- allow LDSCRIPT override and OBJCFLAGS initialization: change to
config.mk to allow board configurations to override the GNU
linker script, selected via the LDSCRIPT, make variable, and to
give an initial value to the OBJCFLAGS make variable
- 8260 i2c enhancement:
o correctly extends the timeout depending on the size of all
queued messages for both transmit and receive
o will not continue with receive if transmit times out
o ensures that the error callback is done for all queued tx
and rx messages
o correctly detects both tx and rx timeouts, only delivers one to
the callback, and does not overwrite an earlier error
o logic in i2c_probe now correct
- add "vprintf()" function so that "panic()" function can be
technically correct
- many Hymod board changes

# ea909b76 21-Nov-2002 Wolfgang Denk <wdenk>

* Added support for both PCMCIA slots (at the same time!) on MPC8xx

* Patch by Rod Boyce, 21 Nov 2002:
fix PCMCIA on MBX8xx board

* Patch by Pierre Aubert , 21 Nov 2002
Add CFG_CPM_POST_WORD_ADDR to make the offset of the
bootmode word in DPRAM configurable

# 7f6c2cbc 10-Nov-2002 Wolfgang Denk <wdenk>

* Vince Husovsky, 7 Nov 2002:
Add "-n" to linker options to get rid of "Not enough room for
program headers" problem

* Patch by David M�ller, 05 Nov 2002
Rename CONFIG_PLL_INPUT_FREQ to CONFIG_SYS_CLK_FREQ
so we can use an already existing name

* Patch by Pierre Aubert, 05 Nov 2002
Hardware related improvements in FDC boot code

* Patch by Holger Schurig, 5 Nov 2002:
Make the PXA really change it's frequency

* Patch by Pierre Aubert, 05 Nov 2002
Add support for slave serial Spartan 2 FPGAs

* Fix uninitialized memory (MAC address) in 8xx SCC/FEC ethernet
drivers

# e2211743 02-Nov-2002 Wolfgang Denk <wdenk>

Initial revision

# 587e4a42 27-Mar-2020 Tom Rini <trini@konsulko.com>

kconfig / kbuild: Re-sync with Linux 4.19

Align Kconfig and Kbuild logic to Linux 4.19 release with minimal impact
on files outside of this scope.

Our previous Kconfig sync was done by commit 5972ff077e0f ("kconfig /
kbuild: re-sync with Linux 4.18").

In this particular re-sync in order to keep clang support working a
number of related changes needed to be pulled in that had been missed
previously. Not all of these changes we easily traceable and so have
been omitted from the list below.

The imported Linux commits are:
[From prior to v4.18]
9f3f1fd29976 kbuild: Add __cc-option macro
d7f14c66c273 kbuild: Enable Large File Support for hostprogs
6d79a7b424a5 kbuild: suppress warnings from 'getconf LFS_*'
24403874316a Shared library support
86a9df597cdd kbuild: fix linker feature test macros when cross compiling with Clang
0294e6f4a000 kbuild: simplify ld-option implementation

[From v4.18 to v4.19]
96f14fe738b6 kbuild: Rename HOSTCFLAGS to KBUILD_HOSTCFLAGS
10844aebf448 kbuild: Rename HOSTCXXFLAGS to KBUILD_HOSTCXXFLAGS
b90a368000ab kbuild: Rename HOSTLDFLAGS to KBUILD_HOSTLDFLAGS
8377bd2b9ee1 kbuild: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS
f92d19e0ef9b kbuild: Use HOST*FLAGS options from the command line
4ab3b80159d4 kconfig: check for pkg-config on make {menu,n,g,x}config
693359f7ac90 kconfig: rename SYMBOL_AUTO to SYMBOL_NO_WRITE
f60b992e30ff kbuild: replace $(LDFLAGS) $(ldflags-y) with $(ld_flags)
2fb9279f2c3e kbuild: change ld_flags to contain LDFLAGS_$(@F)
c931d34ea085 arm64: build with baremetal linker target instead of Linux when available
5accd7f3360e kconfig: handle format string before calling conf_message_callback()
a2ff4040151a kconfig: rename file_write_dep and move it to confdata.c
0608182ad542 kconfig: split out useful helpers in confdata.c
adc18acf42a1 kconfig: remove unneeded directory generation from local*config
79123b1389cc kconfig: create directories needed for syncconfig by itself
16952b77d8b5 kconfig: make syncconfig update .config regardless of sym_change_count
d6c6ab93e17f kbuild: remove deprecated host-progs variable
56869d45e364 kconfig: fix the rule of mainmenu_stmt symbol
c151272d1687 kconfig: remove unused sym_get_env_prop() function
1880861226c1 kconfig: remove P_ENV property type
e3fd9b5384f3 scripts/dtc: consolidate include path options in Makefile
4bf6a9af0e91 kconfig: add build-only configurator targets
f1575595d156 kconfig: error out when seeing recursive dependency
5e8c5299d315 kconfig: report recursive dependency involving 'imply'
f498926c47aa kconfig: improve the recursive dependency report
98a4afbfafd2 kconfig: fix "Can't open ..." in parallel build
9a9ddcf47831 kconfig: suppress "configuration written to .config" for syncconfig
87a32e624037 kbuild: pass LDFLAGS to recordmcount.pl
d503ac531a52 kbuild: rename LDFLAGS to KBUILD_LDFLAGS
217c3e019675 disable stringop truncation warnings for now
bc8d2e20a3eb kconfig: remove a spurious self-assignment
fd65465b7016 kconfig: do not require pkg-config on make {menu,n}config
5a4630aadb9a ftrace: Build with CPPFLAGS to get -Qunused-arguments

Note that this adds new cleanup work to do in that we should adapt the
shared library support we have to what is now upstream.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>

# 1d3b97c9 23-Sep-2018 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

Kbuild: add LDFLAGS_STANDALONE

Introduce a new Makefile variable for passing LDFLAGS to standalone
programs. Currently the variable CONFIG_STANDALONE_LOAD_ADDR is
misued on some archs to pass a specific linker script.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 9865543a 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove CONFIG_USE_STDINT

You do not need to use the typedefs provided by compiler.

Our compilers are either IPL32 or LP64. Hence, U-Boot can/should
always use int-ll64.h typedefs like Linux kernel, whatever the
typedefs the compiler internally uses.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# e020c88a 31-Jul-2015 Simon Glass <sjg@chromium.org>

Allow objcopy to work without filling gaps with 0xff

This is currently done for all targets, since 0xff is the default erased
value for most flash devices. In some cases this is not what we want (e.g.
for EFI images) so provide a command to do a vanilla objcopy.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e02ee254 24-Feb-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: switch to single .config configuration

When Kconfig for U-boot was examined, one of the biggest issues was
how to support multiple images (Normal, SPL, TPL). There were
actually two options, "single .config" and "multiple .config".
After some discussions and thought experiments, I chose the latter,
i.e. to create ".config", "spl/.config", "tpl/.config" for Normal,
SPL, TPL, respectively.

It is true that the "multiple .config" strategy provided us the
maximum flexibility and helped to avoid duplicating CONFIGs among
Normal, SPL, TPL, but I have noticed some fatal problems:

[1] It is impossible to share CONFIG options across the images.
If you change the configuration of Main image, you often have to
adjust some SPL configurations correspondingly. Currently, we
cannot handle the dependencies between them. It means one of the
biggest advantages of Kconfig is lost.

[2] It is too painful to change both ".config" and "spl/.config".
Sunxi guys started to work around this problem by creating a new
configuration target. Commit cbdd9a9737cc (sunxi: kconfig: Add
%_felconfig rule to enable FEL build of sunxi platforms.) added
"make *_felconfig" to enable CONFIG_SPL_FEL on both images.
Changing the configuration of multiple images in one command is a
generic demand. The current implementation cannot propose any
good solution about this.

[3] Kconfig files are getting ugly and difficult to understand.
Commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN to
Kconfig) has sprinkled "if !SPL_BUILD" over the Kconfig files.

[4] The build system got more complicated than it should be.
To adjust Linux-originated Kconfig to U-Boot, the helper script
"scripts/multiconfig.sh" was introduced. Writing a complicated
text processor is a shell script sometimes caused problems.

Now I believe the "single .config" will serve us better. With it,
all the problems above would go away. Instead, we will have to add
some CONFIG_SPL_* (and CONFIG_TPL_*) options such as CONFIG_SPL_DM,
but we will not have much. Anyway, this is what we do now in
scripts/Makefile.spl.

I admit my mistake with my apology and this commit switches to the
single .config configuration.

It is not so difficult to do that:

- Remove unnecessary processings from scripts/multiconfig.sh
This file will remain for a while to support the current defconfig
format. It will be removed after more cleanups are done.

- Adjust some makefiles and Kconfigs

- Add some entries to include/config_uncmd_spl.h and the new file
scripts/Makefile.uncmd_spl. Some CONFIG options that are not
supported on SPL must be disabled because one .config is shared
between SPL and U-Boot proper going forward. I know this is not
a beautiful solution and I think we can do better, but let's see
how much we will have to describe them.

- update doc/README.kconfig

More cleaning up patches will follow this.

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

# 0d296cc2 15-Oct-2014 Gabe Black <gabeblack@chromium.org>

Provide option to avoid defining a custom version of uintptr_t.

There's a definition in stdint.h (provided by gcc) which will be more correct
if available.

Define CONFIG_USE_STDINT to use this feature, or USE_STDINT=1 on the 'make'
commmand.

This adjusts the settings for x86 and sandbox, with both have 64-bit options.

Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@google.com>
Rewritten to be an option, since stdint.h is often available only in glibc.
Changed to preserve a clear boundary between stdint and non-stdint
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5b3ee386 20-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: clear VENDOR variable to fix build error on tcsh

Since the environment "VENDOR" is set in tcsh, it must be cleared in our
makefile. Otherwise, boards without CONFIG_SYS_VENDOR fail to build:

> make CROSS_COMPILE=arm-linux-gnueabi- wandboard_quad_defconfig all
[ snip ]
AR arch/arm/lib/lib.a
CC arch/arm/lib/eabi_compat.o
scripts/Makefile.build:55: /home/foo/u-boot/board/unknown/wandboard/ \
Makefile: No such file or directory
make[2]: *** No rule to make target `/home/foo/u-boot/board/unknown/ \
wandboard/Makefile'. Stop.
make[1]: *** [board/unknown/wandboard] Error 2
make: *** [__build_one_by_one] Error 2

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reported-by: Tom Everett <tom@khubla.com>
Reported-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# b8450521 14-Sep-2014 Simon Glass <sjg@chromium.org>

Reactivate the tracing feature

This was lost sometime in the Kbuild conversion. Add it back.

Check that the trace test now passes:

$ ./test/trace/test-trace.sh
Simple trace test / sanity check using sandbox

/tmp/filemHKPGw
Build sandbox
O=sandbox FTRACE=1
GEN /home/sjg/c/src/third_party/u-boot/files/sandbox/Makefile
Configuring for sandbox board...
Check results
Test passed

Signed-off-by: Simon Glass <sjg@chromium.org>

# 51148790 29-Jul-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

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: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a8b0f9b6 24-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

build: define CPU only when arch/${ARCH}/cpu/${CPU} exists

The directory arch/${ARCH}/cpu/${CPU} does not exist
in avr32, blackfin, microblaze, nios2, openrisc, sandbox, x86.

These architectures have only one CPU type.
Defining CPU should not be required for such architectures.

This commit allows cpu field (= the 3rd field of boards.cfg)
to be kept blank.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Andreas Bießmann <andreas.devel@googlemail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Sonic Zhang <sonic.zhang@analog.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>

# 01286329 10-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: rename SRCTREE to srctree

Prior to Kbuild, $(TOPDIR) or $(SRCTREE) was used for
pointing to the top of source directory.
(No difference between the two.)

In Kbuild style, $(srctree) is used for instead.
This commit renames SRCTREE to srctree and deletes the
defition of SRCTREE.

Note that SRCTREE in scripts/kernel-doc, scripts/docproc.c,
doc/DocBook/Makefile should be keep.

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

# 4379ac61 10-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: rename TOPDIR to stctree

Prior to Kbuild, $(TOPDIR) or $(SRCTREE) was used for
pointing to the top of source directory.
(No difference between the two.)

In Kbuild style, $(srctree) is used instead.
This commit renames TOPDIR to srctree and delete the
defition of TOPDIR.

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

# 026f9cf2 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: improve Kbuild speed

Kbuild brought about many advantages for us but a significant
performance regression was reported by Simon Glass.

After some discussions and analysis, it turned out
its main cause is in $(call cc-option,...).

Historically, U-Boot parses all config.mk
(arch/*/config.mk and board/*/config.mk)
every time descending into subdirectories.
That means cc-options are evaluated over and over again.

$(call cc-option,...) is useful but costly.
So we want to evaluate them only in ./Makefile
and spl/Makefile and export compiler flags.

This commit changes the build system as follows:

- Modify scripts/Makefile.build to not include config.mk
Instead, add $(PLATFORM_CPPFLAGS) to asflags-y, ccflags-y,
cppflags-y.

- Export many variables
Going forward, Kbuild will not parse config.mk files
when it descends into subdirectories.
If we want to set variables in config.mk and use them
in subdirectories, they must be exported.

This is the list of variables to get exported:
PLATFORM_CPPFLAGS
CPUDIR
BOARDDIR
OBJCOPYFLAGS
LDFLAGS
LDFLAGS_FINAL
(used in nand_spl/board/*/*/Makefile)
CONFIG_STANDALONE_LOAD_ADDR
(used in examples/standalone/Makefile)
SYM_PREFIX
(used in examples/standalone/Makefile)
RELFLAGS
(used in examples/standalone/Makefile)

- Delete CPPFLAGS
This variable has been replaced with PLATFORM_CPPFLAGS

- Copy gcclibdir from example/standalone/Makefile
to arch/sparc/config.mk
The reference in CONFIG_STANDALONE_LOAD_ADDR must be
resolved before it is exported.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reported-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> [on Sandbox]
Tested-by: Stephen Warren <swarren@nvidia.com> [on Tegra]

# 33a02da0 03-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: allow empty board directories

U-Boot has compelled all boards to have
board/${BOARD}/ or board/${VENDOR}/${BOARD}/ directory.

Sometimes it does not seem suitable for some boards,
for example Sandbox. (Is it a board?)

And arcangel4 board has nothing to compile
under the board directory.

This commit makes the build system more flexible:
If '<none>' is given to the 6th column (=Board name) of boards.cfg,
Kbuild will not descend into the board directory.

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

# 57181573 25-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

config.mk: Delete unused variable BCURDIR

This variable was abolished by Kbuild series.
I forgot to delete it.

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

# 95ddcd68 23-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: rename OBJCFLAGS to OBJCOPYFLAGS

Rename OBJCFLAGS to OBJCOPYFLAGS beforehand to use
"cmd_objcopy" in scripts/Makefile.lib in an upcoming commit.

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

# 01072b44 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: move include directives of board configuration files

This commit changes the location of include directives
of board configuration files.

The purpose of this change is:
- Slim down $(TOPDIR)/config.mk
- Prevent $(TOPDIR)/Makefile from including the same
configuration file twice
- Do not include include/config.mk multiple times
because ARCH, CPU, BOARD, VENDOR, SOC are exported

Before this commit:

- include/autoconf.mk was included from $(TOPDIR)/Makefile
and $(TOPDIR)/config.mk
(This means $(TOPDIR)/Makefile included include/autoconf.mk twice)

- include/{spl,tpl}-autoconf.mk was included from $(TOPDIR)/config.mk

- include/config.mk was included from $(TOPDIR)/Makefile
and $(TOPDIR)/config.mk
(This means $(TOPDIR)/Makefile included include/config.mk twice)

After this commit:

- include/autoconf.mk is included from $(TOPDIR)/Makefile
and $(TOPDIR)/scripts/Makefile.build

- include/{spl,tpl}-autoconf.mk is included from $(TOPDIR)/spl/Makefile
and $(TOPDIR)/scripts/Makefile.build

- include/config.mk is included from $(TOPDIR)/config.mk and
$(TOPDIR)/spl/Makefile

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

# 6825a95b 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: use Linux Kernel build scripts

Now we are ready to switch over to real Kbuild.

This commit disables temporary scripts:
scripts/{Makefile.build.tmp, Makefile.host.tmp}
and enables real Kbuild scripts:
scripts/{Makefile.build,Makefile.host,Makefile.lib}.

This switch is triggered by the line in scripts/Kbuild.include
-build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj
+build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj

We need to adjust some build scripts for U-Boot.
But smaller amount of modification is preferable.

Additionally, we need to fix compiler flags which are
locally added or removed.

In Kbuild, it is not allowed to change CFLAGS locally.
Instead, ccflags-y, asflags-y, cppflags-y,
CFLAGS_$(basetarget).o, CFLAGS_REMOVE_$(basetarget).o
are prepared for that purpose.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>

# 9e414032 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: change out-of-tree build

This commit changes the working directory
where the build process occurs.

Before this commit, build process occurred under the source
tree for both in-tree and out-of-tree build.

That's why we needed to add $(obj) prefix to all generated
files in makefiles like follows:
$(obj)u-boot.bin: $(obj)u-boot

Here, $(obj) is empty for in-tree build, whereas it points
to the output directory for out-of-tree build.

And our old build system changes the current working directory
with "make -C <sub-dir>" syntax when descending into the
sub-directories.

On the other hand, Kbuild uses a different idea
to handle out-of-tree build and directory descending.

The build process of Kbuild always occurs under the output tree.
When "O=dir/to/store/output/files" is given, the build system
changes the current working directory to that directory and
restarts the make.

Kbuild uses "make -f $(srctree)/scripts/Makefile.build obj=<sub-dir>"
syntax for descending into sub-directories.
(We can write it like "make $(obj)=<sub-dir>" with a shorthand.)
This means the current working directory is always the top
of the output directory.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>

# d9580025 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move some flags to examples makefiles

This commit moves some flags which are used
under examples/ directory only.

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

# e0d5d9f8 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move some flags to spl/Makefile

Some flags are used for SPL (and TPL) build only.
This commit moves them from config.mk to spl/Makefile.

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

# ced0715d 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move more stuff to top Makefile

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

# fea1ca8e 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: refactor include path settings

This commit merges commonly-used header include paths
to UBOOTINCLUDE and NOSTDINC_FLAGS variables, which are placed
at the top Makefile.

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

# 2b3c9d3d 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move more flags to the top Makefile

Before this commit, most of compiler flags were defined in config.mk.
But it is redundant because config.mk is included from all recursive make.

This commit moves many complier flags to the top Makefile
and export them.
And we use new vaiarables to store them:
KBUILD_CPPFLAGS, KBUILD_CFLAGS, KBUILD_AFLAGS.
This will allow us to switch more smoothly to Kbuild.

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

# bf4b3de1 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: Use Kbuild.include

This commit adjusts some files to use Kbuild.include.

- Use cc-option defined in Kbuild.include
(Delete cc-option in config.mk)
- Use cc-version defined in
(Delete cc-version in config.mk)
- Move binutils-version and dtc-version to Kbuild.include
by analogy to cc-version

This commit also adds srctree (same as SRCTREE)
to use Kbuild scripts.

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

# 34bd0507 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move BFD_ROOT_DIR to tools/gdb/Makefile

BFD_ROOT_DIR is used only in tools/gdb/Makefile

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

# f6322eb7 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move some variable definitions to the top Makefile

This commit moves some variable definitions from config.mk
to the top Makefile:

- HOSTCC, HOSTCFLAGS, HOSTLDFLAGS
- AS, LD, CC, CPP, etc.
- SHELL (renamed to CONFIG_SHELL)

I'd like to slim down config.mk file
because it is included from all recursive make.
It is redundant to re-define the variables
every time descending into sub directories.
We should rather define them at the top Makefile
and export them.

U-Boot makefiles has been used "SHELL" variable to store shell
chosen for the user, whereas Linux Kernel uses "CONFIG_SHELL".

We should never use "SHELL" variable because it is
a special variable for GNU Make.
Changing SHELL may cause unpredictable side effects
whose root cause is usually difficult to find.
We should use a generic variable name "CONFIG_SHELL".

We should not use the syntax as follows either:

rm -f $(obj)tools/env/{fw_printenv,fw_setenv}

This depends on "bash" although GNU Make generally
invokes "sh" to run the each rule.

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

# 5651ccff 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makfile: move suffix rules to Makefile.build

This commit moves suffix rules from config.mk
to scripts/Makefile.build, which will allow us
to switch smoothly to real Kbuild.

Note1:
post/lib_powerpc/fpu/Makefile has
its own rule to compile C sources.
We need to tweak it to keep the same behavior.

Note2:
There are two file2 with the same name:
arch/arm/lib/crt0.S and eamples/api/crt0.S.
To keep the same build behavior,
examples/api/Makefile also has to be treaked.

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

# 940db16d 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

tools: convert makefiles to kbuild style

Before this commit, makefiles under tools/ directory
were implemented with their own way.

This commit refactors them by using "hostprogs-y" variable.

Several C sources have been added to wrap other C sources
to simplify Makefile.
For example, tools/crc32.c includes lib/crc32.c

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

# 3d83efbc 26-Nov-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

sandbox: Use system headers first for sandbox's os.c in a different way

Commit cbe5cdfcd changed config.mk and arch/sandbox/cpu/Makefile
to use -idirafter instead of -I and remove -nostdinc.

But
* Sandbox-specific code dirties config.mk
* os.c is compiled without such compiler flags as:
-Wall -Wstrict-prototypes -Wno-format-security
-fno-builtin -ffreestanding -fno-stack-protector
-fstack-usage -Wno-format-nonliteral

This commit use -idirafter and remove the -nostdinc
differently and more simply.

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

# dd88ab32 28-Nov-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: Move some scripts imported from Linux

We have some scripts imported from Linux Kernel:
setlocalversion, checkstack.pl, checkpatch.pl, cleanpatch

They are located under tools/ directory in U-Boot now.
But they were originally located under scripts/ directory
in Linux Kernel.

This commit moves them to the original location.

It is true that binutils-version.sh and dtc-version.sh
do not originate in Linux Kernel, but they should
be moved by analogy to gcc-version.sh.

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

# cbe5cdfc 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Use system headers first for sandbox's os.c

This file must be compiled with system headers, even if U-Boot has headers
of the same name. The existing solution for this is good enough for libfdt,
but fails when we have headers like stdint.h in U-Boot.

Use -idirafter instead of -I, and remove the -nostdinc and other things
that we don't want for this file. The best way to do this is to keep a
copy of the original flags, rather than trying to filter them later.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 74307f20 10-Nov-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

config.mk: delete unnecessary lines

SPL_BIN is already defined in spl/Makefile
and it is used only in spl/Makefile.

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

# bb02c536 31-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: do not create a symbolic link to arch/${ARCH}/include/asm

In-tree build:
- Do not create a symbolic link
from include/asm to arch/${ARCH}/include/asm
- Add ${SRCTREE}/arch/arm/include into the header search path

Out-of-tree build:
- Do not create a directory ${OBJTREE}/include2
- Do not create a symbolic link
from ${OBJTREE}/include2/asm to ${SRCTREE}/arch/${ARCH}/include/asm
- Add ${SRCTREE}/arch/arm/include into the header search path

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

# 93e14596 04-Oct-2013 Wolfgang Denk <wd@denx.de>

Coding Style cleanup: replace leading SPACEs by TABs

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Drop changes for PEP 4 following python tools]
Signed-off-by: Tom Rini <trini@ti.com>

# 47f75cf2 06-Sep-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm


# 1affd4d4 01-Sep-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

cam_enc_4xx: Move CONFIG_SPL_PAD_TO to a config header

For most boards which define CONFIG_SPL_PAD_TO,
it is defined in config header files.
Currently, there exists only one exception, cam_enc_4xx board.

This patch moves CONFIG_SPL_PAD_TO definition
from board/ait/cam_enc_4xx/config.mk
to include/configs/cam_enc_4xx.h.

With this modification, we can delete a glue code
in the top level config.mk:

ifneq ($(CONFIG_SPL_PAD_TO),)
CPPFLAGS += -DCONFIG_SPL_PAD_TO=$(CONFIG_SPL_PAD_TO)
endif

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Heiko Schocher <hs@denx.de>

# cb4ef5ba 01-Sep-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

config.mk: Delete unnecessary code

Currently no makefiles (board-specific config.mk)
set the following variables:

CONFIG_SPL_TEXT_BASE
CONFIG_UBOOT_PAD_TO
CONFIG_RESET_VECTOR_ADDRESS
CONFIG_TPL_PAD_TO

For all target boards using above macros
they are set in header files (include/configs/*.h),
so we do not need to set them as CPPFLAGS.

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

# 19d829fa 05-Sep-2013 Albert ARIBAUD <albert.u.boot@aribaud.net>

Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'

Conflicts:
drivers/serial/serial.c

The conflict above was a trivial case of adding one init
function in each branch, and manually resolved in merge.


# bce88370 26-Aug-2013 Marek Vasut <marex@denx.de>

ARM: mxs: tools: Add mkimage support for MXS bootstream

Add mkimage support for generating and verifying MXS bootstream.
The implementation here is mostly a glue code between MXSSB v0.4
and mkimage, but the long-term goal is to rectify this and merge
MXSSB with mkimage more tightly. Once this code is properly in
U-Boot, MXSSB shall be deprecated in favor of mkimage-mxsimage
support.

Note that the mxsimage generator needs libcrypto from OpenSSL, I
therefore enabled the libcrypto/libssl unconditionally.

MXSSB: http://git.denx.de/?p=mxssb.git;a=summary

The code is based on research presented at:
http://www.rockbox.org/wiki/SbFileFormat

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>

# 3aa29de0 16-Aug-2013 Ying Zhang <b40530@freescale.com>

TPL : introduce the TPL based on the SPL

Due to the nand SPL on some board(e.g. P1022DS)has a size limit, it can
not be more than 4K. So, the SPL cannot initialize the DDR with the SPD
code. This patch introduces TPL to enable a loader stub that is loaded
by the code from the SPL. It initializes the DDR with the SPD or other
operations.

The TPL's size is sizeable, the maximum size is decided by the memory's
size that TPL runs. It initializes the DDR through SPD code, and copys
final uboot image to DDR. So there are three stage uboot images:
* spl_boot, * tpl_boot, * final uboot image

Signed-off-by: Ying Zhang <b40530@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 39bc12dd 19-Aug-2013 Joel Fernandes <joelf@ti.com>

SPL: Makefile: Build a separate autoconf.mk for SPL

SPL defines CONFIG_SPL_BUILD but this does not percolate to the
autoconf.mk Makefile. As a result the build breaks when
CONFIG_SPL_BUILD is used in the board-specific include header file. With
this, there is a possibility of having a CONFIG option defined in the
header file but not defined in the Makefile causing all kinds of build
failure and problems.

It also messes things for up, for example, when one might want to
undefine options to keep the SPL small and doesn't want to be stuck with
the CONFIG options used for U-boot. Lastly, this also avoids defining
special CONFIG_SPL_ variables for cases where some options are required
in U-boot but not in SPL.

We add a spl-autoconf.mk rule that is generated for SPL with the
CONFIG_SPL_BUILD flag and conditionally include it for SPL builds.

Signed-off-by: Joel Fernandes <joelf@ti.com>
Signed-off-by: Ying Zhang <b40530@freescale.com>

# 501ebdf2 24-Jul-2013 Stephen Warren <swarren@nvidia.com>

Validate dtc is new enough

Subsequent patches assume that dtc supports various recent features.
These are available in dtc 1.4.0. Validate that dtc is at least that
version.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>

# eca3aeb3 21-Jun-2013 Wolfgang Denk <wd@denx.de>

Licenses: introduce SPDX Unique Lincense Identifiers

Like many other projects, U-Boot has a tradition of including big
blocks of License headers in all files. This not only blows up the
source code with mostly redundant information, but also makes it very
difficult to generate License Clearing Reports. An additional problem
is that even the same lincenses are referred to by a number of
slightly varying text blocks (full, abbreviated, different
indentation, line wrapping and/or white space, with obsolete address
information, ...) which makes automatic processing a nightmare.

To make this easier, such license headers in the source files will be
replaced with a single line reference to Unique Lincense Identifiers
as defined by the Linux Foundation's SPDX project [1]. For example,
in a source file the full "GPL v2.0 or later" header text will be
replaced by a single line:

SPDX-License-Identifier: GPL-2.0+

We use the SPDX Unique Lincense Identifiers here; these are available
at [2].

Note: From the legal point of view, this patch is supposed to be only
a change to the textual representation of the license information,
but in no way any change to the actual license terms. With this patch
applied, all files will still be licensed under the same terms they
were before.

Note 2: The apparent difference between the old "COPYING" and the new
"Licenses/gpl-2.0.txt" only results from switching to the upstream
version of the license which is differently formatted; there are not
any actual changes to the content.

Note 3: There are some recurring questions about linense issues, such
as:
- Is a "All Rights Reserved" clause a problem in GPL code?
- Are files without any license header a problem?
- Do we need license headers at all?

The following excerpt from an e-mail by Daniel B. Ravicher should help
with these:

| Message-ID: <4ADF8CAA.5030808@softwarefreedom.org>
| Date: Wed, 21 Oct 2009 18:35:22 -0400
| From: "Daniel B. Ravicher" <ravicher@softwarefreedom.org>
| To: Wolfgang Denk <wd@denx.de>
| Subject: Re: GPL and license cleanup questions
|
| Mr. Denk,
|
| Wolfgang Denk wrote:
| > - There are a number of files which do not include any specific
| > license information at all. Is it correct to assume that these files
| > are automatically covered by the "GPL v2 or later" clause as
| > specified by the COPYING file in the top level directory of the
| > U-Boot source tree?
|
| That is a very fact specific analysis and could be different across the
| various files. However, if the contributor could reasonably be expected
| to have known that the project was licensed GPLv2 or later at the time
| she made her contribution, then a reasonably implication is that she
| consented to her contributions being distributed under those terms.
|
| > - Do such files need any clean up, for example should we add GPL
| > headers to them, or is this not needed?
|
| If the project as a whole is licensed under clear terms, you need not
| identify those same terms in each file, although there is no harm in
| doing so.
|
| > - There are other files, which include both a GPL license header
| > _plus_ some copyright note with an "All Rights Reserved" clause. It
| > has been my understanding that this is a conflict, and me must ask
| > the copyright holders to remove such "All Rights Reserved" clauses.
| > But then, some people claim that "All Rights Reserved" is a no-op
| > nowadays. License checking tools (like OSLC) seem to indicate this is
| > a problem, but then we see quite a lot of "All rights reserved" in
| > BSD-licensed files in gcc and glibc. So what is the correct way to
| > deal with such files?
|
| It is not a conflict to grant a license and also reserve all rights, as
| implicit in that language is that you are reserving all "other" rights
| not granted in the license. Thus, a file with "Licensed under GPL, All
| Rights Reserved" would mean that it is licensed under the GPL, but no
| other rights are given to copy, modify or redistribute it.
|
| Warm regards,
| --Dan
|
| Daniel B. Ravicher, Legal Director
| Software Freedom Law Center (SFLC) and Moglen Ravicher LLC
| 1995 Broadway, 17th Fl., New York, NY 10023
| (212) 461-1902 direct (212) 580-0800 main (212) 580-0898 fax
| ravicher@softwarefreedom.org www.softwarefreedom.org

[1] http://spdx.org/
[2] http://spdx.org/licenses/

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 971c450a 17-Jul-2013 Simon Glass <sjg@chromium.org>

mkimage: Use board config to get CONFIG_FIT_SIGNATURE value

The value of this config variable is not available to image.h on the host,
since the board config is not actually included. Bring this in so that
mkimage will be built with image-signing support for sandbox at least.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 29ce737d 27-Jun-2013 Simon Glass <sjg@chromium.org>

mkimage: Build signing only if board has CONFIG_FIT_SIGNATURE

At present mkimage is set up to always build with image signing support.
This means that the SSL libraries (e.g. libssl-dev) are always required.

Adjust things so that mkimage can be built with and without image signing,
controlled by the presence of CONFIG_FIT_SIGNATURE in the board config file.

If CONFIG_FIT_SIGNATURE is not enabled, then mkimage will report a warning
that signing is not supported. If the option is enabled, but libraries are
not available, then a build error similar to this will be shown:

lib/rsa/rsa-sign.c:26:25: fatal error: openssl/rsa.h: No such file or directory

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19c402af 13-Jun-2013 Simon Glass <sjg@chromium.org>

image: Add RSA support for image signing

RSA provides a public key encryption facility which is ideal for image
signing and verification.

Images are signed using a private key by mkimage. Then at run-time, the
images are verified using a private key.

This implementation uses openssl for the host part (mkimage). To avoid
bringing large libraries into the U-Boot binary, the RSA public key
is encoded using a simple numeric representation in the device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5c2aeac5 11-Jun-2013 Simon Glass <sjg@chromium.org>

Support tracing in config.mk when enabled

Use -finstrument-functions when tracing is enabled (make FTRACE=1).
Tracing is not currently supported by SPL even if sufficient memory is
available.

When tracing is enabled, we #define FTRACE. This can be used by
board config files to conditionally enable the tracing options.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d642c467 27-Apr-2013 Marek Vasut <marex@denx.de>

build: Pull -DBUILD_TAG into separate ifdef

Currently the base setting for CFLAGS is split in two possibilities,
one with -DBUILD_TAG appended at the end and one without, the rest of
CFLAGS is the same in both cases. Change this so CFLAGS are always set
and the -DBUILD_TAG is appended in separate ifdef.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Tom Rini <trini@ti.com>
Reviewed-by: Otavio Salvador <otavio@ossystems.com.br>

# fada9e20 20-Apr-2013 Simon Glass <sjg@chromium.org>

Trigger generic board error only when building

At present the generic board error can occur when configuring U-Boot, or
during distclean, but this is incorrect. The existing autoconf.mk may come
from an earlier U-Boot configuration which is about to be overwritten.

Make the error conditional so that it will only be triggered when we are
actually building U-Boot.

This avoids a problem where the system is being reconfigured to remove
CONFIG_SYS_GENERIC_BOARD on an architecture that does not support it.
Currently this will print an error and require the manual removal of
include/autoconf.mk.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ecddccd0 22-Feb-2013 Stefan Roese <sr@denx.de>

Makefile: Add target for combined u-boot.img & spl/u-boot.bin

This new make target "u-boot-img-spl-at-end.bin" consists of the
the real, full-blown U-Boot image and the U-Boot SPL binary
directly attached to it. The full-blown U-Boot image has the
mkimage header included, with its load-address and entry-point.

This will be used by the upcoming lwmon5 PPC440EPx derivate board
port.

Signed-off-by: Stefan Roese <sr@denx.de>

# 120ae609 11-Apr-2013 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Makefile: Move SHELL setup to config.mk

make never uses the SHELL variable from the environment. Instead, it
uses /bin/sh, or the value assigned to the SHELL variable by the Makefile. This
makes the export of the SHELL variable useless for sub-makes (but still useful
for the environment of recipes). However, we want all makes to use the same
shell.

This patch fixes this issue by moving the SHELL variable setup and export to the
top config.mk, so that all Makefile-s including it use the same shell.

Since BASH is used by default, this makes it possible to use things
like 'echo -e ...' in sub-makes, which would otherwise fail e.g. with /bin/sh
symlinked to /bin/dash on Ubuntu.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 0ce033d2 17-Mar-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Albert's rework of the linker scripts conflicted with Simon's making
everyone use __bss_end. We also had a minor conflict over
README.scrapyard being added to in mainline and enhanced in
u-boot-arm/master with proper formatting.

Conflicts:
arch/arm/cpu/ixp/u-boot.lds
arch/arm/cpu/u-boot.lds
arch/arm/lib/Makefile
board/actux1/u-boot.lds
board/actux2/u-boot.lds
board/actux3/u-boot.lds
board/dvlhost/u-boot.lds
board/freescale/mx31ads/u-boot.lds
doc/README.scrapyard
include/configs/tegra-common.h

Build tested for all of ARM and run-time tested on am335x_evm.

Signed-off-by: Tom Rini <trini@ti.com>


# 5c1a7ea6 08-Mar-2013 Simon Glass <sjg@chromium.org>

__HAVE_ARCH_GENERIC_BOARD controls availabilty of generic board

We are introducing a new unified board setup. Add a check to make sure that
board config files do not define CONFIG_SYS_GENERIC_BOARD unless their
architecture defines __HAVE_ARCH_GENERIC_BOARD

__HAVE_ARCH_GENERIC_BOARD will currently not be the default setting, but
we can switch this later when most architecture support generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ef123c52 24-Feb-2013 Albert ARIBAUD <albert.u.boot@aribaud.net>

Refactor linker-generated arrays

Refactor linker-generated array code so that symbols
which were previously linker-generated are now compiler-
generated. This causes relocation records of type
R_ARM_ABS32 to become R_ARM_RELATIVE, which makes
code which uses LGA able to run before relocation as
well as after.

Note: this affects more than ARM targets, as linker-
lists span possibly all target architectures, notably
PowerPC.

Conflicts:
arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
arch/arm/cpu/arm926ejs/spear/u-boot-spl.lds
arch/arm/cpu/armv7/omap-common/u-boot-spl.lds
board/ait/cam_enc_4xx/u-boot-spl.lds
board/davinci/da8xxevm/u-boot-spl-da850evm.lds
board/davinci/da8xxevm/u-boot-spl-hawk.lds
board/vpac270/u-boot-spl.lds

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 97b24d3d 18-Oct-2012 Marek Vasut <marex@denx.de>

common: Add symbol handling for generic lists into Makefile

This patch adds essential components for generation of the contents of
the linker section that is used by the linker-generated array. All of
the contents is held in a separate file, u-boot.lst, which is generated
at runtime just before U-Boot is linked.

The purpose of this code is to especially generate the appropriate
boundary symbols around each subsection in the section carrying the
linker-generated arrays. Obviously, the interim linker code for actual
placement of the variables into the section is generated too. The
generated file, u-boot.lst, is included into u-boot.lds via the linker
INCLUDE directive in u-boot.lds .

Adjustments are made in the Makefile and spl/Makefile so that the
u-boot.lds and u-boot-spl.lds depend on their respective .lst files.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@gmail.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Tested-by: Joe Hershberger <joe.hershberger@ni.com>

# 4ab64933 20-Sep-2012 Kim Phillips <kim.phillips@freescale.com>

add check infrastructure, default sparse

Add support for running source code checkers on u-boot source, e.g.,
using sparse to aid with typechecking. This comes in especially
handy as SoC vendors mix and match cores and devices with different
endianness, thus here we add CHECK_ENDIAN to the otherwise linux
kernel default CHECKFLAGS.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

# c1f5805a 14-Sep-2012 Marek Vasut <marex@denx.de>

serial: Compile drivers/serial/serial.c by default

Compile drivers/serial/serial.c by default both into SPL and into
non-SPL builds, since CONFIG_SERIAL_MULTI is now the default state.
Also having common/serial.c in by default now, it's pointless to keep
-DCONFIG_SERIAL_MULTI in CPPFLAGS any longer, so remove it as well.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>

# 82dda962 14-Sep-2012 Marek Vasut <marex@denx.de>

serial: Unconditionally enable CONFIG_SERIAL_MULTI

Enable CONFIG_SERIAL_MULTI for all builds of U-Boot. That includes
both SPL builds and non-SPL builds, everything. To avoid poluting
this patch with removal of ifdef-endif constructions containing
CONFIG_SERIAL_MULTI, the CONFIG_SERIAL_MULTI is temporarily added
into CPPFLAGS in config.mk . This will be again removed in following
patch.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>

# 2051ff34 15-Aug-2012 Allen Martin <amartin@nvidia.com>

tools, config.mk: add binutils-version

Modeled after gcc-version, add function to get binutils version.

Signed-off-by: Allen Martin <amartin@nvidia.com>
Acked-by: Wolfgang Denk <wd@denx.de>

# 7cb714a5 02-Aug-2012 Khem Raj <raj.khem@gmail.com>

config: Always use GNU ld

This patch makes sure that we always use the GNU ld. U-Boot uses certain
construct e.g. OVERLAY which are not implemented in gold therefore it
always needs GNU ld for linking.

It works well if default linker in toolchain is GNU ld but in some
cases we can have gold to be the default linker and also ship GNU ld
but not as default in such cases its called $(PREFIX)ld.bfd, with this
patch we make sure that if $(PREFIX)ld.bfd exists than we use that for
our ld.

This way it does not matter what the default ld is.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 94aebe6c 05-Jan-2012 Stefan Roese <sr@denx.de>

Makefile: Add u-boot.spr build target (SPEAr)

On x600 (SPEAr600) U-Boot is appended to U-Boot SPL. Both images are
created using mkimage (crc etc), so that the ROM bootloader can check
its integrity. Padding needs to be done to the SPL image (with
mkimage header) and not the binary. Otherwise the resulting image
which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
The resulting image containing both U-Boot images is called u-boot.spr.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Amit Virdi <amit.virdi@st.com>
Cc: Vipin Kumar <vipin.kumar@st.com>

# 19a695f8 15-Mar-2012 Tom Rini <trini@ti.com>

tools, config.mk: Add gcc-version.sh, cc-version test from Linux

Added from Linux - commit fde7d9049e55ab85a390be7f415d74c9f62dd0f9

Signed-off-by: Tom Rini <trini@ti.com>

# 4a30f1e8 20-Feb-2012 Tom Rini <trini@ti.com>

config.mk: Check for -fstack-usage support

Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Tom Rini <trini@ti.com>

# 6f4acc17 14-Feb-2012 Tom Rini <trini@ti.com>

config.mk: Make cc-option create a file under include/generated

Testing for -fstack-usage requires the creation of an output file, which
isn't possible with /dev/null.

Signed-off-by: Tom Rini <trini@ti.com>

# b6a467d7 06-Nov-2011 Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

config.mk: use memoization in cc-option macro to speed up compilation

Apply memoization to cc-option macro by caching the results of the
gcc calls. This macro is called very often so using cached results
leads to faster compilation times.

The old behaviour can be restored by defining the config option
CONFIG_CC_OPT_CACHE_DISABLE=y.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

# cca4e4ae 01-Nov-2011 Wolfgang Denk <wd@denx.de>

Reduce build times

U-Boot Makefiles contain a number of tests for compiler features etc.
which so far are executed again and again. On some architectures
(especially ARM) this results in a large number of calls to gcc.

This patch makes sure to run such tests only once, thus largely
reducing the number of "execve" system calls.

Example: number of "execve" system calls for building the "P2020DS"
(Power Architecture) and "qong" (ARM) boards, measured as:
-> strace -f -e trace=execve -o /tmp/foo ./MAKEALL <board>
-> grep execve /tmp/foo | wc -l

Before: After: Reduction:
==================================
P2020DS 20555 15205 -26%
qong 31692 14490 -54%

As a result, built times are significantly reduced, typically by
30...50%.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Albert Aribaud <albert.aribaud@free.fr>
cc: Graeme Russ <graeme.russ@gmail.com>
cc: Mike Frysinger <vapier@gentoo.org>
Tested-by: Graeme Russ <graeme.russ@gmail.com>
Tested-by: Matthias Weisser <weisserm@arcor.de>
Tested-by: Sanjeev Premi <premi@ti.com>
Tested-by: Simon Glass <sjg@chromium.org>
Tested-by: Macpaul Lin <macpaul@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# bbb0b128 14-Oct-2011 Simon Glass <sjg@chromium.org>

fdt: Add support for embedded device tree (CONFIG_OF_EMBED)

This new option allows U-Boot to embed a binary device tree into its image
to allow run-time control of peripherals. This device tree is for U-Boot's
own use and is not necessarily the same one as is passed to the kernel.

The device tree compiler output should be placed in the $(obj)
rooted tree. Since $(OBJCOPY) insists on adding the path to the
generated symbol names, to ensure consistency it should be
invoked from the directory where the .dtb file is located and
given the input file name without the path.

This commit contains my entry for the ugliest Makefile / shell interaction
competition.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5968adc4 12-Oct-2011 Mike Frysinger <vapier@gentoo.org>

build: force migration away from $(AR)

People keep adding new code that still uses $(AR) instead of
$(cmd_link_o_target), so turn it into a build time error.

We still use $(AR) locally, but we don't use $(ARFLAGS).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 47508843 07-Oct-2011 Simon Glass <sjg@chromium.org>

Adjust dependency rules to permit per-file flags

The dependency rules are currently done in a shell 'for' loop. This does not
permit Makefile variables to adjust preprocessor flags as is done with normal
compile flags, using the CFLAGS_path/file.o syntax.

This change moves the dependency generation into the Makefile itself, and
permits a CPPFLAGS_path/file.o to adjust preprocessor flags on a file or
directory basis.

The CPPFLAGS_... variable is also folded into CFLAGS during the build.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6262e4e7 25-Apr-2011 Mike Frysinger <vapier@gentoo.org>

disable security warning flags when possible

Some toolchains enable security warning flags by default, but these don't
really make sense in the u-boot world. Such as forcing changes like:
-printf(foo);
+printf("%s", foo);

So disable the flags when the compiler supports them. Linux has already
merged a similar change in their build system.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# c8f9c302 18-Jul-2011 Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

Extend build-system for SPL framework

Signed-off-by: Aneesh V <aneesh@ti.com>
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

# d51dfff7 19-Jun-2011 Ilya Yanok <yanok@emcraft.com>

config.mk: move LDSCRIPT processing to the top-level Makefile

LDSCRIPT is used only from the top-level Makefile and only when the
system is configured so we can move LDSCRIPT and CONFIG_SYS_LDSCRIPT
related logic into the top level Makefile and under configured condition
to avoid errors when building tools from unconfigured tree.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 83b7e2a7 06-Apr-2011 Scott Wood <scottwood@freescale.com>

Handle most LDSCRIPT setting centrally

Currently, some linker scripts are found by common code in config.mk.
Some are found using CONFIG_SYS_LDSCRIPT, but the code for that is
sometimes in arch config.mk and sometimes in board config.mk. Some
are found using an arch-specific rule for looking in CPUDIR, etc.

Further, the powerpc config.mk rule relied on CONFIG_NAND_SPL
when it really wanted CONFIG_NAND_U_BOOT -- which covered up the fact
that not all NAND_U_BOOT builds actually wanted CPUDIR/u-boot-nand.lds.

Replace all of this -- except for a handful of boards that are actually
selecting a linker script in a unique way -- with centralized ldscript
finding.

If board code specifies LDSCRIPT, that will be used.
Otherwise, if CONFIG_SYS_LDSCRIPT is specified, that will be used.

If neither of these are specified, then the central config.mk will
check for the existence of the following, in order:

$(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT)
$(TOPDIR)/$(CPUDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT)
$(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
$(TOPDIR)/$(CPUDIR)/u-boot.lds

Some boards (sc3, cm5200, munices) provided their own u-boot.lds that
were dead code, because they were overridden by a CPUDIR u-boot.lds under
the old powerpc rules. These boards' own u-boot.lds have bitrotted and
no longer work -- these lds files have been removed.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Tested-by: Graeme Russ <graeme.russ@gmail.com>

# 6dc1eceb 22-Feb-2011 Haiying Wang <Haiying.Wang@freescale.com>

Introduce a new linker flag LDFLAGS_FINAL

commit 8aba9dceebb14144e07d19593111ee3a999c37fc
Divides variable of linker flags to LDFLAGS-u-boot and LDFLAGS

breaks the usage of --gc-section to build nand_spl. We still need linker option
--gc-section for every uboot image, not only the main one. LDFLAGS_FINAL passes
the --gc-sections to each uboot image.

To get the proper linker flags, we use LDFLAGS and LDFLAGS_FINAL to replace
PLATFORM_LDFLAGS in the Makefile of each nand_spl board.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>

# 5e987ddf 17-Jan-2011 Joakim Tjernlund <Joakim.Tjernlund@transmode.se>

Top config.mk: add include/config.mk

Seems to me that the top level config.mk should include
the auto generated include/config.mk so that all Makefile's
pickup those definitions.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>

# 8aba9dce 05-Jan-2011 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

Divides variable of linker flags to LDFLAGS-u-boot and LDFLAGS

Linker needs to use the proper endian/bfd flags even when doing partial linking.
LDFLAGS_u-boot sets linker option which is called it when U-boot is built
(u-boot final).
LDFLAGS sets necessary option by partial linking (use in cmd_link_o_target).

CC: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

# 326a6945 15-Dec-2010 Mike Frysinger <vapier@gentoo.org>

config.mk: unify duplicated flag setting

Multiple rules are using the expanded AFLAGS/CFLAGS settings and some are
getting so long that the rules need to be line wrapped. So unify them in
one variable, use that variable in the rule, and then unwrap things. This
makes the actual `make` output nicer as it doesn't have line continuations
in it anymore.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 844f07d8 27-Nov-2010 Wolfgang Denk <wd@denx.de>

Coding Style (white space) cleanup

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 6d8962e8 05-Nov-2010 Sebastien Carlier <sebastien.carlier@gmail.com>

Switch from archive libraries to partial linking

Before this commit, weak symbols were not overridden by non-weak symbols
found in archive libraries when linking with recent versions of
binutils. As stated in the System V ABI, "the link editor does not
extract archive members to resolve undefined weak symbols".

This commit changes all Makefiles to use partial linking (ld -r) instead
of creating library archives, which forces all symbols to participate in
linking, allowing non-weak symbols to override weak symbols as intended.
This approach is also used by Linux, from which the gmake function
cmd_link_o_target (defined in config.mk and used in all Makefiles) is
inspired.

The name of each former library archive is preserved except for
extensions which change from ".a" to ".o". This commit updates
references accordingly where needed, in particular in some linker
scripts.

This commit reveals board configurations that exclude some features but
include source files that depend these disabled features in the build,
resulting in undefined symbols. Known such cases include:
- disabling CMD_NET but not CMD_NFS;
- enabling CONFIG_OF_LIBFDT but not CONFIG_QE.

Signed-off-by: Sebastien Carlier <sebastien.carlier@gmail.com>

# 14d0a02a 07-Oct-2010 Wolfgang Denk <wd@denx.de>

Rename TEXT_BASE into CONFIG_SYS_TEXT_BASE

The change is currently needed to be able to remove the board
configuration scripting from the top level Makefile and replace it by
a simple, table driven script.

Moving this configuration setting into the "CONFIG_*" name space is
also desirable because it is needed if we ever should move forward to
a Kconfig driven configuration system.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# f534c7cd 03-Aug-2010 Mike Frysinger <vapier@gentoo.org>

config.mk: avoid -traditional-cpp on OS X 10.5

Simply trying to include a basic header file like stdlib.h on OS X 10.5
and then building with -traditional-cpp fails with lots of errors like:
In file included from /usr/include/stdlib.h:63,
from test.c:3:
/usr/include/available.h:85: error: stray '#' in program
/usr/include/available.h:85: error: syntax error before numeric constant
/usr/include/available.h:86: error: stray '#' in program

In the past, I hadn't noticed because the old logic for these flags were
restricted to Darwin running on PowerPC systems while I'm running on an
Intel system. But after some recent clean ups and changes, the flag was
being applied to all Darwin systems and my host tools broke.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 1117cbf2 27-May-2010 Thomas Chou <thomas@wytron.com.tw>

nios: remove nios-32 arch

The nios-32 arch is obsolete and broken. So it is removed.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# c7da8c19 22-May-2010 Andreas Bießmann <andreas.devel@googlemail.com>

config.mk: use different host compiler for OS X 10.6

Compiling tools subdirectory on Mac OS X 10.6 (Snow Leopard) complains about
wrong syntax in system includes.

In file included from /usr/include/stdio.h:444,
from ../source/u-boot/include/compiler.h:26,
from ../source/u-boot/lib/crc32.c:15:
/usr/include/secure/_stdio.h:46: error: syntax error in macro parameter list

This can be fixed by reverting the workaround for prior OS X releases in
config.mk conditionally for OS X 10.6+.

Signed-off-by: Andreas Bie�mann <andreas.devel@googlemail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8d1f2682 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

ppc: Move cpu/$CPU to arch/ppc/cpu/$CPU

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# ea0364f1 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Move lib_$ARCH directories to arch/$ARCH/lib

Also move lib_$ARCH/config.mk to arch/$ARCH/config.mk

This change is intended to clean up the top-level directory structure
and more closely mimic Linux's directory organization.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# 89f39e17 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Change directory-specific CFLAGS to use full path

Previously, a specific file or directory could be compiled with custom
CFLAGS by adding a Makefile variable such as:
CFLAGS_dlmalloc.o = <custom flags for common/dlmalloc.c>
or
CFLAGS_lib = <custom flags for lib directory>

This method breaks down once multiple files or directories share the
same path. Eg FLAGS_fileA = <custom flags> would incorrectly result in
both dir1/fileA.c and dir2/fileA.c being compiled with <custom flags>.

This change allows finer grained control which we need once we move
lib_$ARCH to arch/$ARCH/lib/ and lib_generic/ to lib/. Without this
change all lib/ directories would share the same custom CFLAGS.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# 03b7004d 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Create CPUDIR variable

The CPUDIR variable points to the location of a target's CPU directory.
Currently, it is set to cpu/$CPU. However, using $CPUDIR will allow for
more flexibility in the future. It lays the groundwork for reorganizing
U-Boot's directory structure to support a layout such as:

arch/$ARCH/cpu/$CPU/* (architecture with multiple CPU types)
arch/$ARCH/cpu/* (architecture with one CPU type)

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# d984fed0 04-Nov-2009 Scott Wood <scottwood@freescale.com>

makefiles: fixes for building build tools

Currently, some of the tools instead set CC to be HOSTCC in order to re-use
some pattern rules -- but this fails when the user overrides CC on the make
command line. Also, the HOSTCFLAGS in tools/Makefile are currently not
being used because config.mk overwrites them.

This patch adds static pattern rules for files that have been requested to
be built with the native compiler using $(HOSTSRCS) and $(HOSTOBJS), and
converts the tools to use them.

It restores easylogo to using the host compiler, which was broken by commit
38d299c2db81bd889c601b5dfc12c4e83ef83333 (if this was an intentional change,
please let me know -- but it seems to be a build tool).

It restores -pedantic and the special flags for darwin and cygwin that were
requested in tools/makefile (but keeps the flags added by config.mk) --
hopefully someone can test this on those platforms. It no longer
conditionalizes -pedantic on not being darwin; it wasn't clear that that was
intentional, and unless there's a real problem it's just inviting people to
contribute non-pedantic patches to those files (I'm not a fan of -pedantic
personally, but if it's on for one platform it should be on for all).

HOST_LDFLAGS is renamed HOSTLDFLAGS for consistency with the previous
HOST_CFLAGS to HOSTCFLAGS rename. A new HOSTCFLAGS_NOPED is made available
for those files which currently cannot be built with -pedantic, and replaces
the old FIT_CFLAGS.

imls now uses the cross compiler properly, rather than by trying to
reconstruct CC using the typoed $(CROSS_COMPILER).

envcrc.c is now dependency-processed unconditionally -- previously it would
be built without being on (HOST)SRCS if CONFIG_ENV_IS_EMBEDDED was not
selected.

Signed-off-by: Scott Wood <scottwood@freescale.com>

# 6c97a20d 09-Sep-2009 Kumar Gala <galak@kernel.crashing.org>

ppc/85xx: Introduce RESET_VECTOR_ADDRESS to handle non-standard link address

Some board ports place TEXT_BASE at a location that would cause the
RESET_VECTOR_ADDRESS not to be at 0xfffffffc when we link. By default
we assume RESET_VECTOR_ADDRESS will be 0xfffffffc if the board doesn't
explicitly set it.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Wolfgang Denk <wd@denx.de>

# 6ac9f479 23-Aug-2009 Mike Frysinger <vapier@gentoo.org>

start a linker script helper file

Start a common header file for common linker script code (such as
workarounds for older linkers) rather than doing this in the build system.

As fallout, we no longer execute the linker every time config.mk is
included by a build file (which can easily be 70+ times), but rather only
execute it once.

This also fixes a bug in the major version checking by creating a macro to
easily compare versions and keep people from making the same common
mistake (forgetting to check major and minor together).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 1aada9cd 17-Aug-2009 Wolfgang Denk <wd@denx.de>

Fix all linker scripts for older binutils versions (pre-2.16)

Commit f62fb99941c6 fixed handling of all rodata sections by using a
wildcard combined with calls to ld's builtin functions SORT_BY_ALIGNMENT()
and SORT_BY_NAME(). Unfortunately these functions were only
introduced with biunutils version 2.16, so the modification broke
building with all tool chains using older binutils.

This patch makes it work again. This is done by omitting the use of
these functions for such old tool chains. This will result in
slightly larger target binaries, as the rodata sections are no longer
in optimal order alignment-wise which reauls in unused gaps, but the
effect was found to be insignificant - especially compared to the fact
that you cannot build U-Boot at all in the current state.

As ld seems to have no support for conditionals we run the linker
script through the C preprocessor which can be easily used to remove
the unwanted function calls.

Note that the C preprocessor must be run with the "-ansi" (or a
"-std=") option to make sure all the system-specific predefined
macros outside the reserved namespace are suppressed. Otherise, cpp
might for example substitute "powerpc" to "1", thus corrupting for
example "OUTPUT_ARCH(powerpc)" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>

# f772acf8 17-Aug-2009 Wolfgang Denk <wd@denx.de>

ARM: compiler options cleanup - improve tool chain support

For some time there have been repeated reports about build problems
with some ARM (cross) tool chains. Especially issues about
(in)compatibility with the tool chain provided runtime support
library libgcc.a caused to add and support a private implementation
of such runtime support code in U-Boot. A closer look at the code
indicated that some of these issues are actually home-made. This
patch attempts to clean up some of the most obvious problems and make
building of U-Boot with different tool chains easier:

- Even though all ARM systems basicy used the same compiler options
to select a specific ABI from the tool chain, the code for this was
distributed over all cpu/*/config.mk files. We move this one level
up into lib_arm/config.mk instead.

- So far, we only checked if "-mapcs-32" was supported by the tool
chain; if yes, this was used, if not, "-mabi=apcs-gnu" was
selected, no matter if the tool chain actually understood this
option. There was no support for EABI conformant tool chains.
This patch implements the following logic:

1) If the tool chain supports
"-mabi=aapcs-linux -mno-thumb-interwork"
we use these options (EABI conformant tool chain).
2) Otherwise, we check first if
"-mapcs-32"
is supported, and then check for
"-mabi=apcs-gnu"
If one test succeeds, we use the first found option.
3) In case 2), we also test if "-mno-thumb-interwork", and use
this if the test succeeds. [For "-mabi=aapcs-linux" we set
"-mno-thumb-interwork" mandatorily.]

This way we use a similar logic for the compile options as the
Linux kernel does.

- Some EABI conformant tool chains cause external references to
utility functions like raise(); such functions are provided in the
new file lib_arm/eabi_compat.c

Note that lib_arm/config.mk gets parsed several times, so we must
make sure to add eabi_compat.o only once to the linker list.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Dirk Behme <dirk.behme@googlemail.com>
Cc: Magnus Lilja <lilja.magnus@gmail.com>
Cc: Tom Rix <Tom.Rix@windriver.com>
Cc: Prafulla Wadaskar <prafulla@marvell.com>
Acked-by: Sergey Kubushyn <ksi@koi8.net>
Tested-by: Magnus Lilja <lilja.magnus@gmail.com>
Tested-by: Andrzej Wolski <awolski@poczta.fm>
Tested-by: Gaye Abdoulaye Walsimou <walsimou@walsimou.com>
Tested-by: Tom Rix <Tom.Rix@windriver.com>
Tested-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# b220c64d 10-Jul-2009 Peter Tyser <ptyser@xes-inc.com>

Move architecture specific config.mk files into subdirs

This cleans up U-Boot's toplevel directory a bit and makes the
architecture 'config.mk' file naming and location similar to board
and cpu 'config.mk' files

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# cff80f2c 20-Jun-2009 Shinya Kuribayashi <skuribay@pobox.com>

config.mk: Remove unused HPATH

This variable is not unused anywhere.

Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>

# 12e9043c 20-Jun-2009 Shinya Kuribayashi <skuribay@pobox.com>

config.mk: Remove $(PCI_CLOCK) reference

The following commit introduced $(PCI_CLOCK) reference so that
we could tweak `PCI_66M' definition via an environment variable.

> commit f046ccd15c8bc9613bfd72916b761a127d36e5c6
> Author: Eran Liberty <liberty@freescale.com>
> Date: Thu Jul 28 10:08:46 2005 -0500
>
> * Patch by Eran Liberty
> Add support for the Freescale MPC8349ADS board.

But I suggest a removal of it for the following reasons:

* In 2006, MPC8349ADS was merged into MPC8349EMDS port,
and it seems that MPC8349EMDS port is PCI_66M free.

* OTOH, PCI_66M is used by MPC832XEMDS an MPC8360EMDS ports,
but they don't need $(PCI_CLOCK) environment variable at all.
PCI_66M is automatically configured via $(BOARD)_config names
with the help of $(findstring _66_,$@).

* Unfortunately $(PCI_CLOCK) has been undocumented anywhere,
so only a few people know the existence of it these days.

* Keep config.mk independent from $(BOARD) as much as possible.

Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# 31f30c9e 14-Jun-2009 Mike Frysinger <vapier@gentoo.org>

add %.c->%.i and %.c->%.s rules

The Linux kernel has some helper rules which allow you to quickly produce
some of the intermediary files from C source. Specifically, you can
create .i files which is the preprocessed output and you can create .s
files which is the assembler output. This is useful when you are trying
to track down header/macro expansion errors or inline assembly errors.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 5ec5529b 14-Jun-2009 Mike Frysinger <vapier@gentoo.org>

allow boards to customize compiler options on a per-file/dir basis

With our Blackfin boards, we like to build the compression routines with
-O2 as our tests show a pretty good size/speed tradeoff. For the rest of
U-Boot though, we want to stick with the default -Os as that is mostly
control code. So in our case, we would add a line like so to the board
specific config.mk file:
CFLAGS_lib_generic += -O2

Now all files under lib_generic/ will have -O2 appended to their build.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 3112030a 22-May-2009 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

config.mk: remove un-needed REMOTE_BUILD check

as $(obj) is empty when in tree build

%.s: %.S
$(CPP) $(AFLAGS) -o $@ $<

and

$(obj)%.s: %.S
$(CPP) $(AFLAGS) -o $@ $<

are the same

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 4cda4378 17-Jan-2009 Mike Frysinger <vapier@gentoo.org>

build system: treat all Darwin's alike

The x86 based version of Darwin behaves the same quirky way as the powerpc
Darwin, so only check HOSTOS when setting up Darwin workarounds.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 434c51a5 12-Nov-2008 Peter Tyser <ptyser@xes-inc.com>

Remove unneeded CONFIG_SHELL references

Make should be using the bash shell by default which makes
CONFIG_SHELL unnecessary

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# 03db5333 11-Sep-2008 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

make: Remove redundant __ARM__ addition when cross-compiling on *BSD

__ARM__ is given by arm_config.mk automatically.

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

# 6b971c73 30-Aug-2008 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

config.mk: Move arch-specific condition to $(ARCH)_config.mk

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

# 28eab0d7 18-May-2008 Haavard Skinnemoen <hskinnemoen@atmel.com>

Conditionally add -fno-stack-protector to CFLAGS

When compile-testing on powerpc, I get errors like this:

net/nfs.c:422: undefined reference to `__stack_chk_fail_local'

This seems to be because -fstack-protector is on by default, so
let's explicitly disable it on all architectures that support the
option.

The Ubuntu toolchain is affected by this problem, and according to
Mike Frysinger, Gentoo has been running with SSP enabled for years.
More and more distros are turning SSP on by default, so this problem
is likely to get worse in the future.

Also, powerpc just happens to be one of the arches I do
compile-testing on. There may be other arches affected by this too.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>

# 53677ef1 20-May-2008 Wolfgang Denk <wd@denx.de>

Big white-space cleanup.

This commit gets rid of a huge amount of silly white-space issues.
Especially, all sequences of SPACEs followed by TAB characters get
removed (unless they appear in print statements).

Also remove all embedded "vim:" and "vi:" statements which hide
indentation problems.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# c4e5f52a 03-May-2008 Wolfgang Denk <wd@denx.de>

config.mk: use correct (cross) compiler

Some config.mk files reference $(CC) to test for specific tool chain
features, so make sure $(CC) gets set before including any such
config files.

This patch replaces commit b7166e05a5 ("ColdFire: Get information from
the correct GCC").

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 755c35f5 18-Feb-2008 Mike Frysinger <vapier@gentoo.org>

include autoconf.mk before any other .mk files

This bumps the autoconf.mk include step above board/cpu/arch/etc... so that
those .mk files can have make if statements based on the current config.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 6f99eec3 14-Feb-2008 Wolfgang Denk <wd@denx.de>

Merge branch 'master' of git://www.denx.de/git/u-boot-blackfin

Conflicts:

Makefile
doc/README.standalone

Signed-off-by: Wolfgang Denk <wd@denx.de>


# 161b2af4 28-Jan-2008 Mike Frysinger <vapier@gentoo.org>

Only use TEXT_BASE if defined by the board

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 94a91e24 04-Feb-2008 Mike Frysinger <vapier@gentoo.org>

generate u-boot.ldr for Blackfin targets

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 2f155f6c 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

[BUILD] Generate include/autoconf.mk from board config files

Use cpp and sed to postprocess config.h and import the defined values
into include/autoconf.mk. autoconf.mk is then included by config.mk to
give 'make' access to the board configuration.

Doing this enables conditional compilation at the Makefile level instead
of by wrapping every .c file with #ifdef/#endif wrappers.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# ad845bee 30-Oct-2007 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

blackfin: Move `-D__BLACKFIN__' to $(ARCH)_config.mk

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

# ef26a08f 08-Mar-2007 Aubrey.Li <aubrey.adi@gmail.com>

[Blackfin][PATCH-2/2] Common files changed to support bf533 platform

# 1954be6e 28-Oct-2006 Wolfgang Denk <wd@pollux.denx.de>

Automatically adjust ARFLAGS so "make -s" is really silent.

# e11887a7 26-Oct-2006 Haavard Skinnemoen <hskinnemoen@atmel.com>

Don't pass any debug options directly to the assembler

When passing the -g option to gcc, gcc automatically selects a
suitable --g<format> option to pass on to the assembler.
Thus, there's no point in forcing a specific debug option on the
assembler using the -Wa mechanism.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>

# 2da2d9a4 24-Oct-2006 Wolfgang Denk <wd@pollux.denx.de>

Use -g instead of -gstabs in AFLAGS_DEBUG
Patch by Haavard Skinnemoen, 30 Aug 2006

In config.mk, -Wa,-gstabs is unconditionally appended to AFLAGS no
matter what the target's preferred debugging format is. This patch
simply replaces -gstabs with -g, so that the default debugging format
for the architecture is used.

# 2b208f53 08-Oct-2006 Wolfgang Denk <wd@atlas.denx.de>

Move "ar" flags to config.mk to allow for silent "make -s"
Based on patch by Mike Frysinger, 20 Jun 2006

# 511d0c72 08-Oct-2006 Wolfgang Denk <wd@atlas.denx.de>

Coding style cleanup

# 887e2ec9 07-Sep-2006 Stefan Roese <sr@denx.de>

Add support for AMCC Sequoia PPC440EPx eval board
- Add support for PPC440EPx & PPC440GRx
- Add support for PPC440EP(x)/GR(x) NAND controller
in cpu/ppc4xx directory
- Add NAND boot functionality for Sequoia board,
please see doc/README.nand-boot-ppc440 for details
- This Sequoia NAND image doesn't support environment
in NAND for now. This will be added in a short while.
Patch by Stefan Roese, 07 Sep 2006

# f9328639 01-Sep-2006 Marian Balakowicz <m8@semihalf.com>

Add support for a saving build objects in a separate directory.
Modifications are based on the linux kernel approach and
support two use cases:

1) Add O= to the make command line
'make O=/tmp/build all'

2) Set environement variable BUILD_DIR to point to the desired location
'export BUILD_DIR=/tmp/build'
'make'

The second approach can also be used with a MAKEALL script
'export BUILD_DIR=/tmp/build'
'./MAKEALL'

Command line 'O=' setting overrides BUILD_DIR environent variable.

When none of the above methods is used the local build is performed and
the object files are placed in the source directory.

# 4176c799 10-Jun-2006 Wolfgang Denk <wd@pollux.denx.de>

Merge with /home/hs/U-Boot/u-boot-dev


# b62fa913 16-May-2006 Marian Balakowicz <m8@semihalf.com>

Fix gcc 3.4.x AFLAGS setting for m68k platform.

# 483a0cf8 09-May-2006 Marian Balakowicz <m8@semihalf.com>

Fixes for gcc 3.4 based m68k toolchain,
based on patch by Jate Sujjavanich.

# 9acb626f 20-Apr-2006 Heiko Schocher <hs@pollux.denx.de>

Add MCF5282 support (without preloader)
relocate ichache_State to ram
u-boot can run from internal flash
Add EB+MCF-EV123 board support.
Add m68k Boards to MAKEALL
Patch from Jens Scharsig, 08 Aug 2005

# 0afe519a 11-Mar-2006 Wolfgang Denk <wd@pollux.denx.de>

Add ADI Blackfin support
- add support for Analog Devices Blackfin BF533 CPU
- add support for the ADI BF533 Stamp uClinux board
- add support for the ADI BF533 EZKit board
Patches by Richard Klingler, June 11th 2005:

# 0be248fa 06-Mar-2006 Wolfgang Denk <wd@atlas.denx.de>

Cleanup (get rid of debug code that sneaked in)

# 00c35bd2 28-Feb-2006 Markus Klotzb�cher <Markus Klotzb�mk@pollux.(none)>

Added GPIO initialization of DF signal. Still not working.

# e0269579 07-Feb-2006 Markus Klotzb�cher <Markus Klotzb�mk@pollux.(none)>

This is the first commit for the u-boot zylonite port. The following has be
done so far:

* created zylonite board dir (based on lubbock)
* extended some - but not all pxa sources and headers for Intel
Monahans support (CONFIG_CPU_MONAHANS)
* created Makefile zylonite target + MAKEALL entry
* added some debug nonsense, remove later, grep for mk@tbd

Status: compiles (eldk-4.0), and can be started with BDI, but runs forever
and doesn't halt at breakpoints. Hmmm...

# 9b880bd4 04-Oct-2005 Wolfgang Denk <wd@pollux.denx.de>

Update ARM Integrator boards:
Correct addessing errors in platform files.
Split off common core module data from Integrator header files to
include/armcoremodule.h.
Patch by Peter Pearse, 04 Oct 2005

# 1820d4c7 04-Oct-2005 Wolfgang Denk <wd@pollux.denx.de>

Make sure only supported compiler options are used
Import "cc-option" shell function from kernel and
use it to get the correct ARM GCC options for individual CPUs
Patch by Peter Pearse, 30 Jun 2005

# f046ccd1 28-Jul-2005 Eran Liberty <liberty@freescale.com>

* Patch by Eran Liberty
Add support for the Freescale MPC8349ADS board.

# 1d9f4105 09-Oct-2004 Wolfgang Denk <wdenk>

Patch by Steven Scholz, 16 Aug 2004:
- Introducing the concept of SoCs "./cpu/$(CPU)/$(SOC)"
- creating subdirs for SoCs ./cpu/arm920t/imx and ./cpu/arm920t/s3c24x0
- moving SoC specific code out of cpu/arm920t/ into cpu/arm920t/$(SOC)/
- moving drivers/s3c24x0_i2c.c and drivers/serial_imx.c out of drivers/
into cpu/arm920t/$(SOC)/

# e4cc71aa 19-May-2004 Wolfgang Denk <wdenk>

Patch by Scott McNutt, 25 Apr 2004:
Add Nios GDB/JTAG Console support:
- Add stubs to support gdb via JTAG.
- Add support for console over JTAG.
- Minor cleanup.

# c40b2956 13-Mar-2004 Wolfgang Denk <wdenk>

* Patch by Rune Torgersen, 27 Feb 2004:
- Added LBA48 support (CONFIG_LBA48 & CFG_64BIT_LBA)
- Added support for 64bit printing in vsprintf (CFG_64BIT_VSPRINTF)
- Added support for 64bit strtoul (CFG_64BIT_STRTOUL)

* Patch by Masami Komiya, 27 Feb 2004:
Fix rarpboot: add autoload by NFS

* Patch by Dan Eisenhut, 26 Feb 2004:
fix flash_write return value in saveenv

* Patch by Stephan Linz, 11 Dec 2003
expand config.mk to avoid trigraph warnings on NIOS

* Rename "BMS2003" board into "HMI10"

# 4aeb251f 16-Sep-2003 Wolfgang Denk <wdenk>

* Modify XLB arbiter priorities on MPC5200 so all devices use same
priority; configure critical interrupts to be handled like external
interrupts

# 27b207fd 24-Jul-2003 Wolfgang Denk <wdenk>

* Implement new mechanism to export U-Boot's functions to standalone
applications: instead of using (PPC-specific) system calls we now
use a jump table; please see doc/README.standalone for details

* Patch by Dave Westwood, 24 Jul 2003:
added support for Unity OS (a proprietary OS)

# b783edae 25-Jun-2003 Wolfgang Denk <wdenk>

* Header file cleanup for ARM

* Patch by Murray Jensen, 24 Jun 2003:
- make sure to use only U-boot provided header files
- fix problems with ".rodata.str1.4" section as used by GCC-3.x

# 592c5cab 20-Jun-2003 Wolfgang Denk <wdenk>

Patch by Murray Jensen, 20 Jun 2003:
- hymod update
- cleanup (especially for gcc-3.x compilers)

# 6dd652fa 19-Jun-2003 Wolfgang Denk <wdenk>

Patches by Murray Jensen, 17 Jun 2003:
- Hymod board database mods: add "who" field and new xilinx chip types
- provide new "init_cmd_timeout()" function so code external to
"common/main.c" can use the "reset_cmd_timeout()" function before
entering the main loop
- add DTT support for adm1021 (new file dtt/adm1021.c; config
slightly different. see include/configs/hymod.h for an example
(requires CONFIG_DTT_ADM1021, CONFIG_DTT_SENSORS, and
CFG_DTT_ADM1021 defined)
- add new "eeprom_probe()" function which has similar args and
behaves in a similar way to "eeprom_read()" etc.
- add 8260 FCC ethernet loopback code (new "eth_loopback_test()"
function which is enabled by defining CONFIG_ETHER_LOOPBACK_TEST)
- gdbtools copyright update
- ensure that set_msr() executes the "sync" and "isync" instructions
after the "mtmsr" instruction in cpu/mpc8260/interrupts.c
- 8260 I/O ports fix: Open Drain should be set last when configuring
- add SIU IRQ defines for 8260
- allow LDSCRIPT override and OBJCFLAGS initialization: change to
config.mk to allow board configurations to override the GNU
linker script, selected via the LDSCRIPT, make variable, and to
give an initial value to the OBJCFLAGS make variable
- 8260 i2c enhancement:
o correctly extends the timeout depending on the size of all
queued messages for both transmit and receive
o will not continue with receive if transmit times out
o ensures that the error callback is done for all queued tx
and rx messages
o correctly detects both tx and rx timeouts, only delivers one to
the callback, and does not overwrite an earlier error
o logic in i2c_probe now correct
- add "vprintf()" function so that "panic()" function can be
technically correct
- many Hymod board changes

# ea909b76 21-Nov-2002 Wolfgang Denk <wdenk>

* Added support for both PCMCIA slots (at the same time!) on MPC8xx

* Patch by Rod Boyce, 21 Nov 2002:
fix PCMCIA on MBX8xx board

* Patch by Pierre Aubert , 21 Nov 2002
Add CFG_CPM_POST_WORD_ADDR to make the offset of the
bootmode word in DPRAM configurable

# 7f6c2cbc 10-Nov-2002 Wolfgang Denk <wdenk>

* Vince Husovsky, 7 Nov 2002:
Add "-n" to linker options to get rid of "Not enough room for
program headers" problem

* Patch by David M�ller, 05 Nov 2002
Rename CONFIG_PLL_INPUT_FREQ to CONFIG_SYS_CLK_FREQ
so we can use an already existing name

* Patch by Pierre Aubert, 05 Nov 2002
Hardware related improvements in FDC boot code

* Patch by Holger Schurig, 5 Nov 2002:
Make the PXA really change it's frequency

* Patch by Pierre Aubert, 05 Nov 2002
Add support for slave serial Spartan 2 FPGAs

* Fix uninitialized memory (MAC address) in 8xx SCC/FEC ethernet
drivers

# e2211743 02-Nov-2002 Wolfgang Denk <wdenk>

Initial revision

# 1d3b97c9 23-Sep-2018 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

Kbuild: add LDFLAGS_STANDALONE

Introduce a new Makefile variable for passing LDFLAGS to standalone
programs. Currently the variable CONFIG_STANDALONE_LOAD_ADDR is
misued on some archs to pass a specific linker script.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>


# 9865543a 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove CONFIG_USE_STDINT

You do not need to use the typedefs provided by compiler.

Our compilers are either IPL32 or LP64. Hence, U-Boot can/should
always use int-ll64.h typedefs like Linux kernel, whatever the
typedefs the compiler internally uses.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>


# e020c88a 31-Jul-2015 Simon Glass <sjg@chromium.org>

Allow objcopy to work without filling gaps with 0xff

This is currently done for all targets, since 0xff is the default erased
value for most flash devices. In some cases this is not what we want (e.g.
for EFI images) so provide a command to do a vanilla objcopy.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# e02ee254 24-Feb-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: switch to single .config configuration

When Kconfig for U-boot was examined, one of the biggest issues was
how to support multiple images (Normal, SPL, TPL). There were
actually two options, "single .config" and "multiple .config".
After some discussions and thought experiments, I chose the latter,
i.e. to create ".config", "spl/.config", "tpl/.config" for Normal,
SPL, TPL, respectively.

It is true that the "multiple .config" strategy provided us the
maximum flexibility and helped to avoid duplicating CONFIGs among
Normal, SPL, TPL, but I have noticed some fatal problems:

[1] It is impossible to share CONFIG options across the images.
If you change the configuration of Main image, you often have to
adjust some SPL configurations correspondingly. Currently, we
cannot handle the dependencies between them. It means one of the
biggest advantages of Kconfig is lost.

[2] It is too painful to change both ".config" and "spl/.config".
Sunxi guys started to work around this problem by creating a new
configuration target. Commit cbdd9a9737cc (sunxi: kconfig: Add
%_felconfig rule to enable FEL build of sunxi platforms.) added
"make *_felconfig" to enable CONFIG_SPL_FEL on both images.
Changing the configuration of multiple images in one command is a
generic demand. The current implementation cannot propose any
good solution about this.

[3] Kconfig files are getting ugly and difficult to understand.
Commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN to
Kconfig) has sprinkled "if !SPL_BUILD" over the Kconfig files.

[4] The build system got more complicated than it should be.
To adjust Linux-originated Kconfig to U-Boot, the helper script
"scripts/multiconfig.sh" was introduced. Writing a complicated
text processor is a shell script sometimes caused problems.

Now I believe the "single .config" will serve us better. With it,
all the problems above would go away. Instead, we will have to add
some CONFIG_SPL_* (and CONFIG_TPL_*) options such as CONFIG_SPL_DM,
but we will not have much. Anyway, this is what we do now in
scripts/Makefile.spl.

I admit my mistake with my apology and this commit switches to the
single .config configuration.

It is not so difficult to do that:

- Remove unnecessary processings from scripts/multiconfig.sh
This file will remain for a while to support the current defconfig
format. It will be removed after more cleanups are done.

- Adjust some makefiles and Kconfigs

- Add some entries to include/config_uncmd_spl.h and the new file
scripts/Makefile.uncmd_spl. Some CONFIG options that are not
supported on SPL must be disabled because one .config is shared
between SPL and U-Boot proper going forward. I know this is not
a beautiful solution and I think we can do better, but let's see
how much we will have to describe them.

- update doc/README.kconfig

More cleaning up patches will follow this.

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


# 0d296cc2 15-Oct-2014 Gabe Black <gabeblack@chromium.org>

Provide option to avoid defining a custom version of uintptr_t.

There's a definition in stdint.h (provided by gcc) which will be more correct
if available.

Define CONFIG_USE_STDINT to use this feature, or USE_STDINT=1 on the 'make'
commmand.

This adjusts the settings for x86 and sandbox, with both have 64-bit options.

Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@google.com>
Rewritten to be an option, since stdint.h is often available only in glibc.
Changed to preserve a clear boundary between stdint and non-stdint
Signed-off-by: Simon Glass <sjg@chromium.org>


# 5b3ee386 20-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: clear VENDOR variable to fix build error on tcsh

Since the environment "VENDOR" is set in tcsh, it must be cleared in our
makefile. Otherwise, boards without CONFIG_SYS_VENDOR fail to build:

> make CROSS_COMPILE=arm-linux-gnueabi- wandboard_quad_defconfig all
[ snip ]
AR arch/arm/lib/lib.a
CC arch/arm/lib/eabi_compat.o
scripts/Makefile.build:55: /home/foo/u-boot/board/unknown/wandboard/ \
Makefile: No such file or directory
make[2]: *** No rule to make target `/home/foo/u-boot/board/unknown/ \
wandboard/Makefile'. Stop.
make[1]: *** [board/unknown/wandboard] Error 2
make: *** [__build_one_by_one] Error 2

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reported-by: Tom Everett <tom@khubla.com>
Reported-by: Jeroen Hofstee <jeroen@myspectrum.nl>


# b8450521 14-Sep-2014 Simon Glass <sjg@chromium.org>

Reactivate the tracing feature

This was lost sometime in the Kbuild conversion. Add it back.

Check that the trace test now passes:

$ ./test/trace/test-trace.sh
Simple trace test / sanity check using sandbox

/tmp/filemHKPGw
Build sandbox
O=sandbox FTRACE=1
GEN /home/sjg/c/src/third_party/u-boot/files/sandbox/Makefile
Configuring for sandbox board...
Check results
Test passed

Signed-off-by: Simon Glass <sjg@chromium.org>


# 51148790 29-Jul-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

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: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>


# a8b0f9b6 24-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

build: define CPU only when arch/${ARCH}/cpu/${CPU} exists

The directory arch/${ARCH}/cpu/${CPU} does not exist
in avr32, blackfin, microblaze, nios2, openrisc, sandbox, x86.

These architectures have only one CPU type.
Defining CPU should not be required for such architectures.

This commit allows cpu field (= the 3rd field of boards.cfg)
to be kept blank.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Andreas Bießmann <andreas.devel@googlemail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Sonic Zhang <sonic.zhang@analog.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>


# 01286329 10-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: rename SRCTREE to srctree

Prior to Kbuild, $(TOPDIR) or $(SRCTREE) was used for
pointing to the top of source directory.
(No difference between the two.)

In Kbuild style, $(srctree) is used for instead.
This commit renames SRCTREE to srctree and deletes the
defition of SRCTREE.

Note that SRCTREE in scripts/kernel-doc, scripts/docproc.c,
doc/DocBook/Makefile should be keep.

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


# 4379ac61 10-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: rename TOPDIR to stctree

Prior to Kbuild, $(TOPDIR) or $(SRCTREE) was used for
pointing to the top of source directory.
(No difference between the two.)

In Kbuild style, $(srctree) is used instead.
This commit renames TOPDIR to srctree and delete the
defition of TOPDIR.

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


# 026f9cf2 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: improve Kbuild speed

Kbuild brought about many advantages for us but a significant
performance regression was reported by Simon Glass.

After some discussions and analysis, it turned out
its main cause is in $(call cc-option,...).

Historically, U-Boot parses all config.mk
(arch/*/config.mk and board/*/config.mk)
every time descending into subdirectories.
That means cc-options are evaluated over and over again.

$(call cc-option,...) is useful but costly.
So we want to evaluate them only in ./Makefile
and spl/Makefile and export compiler flags.

This commit changes the build system as follows:

- Modify scripts/Makefile.build to not include config.mk
Instead, add $(PLATFORM_CPPFLAGS) to asflags-y, ccflags-y,
cppflags-y.

- Export many variables
Going forward, Kbuild will not parse config.mk files
when it descends into subdirectories.
If we want to set variables in config.mk and use them
in subdirectories, they must be exported.

This is the list of variables to get exported:
PLATFORM_CPPFLAGS
CPUDIR
BOARDDIR
OBJCOPYFLAGS
LDFLAGS
LDFLAGS_FINAL
(used in nand_spl/board/*/*/Makefile)
CONFIG_STANDALONE_LOAD_ADDR
(used in examples/standalone/Makefile)
SYM_PREFIX
(used in examples/standalone/Makefile)
RELFLAGS
(used in examples/standalone/Makefile)

- Delete CPPFLAGS
This variable has been replaced with PLATFORM_CPPFLAGS

- Copy gcclibdir from example/standalone/Makefile
to arch/sparc/config.mk
The reference in CONFIG_STANDALONE_LOAD_ADDR must be
resolved before it is exported.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reported-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> [on Sandbox]
Tested-by: Stephen Warren <swarren@nvidia.com> [on Tegra]


# 33a02da0 03-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: allow empty board directories

U-Boot has compelled all boards to have
board/${BOARD}/ or board/${VENDOR}/${BOARD}/ directory.

Sometimes it does not seem suitable for some boards,
for example Sandbox. (Is it a board?)

And arcangel4 board has nothing to compile
under the board directory.

This commit makes the build system more flexible:
If '<none>' is given to the 6th column (=Board name) of boards.cfg,
Kbuild will not descend into the board directory.

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


# 57181573 25-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

config.mk: Delete unused variable BCURDIR

This variable was abolished by Kbuild series.
I forgot to delete it.

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


# 95ddcd68 23-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: rename OBJCFLAGS to OBJCOPYFLAGS

Rename OBJCFLAGS to OBJCOPYFLAGS beforehand to use
"cmd_objcopy" in scripts/Makefile.lib in an upcoming commit.

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


# 01072b44 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: move include directives of board configuration files

This commit changes the location of include directives
of board configuration files.

The purpose of this change is:
- Slim down $(TOPDIR)/config.mk
- Prevent $(TOPDIR)/Makefile from including the same
configuration file twice
- Do not include include/config.mk multiple times
because ARCH, CPU, BOARD, VENDOR, SOC are exported

Before this commit:

- include/autoconf.mk was included from $(TOPDIR)/Makefile
and $(TOPDIR)/config.mk
(This means $(TOPDIR)/Makefile included include/autoconf.mk twice)

- include/{spl,tpl}-autoconf.mk was included from $(TOPDIR)/config.mk

- include/config.mk was included from $(TOPDIR)/Makefile
and $(TOPDIR)/config.mk
(This means $(TOPDIR)/Makefile included include/config.mk twice)

After this commit:

- include/autoconf.mk is included from $(TOPDIR)/Makefile
and $(TOPDIR)/scripts/Makefile.build

- include/{spl,tpl}-autoconf.mk is included from $(TOPDIR)/spl/Makefile
and $(TOPDIR)/scripts/Makefile.build

- include/config.mk is included from $(TOPDIR)/config.mk and
$(TOPDIR)/spl/Makefile

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


# 6825a95b 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: use Linux Kernel build scripts

Now we are ready to switch over to real Kbuild.

This commit disables temporary scripts:
scripts/{Makefile.build.tmp, Makefile.host.tmp}
and enables real Kbuild scripts:
scripts/{Makefile.build,Makefile.host,Makefile.lib}.

This switch is triggered by the line in scripts/Kbuild.include
-build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj
+build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj

We need to adjust some build scripts for U-Boot.
But smaller amount of modification is preferable.

Additionally, we need to fix compiler flags which are
locally added or removed.

In Kbuild, it is not allowed to change CFLAGS locally.
Instead, ccflags-y, asflags-y, cppflags-y,
CFLAGS_$(basetarget).o, CFLAGS_REMOVE_$(basetarget).o
are prepared for that purpose.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>


# 9e414032 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: change out-of-tree build

This commit changes the working directory
where the build process occurs.

Before this commit, build process occurred under the source
tree for both in-tree and out-of-tree build.

That's why we needed to add $(obj) prefix to all generated
files in makefiles like follows:
$(obj)u-boot.bin: $(obj)u-boot

Here, $(obj) is empty for in-tree build, whereas it points
to the output directory for out-of-tree build.

And our old build system changes the current working directory
with "make -C <sub-dir>" syntax when descending into the
sub-directories.

On the other hand, Kbuild uses a different idea
to handle out-of-tree build and directory descending.

The build process of Kbuild always occurs under the output tree.
When "O=dir/to/store/output/files" is given, the build system
changes the current working directory to that directory and
restarts the make.

Kbuild uses "make -f $(srctree)/scripts/Makefile.build obj=<sub-dir>"
syntax for descending into sub-directories.
(We can write it like "make $(obj)=<sub-dir>" with a shorthand.)
This means the current working directory is always the top
of the output directory.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>


# d9580025 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move some flags to examples makefiles

This commit moves some flags which are used
under examples/ directory only.

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


# e0d5d9f8 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move some flags to spl/Makefile

Some flags are used for SPL (and TPL) build only.
This commit moves them from config.mk to spl/Makefile.

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


# ced0715d 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move more stuff to top Makefile

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


# fea1ca8e 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: refactor include path settings

This commit merges commonly-used header include paths
to UBOOTINCLUDE and NOSTDINC_FLAGS variables, which are placed
at the top Makefile.

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


# 2b3c9d3d 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move more flags to the top Makefile

Before this commit, most of compiler flags were defined in config.mk.
But it is redundant because config.mk is included from all recursive make.

This commit moves many complier flags to the top Makefile
and export them.
And we use new vaiarables to store them:
KBUILD_CPPFLAGS, KBUILD_CFLAGS, KBUILD_AFLAGS.
This will allow us to switch more smoothly to Kbuild.

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


# bf4b3de1 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: Use Kbuild.include

This commit adjusts some files to use Kbuild.include.

- Use cc-option defined in Kbuild.include
(Delete cc-option in config.mk)
- Use cc-version defined in
(Delete cc-version in config.mk)
- Move binutils-version and dtc-version to Kbuild.include
by analogy to cc-version

This commit also adds srctree (same as SRCTREE)
to use Kbuild scripts.

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


# 34bd0507 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move BFD_ROOT_DIR to tools/gdb/Makefile

BFD_ROOT_DIR is used only in tools/gdb/Makefile

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


# f6322eb7 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: move some variable definitions to the top Makefile

This commit moves some variable definitions from config.mk
to the top Makefile:

- HOSTCC, HOSTCFLAGS, HOSTLDFLAGS
- AS, LD, CC, CPP, etc.
- SHELL (renamed to CONFIG_SHELL)

I'd like to slim down config.mk file
because it is included from all recursive make.
It is redundant to re-define the variables
every time descending into sub directories.
We should rather define them at the top Makefile
and export them.

U-Boot makefiles has been used "SHELL" variable to store shell
chosen for the user, whereas Linux Kernel uses "CONFIG_SHELL".

We should never use "SHELL" variable because it is
a special variable for GNU Make.
Changing SHELL may cause unpredictable side effects
whose root cause is usually difficult to find.
We should use a generic variable name "CONFIG_SHELL".

We should not use the syntax as follows either:

rm -f $(obj)tools/env/{fw_printenv,fw_setenv}

This depends on "bash" although GNU Make generally
invokes "sh" to run the each rule.

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


# 5651ccff 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makfile: move suffix rules to Makefile.build

This commit moves suffix rules from config.mk
to scripts/Makefile.build, which will allow us
to switch smoothly to real Kbuild.

Note1:
post/lib_powerpc/fpu/Makefile has
its own rule to compile C sources.
We need to tweak it to keep the same behavior.

Note2:
There are two file2 with the same name:
arch/arm/lib/crt0.S and eamples/api/crt0.S.
To keep the same build behavior,
examples/api/Makefile also has to be treaked.

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


# 940db16d 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

tools: convert makefiles to kbuild style

Before this commit, makefiles under tools/ directory
were implemented with their own way.

This commit refactors them by using "hostprogs-y" variable.

Several C sources have been added to wrap other C sources
to simplify Makefile.
For example, tools/crc32.c includes lib/crc32.c

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


# 3d83efbc 26-Nov-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

sandbox: Use system headers first for sandbox's os.c in a different way

Commit cbe5cdfcd changed config.mk and arch/sandbox/cpu/Makefile
to use -idirafter instead of -I and remove -nostdinc.

But
* Sandbox-specific code dirties config.mk
* os.c is compiled without such compiler flags as:
-Wall -Wstrict-prototypes -Wno-format-security
-fno-builtin -ffreestanding -fno-stack-protector
-fstack-usage -Wno-format-nonliteral

This commit use -idirafter and remove the -nostdinc
differently and more simply.

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


# dd88ab32 28-Nov-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: Move some scripts imported from Linux

We have some scripts imported from Linux Kernel:
setlocalversion, checkstack.pl, checkpatch.pl, cleanpatch

They are located under tools/ directory in U-Boot now.
But they were originally located under scripts/ directory
in Linux Kernel.

This commit moves them to the original location.

It is true that binutils-version.sh and dtc-version.sh
do not originate in Linux Kernel, but they should
be moved by analogy to gcc-version.sh.

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


# cbe5cdfc 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Use system headers first for sandbox's os.c

This file must be compiled with system headers, even if U-Boot has headers
of the same name. The existing solution for this is good enough for libfdt,
but fails when we have headers like stdint.h in U-Boot.

Use -idirafter instead of -I, and remove the -nostdinc and other things
that we don't want for this file. The best way to do this is to keep a
copy of the original flags, rather than trying to filter them later.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 74307f20 10-Nov-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

config.mk: delete unnecessary lines

SPL_BIN is already defined in spl/Makefile
and it is used only in spl/Makefile.

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


# bb02c536 31-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile: do not create a symbolic link to arch/${ARCH}/include/asm

In-tree build:
- Do not create a symbolic link
from include/asm to arch/${ARCH}/include/asm
- Add ${SRCTREE}/arch/arm/include into the header search path

Out-of-tree build:
- Do not create a directory ${OBJTREE}/include2
- Do not create a symbolic link
from ${OBJTREE}/include2/asm to ${SRCTREE}/arch/${ARCH}/include/asm
- Add ${SRCTREE}/arch/arm/include into the header search path

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


# 93e14596 04-Oct-2013 Wolfgang Denk <wd@denx.de>

Coding Style cleanup: replace leading SPACEs by TABs

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Drop changes for PEP 4 following python tools]
Signed-off-by: Tom Rini <trini@ti.com>


# 1affd4d4 01-Sep-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

cam_enc_4xx: Move CONFIG_SPL_PAD_TO to a config header

For most boards which define CONFIG_SPL_PAD_TO,
it is defined in config header files.
Currently, there exists only one exception, cam_enc_4xx board.

This patch moves CONFIG_SPL_PAD_TO definition
from board/ait/cam_enc_4xx/config.mk
to include/configs/cam_enc_4xx.h.

With this modification, we can delete a glue code
in the top level config.mk:

ifneq ($(CONFIG_SPL_PAD_TO),)
CPPFLAGS += -DCONFIG_SPL_PAD_TO=$(CONFIG_SPL_PAD_TO)
endif

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Heiko Schocher <hs@denx.de>


# cb4ef5ba 01-Sep-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

config.mk: Delete unnecessary code

Currently no makefiles (board-specific config.mk)
set the following variables:

CONFIG_SPL_TEXT_BASE
CONFIG_UBOOT_PAD_TO
CONFIG_RESET_VECTOR_ADDRESS
CONFIG_TPL_PAD_TO

For all target boards using above macros
they are set in header files (include/configs/*.h),
so we do not need to set them as CPPFLAGS.

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


# bce88370 26-Aug-2013 Marek Vasut <marex@denx.de>

ARM: mxs: tools: Add mkimage support for MXS bootstream

Add mkimage support for generating and verifying MXS bootstream.
The implementation here is mostly a glue code between MXSSB v0.4
and mkimage, but the long-term goal is to rectify this and merge
MXSSB with mkimage more tightly. Once this code is properly in
U-Boot, MXSSB shall be deprecated in favor of mkimage-mxsimage
support.

Note that the mxsimage generator needs libcrypto from OpenSSL, I
therefore enabled the libcrypto/libssl unconditionally.

MXSSB: http://git.denx.de/?p=mxssb.git;a=summary

The code is based on research presented at:
http://www.rockbox.org/wiki/SbFileFormat

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>


# 3aa29de0 16-Aug-2013 Ying Zhang <b40530@freescale.com>

TPL : introduce the TPL based on the SPL

Due to the nand SPL on some board(e.g. P1022DS)has a size limit, it can
not be more than 4K. So, the SPL cannot initialize the DDR with the SPD
code. This patch introduces TPL to enable a loader stub that is loaded
by the code from the SPL. It initializes the DDR with the SPD or other
operations.

The TPL's size is sizeable, the maximum size is decided by the memory's
size that TPL runs. It initializes the DDR through SPD code, and copys
final uboot image to DDR. So there are three stage uboot images:
* spl_boot, * tpl_boot, * final uboot image

Signed-off-by: Ying Zhang <b40530@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>


# 39bc12dd 19-Aug-2013 Joel Fernandes <joelf@ti.com>

SPL: Makefile: Build a separate autoconf.mk for SPL

SPL defines CONFIG_SPL_BUILD but this does not percolate to the
autoconf.mk Makefile. As a result the build breaks when
CONFIG_SPL_BUILD is used in the board-specific include header file. With
this, there is a possibility of having a CONFIG option defined in the
header file but not defined in the Makefile causing all kinds of build
failure and problems.

It also messes things for up, for example, when one might want to
undefine options to keep the SPL small and doesn't want to be stuck with
the CONFIG options used for U-boot. Lastly, this also avoids defining
special CONFIG_SPL_ variables for cases where some options are required
in U-boot but not in SPL.

We add a spl-autoconf.mk rule that is generated for SPL with the
CONFIG_SPL_BUILD flag and conditionally include it for SPL builds.

Signed-off-by: Joel Fernandes <joelf@ti.com>
Signed-off-by: Ying Zhang <b40530@freescale.com>


# 501ebdf2 24-Jul-2013 Stephen Warren <swarren@nvidia.com>

Validate dtc is new enough

Subsequent patches assume that dtc supports various recent features.
These are available in dtc 1.4.0. Validate that dtc is at least that
version.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>


# eca3aeb3 21-Jun-2013 Wolfgang Denk <wd@denx.de>

Licenses: introduce SPDX Unique Lincense Identifiers

Like many other projects, U-Boot has a tradition of including big
blocks of License headers in all files. This not only blows up the
source code with mostly redundant information, but also makes it very
difficult to generate License Clearing Reports. An additional problem
is that even the same lincenses are referred to by a number of
slightly varying text blocks (full, abbreviated, different
indentation, line wrapping and/or white space, with obsolete address
information, ...) which makes automatic processing a nightmare.

To make this easier, such license headers in the source files will be
replaced with a single line reference to Unique Lincense Identifiers
as defined by the Linux Foundation's SPDX project [1]. For example,
in a source file the full "GPL v2.0 or later" header text will be
replaced by a single line:

SPDX-License-Identifier: GPL-2.0+

We use the SPDX Unique Lincense Identifiers here; these are available
at [2].

Note: From the legal point of view, this patch is supposed to be only
a change to the textual representation of the license information,
but in no way any change to the actual license terms. With this patch
applied, all files will still be licensed under the same terms they
were before.

Note 2: The apparent difference between the old "COPYING" and the new
"Licenses/gpl-2.0.txt" only results from switching to the upstream
version of the license which is differently formatted; there are not
any actual changes to the content.

Note 3: There are some recurring questions about linense issues, such
as:
- Is a "All Rights Reserved" clause a problem in GPL code?
- Are files without any license header a problem?
- Do we need license headers at all?

The following excerpt from an e-mail by Daniel B. Ravicher should help
with these:

| Message-ID: <4ADF8CAA.5030808@softwarefreedom.org>
| Date: Wed, 21 Oct 2009 18:35:22 -0400
| From: "Daniel B. Ravicher" <ravicher@softwarefreedom.org>
| To: Wolfgang Denk <wd@denx.de>
| Subject: Re: GPL and license cleanup questions
|
| Mr. Denk,
|
| Wolfgang Denk wrote:
| > - There are a number of files which do not include any specific
| > license information at all. Is it correct to assume that these files
| > are automatically covered by the "GPL v2 or later" clause as
| > specified by the COPYING file in the top level directory of the
| > U-Boot source tree?
|
| That is a very fact specific analysis and could be different across the
| various files. However, if the contributor could reasonably be expected
| to have known that the project was licensed GPLv2 or later at the time
| she made her contribution, then a reasonably implication is that she
| consented to her contributions being distributed under those terms.
|
| > - Do such files need any clean up, for example should we add GPL
| > headers to them, or is this not needed?
|
| If the project as a whole is licensed under clear terms, you need not
| identify those same terms in each file, although there is no harm in
| doing so.
|
| > - There are other files, which include both a GPL license header
| > _plus_ some copyright note with an "All Rights Reserved" clause. It
| > has been my understanding that this is a conflict, and me must ask
| > the copyright holders to remove such "All Rights Reserved" clauses.
| > But then, some people claim that "All Rights Reserved" is a no-op
| > nowadays. License checking tools (like OSLC) seem to indicate this is
| > a problem, but then we see quite a lot of "All rights reserved" in
| > BSD-licensed files in gcc and glibc. So what is the correct way to
| > deal with such files?
|
| It is not a conflict to grant a license and also reserve all rights, as
| implicit in that language is that you are reserving all "other" rights
| not granted in the license. Thus, a file with "Licensed under GPL, All
| Rights Reserved" would mean that it is licensed under the GPL, but no
| other rights are given to copy, modify or redistribute it.
|
| Warm regards,
| --Dan
|
| Daniel B. Ravicher, Legal Director
| Software Freedom Law Center (SFLC) and Moglen Ravicher LLC
| 1995 Broadway, 17th Fl., New York, NY 10023
| (212) 461-1902 direct (212) 580-0800 main (212) 580-0898 fax
| ravicher@softwarefreedom.org www.softwarefreedom.org

[1] http://spdx.org/
[2] http://spdx.org/licenses/

Signed-off-by: Wolfgang Denk <wd@denx.de>


# 971c450a 17-Jul-2013 Simon Glass <sjg@chromium.org>

mkimage: Use board config to get CONFIG_FIT_SIGNATURE value

The value of this config variable is not available to image.h on the host,
since the board config is not actually included. Bring this in so that
mkimage will be built with image-signing support for sandbox at least.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 29ce737d 27-Jun-2013 Simon Glass <sjg@chromium.org>

mkimage: Build signing only if board has CONFIG_FIT_SIGNATURE

At present mkimage is set up to always build with image signing support.
This means that the SSL libraries (e.g. libssl-dev) are always required.

Adjust things so that mkimage can be built with and without image signing,
controlled by the presence of CONFIG_FIT_SIGNATURE in the board config file.

If CONFIG_FIT_SIGNATURE is not enabled, then mkimage will report a warning
that signing is not supported. If the option is enabled, but libraries are
not available, then a build error similar to this will be shown:

lib/rsa/rsa-sign.c:26:25: fatal error: openssl/rsa.h: No such file or directory

Signed-off-by: Simon Glass <sjg@chromium.org>


# 19c402af 13-Jun-2013 Simon Glass <sjg@chromium.org>

image: Add RSA support for image signing

RSA provides a public key encryption facility which is ideal for image
signing and verification.

Images are signed using a private key by mkimage. Then at run-time, the
images are verified using a private key.

This implementation uses openssl for the host part (mkimage). To avoid
bringing large libraries into the U-Boot binary, the RSA public key
is encoded using a simple numeric representation in the device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 5c2aeac5 11-Jun-2013 Simon Glass <sjg@chromium.org>

Support tracing in config.mk when enabled

Use -finstrument-functions when tracing is enabled (make FTRACE=1).
Tracing is not currently supported by SPL even if sufficient memory is
available.

When tracing is enabled, we #define FTRACE. This can be used by
board config files to conditionally enable the tracing options.

Signed-off-by: Simon Glass <sjg@chromium.org>


# d642c467 27-Apr-2013 Marek Vasut <marex@denx.de>

build: Pull -DBUILD_TAG into separate ifdef

Currently the base setting for CFLAGS is split in two possibilities,
one with -DBUILD_TAG appended at the end and one without, the rest of
CFLAGS is the same in both cases. Change this so CFLAGS are always set
and the -DBUILD_TAG is appended in separate ifdef.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Tom Rini <trini@ti.com>
Reviewed-by: Otavio Salvador <otavio@ossystems.com.br>


# fada9e20 20-Apr-2013 Simon Glass <sjg@chromium.org>

Trigger generic board error only when building

At present the generic board error can occur when configuring U-Boot, or
during distclean, but this is incorrect. The existing autoconf.mk may come
from an earlier U-Boot configuration which is about to be overwritten.

Make the error conditional so that it will only be triggered when we are
actually building U-Boot.

This avoids a problem where the system is being reconfigured to remove
CONFIG_SYS_GENERIC_BOARD on an architecture that does not support it.
Currently this will print an error and require the manual removal of
include/autoconf.mk.

Signed-off-by: Simon Glass <sjg@chromium.org>


# ecddccd0 22-Feb-2013 Stefan Roese <sr@denx.de>

Makefile: Add target for combined u-boot.img & spl/u-boot.bin

This new make target "u-boot-img-spl-at-end.bin" consists of the
the real, full-blown U-Boot image and the U-Boot SPL binary
directly attached to it. The full-blown U-Boot image has the
mkimage header included, with its load-address and entry-point.

This will be used by the upcoming lwmon5 PPC440EPx derivate board
port.

Signed-off-by: Stefan Roese <sr@denx.de>


# 120ae609 11-Apr-2013 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Makefile: Move SHELL setup to config.mk

make never uses the SHELL variable from the environment. Instead, it
uses /bin/sh, or the value assigned to the SHELL variable by the Makefile. This
makes the export of the SHELL variable useless for sub-makes (but still useful
for the environment of recipes). However, we want all makes to use the same
shell.

This patch fixes this issue by moving the SHELL variable setup and export to the
top config.mk, so that all Makefile-s including it use the same shell.

Since BASH is used by default, this makes it possible to use things
like 'echo -e ...' in sub-makes, which would otherwise fail e.g. with /bin/sh
symlinked to /bin/dash on Ubuntu.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Reviewed-by: Tom Rini <trini@ti.com>


# 5c1a7ea6 08-Mar-2013 Simon Glass <sjg@chromium.org>

__HAVE_ARCH_GENERIC_BOARD controls availabilty of generic board

We are introducing a new unified board setup. Add a check to make sure that
board config files do not define CONFIG_SYS_GENERIC_BOARD unless their
architecture defines __HAVE_ARCH_GENERIC_BOARD

__HAVE_ARCH_GENERIC_BOARD will currently not be the default setting, but
we can switch this later when most architecture support generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>


# ef123c52 24-Feb-2013 Albert ARIBAUD <albert.u.boot@aribaud.net>

Refactor linker-generated arrays

Refactor linker-generated array code so that symbols
which were previously linker-generated are now compiler-
generated. This causes relocation records of type
R_ARM_ABS32 to become R_ARM_RELATIVE, which makes
code which uses LGA able to run before relocation as
well as after.

Note: this affects more than ARM targets, as linker-
lists span possibly all target architectures, notably
PowerPC.

Conflicts:
arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
arch/arm/cpu/arm926ejs/spear/u-boot-spl.lds
arch/arm/cpu/armv7/omap-common/u-boot-spl.lds
board/ait/cam_enc_4xx/u-boot-spl.lds
board/davinci/da8xxevm/u-boot-spl-da850evm.lds
board/davinci/da8xxevm/u-boot-spl-hawk.lds
board/vpac270/u-boot-spl.lds

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>


# 97b24d3d 18-Oct-2012 Marek Vasut <marex@denx.de>

common: Add symbol handling for generic lists into Makefile

This patch adds essential components for generation of the contents of
the linker section that is used by the linker-generated array. All of
the contents is held in a separate file, u-boot.lst, which is generated
at runtime just before U-Boot is linked.

The purpose of this code is to especially generate the appropriate
boundary symbols around each subsection in the section carrying the
linker-generated arrays. Obviously, the interim linker code for actual
placement of the variables into the section is generated too. The
generated file, u-boot.lst, is included into u-boot.lds via the linker
INCLUDE directive in u-boot.lds .

Adjustments are made in the Makefile and spl/Makefile so that the
u-boot.lds and u-boot-spl.lds depend on their respective .lst files.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@gmail.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Tested-by: Joe Hershberger <joe.hershberger@ni.com>


# 4ab64933 20-Sep-2012 Kim Phillips <kim.phillips@freescale.com>

add check infrastructure, default sparse

Add support for running source code checkers on u-boot source, e.g.,
using sparse to aid with typechecking. This comes in especially
handy as SoC vendors mix and match cores and devices with different
endianness, thus here we add CHECK_ENDIAN to the otherwise linux
kernel default CHECKFLAGS.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>


# c1f5805a 14-Sep-2012 Marek Vasut <marex@denx.de>

serial: Compile drivers/serial/serial.c by default

Compile drivers/serial/serial.c by default both into SPL and into
non-SPL builds, since CONFIG_SERIAL_MULTI is now the default state.
Also having common/serial.c in by default now, it's pointless to keep
-DCONFIG_SERIAL_MULTI in CPPFLAGS any longer, so remove it as well.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>


# 82dda962 14-Sep-2012 Marek Vasut <marex@denx.de>

serial: Unconditionally enable CONFIG_SERIAL_MULTI

Enable CONFIG_SERIAL_MULTI for all builds of U-Boot. That includes
both SPL builds and non-SPL builds, everything. To avoid poluting
this patch with removal of ifdef-endif constructions containing
CONFIG_SERIAL_MULTI, the CONFIG_SERIAL_MULTI is temporarily added
into CPPFLAGS in config.mk . This will be again removed in following
patch.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>


# 2051ff34 15-Aug-2012 Allen Martin <amartin@nvidia.com>

tools, config.mk: add binutils-version

Modeled after gcc-version, add function to get binutils version.

Signed-off-by: Allen Martin <amartin@nvidia.com>
Acked-by: Wolfgang Denk <wd@denx.de>


# 7cb714a5 02-Aug-2012 Khem Raj <raj.khem@gmail.com>

config: Always use GNU ld

This patch makes sure that we always use the GNU ld. U-Boot uses certain
construct e.g. OVERLAY which are not implemented in gold therefore it
always needs GNU ld for linking.

It works well if default linker in toolchain is GNU ld but in some
cases we can have gold to be the default linker and also ship GNU ld
but not as default in such cases its called $(PREFIX)ld.bfd, with this
patch we make sure that if $(PREFIX)ld.bfd exists than we use that for
our ld.

This way it does not matter what the default ld is.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>


# 94aebe6c 05-Jan-2012 Stefan Roese <sr@denx.de>

Makefile: Add u-boot.spr build target (SPEAr)

On x600 (SPEAr600) U-Boot is appended to U-Boot SPL. Both images are
created using mkimage (crc etc), so that the ROM bootloader can check
its integrity. Padding needs to be done to the SPL image (with
mkimage header) and not the binary. Otherwise the resulting image
which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
The resulting image containing both U-Boot images is called u-boot.spr.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Amit Virdi <amit.virdi@st.com>
Cc: Vipin Kumar <vipin.kumar@st.com>


# 19a695f8 15-Mar-2012 Tom Rini <trini@ti.com>

tools, config.mk: Add gcc-version.sh, cc-version test from Linux

Added from Linux - commit fde7d9049e55ab85a390be7f415d74c9f62dd0f9

Signed-off-by: Tom Rini <trini@ti.com>


# 4a30f1e8 20-Feb-2012 Tom Rini <trini@ti.com>

config.mk: Check for -fstack-usage support

Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Tom Rini <trini@ti.com>


# 6f4acc17 14-Feb-2012 Tom Rini <trini@ti.com>

config.mk: Make cc-option create a file under include/generated

Testing for -fstack-usage requires the creation of an output file, which
isn't possible with /dev/null.

Signed-off-by: Tom Rini <trini@ti.com>


# b6a467d7 06-Nov-2011 Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

config.mk: use memoization in cc-option macro to speed up compilation

Apply memoization to cc-option macro by caching the results of the
gcc calls. This macro is called very often so using cached results
leads to faster compilation times.

The old behaviour can be restored by defining the config option
CONFIG_CC_OPT_CACHE_DISABLE=y.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>


# cca4e4ae 01-Nov-2011 Wolfgang Denk <wd@denx.de>

Reduce build times

U-Boot Makefiles contain a number of tests for compiler features etc.
which so far are executed again and again. On some architectures
(especially ARM) this results in a large number of calls to gcc.

This patch makes sure to run such tests only once, thus largely
reducing the number of "execve" system calls.

Example: number of "execve" system calls for building the "P2020DS"
(Power Architecture) and "qong" (ARM) boards, measured as:
-> strace -f -e trace=execve -o /tmp/foo ./MAKEALL <board>
-> grep execve /tmp/foo | wc -l

Before: After: Reduction:
==================================
P2020DS 20555 15205 -26%
qong 31692 14490 -54%

As a result, built times are significantly reduced, typically by
30...50%.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Albert Aribaud <albert.aribaud@free.fr>
cc: Graeme Russ <graeme.russ@gmail.com>
cc: Mike Frysinger <vapier@gentoo.org>
Tested-by: Graeme Russ <graeme.russ@gmail.com>
Tested-by: Matthias Weisser <weisserm@arcor.de>
Tested-by: Sanjeev Premi <premi@ti.com>
Tested-by: Simon Glass <sjg@chromium.org>
Tested-by: Macpaul Lin <macpaul@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>


# bbb0b128 14-Oct-2011 Simon Glass <sjg@chromium.org>

fdt: Add support for embedded device tree (CONFIG_OF_EMBED)

This new option allows U-Boot to embed a binary device tree into its image
to allow run-time control of peripherals. This device tree is for U-Boot's
own use and is not necessarily the same one as is passed to the kernel.

The device tree compiler output should be placed in the $(obj)
rooted tree. Since $(OBJCOPY) insists on adding the path to the
generated symbol names, to ensure consistency it should be
invoked from the directory where the .dtb file is located and
given the input file name without the path.

This commit contains my entry for the ugliest Makefile / shell interaction
competition.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 5968adc4 12-Oct-2011 Mike Frysinger <vapier@gentoo.org>

build: force migration away from $(AR)

People keep adding new code that still uses $(AR) instead of
$(cmd_link_o_target), so turn it into a build time error.

We still use $(AR) locally, but we don't use $(ARFLAGS).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>


# 47508843 07-Oct-2011 Simon Glass <sjg@chromium.org>

Adjust dependency rules to permit per-file flags

The dependency rules are currently done in a shell 'for' loop. This does not
permit Makefile variables to adjust preprocessor flags as is done with normal
compile flags, using the CFLAGS_path/file.o syntax.

This change moves the dependency generation into the Makefile itself, and
permits a CPPFLAGS_path/file.o to adjust preprocessor flags on a file or
directory basis.

The CPPFLAGS_... variable is also folded into CFLAGS during the build.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 6262e4e7 25-Apr-2011 Mike Frysinger <vapier@gentoo.org>

disable security warning flags when possible

Some toolchains enable security warning flags by default, but these don't
really make sense in the u-boot world. Such as forcing changes like:
-printf(foo);
+printf("%s", foo);

So disable the flags when the compiler supports them. Linux has already
merged a similar change in their build system.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>


# c8f9c302 18-Jul-2011 Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>

Extend build-system for SPL framework

Signed-off-by: Aneesh V <aneesh@ti.com>
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>


# d51dfff7 19-Jun-2011 Ilya Yanok <yanok@emcraft.com>

config.mk: move LDSCRIPT processing to the top-level Makefile

LDSCRIPT is used only from the top-level Makefile and only when the
system is configured so we can move LDSCRIPT and CONFIG_SYS_LDSCRIPT
related logic into the top level Makefile and under configured condition
to avoid errors when building tools from unconfigured tree.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>


# 83b7e2a7 06-Apr-2011 Scott Wood <scottwood@freescale.com>

Handle most LDSCRIPT setting centrally

Currently, some linker scripts are found by common code in config.mk.
Some are found using CONFIG_SYS_LDSCRIPT, but the code for that is
sometimes in arch config.mk and sometimes in board config.mk. Some
are found using an arch-specific rule for looking in CPUDIR, etc.

Further, the powerpc config.mk rule relied on CONFIG_NAND_SPL
when it really wanted CONFIG_NAND_U_BOOT -- which covered up the fact
that not all NAND_U_BOOT builds actually wanted CPUDIR/u-boot-nand.lds.

Replace all of this -- except for a handful of boards that are actually
selecting a linker script in a unique way -- with centralized ldscript
finding.

If board code specifies LDSCRIPT, that will be used.
Otherwise, if CONFIG_SYS_LDSCRIPT is specified, that will be used.

If neither of these are specified, then the central config.mk will
check for the existence of the following, in order:

$(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT)
$(TOPDIR)/$(CPUDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT)
$(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
$(TOPDIR)/$(CPUDIR)/u-boot.lds

Some boards (sc3, cm5200, munices) provided their own u-boot.lds that
were dead code, because they were overridden by a CPUDIR u-boot.lds under
the old powerpc rules. These boards' own u-boot.lds have bitrotted and
no longer work -- these lds files have been removed.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Tested-by: Graeme Russ <graeme.russ@gmail.com>


# 6dc1eceb 22-Feb-2011 Haiying Wang <Haiying.Wang@freescale.com>

Introduce a new linker flag LDFLAGS_FINAL

commit 8aba9dceebb14144e07d19593111ee3a999c37fc
Divides variable of linker flags to LDFLAGS-u-boot and LDFLAGS

breaks the usage of --gc-section to build nand_spl. We still need linker option
--gc-section for every uboot image, not only the main one. LDFLAGS_FINAL passes
the --gc-sections to each uboot image.

To get the proper linker flags, we use LDFLAGS and LDFLAGS_FINAL to replace
PLATFORM_LDFLAGS in the Makefile of each nand_spl board.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>


# 5e987ddf 17-Jan-2011 Joakim Tjernlund <Joakim.Tjernlund@transmode.se>

Top config.mk: add include/config.mk

Seems to me that the top level config.mk should include
the auto generated include/config.mk so that all Makefile's
pickup those definitions.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>


# 8aba9dce 05-Jan-2011 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

Divides variable of linker flags to LDFLAGS-u-boot and LDFLAGS

Linker needs to use the proper endian/bfd flags even when doing partial linking.
LDFLAGS_u-boot sets linker option which is called it when U-boot is built
(u-boot final).
LDFLAGS sets necessary option by partial linking (use in cmd_link_o_target).

CC: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>


# 326a6945 15-Dec-2010 Mike Frysinger <vapier@gentoo.org>

config.mk: unify duplicated flag setting

Multiple rules are using the expanded AFLAGS/CFLAGS settings and some are
getting so long that the rules need to be line wrapped. So unify them in
one variable, use that variable in the rule, and then unwrap things. This
makes the actual `make` output nicer as it doesn't have line continuations
in it anymore.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>


# 844f07d8 27-Nov-2010 Wolfgang Denk <wd@denx.de>

Coding Style (white space) cleanup

Signed-off-by: Wolfgang Denk <wd@denx.de>


# 6d8962e8 05-Nov-2010 Sebastien Carlier <sebastien.carlier@gmail.com>

Switch from archive libraries to partial linking

Before this commit, weak symbols were not overridden by non-weak symbols
found in archive libraries when linking with recent versions of
binutils. As stated in the System V ABI, "the link editor does not
extract archive members to resolve undefined weak symbols".

This commit changes all Makefiles to use partial linking (ld -r) instead
of creating library archives, which forces all symbols to participate in
linking, allowing non-weak symbols to override weak symbols as intended.
This approach is also used by Linux, from which the gmake function
cmd_link_o_target (defined in config.mk and used in all Makefiles) is
inspired.

The name of each former library archive is preserved except for
extensions which change from ".a" to ".o". This commit updates
references accordingly where needed, in particular in some linker
scripts.

This commit reveals board configurations that exclude some features but
include source files that depend these disabled features in the build,
resulting in undefined symbols. Known such cases include:
- disabling CMD_NET but not CMD_NFS;
- enabling CONFIG_OF_LIBFDT but not CONFIG_QE.

Signed-off-by: Sebastien Carlier <sebastien.carlier@gmail.com>


# 14d0a02a 07-Oct-2010 Wolfgang Denk <wd@denx.de>

Rename TEXT_BASE into CONFIG_SYS_TEXT_BASE

The change is currently needed to be able to remove the board
configuration scripting from the top level Makefile and replace it by
a simple, table driven script.

Moving this configuration setting into the "CONFIG_*" name space is
also desirable because it is needed if we ever should move forward to
a Kconfig driven configuration system.

Signed-off-by: Wolfgang Denk <wd@denx.de>


# f534c7cd 03-Aug-2010 Mike Frysinger <vapier@gentoo.org>

config.mk: avoid -traditional-cpp on OS X 10.5

Simply trying to include a basic header file like stdlib.h on OS X 10.5
and then building with -traditional-cpp fails with lots of errors like:
In file included from /usr/include/stdlib.h:63,
from test.c:3:
/usr/include/available.h:85: error: stray '#' in program
/usr/include/available.h:85: error: syntax error before numeric constant
/usr/include/available.h:86: error: stray '#' in program

In the past, I hadn't noticed because the old logic for these flags were
restricted to Darwin running on PowerPC systems while I'm running on an
Intel system. But after some recent clean ups and changes, the flag was
being applied to all Darwin systems and my host tools broke.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>


# 1117cbf2 27-May-2010 Thomas Chou <thomas@wytron.com.tw>

nios: remove nios-32 arch

The nios-32 arch is obsolete and broken. So it is removed.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>


# c7da8c19 22-May-2010 Andreas Biessmann <andreas.devel@googlemail.com>

config.mk: use different host compiler for OS X 10.6

Compiling tools subdirectory on Mac OS X 10.6 (Snow Leopard) complains about
wrong syntax in system includes.

In file included from /usr/include/stdio.h:444,
from ../source/u-boot/include/compiler.h:26,
from ../source/u-boot/lib/crc32.c:15:
/usr/include/secure/_stdio.h:46: error: syntax error in macro parameter list

This can be fixed by reverting the workaround for prior OS X releases in
config.mk conditionally for OS X 10.6+.

Signed-off-by: Andreas Bie�mann <andreas.devel@googlemail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>


# 8d1f2682 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

ppc: Move cpu/$CPU to arch/ppc/cpu/$CPU

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>


# ea0364f1 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Move lib_$ARCH directories to arch/$ARCH/lib

Also move lib_$ARCH/config.mk to arch/$ARCH/config.mk

This change is intended to clean up the top-level directory structure
and more closely mimic Linux's directory organization.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>


# 89f39e17 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Change directory-specific CFLAGS to use full path

Previously, a specific file or directory could be compiled with custom
CFLAGS by adding a Makefile variable such as:
CFLAGS_dlmalloc.o = <custom flags for common/dlmalloc.c>
or
CFLAGS_lib = <custom flags for lib directory>

This method breaks down once multiple files or directories share the
same path. Eg FLAGS_fileA = <custom flags> would incorrectly result in
both dir1/fileA.c and dir2/fileA.c being compiled with <custom flags>.

This change allows finer grained control which we need once we move
lib_$ARCH to arch/$ARCH/lib/ and lib_generic/ to lib/. Without this
change all lib/ directories would share the same custom CFLAGS.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>


# 03b7004d 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

Create CPUDIR variable

The CPUDIR variable points to the location of a target's CPU directory.
Currently, it is set to cpu/$CPU. However, using $CPUDIR will allow for
more flexibility in the future. It lays the groundwork for reorganizing
U-Boot's directory structure to support a layout such as:

arch/$ARCH/cpu/$CPU/* (architecture with multiple CPU types)
arch/$ARCH/cpu/* (architecture with one CPU type)

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>


# d984fed0 04-Nov-2009 Scott Wood <scottwood@freescale.com>

makefiles: fixes for building build tools

Currently, some of the tools instead set CC to be HOSTCC in order to re-use
some pattern rules -- but this fails when the user overrides CC on the make
command line. Also, the HOSTCFLAGS in tools/Makefile are currently not
being used because config.mk overwrites them.

This patch adds static pattern rules for files that have been requested to
be built with the native compiler using $(HOSTSRCS) and $(HOSTOBJS), and
converts the tools to use them.

It restores easylogo to using the host compiler, which was broken by commit
38d299c2db81bd889c601b5dfc12c4e83ef83333 (if this was an intentional change,
please let me know -- but it seems to be a build tool).

It restores -pedantic and the special flags for darwin and cygwin that were
requested in tools/makefile (but keeps the flags added by config.mk) --
hopefully someone can test this on those platforms. It no longer
conditionalizes -pedantic on not being darwin; it wasn't clear that that was
intentional, and unless there's a real problem it's just inviting people to
contribute non-pedantic patches to those files (I'm not a fan of -pedantic
personally, but if it's on for one platform it should be on for all).

HOST_LDFLAGS is renamed HOSTLDFLAGS for consistency with the previous
HOST_CFLAGS to HOSTCFLAGS rename. A new HOSTCFLAGS_NOPED is made available
for those files which currently cannot be built with -pedantic, and replaces
the old FIT_CFLAGS.

imls now uses the cross compiler properly, rather than by trying to
reconstruct CC using the typoed $(CROSS_COMPILER).

envcrc.c is now dependency-processed unconditionally -- previously it would
be built without being on (HOST)SRCS if CONFIG_ENV_IS_EMBEDDED was not
selected.

Signed-off-by: Scott Wood <scottwood@freescale.com>


# bbff2d28 09-Sep-2009 Kumar Gala <galak@kernel.crashing.org>

ppc/85xx: Introduce RESET_VECTOR_ADDRESS to handle non-standard link address

Some board ports place TEXT_BASE at a location that would cause the
RESET_VECTOR_ADDRESS not to be at 0xfffffffc when we link. By default
we assume RESET_VECTOR_ADDRESS will be 0xfffffffc if the board doesn't
explicitly set it.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Wolfgang Denk <wd@denx.de>


# 6c97a20d 09-Sep-2009 Kumar Gala <galak@kernel.crashing.org>

ppc/85xx: Introduce RESET_VECTOR_ADDRESS to handle non-standard link address

Some board ports place TEXT_BASE at a location that would cause the
RESET_VECTOR_ADDRESS not to be at 0xfffffffc when we link. By default
we assume RESET_VECTOR_ADDRESS will be 0xfffffffc if the board doesn't
explicitly set it.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Wolfgang Denk <wd@denx.de>


# 6ac9f479 23-Aug-2009 Mike Frysinger <vapier@gentoo.org>

start a linker script helper file

Start a common header file for common linker script code (such as
workarounds for older linkers) rather than doing this in the build system.

As fallout, we no longer execute the linker every time config.mk is
included by a build file (which can easily be 70+ times), but rather only
execute it once.

This also fixes a bug in the major version checking by creating a macro to
easily compare versions and keep people from making the same common
mistake (forgetting to check major and minor together).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>


# 1aada9cd 17-Aug-2009 Wolfgang Denk <wd@denx.de>

Fix all linker scripts for older binutils versions (pre-2.16)

Commit f62fb99941c6 fixed handling of all rodata sections by using a
wildcard combined with calls to ld's builtin functions SORT_BY_ALIGNMENT()
and SORT_BY_NAME(). Unfortunately these functions were only
introduced with biunutils version 2.16, so the modification broke
building with all tool chains using older binutils.

This patch makes it work again. This is done by omitting the use of
these functions for such old tool chains. This will result in
slightly larger target binaries, as the rodata sections are no longer
in optimal order alignment-wise which reauls in unused gaps, but the
effect was found to be insignificant - especially compared to the fact
that you cannot build U-Boot at all in the current state.

As ld seems to have no support for conditionals we run the linker
script through the C preprocessor which can be easily used to remove
the unwanted function calls.

Note that the C preprocessor must be run with the "-ansi" (or a
"-std=") option to make sure all the system-specific predefined
macros outside the reserved namespace are suppressed. Otherise, cpp
might for example substitute "powerpc" to "1", thus corrupting for
example "OUTPUT_ARCH(powerpc)" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>


# f772acf8 17-Aug-2009 Wolfgang Denk <wd@denx.de>

ARM: compiler options cleanup - improve tool chain support

For some time there have been repeated reports about build problems
with some ARM (cross) tool chains. Especially issues about
(in)compatibility with the tool chain provided runtime support
library libgcc.a caused to add and support a private implementation
of such runtime support code in U-Boot. A closer look at the code
indicated that some of these issues are actually home-made. This
patch attempts to clean up some of the most obvious problems and make
building of U-Boot with different tool chains easier:

- Even though all ARM systems basicy used the same compiler options
to select a specific ABI from the tool chain, the code for this was
distributed over all cpu/*/config.mk files. We move this one level
up into lib_arm/config.mk instead.

- So far, we only checked if "-mapcs-32" was supported by the tool
chain; if yes, this was used, if not, "-mabi=apcs-gnu" was
selected, no matter if the tool chain actually understood this
option. There was no support for EABI conformant tool chains.
This patch implements the following logic:

1) If the tool chain supports
"-mabi=aapcs-linux -mno-thumb-interwork"
we use these options (EABI conformant tool chain).
2) Otherwise, we check first if
"-mapcs-32"
is supported, and then check for
"-mabi=apcs-gnu"
If one test succeeds, we use the first found option.
3) In case 2), we also test if "-mno-thumb-interwork", and use
this if the test succeeds. [For "-mabi=aapcs-linux" we set
"-mno-thumb-interwork" mandatorily.]

This way we use a similar logic for the compile options as the
Linux kernel does.

- Some EABI conformant tool chains cause external references to
utility functions like raise(); such functions are provided in the
new file lib_arm/eabi_compat.c

Note that lib_arm/config.mk gets parsed several times, so we must
make sure to add eabi_compat.o only once to the linker list.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Dirk Behme <dirk.behme@googlemail.com>
Cc: Magnus Lilja <lilja.magnus@gmail.com>
Cc: Tom Rix <Tom.Rix@windriver.com>
Cc: Prafulla Wadaskar <prafulla@marvell.com>
Acked-by: Sergey Kubushyn <ksi@koi8.net>
Tested-by: Magnus Lilja <lilja.magnus@gmail.com>
Tested-by: Andrzej Wolski <awolski@poczta.fm>
Tested-by: Gaye Abdoulaye Walsimou <walsimou@walsimou.com>
Tested-by: Tom Rix <Tom.Rix@windriver.com>
Tested-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>


# b220c64d 10-Jul-2009 Peter Tyser <ptyser@xes-inc.com>

Move architecture specific config.mk files into subdirs

This cleans up U-Boot's toplevel directory a bit and makes the
architecture 'config.mk' file naming and location similar to board
and cpu 'config.mk' files

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>


# cff80f2c 20-Jun-2009 Shinya Kuribayashi <skuribay@pobox.com>

config.mk: Remove unused HPATH

This variable is not unused anywhere.

Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>


# 12e9043c 20-Jun-2009 Shinya Kuribayashi <skuribay@pobox.com>

config.mk: Remove $(PCI_CLOCK) reference

The following commit introduced $(PCI_CLOCK) reference so that
we could tweak `PCI_66M' definition via an environment variable.

> commit f046ccd15c8bc9613bfd72916b761a127d36e5c6
> Author: Eran Liberty <liberty@freescale.com>
> Date: Thu Jul 28 10:08:46 2005 -0500
>
> * Patch by Eran Liberty
> Add support for the Freescale MPC8349ADS board.

But I suggest a removal of it for the following reasons:

* In 2006, MPC8349ADS was merged into MPC8349EMDS port,
and it seems that MPC8349EMDS port is PCI_66M free.

* OTOH, PCI_66M is used by MPC832XEMDS an MPC8360EMDS ports,
but they don't need $(PCI_CLOCK) environment variable at all.
PCI_66M is automatically configured via $(BOARD)_config names
with the help of $(findstring _66_,$@).

* Unfortunately $(PCI_CLOCK) has been undocumented anywhere,
so only a few people know the existence of it these days.

* Keep config.mk independent from $(BOARD) as much as possible.

Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>
Acked-by: Kim Phillips <kim.phillips@freescale.com>


# 31f30c9e 14-Jun-2009 Mike Frysinger <vapier@gentoo.org>

add %.c->%.i and %.c->%.s rules

The Linux kernel has some helper rules which allow you to quickly produce
some of the intermediary files from C source. Specifically, you can
create .i files which is the preprocessed output and you can create .s
files which is the assembler output. This is useful when you are trying
to track down header/macro expansion errors or inline assembly errors.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>


# 5ec5529b 14-Jun-2009 Mike Frysinger <vapier@gentoo.org>

allow boards to customize compiler options on a per-file/dir basis

With our Blackfin boards, we like to build the compression routines with
-O2 as our tests show a pretty good size/speed tradeoff. For the rest of
U-Boot though, we want to stick with the default -Os as that is mostly
control code. So in our case, we would add a line like so to the board
specific config.mk file:
CFLAGS_lib_generic += -O2

Now all files under lib_generic/ will have -O2 appended to their build.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>


# 3112030a 22-May-2009 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

config.mk: remove un-needed REMOTE_BUILD check

as $(obj) is empty when in tree build

%.s: %.S
$(CPP) $(AFLAGS) -o $@ $<

and

$(obj)%.s: %.S
$(CPP) $(AFLAGS) -o $@ $<

are the same

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>


# 4cda4378 17-Jan-2009 Mike Frysinger <vapier@gentoo.org>

build system: treat all Darwin's alike

The x86 based version of Darwin behaves the same quirky way as the powerpc
Darwin, so only check HOSTOS when setting up Darwin workarounds.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>


# 434c51a5 12-Nov-2008 Peter Tyser <ptyser@xes-inc.com>

Remove unneeded CONFIG_SHELL references

Make should be using the bash shell by default which makes
CONFIG_SHELL unnecessary

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>


# 03db5333 11-Sep-2008 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

make: Remove redundant __ARM__ addition when cross-compiling on *BSD

__ARM__ is given by arm_config.mk automatically.

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>


# 6b971c73 30-Aug-2008 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

config.mk: Move arch-specific condition to $(ARCH)_config.mk

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>


# 28eab0d7 18-May-2008 Haavard Skinnemoen <hskinnemoen@atmel.com>

Conditionally add -fno-stack-protector to CFLAGS

When compile-testing on powerpc, I get errors like this:

net/nfs.c:422: undefined reference to `__stack_chk_fail_local'

This seems to be because -fstack-protector is on by default, so
let's explicitly disable it on all architectures that support the
option.

The Ubuntu toolchain is affected by this problem, and according to
Mike Frysinger, Gentoo has been running with SSP enabled for years.
More and more distros are turning SSP on by default, so this problem
is likely to get worse in the future.

Also, powerpc just happens to be one of the arches I do
compile-testing on. There may be other arches affected by this too.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>


# 53677ef1 20-May-2008 Wolfgang Denk <wd@denx.de>

Big white-space cleanup.

This commit gets rid of a huge amount of silly white-space issues.
Especially, all sequences of SPACEs followed by TAB characters get
removed (unless they appear in print statements).

Also remove all embedded "vim:" and "vi:" statements which hide
indentation problems.

Signed-off-by: Wolfgang Denk <wd@denx.de>


# c4e5f52a 03-May-2008 Wolfgang Denk <wd@denx.de>

config.mk: use correct (cross) compiler

Some config.mk files reference $(CC) to test for specific tool chain
features, so make sure $(CC) gets set before including any such
config files.

This patch replaces commit b7166e05a5 ("ColdFire: Get information from
the correct GCC").

Signed-off-by: Wolfgang Denk <wd@denx.de>


# 755c35f5 18-Feb-2008 Mike Frysinger <vapier@gentoo.org>

include autoconf.mk before any other .mk files

This bumps the autoconf.mk include step above board/cpu/arch/etc... so that
those .mk files can have make if statements based on the current config.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>


# 161b2af4 28-Jan-2008 Mike Frysinger <vapier@gentoo.org>

Only use TEXT_BASE if defined by the board

Signed-off-by: Mike Frysinger <vapier@gentoo.org>


# 94a91e24 04-Feb-2008 Mike Frysinger <vapier@gentoo.org>

generate u-boot.ldr for Blackfin targets

Signed-off-by: Mike Frysinger <vapier@gentoo.org>


# 2f155f6c 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

[BUILD] Generate include/autoconf.mk from board config files

Use cpp and sed to postprocess config.h and import the defined values
into include/autoconf.mk. autoconf.mk is then included by config.mk to
give 'make' access to the board configuration.

Doing this enables conditional compilation at the Makefile level instead
of by wrapping every .c file with #ifdef/#endif wrappers.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>


# ad845bee 30-Oct-2007 Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

blackfin: Move `-D__BLACKFIN__' to $(ARCH)_config.mk

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>


# ef26a08f 08-Mar-2007 Aubrey.Li <aubrey.adi@gmail.com>

[Blackfin][PATCH-2/2] Common files changed to support bf533 platform


# 1954be6e 28-Oct-2006 Wolfgang Denk <wd@pollux.denx.de>

Automatically adjust ARFLAGS so "make -s" is really silent.


# e11887a7 26-Oct-2006 Haavard Skinnemoen <hskinnemoen@atmel.com>

Don't pass any debug options directly to the assembler

When passing the -g option to gcc, gcc automatically selects a
suitable --g<format> option to pass on to the assembler.
Thus, there's no point in forcing a specific debug option on the
assembler using the -Wa mechanism.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>


# 2da2d9a4 24-Oct-2006 Wolfgang Denk <wd@pollux.denx.de>

Use -g instead of -gstabs in AFLAGS_DEBUG
Patch by Haavard Skinnemoen, 30 Aug 2006

In config.mk, -Wa,-gstabs is unconditionally appended to AFLAGS no
matter what the target's preferred debugging format is. This patch
simply replaces -gstabs with -g, so that the default debugging format
for the architecture is used.


# 2b208f53 08-Oct-2006 Wolfgang Denk <wd@atlas.denx.de>

Move "ar" flags to config.mk to allow for silent "make -s"
Based on patch by Mike Frysinger, 20 Jun 2006


# 511d0c72 08-Oct-2006 Wolfgang Denk <wd@atlas.denx.de>

Coding style cleanup


# 887e2ec9 07-Sep-2006 Stefan Roese <sr@denx.de>

Add support for AMCC Sequoia PPC440EPx eval board
- Add support for PPC440EPx & PPC440GRx
- Add support for PPC440EP(x)/GR(x) NAND controller
in cpu/ppc4xx directory
- Add NAND boot functionality for Sequoia board,
please see doc/README.nand-boot-ppc440 for details
- This Sequoia NAND image doesn't support environment
in NAND for now. This will be added in a short while.
Patch by Stefan Roese, 07 Sep 2006


# f9328639 01-Sep-2006 Marian Balakowicz <m8@semihalf.com>

Add support for a saving build objects in a separate directory.
Modifications are based on the linux kernel approach and
support two use cases:

1) Add O= to the make command line
'make O=/tmp/build all'

2) Set environement variable BUILD_DIR to point to the desired location
'export BUILD_DIR=/tmp/build'
'make'

The second approach can also be used with a MAKEALL script
'export BUILD_DIR=/tmp/build'
'./MAKEALL'

Command line 'O=' setting overrides BUILD_DIR environent variable.

When none of the above methods is used the local build is performed and
the object files are placed in the source directory.


# b62fa913 16-May-2006 Marian Balakowicz <m8@semihalf.com>

Fix gcc 3.4.x AFLAGS setting for m68k platform.


# 483a0cf8 09-May-2006 Marian Balakowicz <m8@semihalf.com>

Fixes for gcc 3.4 based m68k toolchain,
based on patch by Jate Sujjavanich.


# 9acb626f 20-Apr-2006 Heiko Schocher <hs@pollux.denx.de>

Add MCF5282 support (without preloader)
relocate ichache_State to ram
u-boot can run from internal flash
Add EB+MCF-EV123 board support.
Add m68k Boards to MAKEALL
Patch from Jens Scharsig, 08 Aug 2005


# 0afe519a 11-Mar-2006 Wolfgang Denk <wd@pollux.denx.de>

Add ADI Blackfin support
- add support for Analog Devices Blackfin BF533 CPU
- add support for the ADI BF533 Stamp uClinux board
- add support for the ADI BF533 EZKit board
Patches by Richard Klingler, June 11th 2005:


# 0be248fa 06-Mar-2006 Wolfgang Denk <wd@atlas.denx.de>

Cleanup (get rid of debug code that sneaked in)


# 00c35bd2 28-Feb-2006 Markus Klotzb�cher <Markus Klotzb�mk@pollux.(none)>

Added GPIO initialization of DF signal. Still not working.


# e0269579 07-Feb-2006 Markus Klotzb�cher <Markus Klotzb�mk@pollux.(none)>

This is the first commit for the u-boot zylonite port. The following has be
done so far:

* created zylonite board dir (based on lubbock)
* extended some - but not all pxa sources and headers for Intel
Monahans support (CONFIG_CPU_MONAHANS)
* created Makefile zylonite target + MAKEALL entry
* added some debug nonsense, remove later, grep for mk@tbd

Status: compiles (eldk-4.0), and can be started with BDI, but runs forever
and doesn't halt at breakpoints. Hmmm...


# 9b880bd4 04-Oct-2005 Wolfgang Denk <wd@pollux.denx.de>

Update ARM Integrator boards:
Correct addessing errors in platform files.
Split off common core module data from Integrator header files to
include/armcoremodule.h.
Patch by Peter Pearse, 04 Oct 2005


# 1820d4c7 04-Oct-2005 Wolfgang Denk <wd@pollux.denx.de>

Make sure only supported compiler options are used
Import "cc-option" shell function from kernel and
use it to get the correct ARM GCC options for individual CPUs
Patch by Peter Pearse, 30 Jun 2005


# f046ccd1 28-Jul-2005 Eran Liberty <liberty@freescale.com>

* Patch by Eran Liberty
Add support for the Freescale MPC8349ADS board.


# 1d9f4105 09-Oct-2004 wdenk <wdenk>

Patch by Steven Scholz, 16 Aug 2004:
- Introducing the concept of SoCs "./cpu/$(CPU)/$(SOC)"
- creating subdirs for SoCs ./cpu/arm920t/imx and ./cpu/arm920t/s3c24x0
- moving SoC specific code out of cpu/arm920t/ into cpu/arm920t/$(SOC)/
- moving drivers/s3c24x0_i2c.c and drivers/serial_imx.c out of drivers/
into cpu/arm920t/$(SOC)/


# e4cc71aa 19-May-2004 wdenk <wdenk>

Patch by Scott McNutt, 25 Apr 2004:
Add Nios GDB/JTAG Console support:
- Add stubs to support gdb via JTAG.
- Add support for console over JTAG.
- Minor cleanup.


# c40b2956 13-Mar-2004 wdenk <wdenk>

* Patch by Rune Torgersen, 27 Feb 2004:
- Added LBA48 support (CONFIG_LBA48 & CFG_64BIT_LBA)
- Added support for 64bit printing in vsprintf (CFG_64BIT_VSPRINTF)
- Added support for 64bit strtoul (CFG_64BIT_STRTOUL)

* Patch by Masami Komiya, 27 Feb 2004:
Fix rarpboot: add autoload by NFS

* Patch by Dan Eisenhut, 26 Feb 2004:
fix flash_write return value in saveenv

* Patch by Stephan Linz, 11 Dec 2003
expand config.mk to avoid trigraph warnings on NIOS

* Rename "BMS2003" board into "HMI10"


# 4aeb251f 16-Sep-2003 wdenk <wdenk>

* Modify XLB arbiter priorities on MPC5200 so all devices use same
priority; configure critical interrupts to be handled like external
interrupts


# 27b207fd 24-Jul-2003 wdenk <wdenk>

* Implement new mechanism to export U-Boot's functions to standalone
applications: instead of using (PPC-specific) system calls we now
use a jump table; please see doc/README.standalone for details

* Patch by Dave Westwood, 24 Jul 2003:
added support for Unity OS (a proprietary OS)


# b783edae 25-Jun-2003 wdenk <wdenk>

* Header file cleanup for ARM

* Patch by Murray Jensen, 24 Jun 2003:
- make sure to use only U-boot provided header files
- fix problems with ".rodata.str1.4" section as used by GCC-3.x


# 592c5cab 20-Jun-2003 wdenk <wdenk>

Patch by Murray Jensen, 20 Jun 2003:
- hymod update
- cleanup (especially for gcc-3.x compilers)


# 6dd652fa 19-Jun-2003 wdenk <wdenk>

Patches by Murray Jensen, 17 Jun 2003:
- Hymod board database mods: add "who" field and new xilinx chip types
- provide new "init_cmd_timeout()" function so code external to
"common/main.c" can use the "reset_cmd_timeout()" function before
entering the main loop
- add DTT support for adm1021 (new file dtt/adm1021.c; config
slightly different. see include/configs/hymod.h for an example
(requires CONFIG_DTT_ADM1021, CONFIG_DTT_SENSORS, and
CFG_DTT_ADM1021 defined)
- add new "eeprom_probe()" function which has similar args and
behaves in a similar way to "eeprom_read()" etc.
- add 8260 FCC ethernet loopback code (new "eth_loopback_test()"
function which is enabled by defining CONFIG_ETHER_LOOPBACK_TEST)
- gdbtools copyright update
- ensure that set_msr() executes the "sync" and "isync" instructions
after the "mtmsr" instruction in cpu/mpc8260/interrupts.c
- 8260 I/O ports fix: Open Drain should be set last when configuring
- add SIU IRQ defines for 8260
- allow LDSCRIPT override and OBJCFLAGS initialization: change to
config.mk to allow board configurations to override the GNU
linker script, selected via the LDSCRIPT, make variable, and to
give an initial value to the OBJCFLAGS make variable
- 8260 i2c enhancement:
o correctly extends the timeout depending on the size of all
queued messages for both transmit and receive
o will not continue with receive if transmit times out
o ensures that the error callback is done for all queued tx
and rx messages
o correctly detects both tx and rx timeouts, only delivers one to
the callback, and does not overwrite an earlier error
o logic in i2c_probe now correct
- add "vprintf()" function so that "panic()" function can be
technically correct
- many Hymod board changes


# ea909b76 21-Nov-2002 wdenk <wdenk>

* Added support for both PCMCIA slots (at the same time!) on MPC8xx

* Patch by Rod Boyce, 21 Nov 2002:
fix PCMCIA on MBX8xx board

* Patch by Pierre Aubert , 21 Nov 2002
Add CFG_CPM_POST_WORD_ADDR to make the offset of the
bootmode word in DPRAM configurable


# 7f6c2cbc 10-Nov-2002 wdenk <wdenk>

* Vince Husovsky, 7 Nov 2002:
Add "-n" to linker options to get rid of "Not enough room for
program headers" problem

* Patch by David M�ller, 05 Nov 2002
Rename CONFIG_PLL_INPUT_FREQ to CONFIG_SYS_CLK_FREQ
so we can use an already existing name

* Patch by Pierre Aubert, 05 Nov 2002
Hardware related improvements in FDC boot code

* Patch by Holger Schurig, 5 Nov 2002:
Make the PXA really change it's frequency

* Patch by Pierre Aubert, 05 Nov 2002
Add support for slave serial Spartan 2 FPGAs

* Fix uninitialized memory (MAC address) in 8xx SCC/FEC ethernet
drivers


# e2211743 02-Nov-2002 wdenk <wdenk>

Initial revision