Commit Graph

947 Commits

Author SHA1 Message Date
Andreas Fenkart
43cb65b7a0 tools: env: bug: config structs must be defined in tools library
fw_senten/fw_printenv can be compiled as a tools library,
excluding the fw_env_main object.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
2016-03-27 09:13:03 -04:00
Andreas Fenkart
69067a34b1 tools: env: fw_parse_script: simplify removal of newline/carriage return
fgets returns when the first '\n' is found

Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
2016-03-26 18:49:29 -04:00
Andreas Fenkart
938c29ff41 tools: env: split fw_string_blank into skip_chars / skip_blanks
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
2016-03-26 18:49:29 -04:00
Andreas Fenkart
9583efcc74 tools: env: fw_string_blank: return from loop when item found
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
2016-03-26 18:49:29 -04:00
Andreas Fenkart
10667e15f4 tools: env: replace WHITESPACE macro by isblank
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
2016-03-26 18:49:29 -04:00
Kevin Smith
7497a6a1f1 tools: kwboot: Add xmodem timeout option
Add command-line specification of xmodem timeout.  If the binary
header needs to take a while to do something (e.g. DDR ECC
scrubbing), the xmodem transfer can time out.  Add a configurable
xmodem block timeout to allow transfers with slow binary headers
to succeed.

Signed-off-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
2016-03-24 10:08:49 +01:00
Kevin Smith
8669dacfb8 tools: kwboot: Clean up usage text
Usage text was getting unwieldy and somewhat incorrect.  The
usage summary implied that some options were mutually exclusive
(e.g. -q or -s).  Clean up the summary to just include the
important ones, and include a generic "[OPTIONS]" instead.

Signed-off-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
2016-03-24 10:08:38 +01:00
Simon Glass
5b15a2596f mkimage: Don't close the file if it wasn't opened
The error path for fit_import_data() is incorrect if the second open() call
fails.

Reported-by: Coverity (CID: 138489)
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-03-22 12:16:28 -04:00
Simon Glass
3bd3a54ac5 mkimage: Ensure file is closed in fdt_property_file()
The file that is opened is not closed in all cases. Fix it.

Reported-by: Coverity (CID: 138490)
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-03-22 12:16:27 -04:00
Simon Glass
7b0bbd886d mkimage: Fix missing free() and close() in fit_build()
Make sure that both the error path and normal return free the buffer and
close the file.

Reported-by: Coverity (CID: 138491)
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-03-22 12:16:27 -04:00
Simon Glass
21c2975a94 mkimage: Fix missing free() in fit_extract_data()
The 'buf' variable is not freed. Fix it.

Reported-by: Coverity (CID: 138492)
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-03-22 12:16:21 -04:00
Simon Glass
b97d71e26a mkimage: Fix error path in fit_extract_data()
The 'fdt' variable is not unmapped in all error cases. Fix this.

Reported-by: Coverity (CID: 138493)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-03-22 12:16:20 -04:00
Simon Glass
6e0ffce6cb mkimage: Add a missing free() to fit_import_data()
The space allocated to fdt is not freed on error. Fix it.

Reported-by: Coverity (CID: 138494)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-03-22 12:16:20 -04:00
Simon Glass
b12a81c4cc mkimage: Close the file when unable to get its size
There is a missing close() on the error path. Add it.

Reported-by: Coverity (CID: 138496)
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-03-22 12:16:19 -04:00
Simon Glass
f980ca3411 mkimage: Correct file being closed twice in fit_extract_data()
The code flows through to the end of the function, so we don't need another
close() before this. Remove it.

Reported-by: Coverity (CID: 138503)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-03-22 12:16:18 -04:00
Simon Glass
508b028a4c mkimage: Correct file being closed twice in fit_import_data()
The code flows through to the end of the function, so we don't need another
close() before this. Remove it.

Reported-by: Coverity (CID: 138504)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-03-22 12:16:17 -04:00
Simon Glass
9cff2d1e39 mkimage: Fix munmap() call when importing data
The munmap() call unmaps the wrong memory buffer. Fix it.

Reported-by: Coverity (CID: 138505)
Reported-by: Coverity (CID: 138495)
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-03-22 12:16:17 -04:00
Vagrant Cascadian
0e28065949 Fix spelling of "comment".
Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-03-22 12:16:13 -04:00
Tom Rini
8a7367acca cmd: Fix license command
The license command isn't usually built and has a few problems:
- The rules to generate license.h haven't worked in a long time,
  re-write these based on the bmp_logo.h rules.
- 'tok' is unused and the license text size has increased
- bin2header.c wasn't grabbing unistd.h to know the prototype for
  read().

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2016-03-22 12:16:13 -04:00
Simon Glass
c81d0d215e buildman: Clarify the use of -V
This option outputs to the log file, not to the terminal. Clarify that in
the help, and add a mention of it in the README.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stephen Warren <swarren@wwwdotorg.org>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
2016-03-17 21:27:39 -06:00
Simon Glass
17bce66cbf buildman: Add a way to specific a full toolchain prefix
At present buildman allows you to specify the directory containing the
toolchain, but not the actual toolchain prefix. If there are multiple
toolchains in a single directory, this can be inconvenient.

Add a new 'toolchain-prefix' setting to the settings file, which allows
the full prefix (or path to the C compiler) to be specified.

Update the documentation to match.

Suggested-by: Stephen Warren <swarren@wwwdotorg.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-17 21:27:39 -06:00
Simon Glass
d4c8572b71 buildman: Allow branch names which conflict with directories
At present if you try to use buildman with the branch 'test' it will
complain that it is unsure whether you mean the branch or the directory.
This is a feature of the 'git log' command that buildman uses. Fix it
by resolving the ambiguity.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2016-03-17 21:27:39 -06:00
Tom Rini
88033d737d Merge git://git.denx.de/u-boot-dm 2016-03-14 19:21:44 -04:00
Simon Glass
529fd18866 mkimage: Bring data into the FIT before processing
Since we now support data outside the FIT image, bring it into the FIT image
first before we do any processing. This avoids adding new functionality to
the core FIT code for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 19:18:30 -04:00
Simon Glass
722ebc8f84 mkimage: Support placing data outside the FIT
One limitation of FIT is that all the data is 'inline' within it, using a
'data' property in each image node. This means that to find out what is in
the FIT it is necessary to scan the entire file. Once loaded it can be
scanned and then the images can be copied to the correct place in memory.

In SPL it can take a significant amount of time to copy images around in
memory. Also loading data that does not end up being used is wasteful. It
would be useful if the FIT were small, acting as a directory, with the
actual data stored elsewhere.

This allows SPL to load the entire FIT, without the images, then load the
images it wants later.

Add a -E option to mkimage to request that it output an 'external' FIT.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 19:18:29 -04:00
Simon Glass
fb4cce0f98 mkimage: Support adding device tree files to a FIT
To make the auto-FIT feature useful we need to be able to provide a list of
device tree files on the command line for mkimage to add into the FIT. Add
support for this feature.

So far there is no support for hashing or verified boot using this method.
For those cases, a .its file must still be provided.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 19:18:29 -04:00
Simon Glass
8e35bb07eb mkimage: Support automatic creating of a FIT without a .its
At present, when generating a FIT, mkimage requires a .its file containing
the structure of the FIT and referring to the images to be included.

Creating the .its file is a separate step that makes it harder to use FIT.
This is not required for creating legacy images.

Often the FIT is pretty standard, consisting of an OS image, some device
tree files and a single configuration. We can handle this case automatically
and avoid needing a .its file at all.

To start with, support automatically generate the FIT using a new '-f auto'
option. Initially this only supports adding a single image (e.g. a linux
kernel) and a single configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 19:18:28 -04:00
Simon Glass
3837ce65bd tools: Add a function to obtain the size of a file
This will be used in mkimage when working out the required size of the FIT
based on the files to be placed into it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 19:18:27 -04:00
Simon Glass
d505a09c1e mkimage: Allow a FIT to include an image of any type
At present FIT images are set up by providing a device tree source file
which is a file with a .its extension. We want to support automatically
creating this file based on the image supplied to mkimage. This means that
even though the final file type is always IH_TYPE_FLATDT, the image inside
may be something else.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 19:18:27 -04:00
Simon Glass
e2070a8961 tools: Include fdt_sw.o in libfdt for mkimage
At present this file is omitted. It is used to build up a binary device
tree. We plan to do this in mkimage, so include this file in the build.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 19:18:27 -04:00
Simon Glass
608e399fde buildman: Allow the toolchain architecture to be specified
At present the architecture is deduced from the toolchain filename. Allow it
to be specified by the caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com
2016-03-14 15:34:50 -06:00
Simon Glass
ff690df9fc buildman: Allow the toolchain priority to be specified
At present the priority of a toolchain is calculated from its filename based
on hard-coded rules. Allow it to be specified by the caller. We will use
this in a later patch. Also display the priority and provide a message when
it is overriden by another toolchain of higher priority.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2016-03-14 15:34:50 -06:00
Simon Glass
ad24ebace1 buildman: Fix up a few code inconsistencies in toolchain.py
Normally we use a single quote for strings unless there is a reason not to
(such as an embedded single quote). Fix a few counter-examples in this file.
Also add a missing function-argument comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2016-03-14 15:34:50 -06:00
Simon Glass
2bdeade0ea buildman: patman: Fix -H when installed as a symlink
It is convenient to install symlinks to buildman and patman in the search
patch, such as /usr/local/bin. But when this is done, the -H option fails to
work because it looks in the directory containing the symlink instead of its
target. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2016-03-14 15:34:50 -06:00
Simon Glass
9ad96982e8 patman: Add a missing space in GetMetaDataForList()
Fix this nit to keep the code consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2016-03-14 15:34:50 -06:00
Simon Glass
9404fc85ab fdtgrep: Improve error handling with invalid device tree
This tool requires that the aliases node be the first node in the tree. But
when it is not, it does not handle things gracefully. In fact it crashes.

Fix this, and add a more helpful error message.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-03-14 15:34:50 -06:00
Simon Glass
cc7a64447b mkimage: Make 'params' static
This is not used outside mkimage.c, so make this variable static.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 14:19:11 -04:00
Simon Glass
1531034831 mkimage: Show an error message when usage() is called
Sometimes incorrect arguments are supplied but the reason is not obvious to
the user. Add some helpful messages.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 14:19:11 -04:00
Simon Glass
b0a487a4eb mkimage: Move usage() up to the top
To avoid a forward declaration, move the usage() function higher in the
file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 14:19:11 -04:00
Simon Glass
0745008145 mkimage: Sort the option processing code by option
Adjust the code so that option alphabetical order matches the order in the
switch() statement. This makes it easier to find options.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 14:19:10 -04:00
Simon Glass
a02221f29d mkimage: Convert to use getopt()
The current way of parsing arguments is a bit clumsy. It seems better to
use getopt() which is commonly used for this purpose.

Convert the code to use getopt() and make a few minor adjustments as needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 14:19:07 -04:00
Simon Glass
0b443dee6b mkimage: Move argument processing into its own function
At present main() is very long. Split out the argument processing to make
it easier to follow.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 14:19:01 -04:00
Tom Rini
05195b2cbe Merge git://git.denx.de/u-boot-dm 2016-02-25 10:35:23 -05:00
Albert ARIBAUD
070b781b2b patman: fix series-notes handling for buildman
A patman series with a 'Series-notes' section causes
buildman to crash with:

    self.series.notes += self.section
    TypeError: cannot concatenate 'str' and 'list' objects

Fix by initializing series.notes as a one-element array
rather than a scalar.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2016-02-24 20:06:19 -08:00
Bin Meng
e8aebc4744 tools: Update openrisc toolchain information
Since commit 87da2690ab
"openrisc: updating build tools naming convention", openrisc
kernel.org toolchain is out of date and cannot build U-Boot.
Update buildman and moveconfig tools to refer to the new one.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2016-02-24 18:44:11 -05:00
Andreas Bießmann
c6e3e8213a tools: -Wno-deprecated-declarations for OpenSSL on darwin
Since OpenSSL is deprecated on OS X in favour of Common Crypto API disable the
warning for this host OS.

Another solution would be to add some glue layer for crypto stuff, but I think
this is not worth the effort.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-02-24 18:43:58 -05:00
William Cohen
c190fbd010 Gracefully handle 64-bit signed-extended 32-bit Load addresses
To follow the MIPS 32-bit and 64-bit memory map conventions (*) recent
MIPS Linux kernels are using a 64-bit sign extended value
(0xffffffff80010000) for the 32-bit load address (0x80010000) of the
Creator CI20 board kernel.  When this 64-bit argument was passed to
mkimage running on a 32-bit machine such as the Creator CI20 board the
load address was incorrectly formed from the upper 32-bit sign-extend
bits (0xffffffff) by the strtoul instead of from the lower 32-bits
(0x80010000).  The mkimage should be able to tolerate the longer
sign-extended 64-bit version of the 32-bit arguments with the use of
strtoull.  Use of the strtoll in place of the strtol in mkimage.c
resolves the issue of self hosted kernel builds for the Creator CI20
board (+) and (++).

(*) http://techpubs.sgi.com/library/dynaweb_docs/0620/SGI_Developer/books/DevDriver_PG/sgi_html/ch01.html
(+) https://github.com/MIPS/CI20_linux/issues/23
(++) https://github.com/MIPS/CI20_linux/issues/22

Signed-off-by: William Cohen <wcohen@redhat.com>
2016-02-24 18:43:58 -05:00
Tom Rini
595af9db24 Merge branch 'master' of git://www.denx.de/git/u-boot-imx 2016-02-21 07:56:16 -05:00
Andreas Bießmann
3964311473 mxsboot: remove unused include
Commit 276d3ebb88 removed htole32() but missed
to remove the corresponding header. This is annoying, since BSD systems do not
have endian.h.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Michael Heimpold <mhei@heimpold.de>
2016-02-21 11:09:19 +01:00
Heiko Schocher
334a994a3c test, tools: introduce tbot README
introduce a README how to use tbot for testing U-Boot
and/or linux kernels.

Signed-off-by: Heiko Schocher <hs@denx.de>
2016-02-08 10:10:34 -05:00