Commit Graph

537 Commits

Author SHA1 Message Date
Masahiro Yamada
6a44d80634 kbuild: move asm-offsets.h rules to ./Kbuild
Generate include/generated/generic-asm-offsets.h and
include/generated/asm-offsets.h in ./Kbuild.

This commit also changes the include guard.

Before this commit, __ASM_OFFSETS_H__ was used for both of them.
So we could not include generic-asm-offsets.h and asm-offsets.h
at the same time.

This commit renames the include guard of the former to
__GENERIC_ASM_OFFSETS_H__.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2014-02-25 11:01:28 -05:00
Masahiro Yamada
8fac9c7b7d kernel-doc: move kernel-doc tools to scripts/
tools/kernel-doc/docproc.c and tools/kernel-doc/kernel-doc are
files imported from Linux Kernel.

They originally resided under scripts/ directory in Linux Kernel.

This commit moves them to the original location.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
2014-02-19 11:10:04 -05:00
Masahiro Yamada
79fc0c5f49 tools/env: cross-compile fw_printenv without setting HOSTCC
fw_printenv is a program which mostly runs on the target Linux.

Before switching to Kbuild, we needed to set HOSTCC at the
command line like this:
    make HOSTCC=<your CC cross-compiler> env

Going forward we can cross compile it by specifying CROSS_COMPILE:
    make CROSS_COMPILE=<your cross-compiler prefix> env
This looks more natural.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>
2014-02-19 11:10:04 -05:00
Masahiro Yamada
2887c47338 Makefile: refactor tools-all targets
- Move "easylogo", "gdb" tagets to tools/Makefile
 - Delete "gdbtools" target (same as "gdb")

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2014-02-19 11:10:04 -05:00
Masahiro Yamada
6825a95b0b 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>
2014-02-19 11:07:50 -05:00
Masahiro Yamada
9e4140329e 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>
2014-02-19 11:07:50 -05:00
Masahiro Yamada
fea1ca8e34 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>
2014-02-19 11:07:50 -05:00
Masahiro Yamada
34bd050709 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>
2014-02-19 11:07:50 -05:00
Masahiro Yamada
940db16d2e 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>
2014-02-19 11:07:49 -05:00
Ian Campbell
054c838834 tools: correct proftool build rule
The incorrect substitution made it rebuild every time.

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>
2014-02-19 10:47:38 -05:00
Masahiro Yamada
e60cfd531a relocate-rela: replace a magic number with sizeof(Elf64_Rela)
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: David Feng <fenghua@phytium.com.cn>
Acked-by: Scott Wood <scottwood@freescale.com>
2014-02-13 15:16:47 +01:00
Masahiro Yamada
901d0ea1fc tools: move kermit files to tools/kermit directory
The script files, define2mk.sed and make-asm-offsets
are used to create autoconf.mk and asm-offsets.h
while build.

Whereas README, dot.kermrc, flash_param, send_cmd, send_image
are files useful for kermit.

We should not put files which have the totally different purpose
into the same directory.

This commit creates a new directory, tools/kermit,
and move kermit files into it.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>
2014-01-24 16:59:07 -05:00
Masahiro Yamada
26d2857485 cosmetic: tools/scripts/README: insert only one space between words
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2014-01-24 16:59:07 -05:00
Masahiro Yamada
84977e44eb .gitignore: ignore u-boot.elf and tools/relocate-rela
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2014-01-20 10:09:51 -05:00
Tom Rini
7f673c99c2 Merge branch 'master' of git://git.denx.de/u-boot-arm
Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
	include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>
2014-01-10 10:56:00 -05:00
Scott Wood
8137af19e7 arm64: Add tool to statically apply RELA relocations
ARM64 uses the newer RELA-style relocations rather than the older REL.
RELA relocations have an addend in the relocation struct, rather than
expecting the loader to read a value from the location to be updated.

While this is beneficial for ordinary program loading, it's problematic
for U-Boot because the location to be updated starts out with zero,
rather than a pre-relocation value.  Since we need to be able to run C
code before relocation, we need a tool to apply the relocations at
build time.

In theory this tool is applicable to other newer architectures (mainly
64-bit), but currently the only relocations it supports are for arm64,
and it assumes a 64-bit little-endian target.  If the latter limitation
is ever to be changed, we'll need a way to tell the tool what format
the image is in.  Eventually this may be replaced by a tool that uses
libelf or similar and operates directly on the ELF file.  I've written
some code for such an approach but libelf does not make it easy to poke
addresses by memory address (rather than by section), and I was
hesitant to write code to manually parse the program headers and do the
update outside of libelf (or to iterate over sections) -- especially
since it wouldn't get test coverage on things like binaries with
multiple PT_LOAD segments.  This should be good enough for now to let
the manual relocation stuff be removed from the arm64 patches.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: David Feng <fenghua@phytium.com.cn>
2014-01-09 16:08:22 +01:00
Albert ARIBAUD
4b0561d841 Merge branch 'u-boot-samsung/master' into 'u-boot-arm/master' 2014-01-06 09:32:42 +01:00
Albert ARIBAUD
a891601ce5 Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'
Conflicts:
	include/micrel.h

The conflict above was trivial, caused by four lines being
added in both branches with different whitepace.
2014-01-06 08:49:58 +01:00
Rajeshwari Birje
0fcac1abde SPL: EXYNOS: Prepare for variable size SPL support
When variable size SPL is used, the BL1 expects the SPL to be
encapsulated differently: instead of putting the checksum at a fixed
offset in the SPL blob, prepend the blob with a header including the
size and the checksum.

The enhancements include
	- adding a command line option, '--vs' to indicate the need for the
	variable size encapsulation
	- padding the fixed size encapsulated blob with 0xff instead of random
	memory contents
	- do not silently truncate the input file, report error instead
	- no need to explicitly closing files/freeing memory, this all happens
	on exit; removing cleanups it makes code clearer
	- profuse commenting
	- modify Makefile to allow enabling the new feature per board

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Rajeshwari S Shinde <rajeshwari.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2013-12-30 16:50:35 +09:00
Rajeshwari Birje
e106bd9b9d Exynos5420: Add base patch for SMDK5420
Adding the base patch for Exynos based SMDK5420.
This shall enable compilation and basic boot support for
SMDK5420.

Signed-off-by: Rajeshwari S Shinde <rajeshwari.s@samsung.com>
Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2013-12-30 16:50:34 +09:00
Marek Vasut
5b5a82eb70 ARM: mxs: tools: Fix errno handling in strtoul() invocation
According to NOTE in strtoul(3), the errno must be zeroed before strtoul()
is called. Zero the errno. The NOTE reads as such:

  Since strtoul() can legitimately return 0 or ULONG_MAX (ULLONG_MAX for
  strtoull()) on both success and failure, the calling program should set
  errno  to  0  before the call, and then determine if an error occurred
  by checking whether errno has a nonzero value after the call.

This issue was detected on Fedora 19 with glibc 2.17 .

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tom Rini <trini@ti.com>
2013-12-17 18:38:43 +01:00
Masahiro Yamada
475c506d08 Makefile, .gitignore: Cleanup non-existing binaries
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2013-12-16 08:59:43 -05:00
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
Guilherme Maciel Ferreira
a804b5ce2d Add dumpimage, a tool to extract data from U-Boot images
Given a multi-file image created through the mkimage's -d option:

  $ mkimage -A x86 -O linux -T multi -n x86 -d vmlinuz:initrd.img:System.map \
  multi.img

  Image Name:   x86
  Created:      Thu Jul 25 10:29:13 2013
  Image Type:   Intel x86 Linux Multi-File Image (gzip compressed)
  Data Size:    13722956 Bytes = 13401.32 kB = 13.09 MB
  Load Address: 00000000
  Entry Point:  00000000
  Contents:
     Image 0: 4040128 Bytes = 3945.44 kB = 3.85 MB
     Image 1: 7991719 Bytes = 7804.41 kB = 7.62 MB
     Image 2: 1691092 Bytes = 1651.46 kB = 1.61 MB

It is possible to perform the innverse operation -- extracting any file from
the image -- by using the dumpimage's -i option:

  $ dumpimage -i multi.img -p 2 System.map

Although it's feasible to retrieve "data files" from image through scripting,
the requirement to embed tools such 'dd', 'awk' and 'sed' for this sole purpose
is cumbersome and unreliable -- once you must keep track of file sizes inside
the image. Furthermore, extracting data files using "dumpimage" tool is faster
than through scripting.

Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2013-12-13 09:15:32 -05:00
Guilherme Maciel Ferreira
f86ed6a8d5 tools: moved code common to all image tools to a separated module.
In order to avoid duplicating code and keep only one point of modification,
the functions, structs and defines useful for "dumpimage" were moved from
"mkimage" to a common module called "imagetool".

This modification also weakens the coupling between image types (FIT, IMX, MXS,
and so on) and image tools (mkimage and dumpimage). Any tool may initialize the
"imagetool" through register_image_tool() function, while the image types
register themselves within an image tool using the register_image_type()
function:

                                                      +---------------+
                                               +------|   fit_image   |
 +--------------+          +-----------+       |      +---------------+
 |    mkimage   |--------> |           | <-----+
 +--------------+          |           |              +---------------+
                           | imagetool | <------------|    imximage   |
 +--------------+          |           |              +---------------+
 |  dumpimage   |--------> |           | <-----+
 +--------------+          +-----------+       |      +---------------+
                                               +------| default_image |
                                                      +---------------+

          register_image_tool()           register_image_type()

Also, the struct "mkimage_params" was renamed to "image_tool_params" to make
clear its general purpose.

Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2013-12-13 09:15:32 -05:00
Guilherme Maciel Ferreira
f1cc458cf3 mkimage: added 'static' specifier to match function's prototype.
This function should be declared static.

Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2013-12-13 09:15:32 -05:00
Tom Rini
5a4fe1aaf1 Merge branch 'buildpatman' of http://git.denx.de/u-boot-x86 2013-11-25 10:42:05 -05:00
Masahiro Yamada
2e78e75e1f tools: updater: Remove remainders of dead board
tools/updater needs board/MAI/AmigaOneG3SE board
for compiling.
But AmigaOneG3SE board was already deleted
by Commit 953b7e6.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2013-11-25 10:41:53 -05:00
Masahiro Yamada
cfe19f917a tools: imls: Remove a broken and unused tool.
It looks like tools/imls/Makefile is invoked from nowhere.
And also it is broken.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2013-11-25 10:41:52 -05:00
Stephen Warren
8426d8b089 buildman: make board selector argument a regex
A common use-case is to build all boards for a particular SoC. This can
be achieved by:

./tools/buildman/buildman -b mainline_dev tegra20

However, when the SoC is a member of a family of SoCs, and each SoC has
a different name, it would be even more useful to build all boards for
every SoC in that family. This currently isn't possible since buildman's
board selection command-line arguments are compared to board definitions
using pure string equality.

To enable this, compare using a regex match instead. This matches
MAKEALL's handling of command-line arguments. This enables:

(all Tegra)
./tools/buildman/buildman -b mainline_dev tegra

(all Tegra)
./tools/buildman/buildman -b mainline_dev '^tegra.*$'

(all Tegra20, Tegra30 boards, but not Tegra114)
./tools/buildman/buildman -b mainline_dev 'tegra[23]'

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
2013-11-21 13:35:58 -07:00
Andreas Bießmann
61242ac5f9 buildman: fix README
This is a trivial fix for c'n'p error.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Simon Glass <sjg@chromium.org>
2013-11-21 13:35:58 -07:00
Albert ARIBAUD
5c8fdd91dc patman: add Commit-notes tag and section
Sometimes a commit should have notes enclosed with it rather
than withing the cover letter -- possibly even because there
is no cover letter. Add a 'Commit-notes' tag, similar to the
'Series-notes' one; lines between this tag and the next END
line are inserted in the patch right after the '---' commit
delimiter.

Change-Id: I01e99ae125607dc6dec08f3be8a5a0b37f0a483d
Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Updated README)
2013-11-21 13:35:51 -07:00
Masahiro Yamada
e2e1f3ca39 tools: Makefile: delete redundant lines
HOSTOS is defined and exported at the top 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
Jagannadha Sutradharudu Teki
a707b3db56 buildman: Use env to pick the python from $PATH
python used in buildman doesn't need to be placed in
/usr/bin/python, So use env to ensure that the interpreter
will pick the python from environment.

Usefull with several versions of python's installed on system.

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Acked-by: Simon Glass <sjg@chromium.org>
2013-10-15 08:44:28 -04:00
Tom Rini
9cc18042e6 Merge branch 'buildman' of git://git.denx.de/u-boot-x86 2013-10-14 20:19:56 -04:00
Wolfgang Denk
16641d52fc Coding Style cleanup: drop some excessive empty lines
Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-10-14 16:06:54 -04: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
Wolfgang Denk
3765b3e7bd Coding Style cleanup: remove trailing white space
Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-10-14 16:06:53 -04:00
Stephen Warren
8bb2bddc2c buildman: don't fail --list-toolchains when toolchains fail
When a toolchain invocation fails, an exception is thrown but not caught
which then aborts the entire toolchain detection process. To solve this,
request that exceptions not be thrown, since the toolchain init code
already error-checks the command result. This solves e.g.:

         - found '/usr/bin/winegcc'
Traceback (most recent call last):
...
Exception: Error running '/usr/bin/winegcc --version'

Change-Id: I579c72ab3b021e38b14132893c3375ea257c74f0
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(formatted to 80cols)
2013-10-10 10:40:42 -06:00
Tom Rini
6297872cd5 Merge branch 'master' of git://git.denx.de/u-boot-arm 2013-10-02 11:45:22 -04:00
Simon Glass
4281ad8e7f buildman: Allow make flags to be specified for each board
There are a few make options such as BUILD_TAG which can be provided when
building U-Boot. Provide a way for buildman to pass these flags to make
also.

The flags should be in a [make-flags] section and arranged by target name
(the 'target' column in boards.cfg. See the README for more details.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-10-01 14:39:14 -06:00
Simon Glass
e19d5781ec buildman: Adjust tests for new boards.cfg format
Commit 27af930e9a changed the boards.cfg format
but missed to change the parsing in buildman. A follow-on commit
03c1bb2425 fixed this but missed fixing the
tests.

This patch updates the tests to fit the new Board constructor.

./tools/buildman/buildman -t
<unittest.result.TestResult run=1 errors=0 failures=0>

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-10-01 14:39:06 -06:00
York Sun
72048bc3f1 tools/imximage.c: Fix compiling warning
Convert set_hdr_func(struct imx_header *imxhdr) to set_hdr_func(void)
to get rid of the warning

warning: ‘imxhdr’ is used uninitialized in this function

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Stefano Babic <sbabic@denx.de>
2013-09-27 13:53:35 +02:00
Andreas Bießmann
03c1bb2425 buildman: fix boards.cfg parsing
Commit 27af930e9a changed the boards.cfg format
but missed to change the parsing in buildman.

This patch changes c'tor of Board class to the new sequence, but omits
maintainer field.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
2013-09-20 10:30:54 -04:00
Masahiro Yamada
2f0877c7f4 FIT: delete unnecessary casts
Becuase fdt_check_header function takes (const void *)
type argument, the argument should be passed to it
without being casted to (char *).

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2013-09-20 10:30:54 -04:00
Roger Meier
a466e49bf3 boards.cfg: show info about boards.cfg instead of MAINTAINERS
Signed-off-by: Roger Meier <roger@bufferoverflow.ch>
2013-09-20 10:30:53 -04:00
Stefano Babic
c4a7ece020 Merge branch 'master' of git://git.denx.de/u-boot-arm
Conflicts:
	MAINTAINERS
	boards.cfg

Signed-off-by: Stefano Babic <sbabic@denx.de>
2013-09-13 12:10:07 +02:00
Albert ARIBAUD
27af930e9a Merge and reformat boards.cfg and MAINTAINERS
Put all informations about targets, including state (active or
orphan) and maintainers, in boards.cfg; remove MAINTAINERS;
adjust the build system accordingly.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
2013-09-12 09:14:37 -04:00
Tom Rini
7bcee5f7ee Merge branch 'master' of git://git.denx.de/u-boot-arm 2013-09-12 09:08:24 -04:00