History log of /u-boot/tools/.gitignore
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# aff5dddd 26-Oct-2023 Sam Protsenko <semen.protsenko@linaro.org>

tools: gitignore: Fix tools/generated path

'git status' shows 'tools/generated/' after running the build, which is
wrong. The corresponding .gitignore rule was already added in commit
c623642d29be ("Adjust gitignore for tools/generated/"), but because of
superfluous 'tools/' part it wasn't in effect. Remove incorrect 'tools/'
part to fix it.

While at it, remove tools/ path incorrectly added to the top-level
.gitignore in commit 801c482207c7 (".gitignore: ignore misc include,
simple-bin, and tools/generated build artifacts"), as it's required in
the comment on the top of .gitignore:

# NOTE! Don't add files that are generated in specific
# subdirectories here. Add them in the ".gitignore" file
# in that subdirectory instead.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Fixes: c623642d29be ("Adjust gitignore for tools/generated/")
Fixes: 801c482207c7 (".gitignore: ignore misc include, simple-bin, and tools/generated build artifacts")

# c623642d 19-Jun-2023 Tobias Deiminger <tdmg@linutronix.de>

Adjust gitignore for tools/generated/

Tell git that auto-generated C sources are now exclusively expected
under tools/generated/.

Signed-off-by: Tobias Deiminger <tdmg@linutronix.de>

# 30238e99 07-Mar-2023 Roman Kopytin <Roman.Kopytin@kaspersky.com>

tools: add fdt_add_pubkey

Having to use the -K option to mkimage to populate U-Boot's .dtb with the
public key while signing the kernel FIT image is often a little
awkward. In particular, when using a meta-build system such as
bitbake/Yocto, having the tasks of the kernel and U-Boot recipes
intertwined, modifying deployed artifacts and rebuilding U-Boot with
an updated .dtb is quite cumbersome. Also, in some scenarios one may
wish to build U-Boot complete with the public key(s) embedded in the
.dtb without the corresponding private keys being present on the same
build host.

So this adds a simple tool that allows one to disentangle the kernel
and U-Boot builds, by simply copy-pasting just enough of the mkimage
code to allow one to add a public key to a .dtb. When using mkimage,
some of the information is taken from the .its used to build the
kernel (algorithm and key name), so that of course needs to be
supplied on the command line.

Signed-off-by: Roman Kopytin <Roman.Kopytin@kaspersky.com>
Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>

# aeca5194 01-Feb-2023 Simon Glass <sjg@chromium.org>

Drop ubsha1 tool

This seems to have been used by ppc4xx which was removed a while back.
The Kconfig does not exist so it is never built. Drop it.

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

# 486aef08 28-Nov-2022 Max Krummenacher <max.krummenacher@toradex.com>

u-boot-initial-env: rework make target

With LTO enabled the U-Boot initial environment is no longer stored
in an easy accessible section in env/common.o. I.e. the section name
changes from build to build, its content maybe compressed and it is
annotated with additional data.

Drop trying to read the initial env with elf tools from the compiler
specific object file in favour of adding and using a host tool with
the only functionality of printing the initial env to stdout.

See also:
https://lore.kernel.org/all/927b122e-1f62-e790-f5ca-30bae4332c77@foss.st.com/

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bdf98312 07-Apr-2022 Du Huanpeng <dhu@hodcarrier.org>

tools: add boot/ to .gitignore

/tools/boot/ is a build product. Add it to .gitignore

Signed-off-by: Du Huanpeng <dhu@hodcarrier.org>

# 850d27b4 28-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: add mkeficapsule to .gitignore

mkeficapsule is a build product. Add it to .gitignore

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 540a2bce 30-Nov-2020 Stefan Roese <sr@denx.de>

mips: octeon: tools: Add update_octeon_header tool

Add a tool to update or insert an Octeon specific header into the U-Boot
image. This is needed e.g. for booting via SPI NOR, eMMC and NAND.

While working on this, move enum cvmx_board_types_enum and
cvmx_board_type_to_string() to cvmx-bootloader.h and remove the
unreferenced (unsupported) board definition.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# e198bb51 29-Dec-2019 Dario Binacchi <dariobin@libero.it>

tools: .gitignore: add asn1_compiler

Add the tool to the ignore list to prevent being marked as unversioned.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4d90f6cd 27-Oct-2019 Bin Meng <bmeng.cn@gmail.com>

tools: Avoid creating symbolic links for tools/version.h

When building U-Boot host tools for Windows from Microsoft Azure
Pipelines, the following errors were seen:

HOSTCC tools/mkenvimage.o
In file included from tools/mkenvimage.c:25:
./tools/version.h:1:1: error: expected identifier or ‘(’ before ‘.’ token
1 | ../include/version.h
| ^
tools/mkenvimage.c: In function ‘main’:
tools/mkenvimage.c:117:4: warning: implicit declaration of function ‘usage’ [-Wimplicit-function-declaration]
117 | usage(prg);
| ^~~~~
tools/mkenvimage.c:120:35: error: ‘PLAIN_VERSION’ undeclared (first use in this function)
120 | printf("%s version %s\n", prg, PLAIN_VERSION);
| ^~~~~~~~~~~~~
tools/mkenvimage.c:120:35: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [scripts/Makefile.host:114: tools/mkenvimage.o] Error 1

It turns out tools/version.h is a symbolic link and with Windows
default settings it is unsupported hence the actual content of
tools/version.h is not what file include/version.h has, but the
the linked file path, which breaks the build.

To fix this, remove the symbolic links for tools/version.h. Instead
we perform a copy from include/version.h during the build.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 08afd714 18-Aug-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

tools: Add ifwitool to .gitignore

Follow up fix to the commit

56bf4f863075 ("x86: Add ifwitool for Intel Integrated Firmware Image")

in order to ignore created binary.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c78b5cb7 11-Jun-2019 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

tools: add tools/spl_size_limit to ignore list

This tool has just been added but it seems I forgot to add it to
the ignore list. So to prevent the built binary being marked as
unversioned, add it to the ignore list.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 07c098b7 22-Nov-2018 Lukas Auer <lukas.auer@aisec.fraunhofer.de>

tools: .gitignore: add prelink-riscv

Ignore tools/prelink-riscv.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# ac020196 17-Jan-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: provide a tool to convert a binary file to an include

For testing EFI disk management we need an in-memory image of
a disk.

The tool file2include converts a file to a C include. The file
is separated into strings of 8 bytes. Only the non-zero strings
are written to the include. The output format has been designed
to maintain readability.

#define EFI_ST_DISK_IMG { 0x00010000, { \
{0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \
{0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \
{0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \
{0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \
...
{0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \
{0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \
{0, NULL} } }

As the disk image needed for testing contains mostly zeroes a high
compression ratio can be attained.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 15b97f5c 16-Oct-2017 Masahiro Yamada <masahiroy@kernel.org>

pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile

The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.

Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.

I also rewrote the Makefile in a cleaner Kbuild style.

The scripts from the upstream have been moved as follows:

lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

The .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.

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

# eab44c93 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Add libfdt related files

Some files are generated during libfdt build. Ignore them.

This was wrongly put in the .gitignore in the root directory before.
Now let's remove entries there and put them in the right place.

Fixes: 34e2c285 ("gitignore: add intermediates from libfdt build")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# d11d3b2f 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Sort in alphabetical order

These are currently out of alphabetical order.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 594b4cc7 27-Feb-2017 Maxime Ripard <maxime.ripard@free-electrons.com>

tools: sunxi: Add spl image builder

This program generates raw SPL images that can be flashed on the NAND with
the ECC and randomizer properly set up.

This has been copied (and tweaked to find the right headers) from the
sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream
repository, commit 1c3a6ca5.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# c25f01a6 25-Nov-2016 oliver@schinagl.nl <oliver@schinagl.nl>

tools: Add tool to add crc8 to a mac address

This patch adds a little tool that takes a generic MAC address and
generates a CRC byte for it. The output is the full MAC address without
any separators, ready written into an EEPROM.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 87c2f76f 22-May-2016 Robert P. J. Day <rpjday@crashcourse.ca>

tools: Add entry for generated tools/bin2header to tools/.gitignore

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

# 01124327 31-Jul-2015 Bin Meng <bmeng.cn@gmail.com>

gitignore: Add defconfig and fdtgrep

Ignore defconfig and tools/fdtgrep.

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

# 9c574877 25-Jul-2015 Masahiro Yamada <masahiroy@kernel.org>

tools: remove mpc86x_clk tool

This is commented out in the Makefile for more than 10 years.
I assume it is proof that this tool is unused.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Pantelis Antoniou <panto@intracom.gr>

# 908ec6e4 24-Nov-2014 Bin Meng <bmeng.cn@gmail.com>

tools: Add ifdtool to .gitignore

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

# bedcf395 24-Oct-2014 Andreas Bießmann <andreas.devel@googlemail.com>

gitignore: ignore atmel pmecc parameter tool

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 7050f0de 06-Jun-2014 Masahiro Yamada <masahiroy@kernel.org>

.gitignore: move *.exe pattern to the top gitignore for Cygwin

GCC on Cygwin generates executables with .exe extension,
for example:
scripts/basic/fixdep.exe
scripts/docproc.exe

To ignore them, *.exe pattern should be moved
from tools/.gitignore to ./.gitignore

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

# ad80c4a3 05-Jun-2014 Masahiro Yamada <masahiroy@kernel.org>

kbuild, tools: generate wrapper C sources automatically by Makefile

There are many source files shared between U-boot image and tools.
Instead of adding a lot of dummy wrapper files that just include
the corresponding file in lib/ or common/ directory,
Makefile should automatically generate them.

The original inspiration for this came from
scripts/Makefile.asm-generic of Linux Kernel.

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

# 50827a59 05-May-2014 Ian Campbell <ijc@hellion.org.uk>

sunxi: non-FEL SPL boot support for sun7i

Add support for booting from an MMC card.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Henrik Nordström <henrik@henriknordstrom.net>
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Reviewed-by: Marek Vasut <marex@denx.de>
Cc: Tom Cubie <Mr.hipboi@gmail.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 29a23f9d 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit_check_sign: verify a signed fit image

add host tool "fit_check_sign" which verifies, if a fit image is
signed correct.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>

# 6bf4ca07 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit: add fit_info host command

add fit_info command to the host tools. This command prints
the name, offset and the len from a property from a node in
a fit file. This info can be used to extract a properties
data with linux tools, for example "dd".

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 8fac9c7b 04-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

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>

# 79fc0c5f 04-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

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>

# 940db16d 04-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

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>

# 84977e44 13-Jan-2014 Masahiro Yamada <masahiroy@kernel.org>

.gitignore: ignore u-boot.elf and tools/relocate-rela

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

# 475c506d 06-Dec-2013 Masahiro Yamada <masahiroy@kernel.org>

Makefile, .gitignore: Cleanup non-existing binaries

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

# a804b5ce 01-Dec-2013 Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>

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>

# 6c887b2a 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add proftool to decode profile data

This tool provides the facility to decode U-Boot trace data and write out
a text file in Linux ftrace format for use with pytimechart.

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

# 30ff8918 06-Oct-2012 Marek Vasut <marex@denx.de>

kerneldoc: Implant DocBook from Linux kernel

Pull slightly modified version of Documentation/DocBook, the related perl
script scripts/kernel-doc and the scripts/docproc.c from Linux kernel and
implant it into U-Boot. This will allow smooth generation of kerneldoc
style documentation.

It was necessary to modify the DocBook/Makefile to work with U-Boot build
system. The changes were only minor though and involved replacing the kbuild
specific parts.

It was also necessary to replace use of variables like KERNEL_VERSION with
U_BOOT_VERSION, strings like Linux kernel with U-Boot Bootloader etc. so
the generated result actually matches.

Finally, it was necessary to adjust docproc.c, since the documentation in
U-Boot is located in doc/DocBook instead of Documentation/DocBook as is in
case of the Linux kernel.

Some parts of the DocBook Makefile are unused, but to allow easier sync with
Linux kernel, these parts are still left in. The targets enabled now are
"htmldocs" "pdfdocs" "psdocs" "xmldocs" and "cleandocs" to remove the results
of documentation build.

Linux scripts/docproc.c:
commit f0f3ca8d967462dafb815412b14ca3339b9817a6
Date: Wed Jun 15 11:53:13 2011 +0200

Linux scripts/kernel-doc:
commit 1b40c1944db445c1de1c47ffd8cd426167f488e8
Date: Sun Aug 12 10:46:15 2012 +0200

Linux Documentation/DocBook:
commit bb8187d35f820671d6dd76700d77a6b55f95e2c5
Date: Thu May 17 19:06:13 2012 -0400

Signed-off-by: Marek Vasut <marex@denx.de>

# 578f35a3 15-Jul-2012 Luka Perkov <uboot@lukaperkov.net>

tools: add kwboot binary to .gitignore file

Signed-off-by: Luka Perkov <uboot@lukaperkov.net>
Acked-by: Prafulla Wadaskar <Prafulla@marvell.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8b425b3f 27-Jul-2012 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

MIPS: fix renaming of inca-swap-bytes to xway-swap-bytes

Fix some remains of the renaming of inca-swap-bytes introduced in

commit 60b74bde9280e85f4423c05a50ecc41de56ad980

MIPS: INCA-IP: rename inca-swap-bytes host tool

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

# ca8a30ec 25-Nov-2011 Mike Frysinger <vapier@gentoo.org>

ignore new mkenvimage tool

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

# f29f7e02 08-Nov-2011 Marek Vasut <marex@denx.de>

iMX28: Add image header generator tool

This tool can now generate proper image for "BootStream" files.

NOTE: This tool now works only for NAND.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>

# 8e0ec82e 14-Aug-2010 Mike Frysinger <vapier@gentoo.org>

tools: update .gitignore

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

# 8204e068 04-Nov-2009 Mike Frysinger <vapier@gentoo.org>

tools: gitignore *.exe binaries

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

# b074a708 04-Apr-2009 Mike Frysinger <vapier@gentoo.org>

tools: add ncb to gitignore

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

# fb8b33c1 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for remaining source files

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

# c0170175 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for fdt targets

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

# 45d6bdff 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Add libfdt/ to the include search path

This change makes the process of symlinking libfdt_internal.h
unnecessary

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

# fba0e3a0 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools: Remove unecessary symlinking of zlib.h

crc32.c uses the zlib.h header in include/u-boot/zlib.h. The symlink
was previously necessary to give U-Boot's version of zlib.h precedence
over the host computer's version of zlib.h.

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

# 0cf4fd3c 10-Sep-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

rename environment.c in env_embedded.c to reflect is functionality

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 31cfe574 14-Jul-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

tools/gitignore: update to all generated files

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 8ea08e5b 29-Apr-2008 Kumar Gala <galak@kernel.crashing.org>

Update .gitignore for zlib.h

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

# 766529fc 14-Mar-2008 Bartlomiej Sieka <tur@semihalf.com>

Add MD5 support to the new uImage format

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 8cf30809 29-Feb-2008 Bartlomiej Sieka <tur@semihalf.com>

[new uImage] Add libfdt support to mkimage

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 1b4aaffe 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

Add .gitignore files

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# c623642d 19-Jun-2023 Tobias Deiminger <tdmg@linutronix.de>

Adjust gitignore for tools/generated/

Tell git that auto-generated C sources are now exclusively expected
under tools/generated/.

Signed-off-by: Tobias Deiminger <tdmg@linutronix.de>

# 30238e99 07-Mar-2023 Roman Kopytin <Roman.Kopytin@kaspersky.com>

tools: add fdt_add_pubkey

Having to use the -K option to mkimage to populate U-Boot's .dtb with the
public key while signing the kernel FIT image is often a little
awkward. In particular, when using a meta-build system such as
bitbake/Yocto, having the tasks of the kernel and U-Boot recipes
intertwined, modifying deployed artifacts and rebuilding U-Boot with
an updated .dtb is quite cumbersome. Also, in some scenarios one may
wish to build U-Boot complete with the public key(s) embedded in the
.dtb without the corresponding private keys being present on the same
build host.

So this adds a simple tool that allows one to disentangle the kernel
and U-Boot builds, by simply copy-pasting just enough of the mkimage
code to allow one to add a public key to a .dtb. When using mkimage,
some of the information is taken from the .its used to build the
kernel (algorithm and key name), so that of course needs to be
supplied on the command line.

Signed-off-by: Roman Kopytin <Roman.Kopytin@kaspersky.com>
Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>

# aeca5194 01-Feb-2023 Simon Glass <sjg@chromium.org>

Drop ubsha1 tool

This seems to have been used by ppc4xx which was removed a while back.
The Kconfig does not exist so it is never built. Drop it.

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

# 486aef08 28-Nov-2022 Max Krummenacher <max.krummenacher@toradex.com>

u-boot-initial-env: rework make target

With LTO enabled the U-Boot initial environment is no longer stored
in an easy accessible section in env/common.o. I.e. the section name
changes from build to build, its content maybe compressed and it is
annotated with additional data.

Drop trying to read the initial env with elf tools from the compiler
specific object file in favour of adding and using a host tool with
the only functionality of printing the initial env to stdout.

See also:
https://lore.kernel.org/all/927b122e-1f62-e790-f5ca-30bae4332c77@foss.st.com/

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bdf98312 07-Apr-2022 Du Huanpeng <dhu@hodcarrier.org>

tools: add boot/ to .gitignore

/tools/boot/ is a build product. Add it to .gitignore

Signed-off-by: Du Huanpeng <dhu@hodcarrier.org>

# 850d27b4 28-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: add mkeficapsule to .gitignore

mkeficapsule is a build product. Add it to .gitignore

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 540a2bce 30-Nov-2020 Stefan Roese <sr@denx.de>

mips: octeon: tools: Add update_octeon_header tool

Add a tool to update or insert an Octeon specific header into the U-Boot
image. This is needed e.g. for booting via SPI NOR, eMMC and NAND.

While working on this, move enum cvmx_board_types_enum and
cvmx_board_type_to_string() to cvmx-bootloader.h and remove the
unreferenced (unsupported) board definition.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# e198bb51 29-Dec-2019 Dario Binacchi <dariobin@libero.it>

tools: .gitignore: add asn1_compiler

Add the tool to the ignore list to prevent being marked as unversioned.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4d90f6cd 27-Oct-2019 Bin Meng <bmeng.cn@gmail.com>

tools: Avoid creating symbolic links for tools/version.h

When building U-Boot host tools for Windows from Microsoft Azure
Pipelines, the following errors were seen:

HOSTCC tools/mkenvimage.o
In file included from tools/mkenvimage.c:25:
./tools/version.h:1:1: error: expected identifier or ‘(’ before ‘.’ token
1 | ../include/version.h
| ^
tools/mkenvimage.c: In function ‘main’:
tools/mkenvimage.c:117:4: warning: implicit declaration of function ‘usage’ [-Wimplicit-function-declaration]
117 | usage(prg);
| ^~~~~
tools/mkenvimage.c:120:35: error: ‘PLAIN_VERSION’ undeclared (first use in this function)
120 | printf("%s version %s\n", prg, PLAIN_VERSION);
| ^~~~~~~~~~~~~
tools/mkenvimage.c:120:35: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [scripts/Makefile.host:114: tools/mkenvimage.o] Error 1

It turns out tools/version.h is a symbolic link and with Windows
default settings it is unsupported hence the actual content of
tools/version.h is not what file include/version.h has, but the
the linked file path, which breaks the build.

To fix this, remove the symbolic links for tools/version.h. Instead
we perform a copy from include/version.h during the build.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 08afd714 18-Aug-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

tools: Add ifwitool to .gitignore

Follow up fix to the commit

56bf4f863075 ("x86: Add ifwitool for Intel Integrated Firmware Image")

in order to ignore created binary.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c78b5cb7 11-Jun-2019 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

tools: add tools/spl_size_limit to ignore list

This tool has just been added but it seems I forgot to add it to
the ignore list. So to prevent the built binary being marked as
unversioned, add it to the ignore list.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 07c098b7 22-Nov-2018 Lukas Auer <lukas.auer@aisec.fraunhofer.de>

tools: .gitignore: add prelink-riscv

Ignore tools/prelink-riscv.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# ac020196 17-Jan-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: provide a tool to convert a binary file to an include

For testing EFI disk management we need an in-memory image of
a disk.

The tool file2include converts a file to a C include. The file
is separated into strings of 8 bytes. Only the non-zero strings
are written to the include. The output format has been designed
to maintain readability.

#define EFI_ST_DISK_IMG { 0x00010000, { \
{0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \
{0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \
{0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \
{0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \
...
{0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \
{0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \
{0, NULL} } }

As the disk image needed for testing contains mostly zeroes a high
compression ratio can be attained.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 15b97f5c 16-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile

The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.

Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.

I also rewrote the Makefile in a cleaner Kbuild style.

The scripts from the upstream have been moved as follows:

lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

The .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.

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

# eab44c93 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Add libfdt related files

Some files are generated during libfdt build. Ignore them.

This was wrongly put in the .gitignore in the root directory before.
Now let's remove entries there and put them in the right place.

Fixes: 34e2c285 ("gitignore: add intermediates from libfdt build")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# d11d3b2f 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Sort in alphabetical order

These are currently out of alphabetical order.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 594b4cc7 27-Feb-2017 Maxime Ripard <maxime.ripard@free-electrons.com>

tools: sunxi: Add spl image builder

This program generates raw SPL images that can be flashed on the NAND with
the ECC and randomizer properly set up.

This has been copied (and tweaked to find the right headers) from the
sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream
repository, commit 1c3a6ca5.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# c25f01a6 25-Nov-2016 oliver@schinagl.nl <oliver@schinagl.nl>

tools: Add tool to add crc8 to a mac address

This patch adds a little tool that takes a generic MAC address and
generates a CRC byte for it. The output is the full MAC address without
any separators, ready written into an EEPROM.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 87c2f76f 22-May-2016 Robert P. J. Day <rpjday@crashcourse.ca>

tools: Add entry for generated tools/bin2header to tools/.gitignore

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

# 01124327 31-Jul-2015 Bin Meng <bmeng.cn@gmail.com>

gitignore: Add defconfig and fdtgrep

Ignore defconfig and tools/fdtgrep.

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

# 9c574877 25-Jul-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

tools: remove mpc86x_clk tool

This is commented out in the Makefile for more than 10 years.
I assume it is proof that this tool is unused.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Pantelis Antoniou <panto@intracom.gr>

# 908ec6e4 24-Nov-2014 Bin Meng <bmeng.cn@gmail.com>

tools: Add ifdtool to .gitignore

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

# bedcf395 24-Oct-2014 Andreas Bießmann <andreas.devel@googlemail.com>

gitignore: ignore atmel pmecc parameter tool

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 7050f0de 06-Jun-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

.gitignore: move *.exe pattern to the top gitignore for Cygwin

GCC on Cygwin generates executables with .exe extension,
for example:
scripts/basic/fixdep.exe
scripts/docproc.exe

To ignore them, *.exe pattern should be moved
from tools/.gitignore to ./.gitignore

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

# ad80c4a3 05-Jun-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild, tools: generate wrapper C sources automatically by Makefile

There are many source files shared between U-boot image and tools.
Instead of adding a lot of dummy wrapper files that just include
the corresponding file in lib/ or common/ directory,
Makefile should automatically generate them.

The original inspiration for this came from
scripts/Makefile.asm-generic of Linux Kernel.

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

# 50827a59 05-May-2014 Ian Campbell <ijc@hellion.org.uk>

sunxi: non-FEL SPL boot support for sun7i

Add support for booting from an MMC card.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Henrik Nordström <henrik@henriknordstrom.net>
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Reviewed-by: Marek Vasut <marex@denx.de>
Cc: Tom Cubie <Mr.hipboi@gmail.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 29a23f9d 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit_check_sign: verify a signed fit image

add host tool "fit_check_sign" which verifies, if a fit image is
signed correct.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>

# 6bf4ca07 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit: add fit_info host command

add fit_info command to the host tools. This command prints
the name, offset and the len from a property from a node in
a fit file. This info can be used to extract a properties
data with linux tools, for example "dd".

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

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

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>

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

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>

# 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>

# 84977e44 13-Jan-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

.gitignore: ignore u-boot.elf and tools/relocate-rela

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

# 475c506d 06-Dec-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

Makefile, .gitignore: Cleanup non-existing binaries

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

# a804b5ce 01-Dec-2013 Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>

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>

# 6c887b2a 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add proftool to decode profile data

This tool provides the facility to decode U-Boot trace data and write out
a text file in Linux ftrace format for use with pytimechart.

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

# 30ff8918 06-Oct-2012 Marek Vasut <marex@denx.de>

kerneldoc: Implant DocBook from Linux kernel

Pull slightly modified version of Documentation/DocBook, the related perl
script scripts/kernel-doc and the scripts/docproc.c from Linux kernel and
implant it into U-Boot. This will allow smooth generation of kerneldoc
style documentation.

It was necessary to modify the DocBook/Makefile to work with U-Boot build
system. The changes were only minor though and involved replacing the kbuild
specific parts.

It was also necessary to replace use of variables like KERNEL_VERSION with
U_BOOT_VERSION, strings like Linux kernel with U-Boot Bootloader etc. so
the generated result actually matches.

Finally, it was necessary to adjust docproc.c, since the documentation in
U-Boot is located in doc/DocBook instead of Documentation/DocBook as is in
case of the Linux kernel.

Some parts of the DocBook Makefile are unused, but to allow easier sync with
Linux kernel, these parts are still left in. The targets enabled now are
"htmldocs" "pdfdocs" "psdocs" "xmldocs" and "cleandocs" to remove the results
of documentation build.

Linux scripts/docproc.c:
commit f0f3ca8d967462dafb815412b14ca3339b9817a6
Date: Wed Jun 15 11:53:13 2011 +0200

Linux scripts/kernel-doc:
commit 1b40c1944db445c1de1c47ffd8cd426167f488e8
Date: Sun Aug 12 10:46:15 2012 +0200

Linux Documentation/DocBook:
commit bb8187d35f820671d6dd76700d77a6b55f95e2c5
Date: Thu May 17 19:06:13 2012 -0400

Signed-off-by: Marek Vasut <marex@denx.de>

# 578f35a3 15-Jul-2012 Luka Perkov <uboot@lukaperkov.net>

tools: add kwboot binary to .gitignore file

Signed-off-by: Luka Perkov <uboot@lukaperkov.net>
Acked-by: Prafulla Wadaskar <Prafulla@marvell.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8b425b3f 27-Jul-2012 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

MIPS: fix renaming of inca-swap-bytes to xway-swap-bytes

Fix some remains of the renaming of inca-swap-bytes introduced in

commit 60b74bde9280e85f4423c05a50ecc41de56ad980

MIPS: INCA-IP: rename inca-swap-bytes host tool

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

# ca8a30ec 25-Nov-2011 Mike Frysinger <vapier@gentoo.org>

ignore new mkenvimage tool

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

# f29f7e02 08-Nov-2011 Marek Vasut <marex@denx.de>

iMX28: Add image header generator tool

This tool can now generate proper image for "BootStream" files.

NOTE: This tool now works only for NAND.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>

# 8e0ec82e 14-Aug-2010 Mike Frysinger <vapier@gentoo.org>

tools: update .gitignore

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

# 8204e068 04-Nov-2009 Mike Frysinger <vapier@gentoo.org>

tools: gitignore *.exe binaries

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

# b074a708 04-Apr-2009 Mike Frysinger <vapier@gentoo.org>

tools: add ncb to gitignore

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

# fb8b33c1 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for remaining source files

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

# c0170175 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for fdt targets

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

# 45d6bdff 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Add libfdt/ to the include search path

This change makes the process of symlinking libfdt_internal.h
unnecessary

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

# fba0e3a0 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools: Remove unecessary symlinking of zlib.h

crc32.c uses the zlib.h header in include/u-boot/zlib.h. The symlink
was previously necessary to give U-Boot's version of zlib.h precedence
over the host computer's version of zlib.h.

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

# 0cf4fd3c 10-Sep-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

rename environment.c in env_embedded.c to reflect is functionality

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 31cfe574 14-Jul-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

tools/gitignore: update to all generated files

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 8ea08e5b 29-Apr-2008 Kumar Gala <galak@kernel.crashing.org>

Update .gitignore for zlib.h

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

# 766529fc 14-Mar-2008 Bartlomiej Sieka <tur@semihalf.com>

Add MD5 support to the new uImage format

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 8cf30809 29-Feb-2008 Bartlomiej Sieka <tur@semihalf.com>

[new uImage] Add libfdt support to mkimage

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 1b4aaffe 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

Add .gitignore files

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# 30238e99 07-Mar-2023 Roman Kopytin <Roman.Kopytin@kaspersky.com>

tools: add fdt_add_pubkey

Having to use the -K option to mkimage to populate U-Boot's .dtb with the
public key while signing the kernel FIT image is often a little
awkward. In particular, when using a meta-build system such as
bitbake/Yocto, having the tasks of the kernel and U-Boot recipes
intertwined, modifying deployed artifacts and rebuilding U-Boot with
an updated .dtb is quite cumbersome. Also, in some scenarios one may
wish to build U-Boot complete with the public key(s) embedded in the
.dtb without the corresponding private keys being present on the same
build host.

So this adds a simple tool that allows one to disentangle the kernel
and U-Boot builds, by simply copy-pasting just enough of the mkimage
code to allow one to add a public key to a .dtb. When using mkimage,
some of the information is taken from the .its used to build the
kernel (algorithm and key name), so that of course needs to be
supplied on the command line.

Signed-off-by: Roman Kopytin <Roman.Kopytin@kaspersky.com>
Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>

# aeca5194 01-Feb-2023 Simon Glass <sjg@chromium.org>

Drop ubsha1 tool

This seems to have been used by ppc4xx which was removed a while back.
The Kconfig does not exist so it is never built. Drop it.

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

# 486aef08 28-Nov-2022 Max Krummenacher <max.krummenacher@toradex.com>

u-boot-initial-env: rework make target

With LTO enabled the U-Boot initial environment is no longer stored
in an easy accessible section in env/common.o. I.e. the section name
changes from build to build, its content maybe compressed and it is
annotated with additional data.

Drop trying to read the initial env with elf tools from the compiler
specific object file in favour of adding and using a host tool with
the only functionality of printing the initial env to stdout.

See also:
https://lore.kernel.org/all/927b122e-1f62-e790-f5ca-30bae4332c77@foss.st.com/

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bdf98312 07-Apr-2022 Du Huanpeng <dhu@hodcarrier.org>

tools: add boot/ to .gitignore

/tools/boot/ is a build product. Add it to .gitignore

Signed-off-by: Du Huanpeng <dhu@hodcarrier.org>

# 850d27b4 28-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: add mkeficapsule to .gitignore

mkeficapsule is a build product. Add it to .gitignore

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 540a2bce 30-Nov-2020 Stefan Roese <sr@denx.de>

mips: octeon: tools: Add update_octeon_header tool

Add a tool to update or insert an Octeon specific header into the U-Boot
image. This is needed e.g. for booting via SPI NOR, eMMC and NAND.

While working on this, move enum cvmx_board_types_enum and
cvmx_board_type_to_string() to cvmx-bootloader.h and remove the
unreferenced (unsupported) board definition.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# e198bb51 29-Dec-2019 Dario Binacchi <dariobin@libero.it>

tools: .gitignore: add asn1_compiler

Add the tool to the ignore list to prevent being marked as unversioned.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4d90f6cd 27-Oct-2019 Bin Meng <bmeng.cn@gmail.com>

tools: Avoid creating symbolic links for tools/version.h

When building U-Boot host tools for Windows from Microsoft Azure
Pipelines, the following errors were seen:

HOSTCC tools/mkenvimage.o
In file included from tools/mkenvimage.c:25:
./tools/version.h:1:1: error: expected identifier or ‘(’ before ‘.’ token
1 | ../include/version.h
| ^
tools/mkenvimage.c: In function ‘main’:
tools/mkenvimage.c:117:4: warning: implicit declaration of function ‘usage’ [-Wimplicit-function-declaration]
117 | usage(prg);
| ^~~~~
tools/mkenvimage.c:120:35: error: ‘PLAIN_VERSION’ undeclared (first use in this function)
120 | printf("%s version %s\n", prg, PLAIN_VERSION);
| ^~~~~~~~~~~~~
tools/mkenvimage.c:120:35: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [scripts/Makefile.host:114: tools/mkenvimage.o] Error 1

It turns out tools/version.h is a symbolic link and with Windows
default settings it is unsupported hence the actual content of
tools/version.h is not what file include/version.h has, but the
the linked file path, which breaks the build.

To fix this, remove the symbolic links for tools/version.h. Instead
we perform a copy from include/version.h during the build.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 08afd714 18-Aug-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

tools: Add ifwitool to .gitignore

Follow up fix to the commit

56bf4f863075 ("x86: Add ifwitool for Intel Integrated Firmware Image")

in order to ignore created binary.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c78b5cb7 11-Jun-2019 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

tools: add tools/spl_size_limit to ignore list

This tool has just been added but it seems I forgot to add it to
the ignore list. So to prevent the built binary being marked as
unversioned, add it to the ignore list.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 07c098b7 22-Nov-2018 Lukas Auer <lukas.auer@aisec.fraunhofer.de>

tools: .gitignore: add prelink-riscv

Ignore tools/prelink-riscv.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# ac020196 17-Jan-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: provide a tool to convert a binary file to an include

For testing EFI disk management we need an in-memory image of
a disk.

The tool file2include converts a file to a C include. The file
is separated into strings of 8 bytes. Only the non-zero strings
are written to the include. The output format has been designed
to maintain readability.

#define EFI_ST_DISK_IMG { 0x00010000, { \
{0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \
{0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \
{0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \
{0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \
...
{0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \
{0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \
{0, NULL} } }

As the disk image needed for testing contains mostly zeroes a high
compression ratio can be attained.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 15b97f5c 16-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile

The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.

Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.

I also rewrote the Makefile in a cleaner Kbuild style.

The scripts from the upstream have been moved as follows:

lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

The .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.

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

# eab44c93 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Add libfdt related files

Some files are generated during libfdt build. Ignore them.

This was wrongly put in the .gitignore in the root directory before.
Now let's remove entries there and put them in the right place.

Fixes: 34e2c285 ("gitignore: add intermediates from libfdt build")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# d11d3b2f 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Sort in alphabetical order

These are currently out of alphabetical order.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 594b4cc7 27-Feb-2017 Maxime Ripard <maxime.ripard@free-electrons.com>

tools: sunxi: Add spl image builder

This program generates raw SPL images that can be flashed on the NAND with
the ECC and randomizer properly set up.

This has been copied (and tweaked to find the right headers) from the
sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream
repository, commit 1c3a6ca5.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# c25f01a6 25-Nov-2016 oliver@schinagl.nl <oliver@schinagl.nl>

tools: Add tool to add crc8 to a mac address

This patch adds a little tool that takes a generic MAC address and
generates a CRC byte for it. The output is the full MAC address without
any separators, ready written into an EEPROM.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 87c2f76f 22-May-2016 Robert P. J. Day <rpjday@crashcourse.ca>

tools: Add entry for generated tools/bin2header to tools/.gitignore

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

# 01124327 31-Jul-2015 Bin Meng <bmeng.cn@gmail.com>

gitignore: Add defconfig and fdtgrep

Ignore defconfig and tools/fdtgrep.

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

# 9c574877 25-Jul-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

tools: remove mpc86x_clk tool

This is commented out in the Makefile for more than 10 years.
I assume it is proof that this tool is unused.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Pantelis Antoniou <panto@intracom.gr>

# 908ec6e4 24-Nov-2014 Bin Meng <bmeng.cn@gmail.com>

tools: Add ifdtool to .gitignore

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

# bedcf395 24-Oct-2014 Andreas Bießmann <andreas.devel@googlemail.com>

gitignore: ignore atmel pmecc parameter tool

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 7050f0de 06-Jun-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

.gitignore: move *.exe pattern to the top gitignore for Cygwin

GCC on Cygwin generates executables with .exe extension,
for example:
scripts/basic/fixdep.exe
scripts/docproc.exe

To ignore them, *.exe pattern should be moved
from tools/.gitignore to ./.gitignore

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

# ad80c4a3 05-Jun-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild, tools: generate wrapper C sources automatically by Makefile

There are many source files shared between U-boot image and tools.
Instead of adding a lot of dummy wrapper files that just include
the corresponding file in lib/ or common/ directory,
Makefile should automatically generate them.

The original inspiration for this came from
scripts/Makefile.asm-generic of Linux Kernel.

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

# 50827a59 05-May-2014 Ian Campbell <ijc@hellion.org.uk>

sunxi: non-FEL SPL boot support for sun7i

Add support for booting from an MMC card.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Henrik Nordström <henrik@henriknordstrom.net>
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Reviewed-by: Marek Vasut <marex@denx.de>
Cc: Tom Cubie <Mr.hipboi@gmail.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 29a23f9d 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit_check_sign: verify a signed fit image

add host tool "fit_check_sign" which verifies, if a fit image is
signed correct.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>

# 6bf4ca07 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit: add fit_info host command

add fit_info command to the host tools. This command prints
the name, offset and the len from a property from a node in
a fit file. This info can be used to extract a properties
data with linux tools, for example "dd".

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

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

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>

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

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>

# 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>

# 84977e44 13-Jan-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

.gitignore: ignore u-boot.elf and tools/relocate-rela

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

# 475c506d 06-Dec-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

Makefile, .gitignore: Cleanup non-existing binaries

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

# a804b5ce 01-Dec-2013 Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>

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>

# 6c887b2a 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add proftool to decode profile data

This tool provides the facility to decode U-Boot trace data and write out
a text file in Linux ftrace format for use with pytimechart.

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

# 30ff8918 06-Oct-2012 Marek Vasut <marex@denx.de>

kerneldoc: Implant DocBook from Linux kernel

Pull slightly modified version of Documentation/DocBook, the related perl
script scripts/kernel-doc and the scripts/docproc.c from Linux kernel and
implant it into U-Boot. This will allow smooth generation of kerneldoc
style documentation.

It was necessary to modify the DocBook/Makefile to work with U-Boot build
system. The changes were only minor though and involved replacing the kbuild
specific parts.

It was also necessary to replace use of variables like KERNEL_VERSION with
U_BOOT_VERSION, strings like Linux kernel with U-Boot Bootloader etc. so
the generated result actually matches.

Finally, it was necessary to adjust docproc.c, since the documentation in
U-Boot is located in doc/DocBook instead of Documentation/DocBook as is in
case of the Linux kernel.

Some parts of the DocBook Makefile are unused, but to allow easier sync with
Linux kernel, these parts are still left in. The targets enabled now are
"htmldocs" "pdfdocs" "psdocs" "xmldocs" and "cleandocs" to remove the results
of documentation build.

Linux scripts/docproc.c:
commit f0f3ca8d967462dafb815412b14ca3339b9817a6
Date: Wed Jun 15 11:53:13 2011 +0200

Linux scripts/kernel-doc:
commit 1b40c1944db445c1de1c47ffd8cd426167f488e8
Date: Sun Aug 12 10:46:15 2012 +0200

Linux Documentation/DocBook:
commit bb8187d35f820671d6dd76700d77a6b55f95e2c5
Date: Thu May 17 19:06:13 2012 -0400

Signed-off-by: Marek Vasut <marex@denx.de>

# 578f35a3 15-Jul-2012 Luka Perkov <uboot@lukaperkov.net>

tools: add kwboot binary to .gitignore file

Signed-off-by: Luka Perkov <uboot@lukaperkov.net>
Acked-by: Prafulla Wadaskar <Prafulla@marvell.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8b425b3f 27-Jul-2012 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

MIPS: fix renaming of inca-swap-bytes to xway-swap-bytes

Fix some remains of the renaming of inca-swap-bytes introduced in

commit 60b74bde9280e85f4423c05a50ecc41de56ad980

MIPS: INCA-IP: rename inca-swap-bytes host tool

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

# ca8a30ec 25-Nov-2011 Mike Frysinger <vapier@gentoo.org>

ignore new mkenvimage tool

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

# f29f7e02 08-Nov-2011 Marek Vasut <marex@denx.de>

iMX28: Add image header generator tool

This tool can now generate proper image for "BootStream" files.

NOTE: This tool now works only for NAND.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>

# 8e0ec82e 14-Aug-2010 Mike Frysinger <vapier@gentoo.org>

tools: update .gitignore

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

# 8204e068 04-Nov-2009 Mike Frysinger <vapier@gentoo.org>

tools: gitignore *.exe binaries

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

# b074a708 04-Apr-2009 Mike Frysinger <vapier@gentoo.org>

tools: add ncb to gitignore

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

# fb8b33c1 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for remaining source files

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

# c0170175 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for fdt targets

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

# 45d6bdff 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Add libfdt/ to the include search path

This change makes the process of symlinking libfdt_internal.h
unnecessary

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

# fba0e3a0 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools: Remove unecessary symlinking of zlib.h

crc32.c uses the zlib.h header in include/u-boot/zlib.h. The symlink
was previously necessary to give U-Boot's version of zlib.h precedence
over the host computer's version of zlib.h.

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

# 0cf4fd3c 10-Sep-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

rename environment.c in env_embedded.c to reflect is functionality

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 31cfe574 14-Jul-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

tools/gitignore: update to all generated files

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 8ea08e5b 29-Apr-2008 Kumar Gala <galak@kernel.crashing.org>

Update .gitignore for zlib.h

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

# 766529fc 14-Mar-2008 Bartlomiej Sieka <tur@semihalf.com>

Add MD5 support to the new uImage format

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 8cf30809 29-Feb-2008 Bartlomiej Sieka <tur@semihalf.com>

[new uImage] Add libfdt support to mkimage

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 1b4aaffe 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

Add .gitignore files

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# aeca5194 01-Feb-2023 Simon Glass <sjg@chromium.org>

Drop ubsha1 tool

This seems to have been used by ppc4xx which was removed a while back.
The Kconfig does not exist so it is never built. Drop it.

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

# 486aef08 28-Nov-2022 Max Krummenacher <max.krummenacher@toradex.com>

u-boot-initial-env: rework make target

With LTO enabled the U-Boot initial environment is no longer stored
in an easy accessible section in env/common.o. I.e. the section name
changes from build to build, its content maybe compressed and it is
annotated with additional data.

Drop trying to read the initial env with elf tools from the compiler
specific object file in favour of adding and using a host tool with
the only functionality of printing the initial env to stdout.

See also:
https://lore.kernel.org/all/927b122e-1f62-e790-f5ca-30bae4332c77@foss.st.com/

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bdf98312 07-Apr-2022 Du Huanpeng <dhu@hodcarrier.org>

tools: add boot/ to .gitignore

/tools/boot/ is a build product. Add it to .gitignore

Signed-off-by: Du Huanpeng <dhu@hodcarrier.org>

# 850d27b4 28-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: add mkeficapsule to .gitignore

mkeficapsule is a build product. Add it to .gitignore

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 540a2bce 30-Nov-2020 Stefan Roese <sr@denx.de>

mips: octeon: tools: Add update_octeon_header tool

Add a tool to update or insert an Octeon specific header into the U-Boot
image. This is needed e.g. for booting via SPI NOR, eMMC and NAND.

While working on this, move enum cvmx_board_types_enum and
cvmx_board_type_to_string() to cvmx-bootloader.h and remove the
unreferenced (unsupported) board definition.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# e198bb51 29-Dec-2019 Dario Binacchi <dariobin@libero.it>

tools: .gitignore: add asn1_compiler

Add the tool to the ignore list to prevent being marked as unversioned.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4d90f6cd 27-Oct-2019 Bin Meng <bmeng.cn@gmail.com>

tools: Avoid creating symbolic links for tools/version.h

When building U-Boot host tools for Windows from Microsoft Azure
Pipelines, the following errors were seen:

HOSTCC tools/mkenvimage.o
In file included from tools/mkenvimage.c:25:
./tools/version.h:1:1: error: expected identifier or ‘(’ before ‘.’ token
1 | ../include/version.h
| ^
tools/mkenvimage.c: In function ‘main’:
tools/mkenvimage.c:117:4: warning: implicit declaration of function ‘usage’ [-Wimplicit-function-declaration]
117 | usage(prg);
| ^~~~~
tools/mkenvimage.c:120:35: error: ‘PLAIN_VERSION’ undeclared (first use in this function)
120 | printf("%s version %s\n", prg, PLAIN_VERSION);
| ^~~~~~~~~~~~~
tools/mkenvimage.c:120:35: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [scripts/Makefile.host:114: tools/mkenvimage.o] Error 1

It turns out tools/version.h is a symbolic link and with Windows
default settings it is unsupported hence the actual content of
tools/version.h is not what file include/version.h has, but the
the linked file path, which breaks the build.

To fix this, remove the symbolic links for tools/version.h. Instead
we perform a copy from include/version.h during the build.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 08afd714 18-Aug-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

tools: Add ifwitool to .gitignore

Follow up fix to the commit

56bf4f863075 ("x86: Add ifwitool for Intel Integrated Firmware Image")

in order to ignore created binary.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c78b5cb7 11-Jun-2019 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

tools: add tools/spl_size_limit to ignore list

This tool has just been added but it seems I forgot to add it to
the ignore list. So to prevent the built binary being marked as
unversioned, add it to the ignore list.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 07c098b7 22-Nov-2018 Lukas Auer <lukas.auer@aisec.fraunhofer.de>

tools: .gitignore: add prelink-riscv

Ignore tools/prelink-riscv.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# ac020196 17-Jan-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: provide a tool to convert a binary file to an include

For testing EFI disk management we need an in-memory image of
a disk.

The tool file2include converts a file to a C include. The file
is separated into strings of 8 bytes. Only the non-zero strings
are written to the include. The output format has been designed
to maintain readability.

#define EFI_ST_DISK_IMG { 0x00010000, { \
{0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \
{0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \
{0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \
{0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \
...
{0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \
{0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \
{0, NULL} } }

As the disk image needed for testing contains mostly zeroes a high
compression ratio can be attained.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 15b97f5c 16-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile

The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.

Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.

I also rewrote the Makefile in a cleaner Kbuild style.

The scripts from the upstream have been moved as follows:

lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

The .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.

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

# eab44c93 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Add libfdt related files

Some files are generated during libfdt build. Ignore them.

This was wrongly put in the .gitignore in the root directory before.
Now let's remove entries there and put them in the right place.

Fixes: 34e2c285 ("gitignore: add intermediates from libfdt build")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# d11d3b2f 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Sort in alphabetical order

These are currently out of alphabetical order.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 594b4cc7 27-Feb-2017 Maxime Ripard <maxime.ripard@free-electrons.com>

tools: sunxi: Add spl image builder

This program generates raw SPL images that can be flashed on the NAND with
the ECC and randomizer properly set up.

This has been copied (and tweaked to find the right headers) from the
sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream
repository, commit 1c3a6ca5.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# c25f01a6 25-Nov-2016 oliver@schinagl.nl <oliver@schinagl.nl>

tools: Add tool to add crc8 to a mac address

This patch adds a little tool that takes a generic MAC address and
generates a CRC byte for it. The output is the full MAC address without
any separators, ready written into an EEPROM.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 87c2f76f 22-May-2016 Robert P. J. Day <rpjday@crashcourse.ca>

tools: Add entry for generated tools/bin2header to tools/.gitignore

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

# 01124327 31-Jul-2015 Bin Meng <bmeng.cn@gmail.com>

gitignore: Add defconfig and fdtgrep

Ignore defconfig and tools/fdtgrep.

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

# 9c574877 25-Jul-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

tools: remove mpc86x_clk tool

This is commented out in the Makefile for more than 10 years.
I assume it is proof that this tool is unused.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Pantelis Antoniou <panto@intracom.gr>

# 908ec6e4 24-Nov-2014 Bin Meng <bmeng.cn@gmail.com>

tools: Add ifdtool to .gitignore

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

# bedcf395 24-Oct-2014 Andreas Bießmann <andreas.devel@googlemail.com>

gitignore: ignore atmel pmecc parameter tool

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 7050f0de 06-Jun-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

.gitignore: move *.exe pattern to the top gitignore for Cygwin

GCC on Cygwin generates executables with .exe extension,
for example:
scripts/basic/fixdep.exe
scripts/docproc.exe

To ignore them, *.exe pattern should be moved
from tools/.gitignore to ./.gitignore

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

# ad80c4a3 05-Jun-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild, tools: generate wrapper C sources automatically by Makefile

There are many source files shared between U-boot image and tools.
Instead of adding a lot of dummy wrapper files that just include
the corresponding file in lib/ or common/ directory,
Makefile should automatically generate them.

The original inspiration for this came from
scripts/Makefile.asm-generic of Linux Kernel.

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

# 50827a59 05-May-2014 Ian Campbell <ijc@hellion.org.uk>

sunxi: non-FEL SPL boot support for sun7i

Add support for booting from an MMC card.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Henrik Nordström <henrik@henriknordstrom.net>
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Reviewed-by: Marek Vasut <marex@denx.de>
Cc: Tom Cubie <Mr.hipboi@gmail.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 29a23f9d 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit_check_sign: verify a signed fit image

add host tool "fit_check_sign" which verifies, if a fit image is
signed correct.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>

# 6bf4ca07 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit: add fit_info host command

add fit_info command to the host tools. This command prints
the name, offset and the len from a property from a node in
a fit file. This info can be used to extract a properties
data with linux tools, for example "dd".

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

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

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>

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

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>

# 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>

# 84977e44 13-Jan-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

.gitignore: ignore u-boot.elf and tools/relocate-rela

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

# 475c506d 06-Dec-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

Makefile, .gitignore: Cleanup non-existing binaries

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

# a804b5ce 01-Dec-2013 Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>

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>

# 6c887b2a 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add proftool to decode profile data

This tool provides the facility to decode U-Boot trace data and write out
a text file in Linux ftrace format for use with pytimechart.

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

# 30ff8918 06-Oct-2012 Marek Vasut <marex@denx.de>

kerneldoc: Implant DocBook from Linux kernel

Pull slightly modified version of Documentation/DocBook, the related perl
script scripts/kernel-doc and the scripts/docproc.c from Linux kernel and
implant it into U-Boot. This will allow smooth generation of kerneldoc
style documentation.

It was necessary to modify the DocBook/Makefile to work with U-Boot build
system. The changes were only minor though and involved replacing the kbuild
specific parts.

It was also necessary to replace use of variables like KERNEL_VERSION with
U_BOOT_VERSION, strings like Linux kernel with U-Boot Bootloader etc. so
the generated result actually matches.

Finally, it was necessary to adjust docproc.c, since the documentation in
U-Boot is located in doc/DocBook instead of Documentation/DocBook as is in
case of the Linux kernel.

Some parts of the DocBook Makefile are unused, but to allow easier sync with
Linux kernel, these parts are still left in. The targets enabled now are
"htmldocs" "pdfdocs" "psdocs" "xmldocs" and "cleandocs" to remove the results
of documentation build.

Linux scripts/docproc.c:
commit f0f3ca8d967462dafb815412b14ca3339b9817a6
Date: Wed Jun 15 11:53:13 2011 +0200

Linux scripts/kernel-doc:
commit 1b40c1944db445c1de1c47ffd8cd426167f488e8
Date: Sun Aug 12 10:46:15 2012 +0200

Linux Documentation/DocBook:
commit bb8187d35f820671d6dd76700d77a6b55f95e2c5
Date: Thu May 17 19:06:13 2012 -0400

Signed-off-by: Marek Vasut <marex@denx.de>

# 578f35a3 15-Jul-2012 Luka Perkov <uboot@lukaperkov.net>

tools: add kwboot binary to .gitignore file

Signed-off-by: Luka Perkov <uboot@lukaperkov.net>
Acked-by: Prafulla Wadaskar <Prafulla@marvell.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8b425b3f 27-Jul-2012 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

MIPS: fix renaming of inca-swap-bytes to xway-swap-bytes

Fix some remains of the renaming of inca-swap-bytes introduced in

commit 60b74bde9280e85f4423c05a50ecc41de56ad980

MIPS: INCA-IP: rename inca-swap-bytes host tool

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

# ca8a30ec 25-Nov-2011 Mike Frysinger <vapier@gentoo.org>

ignore new mkenvimage tool

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

# f29f7e02 08-Nov-2011 Marek Vasut <marex@denx.de>

iMX28: Add image header generator tool

This tool can now generate proper image for "BootStream" files.

NOTE: This tool now works only for NAND.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>

# 8e0ec82e 14-Aug-2010 Mike Frysinger <vapier@gentoo.org>

tools: update .gitignore

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

# 8204e068 04-Nov-2009 Mike Frysinger <vapier@gentoo.org>

tools: gitignore *.exe binaries

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

# b074a708 04-Apr-2009 Mike Frysinger <vapier@gentoo.org>

tools: add ncb to gitignore

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

# fb8b33c1 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for remaining source files

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

# c0170175 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for fdt targets

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

# 45d6bdff 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Add libfdt/ to the include search path

This change makes the process of symlinking libfdt_internal.h
unnecessary

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

# fba0e3a0 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools: Remove unecessary symlinking of zlib.h

crc32.c uses the zlib.h header in include/u-boot/zlib.h. The symlink
was previously necessary to give U-Boot's version of zlib.h precedence
over the host computer's version of zlib.h.

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

# 0cf4fd3c 10-Sep-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

rename environment.c in env_embedded.c to reflect is functionality

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 31cfe574 14-Jul-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

tools/gitignore: update to all generated files

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 8ea08e5b 29-Apr-2008 Kumar Gala <galak@kernel.crashing.org>

Update .gitignore for zlib.h

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

# 766529fc 14-Mar-2008 Bartlomiej Sieka <tur@semihalf.com>

Add MD5 support to the new uImage format

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 8cf30809 29-Feb-2008 Bartlomiej Sieka <tur@semihalf.com>

[new uImage] Add libfdt support to mkimage

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 1b4aaffe 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

Add .gitignore files

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# 486aef08 28-Nov-2022 Max Krummenacher <max.krummenacher@toradex.com>

u-boot-initial-env: rework make target

With LTO enabled the U-Boot initial environment is no longer stored
in an easy accessible section in env/common.o. I.e. the section name
changes from build to build, its content maybe compressed and it is
annotated with additional data.

Drop trying to read the initial env with elf tools from the compiler
specific object file in favour of adding and using a host tool with
the only functionality of printing the initial env to stdout.

See also:
https://lore.kernel.org/all/927b122e-1f62-e790-f5ca-30bae4332c77@foss.st.com/

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bdf98312 07-Apr-2022 Du Huanpeng <dhu@hodcarrier.org>

tools: add boot/ to .gitignore

/tools/boot/ is a build product. Add it to .gitignore

Signed-off-by: Du Huanpeng <dhu@hodcarrier.org>

# 850d27b4 28-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: add mkeficapsule to .gitignore

mkeficapsule is a build product. Add it to .gitignore

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 540a2bce 30-Nov-2020 Stefan Roese <sr@denx.de>

mips: octeon: tools: Add update_octeon_header tool

Add a tool to update or insert an Octeon specific header into the U-Boot
image. This is needed e.g. for booting via SPI NOR, eMMC and NAND.

While working on this, move enum cvmx_board_types_enum and
cvmx_board_type_to_string() to cvmx-bootloader.h and remove the
unreferenced (unsupported) board definition.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# e198bb51 29-Dec-2019 Dario Binacchi <dariobin@libero.it>

tools: .gitignore: add asn1_compiler

Add the tool to the ignore list to prevent being marked as unversioned.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4d90f6cd 27-Oct-2019 Bin Meng <bmeng.cn@gmail.com>

tools: Avoid creating symbolic links for tools/version.h

When building U-Boot host tools for Windows from Microsoft Azure
Pipelines, the following errors were seen:

HOSTCC tools/mkenvimage.o
In file included from tools/mkenvimage.c:25:
./tools/version.h:1:1: error: expected identifier or ‘(’ before ‘.’ token
1 | ../include/version.h
| ^
tools/mkenvimage.c: In function ‘main’:
tools/mkenvimage.c:117:4: warning: implicit declaration of function ‘usage’ [-Wimplicit-function-declaration]
117 | usage(prg);
| ^~~~~
tools/mkenvimage.c:120:35: error: ‘PLAIN_VERSION’ undeclared (first use in this function)
120 | printf("%s version %s\n", prg, PLAIN_VERSION);
| ^~~~~~~~~~~~~
tools/mkenvimage.c:120:35: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [scripts/Makefile.host:114: tools/mkenvimage.o] Error 1

It turns out tools/version.h is a symbolic link and with Windows
default settings it is unsupported hence the actual content of
tools/version.h is not what file include/version.h has, but the
the linked file path, which breaks the build.

To fix this, remove the symbolic links for tools/version.h. Instead
we perform a copy from include/version.h during the build.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 08afd714 18-Aug-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

tools: Add ifwitool to .gitignore

Follow up fix to the commit

56bf4f863075 ("x86: Add ifwitool for Intel Integrated Firmware Image")

in order to ignore created binary.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c78b5cb7 11-Jun-2019 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

tools: add tools/spl_size_limit to ignore list

This tool has just been added but it seems I forgot to add it to
the ignore list. So to prevent the built binary being marked as
unversioned, add it to the ignore list.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 07c098b7 22-Nov-2018 Lukas Auer <lukas.auer@aisec.fraunhofer.de>

tools: .gitignore: add prelink-riscv

Ignore tools/prelink-riscv.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# ac020196 17-Jan-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: provide a tool to convert a binary file to an include

For testing EFI disk management we need an in-memory image of
a disk.

The tool file2include converts a file to a C include. The file
is separated into strings of 8 bytes. Only the non-zero strings
are written to the include. The output format has been designed
to maintain readability.

#define EFI_ST_DISK_IMG { 0x00010000, { \
{0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \
{0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \
{0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \
{0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \
...
{0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \
{0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \
{0, NULL} } }

As the disk image needed for testing contains mostly zeroes a high
compression ratio can be attained.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 15b97f5c 16-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile

The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.

Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.

I also rewrote the Makefile in a cleaner Kbuild style.

The scripts from the upstream have been moved as follows:

lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

The .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.

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

# eab44c93 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Add libfdt related files

Some files are generated during libfdt build. Ignore them.

This was wrongly put in the .gitignore in the root directory before.
Now let's remove entries there and put them in the right place.

Fixes: 34e2c285 ("gitignore: add intermediates from libfdt build")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# d11d3b2f 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Sort in alphabetical order

These are currently out of alphabetical order.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 594b4cc7 27-Feb-2017 Maxime Ripard <maxime.ripard@free-electrons.com>

tools: sunxi: Add spl image builder

This program generates raw SPL images that can be flashed on the NAND with
the ECC and randomizer properly set up.

This has been copied (and tweaked to find the right headers) from the
sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream
repository, commit 1c3a6ca5.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# c25f01a6 25-Nov-2016 oliver@schinagl.nl <oliver@schinagl.nl>

tools: Add tool to add crc8 to a mac address

This patch adds a little tool that takes a generic MAC address and
generates a CRC byte for it. The output is the full MAC address without
any separators, ready written into an EEPROM.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 87c2f76f 22-May-2016 Robert P. J. Day <rpjday@crashcourse.ca>

tools: Add entry for generated tools/bin2header to tools/.gitignore

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

# 01124327 31-Jul-2015 Bin Meng <bmeng.cn@gmail.com>

gitignore: Add defconfig and fdtgrep

Ignore defconfig and tools/fdtgrep.

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

# 9c574877 25-Jul-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

tools: remove mpc86x_clk tool

This is commented out in the Makefile for more than 10 years.
I assume it is proof that this tool is unused.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Pantelis Antoniou <panto@intracom.gr>

# 908ec6e4 24-Nov-2014 Bin Meng <bmeng.cn@gmail.com>

tools: Add ifdtool to .gitignore

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

# bedcf395 24-Oct-2014 Andreas Bießmann <andreas.devel@googlemail.com>

gitignore: ignore atmel pmecc parameter tool

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 7050f0de 06-Jun-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

.gitignore: move *.exe pattern to the top gitignore for Cygwin

GCC on Cygwin generates executables with .exe extension,
for example:
scripts/basic/fixdep.exe
scripts/docproc.exe

To ignore them, *.exe pattern should be moved
from tools/.gitignore to ./.gitignore

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

# ad80c4a3 05-Jun-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild, tools: generate wrapper C sources automatically by Makefile

There are many source files shared between U-boot image and tools.
Instead of adding a lot of dummy wrapper files that just include
the corresponding file in lib/ or common/ directory,
Makefile should automatically generate them.

The original inspiration for this came from
scripts/Makefile.asm-generic of Linux Kernel.

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

# 50827a59 05-May-2014 Ian Campbell <ijc@hellion.org.uk>

sunxi: non-FEL SPL boot support for sun7i

Add support for booting from an MMC card.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Henrik Nordström <henrik@henriknordstrom.net>
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Reviewed-by: Marek Vasut <marex@denx.de>
Cc: Tom Cubie <Mr.hipboi@gmail.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 29a23f9d 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit_check_sign: verify a signed fit image

add host tool "fit_check_sign" which verifies, if a fit image is
signed correct.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>

# 6bf4ca07 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit: add fit_info host command

add fit_info command to the host tools. This command prints
the name, offset and the len from a property from a node in
a fit file. This info can be used to extract a properties
data with linux tools, for example "dd".

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

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

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>

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

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>

# 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>

# 84977e44 13-Jan-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

.gitignore: ignore u-boot.elf and tools/relocate-rela

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

# 475c506d 06-Dec-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

Makefile, .gitignore: Cleanup non-existing binaries

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

# a804b5ce 01-Dec-2013 Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>

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>

# 6c887b2a 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add proftool to decode profile data

This tool provides the facility to decode U-Boot trace data and write out
a text file in Linux ftrace format for use with pytimechart.

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

# 30ff8918 06-Oct-2012 Marek Vasut <marex@denx.de>

kerneldoc: Implant DocBook from Linux kernel

Pull slightly modified version of Documentation/DocBook, the related perl
script scripts/kernel-doc and the scripts/docproc.c from Linux kernel and
implant it into U-Boot. This will allow smooth generation of kerneldoc
style documentation.

It was necessary to modify the DocBook/Makefile to work with U-Boot build
system. The changes were only minor though and involved replacing the kbuild
specific parts.

It was also necessary to replace use of variables like KERNEL_VERSION with
U_BOOT_VERSION, strings like Linux kernel with U-Boot Bootloader etc. so
the generated result actually matches.

Finally, it was necessary to adjust docproc.c, since the documentation in
U-Boot is located in doc/DocBook instead of Documentation/DocBook as is in
case of the Linux kernel.

Some parts of the DocBook Makefile are unused, but to allow easier sync with
Linux kernel, these parts are still left in. The targets enabled now are
"htmldocs" "pdfdocs" "psdocs" "xmldocs" and "cleandocs" to remove the results
of documentation build.

Linux scripts/docproc.c:
commit f0f3ca8d967462dafb815412b14ca3339b9817a6
Date: Wed Jun 15 11:53:13 2011 +0200

Linux scripts/kernel-doc:
commit 1b40c1944db445c1de1c47ffd8cd426167f488e8
Date: Sun Aug 12 10:46:15 2012 +0200

Linux Documentation/DocBook:
commit bb8187d35f820671d6dd76700d77a6b55f95e2c5
Date: Thu May 17 19:06:13 2012 -0400

Signed-off-by: Marek Vasut <marex@denx.de>

# 578f35a3 15-Jul-2012 Luka Perkov <uboot@lukaperkov.net>

tools: add kwboot binary to .gitignore file

Signed-off-by: Luka Perkov <uboot@lukaperkov.net>
Acked-by: Prafulla Wadaskar <Prafulla@marvell.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8b425b3f 27-Jul-2012 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

MIPS: fix renaming of inca-swap-bytes to xway-swap-bytes

Fix some remains of the renaming of inca-swap-bytes introduced in

commit 60b74bde9280e85f4423c05a50ecc41de56ad980

MIPS: INCA-IP: rename inca-swap-bytes host tool

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

# ca8a30ec 25-Nov-2011 Mike Frysinger <vapier@gentoo.org>

ignore new mkenvimage tool

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

# f29f7e02 08-Nov-2011 Marek Vasut <marex@denx.de>

iMX28: Add image header generator tool

This tool can now generate proper image for "BootStream" files.

NOTE: This tool now works only for NAND.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>

# 8e0ec82e 14-Aug-2010 Mike Frysinger <vapier@gentoo.org>

tools: update .gitignore

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

# 8204e068 04-Nov-2009 Mike Frysinger <vapier@gentoo.org>

tools: gitignore *.exe binaries

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

# b074a708 04-Apr-2009 Mike Frysinger <vapier@gentoo.org>

tools: add ncb to gitignore

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

# fb8b33c1 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for remaining source files

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

# c0170175 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for fdt targets

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

# 45d6bdff 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Add libfdt/ to the include search path

This change makes the process of symlinking libfdt_internal.h
unnecessary

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

# fba0e3a0 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools: Remove unecessary symlinking of zlib.h

crc32.c uses the zlib.h header in include/u-boot/zlib.h. The symlink
was previously necessary to give U-Boot's version of zlib.h precedence
over the host computer's version of zlib.h.

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

# 0cf4fd3c 10-Sep-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

rename environment.c in env_embedded.c to reflect is functionality

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 31cfe574 14-Jul-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

tools/gitignore: update to all generated files

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 8ea08e5b 29-Apr-2008 Kumar Gala <galak@kernel.crashing.org>

Update .gitignore for zlib.h

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

# 766529fc 14-Mar-2008 Bartlomiej Sieka <tur@semihalf.com>

Add MD5 support to the new uImage format

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 8cf30809 29-Feb-2008 Bartlomiej Sieka <tur@semihalf.com>

[new uImage] Add libfdt support to mkimage

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 1b4aaffe 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

Add .gitignore files

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# bdf98312 07-Apr-2022 Du Huanpeng <dhu@hodcarrier.org>

tools: add boot/ to .gitignore

/tools/boot/ is a build product. Add it to .gitignore

Signed-off-by: Du Huanpeng <dhu@hodcarrier.org>

# 850d27b4 28-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: add mkeficapsule to .gitignore

mkeficapsule is a build product. Add it to .gitignore

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 540a2bce 30-Nov-2020 Stefan Roese <sr@denx.de>

mips: octeon: tools: Add update_octeon_header tool

Add a tool to update or insert an Octeon specific header into the U-Boot
image. This is needed e.g. for booting via SPI NOR, eMMC and NAND.

While working on this, move enum cvmx_board_types_enum and
cvmx_board_type_to_string() to cvmx-bootloader.h and remove the
unreferenced (unsupported) board definition.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# e198bb51 29-Dec-2019 Dario Binacchi <dariobin@libero.it>

tools: .gitignore: add asn1_compiler

Add the tool to the ignore list to prevent being marked as unversioned.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4d90f6cd 27-Oct-2019 Bin Meng <bmeng.cn@gmail.com>

tools: Avoid creating symbolic links for tools/version.h

When building U-Boot host tools for Windows from Microsoft Azure
Pipelines, the following errors were seen:

HOSTCC tools/mkenvimage.o
In file included from tools/mkenvimage.c:25:
./tools/version.h:1:1: error: expected identifier or ‘(’ before ‘.’ token
1 | ../include/version.h
| ^
tools/mkenvimage.c: In function ‘main’:
tools/mkenvimage.c:117:4: warning: implicit declaration of function ‘usage’ [-Wimplicit-function-declaration]
117 | usage(prg);
| ^~~~~
tools/mkenvimage.c:120:35: error: ‘PLAIN_VERSION’ undeclared (first use in this function)
120 | printf("%s version %s\n", prg, PLAIN_VERSION);
| ^~~~~~~~~~~~~
tools/mkenvimage.c:120:35: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [scripts/Makefile.host:114: tools/mkenvimage.o] Error 1

It turns out tools/version.h is a symbolic link and with Windows
default settings it is unsupported hence the actual content of
tools/version.h is not what file include/version.h has, but the
the linked file path, which breaks the build.

To fix this, remove the symbolic links for tools/version.h. Instead
we perform a copy from include/version.h during the build.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 08afd714 18-Aug-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

tools: Add ifwitool to .gitignore

Follow up fix to the commit

56bf4f863075 ("x86: Add ifwitool for Intel Integrated Firmware Image")

in order to ignore created binary.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c78b5cb7 11-Jun-2019 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

tools: add tools/spl_size_limit to ignore list

This tool has just been added but it seems I forgot to add it to
the ignore list. So to prevent the built binary being marked as
unversioned, add it to the ignore list.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 07c098b7 22-Nov-2018 Lukas Auer <lukas.auer@aisec.fraunhofer.de>

tools: .gitignore: add prelink-riscv

Ignore tools/prelink-riscv.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# ac020196 17-Jan-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: provide a tool to convert a binary file to an include

For testing EFI disk management we need an in-memory image of
a disk.

The tool file2include converts a file to a C include. The file
is separated into strings of 8 bytes. Only the non-zero strings
are written to the include. The output format has been designed
to maintain readability.

#define EFI_ST_DISK_IMG { 0x00010000, { \
{0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \
{0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \
{0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \
{0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \
...
{0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \
{0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \
{0, NULL} } }

As the disk image needed for testing contains mostly zeroes a high
compression ratio can be attained.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 15b97f5c 16-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile

The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.

Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.

I also rewrote the Makefile in a cleaner Kbuild style.

The scripts from the upstream have been moved as follows:

lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

The .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.

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

# eab44c93 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Add libfdt related files

Some files are generated during libfdt build. Ignore them.

This was wrongly put in the .gitignore in the root directory before.
Now let's remove entries there and put them in the right place.

Fixes: 34e2c285 ("gitignore: add intermediates from libfdt build")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# d11d3b2f 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Sort in alphabetical order

These are currently out of alphabetical order.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 594b4cc7 27-Feb-2017 Maxime Ripard <maxime.ripard@free-electrons.com>

tools: sunxi: Add spl image builder

This program generates raw SPL images that can be flashed on the NAND with
the ECC and randomizer properly set up.

This has been copied (and tweaked to find the right headers) from the
sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream
repository, commit 1c3a6ca5.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# c25f01a6 25-Nov-2016 oliver@schinagl.nl <oliver@schinagl.nl>

tools: Add tool to add crc8 to a mac address

This patch adds a little tool that takes a generic MAC address and
generates a CRC byte for it. The output is the full MAC address without
any separators, ready written into an EEPROM.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 87c2f76f 22-May-2016 Robert P. J. Day <rpjday@crashcourse.ca>

tools: Add entry for generated tools/bin2header to tools/.gitignore

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

# 01124327 31-Jul-2015 Bin Meng <bmeng.cn@gmail.com>

gitignore: Add defconfig and fdtgrep

Ignore defconfig and tools/fdtgrep.

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

# 9c574877 25-Jul-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

tools: remove mpc86x_clk tool

This is commented out in the Makefile for more than 10 years.
I assume it is proof that this tool is unused.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Pantelis Antoniou <panto@intracom.gr>

# 908ec6e4 24-Nov-2014 Bin Meng <bmeng.cn@gmail.com>

tools: Add ifdtool to .gitignore

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

# bedcf395 24-Oct-2014 Andreas Bießmann <andreas.devel@googlemail.com>

gitignore: ignore atmel pmecc parameter tool

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 7050f0de 06-Jun-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

.gitignore: move *.exe pattern to the top gitignore for Cygwin

GCC on Cygwin generates executables with .exe extension,
for example:
scripts/basic/fixdep.exe
scripts/docproc.exe

To ignore them, *.exe pattern should be moved
from tools/.gitignore to ./.gitignore

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

# ad80c4a3 05-Jun-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild, tools: generate wrapper C sources automatically by Makefile

There are many source files shared between U-boot image and tools.
Instead of adding a lot of dummy wrapper files that just include
the corresponding file in lib/ or common/ directory,
Makefile should automatically generate them.

The original inspiration for this came from
scripts/Makefile.asm-generic of Linux Kernel.

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

# 50827a59 05-May-2014 Ian Campbell <ijc@hellion.org.uk>

sunxi: non-FEL SPL boot support for sun7i

Add support for booting from an MMC card.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Henrik Nordström <henrik@henriknordstrom.net>
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Reviewed-by: Marek Vasut <marex@denx.de>
Cc: Tom Cubie <Mr.hipboi@gmail.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 29a23f9d 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit_check_sign: verify a signed fit image

add host tool "fit_check_sign" which verifies, if a fit image is
signed correct.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>

# 6bf4ca07 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit: add fit_info host command

add fit_info command to the host tools. This command prints
the name, offset and the len from a property from a node in
a fit file. This info can be used to extract a properties
data with linux tools, for example "dd".

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

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

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>

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

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>

# 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>

# 84977e44 13-Jan-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

.gitignore: ignore u-boot.elf and tools/relocate-rela

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

# 475c506d 06-Dec-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

Makefile, .gitignore: Cleanup non-existing binaries

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

# a804b5ce 01-Dec-2013 Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>

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>

# 6c887b2a 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add proftool to decode profile data

This tool provides the facility to decode U-Boot trace data and write out
a text file in Linux ftrace format for use with pytimechart.

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

# 30ff8918 06-Oct-2012 Marek Vasut <marex@denx.de>

kerneldoc: Implant DocBook from Linux kernel

Pull slightly modified version of Documentation/DocBook, the related perl
script scripts/kernel-doc and the scripts/docproc.c from Linux kernel and
implant it into U-Boot. This will allow smooth generation of kerneldoc
style documentation.

It was necessary to modify the DocBook/Makefile to work with U-Boot build
system. The changes were only minor though and involved replacing the kbuild
specific parts.

It was also necessary to replace use of variables like KERNEL_VERSION with
U_BOOT_VERSION, strings like Linux kernel with U-Boot Bootloader etc. so
the generated result actually matches.

Finally, it was necessary to adjust docproc.c, since the documentation in
U-Boot is located in doc/DocBook instead of Documentation/DocBook as is in
case of the Linux kernel.

Some parts of the DocBook Makefile are unused, but to allow easier sync with
Linux kernel, these parts are still left in. The targets enabled now are
"htmldocs" "pdfdocs" "psdocs" "xmldocs" and "cleandocs" to remove the results
of documentation build.

Linux scripts/docproc.c:
commit f0f3ca8d967462dafb815412b14ca3339b9817a6
Date: Wed Jun 15 11:53:13 2011 +0200

Linux scripts/kernel-doc:
commit 1b40c1944db445c1de1c47ffd8cd426167f488e8
Date: Sun Aug 12 10:46:15 2012 +0200

Linux Documentation/DocBook:
commit bb8187d35f820671d6dd76700d77a6b55f95e2c5
Date: Thu May 17 19:06:13 2012 -0400

Signed-off-by: Marek Vasut <marex@denx.de>

# 578f35a3 15-Jul-2012 Luka Perkov <uboot@lukaperkov.net>

tools: add kwboot binary to .gitignore file

Signed-off-by: Luka Perkov <uboot@lukaperkov.net>
Acked-by: Prafulla Wadaskar <Prafulla@marvell.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8b425b3f 27-Jul-2012 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

MIPS: fix renaming of inca-swap-bytes to xway-swap-bytes

Fix some remains of the renaming of inca-swap-bytes introduced in

commit 60b74bde9280e85f4423c05a50ecc41de56ad980

MIPS: INCA-IP: rename inca-swap-bytes host tool

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

# ca8a30ec 25-Nov-2011 Mike Frysinger <vapier@gentoo.org>

ignore new mkenvimage tool

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

# f29f7e02 08-Nov-2011 Marek Vasut <marex@denx.de>

iMX28: Add image header generator tool

This tool can now generate proper image for "BootStream" files.

NOTE: This tool now works only for NAND.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>

# 8e0ec82e 14-Aug-2010 Mike Frysinger <vapier@gentoo.org>

tools: update .gitignore

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

# 8204e068 04-Nov-2009 Mike Frysinger <vapier@gentoo.org>

tools: gitignore *.exe binaries

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

# b074a708 04-Apr-2009 Mike Frysinger <vapier@gentoo.org>

tools: add ncb to gitignore

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

# fb8b33c1 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for remaining source files

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

# c0170175 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for fdt targets

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

# 45d6bdff 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Add libfdt/ to the include search path

This change makes the process of symlinking libfdt_internal.h
unnecessary

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

# fba0e3a0 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools: Remove unecessary symlinking of zlib.h

crc32.c uses the zlib.h header in include/u-boot/zlib.h. The symlink
was previously necessary to give U-Boot's version of zlib.h precedence
over the host computer's version of zlib.h.

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

# 0cf4fd3c 10-Sep-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

rename environment.c in env_embedded.c to reflect is functionality

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 31cfe574 14-Jul-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

tools/gitignore: update to all generated files

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 8ea08e5b 29-Apr-2008 Kumar Gala <galak@kernel.crashing.org>

Update .gitignore for zlib.h

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

# 766529fc 14-Mar-2008 Bartlomiej Sieka <tur@semihalf.com>

Add MD5 support to the new uImage format

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 8cf30809 29-Feb-2008 Bartlomiej Sieka <tur@semihalf.com>

[new uImage] Add libfdt support to mkimage

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 1b4aaffe 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

Add .gitignore files

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# 850d27b4 28-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: add mkeficapsule to .gitignore

mkeficapsule is a build product. Add it to .gitignore

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 540a2bce 30-Nov-2020 Stefan Roese <sr@denx.de>

mips: octeon: tools: Add update_octeon_header tool

Add a tool to update or insert an Octeon specific header into the U-Boot
image. This is needed e.g. for booting via SPI NOR, eMMC and NAND.

While working on this, move enum cvmx_board_types_enum and
cvmx_board_type_to_string() to cvmx-bootloader.h and remove the
unreferenced (unsupported) board definition.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# e198bb51 29-Dec-2019 Dario Binacchi <dariobin@libero.it>

tools: .gitignore: add asn1_compiler

Add the tool to the ignore list to prevent being marked as unversioned.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4d90f6cd 27-Oct-2019 Bin Meng <bmeng.cn@gmail.com>

tools: Avoid creating symbolic links for tools/version.h

When building U-Boot host tools for Windows from Microsoft Azure
Pipelines, the following errors were seen:

HOSTCC tools/mkenvimage.o
In file included from tools/mkenvimage.c:25:
./tools/version.h:1:1: error: expected identifier or ‘(’ before ‘.’ token
1 | ../include/version.h
| ^
tools/mkenvimage.c: In function ‘main’:
tools/mkenvimage.c:117:4: warning: implicit declaration of function ‘usage’ [-Wimplicit-function-declaration]
117 | usage(prg);
| ^~~~~
tools/mkenvimage.c:120:35: error: ‘PLAIN_VERSION’ undeclared (first use in this function)
120 | printf("%s version %s\n", prg, PLAIN_VERSION);
| ^~~~~~~~~~~~~
tools/mkenvimage.c:120:35: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [scripts/Makefile.host:114: tools/mkenvimage.o] Error 1

It turns out tools/version.h is a symbolic link and with Windows
default settings it is unsupported hence the actual content of
tools/version.h is not what file include/version.h has, but the
the linked file path, which breaks the build.

To fix this, remove the symbolic links for tools/version.h. Instead
we perform a copy from include/version.h during the build.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 08afd714 18-Aug-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

tools: Add ifwitool to .gitignore

Follow up fix to the commit

56bf4f863075 ("x86: Add ifwitool for Intel Integrated Firmware Image")

in order to ignore created binary.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c78b5cb7 11-Jun-2019 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

tools: add tools/spl_size_limit to ignore list

This tool has just been added but it seems I forgot to add it to
the ignore list. So to prevent the built binary being marked as
unversioned, add it to the ignore list.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 07c098b7 22-Nov-2018 Lukas Auer <lukas.auer@aisec.fraunhofer.de>

tools: .gitignore: add prelink-riscv

Ignore tools/prelink-riscv.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# ac020196 17-Jan-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: provide a tool to convert a binary file to an include

For testing EFI disk management we need an in-memory image of
a disk.

The tool file2include converts a file to a C include. The file
is separated into strings of 8 bytes. Only the non-zero strings
are written to the include. The output format has been designed
to maintain readability.

#define EFI_ST_DISK_IMG { 0x00010000, { \
{0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \
{0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \
{0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \
{0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \
...
{0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \
{0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \
{0, NULL} } }

As the disk image needed for testing contains mostly zeroes a high
compression ratio can be attained.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 15b97f5c 16-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile

The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.

Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.

I also rewrote the Makefile in a cleaner Kbuild style.

The scripts from the upstream have been moved as follows:

lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

The .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.

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

# eab44c93 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Add libfdt related files

Some files are generated during libfdt build. Ignore them.

This was wrongly put in the .gitignore in the root directory before.
Now let's remove entries there and put them in the right place.

Fixes: 34e2c285 ("gitignore: add intermediates from libfdt build")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# d11d3b2f 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Sort in alphabetical order

These are currently out of alphabetical order.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 594b4cc7 27-Feb-2017 Maxime Ripard <maxime.ripard@free-electrons.com>

tools: sunxi: Add spl image builder

This program generates raw SPL images that can be flashed on the NAND with
the ECC and randomizer properly set up.

This has been copied (and tweaked to find the right headers) from the
sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream
repository, commit 1c3a6ca5.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# c25f01a6 25-Nov-2016 oliver@schinagl.nl <oliver@schinagl.nl>

tools: Add tool to add crc8 to a mac address

This patch adds a little tool that takes a generic MAC address and
generates a CRC byte for it. The output is the full MAC address without
any separators, ready written into an EEPROM.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 87c2f76f 22-May-2016 Robert P. J. Day <rpjday@crashcourse.ca>

tools: Add entry for generated tools/bin2header to tools/.gitignore

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

# 01124327 31-Jul-2015 Bin Meng <bmeng.cn@gmail.com>

gitignore: Add defconfig and fdtgrep

Ignore defconfig and tools/fdtgrep.

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

# 9c574877 25-Jul-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

tools: remove mpc86x_clk tool

This is commented out in the Makefile for more than 10 years.
I assume it is proof that this tool is unused.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Pantelis Antoniou <panto@intracom.gr>

# 908ec6e4 24-Nov-2014 Bin Meng <bmeng.cn@gmail.com>

tools: Add ifdtool to .gitignore

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

# bedcf395 24-Oct-2014 Andreas Bießmann <andreas.devel@googlemail.com>

gitignore: ignore atmel pmecc parameter tool

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 7050f0de 06-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

.gitignore: move *.exe pattern to the top gitignore for Cygwin

GCC on Cygwin generates executables with .exe extension,
for example:
scripts/basic/fixdep.exe
scripts/docproc.exe

To ignore them, *.exe pattern should be moved
from tools/.gitignore to ./.gitignore

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

# ad80c4a3 05-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild, tools: generate wrapper C sources automatically by Makefile

There are many source files shared between U-boot image and tools.
Instead of adding a lot of dummy wrapper files that just include
the corresponding file in lib/ or common/ directory,
Makefile should automatically generate them.

The original inspiration for this came from
scripts/Makefile.asm-generic of Linux Kernel.

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

# 50827a59 05-May-2014 Ian Campbell <ijc@hellion.org.uk>

sunxi: non-FEL SPL boot support for sun7i

Add support for booting from an MMC card.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Henrik Nordström <henrik@henriknordstrom.net>
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Reviewed-by: Marek Vasut <marex@denx.de>
Cc: Tom Cubie <Mr.hipboi@gmail.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 29a23f9d 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit_check_sign: verify a signed fit image

add host tool "fit_check_sign" which verifies, if a fit image is
signed correct.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>

# 6bf4ca07 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit: add fit_info host command

add fit_info command to the host tools. This command prints
the name, offset and the len from a property from a node in
a fit file. This info can be used to extract a properties
data with linux tools, for example "dd".

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

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

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>

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

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>

# 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>

# 84977e44 13-Jan-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

.gitignore: ignore u-boot.elf and tools/relocate-rela

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

# 475c506d 06-Dec-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile, .gitignore: Cleanup non-existing binaries

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

# a804b5ce 01-Dec-2013 Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>

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>

# 6c887b2a 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add proftool to decode profile data

This tool provides the facility to decode U-Boot trace data and write out
a text file in Linux ftrace format for use with pytimechart.

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

# 30ff8918 06-Oct-2012 Marek Vasut <marex@denx.de>

kerneldoc: Implant DocBook from Linux kernel

Pull slightly modified version of Documentation/DocBook, the related perl
script scripts/kernel-doc and the scripts/docproc.c from Linux kernel and
implant it into U-Boot. This will allow smooth generation of kerneldoc
style documentation.

It was necessary to modify the DocBook/Makefile to work with U-Boot build
system. The changes were only minor though and involved replacing the kbuild
specific parts.

It was also necessary to replace use of variables like KERNEL_VERSION with
U_BOOT_VERSION, strings like Linux kernel with U-Boot Bootloader etc. so
the generated result actually matches.

Finally, it was necessary to adjust docproc.c, since the documentation in
U-Boot is located in doc/DocBook instead of Documentation/DocBook as is in
case of the Linux kernel.

Some parts of the DocBook Makefile are unused, but to allow easier sync with
Linux kernel, these parts are still left in. The targets enabled now are
"htmldocs" "pdfdocs" "psdocs" "xmldocs" and "cleandocs" to remove the results
of documentation build.

Linux scripts/docproc.c:
commit f0f3ca8d967462dafb815412b14ca3339b9817a6
Date: Wed Jun 15 11:53:13 2011 +0200

Linux scripts/kernel-doc:
commit 1b40c1944db445c1de1c47ffd8cd426167f488e8
Date: Sun Aug 12 10:46:15 2012 +0200

Linux Documentation/DocBook:
commit bb8187d35f820671d6dd76700d77a6b55f95e2c5
Date: Thu May 17 19:06:13 2012 -0400

Signed-off-by: Marek Vasut <marex@denx.de>

# 578f35a3 15-Jul-2012 Luka Perkov <uboot@lukaperkov.net>

tools: add kwboot binary to .gitignore file

Signed-off-by: Luka Perkov <uboot@lukaperkov.net>
Acked-by: Prafulla Wadaskar <Prafulla@marvell.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8b425b3f 27-Jul-2012 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

MIPS: fix renaming of inca-swap-bytes to xway-swap-bytes

Fix some remains of the renaming of inca-swap-bytes introduced in

commit 60b74bde9280e85f4423c05a50ecc41de56ad980

MIPS: INCA-IP: rename inca-swap-bytes host tool

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

# ca8a30ec 25-Nov-2011 Mike Frysinger <vapier@gentoo.org>

ignore new mkenvimage tool

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

# f29f7e02 08-Nov-2011 Marek Vasut <marek.vasut@gmail.com>

iMX28: Add image header generator tool

This tool can now generate proper image for "BootStream" files.

NOTE: This tool now works only for NAND.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>

# 8e0ec82e 14-Aug-2010 Mike Frysinger <vapier@gentoo.org>

tools: update .gitignore

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

# 8204e068 04-Nov-2009 Mike Frysinger <vapier@gentoo.org>

tools: gitignore *.exe binaries

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

# b074a708 04-Apr-2009 Mike Frysinger <vapier@gentoo.org>

tools: add ncb to gitignore

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

# fb8b33c1 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for remaining source files

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

# c0170175 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for fdt targets

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

# 45d6bdff 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Add libfdt/ to the include search path

This change makes the process of symlinking libfdt_internal.h
unnecessary

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

# fba0e3a0 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools: Remove unecessary symlinking of zlib.h

crc32.c uses the zlib.h header in include/u-boot/zlib.h. The symlink
was previously necessary to give U-Boot's version of zlib.h precedence
over the host computer's version of zlib.h.

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

# 0cf4fd3c 10-Sep-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

rename environment.c in env_embedded.c to reflect is functionality

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 31cfe574 14-Jul-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

tools/gitignore: update to all generated files

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 8ea08e5b 29-Apr-2008 Kumar Gala <galak@kernel.crashing.org>

Update .gitignore for zlib.h

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

# 766529fc 14-Mar-2008 Bartlomiej Sieka <tur@semihalf.com>

Add MD5 support to the new uImage format

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 8cf30809 29-Feb-2008 Bartlomiej Sieka <tur@semihalf.com>

[new uImage] Add libfdt support to mkimage

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 1b4aaffe 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

Add .gitignore files

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# 540a2bce 30-Nov-2020 Stefan Roese <sr@denx.de>

mips: octeon: tools: Add update_octeon_header tool

Add a tool to update or insert an Octeon specific header into the U-Boot
image. This is needed e.g. for booting via SPI NOR, eMMC and NAND.

While working on this, move enum cvmx_board_types_enum and
cvmx_board_type_to_string() to cvmx-bootloader.h and remove the
unreferenced (unsupported) board definition.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# e198bb51 29-Dec-2019 Dario Binacchi <dariobin@libero.it>

tools: .gitignore: add asn1_compiler

Add the tool to the ignore list to prevent being marked as unversioned.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4d90f6cd 27-Oct-2019 Bin Meng <bmeng.cn@gmail.com>

tools: Avoid creating symbolic links for tools/version.h

When building U-Boot host tools for Windows from Microsoft Azure
Pipelines, the following errors were seen:

HOSTCC tools/mkenvimage.o
In file included from tools/mkenvimage.c:25:
./tools/version.h:1:1: error: expected identifier or ‘(’ before ‘.’ token
1 | ../include/version.h
| ^
tools/mkenvimage.c: In function ‘main’:
tools/mkenvimage.c:117:4: warning: implicit declaration of function ‘usage’ [-Wimplicit-function-declaration]
117 | usage(prg);
| ^~~~~
tools/mkenvimage.c:120:35: error: ‘PLAIN_VERSION’ undeclared (first use in this function)
120 | printf("%s version %s\n", prg, PLAIN_VERSION);
| ^~~~~~~~~~~~~
tools/mkenvimage.c:120:35: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [scripts/Makefile.host:114: tools/mkenvimage.o] Error 1

It turns out tools/version.h is a symbolic link and with Windows
default settings it is unsupported hence the actual content of
tools/version.h is not what file include/version.h has, but the
the linked file path, which breaks the build.

To fix this, remove the symbolic links for tools/version.h. Instead
we perform a copy from include/version.h during the build.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 08afd714 18-Aug-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

tools: Add ifwitool to .gitignore

Follow up fix to the commit

56bf4f863075 ("x86: Add ifwitool for Intel Integrated Firmware Image")

in order to ignore created binary.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c78b5cb7 11-Jun-2019 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

tools: add tools/spl_size_limit to ignore list

This tool has just been added but it seems I forgot to add it to
the ignore list. So to prevent the built binary being marked as
unversioned, add it to the ignore list.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 07c098b7 22-Nov-2018 Lukas Auer <lukas.auer@aisec.fraunhofer.de>

tools: .gitignore: add prelink-riscv

Ignore tools/prelink-riscv.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# ac020196 17-Jan-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: provide a tool to convert a binary file to an include

For testing EFI disk management we need an in-memory image of
a disk.

The tool file2include converts a file to a C include. The file
is separated into strings of 8 bytes. Only the non-zero strings
are written to the include. The output format has been designed
to maintain readability.

#define EFI_ST_DISK_IMG { 0x00010000, { \
{0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \
{0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \
{0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \
{0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \
...
{0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \
{0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \
{0, NULL} } }

As the disk image needed for testing contains mostly zeroes a high
compression ratio can be attained.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 15b97f5c 16-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile

The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.

Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.

I also rewrote the Makefile in a cleaner Kbuild style.

The scripts from the upstream have been moved as follows:

lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

The .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.

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

# eab44c93 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Add libfdt related files

Some files are generated during libfdt build. Ignore them.

This was wrongly put in the .gitignore in the root directory before.
Now let's remove entries there and put them in the right place.

Fixes: 34e2c285 ("gitignore: add intermediates from libfdt build")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# d11d3b2f 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Sort in alphabetical order

These are currently out of alphabetical order.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 594b4cc7 27-Feb-2017 Maxime Ripard <maxime.ripard@free-electrons.com>

tools: sunxi: Add spl image builder

This program generates raw SPL images that can be flashed on the NAND with
the ECC and randomizer properly set up.

This has been copied (and tweaked to find the right headers) from the
sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream
repository, commit 1c3a6ca5.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# c25f01a6 25-Nov-2016 oliver@schinagl.nl <oliver@schinagl.nl>

tools: Add tool to add crc8 to a mac address

This patch adds a little tool that takes a generic MAC address and
generates a CRC byte for it. The output is the full MAC address without
any separators, ready written into an EEPROM.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 87c2f76f 22-May-2016 Robert P. J. Day <rpjday@crashcourse.ca>

tools: Add entry for generated tools/bin2header to tools/.gitignore

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

# 01124327 31-Jul-2015 Bin Meng <bmeng.cn@gmail.com>

gitignore: Add defconfig and fdtgrep

Ignore defconfig and tools/fdtgrep.

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

# 9c574877 25-Jul-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

tools: remove mpc86x_clk tool

This is commented out in the Makefile for more than 10 years.
I assume it is proof that this tool is unused.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Pantelis Antoniou <panto@intracom.gr>

# 908ec6e4 24-Nov-2014 Bin Meng <bmeng.cn@gmail.com>

tools: Add ifdtool to .gitignore

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

# bedcf395 24-Oct-2014 Andreas Bießmann <andreas.devel@googlemail.com>

gitignore: ignore atmel pmecc parameter tool

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 7050f0de 06-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

.gitignore: move *.exe pattern to the top gitignore for Cygwin

GCC on Cygwin generates executables with .exe extension,
for example:
scripts/basic/fixdep.exe
scripts/docproc.exe

To ignore them, *.exe pattern should be moved
from tools/.gitignore to ./.gitignore

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

# ad80c4a3 05-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild, tools: generate wrapper C sources automatically by Makefile

There are many source files shared between U-boot image and tools.
Instead of adding a lot of dummy wrapper files that just include
the corresponding file in lib/ or common/ directory,
Makefile should automatically generate them.

The original inspiration for this came from
scripts/Makefile.asm-generic of Linux Kernel.

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

# 50827a59 05-May-2014 Ian Campbell <ijc@hellion.org.uk>

sunxi: non-FEL SPL boot support for sun7i

Add support for booting from an MMC card.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Henrik Nordström <henrik@henriknordstrom.net>
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Reviewed-by: Marek Vasut <marex@denx.de>
Cc: Tom Cubie <Mr.hipboi@gmail.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 29a23f9d 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit_check_sign: verify a signed fit image

add host tool "fit_check_sign" which verifies, if a fit image is
signed correct.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>

# 6bf4ca07 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit: add fit_info host command

add fit_info command to the host tools. This command prints
the name, offset and the len from a property from a node in
a fit file. This info can be used to extract a properties
data with linux tools, for example "dd".

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

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

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>

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

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>

# 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>

# 84977e44 13-Jan-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

.gitignore: ignore u-boot.elf and tools/relocate-rela

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

# 475c506d 06-Dec-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile, .gitignore: Cleanup non-existing binaries

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

# a804b5ce 01-Dec-2013 Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>

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>

# 6c887b2a 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add proftool to decode profile data

This tool provides the facility to decode U-Boot trace data and write out
a text file in Linux ftrace format for use with pytimechart.

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

# 30ff8918 06-Oct-2012 Marek Vasut <marex@denx.de>

kerneldoc: Implant DocBook from Linux kernel

Pull slightly modified version of Documentation/DocBook, the related perl
script scripts/kernel-doc and the scripts/docproc.c from Linux kernel and
implant it into U-Boot. This will allow smooth generation of kerneldoc
style documentation.

It was necessary to modify the DocBook/Makefile to work with U-Boot build
system. The changes were only minor though and involved replacing the kbuild
specific parts.

It was also necessary to replace use of variables like KERNEL_VERSION with
U_BOOT_VERSION, strings like Linux kernel with U-Boot Bootloader etc. so
the generated result actually matches.

Finally, it was necessary to adjust docproc.c, since the documentation in
U-Boot is located in doc/DocBook instead of Documentation/DocBook as is in
case of the Linux kernel.

Some parts of the DocBook Makefile are unused, but to allow easier sync with
Linux kernel, these parts are still left in. The targets enabled now are
"htmldocs" "pdfdocs" "psdocs" "xmldocs" and "cleandocs" to remove the results
of documentation build.

Linux scripts/docproc.c:
commit f0f3ca8d967462dafb815412b14ca3339b9817a6
Date: Wed Jun 15 11:53:13 2011 +0200

Linux scripts/kernel-doc:
commit 1b40c1944db445c1de1c47ffd8cd426167f488e8
Date: Sun Aug 12 10:46:15 2012 +0200

Linux Documentation/DocBook:
commit bb8187d35f820671d6dd76700d77a6b55f95e2c5
Date: Thu May 17 19:06:13 2012 -0400

Signed-off-by: Marek Vasut <marex@denx.de>

# 578f35a3 15-Jul-2012 Luka Perkov <uboot@lukaperkov.net>

tools: add kwboot binary to .gitignore file

Signed-off-by: Luka Perkov <uboot@lukaperkov.net>
Acked-by: Prafulla Wadaskar <Prafulla@marvell.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8b425b3f 27-Jul-2012 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

MIPS: fix renaming of inca-swap-bytes to xway-swap-bytes

Fix some remains of the renaming of inca-swap-bytes introduced in

commit 60b74bde9280e85f4423c05a50ecc41de56ad980

MIPS: INCA-IP: rename inca-swap-bytes host tool

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

# ca8a30ec 25-Nov-2011 Mike Frysinger <vapier@gentoo.org>

ignore new mkenvimage tool

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

# f29f7e02 08-Nov-2011 Marek Vasut <marek.vasut@gmail.com>

iMX28: Add image header generator tool

This tool can now generate proper image for "BootStream" files.

NOTE: This tool now works only for NAND.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>

# 8e0ec82e 14-Aug-2010 Mike Frysinger <vapier@gentoo.org>

tools: update .gitignore

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

# 8204e068 04-Nov-2009 Mike Frysinger <vapier@gentoo.org>

tools: gitignore *.exe binaries

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

# b074a708 04-Apr-2009 Mike Frysinger <vapier@gentoo.org>

tools: add ncb to gitignore

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

# fb8b33c1 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for remaining source files

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

# c0170175 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for fdt targets

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

# 45d6bdff 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Add libfdt/ to the include search path

This change makes the process of symlinking libfdt_internal.h
unnecessary

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

# fba0e3a0 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools: Remove unecessary symlinking of zlib.h

crc32.c uses the zlib.h header in include/u-boot/zlib.h. The symlink
was previously necessary to give U-Boot's version of zlib.h precedence
over the host computer's version of zlib.h.

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

# 0cf4fd3c 10-Sep-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

rename environment.c in env_embedded.c to reflect is functionality

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 31cfe574 14-Jul-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

tools/gitignore: update to all generated files

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 8ea08e5b 29-Apr-2008 Kumar Gala <galak@kernel.crashing.org>

Update .gitignore for zlib.h

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

# 766529fc 14-Mar-2008 Bartlomiej Sieka <tur@semihalf.com>

Add MD5 support to the new uImage format

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 8cf30809 29-Feb-2008 Bartlomiej Sieka <tur@semihalf.com>

[new uImage] Add libfdt support to mkimage

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 1b4aaffe 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

Add .gitignore files

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# e198bb51 29-Dec-2019 Dario Binacchi <dariobin@libero.it>

tools: .gitignore: add asn1_compiler

Add the tool to the ignore list to prevent being marked as unversioned.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4d90f6cd 27-Oct-2019 Bin Meng <bmeng.cn@gmail.com>

tools: Avoid creating symbolic links for tools/version.h

When building U-Boot host tools for Windows from Microsoft Azure
Pipelines, the following errors were seen:

HOSTCC tools/mkenvimage.o
In file included from tools/mkenvimage.c:25:
./tools/version.h:1:1: error: expected identifier or ‘(’ before ‘.’ token
1 | ../include/version.h
| ^
tools/mkenvimage.c: In function ‘main’:
tools/mkenvimage.c:117:4: warning: implicit declaration of function ‘usage’ [-Wimplicit-function-declaration]
117 | usage(prg);
| ^~~~~
tools/mkenvimage.c:120:35: error: ‘PLAIN_VERSION’ undeclared (first use in this function)
120 | printf("%s version %s\n", prg, PLAIN_VERSION);
| ^~~~~~~~~~~~~
tools/mkenvimage.c:120:35: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [scripts/Makefile.host:114: tools/mkenvimage.o] Error 1

It turns out tools/version.h is a symbolic link and with Windows
default settings it is unsupported hence the actual content of
tools/version.h is not what file include/version.h has, but the
the linked file path, which breaks the build.

To fix this, remove the symbolic links for tools/version.h. Instead
we perform a copy from include/version.h during the build.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 08afd714 18-Aug-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

tools: Add ifwitool to .gitignore

Follow up fix to the commit

56bf4f863075 ("x86: Add ifwitool for Intel Integrated Firmware Image")

in order to ignore created binary.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c78b5cb7 11-Jun-2019 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

tools: add tools/spl_size_limit to ignore list

This tool has just been added but it seems I forgot to add it to
the ignore list. So to prevent the built binary being marked as
unversioned, add it to the ignore list.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 07c098b7 22-Nov-2018 Lukas Auer <lukas.auer@aisec.fraunhofer.de>

tools: .gitignore: add prelink-riscv

Ignore tools/prelink-riscv.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# ac020196 17-Jan-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: provide a tool to convert a binary file to an include

For testing EFI disk management we need an in-memory image of
a disk.

The tool file2include converts a file to a C include. The file
is separated into strings of 8 bytes. Only the non-zero strings
are written to the include. The output format has been designed
to maintain readability.

#define EFI_ST_DISK_IMG { 0x00010000, { \
{0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \
{0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \
{0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \
{0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \
...
{0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \
{0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \
{0, NULL} } }

As the disk image needed for testing contains mostly zeroes a high
compression ratio can be attained.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 15b97f5c 16-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile

The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.

Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.

I also rewrote the Makefile in a cleaner Kbuild style.

The scripts from the upstream have been moved as follows:

lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

The .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.

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

# eab44c93 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Add libfdt related files

Some files are generated during libfdt build. Ignore them.

This was wrongly put in the .gitignore in the root directory before.
Now let's remove entries there and put them in the right place.

Fixes: 34e2c285 ("gitignore: add intermediates from libfdt build")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# d11d3b2f 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Sort in alphabetical order

These are currently out of alphabetical order.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 594b4cc7 27-Feb-2017 Maxime Ripard <maxime.ripard@free-electrons.com>

tools: sunxi: Add spl image builder

This program generates raw SPL images that can be flashed on the NAND with
the ECC and randomizer properly set up.

This has been copied (and tweaked to find the right headers) from the
sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream
repository, commit 1c3a6ca5.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# c25f01a6 25-Nov-2016 oliver@schinagl.nl <oliver@schinagl.nl>

tools: Add tool to add crc8 to a mac address

This patch adds a little tool that takes a generic MAC address and
generates a CRC byte for it. The output is the full MAC address without
any separators, ready written into an EEPROM.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 87c2f76f 22-May-2016 Robert P. J. Day <rpjday@crashcourse.ca>

tools: Add entry for generated tools/bin2header to tools/.gitignore

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

# 01124327 31-Jul-2015 Bin Meng <bmeng.cn@gmail.com>

gitignore: Add defconfig and fdtgrep

Ignore defconfig and tools/fdtgrep.

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

# 9c574877 25-Jul-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

tools: remove mpc86x_clk tool

This is commented out in the Makefile for more than 10 years.
I assume it is proof that this tool is unused.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Pantelis Antoniou <panto@intracom.gr>

# 908ec6e4 24-Nov-2014 Bin Meng <bmeng.cn@gmail.com>

tools: Add ifdtool to .gitignore

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

# bedcf395 24-Oct-2014 Andreas Bießmann <andreas.devel@googlemail.com>

gitignore: ignore atmel pmecc parameter tool

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 7050f0de 06-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

.gitignore: move *.exe pattern to the top gitignore for Cygwin

GCC on Cygwin generates executables with .exe extension,
for example:
scripts/basic/fixdep.exe
scripts/docproc.exe

To ignore them, *.exe pattern should be moved
from tools/.gitignore to ./.gitignore

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

# ad80c4a3 05-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild, tools: generate wrapper C sources automatically by Makefile

There are many source files shared between U-boot image and tools.
Instead of adding a lot of dummy wrapper files that just include
the corresponding file in lib/ or common/ directory,
Makefile should automatically generate them.

The original inspiration for this came from
scripts/Makefile.asm-generic of Linux Kernel.

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

# 50827a59 05-May-2014 Ian Campbell <ijc@hellion.org.uk>

sunxi: non-FEL SPL boot support for sun7i

Add support for booting from an MMC card.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Henrik Nordström <henrik@henriknordstrom.net>
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Reviewed-by: Marek Vasut <marex@denx.de>
Cc: Tom Cubie <Mr.hipboi@gmail.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 29a23f9d 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit_check_sign: verify a signed fit image

add host tool "fit_check_sign" which verifies, if a fit image is
signed correct.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>

# 6bf4ca07 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit: add fit_info host command

add fit_info command to the host tools. This command prints
the name, offset and the len from a property from a node in
a fit file. This info can be used to extract a properties
data with linux tools, for example "dd".

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

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

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>

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

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>

# 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>

# 84977e44 13-Jan-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

.gitignore: ignore u-boot.elf and tools/relocate-rela

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

# 475c506d 06-Dec-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile, .gitignore: Cleanup non-existing binaries

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

# a804b5ce 01-Dec-2013 Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>

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>

# 6c887b2a 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add proftool to decode profile data

This tool provides the facility to decode U-Boot trace data and write out
a text file in Linux ftrace format for use with pytimechart.

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

# 30ff8918 06-Oct-2012 Marek Vasut <marex@denx.de>

kerneldoc: Implant DocBook from Linux kernel

Pull slightly modified version of Documentation/DocBook, the related perl
script scripts/kernel-doc and the scripts/docproc.c from Linux kernel and
implant it into U-Boot. This will allow smooth generation of kerneldoc
style documentation.

It was necessary to modify the DocBook/Makefile to work with U-Boot build
system. The changes were only minor though and involved replacing the kbuild
specific parts.

It was also necessary to replace use of variables like KERNEL_VERSION with
U_BOOT_VERSION, strings like Linux kernel with U-Boot Bootloader etc. so
the generated result actually matches.

Finally, it was necessary to adjust docproc.c, since the documentation in
U-Boot is located in doc/DocBook instead of Documentation/DocBook as is in
case of the Linux kernel.

Some parts of the DocBook Makefile are unused, but to allow easier sync with
Linux kernel, these parts are still left in. The targets enabled now are
"htmldocs" "pdfdocs" "psdocs" "xmldocs" and "cleandocs" to remove the results
of documentation build.

Linux scripts/docproc.c:
commit f0f3ca8d967462dafb815412b14ca3339b9817a6
Date: Wed Jun 15 11:53:13 2011 +0200

Linux scripts/kernel-doc:
commit 1b40c1944db445c1de1c47ffd8cd426167f488e8
Date: Sun Aug 12 10:46:15 2012 +0200

Linux Documentation/DocBook:
commit bb8187d35f820671d6dd76700d77a6b55f95e2c5
Date: Thu May 17 19:06:13 2012 -0400

Signed-off-by: Marek Vasut <marex@denx.de>

# 578f35a3 15-Jul-2012 Luka Perkov <uboot@lukaperkov.net>

tools: add kwboot binary to .gitignore file

Signed-off-by: Luka Perkov <uboot@lukaperkov.net>
Acked-by: Prafulla Wadaskar <Prafulla@marvell.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8b425b3f 27-Jul-2012 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

MIPS: fix renaming of inca-swap-bytes to xway-swap-bytes

Fix some remains of the renaming of inca-swap-bytes introduced in

commit 60b74bde9280e85f4423c05a50ecc41de56ad980

MIPS: INCA-IP: rename inca-swap-bytes host tool

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

# ca8a30ec 25-Nov-2011 Mike Frysinger <vapier@gentoo.org>

ignore new mkenvimage tool

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

# f29f7e02 08-Nov-2011 Marek Vasut <marek.vasut@gmail.com>

iMX28: Add image header generator tool

This tool can now generate proper image for "BootStream" files.

NOTE: This tool now works only for NAND.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>

# 8e0ec82e 14-Aug-2010 Mike Frysinger <vapier@gentoo.org>

tools: update .gitignore

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

# 8204e068 04-Nov-2009 Mike Frysinger <vapier@gentoo.org>

tools: gitignore *.exe binaries

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

# b074a708 04-Apr-2009 Mike Frysinger <vapier@gentoo.org>

tools: add ncb to gitignore

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

# fb8b33c1 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for remaining source files

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

# c0170175 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for fdt targets

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

# 45d6bdff 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Add libfdt/ to the include search path

This change makes the process of symlinking libfdt_internal.h
unnecessary

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

# fba0e3a0 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools: Remove unecessary symlinking of zlib.h

crc32.c uses the zlib.h header in include/u-boot/zlib.h. The symlink
was previously necessary to give U-Boot's version of zlib.h precedence
over the host computer's version of zlib.h.

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

# 0cf4fd3c 10-Sep-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

rename environment.c in env_embedded.c to reflect is functionality

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 31cfe574 14-Jul-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

tools/gitignore: update to all generated files

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 8ea08e5b 29-Apr-2008 Kumar Gala <galak@kernel.crashing.org>

Update .gitignore for zlib.h

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

# 766529fc 14-Mar-2008 Bartlomiej Sieka <tur@semihalf.com>

Add MD5 support to the new uImage format

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 8cf30809 29-Feb-2008 Bartlomiej Sieka <tur@semihalf.com>

[new uImage] Add libfdt support to mkimage

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 1b4aaffe 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

Add .gitignore files

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# 4d90f6cd 27-Oct-2019 Bin Meng <bmeng.cn@gmail.com>

tools: Avoid creating symbolic links for tools/version.h

When building U-Boot host tools for Windows from Microsoft Azure
Pipelines, the following errors were seen:

HOSTCC tools/mkenvimage.o
In file included from tools/mkenvimage.c:25:
./tools/version.h:1:1: error: expected identifier or ‘(’ before ‘.’ token
1 | ../include/version.h
| ^
tools/mkenvimage.c: In function ‘main’:
tools/mkenvimage.c:117:4: warning: implicit declaration of function ‘usage’ [-Wimplicit-function-declaration]
117 | usage(prg);
| ^~~~~
tools/mkenvimage.c:120:35: error: ‘PLAIN_VERSION’ undeclared (first use in this function)
120 | printf("%s version %s\n", prg, PLAIN_VERSION);
| ^~~~~~~~~~~~~
tools/mkenvimage.c:120:35: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [scripts/Makefile.host:114: tools/mkenvimage.o] Error 1

It turns out tools/version.h is a symbolic link and with Windows
default settings it is unsupported hence the actual content of
tools/version.h is not what file include/version.h has, but the
the linked file path, which breaks the build.

To fix this, remove the symbolic links for tools/version.h. Instead
we perform a copy from include/version.h during the build.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 08afd714 18-Aug-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

tools: Add ifwitool to .gitignore

Follow up fix to the commit

56bf4f863075 ("x86: Add ifwitool for Intel Integrated Firmware Image")

in order to ignore created binary.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c78b5cb7 11-Jun-2019 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

tools: add tools/spl_size_limit to ignore list

This tool has just been added but it seems I forgot to add it to
the ignore list. So to prevent the built binary being marked as
unversioned, add it to the ignore list.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 07c098b7 22-Nov-2018 Lukas Auer <lukas.auer@aisec.fraunhofer.de>

tools: .gitignore: add prelink-riscv

Ignore tools/prelink-riscv.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# ac020196 17-Jan-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: provide a tool to convert a binary file to an include

For testing EFI disk management we need an in-memory image of
a disk.

The tool file2include converts a file to a C include. The file
is separated into strings of 8 bytes. Only the non-zero strings
are written to the include. The output format has been designed
to maintain readability.

#define EFI_ST_DISK_IMG { 0x00010000, { \
{0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \
{0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \
{0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \
{0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \
...
{0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \
{0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \
{0, NULL} } }

As the disk image needed for testing contains mostly zeroes a high
compression ratio can be attained.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 15b97f5c 16-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile

The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.

Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.

I also rewrote the Makefile in a cleaner Kbuild style.

The scripts from the upstream have been moved as follows:

lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

The .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.

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

# eab44c93 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Add libfdt related files

Some files are generated during libfdt build. Ignore them.

This was wrongly put in the .gitignore in the root directory before.
Now let's remove entries there and put them in the right place.

Fixes: 34e2c285 ("gitignore: add intermediates from libfdt build")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# d11d3b2f 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Sort in alphabetical order

These are currently out of alphabetical order.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@imgtec.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 594b4cc7 27-Feb-2017 Maxime Ripard <maxime.ripard@free-electrons.com>

tools: sunxi: Add spl image builder

This program generates raw SPL images that can be flashed on the NAND with
the ECC and randomizer properly set up.

This has been copied (and tweaked to find the right headers) from the
sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream
repository, commit 1c3a6ca5.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# c25f01a6 25-Nov-2016 oliver@schinagl.nl <oliver@schinagl.nl>

tools: Add tool to add crc8 to a mac address

This patch adds a little tool that takes a generic MAC address and
generates a CRC byte for it. The output is the full MAC address without
any separators, ready written into an EEPROM.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 87c2f76f 22-May-2016 Robert P. J. Day <rpjday@crashcourse.ca>

tools: Add entry for generated tools/bin2header to tools/.gitignore

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

# 01124327 31-Jul-2015 Bin Meng <bmeng.cn@gmail.com>

gitignore: Add defconfig and fdtgrep

Ignore defconfig and tools/fdtgrep.

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

# 9c574877 25-Jul-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

tools: remove mpc86x_clk tool

This is commented out in the Makefile for more than 10 years.
I assume it is proof that this tool is unused.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Pantelis Antoniou <panto@intracom.gr>

# 908ec6e4 24-Nov-2014 Bin Meng <bmeng.cn@gmail.com>

tools: Add ifdtool to .gitignore

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

# bedcf395 24-Oct-2014 Andreas Bießmann <andreas.devel@googlemail.com>

gitignore: ignore atmel pmecc parameter tool

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 7050f0de 06-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

.gitignore: move *.exe pattern to the top gitignore for Cygwin

GCC on Cygwin generates executables with .exe extension,
for example:
scripts/basic/fixdep.exe
scripts/docproc.exe

To ignore them, *.exe pattern should be moved
from tools/.gitignore to ./.gitignore

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

# ad80c4a3 05-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild, tools: generate wrapper C sources automatically by Makefile

There are many source files shared between U-boot image and tools.
Instead of adding a lot of dummy wrapper files that just include
the corresponding file in lib/ or common/ directory,
Makefile should automatically generate them.

The original inspiration for this came from
scripts/Makefile.asm-generic of Linux Kernel.

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

# 50827a59 05-May-2014 Ian Campbell <ijc@hellion.org.uk>

sunxi: non-FEL SPL boot support for sun7i

Add support for booting from an MMC card.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Henrik Nordström <henrik@henriknordstrom.net>
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Reviewed-by: Marek Vasut <marex@denx.de>
Cc: Tom Cubie <Mr.hipboi@gmail.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 29a23f9d 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit_check_sign: verify a signed fit image

add host tool "fit_check_sign" which verifies, if a fit image is
signed correct.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>

# 6bf4ca07 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit: add fit_info host command

add fit_info command to the host tools. This command prints
the name, offset and the len from a property from a node in
a fit file. This info can be used to extract a properties
data with linux tools, for example "dd".

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

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

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>

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

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>

# 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>

# 84977e44 13-Jan-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

.gitignore: ignore u-boot.elf and tools/relocate-rela

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

# 475c506d 06-Dec-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile, .gitignore: Cleanup non-existing binaries

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

# a804b5ce 01-Dec-2013 Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>

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>

# 6c887b2a 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add proftool to decode profile data

This tool provides the facility to decode U-Boot trace data and write out
a text file in Linux ftrace format for use with pytimechart.

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

# 30ff8918 06-Oct-2012 Marek Vasut <marex@denx.de>

kerneldoc: Implant DocBook from Linux kernel

Pull slightly modified version of Documentation/DocBook, the related perl
script scripts/kernel-doc and the scripts/docproc.c from Linux kernel and
implant it into U-Boot. This will allow smooth generation of kerneldoc
style documentation.

It was necessary to modify the DocBook/Makefile to work with U-Boot build
system. The changes were only minor though and involved replacing the kbuild
specific parts.

It was also necessary to replace use of variables like KERNEL_VERSION with
U_BOOT_VERSION, strings like Linux kernel with U-Boot Bootloader etc. so
the generated result actually matches.

Finally, it was necessary to adjust docproc.c, since the documentation in
U-Boot is located in doc/DocBook instead of Documentation/DocBook as is in
case of the Linux kernel.

Some parts of the DocBook Makefile are unused, but to allow easier sync with
Linux kernel, these parts are still left in. The targets enabled now are
"htmldocs" "pdfdocs" "psdocs" "xmldocs" and "cleandocs" to remove the results
of documentation build.

Linux scripts/docproc.c:
commit f0f3ca8d967462dafb815412b14ca3339b9817a6
Date: Wed Jun 15 11:53:13 2011 +0200

Linux scripts/kernel-doc:
commit 1b40c1944db445c1de1c47ffd8cd426167f488e8
Date: Sun Aug 12 10:46:15 2012 +0200

Linux Documentation/DocBook:
commit bb8187d35f820671d6dd76700d77a6b55f95e2c5
Date: Thu May 17 19:06:13 2012 -0400

Signed-off-by: Marek Vasut <marex@denx.de>

# 578f35a3 15-Jul-2012 Luka Perkov <uboot@lukaperkov.net>

tools: add kwboot binary to .gitignore file

Signed-off-by: Luka Perkov <uboot@lukaperkov.net>
Acked-by: Prafulla Wadaskar <Prafulla@marvell.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8b425b3f 27-Jul-2012 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

MIPS: fix renaming of inca-swap-bytes to xway-swap-bytes

Fix some remains of the renaming of inca-swap-bytes introduced in

commit 60b74bde9280e85f4423c05a50ecc41de56ad980

MIPS: INCA-IP: rename inca-swap-bytes host tool

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

# ca8a30ec 25-Nov-2011 Mike Frysinger <vapier@gentoo.org>

ignore new mkenvimage tool

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

# f29f7e02 08-Nov-2011 Marek Vasut <marek.vasut@gmail.com>

iMX28: Add image header generator tool

This tool can now generate proper image for "BootStream" files.

NOTE: This tool now works only for NAND.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>

# 8e0ec82e 14-Aug-2010 Mike Frysinger <vapier@gentoo.org>

tools: update .gitignore

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

# 8204e068 04-Nov-2009 Mike Frysinger <vapier@gentoo.org>

tools: gitignore *.exe binaries

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

# b074a708 04-Apr-2009 Mike Frysinger <vapier@gentoo.org>

tools: add ncb to gitignore

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

# fb8b33c1 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for remaining source files

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

# c0170175 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for fdt targets

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

# 45d6bdff 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Add libfdt/ to the include search path

This change makes the process of symlinking libfdt_internal.h
unnecessary

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

# fba0e3a0 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools: Remove unecessary symlinking of zlib.h

crc32.c uses the zlib.h header in include/u-boot/zlib.h. The symlink
was previously necessary to give U-Boot's version of zlib.h precedence
over the host computer's version of zlib.h.

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

# 0cf4fd3c 10-Sep-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

rename environment.c in env_embedded.c to reflect is functionality

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 31cfe574 14-Jul-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

tools/gitignore: update to all generated files

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 8ea08e5b 29-Apr-2008 Kumar Gala <galak@kernel.crashing.org>

Update .gitignore for zlib.h

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

# 766529fc 14-Mar-2008 Bartlomiej Sieka <tur@semihalf.com>

Add MD5 support to the new uImage format

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 8cf30809 29-Feb-2008 Bartlomiej Sieka <tur@semihalf.com>

[new uImage] Add libfdt support to mkimage

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 1b4aaffe 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

Add .gitignore files

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# 08afd714 18-Aug-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

tools: Add ifwitool to .gitignore

Follow up fix to the commit

56bf4f863075 ("x86: Add ifwitool for Intel Integrated Firmware Image")

in order to ignore created binary.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c78b5cb7 11-Jun-2019 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

tools: add tools/spl_size_limit to ignore list

This tool has just been added but it seems I forgot to add it to
the ignore list. So to prevent the built binary being marked as
unversioned, add it to the ignore list.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 07c098b7 22-Nov-2018 Lukas Auer <lukas.auer@aisec.fraunhofer.de>

tools: .gitignore: add prelink-riscv

Ignore tools/prelink-riscv.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# ac020196 17-Jan-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: provide a tool to convert a binary file to an include

For testing EFI disk management we need an in-memory image of
a disk.

The tool file2include converts a file to a C include. The file
is separated into strings of 8 bytes. Only the non-zero strings
are written to the include. The output format has been designed
to maintain readability.

#define EFI_ST_DISK_IMG { 0x00010000, { \
{0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \
{0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \
{0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \
{0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \
...
{0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \
{0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \
{0, NULL} } }

As the disk image needed for testing contains mostly zeroes a high
compression ratio can be attained.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 15b97f5c 16-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile

The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.

Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.

I also rewrote the Makefile in a cleaner Kbuild style.

The scripts from the upstream have been moved as follows:

lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

The .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.

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

# eab44c93 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Add libfdt related files

Some files are generated during libfdt build. Ignore them.

This was wrongly put in the .gitignore in the root directory before.
Now let's remove entries there and put them in the right place.

Fixes: 34e2c285 ("gitignore: add intermediates from libfdt build")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# d11d3b2f 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Sort in alphabetical order

These are currently out of alphabetical order.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@imgtec.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 594b4cc7 27-Feb-2017 Maxime Ripard <maxime.ripard@free-electrons.com>

tools: sunxi: Add spl image builder

This program generates raw SPL images that can be flashed on the NAND with
the ECC and randomizer properly set up.

This has been copied (and tweaked to find the right headers) from the
sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream
repository, commit 1c3a6ca5.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# c25f01a6 25-Nov-2016 oliver@schinagl.nl <oliver@schinagl.nl>

tools: Add tool to add crc8 to a mac address

This patch adds a little tool that takes a generic MAC address and
generates a CRC byte for it. The output is the full MAC address without
any separators, ready written into an EEPROM.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 87c2f76f 22-May-2016 Robert P. J. Day <rpjday@crashcourse.ca>

tools: Add entry for generated tools/bin2header to tools/.gitignore

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

# 01124327 31-Jul-2015 Bin Meng <bmeng.cn@gmail.com>

gitignore: Add defconfig and fdtgrep

Ignore defconfig and tools/fdtgrep.

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

# 9c574877 25-Jul-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

tools: remove mpc86x_clk tool

This is commented out in the Makefile for more than 10 years.
I assume it is proof that this tool is unused.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Pantelis Antoniou <panto@intracom.gr>

# 908ec6e4 24-Nov-2014 Bin Meng <bmeng.cn@gmail.com>

tools: Add ifdtool to .gitignore

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

# bedcf395 24-Oct-2014 Andreas Bießmann <andreas.devel@googlemail.com>

gitignore: ignore atmel pmecc parameter tool

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 7050f0de 06-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

.gitignore: move *.exe pattern to the top gitignore for Cygwin

GCC on Cygwin generates executables with .exe extension,
for example:
scripts/basic/fixdep.exe
scripts/docproc.exe

To ignore them, *.exe pattern should be moved
from tools/.gitignore to ./.gitignore

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

# ad80c4a3 05-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild, tools: generate wrapper C sources automatically by Makefile

There are many source files shared between U-boot image and tools.
Instead of adding a lot of dummy wrapper files that just include
the corresponding file in lib/ or common/ directory,
Makefile should automatically generate them.

The original inspiration for this came from
scripts/Makefile.asm-generic of Linux Kernel.

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

# 50827a59 05-May-2014 Ian Campbell <ijc@hellion.org.uk>

sunxi: non-FEL SPL boot support for sun7i

Add support for booting from an MMC card.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Henrik Nordström <henrik@henriknordstrom.net>
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Reviewed-by: Marek Vasut <marex@denx.de>
Cc: Tom Cubie <Mr.hipboi@gmail.com>
Reviewed-by: Tom Rini <trini@ti.com>

# 29a23f9d 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit_check_sign: verify a signed fit image

add host tool "fit_check_sign" which verifies, if a fit image is
signed correct.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>

# 6bf4ca07 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit: add fit_info host command

add fit_info command to the host tools. This command prints
the name, offset and the len from a property from a node in
a fit file. This info can be used to extract a properties
data with linux tools, for example "dd".

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

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

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>

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

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>

# 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>

# 84977e44 13-Jan-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

.gitignore: ignore u-boot.elf and tools/relocate-rela

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

# 475c506d 06-Dec-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile, .gitignore: Cleanup non-existing binaries

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

# a804b5ce 01-Dec-2013 Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>

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>

# 6c887b2a 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add proftool to decode profile data

This tool provides the facility to decode U-Boot trace data and write out
a text file in Linux ftrace format for use with pytimechart.

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

# 30ff8918 06-Oct-2012 Marek Vasut <marex@denx.de>

kerneldoc: Implant DocBook from Linux kernel

Pull slightly modified version of Documentation/DocBook, the related perl
script scripts/kernel-doc and the scripts/docproc.c from Linux kernel and
implant it into U-Boot. This will allow smooth generation of kerneldoc
style documentation.

It was necessary to modify the DocBook/Makefile to work with U-Boot build
system. The changes were only minor though and involved replacing the kbuild
specific parts.

It was also necessary to replace use of variables like KERNEL_VERSION with
U_BOOT_VERSION, strings like Linux kernel with U-Boot Bootloader etc. so
the generated result actually matches.

Finally, it was necessary to adjust docproc.c, since the documentation in
U-Boot is located in doc/DocBook instead of Documentation/DocBook as is in
case of the Linux kernel.

Some parts of the DocBook Makefile are unused, but to allow easier sync with
Linux kernel, these parts are still left in. The targets enabled now are
"htmldocs" "pdfdocs" "psdocs" "xmldocs" and "cleandocs" to remove the results
of documentation build.

Linux scripts/docproc.c:
commit f0f3ca8d967462dafb815412b14ca3339b9817a6
Date: Wed Jun 15 11:53:13 2011 +0200

Linux scripts/kernel-doc:
commit 1b40c1944db445c1de1c47ffd8cd426167f488e8
Date: Sun Aug 12 10:46:15 2012 +0200

Linux Documentation/DocBook:
commit bb8187d35f820671d6dd76700d77a6b55f95e2c5
Date: Thu May 17 19:06:13 2012 -0400

Signed-off-by: Marek Vasut <marex@denx.de>

# 578f35a3 15-Jul-2012 Luka Perkov <uboot@lukaperkov.net>

tools: add kwboot binary to .gitignore file

Signed-off-by: Luka Perkov <uboot@lukaperkov.net>
Acked-by: Prafulla Wadaskar <Prafulla@marvell.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# 8b425b3f 27-Jul-2012 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

MIPS: fix renaming of inca-swap-bytes to xway-swap-bytes

Fix some remains of the renaming of inca-swap-bytes introduced in

commit 60b74bde9280e85f4423c05a50ecc41de56ad980

MIPS: INCA-IP: rename inca-swap-bytes host tool

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

# ca8a30ec 25-Nov-2011 Mike Frysinger <vapier@gentoo.org>

ignore new mkenvimage tool

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

# f29f7e02 08-Nov-2011 Marek Vasut <marek.vasut@gmail.com>

iMX28: Add image header generator tool

This tool can now generate proper image for "BootStream" files.

NOTE: This tool now works only for NAND.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>

# 8e0ec82e 14-Aug-2010 Mike Frysinger <vapier@gentoo.org>

tools: update .gitignore

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

# 8204e068 04-Nov-2009 Mike Frysinger <vapier@gentoo.org>

tools: gitignore *.exe binaries

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

# b074a708 04-Apr-2009 Mike Frysinger <vapier@gentoo.org>

tools: add ncb to gitignore

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

# fb8b33c1 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for remaining source files

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

# c0170175 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for fdt targets

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

# 45d6bdff 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Add libfdt/ to the include search path

This change makes the process of symlinking libfdt_internal.h
unnecessary

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

# fba0e3a0 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools: Remove unecessary symlinking of zlib.h

crc32.c uses the zlib.h header in include/u-boot/zlib.h. The symlink
was previously necessary to give U-Boot's version of zlib.h precedence
over the host computer's version of zlib.h.

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

# 0cf4fd3c 10-Sep-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

rename environment.c in env_embedded.c to reflect is functionality

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 31cfe574 14-Jul-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

tools/gitignore: update to all generated files

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# 8ea08e5b 29-Apr-2008 Kumar Gala <galak@kernel.crashing.org>

Update .gitignore for zlib.h

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

# 766529fc 14-Mar-2008 Bartlomiej Sieka <tur@semihalf.com>

Add MD5 support to the new uImage format

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 8cf30809 29-Feb-2008 Bartlomiej Sieka <tur@semihalf.com>

[new uImage] Add libfdt support to mkimage

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>

# 1b4aaffe 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

Add .gitignore files

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Kim Phillips <kim.phillips@freescale.com>

# ac020196 17-Jan-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

tools: provide a tool to convert a binary file to an include

For testing EFI disk management we need an in-memory image of
a disk.

The tool file2include converts a file to a C include. The file
is separated into strings of 8 bytes. Only the non-zero strings
are written to the include. The output format has been designed
to maintain readability.

#define EFI_ST_DISK_IMG { 0x00010000, { \
{0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \
{0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \
{0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \
{0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \
...
{0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \
{0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \
{0, NULL} } }

As the disk image needed for testing contains mostly zeroes a high
compression ratio can be attained.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>


# 15b97f5c 16-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile

The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.

Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.

I also rewrote the Makefile in a cleaner Kbuild style.

The scripts from the upstream have been moved as follows:

lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

The .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.

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


# eab44c93 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Add libfdt related files

Some files are generated during libfdt build. Ignore them.

This was wrongly put in the .gitignore in the root directory before.
Now let's remove entries there and put them in the right place.

Fixes: 34e2c285 ("gitignore: add intermediates from libfdt build")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>


# d11d3b2f 05-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

tools: .gitignore: Sort in alphabetical order

These are currently out of alphabetical order.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>


# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@imgtec.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>


# 594b4cc7 27-Feb-2017 Maxime Ripard <maxime.ripard@free-electrons.com>

tools: sunxi: Add spl image builder

This program generates raw SPL images that can be flashed on the NAND with
the ECC and randomizer properly set up.

This has been copied (and tweaked to find the right headers) from the
sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream
repository, commit 1c3a6ca5.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>


# c25f01a6 25-Nov-2016 oliver@schinagl.nl <oliver@schinagl.nl>

tools: Add tool to add crc8 to a mac address

This patch adds a little tool that takes a generic MAC address and
generates a CRC byte for it. The output is the full MAC address without
any separators, ready written into an EEPROM.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>


# 87c2f76f 22-May-2016 Robert P. J. Day <rpjday@crashcourse.ca>

tools: Add entry for generated tools/bin2header to tools/.gitignore

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>


# 01124327 31-Jul-2015 Bin Meng <bmeng.cn@gmail.com>

gitignore: Add defconfig and fdtgrep

Ignore defconfig and tools/fdtgrep.

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


# 9c574877 25-Jul-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

tools: remove mpc86x_clk tool

This is commented out in the Makefile for more than 10 years.
I assume it is proof that this tool is unused.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Pantelis Antoniou <panto@intracom.gr>


# 908ec6e4 24-Nov-2014 Bin Meng <bmeng.cn@gmail.com>

tools: Add ifdtool to .gitignore

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


# bedcf395 24-Oct-2014 Andreas Bießmann <andreas.devel@googlemail.com>

gitignore: ignore atmel pmecc parameter tool

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>


# 7050f0de 06-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

.gitignore: move *.exe pattern to the top gitignore for Cygwin

GCC on Cygwin generates executables with .exe extension,
for example:
scripts/basic/fixdep.exe
scripts/docproc.exe

To ignore them, *.exe pattern should be moved
from tools/.gitignore to ./.gitignore

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


# ad80c4a3 05-Jun-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild, tools: generate wrapper C sources automatically by Makefile

There are many source files shared between U-boot image and tools.
Instead of adding a lot of dummy wrapper files that just include
the corresponding file in lib/ or common/ directory,
Makefile should automatically generate them.

The original inspiration for this came from
scripts/Makefile.asm-generic of Linux Kernel.

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


# 50827a59 05-May-2014 Ian Campbell <ijc@hellion.org.uk>

sunxi: non-FEL SPL boot support for sun7i

Add support for booting from an MMC card.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Henrik Nordström <henrik@henriknordstrom.net>
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Reviewed-by: Marek Vasut <marex@denx.de>
Cc: Tom Cubie <Mr.hipboi@gmail.com>
Reviewed-by: Tom Rini <trini@ti.com>


# 29a23f9d 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit_check_sign: verify a signed fit image

add host tool "fit_check_sign" which verifies, if a fit image is
signed correct.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>


# 6bf4ca07 02-Mar-2014 Heiko Schocher <hs@denx.de>

tools, fit: add fit_info host command

add fit_info command to the host tools. This command prints
the name, offset and the len from a property from a node in
a fit file. This info can be used to extract a properties
data with linux tools, for example "dd".

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>


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

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>


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

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>


# 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>


# 84977e44 13-Jan-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

.gitignore: ignore u-boot.elf and tools/relocate-rela

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


# 475c506d 06-Dec-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

Makefile, .gitignore: Cleanup non-existing binaries

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


# a804b5ce 01-Dec-2013 Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>

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>


# 6c887b2a 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add proftool to decode profile data

This tool provides the facility to decode U-Boot trace data and write out
a text file in Linux ftrace format for use with pytimechart.

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


# 30ff8918 06-Oct-2012 Marek Vasut <marex@denx.de>

kerneldoc: Implant DocBook from Linux kernel

Pull slightly modified version of Documentation/DocBook, the related perl
script scripts/kernel-doc and the scripts/docproc.c from Linux kernel and
implant it into U-Boot. This will allow smooth generation of kerneldoc
style documentation.

It was necessary to modify the DocBook/Makefile to work with U-Boot build
system. The changes were only minor though and involved replacing the kbuild
specific parts.

It was also necessary to replace use of variables like KERNEL_VERSION with
U_BOOT_VERSION, strings like Linux kernel with U-Boot Bootloader etc. so
the generated result actually matches.

Finally, it was necessary to adjust docproc.c, since the documentation in
U-Boot is located in doc/DocBook instead of Documentation/DocBook as is in
case of the Linux kernel.

Some parts of the DocBook Makefile are unused, but to allow easier sync with
Linux kernel, these parts are still left in. The targets enabled now are
"htmldocs" "pdfdocs" "psdocs" "xmldocs" and "cleandocs" to remove the results
of documentation build.

Linux scripts/docproc.c:
commit f0f3ca8d967462dafb815412b14ca3339b9817a6
Date: Wed Jun 15 11:53:13 2011 +0200

Linux scripts/kernel-doc:
commit 1b40c1944db445c1de1c47ffd8cd426167f488e8
Date: Sun Aug 12 10:46:15 2012 +0200

Linux Documentation/DocBook:
commit bb8187d35f820671d6dd76700d77a6b55f95e2c5
Date: Thu May 17 19:06:13 2012 -0400

Signed-off-by: Marek Vasut <marex@denx.de>


# 578f35a3 15-Jul-2012 Luka Perkov <uboot@lukaperkov.net>

tools: add kwboot binary to .gitignore file

Signed-off-by: Luka Perkov <uboot@lukaperkov.net>
Acked-by: Prafulla Wadaskar <Prafulla@marvell.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>


# 8b425b3f 27-Jul-2012 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

MIPS: fix renaming of inca-swap-bytes to xway-swap-bytes

Fix some remains of the renaming of inca-swap-bytes introduced in

commit 60b74bde9280e85f4423c05a50ecc41de56ad980

MIPS: INCA-IP: rename inca-swap-bytes host tool

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


# ca8a30ec 25-Nov-2011 Mike Frysinger <vapier@gentoo.org>

ignore new mkenvimage tool

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


# f29f7e02 08-Nov-2011 Marek Vasut <marek.vasut@gmail.com>

iMX28: Add image header generator tool

This tool can now generate proper image for "BootStream" files.

NOTE: This tool now works only for NAND.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>


# 8e0ec82e 14-Aug-2010 Mike Frysinger <vapier@gentoo.org>

tools: update .gitignore

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


# 8204e068 04-Nov-2009 Mike Frysinger <vapier@gentoo.org>

tools: gitignore *.exe binaries

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


# b074a708 04-Apr-2009 Mike Frysinger <vapier@gentoo.org>

tools: add ncb to gitignore

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


# fb8b33c1 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for remaining source files

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


# c0170175 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Remove symlinks for fdt targets

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


# 45d6bdff 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools/Makefile: Add libfdt/ to the include search path

This change makes the process of symlinking libfdt_internal.h
unnecessary

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


# fba0e3a0 13-Mar-2009 Peter Tyser <ptyser@xes-inc.com>

tools: Remove unecessary symlinking of zlib.h

crc32.c uses the zlib.h header in include/u-boot/zlib.h. The symlink
was previously necessary to give U-Boot's version of zlib.h precedence
over the host computer's version of zlib.h.

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


# 0cf4fd3c 10-Sep-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

rename environment.c in env_embedded.c to reflect is functionality

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>


# 31cfe574 14-Jul-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

tools/gitignore: update to all generated files

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>


# 8ea08e5b 29-Apr-2008 Kumar Gala <galak@kernel.crashing.org>

Update .gitignore for zlib.h

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>


# 766529fc 14-Mar-2008 Bartlomiej Sieka <tur@semihalf.com>

Add MD5 support to the new uImage format

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>


# 8cf30809 29-Feb-2008 Bartlomiej Sieka <tur@semihalf.com>

[new uImage] Add libfdt support to mkimage

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>


# 1b4aaffe 24-Sep-2007 Grant Likely <grant.likely@secretlab.ca>

Add .gitignore files

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Kim Phillips <kim.phillips@freescale.com>