Commit Graph

1643 Commits

Author SHA1 Message Date
Peng Fan
47f7a9def7 tools: imx8image: flatten container header only when creating container
If there is no CONTAINER entry, there is no need to flatten container
header.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2018-11-06 11:24:10 +01:00
Peng Fan
a9f7f1c585 tools: imx8image: fix coverity CID 184233
Fix:
CID 184233:    (NEGATIVE_RETURNS)
Using variable "container" as an index to array "imx_header.fhdr".

Reported-by: Coverity
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2018-11-06 11:23:59 +01:00
Peng Fan
df439e938c tools: imx8image: fix coverity CID 184234
Fix:
CID 184234:    (TAINTED_SCALAR)
Using tainted variable "header.num_images - 1" as an index into an array "header.img".

Reported-by: Coverity
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2018-11-06 11:23:45 +01:00
Peng Fan
fc61cc2ca3 tools: imx8image: check lseek return value
Check lseek return value.

Fix Coverity CID: 184236 184235 184232

Reported-by: Coverity
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2018-11-06 11:23:27 +01:00
Daniel Schwierzeck
9630146411 MIPS: make size of relocation table fixed but configurable
Currently the size of the relocation table will be shrunk
to the actual size needed. Although this gives a maximal
space saving, it messes up the _end symbol. This breaks
features like appended DTBs because the _end symbol doesn't
point to the real end of the U-Boot binary.

Remove the size shrinking and make the size of the relocation
table fixed but configurable. This follows the Linux approach
and the user can adjust the size to his needs.

Also rename the relocation table section from .rel to .data.reloc
to follow the Linux approach and to avoid ambiguities with the
.rel.* sections added by the linker.

Reported-by: Lars Povlsen <lars.povlsen@microsemi.com>
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
2018-11-02 22:39:07 +01:00
Tom Rini
cf033e04da Merged imx8 architecture, fix build for imx8 + warnings
-----BEGIN PGP SIGNATURE-----
 
 iQHDBAABCgAtFiEEiZClFGvhzbUNsmAvKMTY0yrV63cFAlvRk0gPHHNiYWJpY0Bk
 ZW54LmRlAAoJECjE2NMq1et3IuAL/0jfCqEIzKbPXIz81zJ+43ZNPsyu4LluUFsP
 2s5+yKN4zPnxDaHmVyxKynREqCNCcbfz7biStEPRzIjQYPBWUWrqz1yceqvOTqWQ
 eh51ItNeow28IlnVEr40e5cNL28KPsAdO8Tx6yNiXdPndPOgm3DuFlT+Xbnv2/+P
 X9GYBoCD7EQ3aUJBDUKcN/AFSAl8YCQ43FKhowM18/ExeURiKk8YDRXVFgTDDd4J
 HIlzUbyeIG24xfmxc0MsUMEufMjqQE7k/tMfFvQJiwLBLkzuO+1WmbPlWd7XHqco
 t68mheBcm8m2G/CZJoxCy8ymUi5PKDJBhw3qQz646h+JiXP1lg7Yw8hf4nREV56k
 v/bMiDU1exIflI9Qf8CibxRAYv3bjKJD6p/uua2CIvsLO4emLPbi7DHFBdaQq+WB
 r32O0Xc6LiRBIhr/qeL/5HmxFT2o4lo+O9ybo10uhK8RA1LTPlQ0UNMwmSPLl4zR
 7e5YwnRCcHV492+/Fn31LWXUUVVxVw==
 =kkpS
 -----END PGP SIGNATURE-----

Merge tag 'u-boot-imx-20181025' of git://git.denx.de/u-boot-imx

Merged imx8 architecture, fix build for imx8 + warnings
2018-10-25 10:16:21 -04:00
Peng Fan
d79611598f imx: mkimage: avoid stop CI when required files not exists
Introduce a new script to check whether file exists and
use that check in Makefile to avoid break CI system.

The script return 1 when the required files not exists, return 0
when files exists. The script will ignore check to u-boot-dtb.bin,
because if there is something wrong to generate u-boot-dtb.bin,
there must be some code error.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2018-10-25 11:47:53 +02:00
Simon Glass
3ae192c2a4 binman: Add a test for Intel reference code
Unfortunately the test was not included in the original implementation.
Add one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-22 13:57:12 -04:00
Peng Fan
a2b96ece5b tools: add i.MX8/8X image support
i.MX8/8X bootable image type is container type.
The bootable image, containers a container set which supports two
container. The 1st container is for SECO firmware, the 2nd container
needs to include scfw, m4_0/1 image, ACore images per your requirement.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2018-10-22 13:01:27 +02:00
Simon Glass
27fb0cf1f0 binman: Add support for Intel reference code
Some platforms use this instead of FSP to set up the platform, including
memory. Add support for this in binman. This is needed for
chromebook_samus, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2018-10-22 17:51:45 +08:00
Simon Glass
41b781ddf1 dtoc: Fix the value of SetInt()
This does not set the correct value at present. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-09 04:40:27 -06:00
Simon Glass
741f2d620c binman: Move to three-digit test-file numbers
We now have 99 tests. Before adding any more, rename everything to three
digits. This helps to preserve the ordering of tests and makes it easier
to find things.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-09 04:40:27 -06:00
Simon Glass
11ae93eef4 binman: Run tests concurrently
At present the tests run one after the other using a single CPU. This is
not very efficient. Bring in the concurrencytest module and run the tests
concurrently, using one process for each CPU by default. A -P option
allows this to be overridden, which is necessary for code-coverage to
function correctly.

This requires fixing a few tests which are currently not fully
independent.

At some point we might consider doing this across all pytests in U-Boot.
There is a pytest version that supports specifying the number of processes
to use, but it did not work for me.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-08 07:34:34 -06:00
Simon Glass
008b030009 patman: Don't clear progress in tout unless it was used
At present calling Uninit() always called ClearProgress() which outputs
a \r character as well as spaces to remove any progress information on the
line. This can mess up the normal output of binman and other tools. Fix
this by outputing this only when progress information has actually been
previous written.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-08 07:34:34 -06:00
Simon Glass
1fda18205f tools: Set an initial value for indir
This variable is not documented or set up in the module. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-08 07:34:34 -06:00
Simon Glass
4b4bc06ef4 buildman: dtoc: Suppress unwanted output from test
There are a few test cases which print output. Suppress this so that tests
can run silently in the normal case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-08 07:34:34 -06:00
Simon Glass
86af511d89 binman: Separate out testSplBssPad()
At present this test runs binman twice, which means that the temporary
files from the first run do not get cleaned up. Split this into two tests
to fix this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-08 07:34:34 -06:00
Simon Glass
e0e6275f4c binman: Fix up removal of temporary directories
At present 'make check' leaves some temporary directories around. Part of
this is because we call tools.PrepareOutputDir() twice in some cases,
without calling tools.FinaliseOutputDir() in between.

Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-08 07:34:34 -06:00
Simon Glass
ed59e005e6 binman: Add a default path to libfdt.py
This module is often available in the sandbox_spl build created by
'make check'. Use this as a default path so that just typing 'binman -t'
(without setting PYTHONPATH) will generally run the tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-08 07:34:34 -06:00
Simon Glass
da753e35cb buildman: Make the toolchain test more forgiving
The filenames of the toolchains on kernel.org changes every now and then.
Fix it for the current change, and make the test use a regex so that it
has a better chance of passing with future changes too.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-08 07:34:34 -06:00
Simon Glass
ec9e0f4712 patman: Handle unicode in _ProjectConfigParser tests
With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-10-08 07:34:34 -06:00
Tom Rini
1b484736ce Merge branch 'master' of git://git.denx.de/u-boot-socfpga 2018-10-05 21:17:21 -04:00
Daniel Gröber
f25c1755a7 rockchip: Fix rkimage format for SPL boot over USB
The 'rkimage' format used for booting rockchip boards over USB seems to
have been broken since commit 7bf274b9ca ("rockchip: mkimage: use
imagename to select spl hdr & spl size"). That commit adds an offset of
RK_SPL_HDR_START(=2048) to the location the 'RKxx' header is written
at. However the bootrom expects this header to be the first four bytes of
the image, not at offset 2048. This appears to have been a copy paste
error since the 'rksd' and 'rkspi' image types do require this offset.

Furthermore commit 111bcc4fb6 ("rockchip: mkimage: pad the header to
8-bytes (using a 'nop') for RK3399"), commit 3d54eabcaf ("rockchip:
spl: RK3399: use boot0 hook to create space for SPL magic") and
commit 3082775692 ("rockchip: mkimage: update rkimage to support
pre-padded payloads") changed the way the space for the 'RKxx' header is
allocated and written to the image without adjusting 'rkimage'.

This commit fixes those mistakes and makes it possible to load u-boot SPL
over USB once more.

(Tested on RK3399)

Signed-off-by: Daniel Gröber <daniel@dps.uibk.ac.at>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2018-10-04 22:55:47 +02:00
Atsushi Nemoto
0ca8fd37ae tools: socfpga: fix sfp_verify_header
Fix sfp_verify_header to return correct version number.
This fixes "Not a sane SOCFPGA preloader" error message with v1 header.

Signed-off-by: Atsushi Nemoto <atsushi.nemoto@sord.co.jp>
2018-10-03 12:56:50 +02:00
Tom Rini
d24c1d0f4d Merge git://git.denx.de/u-boot-dm 2018-09-30 18:16:51 -04:00
Simon Glass
e62a24ce27 buildman: Avoid hanging when the config changes
Something has changed in the last several month such that when buildman
builds U-Boot incrementally and a new CONFIG option has been added to the
Kconfig, the build hanges waiting for input:

    Test new config (NEW_CONFIG) [N/y/?] (NEW)

Since binamn does not connect the build's stdin to anything this waits on
stdin to the build thread, which never comes. Eventually I suspect all the
threads end up in this state and the build does not progress.

Fix this by passing /dev/null as input to the build. That way, if there is
a new CONFIG, the build will stop (and fail):

    Test new config (NEW_CONFIG) [N/y/?] (NEW)

    Error in reading or end of file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-29 11:49:35 -06:00
Simon Glass
163ed6c342 binman: Allow writing a map file when something goes wrong
When we get a problem like overlapping regions it is sometimes hard to
figure what what is going on. At present we don't write the map file in
this case. However the file does provide useful information.

Catch any packing errors and write a map file (if enabled with -m) to aid
debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-29 11:49:35 -06:00
Simon Glass
fe1ae3ecc3 binman: Support ELF files for U-Boot and SPL
For sandbox we want to put ELF files in the image since that is what we
need to execute. Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-29 11:49:35 -06:00
Simon Glass
f8f8df6eb8 binman: Correct fmap output on x86
Normally x86 platforms use the end-at-4gb option. This currently produces
an FMAP with positions which have a large offset. The use of end-at-4gb is
a useful convenience within binman, but we don't really want to export
a map with these offsets.

Fix this by subtracting the 'skip at start' parameter.

Also put the code which convers names to fmap format, for clarity.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-29 11:49:35 -06:00
Simon Glass
08723a7abb binman: Record the parent section of each section
At present sections have no record of their parent so it is not possible
to traverse up the tree to the root and figure out the position of a
section within the image.

Change the constructor to record this information.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-29 11:49:35 -06:00
Simon Glass
f025363543 binman: Support x86 microcode in TPL
When TPL is used on x86 we may want to program the microcode (at least for
the first CPU) early in boot. Add support for this by refactoring the
existing code to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-29 11:49:35 -06:00
Simon Glass
e0e5df9310 binman: Support hashing entries
Sometimesi it us useful to be able to verify the content of entries with
a hash. Add an easy way to do this in binman. The hash information can be
retrieved from the device tree at run time.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-29 11:49:35 -06:00
Simon Glass
9c888cca5e binman: Mention section attributes in docs
Images and sections have the same attributes, since an image is mostly
just a top-level section. Update the docs to explain this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-29 11:49:35 -06:00
Simon Glass
ba64a0bbb7 binman: Support expanding entries
It is useful to have entries which can grow automatically to fill
available space. Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-29 11:49:35 -06:00
Simon Glass
0a98b28b06 binman: Support adding files
In some cases it is useful to add a group of files to the image and be
able to access them at run-time. Of course it is possible to generate
the binman config file with a set of blobs each with a filename. But for
convenience, add an entry type which can do this.

Add required support (for adding nodes and string properties) into the
state module.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-29 11:49:35 -06:00
Simon Glass
b4e1a38c29 binman: Allow zero-size sections
At present if there is only a zero-size entry in a section this is
reported as an error, e.g.:

   Offset 0x0 (0) is outside the section starting at 0x0 (0)

Adjust the logic in CheckEntries() to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-29 11:49:35 -06:00
Simon Glass
83d73c2f7c binman: Support compressed entries
Add support for compressing blob entries. This can help reduce image sizes
for many types of data. It requires that the firmware be able to
decompress the data at run-time.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-29 11:49:32 -06:00
Simon Glass
04187a845c patman: Detect missing tools and report them
When tools are needed but not present, at present we just get an error
which can be confusing for the user. Try to be helpful by reporting the
tool as missing and suggesting a possible remedy.

Also update the Run() method to support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28 11:09:01 -06:00
Simon Glass
6ed45ba0a8 binman: Support updating all device tree files
Binman currently supports updating the main device tree with things like
the position of each entry. Extend this support to SPL and TPL as well,
since they may need (a subset of) this information.

Also adjust DTB output files to have a .out extension since this seems
clearer than having a .dtb extension with 'out' in the name somwhere.

Also add a few missing comments and update the DT setup code to use
ReadFile and WriteFile().

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28 11:09:01 -06:00
Simon Glass
93d174135a binman: Allow control of whether a fake DT is used
We use a fake device tree in tests most of the time since tests don't
normally care about the actual data. For example, for U-Boot proper we use
U_BOOT_DTB_DATA which is just a four-character string. This makes testing
the image output against an expected value very easy.

However in some cases, such as when the test wants to check that the DT
output containing particular nodes, we do actually need the real DT. Add
support for this, along with a command-line option to select 'test mode'.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28 11:09:01 -06:00
Simon Glass
539aece516 binman: Obtain the list of device trees from the config
We always have a device tree for U-Boot proper. But we may also have one
for SPL and TPL. Add a new Entry method to find out what DTs an entry
has, and use that list when updating DTs.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28 11:09:01 -06:00
Simon Glass
f46621d255 binman: Centralise device-tree updates within binman
At present we have a few calls to device-tree functions in binman and plan
to add more as we add new entry types which need to report their results.

It makes sense to put this code in a central place so that we can make
sure all device trees are updated. At present we only have U-Boot proper,
but plan to add SPL and TPL too.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28 11:09:01 -06:00
Simon Glass
2a72cc72ca binman: Move state logic into the state module
Rather than reaching into this module from control, move the code that
needs this info into state.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28 11:09:01 -06:00
Simon Glass
c55a50f558 binman: Move state information into a new module
At present the control module has state information in it, since it is the
primary user of this. But it is a bit odd to have entries and other
modules importing control to obtain this information.

It seems better to have a dedicated state module, which control can use as
well. Create a new module using code from control and update other modules
to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28 11:09:01 -06:00
Simon Glass
6c234bfbf7 binman: Add an entry method for getting the default filename
Various entry implementations provide a way to obtain the default filename
for an entry. But at present there is no base-class implementation for
this function. Add one so that the API is defined.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28 11:09:01 -06:00
Simon Glass
746aee3f2f dtoc: Add a way to create an Fdt object from a data block
Support creating an Fdt object without having to write the data to a file
first.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28 11:09:01 -06:00
Simon Glass
6434961b2b dtoc: Add methods for adding and updating properties
Add a few more functions which allow creating and modifying property
values. If only we could do this so easily in the real world.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28 11:09:01 -06:00
Simon Glass
e21c27af47 dtoc: Support adding new nodes
Add a way to add new nodes and sync them back to the blob.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28 11:09:01 -06:00
Simon Glass
af53f5aafc dtoc: Fixed endianness in Prop.GetEmpty()
This should be big endian, since that is what device tree uses. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28 11:09:01 -06:00
Simon Glass
fa80c25c09 dtoc: Allow syncing of the device tree back to a file
At present we require the caller to manually update the device tree using
individual calls to libfdt functions. This is not ideal. It would be
better if we could make changes using the Python structure and then call a
Sync() function to write them back.

Add this feature to the Fdt class. Update binman and the tests to match.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28 11:09:01 -06:00