Commit Graph

112 Commits

Author SHA1 Message Date
Masahiro Yamada
dd88ab325c 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>
2013-12-13 09:18:45 -05:00
Simon Glass
cbe5cdfcd3 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>
2013-11-21 16:54:26 -07:00
Masahiro Yamada
74307f206c 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>
2013-11-17 14:11:32 -05:00
Masahiro Yamada
bb02c53660 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>
2013-11-08 09:39:14 -05:00
Wolfgang Denk
93e1459641 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>
2013-10-14 16:06:54 -04:00
Tom Rini
47f75cf2e1 Merge branch 'master' of git://git.denx.de/u-boot-arm 2013-09-06 20:25:35 -04:00
Masahiro Yamada
1affd4d4a3 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>
2013-09-06 13:09:08 -04:00
Masahiro Yamada
cb4ef5ba36 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>
2013-09-06 13:09:08 -04:00
Albert ARIBAUD
19d829fa60 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.
2013-09-05 11:15:26 +02:00
Marek Vasut
bce8837071 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>
2013-08-31 15:26:52 +02:00
Ying Zhang
3aa29de0b0 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>
2013-08-20 09:57:22 -07:00
Joel Fernandes
39bc12ddc3 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>
2013-08-19 18:05:19 -04:00
Stephen Warren
501ebdf286 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>
2013-08-02 18:29:32 -04:00
Wolfgang Denk
eca3aeb352 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>
2013-07-24 09:44:16 -04:00
Simon Glass
971c450a44 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>
2013-07-19 09:45:19 -04:00
Simon Glass
29ce737d6f 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>
2013-06-28 16:26:52 -04:00
Simon Glass
19c402afa2 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>
2013-06-26 10:18:56 -04:00
Simon Glass
5c2aeac5ae 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>
2013-06-26 10:16:41 -04:00
Marek Vasut
d642c467a0 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>
2013-05-09 17:03:04 -04:00
Simon Glass
fada9e2048 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>
2013-05-01 11:17:21 -04:00
Stefan Roese
ecddccd006 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>
2013-04-22 09:53:53 +02:00
Benoît Thébaudeau
120ae6091d 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>
2013-04-12 07:55:07 +02:00
Tom Rini
0ce033d258 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>
2013-03-18 14:37:18 -04:00
Simon Glass
5c1a7ea6ad __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>
2013-03-15 16:13:59 -04:00
Albert ARIBAUD
ef123c5253 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>
2013-03-12 23:28:40 +01:00
Marek Vasut
97b24d3d51 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>
2012-10-22 08:29:29 -07:00
Kim Phillips
4ab64933e3 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>
2012-10-15 11:54:03 -07:00
Marek Vasut
c1f5805a9d 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>
2012-10-15 11:53:59 -07:00
Marek Vasut
82dda962f0 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>
2012-10-15 11:53:58 -07:00
Allen Martin
2051ff3450 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>
2012-10-04 14:18:54 +02:00
Khem Raj
7cb714a578 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>
2012-08-10 23:26:10 +02:00
Stefan Roese
94aebe6cc3 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>
2012-07-07 14:07:43 +02:00
Tom Rini
19a695f84b 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>
2012-05-15 08:31:26 +02:00
Tom Rini
4a30f1e874 config.mk: Check for -fstack-usage support
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Tom Rini <trini@ti.com>
2012-03-26 23:09:24 +02:00
Tom Rini
6f4acc179c 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>
2012-03-26 23:09:24 +02:00
Daniel Schwierzeck
b6a467d73d 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>
2011-11-07 21:56:11 +01:00
Wolfgang Denk
cca4e4aec1 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>
2011-11-03 20:44:58 +01:00
Simon Glass
bbb0b128c3 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>
2011-10-26 21:38:59 +02:00
Mike Frysinger
5968adc414 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>
2011-10-22 01:19:28 +02:00
Simon Glass
4750884306 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>
2011-10-17 23:56:59 +02:00
Mike Frysinger
6262e4e74e 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>
2011-07-26 16:35:50 +02:00
Daniel Schwierzeck
c8f9c302c2 Extend build-system for SPL framework
Signed-off-by: Aneesh V <aneesh@ti.com>
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
2011-07-26 14:42:40 +02:00
Ilya Yanok
d51dfff7af 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>
2011-06-22 20:03:01 +02:00
Scott Wood
83b7e2a7f2 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>
2011-04-30 00:59:47 +02:00
Haiying Wang
6dc1eceb9c Introduce a new linker flag LDFLAGS_FINAL
commit 8aba9dceeb
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>
2011-03-22 23:32:06 +01:00
Joakim Tjernlund
5e987ddf85 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>
2011-03-21 22:56:56 +01:00
Nobuhiro Iwamatsu
8aba9dceeb 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>
2011-01-25 22:22:30 +01:00
Mike Frysinger
326a694527 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>
2010-12-17 21:19:37 +01:00
Wolfgang Denk
844f07d8a1 Coding Style (white space) cleanup
Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-11-27 23:35:14 +01:00
Sebastien Carlier
6d8962e814 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>
2010-11-17 21:02:18 +01:00