Commit Graph

2272 Commits

Author SHA1 Message Date
Simon Glass
9ef0ceb730 buildman: Use spaces in the board list
At present the board names shown with -l are separated by commas. This
makes it hard to double-click to select a particular board. Also it is not
possible to select all boards and paste them as arguments to a subsequent
buildman run, since buildman requires spaces to separate the list on the
command line, not commas.

Change the output format to use spaces instead of commas.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21 06:33:47 -06:00
Simon Glass
8c9a2674ee buildman: Show the list of boards in magenta
It is quite hard to see the list of board for each error line since the
colour is the same as the actual error line. Show the board list in
magenta so that it is easier to distinguish them.

There is no point in checking the colour of the overall line, since there
are now multiple colours. So drop those tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21 06:33:47 -06:00
Simon Glass
35d696dbe5 buildman: Use an object to hold error lines
At present the string for each error line is created in _CalcErrorDelta()
and used to create the summary output. This is inflexible since all the
information (error/warning character, error line, list of boards with that
error line) is munged together in a string.

Create an object to hold this information and only convert it to a string
when printing the actual output.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21 06:33:47 -06:00
Simon Glass
5627bd9d96 buildman: Use yellow consistently for warning lines
At present warnings are shown in yellow in the summary (-s) but magenta in
the detail listing (-e). Use yellow in both.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21 06:33:47 -06:00
Simon Glass
e631a2b48a buildman: Test the output with --list-error-boards
Add a test to cover this flag, which adds the name of each board to each
error/warning line.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21 06:33:47 -06:00
Simon Glass
c9dd80b3d4 buildman: Add a test helper for creating a line prefix
The split/join code is repeated in a lot of places. Add a function to
handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21 06:33:47 -06:00
Simon Glass
ce558db34b buildman: Split out testOutput() into separate functions
We want to add a few more tests similar to testOutput(). Split its logic
into a function which runs buildman to get the output and another which
checks the output. This will make it easier to reuse the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21 06:33:47 -06:00
Simon Glass
af43065f8d buildman: Create temp directory in test setup
Rather than having a few tests handle this themselves, create the
temporary directory in the setUp() method and remove it in tearDown().
This will make it easier to add more tests.

Only testOutput and testGit() actually need it, but it doesn't add to the
test time noticeably to do this for all tests in this file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21 06:33:47 -06:00
Simon Glass
c3bc4f1fca buildman: Use an iterator to check test output
Rather than using the absolute array index, use an interator to work
through the expected output lines. This is easier to follow.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21 06:33:47 -06:00
Simon Glass
3c339bbd4c buildman: Add test coverage for error/warning colour
Buildman should output the right colours for each error/warning line. Some
of these checks are missing. Add them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21 06:33:47 -06:00
Simon Glass
b206d87d52 buildman: Refactor error-line output int a function
Reduce the amount of repeated code by creating an _OutputErrLines()
function to hold this code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-21 06:33:47 -06:00
Heinrich Schuchardt
2799a69ee8 doc: fix references to driver-model
Fix some errors pointed out by 'make refcheckdocs'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-17 12:32:36 -04:00
Thomas Hebb
ab5a2b0f79 mkimage: fit: don't create image with 0700 permissions
commit 7298e42250 ("mkimage: fit: add support to encrypt image with
aes") added a new copyfile() function as part of the FIT image creation
flow. This function as currently written creates the final image with a
mode of 0700 (before umask), differing from the old behavior of 0666.
Since there doesn't seem to be any reason to make the image executable
or non-group, non-other readable, change the mask to 0666 to preserve
the old behavior.

Fixes: 7298e42250 ("mkimage: fit: add support to encrypt image with aes")
Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2020-04-17 12:32:36 -04:00
Simon Glass
cf0ef9317c patman: Apply the cc limit to the cover letter also
Quite often on a series that has clean-up patches, the individual patches
may fit within the cc limit but the cover letter does not. Apply the same
limit to the cover letter.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
2020-04-16 08:07:58 -06:00
Simon Glass
4e9162d519 buildman: Drop the -a option
There is no point in setting the ARCH environment variable since the
U-Boot build system no-longer uses it.

It seems safe to drop this feature since it was only recently added.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2020-04-10 21:21:06 -04:00
Simon Glass
b2d89bc538 buildman: Allow building within a subdir of the current dir
This is useful in some situations, in particular with -w and when building
in-tree. Now that we are more careful about what we remove in
_PrepareOutputSpace(), it should be safe to relax this restriction.

Update the progress information also so it is clear what buildman is
doing. Remove files can take a long time.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-10 21:21:06 -04:00
Simon Glass
925f6adfa5 buildman: Be more selective about which directories to remove
At present buildman removes any directory it doesn't intend to write
output into. This is overly expansive since if the output directory
happens to be somewhere with existing files, they may be removed. Using
an existing directory for buildman is not a good practice, but since the
result might be catastrophic, it is best to guard against it.

A previous commit[1] fixed this by refusing to write to a subdirectory
of the current directory, assumed to have U-Boot source code. But we can
do better by only removing directories that look like the ones buildman
creates.

Update the code to do this and add a test.

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

[1] 409fc029c4 tools: buildman: Don't use the working dir as build dir
2020-04-10 21:21:06 -04:00
Simon Glass
7beb43c980 buildman: Allow ignoring warnings in the return code
Sometimes we don't want buildman to return failure if it seems warnings.
Add a -W option to support this. If buildman detects warnings (and no
errors) it will return an exit code of 0 (success).

Note that the definition of 'warnings' includes the migration warnings
produced by U-Boot, such as:

    ===================== WARNING ======================
    This board does not use CONFIG_DM_MMC. Please update
    ...
    ====================================================

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2020-04-10 21:21:06 -04:00
Simon Glass
f9c094bbce buildman: Update help for -d
This help is a bit ambiguous. It only does anything if asked to show size
changes with -S. Update the help and the function comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-10 21:21:06 -04:00
Simon Glass
d829f1217c bulidman: Add support for a simple build
It is useful to run a simple build and put all the output in a single
directory. Add a -w option to support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-10 21:21:06 -04:00
Simon Glass
e9fbbf633e buildman: Document the members of BuilderJob
This class has a few more members now. Add documentation for them and fix
a nit in the 'commits' comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-10 21:21:06 -04:00
Bin Meng
205254eab8 buildman: Support fetching gcc 9.2.0
This adds support to fetch gcc 9.2.0 toolchains.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2020-04-10 15:54:16 -04:00
Tom Rini
587e4a4296 kconfig / kbuild: Re-sync with Linux 4.19
Align Kconfig and Kbuild logic to Linux 4.19 release with minimal impact
on files outside of this scope.

Our previous Kconfig sync was done by commit 5972ff077e ("kconfig /
kbuild: re-sync with Linux 4.18").

In this particular re-sync in order to keep clang support working a
number of related changes needed to be pulled in that had been missed
previously.  Not all of these changes we easily traceable and so have
been omitted from the list below.

The imported Linux commits are:
[From prior to v4.18]
9f3f1fd29976 kbuild: Add __cc-option macro
d7f14c66c273 kbuild: Enable Large File Support for hostprogs
6d79a7b424a5 kbuild: suppress warnings from 'getconf LFS_*'
24403874316a Shared library support
86a9df597cdd kbuild: fix linker feature test macros when cross compiling with Clang
0294e6f4a000 kbuild: simplify ld-option implementation

[From v4.18 to v4.19]
96f14fe738b6 kbuild: Rename HOSTCFLAGS to KBUILD_HOSTCFLAGS
10844aebf448 kbuild: Rename HOSTCXXFLAGS to KBUILD_HOSTCXXFLAGS
b90a368000ab kbuild: Rename HOSTLDFLAGS to KBUILD_HOSTLDFLAGS
8377bd2b9ee1 kbuild: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS
f92d19e0ef9b kbuild: Use HOST*FLAGS options from the command line
4ab3b80159d4 kconfig: check for pkg-config on make {menu,n,g,x}config
693359f7ac90 kconfig: rename SYMBOL_AUTO to SYMBOL_NO_WRITE
f60b992e30ff kbuild: replace $(LDFLAGS) $(ldflags-y) with $(ld_flags)
2fb9279f2c3e kbuild: change ld_flags to contain LDFLAGS_$(@F)
c931d34ea085 arm64: build with baremetal linker target instead of Linux when available
5accd7f3360e kconfig: handle format string before calling conf_message_callback()
a2ff4040151a kconfig: rename file_write_dep and move it to confdata.c
0608182ad542 kconfig: split out useful helpers in confdata.c
adc18acf42a1 kconfig: remove unneeded directory generation from local*config
79123b1389cc kconfig: create directories needed for syncconfig by itself
16952b77d8b5 kconfig: make syncconfig update .config regardless of sym_change_count
d6c6ab93e17f kbuild: remove deprecated host-progs variable
56869d45e364 kconfig: fix the rule of mainmenu_stmt symbol
c151272d1687 kconfig: remove unused sym_get_env_prop() function
1880861226c1 kconfig: remove P_ENV property type
e3fd9b5384f3 scripts/dtc: consolidate include path options in Makefile
4bf6a9af0e91 kconfig: add build-only configurator targets
f1575595d156 kconfig: error out when seeing recursive dependency
5e8c5299d315 kconfig: report recursive dependency involving 'imply'
f498926c47aa kconfig: improve the recursive dependency report
98a4afbfafd2 kconfig: fix "Can't open ..." in parallel build
9a9ddcf47831 kconfig: suppress "configuration written to .config" for syncconfig
87a32e624037 kbuild: pass LDFLAGS to recordmcount.pl
d503ac531a52 kbuild: rename LDFLAGS to KBUILD_LDFLAGS
217c3e019675 disable stringop truncation warnings for now
bc8d2e20a3eb kconfig: remove a spurious self-assignment
fd65465b7016 kconfig: do not require pkg-config on make {menu,n}config
5a4630aadb9a ftrace: Build with CPPFLAGS to get -Qunused-arguments

Note that this adds new cleanup work to do in that we should adapt the
shared library support we have to what is now upstream.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
2020-04-10 11:18:32 -04:00
Tom Rini
1f47e2aca4 Xilinx changes for v2020.07
common:
 - Align ENV_FAT_INTERFACE
 - Fix MAC address source print log
 - Improve based autodetection code
 
 xilinx:
 - Enable netconsole
 
 Microblaze:
 - Setup default ENV_OFFSET/ENV_SECT_SIZE
 
 Zynq:
 - Multiple DT updates/fixes
 - Use DEVICE_TREE environment variable for DTB selection
 - Switch to single zynq configuration
 - Enable NOR flash via DM
 - Minor SPL print removal
 - Enable i2c mux driver
 
 ZynqMP:
 - Print multiboot register
 - Enable cache commands in mini mtest
 - Multiple DT updates/fixes
 - Fix firmware probing when driver is not enabled
 - Specify 3rd backup RAM boot mode in SPL
 - Add SPL support for zcu102 v1.1 and zcu111 revA
 - Redesign debug uart enabling and psu_init delay
 - Enable full u-boot run from EL3
 - Enable u-boot.itb generation without ATF with U-Boot in EL3
 
 Versal:
 - Enable distro default
 - Enable others SPI flashes
 - Enable systems without DDR
 
 Drivers:
 - Gem:
   - Flush memory after freeing
   - Handle mdio bus separately
 - Watchdog:
   - Get rid of unused global data pointer
   - Enable window watchdog timer
 - Serial:
   - Change reinitialization logic in zynq serial driver
 -----BEGIN PGP SIGNATURE-----
 
 iF0EABECAB0WIQQbPNTMvXmYlBPRwx7KSWXLKUoMIQUCXoxw9wAKCRDKSWXLKUoM
 IbQxAKCK23yTy4FoN8oTGTYsbmLOA9kVUQCbBx8lg4nBeA8ihSaAnY+HMDF37YI=
 =Lg54
 -----END PGP SIGNATURE-----

Merge tag 'xilinx-for-v2020.07' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2020.07

common:
- Align ENV_FAT_INTERFACE
- Fix MAC address source print log
- Improve based autodetection code

xilinx:
- Enable netconsole

Microblaze:
- Setup default ENV_OFFSET/ENV_SECT_SIZE

Zynq:
- Multiple DT updates/fixes
- Use DEVICE_TREE environment variable for DTB selection
- Switch to single zynq configuration
- Enable NOR flash via DM
- Minor SPL print removal
- Enable i2c mux driver

ZynqMP:
- Print multiboot register
- Enable cache commands in mini mtest
- Multiple DT updates/fixes
- Fix firmware probing when driver is not enabled
- Specify 3rd backup RAM boot mode in SPL
- Add SPL support for zcu102 v1.1 and zcu111 revA
- Redesign debug uart enabling and psu_init delay
- Enable full u-boot run from EL3
- Enable u-boot.itb generation without ATF with U-Boot in EL3

Versal:
- Enable distro default
- Enable others SPI flashes
- Enable systems without DDR

Drivers:
- Gem:
  - Flush memory after freeing
  - Handle mdio bus separately
- Watchdog:
  - Get rid of unused global data pointer
  - Enable window watchdog timer
- Serial:
  - Change reinitialization logic in zynq serial driver

Signed-off-by: Tom Rini <trini@konsulko.com>
2020-04-07 17:13:35 -04:00
Simon Glass
72188f5462 image: Use constants for 'required' and 'key-name-hint'
These are used in multiple places so update them to use a shared #define.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-04-01 07:45:09 -06:00
Simon Glass
c3aa81e35c fit_check_sign: Allow selecting the configuration to verify
This tool always verifies the default configuration. It is useful to be
able to verify a specific one. Add a command-line flag for this and plumb
the logic through.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-01 07:45:09 -06:00
Simon Glass
382cf62039 image: Be a little more verbose when checking signatures
It is useful to be a little more specific about what is being checked.
Update a few messages to help with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-01 07:45:09 -06:00
Tom Rini
2b18b89156 Merge branch 'next' of git://git.denx.de/u-boot-usb into next 2020-03-31 17:24:19 -04:00
Miquel Raynal
e5a405583f rockchip: mkimage: Use an existing macro instead of a decimal value
Depending on the SoC, a header of four characters is prepended to the
image. There is already a macro defining the number of characters:
RK_SPL_HDR_SIZE, so use it instead of hardcoding "4".

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2020-03-26 22:58:46 +08:00
AKASHI Takahiro
b983cc2da0 lib: rsa: decouple rsa from FIT image verification
Introduce new configuration, CONFIG_RSA_VERIFY which will decouple building
RSA functions from FIT verification and allow for adding a RSA-based
signature verification for other file formats, in particular PE file
for UEFI secure boot.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-03-12 08:20:38 -04:00
Markus Klotzbuecher
4f5c5e99bb moveconfig: convert ps.stderr to string
Printing the error message in verbose mode fails, since python3
doesn't implicitely convert bytes to strings.

Signed-off-by: Markus Klotzbuecher <mk@mkio.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-02-25 13:46:25 -05:00
Markus Klotzbuecher
b3192f48c1 moveconfig: replace unsafe eval with asteval
Commit b237d358b4 ("moveconfig: expand simple expressions") added
support for expanding expressions in configs, but used the unsafe python
built-in "eval". This patch fixes this by replacing eval with the
asteval module.

Signed-off-by: Markus Klotzbuecher <mk@mkio.de>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-02-25 13:46:25 -05:00
Philippe Reynes
a3ca99c260 tools: image-host.c: remove uboot_aes.h
The include uboot_aes.h is not useful and
it breaks the compilation on android, so
we remove it.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reported-by: Praneeth Bajjuri <praneeth@ti.com>
2020-02-25 11:29:39 -05:00
Antonio Borneo
441749d9d1 tools: mkimage: fix STM32 image format for big endian hosts
Two header fields are not properly converted to little endian
before assignment, resulting in incorrect header while executing
mkimage on big endian hosts.

Convert the value of the header fields image_checksum and
edcsa_algorithm to little endian before the assignment.

Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-02-13 17:32:09 +01:00
Tom Rini
9a8942b53d sandbox conversion to SDL2
TPM TEE driver
 Various minor sandbox video enhancements
 New driver model core utility functions
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAl48iogACgkQfxc6PpAI
 reaVzAf/an3/yKe6r3CVWlcRV6H/dVg1ApnnLpX7jS0p0b++oCVvOiy7z1WPXj3k
 b1SSgENDeeZ/8EHio+Gf7ZidH/TGEj7L6YEFwd1t60GMkZiWEkNf4Z53tw482YG+
 96hoPD+ySTW+ddIdVHWAFG2I4aEiKHANJAp/ItNdD+rLbrEwNQy+eiK5JTOk80B6
 /X8AJCLZeAC1s7vs+2+WolgjT78QGzA9HHalMiublcqh0ivKKk0QeQiOKKPe8JYJ
 om5YY1TxayQ60Xmo5f39/SBfzEEklxw83sU9o1tBeYzyVUpu7fQdkxiDbWdsij77
 DgwLdeYQJGbN+hdSWE0gjTqyhW+lWA==
 =KRoA
 -----END PGP SIGNATURE-----

Merge tag 'dm-pull-6feb20' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

sandbox conversion to SDL2
TPM TEE driver
Various minor sandbox video enhancements
New driver model core utility functions
2020-02-11 10:58:41 -05:00
Sébastien Szymanski
4cfeb8df31 tools: imx8m_image: fix warning message
When a firmware file is missing the warning message doesn't indicate the
firmware file name because '$tmp' var doesn't exist.
Fix the warning message and while at it reduce the if/else statement.

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
2020-02-09 14:57:38 +01:00
Matthias Brugger
2f7c53cbd3 buildman: Enable buildman on aarch64 hosts
At kernel.org aarch64 toolchains are published in folder
arm64. Fix the URL for that case, so that we can fetch
toolchains on aarch64 machines.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-02-05 19:33:46 -07:00
Flavio Suligoi
9de5c397b2 tools: buildman: fix typo
Signed-off-by: Flavio Suligoi <f.suligoi@asem.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-01-30 13:30:35 -05:00
Heinrich Schuchardt
e4e355f6e4 tools: correct Markdown in concurrencytest/README.md
Remove incorrect indentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-30 13:30:35 -05:00
Baruch Siach
3166014d57 genboardscfg.py: drop python version comment
genboardscfg.py requires python 3.x since commit 3bc14098d8
("genboardscfg.py: Convert to Python 3").

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-25 12:04:36 -05:00
Patrick Delaunay
dae188e683 tools: ftdgrep: correct the find regions loop in do_fdtgrep
Use realloc and update the loop executed in do_fdtgrep to find all
the regions: only test count > max_region after the second pass.

This patch solve an issue if the number of region found (count)
is greater then the default value (max_region = count = 100):
the second pass is never executed, because the loop stops after
the first pass (i = 0, count > 100, max_regions = 100)
with error -1 and the error message
"Internal error with fdtgrep_find_region".

I also update the error message.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-01-24 12:33:08 -05:00
Philippe Reynes
4df3578119 u-boot: fit: add support to decrypt fit with aes
This commit add to u-boot the support to decrypt
fit image encrypted with aes. The FIT image contains
the key name and the IV name. Then u-boot look for
the key and IV in his device tree and decrypt images
before moving to the next stage.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-01-17 10:16:29 -05:00
Philippe Reynes
7298e42250 mkimage: fit: add support to encrypt image with aes
This commit add the support of encrypting image with aes
in mkimage. To enable the ciphering, a node cipher with
a reference to a key and IV (Initialization Vector) must
be added to the its file. Then mkimage add the encrypted
image to the FIT and add the key and IV to the u-boot
device tree.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-01-17 10:15:49 -05:00
Heinrich Schuchardt
5819466dc1 mkimage: simplify fit_check_params()
fit_check_params() wants at least two of dflag, fflag, and lflag set.

Simplify the logical constraint checking this.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-10 14:18:26 -05:00
Tom Rini
d6b92b9742 dm: Increased separation of ofdata_to_platdata() and probe methods
-----BEGIN PGP SIGNATURE-----
 
 iQFFBAABCgAvFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAl4WGTURHHNqZ0BjaHJv
 bWl1bS5vcmcACgkQfxc6PpAIreaB9wf+P/DA1udn1JKSL7sGkqzXlWGtC6qTU5eY
 em6GpotS3BiJx40vvKCYc1LbVbVEwXNKvs0AcxvqTxA+9ZiNAFERjbtmxPaqFUHe
 +vBcqTkYOSOIoSkWTAK+leqVirfGQULdLhITI7sHoF+37UbsDKlSlHjHQZ4XL9Xn
 fey1eGNaT+QThJ23GTZtZJAHUzoK870+qUhkqifUdHpvnxOJ/j75/AU7zNYlJJHW
 12H3DqeoBRnQU0sPsyY/4Bm0e5+GalYMS9XCcWKxxFqPh7/NQoV7Z7yqvKsm7KXc
 2VsZk8D+3lU4486JKpfOeCcdUCfgNPSR35AQwQttzNNc9nfYJRpfxA==
 =56sP
 -----END PGP SIGNATURE-----

Merge tag 'dm-pull-8jan20' of git://git.denx.de/u-boot-dm

dm: Increased separation of ofdata_to_platdata() and probe methods
2020-01-09 08:52:21 -05:00
Masahiro Yamada
f6a8c0f468 binman: fix default filename of u-boot-with-ucode-ptr in documentation
The suffix should be ".bin" instead of ".dtb" .

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-01-07 16:02:39 -07:00
Andrew F. Davis
e3cd06be93 tools: dumpimage: Fall-though to print usage for help command
This has the same result but some compilers will warn about this
fall-through if there are statements as part of the label block.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-01-07 11:12:47 -05:00
Andrew F. Davis
e5b5628e8a tools: fit_image: Use fit_image_get_data_and_size for getting offset/size
This is very similar to fit_image_get_data but has the benefit of working
on FIT images with external data unlike fit_image_get_data. This is
useful for extracting sub-images from type of FIT image as this would
previously just silently fail. Add an error message also so if this
still fails it is easier to find out why.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-01-07 11:12:46 -05:00
Andrew F. Davis
79e984c470 tools: dumpimage: Provide more feedback on internal errors
The dumpimage utility errors out in a number of places without providing
sufficient feedback to allow the user to easily determine what has gone
wrong. Add additional error messages to make the cause of the failure
more obvious.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-01-07 11:12:46 -05:00
Tom Rini
d8a3f5259a New for 2020.04
---------------
 
 - New boards
 	Embedded Artists COM board
 	Xea Board
 - Switch to DM:
 	Aristainetos boards
 	Toradex colibri (DM_ETH)
 	iCubox
 	GE bx50v3
 	mx7dsabre (DM_ETH)
 	cx9020
 - New features:
 	Bootaux with elf files
 	Default SYS_THUMB_BUILD for i.MX6/7
 - Fixes:
 	DHCOM i.MX6 PDK
 	Engicam
 	i.MX8M tools (imx8m_image)
 
 Travis: https://travis-ci.org/sbabic/u-boot-imx/builds/633679664
 -----BEGIN PGP SIGNATURE-----
 
 iQHDBAABCgAtFiEEiZClFGvhzbUNsmAvKMTY0yrV63cFAl4UhxIPHHNiYWJpY0Bk
 ZW54LmRlAAoJECjE2NMq1et3MZYMAMEttt0cNxBg0/zBjNuMSn3Bq1lpN+KKsY97
 Cme06wZQdlbdfHhXyKiVfky2vjrZa1nacUgqSQlJdzvsPQbg9TE/8zxTd13BNw6C
 Tn6IHS7godvz9Puf0HD8skoYBpVm/LQKmSEfcPAEGOSnHzZx/MrMU0Qze3PgqWu5
 0xbp8yBsyVw96/zBRZtbwXy4COuS1viFrbf82EgHAZUsmXpgvJB59i8rOewwWNR1
 TpyhPbHlq42X+0Qrwq0RGtUr+t4tI6czlxeReOBgb1/YqJGJ6rEqbGm90XROW3sA
 IeU5PY7LUk8OFRQtyfBSSYgFgFmgOYzfpXe9YSUoIxV55OvCad7ksaRctjPJnKqy
 CndINrG9JnV9T5N0LczAgVFXWT49ybPziyZRDHERDg1XosuHnNk7r0co05uacYUN
 ZFgB21mzQ8qGPAd1C3tMXG05ZA9cdRCmWxKxxF6z2/2FT15euZQ0obwAR1HsiJmZ
 wLbyPl1Hi7ZkwvTT/Wk3se0zGpNj2A==
 =vOZ+
 -----END PGP SIGNATURE-----

Merge tag 'u-boot-imx-20200107' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

New for 2020.04
---------------

- New boards
	Embedded Artists COM board
	Xea Board
- Switch to DM:
	Aristainetos boards
	Toradex colibri (DM_ETH)
	iCubox
	GE bx50v3
	mx7dsabre (DM_ETH)
	cx9020
- New features:
	Bootaux with elf files
	Default SYS_THUMB_BUILD for i.MX6/7
- Fixes:
	DHCOM i.MX6 PDK
	Engicam
	i.MX8M tools (imx8m_image)

Travis: https://travis-ci.org/sbabic/u-boot-imx/builds/633679664
2020-01-07 08:45:43 -05:00
Frieder Schrempf
162c72c804 tools: imx8m_image: Change source path for DDR firmware to build dir
The DDR firmware binaries are not part of the U-Boot source code, so
we should look for them in the build directory, where they need to be
copied to before building U-Boot.

The ATF binary is already fetched from the build directory, but the
README files for the i.MX8M EVKs claim that it needs to be copied to
the source directory (which is still true for in-tree builds, but not
in general). Therefore we also fix the READMEs to use the build
directory as the correct location for all additional binary files.

Sined-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
2020-01-07 10:26:57 +01:00
Tom Rini
5a8fa095cb Merge branch 'next'
Bring in the following merges:

commit 8fbbec12f7
Merge: 87f69f467a 63618e71e8
Author: Tom Rini <trini@konsulko.com>
Date:   Fri Jan 3 09:48:47 2020 -0500

    Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq into next

    - updates and fixes on ls1028a, lx2, ls1046a, MC-DPSPARSER support

commit 87f69f467a
Merge: c0912f9bbf 4466b99703
Author: Tom Rini <trini@konsulko.com>
Date:   Tue Dec 24 08:18:19 2019 -0500

    Merge https://gitlab.denx.de/u-boot/custodians/u-boot-mpc85xx into next

    - Enable DM driver on ppc/km boards
    - Enable DM_USB for some of NXP powerpc platforms: P5040, T4240, T208x,
      T104x, P4080, P2041, P2020, P1020, P3041
    - Some updates in mpc85xx-ddr driver, km boards

commit c0912f9bbf
Merge: 533c9f5714 a1d6dc3f84
Author: Tom Rini <trini@konsulko.com>
Date:   Wed Dec 18 07:20:19 2019 -0500

    Merge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-x86 into next

    - Various x86 common codes updated for TPL/SPL
    - I2C designware driver updated for PCI
    - ICH SPI driver updated to support Apollo Lake
    - Add Intel FSP2 base support
    - Intel Apollo Lake platform specific drivers support
    - Add a new board Google Chromebook Coral

commit 533c9f5714
Merge: 553cb06887 033e18b47b
Author: Tom Rini <trini@konsulko.com>
Date:   Tue Dec 17 07:53:08 2019 -0500

    Merge tag '20191217-for-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-i2c into next

    i2c: for next
    - misc: i2c_eeprom:
      Add partition support and add ability to query size
      of eeprom device and partitions
    - i2c common:
      add support for offset overflow in to address and add
      sandbox tests for it.

commit 553cb06887
Merge: f39abbbc53 b4f98b3b16
Author: Tom Rini <trini@konsulko.com>
Date:   Thu Dec 12 08:18:59 2019 -0500

    Merge tag 'dm-next-13dec19' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm into next

    buildman improvements including toolchain environment feature
    sandbox unicode support in serial
2020-01-06 17:07:49 -05:00
Tom Rini
28aa6dc29a Merge tag 'u-boot-rockchip-20191231' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip
- Fix latest mainline kernel for rk3308
- Update rk3288-evb config to suport OP-TEE
- Fix for firefly-px30 DEBUG_UART channel and make it standalone
- Script make_fit_atf add python3 support
- Fix rk3328 timer with correct COUNTER_FREQUENCY
- Fix rk3328 ATF support with enable spl-fifo-mode
2020-01-02 10:28:26 -05:00
Dario Binacchi
e198bb51dd 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>
2020-01-02 10:27:23 -05:00
Jorge Ramirez-Ortiz
e97bdfa5da tools/imximage: share DCD information via Kconfig
IMX based platforms can have the DCD table located on different
addresses due to differences in their memory maps (ie iMX7ULP).

This information is required by the user to sign the images for secure
boot so continue making it accessible via mkimage.

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>
2019-12-27 12:55:59 +01:00
Jeffy Chen
f43b0d49c0 rockchip: mkimage: fix wrong range of rc4 encoding for boot image
The rc4 encoding should cover spl header as well, and the file_size
contains spl header too.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2019-12-27 15:17:07 +08:00
Jeffy Chen
eea6cd8d7c rockchip: mkimage: support packing optional second level boot-loader
Support packing optional second level boot-loader:

$ ./tools/mkimage -n rk3399 -T rksd -d \
  rk3399_ddr_800MHz_v1.24.bin:rk3399_miniloader_v1.19.bin out -v
Adding Image rk3399_ddr_800MHz_v1.24.bin
Size 116492(pad to 116736)
Adding Image rk3399_miniloader_v1.19.bin
Size 88060(pad to 88064)
Image Type:   Rockchip RK33 (SD/MMC) boot image
Init Data Size: 116736 bytes
Boot Data Size: 88064 bytes

Mainly parse init file and boot file from datafile option, copy them to
the image with 2KB alignment.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2019-12-27 15:17:07 +08:00
Rasmus Villemoes
c62e6142b9 fw_setenv: avoid writing environment when nothing has changed
In the case where one deletes an already-non-existing variable, or sets
a variable to the value it already has, there is no point in writing the
environment back, thus reducing wear on the underlying storage
device.

In the case of redundant environments, if the two environments
differ (e.g. because one is corrupt), make sure that any call of
fw_setenv causes the two to become synchronized, even if the fw_setenv
call does not change anything in the good copy.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2019-12-20 10:02:24 -06:00
Tom Rini
d08c38c32f buildman: Ignore blank lines during size checks
Today when parsing the .sizes files we get a warning about an invalid
line in the file as it's blank.  Solve this by checking that we have a
non-blank line prior to processing.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-12-10 21:11:31 -07:00
Simon Glass
57cb9d5239 buildman: Add options to get the arch and toolchain info
Sometimes it is useful for external tools to use buildman to provide the
toolchain information. Add an -a option which shows the value to use for
the ARCH environment variable, and -A which does the same for
CROSS_COMPILE

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-12-10 21:11:31 -07:00
Simon Glass
7c66ead452 buildman: Figure out boards before commits
At present buildman looks at toolchains, then commits and then boards.
Move the board processing up above the commit processing, since it relates
to the toolchain code. This will make it easier to check the toolchains
needed for a board without processing commits first.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-12-10 21:11:31 -07:00
Simon Glass
6a3fc91ea7 buildman: Ask genboardscfg to be quiet
Now that this tool has a 'quiet' flag, use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-12-10 21:11:31 -07:00
Simon Glass
69bbdd112b genboardcfg: Support a quiet mode
We don't really need buildman to print this every time it runs. Add a flag
to run quietly, that buildman can use.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-12-10 21:11:30 -07:00
Cristian Ciocaltea
4251fbc6fb buildman: Improve [make-flags] section parser to allow quoted strings
The parser responsible for the '[make-flags]' section in
the '.buildman' settings file is currently not able to
handle quoted strings, as given in the sample bellow:

[make-flags]
qemu_arm=HOSTCC="cc -isystem /add/include" HOSTLDFLAGS="-L/add/lib"

This patch replaces the simple string splitter based on the <space>
delimiter with a regex tokenizer that preserves spaces inside double
quoted strings.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
2019-12-10 05:54:55 -07:00
AKASHI Takahiro
2b12196dc1 cmd: add asn1_compiler
Imported from linux kernel v5.3:
 asn1.h without changes
 asn1_ber_bytecode.h without changes
 asn1_decoder.h without changes
 asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-12-06 16:44:20 -05:00
Thomas Hebb
32f2ca2a7e cosmetic: Fix spelling and whitespace errors
Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2019-12-03 08:43:23 -05:00
Simon Glass
3db7110857 crc32: Use the crc.h header for crc functions
Drop inclusion of crc.h in common.h and use the correct header directly
instead.

With this we can drop the conflicting definition in fw_env.h and rely on
the crc.h header, which is already included.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:23:08 -05:00
Simon Glass
b2ea91ba57 crc: Fix code style with crc functions
Some of these have a space before the bracket. Drop it to fix the style.
Add some missing function comments while here.

Note that u32 and u8 cannot be used here since crc.h is included on the
host side.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02 18:23:07 -05:00
Tom Rini
70f6813985 buildman: Fix problem with non-existent output directories
Now that we have buildman telling genboards.cfg to use an output
directory we need to ensure that it exists.

Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Fixes: bc750bca12 ("tools: buildman: Honor output directory when generating boards.cfg")
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-11-23 14:53:48 -05:00
Tom Rini
02b5670e65 moveconfig.py: Fix more Python3 UTF issues
With the move to using Python 3 for real, we encounter two different
issues.  First, the file include/video_font_data.h includes at least one
UTF-16 character.  Given that it does not include any CONFIG symbols it
is easiest to just ignore this file.  Next, we encounter similar
problems with some dts/dtsi files that come from Linux.  In this case
it's easiest to simply ignore all dts/dtsi files as there will not be
CONFIG symbols for us to migrate in them.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2019-11-23 14:53:48 -05:00
Tom Rini
a8992e788a env: Remove useless CONFIG_ENV_SIZE_REDUND and fix ENV_IS_REDUND check
We have CONFIG_ENV_SIZE_IS_REDUND but don't really use it.  We have one
board where we can simply multiple CONFIG_ENV_SIZE by two for the same
result.  The other place where we could but were not previously using
this is for where env_internal.h checks for if we should set
ENV_IS_EMBEDDED.  This seems like the most likely use, historically, of
the variable, but it was not used.  Add logic to check for this now.

Cc: Wolfgang Denk <wd@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2019-11-20 18:31:24 -05:00
Tom Rini
d64efd920e Merge tag 'u-boot-rockchip-20191118' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip
- Add support for rockchip SoC: PX30, RK3308
- Add and migrate to use common dram driver: PX30, RK3328, RK3399
- Add rk3399 board Tinker-s support
- Board config update for Rock960, Rockpro64
2019-11-17 21:15:57 -05:00
Andy Yan
644c6bebb6 rockchip: mkimage: add support for RK3308
Usage:

 (1) tools/mkimage -n rk3308 -T rksd -d tpl/u-boot-tpl.bin idbloader.img
 (2) cat spl/u-boot-spl.bin >> idbloader.img
 (3) upgrade_tool wl 0x40 idbloader.img

Note:
  When use ddr binary from rkbin as tpl, use it replace u-boot-tpl.bin in(1)

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2019-11-17 17:22:53 +08:00
Kever Yang
c6e66b12e4 rockchip: mkimage: add support for px30
Add the table entry for px30 socs.
The px30 has 10K of sram available.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2019-11-17 17:23:12 +08:00
Robert Beckett
677dac23d8 patman: fix coverletter cc list with nulls
fixes: 8ab452d587

When compiling list of cover letter cc addresses, using null as a
separater, then encoding to utf-8 results in lots of "\x00" as
separators. patman then doesnt understand that when it comes to
repoting the list to send-email.

Fix this by not encoding to utf-8, as done for the other patch files.

Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-11-14 07:09:34 -06:00
Anatolij Gustschin
ab4a6aba7f patman: fix some typos in comments
s/Subprocress/Subprocess/
s/easiler/easier/
s/repositiory/repository/
s/rangem/range/
s/Retruns/Returns/

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-11-14 07:09:34 -06:00
Tom Rini
cb6617a77f defconfigs: Migrate CONFIG_SYS_REDUNDAND_ENVIRONMENT
Move this symbol to Kconfig.  As part of this we can drop a UBI-specific
symbol that was a stop-gap for not having this particular symbol in
Kconfig.

Signed-off-by: Tom Rini <trini@konsulko.com>
2019-11-12 11:08:00 -05:00
Tom Rini
5f7ff6d63e u-boot-imx-20191105
-------------------
 i.MX8MN SoC support
 ROM API image download support
 i.MX8MM enet enabling
 -----BEGIN PGP SIGNATURE-----
 
 iQHDBAABCgAtFiEEiZClFGvhzbUNsmAvKMTY0yrV63cFAl3BmLkPHHNiYWJpY0Bk
 ZW54LmRlAAoJECjE2NMq1et3oVwL/2Z7kCMCjudXNjXqJFSVsCizuzaxkYvUDQCK
 g8+P7pdci/xZz8pVvVD5zmpZGRM2hu+7hFQwIlSu7anlRqdW+9cZCAJoeq/4A29c
 TkI3w99R0xTDGFlip0zM4vKlQXmC0I0LYbJPVDLjN+zNkhL6QNS3QptONw/3xPzr
 Vj5+eztasl5JOnkTFE8yZkfbkekgPbO4h43oje5XwRdRQcwzo4qEFZcxZzvucz39
 0RXyvu5qtXvSeVYApXeYcnBD3Mn4rjq26rfn2EEntkO0FbhYBHBjwx3/ozmUaOFR
 7AtNyZZSAZFe03egfX6+ODx7tuOTA0PK1LLdogMjLDrOd70px+P7wxY9QZV6hKw9
 TC4YlboZK2bjsPyOwIraTWVUvU9YjQzlPT0SYjyIono33Av1Um7RDvp+XeyG7VPC
 AYE6luZwhauYNUaGegFPexDxOSRqeAiTLx3kOOeHb4Vb4KkJu4Np7Pma2uiqI00V
 4TpWJwhqQPn7lo/N1X9ymBx6iNvt2Q==
 =sgCz
 -----END PGP SIGNATURE-----

Merge tag 'u-boot-imx-20191105' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

u-boot-imx-20191105
-------------------
i.MX8MN SoC support
ROM API image download support
i.MX8MM enet enabling
2019-11-12 07:18:23 -05:00
Simon Glass
7c15013639 binman: tegra: Adjust symbol calculation depending on end-at-4gb
A recent change adjusted the symbol calculation to work on x86 but broke
it for Tegra. In fact this is because they have different needs.

On x86 devices the code is linked to a ROM address and the end-at-4gb
property is used for the image. In this case there is no need to add the
base address of the image, since the base address is already built into
the offset and image-pos properties.

On other devices we must add the base address since the offsets start at
zero.

In addition the base address is currently added to the 'offset' and 'size'
values. It should in fact only be added to 'image-pos', since 'offset' is
relative to its parent and 'size' is not actually an address. This code
should have been adjusted when support for 'image-pos' and 'size' was
added, but it was not.

To correct these problems:
- move the code that handles adding the base address to section.py, which
  can check the end-at-4gb property and which property
  (offset/size/image-pos) is being read
- add the base address only when needed (only for image-pos and not if the
  image uses end-at-4gb)
- add a note to the documentation
- add a separate test to cover x86 behaviour

Fixes: 15c981cc (binman: Correct symbol calculation with non-zero image base)

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
2019-11-11 14:20:35 -05:00
Tom Rini
fb6dc1fd58 tools/img2brec.sh: Delete unused tool
This script was only used on the MX1ADS board (and possibly other MX1
platforms) to program the flash.  As we no longer have any boards for
that SoC, remove this tool.

Fixes: e570aca947 ("mx1ads: remove board support")
Signed-off-by: Tom Rini <trini@konsulko.com>
2019-11-08 14:04:53 -05:00
Peng Fan
d3c7d84be6 tools: imx8m_image: support ddr4 firmware
some boards use ddr4, not lpddr4, so we need to check ddr4 firmware.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-11-05 10:27:18 +01:00
Peng Fan
b8f168346b tools: imx8mimage: add ROM VERSION
The IVT offset is changed on i.MX8MN. Use ROM_VERSION to pass the
v1 or v2 to mkimage.
v1 is for iMX8MQ and iMX8MM
v2 is for iMX8M Nano (iMX8MN)

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-11-05 10:27:18 +01:00
Simon Glass
388560134b binman: Move to use Python 3
Update this tool to use Python 3 to meet the 2020 deadline.

Unfortunately this introduces a test failure due to a problem in pylibfdt
on Python 3. I will investigate.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
a90df2b172 dtoc: Convert fdt.py to Python 3
Drop the now-unused Python 2 code to keep code coverage at 100%.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
b6ee0cf89f binman: Convert a few tests to Python 3
Some tests have crept in with Python 2 strings and constructs. Convert
then.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
9a5d3dcff7 binman: Remember the pre-reset entry size
When preparing to possible expand or contract an entry we reset the size
to the original value from the binman device-tree definition, which is
often None.

This causes binman to forget the original size of the entry. Remember this
so that it can be used when needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
b4cf5f1df7 pylibfdt: Convert to Python 3
Build this swig module with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
5effab0549 rkmux: Convert to Python 3
Convert this tool to Python 3 and make it use that, to meet the 2020
deadline.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
793dca34ca move_config: Convert to Python 3
Convert this tool to Python 3 and make it use that, to meet the 2020
deadline.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
879ca27656 microcode_tool: Convert to Python 3
Convert this tool to Python 3 and make it use that, to meet the 2020
deadline.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
3c19dc8b68 test_dtoc: Move to use Python 3
Update this test to use Python 3 to meet the 2020 deadline.

Also make it executable while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
f7ba5f0db2 test_fdt: Move to use Python 3
Update this test to use Python 3 to meet the 2020 deadline.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
c05aa03642 buildman: Convert to Python 3
Convert buildman to Python 3 and make it use that, to meet the 2020
deadline.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
e3986d9b40 patman: Move to use Python 3
Update this tool to use Python 3 to meet the 2020 deadline.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
272cd85deb patman: Use unicode for file I/O
At present patman test fail in some environments which don't use utf-8
as the default file encoding. Add this explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
3b3e3c0f6c patman: Adjust 'command' to return strings instead of bytes
At present all the 'command' methods return bytes. Most of the time we
actually want strings, so change this. We still need to keep the internal
representation as bytes since otherwise unicode strings might break over
a read() boundary (e.g. 4KB), causing errors. But we can convert the end
result to strings.

Add a 'binary' parameter to cover the few cases where bytes are needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
f0921f5098 fdt: Sync up to the latest libfdt
Bring over the fdt from this commit:

430419c (origin/master) tests: fix some python warnings

adding in the 'assumptions' series designed to reduce code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04 18:15:32 -07:00
Simon Glass
211193dc5c binman: Fix up comment in intel-fsp-m
This comment references the wrong FSP component. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-11-02 18:00:51 +08:00
Simon Glass
998d1482cd binman: Add support for Intel FSP-T
This entry is used to hold an Intel FSP-T (Firmware Support Package
Temp-RAM init) binary. Add support for this in binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-11-02 18:00:51 +08:00
Simon Glass
bc6a88fafe binman: Add support for Intel FSP-S
This entry is used to hold an Intel FSP-S (Firmware Support Package
Silicon init) binary. Add support for this in binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-11-02 18:00:51 +08:00
Simon Glass
15c981cc8a binman: Correct symbol calculation with non-zero image base
At present binman adds the image base address to the symbol value before
it writes it to the binary. This is not correct since the symbol value
itself (e.g. image position) has no relationship to the image base.

Fix this and update the tests to cover this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-11-02 18:00:51 +08:00
Tom Rini
bb1bb4bb5d Fix for patman with email addresses containing commas
Bootstage improvements for TPL, SPL
 Various sandbox and dm improvements and fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQFFBAABCgAvFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAl24zDoRHHNqZ0BjaHJv
 bWl1bS5vcmcACgkQfxc6PpAIreZRiwf+Mf7oG//zjiZcHaPP6KOFb1CjwqLSuiaI
 eCYB6GEZXuSpc8MjAw+baAfIw8MMFuaCfPsUQ5dDo391neK0sW9kkEsdcXnQBpB3
 GdJYcewLN1UuJZovriGobIisGc0GQHh8gmRcVGWSKoEt+gAQauRtVYBIUPuS3JG+
 ihZgYmVgICa+3tqavIbP2oZdXLuLAxR65mfiQHtiJwdCN3OOzyls2v0T0slQX9GV
 ln6EvTk8OMIudBmkB7YiTmJF7AB+3PH/uBaiYyTKO9gtjLhnmCFvG5HxJTRFOKvU
 F4oVWZJDEcqfZvYgWg8i5vgokMP41nzLfBr7j5ifUX1f3xwCHy/Tpw==
 =S4XI
 -----END PGP SIGNATURE-----

Merge tag 'dm-pull-29oct19' of git://git.denx.de/u-boot-dm

- Fix for patman with email addresses containing commas
- Bootstage improvements for TPL, SPL
- Various sandbox and dm improvements and fixes
2019-11-01 09:34:35 -04:00
Michal Sojka
12e288a8ba mkimage: Set correct FDT type and ramdisk architecture in FIT auto mode
When running the following command

    mkimage -f auto -A arm -O linux -T kernel -C none -a 0x8000 -e 0x8000 \
            -d zImage -b zynq-microzed.dtb -i initramfs.cpio image.ub

the type of fdt subimage is the same as of the main kernel image and
the architecture of the initramfs image is not set. Such an image is
refused by U-Boot when booting. This commits sets the mentioned
attributes, allowing to use the "-f auto" mode in this case instead of
writing full .its file.

Following is the diff of mkimage output without and with this commit:

 FIT description: Kernel Image image with one or more FDT blobs
 Created:         Thu Sep 12 23:23:16 2019
  Image 0 (kernel-1)
   Description:
   Created:      Thu Sep 12 23:23:16 2019
   Type:         Kernel Image
   Compression:  uncompressed
   Data Size:    4192744 Bytes = 4094.48 KiB = 4.00 MiB
   Architecture: ARM
   OS:           Linux
   Load Address: 0x00008000
   Entry Point:  0x00008000
  Image 1 (fdt-1)
   Description:  zynq-microzed
   Created:      Thu Sep 12 23:23:16 2019
-  Type:         Kernel Image
+  Type:         Flat Device Tree
   Compression:  uncompressed
   Data Size:    9398 Bytes = 9.18 KiB = 0.01 MiB
   Architecture: ARM
-  OS:           Unknown OS
-  Load Address: unavailable
-  Entry Point:  unavailable
  Image 2 (ramdisk-1)
   Description:  unavailable
   Created:      Thu Sep 12 23:23:16 2019
   Type:         RAMDisk Image
   Compression:  Unknown Compression
   Data Size:    760672 Bytes = 742.84 KiB = 0.73 MiB
-  Architecture: Unknown Architecture
+  Architecture: ARM
   OS:           Linux
   Load Address: unavailable
   Entry Point:  unavailable
  Default Configuration: 'conf-1'
  Configuration 0 (conf-1)
   Description:  zynq-microzed
   Kernel:       kernel-1
   Init Ramdisk: ramdisk-1
   FDT:          fdt-1
   Loadables:    kernel-1

Signed-off-by: Michal Sojka <michal.sojka@cvut.cz>
2019-10-31 07:22:53 -04:00
Bin Meng
578b637203 tools: buildman: Remove useless mkdir() in Make() in test.py
In the 'Make' function, the codes tries to create a directory
if current stage is 'build'. But the directory isn't used at
all anywhere.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-10-29 16:17:39 -04:00
Bin Meng
bc750bca12 tools: buildman: Honor output directory when generating boards.cfg
buildman always generates boards.cfg in the U-Boot source tree.
When '-o' is given, we should generate boards.cfg to the given
output directory.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-10-29 16:17:36 -04:00
Bin Meng
4d90f6cd98 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>
2019-10-28 13:32:51 -04:00
Bin Meng
ccd4398fa7 tools: ifwitool: Define __packed when it is not defined
Some compilers may provide __packed define for us.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-28 13:32:51 -04:00
Bin Meng
afd3bf4318 tools: zynqmpbif: Use compiler builtin instead of linux-specific __swab32
__swab32() is a Linux specific macro defined in linux/swab.h. Let's
use the compiler equivalent builtin function __builtin_bswap32() for
better portability.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-28 13:32:51 -04:00
Bin Meng
a7c9a65ed9 tools: mtk_image.h: Use portable uintXX_t instead of linux-specific __leXX
__leXX has Linux kernel specific __attribute__((bitwise)) which is
not portable. Use corresponding uintXX_t instead.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-28 13:32:51 -04:00
Dmitry Torokhov
8ab452d587 patman: separate emails in CC list with NULs
There is a contributor in Linux kernel with a comma in their name, which
confuses patman and results in invalid to- or cc- addresses on some
patches. To avoid this, let's use \0 as a separator when generating cc
file.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-10-27 10:56:51 -06:00
Michal Simek
d8a6d1b7b1 arm64: zynqmp: Do not remove dpll_prog from psu_init
dpll_prog is available in some psu_init files that's why this function
should stay there.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2019-10-24 13:37:02 +02:00
Douglas Anderson
833e4192cd patman: Use the Change-Id, version, and prefix in the Message-Id
As per the centithread on ksummit-discuss [1], there are folks who
feel that if a Change-Id is present in a developer's local commit that
said Change-Id could be interesting to include in upstream posts.
Specifically if two commits are posted with the same Change-Id there's
a reasonable chance that they are either the same commit or a newer
version of the same commit.  Specifically this is because that's how
gerrit has trained people to work.

There is much angst about Change-Id in upstream Linux, but one thing
that seems safe and non-controversial is to include the Change-Id as
part of the string of crud that makes up a Message-Id.

Let's give that a try.

In theory (if there is enough adoption) this could help a tool more
reliably find various versions of a commit.  This actually might work
pretty well for U-Boot where (I believe) quite a number of developers
use patman, so there could be critical mass (assuming that enough of
these people also use a git hook that adds Change-Id to their
commits).  I was able to find this git hook by searching for "gerrit
change id git hook" in my favorite search engine.

In theory one could imagine something like this could be integrated
into other tools, possibly even git-send-email.  Getting it into
patman seems like a sane first step, though.

NOTE: this patch is being posted using a patman containing this patch,
so you should be able to see the Message-Id of this patch and see that
it contains my local Change-Id, which ends in 2b9 if you want to
check.

[1] https://lists.linuxfoundation.org/pipermail/ksummit-discuss/2019-August/006739.html

Signed-off-by: Douglas Anderson <dianders@chromium.org>
2019-10-15 08:40:03 -06:00
Simon Glass
d1d5ffd554 binman: Drop comment-out code in testUpdateFdtOutput()
This code is not needed so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
aed6c0b043 binman: Add logging for the number of pack passes
Sometimes binman takes multiple passes to complete packing an image. Add
logging to indicate this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
261cbe0b37 binman: Write symbol info before image inclusion
At present the symbol information is written to binaries just before
binman exits. This is fine for entries within sections since the section
contents is calculated when it is needed, so the updated symbol values are
included in the image that is written.

However some binaries are inside entries which have already generated
their contents and do not notice that the entries have changed (e.g. Intel
IFWI).

Move the symbol writing earlier to cope with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
ed9571d269 binman: Support writing symbols into entries within an IFWI
The Intel IFWI (Integrated Firmware Image) is effectively a section with
other entries inside it. Support writing symbol information into entries
within it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
51f20726ca binman: Update IFWI entry to support updates
Add support for the ProcessContents() method in this entry so that it is
possible to support entries which change after initial creation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
afc68a8a4d binman: Update IFWI entry to read entries outside constructor
At present this class reads its entries in the constructor. This is not
how things should be done now. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
7d645e08d6 binman: Fix entry comment for Intel descriptor
This comment references another entry type. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
ea0fff929b binman: Add support for Intel FSP meminit
The Intel FSP supports initialising memory early during boot using a binary
blob called 'fspm'. Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
b87064c249 binman: Allow support for writing a size symbol to binaries
It is useful to be able to access the size of an image in SPL, with
something like:

binman_sym_declare(unsigned long, u_boot_any, size);

...
   ulong u_boot_size = binman_sym(ulong, u_boot_any, size);

Add support for this and update the tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
eb0086fa59 binman: Increase size of TPL and SPL test data
At present these are large enough to hold 20 bytes of symbol data. Add
four more bytes so we can add another test.

Unfortunately at present this involves changing a few test files to make
room. We could adjust the test files to not specify sizes for entries.
Then we could make the tests check the actual sizes. But for now, leave it
as it is, since the effort is minor.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
bf4d0e2842 binman: Avoid needing the section size in advance
Entries which include a section and need to obtain its contents call
GetData(), as with any other entry. But the current implementation of this
method in entry_Section requires the size of the section to be known. If
it is unknown, an error is produced, since size is None:

   TypeError: can't multiply sequence by non-int of type 'NoneType'

There is no need to know the size in advance since the code can be
adjusted to build up the section piece by piece, instead of patching each
entry into an existing bytearray.

Update the code to handle this and add a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
dfdd2b6217 binman: Rename some two-digit test files
Two of the test files somehow were not converted to three digits. Fix
them, using the next available numbers.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
9255f3c58e binman: Use underscore in test filenames
At present a small number of test files use hyphens instead of
underscores. Rename them for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
2090f1e3d0 binman: Allow symbols to be resolved inside sections
At present we only support symbols inside binaries which are at the top
level of an image. This restrictions seems unreasonable since more complex
images may want to group binaries within different sections.

Relax the restriction, adding a new _SetupTplElf() helper function.

Also fix a typo in the comment for testTpl().

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
c9a0b27589 binman: Clean up unnecessary code related to ELF test files
We use the Makefile for all ELF test files now, so drop all the code that
checks whether to get the test file from the Makefile or from the git
repo.

Also add a comment to the Makefile indicating that it is run from binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
8dc60f99f9 binman: Use the Makefile for u_boot_binman_syms_bad
Remove this file from git and instead build it using the Makefile.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
e9d2ee3862 binman: Use the Makefile for u_boot_binman_syms_size
Remove this file from git and instead build it using the Makefile.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
1542c8b5fc binman: Use the Makefile for u_boot_binman_syms
Remove this file from git and instead build it using the Makefile.

With this change a few things need to be adjusted:

1. The 'notes' section no-longer appears at the start of the ELF file
(before the code), so update testSymbols to adjust the offsets.

2. The dynamic linker is disabled to avoid errors like:

    "Not enough room for program headers, try linking with -N"

3. The interpreter note is moved to the end of the image, so that the
binman symbols appear first.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
bccd91da9b binman: Use the Makefile for u_boot_no_ucode_ptr
Remove this file from git and instead build it using the Makefile.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
f514d8f23d binman: Use the Makefile for u_boot_ucode_ptr
Remove this file from git and instead build it using the Makefile.

Update tools.GetInputFilename() to support reading files from an absolute
path, so that we can read the Elf test files easily. Also make sure that
the temp directory is report in ELF tests as this was commented out.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
53e22bf38c binman: Use the Makefile to build ELF test files
At present the ELF test files are checked into the U-Boot tree. This is
covenient since the files never change and can be used on non-x86
platforms. However it is not good practice to check in binaries and in
this case it does not seem essential.

Update the binman test-file Makefile to support having source in a
different directory. Adjust binman to run it to build bss_data, as a
start. We can add other files as needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
180f556b09 binman: Use tools.Run() to run objdump
At present this command silently fails if something goes wrong. Use the
tools.Run() function instead, since it reports errors.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
e95be637c4 binman: Fix IFWI output when using an Intel FIT image
At present this entry does not work correctly when a FIT image is used as
the input. It updates the FIT instead of the output image. The test passed
because the FIT image happened to have the right data already.

Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
5af1207ec9 binman: Add support for Intel FIT
A Firmware Image Table (FIT) is a data structure defined by Intel which
contains information about various things needed by the SoC, such as
microcode.

Add support for this entry as well as the pointer to it. The contents of
FIT are fixed at present. Future work is needed to support adding
microcode, etc.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
5e239183f6 binman: x86: Separate out 16-bit reset and init code
At present these two sections of code are linked together into a single
2KB chunk in a single file. Some Intel SoCs like to have a FIT (Firmware
Interface Table) in the ROM and the pointer for this needs to go at
0xffffffc0 which is in the middle of these two sections.

Make use of the new 'reset' entry and change the existing 16-bit entry to
include just the 16-bit data.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
2250ee6ee6 binman: Add support for an x86 'reset' section
At present binman has a single entry type for the 16-bit code code needed
to start up an x86 processor. This entry is intended to include both the
reset vector itself as well as the code to move to 32-bit mode.

However this is not very flexible since in some cases other data needs to
be included at the top of the SPI flash, in between these two pieces. For
example Intel requires that a FIT (Firmware Image Table) pointer be placed
0x40 bytes before the end of the ROM.

To deal with this, add a new reset entry for just the reset vector. A
subsequent change will adjust the existing 'start16' entry.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
3da9ce8dd4 binman: Correct use of 'replace' in IFWI tests
At present the Intel IFWI entry uses 'replace' without the 'ifwi-' prefix.
This is a fairly generic name which might conflict with the main Entry
base class at some point, if more features are added. Add a prefix.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
39c8e47d2e binman: Handle hidden symbols in ELF files
Some versions of binutils generate hidden symbols which are currently not
parsed by binman. Correct this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
9d44a7e6c6 binman: Drop .note section from ELF
Recent versions of binutils add a '.note.gnu.property' into the ELF file.
This is not required and interferes with the expected output. Drop it.

Also fix testMakeElf() to use a different file for input and output.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
8dbb7444eb binman: Allow use of help and entry-docs without libfdt
At present if libfdt is not available binman can't do anything much.
Improve the situation a little.

Ideally there should be a test to cover this, but I'm not quite sure how
to fake this.

Signed-off-by: Simon Glass <sjg@chromium.org>
(fixed up missing ReadChildData() enty test)
2019-10-15 08:40:02 -06:00
Simon Glass
b986b3bb19 binman: Use cls instead of self for class methods
It is more common to use the name 'cls' for the class object of a class
method, to distinguish it from normal methods, which use 'self' Update the
binman tests accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
6eace39807 patman: Update command.Run() to handle failure better
At present tools are not expected to fail. If they do an exception is
raised but there is no detail about what went wrong. This makes it hard
to debug if something does actually go wrong.

Fix this by outputting both stderr and stdout on failure.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Simon Glass
3b1c0b09c9 patman: Drop binary parameter
Since cros_subprocess use bytestrings now, this feature not needed. Drop
it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15 08:40:02 -06:00
Bin Meng
c443f56cc6 binman: Use qemu-x86_defconfig in the example
The doc currently uses sandbox_defconfig as examples of enabling
debug/verbose output of binman. However during a sandbox build it
does not call binman at all. Change it to qemu-x86_defconfig.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-10-11 17:37:44 +08:00
Tom Rini
eaa0bde051 u-boot-imx-20191009
-------------------
 
 Travis : https://travis-ci.org/sbabic/u-boot-imx/builds/595148532
 
 - MX6UL / ULZ
 - Toradex board
 - Allow to set OCRAM for MX6Q/D
 - MX7ULP
 - MX8: (container image, imx8mq_mek), SCU API
 - fix several board booting from SD/EMMC (cubox-i for example)
 - pico boards
 -----BEGIN PGP SIGNATURE-----
 
 iQHDBAABCgAtFiEEiZClFGvhzbUNsmAvKMTY0yrV63cFAl2dlTAPHHNiYWJpY0Bk
 ZW54LmRlAAoJECjE2NMq1et3yfgL/1b4pKCwxswK42XkPpdHN1u/v2W/PVDanl/H
 EYxlluHVFH23bLTjLvrrgQjAnZD1VQhxWq3bwCMoJ8vb9tYQ3d9vq7XADQ0WVQV+
 EfhE33fVRPRT3rEdhDKWm+y1mL8YPvYEBnr9li7qU9n1VxiwONPXxMXMqoo9/lbM
 b6lJaG5KkuK8Ofx3cYFVQeAEdsFYIJ2aXtTqsqrV9o2sjruOuG3Ux+6Ov+9O0crY
 q8MXvW6kwWkVVNriVV7Yal0pomPZfMTqft007En9Mv2FtXqMeCWZ4Xh2LtRylR7n
 ruIbo94jkPuwuZ0p/6SeiyopoG/hU/skrkJv1s8W70DOsyaunP2BsveYXEjMV2Rb
 DomotcJit9Ws6P7rOP1oI8OvxSxVN8n6mo23UviZd8MjNAmOm49BtSxVGGB+pwmr
 ufGFG4MGQ5VpCxmzh6KrJCLXpI/mhKrkBkZy58cUbus7aPv3es/jBmmtGlU3m6ka
 NlEzHOX1hpJV/lhLvxjqRhVxuXvXOA==
 =+e3p
 -----END PGP SIGNATURE-----

Merge tag 'u-boot-imx-20191009' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

u-boot-imx-20191009
-------------------

Travis : https://travis-ci.org/sbabic/u-boot-imx/builds/595148532

- MX6UL / ULZ
- Toradex board
- Allow to set OCRAM for MX6Q/D
- MX7ULP
- MX8: (container image, imx8mq_mek), SCU API
- fix several board booting from SD/EMMC (cubox-i for example)
- pico boards

[trini: display5 merged manually]
Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-09 11:44:45 -04:00
Tom Rini
efea5a34bb Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
- Rename existing FSP code to fsp1
- Add fsp2 directory in preparation to support FSP 2.0
- Various x86 platform codes update
- Various bug fixes and updates in dm core, sandbox and spl
2019-10-08 18:45:26 -04:00
Tom Rini
aae62584a6 buildman: Perform tests in a temporary directory
We may not always be able to write to the default output directory so
have a temporary directory for our output be created.

Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Stephen Warren <swarren@wwwdotorg.org>
Suggested-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-08 12:10:38 -04:00
Stefano Babic
d714a75fd4 imx: replace CONFIG_SECURE_BOOT with CONFIG_IMX_HAB
CONFIG_SECURE_BOOT is too generic and forbids to use it for cross
architecture purposes. If Secure Boot is required for imx, this means to
enable and use the HAB processor in the soc.

Signed-off-by: Stefano Babic <sbabic@denx.de>
2019-10-08 16:36:37 +02:00
Peng Fan
4b78bb5041 tools: imx8m_image: align spl bin image size
The loader for the DDR firmware in drivers/ddr/imx/imx8m/helper.c uses a
4-byte-aligned address to load the firmware. In cases where OF is
enabled in SPL the dtb will be appended to the SPL binary and can result
in a binary that is not aligned correctly. If OF is not enabled in SPL,
`_end` is already aligned correctly, but this patch does not hurt.

To ensure the correct alignment we use dd to create a temporary file
u-boot-spl-pad.bin with the correct padding.

Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-10-08 16:36:36 +02:00
Breno Matheus Lima
5b20d141f2 imx: Kconfig: Reduce default CONFIG_CSF_SIZE
The default CSF_SIZE defined in Kconfig is too high and SPL cannot
fit into the OCRAM in certain cases.

The CSF cannot achieve 0x2000 length when using RSA 4K key which is
the largest key size supported by HABv4.

According to AN12056 "Encrypted Boot on HABv4 and CAAM Enabled Devices"
it's recommended to pad CSF binary to 0x2000 and append DEK blob to
deploy encrypted boot images.

As the maximum DEK blob size is 0x58 we can reduce CSF_SIZE to 0x2060
which should cover both CSF and DEK blob length.

Update default_image.c and image.c to align with this change and avoid
a U-Boot proper authentication failure in HAB closed devices:

Authenticate image from DDR location 0x877fffc0...
bad magic magic=0x32 length=0x6131 version=0x38
bad length magic=0x32 length=0x6131 version=0x38
bad version magic=0x32 length=0x6131 version=0x38
spl: ERROR:  image authentication fail

Fixes: 96d27fb218 (Revert "habv4: tools: Avoid hardcoded CSF size for SPL targets")

Reported-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Breno Lima <breno.lima@nxp.com>
2019-10-08 16:36:36 +02:00
Fabio Estevam
dc3e6c8305 logos: Add the TechNexion's logo
Add the TechNexion's logo from their internal U-Boot tree.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2019-10-08 16:35:59 +02:00
Stefano Babic
70026345ed Revert "habv4: tools: Avoid hardcoded CSF size for SPL targets"
This reverts commit 62a52f3f85bf33e286632e99f0d39b2c166af0c4.
2019-10-08 16:35:59 +02:00
Breno Matheus Lima
40af7d39aa habv4: tools: Avoid hardcoded CSF size for SPL targets
Currently it's not possible to authenticate the U-Boot proper of
mx6ul_14x14_evk_defconfig target:

Authenticate image from DDR location 0x877fffc0...
bad magic magic=0x0 length=0x00 version=0x3
bad length magic=0x0 length=0x00 version=0x3
bad version magic=0x0 length=0x00 version=0x3
spl: ERROR:  image authentication fail

Commit 0633e13478 ("imx: hab: Increase CSF_SIZE for i.MX6 and
i.MX7 devices") has increased CSF_SIZE to avoid a possible issue
when booting encrypted boot images.

Commit d21bd69b6e ("tools: mkimage: add firmware-ivt image type
for HAB verification") is hardcoding the CSF and IVT sizes, the
new CSF size is not being considered and u-boot-ivt.img fails to
boot.

Avoid hardcoded CSF and IVT size to fix this issue.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2019-10-08 16:35:59 +02:00
Breno Matheus Lima
7171437166 imx6: spl: Reduce SPL limit size in case CONFIG_SECURE_BOOT is enabled
In case CONFIG_SECURE_BOOT is enabled we need to limit the SPL size to
avoid a possible HAB failure event:

--------- HAB Event 1 -----------------
event data:
        0xdb 0x00 0x14 0x42 0x33 0x22 0x33 0x00
        0x00 0x00 0x00 0x0f 0x00 0x90 0x70 0x00
        0x00 0x01 0x10 0x00
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ADDRESS (0x22)
CTX = HAB_CTX_TARGET (0x33)
ENG = HAB_ENG_ANY (0x00)

As explained in Commit 23612534fe ("spl: imx6: Provide a SPL_SIZE_LIMIT
default") the i.MX6 SPL size limit is 68KB.

The ROM code is copying the image size defined in boot data to its
respective load address, in case we exceed the OCRAM free region a
HAB invalid address failure event is generated.

The maximum CSF size is defined in CONFIG_CSF_SIZE, reduce SPL size
limit based on this configuration.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2019-10-08 16:35:58 +02:00
Peng Fan
4d655bfe03 tools: imx8mimage: fix HDMI/FIT parsing
Add missed break for HDMI entry.
And moving FIT parsing earlier, because it does not have parameter,
it will not runs into CFG_REG_SIZE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-10-08 16:35:16 +02:00
Tom Rini
65e05ddc1a kconfiglib: Update to the 12.14.0 release
A large number of changes have happened upstream since our last sync
which was to 375506d.  The reason to do the upgrade at this point is for
improved Python 3 support.

As part of this upgrade we need to update moveconfig.py and
genboardscfg.py the current API.  This is:
- Change "kconfiglib.Config" calls to "kconfiglib.Kconfig"
- Change get_symbol() calls to syms.get().
- Change get_value() to str_value.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-08 08:37:29 -04:00
Tom Rini
5e7c8a39e6 genboardscfg.py: Remove "warnings" print section
We tell kconfiglib to not print any warnings to us so drop this code as
it will be unused.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-08 08:37:28 -04:00
Tom Rini
3bc14098d8 genboardscfg.py: Convert to Python 3
Convert this tool to requiring Python 3.  The bulk of this is done with
the 2to3 tool In addition, we need to use the '//' operator to have our
division result return an int rather than a float and ensure that we use
UTF-8 when reading/writing files.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2019-10-08 08:37:28 -04:00
Simon Glass
0b7ebee38e binman: Take account of skip-at-start with image-header
The image-header currently sets it offset assuming that skip-at-start is
zero. This does not work on x86 where offsets end at 4GB. Add in this
value so that the offset is correct.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-08 13:57:44 +08:00
Simon Glass
2d553c006d binman: Handle reading data for end-at-4gb sections
Some x86 sections have special offsets which currently result in empty
data being returned from the 'extract' command. Fix this by taking account
of the skip-at-start property.

Add a little more debugging while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-08 13:57:44 +08:00
Simon Glass
4e185e8dd7 binman: Add a base implementation of Entry.ReadChildData()
At present this function is not present in the Entry base class so it is
hard to find the documentation for it. Move the docs from the section
class and expand it a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-08 13:57:43 +08:00
Simon Glass
7bc4f0f883 binman: Allow verbose output with all commands
At present the verbose flag only works for the 'build' command. This is
not intended, nor is it useful. Update the code to support the verbose
flag and make use of a command exception handler.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: rebase the patch against u-boot-x86/next to get it applied cleanly]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-08 13:57:43 +08:00
Simon Glass
1f338e00fa binman: Allow selection of logging verbosity
Support a new BINMAN_VERBOSE option to the build, to allow passing the
-v flag to binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-08 13:51:00 +08:00
Pierre-Jean Texier
7ce01c78dc fw_env: fix build error
The following error appears:

tools/env/fw_env.c:1149:25: error: lvalue required as unary ‘&’ operand
  rc = write(fd, &ENV_REDUND_OBSOLETE, sizeof(ENV_REDUND_OBSOLETE));

Fixes: d3716dd ("env: Rename the redundancy flags")

Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
Tested-by: Joris Offouga <offougajoris@gmail.com>
Tested-by: Heiko Schocher <hs@denx.de>
Suggested-by: Heiko Schocher <hs@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2019-09-24 17:46:13 -04:00
Pierre-Jean Texier
e184a3b4fd fw_env: remove duplicated definitions
Since commit d3716dd ("env: Rename the redundancy flags"), the
definitions of ENV_REDUND_OBSOLETE & ENV_REDUND_ACTIVE was moved
to env.h.

Fixes:

tools/env/fw_env.c:122:22: error: ‘ENV_REDUND_ACTIVE’ redeclared as different kind of symbol
 static unsigned char ENV_REDUND_ACTIVE = 1;
                      ^~~~~~~~~~~~~~~~~
In file included from tools/env/fw_env.c:13:
include/env.h:63:2: note: previous definition of ‘ENV_REDUND_ACTIVE’ was here
  ENV_REDUND_ACTIVE = 1,
  ^~~~~~~~~~~~~~~~~
tools/env/fw_env.c:127:22: error: ‘ENV_REDUND_OBSOLETE’ redeclared as different kind of symbol
 static unsigned char ENV_REDUND_OBSOLETE;
                      ^~~~~~~~~~~~~~~~~~~
In file included from tools/env/fw_env.c:13:
include/env.h:62:2: note: previous definition of ‘ENV_REDUND_OBSOLETE’ was here
  ENV_REDUND_OBSOLETE = 0,

Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
Tested-by: Joris Offouga <offougajoris@gmail.com>
Tested-by: Heiko Schocher <hs@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2019-09-24 17:46:13 -04:00
Andy Shevchenko
08afd714d0 tools: Add ifwitool to .gitignore
Follow up fix to the commit

56bf4f8630 ("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>
2019-09-10 14:19:39 +08:00
Marcus Comstedt
71bdfcb21d riscv: tools: Handle addend to absolute reloc in prelink-riscv
Previously the handling of R_RISCV_32 and R_RISCV_64 would simply
insert the value of the symbol and ignore any addend.  However, there
exist relocs where the addend is non-zero:

0000000080250900 R_RISCV_64        efi_runtime_services+0x0000000000000068
0000000080250910 R_RISCV_64        efi_runtime_services+0x0000000000000038
0000000080250920 R_RISCV_64        efi_runtime_services+0x0000000000000018
0000000080250930 R_RISCV_64        efi_runtime_services+0x0000000000000020
0000000080250980 R_RISCV_64        efi_runtime_services+0x0000000000000048
0000000080250990 R_RISCV_64        efi_runtime_services+0x0000000000000050
00000000802509a0 R_RISCV_64        efi_runtime_services+0x0000000000000058
0000000080250940 R_RISCV_64        systab+0x0000000000000030
0000000080250950 R_RISCV_64        systab+0x0000000000000040
0000000080250960 R_RISCV_64        systab+0x0000000000000050
0000000080250970 R_RISCV_64        systab+0x0000000000000060

In these cases the addend needs to be added to the symbol value to get
the correct value for the reloc.

Signed-off-by: Marcus Comstedt <marcus@mc.pp.se>
Cc: Rick Chen <rick@andestech.com>
2019-09-03 09:30:32 +08:00
Heinrich Schuchardt
44de15d686 tools: remove easylogo and include/video_logo.h
include/video_logo.h once was created via the tool easylogo and than used
in cpu/mpc8xx/video.c to display Tux. video_logo.h has been replaced by
include/linux_logo.h and is not needed anymore.

Delete the include and the tool,

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-08-26 11:46:30 -04:00
Heinrich Schuchardt
cd1db46353 easylogo: avoid buffer overrun
Building easylogo with `HOST_TOOLS_ALL=y make tools` results in a build
warning due to a possible buffer overrun:

tools/easylogo/easylogo.c:453:4: note: ‘sprintf’ output between 7 and
262 bytes into a destination of size 256
    sprintf (str, "%s, 0x%02x", app, *dataptr++);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Truncate the output to fit into the destination buffer.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-08-20 12:20:33 -04:00
Marcus Comstedt
4539926a9c riscv: tools: Add big endian target support to prelink-riscv
Signed-off-by: Marcus Comstedt <marcus@mc.pp.se>
Cc: Rick Chen <rick@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2019-08-15 13:42:28 +08:00
Marcus Comstedt
e604410d3e riscv: tools: Fix prelink-riscv to work on big endian hosts
All ELF fields whose values are inspected by the code are converted to
CPU byteorder first.  Values which are copied verbatim (relocation
fixups) are not swapped to CPU byteorder and back as it is not needed.

Signed-off-by: Marcus Comstedt <marcus@mc.pp.se>
Cc: Rick Chen <rick@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2019-08-15 13:42:28 +08:00
Simon Glass
f3998fdc4d env: Rename environment.h to env_internal.h
This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>
2019-08-11 19:27:31 -04:00
Simon Glass
d3716dd64b env: Rename the redundancy flags
Add an ENV prefix to these two flags so that it is clear what they relate
to. Also move them to env.h since they are part of the public API. Use an
enum rather than a #define to tie them together.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-11 16:43:41 -04:00
Simon Glass
be54ec1624 env: Rename environment to embedded_environment
The name 'environment' is widely used in U-Boot so is not a very useful
name of a variable. Rename it to better indicate its purpose.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2019-08-11 16:43:41 -04:00
Simon Glass
9fb625ce05 env: Move env_set() to env.h
Move env_set() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-11 16:43:41 -04:00
Luca Ceresoli
7f492f3c11 tools: zynqmp_psu_init_minimize.sh: fix return lines coding style
Remove unneeded parenthess around return value. E.g.:
    return (0);   ->   return 0;

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2019-07-30 10:20:06 +02:00
Luca Ceresoli
84a2c83263 arm64: zynqmp: add tool to minimize psu_init_gpl.c files
This script transforms a pair of psu_init_gpl.c and .h files produced by
the Xilinx Vivado tool for ZynqMP into a smaller psu_init_gpl.c file that
is almost checkpatch compliant.

Based on a script by Michal Simek.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2019-07-30 10:20:06 +02:00
Luca Ceresoli
4f4b56205e arm64: zynqmp: add tool to convert PMU config object .c to binary
The recently-added ZYNQMP_SPL_PM_CFG_OBJ_FILE option allows SPL to load a
PMUFW configuration object from a binary blob. However the configuration
object is produced by Xilinx proprietary tools as a C source file and no
tool exists to easily convert it to a binary blob in an embedded Linux
build system for U-Boot to use.

Add a simple Python script to do the conversion.

It is definitely not a complete C language parser, but it is enough to
parse the known patterns generated by Xilinx tools, including:

 - defines
 - literal integers, optionally with a 'U' suffix
 - bitwise OR between them

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2019-07-30 10:20:06 +02:00
Tom Rini
de17e1fc03 binman support for replacing files
-----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAl0/Y4EACgkQfxc6PpAI
 reYhFwgAjqO+3dtXVPwo9vX/+9VzWUIMiBalYFZxSqFR2KDSkj+VjQOQCvyQRslv
 RydnyMgMaZbIXoPFU1Fa5Pz9zDDJ0DcG3LPIBi4/2ELH/ezwv1IdL73Ol7ulA+G7
 Z3d7fwa4RWiF35z5Rl/ck1eqOAazZepsmiVQfLKX/KlHz24+nGyWKf49JAqWcfu1
 bAuwKpwg/FIX8ni8JbL2CdNBK4RXAkec3TCcbanT+LlDF6gKyrx0XDv4M+9bsKD4
 REDXOAiQTujM4v5j4VNL97JFg/l68nhMn0CZAJQQ4zS65bnUXEvuCFvqEXD7pGV9
 3Fsw0VroncfvGHnvd3NoNpZ5TfkqDQ==
 =q4Cl
 -----END PGP SIGNATURE-----

Merge tag 'dm-pull-29jul19' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

binman support for replacing files
2019-07-29 17:59:51 -04:00
Tom Rini
2d64a0f7e9 Merge branch '2019-07-29-master-imports'
- Assorted bug fixes
2019-07-29 11:51:17 -04:00
Simon Glass
a6cb995096 binman: Add command-line support for replacing entries
Add a 'replace' command to binman to permit entries to be replaced, either
individually or all at once (using a filter).

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
bb5edc1d3c binman: Correct the error message for invalid path
At present this message references -o for output file. But binman uses -f
now. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
d7fa4e4b22 binman: Split control.WriteEntryToImage() into separate functions
This code has three distinct phases:

1. The image is loaded and the state module is set up
2. The entry is written to the image
3. The image is repacked and written back to the file

Split the code out with three separate functions, one for each phase.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
3ad804e6bd binman: Update control.WriteEntry() to support writing the map
Add the ability to write a new map file. Also tidy up a few comments and
rename a misleading variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
22a76b7428 binman: Move control.WriteEntry further down the file
Move this function after the extraction logic so we can keep the writing
logic in one place.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
f86a736349 binman: Clean up all output directories in tests
At present some tests leave behind output directories. This happens
because some tests call binman, which sets up an output directory, then
call it again, which sets up another output directory and leaves the
original one behind.

Fix this by using a separate temporary directory when binman is called
twice, or by manually removing the output directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
bf574f129b binman: Add a test function to clean up the output dir
Put tearDown()'s logic into a new _CleanupOutputDir() function so that it
can be called from elsewhere.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
f6e02497ae binman: Update state when replacing device-tree entries
Since the state module holds references to all the device trees used by
binman, it must be updated when the device trees are updated. Add support
for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
313533018d patman: Reset the output directory when it is removed
At present outdir remains set ever after the output directory has been
removed. Fix this to avoid trying to access it when it is not present.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
eb0f4a4cb4 binman: Support replacing data in a cbfs
At present binman cannot replace data within a CBFS since it does not
allow rewriting of the files in that CBFS. Implement this by using the
new WriteData() method to handle the case.

Add a header to compressed data so that the amount of compressed data can
be determined without reference to the size of the containing entry. This
allows the entry to be larger that the contents, without causing errors in
decompression. This is necessary to cope with a compressed device tree
being updated in such a way that it shrinks after the entry size is
already set (an obscure case). It is not used with CBFS since it has its
own metadata for this. Increase the number of passes allowed to resolve
the position of entries, to handle this case.

Add a test for this new logic.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
7210c89eac binman: Update Entry.WriteData() to handle special sections
At present this method assumes that the parent section does not need
to recalculate its position or adjust any metadata it may contain. But
when the entry changes size this may not be true. Also if the parent
section is more than just a container (e.g. it is a CBFS) then the
section may need to regenerate its output.

Add a new WriteChildData() method to sections and call this from the
WriteData() method, to handle this situation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
a9cd39ef75 binman: Update Entry.ReadEntry() to work through classes
At present we simply extract the data directly from entries using the
image_pos information. This happens to work on current entry types, but
cannot work if the entry type encodes the data in some way. Update the
ReadData() method to provide the data by calling a new ReadChildData()
method in the parent. This allows the entry_Section class, or possibly
any other container class, to return the correct data in all cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
17a7421ff4 binman: Add a prefix before CBFS hex offsets
Add a 0x prefix to these errors to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
513c53e445 binman: Add a few more features to the wishlist
Add mention of a few other desirable features that may be implemented in
the future.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
27145fd3a8 binman: Place Intel descriptor at image start
The Intel descriptor must always appear at the start of an (x86) image,
so it is supposed to position itself there always. However there is no
explicit test for this. Add one and fix a bug introduced by the recent
change to adjust Entry to read the node in a separate call.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
95a0f3c691 binman: Adjust fmap to ignore CBFS files
The FMAP is not intended to show the files inside a CBFS. The FMAP can be
used to locate the CBFS itself, but then the CBFS must be read to find out
what is in it.

Update the FMAP to work this way and add some debugging while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
61ec04f9ed binman: Support shrinking a entry after packing
Sometimes an entry may shrink after it has already been packed. In that
case we must repack the items. Of course it is always possible to just
leave the entry at its original size and waste space at the end. This is
what binman does by default, since there is the possibility of the entry
changing size every time binman calculates its contents, thus causing a
loop.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
79d3c58d12 binman: Update the _testing entry to support shrinkage
Sometimes entries shrink after packing. As a start towards supporting
this, update the _testing entry to handle the test case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
51014aabc2 binman: Allow updating entries that change size
So far we don't allow entries to change size when repacking. But this is
not very useful since it is common for entries to change size after an
updated binary is built, etc.

Add support for this, respecting the original offset/size/alignment
constraints of the image layout. For this to work the original image
must have been created with the 'allow-repack' property.

This does not support entry types with sub-entries such as files and
CBFS, but it does support sections.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
eba1f0cc94 binman: Add more tests for image header position
The positioning does not currently work correctly if at the end of an
image with no fixed size. Also if the header is in the middle of an image
it can cause a gap in the image since the header position is normally at
the image end, so entries after it are placed after the end of the image.

Fix these problems and add more tests to cover these cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
7400107e46 binman: Move Image.BuildImage() into a single function
Now that an Image is an Entry_section, there is no need for the separate
BuildSection() function. Drop it and add a bit of logging.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
96b6c506ca binman: Write the original input fdtmap to a file
When reading an image in, write its fdtmap to a file in the output
directory. This is useful for debugging. Update the 'ls' command to set up
the output directory; otherwise it will fail.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
4ab88b6f2f binman: Update documentation for image creation
There are a few more steps in the process now. Update the documentation to
reflect this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
12bb1a99c2 binman: Add info to allow safely repacking an image later
At present it is not possible to discover the contraints to repacking an
image (e.g. maximum section size) since this information is not preserved
from the original image description.

Add new 'orig-offset' and 'orig-size' properties to hold this. Add them to
the main device tree in the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
10f9d0066b binman: Support updating entries in an existing image
While it is useful and efficient to build images in a single pass from a
unified description, it is sometimes desirable to update the image later.

Add support for replace an existing file with one of the same size. This
avoids needing to repack the file. Support for more advanced updates will
come in future patches.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
a004f29464 binman: Tidy up _SetupDtb() to use its own temporary file
At present EnsureCompiled() uses an file from the 'output' directory (in
the tools module) when compiling the device tree. This is fine in most
cases, allowing useful inspection of the output files from binman.

However in functional tests, _SetupDtb() creates an output directory and
immediately removes it afterwards. This serves no benefit and just
confuses things, since the 'official' output directory is supposed to be
created and destroyed in control.Binman().

Add a new parameter for the optional temporary directory to use, and use a
separate temporary directory in _SetupDtb().

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
02fd463cfe binman: Allow the fdtmap to remain unchanged
When updating an existing image where the size of all entries remains the
same, we should not need to regenerate the fdtmap. Update the entry to
return the same fdtmap as was read from the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
6ccbfcdd96 binman: Add a constant for common entry properties
We use this same combination of properties several times in tests. Add a
constant for it to avoid typos, etc.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
c5ad04b721 binman: Add a function to obtain the image for an Entry
At present we have an 'image' property in the entry for this purpose, but
this is not necessary and seems error-prone in the presence of
inheritance. Add a function instead. The Entry_section class overrides
this with a special version, since top-level sections are in fact images,
since Image inherits Entry_section.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
c6bd6e235a binman: Adjust Entry to read the node in a separate call
At present the Entry constructor sets up the object and then immediately
reads its device-tree node to obtain its properties.

This breaks a convention that constructors should not do any processing.
A consequence is that we must pass all arguments to the constructor and
cannot have the node-reading proceed in a different way unless we pass
flags to that constructor. We already have a 'test' flag in a few cases,
and now need to control whether the 'orig_offset' and 'orig_size'
properties are set or not.

Adjust the code to require a separate call to ReadNode() after
construction. The Image class remains as it was.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
1411ac8d16 binman: Add an image name into the fdtmap
Since binman supports multiple images it is useful to know which one
created the image that has been read. Then it is possible to look up that
name in the 'master' device tree (containing the description of all
images).

Add a property for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
6ca0dcba5e binman: Store the entry in output_fdt_files
In some cases we want to access the Entry object for a particular device
tree. This allows us to read its contents or update it. Add this
information to output_fdt_files and provide a function to read it.

Also rename output_fdt_files since its name is no-longer descriptive.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
6a3b5b5411 binman: Allow state functions to fail to return data
At present these state functions raise an exception if they cannot find
what is requested. But in some cases the information is optional (e.g. an
fdtmap in a coming patch) so it is better to return gracefully.

Update these two functions to return None when the data cannot be found.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
d5079330f5 binman: Support loading entry data from a file
When modifying an image it is convenient to load the data from the file
into each entry so that it can be reprocessed. Add a new LoadData() method
to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
589d8f917e binman: Store image fdtmap when loading from a file
This data provides all the information about the position and size of each
entry. Store it for later use when loading an image. It can be reused as
is if the image is modified without changing offsets/sizes.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
e44bc831e2 dtoc: Update Fdt.GetNode() to handle the root node
This function currently fails if the root node is requested. Requesting
the root node is sometimes useful, so fix the bug.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
880e9ee650 dtoc: Update Fdt.FromData() to allow a name
It is confusing when something goes wrong with a device tree which was
created from data rather than a file, since there is no identifying
filename. Add an option to provide this. Use the filename as the name,
where available

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
d9dad10e3c binman: Show a helpful error when a DT property is missing
At present a Python exception is raised which does not show the node
information. Add a more helpful exception in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
9f297b09c0 binman: Add a bit of logging in entries when packing
Use the new logging feature to log information about progress with
packing. This is useful to see how binman is figuring things out.

Also update elf.py to use the same feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
fd07336211 patman: Update tout to avoid open-coding the debug levels
Use the debug level constants instead of open-coding them in the file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
f49462e547 binman: Drop state.fdt_set as this is not needed
We can iterate through the output files so don't need this global anymore.
Remove it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
77e4ef1bf4 binman: Simplify state.fdt_subset
At present this excludes the device tree passed in to binman since it
is always returned first by GetAllFdts(). However, this is easy to ensure
by adding a check in that function. Change this dict to includes all
device trees, and rename it to fdt_set.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
fb5e8b163e binman: Adjust state.fdt_files to be keyed by entry type
It makes more sense to use entry type as the key for this dictionary,
since the filename can in principle be anything. Make this change and also
rename fdt_files and add a comment to explain it better.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
4bdd30055c binman: Adjust GetFdt() to be keyed by etype
At present the FDTs are keyed by their default filename (not their actual
filename). It seems easier to key by the entry type, since this is always
the same for each FDT type.

To do this, add a new Entry method called GetFdtEtype(). This is necessary
since some entry types contain a device tree which are not the simple
three entry types 'u-boot-dtb', 'u-boot-spl' or 'u-boot-tpl'.

The code already returns a dict for GetFdt(). Update the value of that
dict to include the filename so that existing code can work.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
726e296129 binman: Rename state.GetFdt()
This function name conflicts with Fdt.Node.GetFdt() which has a different
purpose. Rename it to avoid confusion.

The new name suggests it is indexed by entry type rather than filename.
This will be tidied up in a future commit.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
4bdd115980 binman: Rename state.GetFdts()
This function name conflicts with Entry.GetFdts() which has a different
purpose. Rename it to avoid confusion. Also update a stale comment
relating to this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
a8adb6dfeb binman: Convert GetFdtSet() to use a dict
At present this function returns a set of device-tree filenames. It has no
way of returning the actual device-tree object. Change it to a dictionary
so that we can add this feature in a future patch.

Also drop fdt_set since it is no-longer used.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
a8573c4c8f binman: Move image/fdt code into PrepareImagesAndDtbs()
Further reduce the size of the main Binman() function by moving this setup
code into its own function.

Note that the 'images' value is accessed from other modules so must be made
a global.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
7b773167c0 binman: Use print() to print output
At present tout writes directly to stdout. This is not necessary and it
prevents tests from redirecting output. Change it to use print() for the
non-progress output.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
935461262e binman: Move GetFdtSet() into blob_dtb
At present we check the filename to see if an entry holds a device-tree
file. It is easier to use the base class designed for this purpose.

Move this method implementation into Entry_blob_dtb and update the default
one to return an empty set.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
b88e81c622 binman: Move image-processing code into a function
The Binman() function is very long. Split out the image code to make it
more manageable.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
1000096b06 dtoc: Return a non-zero exit code when tests fail
At present 'dtoc -t' return a success code even if some of the tests fail.
Fix this by checking the test result and setting the exit code. This
allows 'make qcheck' to function as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Heinrich Schuchardt
e35d533c79 tools/logos: remove black background of U-Boot logo
When generating the Sphinx documentation with command 'make htmldocs' the
U-Boot logo is displayed with a black box as a background.

Remove the black box.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-29 09:32:08 -04:00
Heiko Schocher
245b1029e1 bmp_logo: support CONFIG_DM_VIDEO
in case of bmp_logo, the video_bmp driver is used for
drawing a bmp logo. This driver supports only "full"
bmp data. Adding a logo with the bmp_logo tool to
u-boot binary adds currently only real data and drops
the bmp header.

This patch adds now the full bmp data to the u-boot
binary, so video_bmp driver works with the logo embedded
into u-boot.

Fixed also some checkpatch error poping up with this
patch.

Signed-off-by: Heiko Schocher <hs@denx.de>
2019-07-29 00:20:31 +02:00
Baruch Siach
2429613601 buildman: fix invocation examples typos
Also, make command line example indentation consistent.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
2019-07-24 12:54:08 -07:00
Simon Glass
e2705fa9c5 binman: Add a test for nested and aligned sections
Current test coverage is likely sufficient for the logic used to place
sections in the image. However it seems useful to add a test specifically
for nested sections, since these could have some unusual interactions.

Add a new test for this and aligned sections. This test failed before the
refactor to drop the bsection.py file (Section class), but passes now.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24 12:54:08 -07:00
Simon Glass
71ce0ba284 binman: Add an 'extract' command
It is useful to be able to extract all binaries from the image, or a
subset of them. Add a new 'extract' command to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24 12:54:08 -07:00
Simon Glass
3a9c252583 binman: Support reading from CBFS entries
CBFS is a bit like a section but with a custom format. Provide the list of
entries and the compression type to binman so that it can extract the data
from the CBFS, just like any other part of the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24 12:54:08 -07:00
Simon Glass
f667e45b1c binman: Allow reading an entry from an image
It is useful to be able to extract entry contents from an image to see
what is inside. Add a simple function to read the contents of an entry,
decompressing it by default.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24 12:54:08 -07:00
Simon Glass
eea264ead3 binman: Allow for logging information to be displayed
Binman generally operates silently but in some cases it is useful to see
what Binman is actually doing at each step. Enable some logging output
with different logging levels selectable via the -v flag.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24 12:54:08 -07:00
Simon Glass
61f564d15f binman: Support listing an image
Add support for listing the entries in an image. This relies on the image
having an FDT map.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24 12:54:08 -07:00
Simon Glass
8beb11ea6e binman: Convert Image to a subclass of Entry
When support for sections (and thus hierarchical images) was added to
binman, the decision was made to create a new Section class which could
be used by both Image and an Entry_section class. The decision between
using inheritance and composition was tricky to make, but in the end it
was decided that Image was different enough from Entry that it made sense
to put the implementation of sections in an entirely separate class. It
also has the advantage that core Image code does have to rely on an entry
class in the etype directory.

This work was mostly completed in commit:

   8f1da50ccc "binman: Refactor much of the image code into 'section'

As a result of this, the Section class has its own version of things like
offset and size and these must be kept in sync with the parent
Entry_section class in some cases.

In the last year it has become apparent that the cost of keeping things in
sync is larger than expected, since more and more code wants to access
these properties.

An alternative approach, previously considered and rejected, now seems
better.

Adjust Image to be a subclass of Entry_section. Move the code from Section
(in bsection.py) to Entry_section and delete Section. Update all tests
accordingly.

This requires substantial changes to Image. Overall the changes reduce
code size by about 240 lines. While much of that is just boilerplate from
Section, there are quite a few functions in Entry_section which now do not
need to be overiden from Entry. This suggests the change is beneficial
even without further functionality being added.

A side benefit is that the properties of sections are now consistent with
other entries. This fixes a problem in testListCmd() where some properties
are missing for sections.

Unfortunately this is a very large commit since it is not feasible to do
the migration piecemeal. Given the substantial tests available and the
100% code coverage of binman, we should be able to do this safely.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24 12:54:08 -07:00
Simon Glass
ffded7527a binman: Support reading an image into an Image object
It is possible to read an Image, locate its FDT map and then read it into
the binman data structures. This allows full access to the entries that
were written to the image. Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24 12:54:08 -07:00
Simon Glass
2d26003df7 binman: Support locating an image header
Add support for locating an image header in an image.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24 12:54:08 -07:00
Simon Glass
e1925fa520 binman: Support locating an FDT map
Add support for locating an image's Fdt map which is used to determine
the contents and structure of the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24 12:54:08 -07:00
Simon Glass
41b8ba090c binman: Allow listing the entries in an image
It is useful to be able to summarise all the entries in an image, e.g. to
display this to this user. Add a new ListEntries() method to Entry, and
set up a way to call it through the Image class.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24 12:54:08 -07:00
Simon Glass
8a1ad068de binman: Detect bad CBFS file types
Detect when an unknown or unsupported file type is specified and report
an error.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24 12:54:08 -07:00
Simon Glass
69f7cb31a0 binman: Support FDT update for CBFS
It is useful to add the CBFS file information (offset, size, etc.) into
the FDT so that the layout is complete. Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24 12:54:08 -07:00