Commit graph

3367 commits

Author SHA1 Message Date
Pali Rohár
8562a1c6a4 tools: kwboot: Fix parsing SDIO kwbimage
Despite the official specification, Marvell BootROM does not interpret
srcaddr from SDIO image as offset in number of sectors (like for SATA
image), but as offset in bytes (like for all other images except SATA).

To parse SDIO kwbimage in the same way as Marvell BootROM, it is needed to
interpret srcaddr in bytes. This change fixes loading of SDIO images via
kwboot over UART.

Fixes: 792e423550 ("tools: kwboot: Patch source address in image header")
Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Pali Rohár
14b866e6d6 tools: kwbimage: Fix generating, verifying and extracting SDIO kwbimage
Despite the official specification, Marvell BootROM does not interpret
srcaddr from SDIO image as offset in number of sectors (like for SATA
image), but as offset in bytes (like for all other images except SATA).

To generate SDIO kwbimage compatible with Marvell BootROM, it is needed to
have srcaddr in bytes. This change fixes SDIO images for Armada 38x SoCs.

Fixes: 501a54a29c ("tools: kwbimage: Fix generation of SATA, SDIO and PCIe images")
Fixes: 5c61710c98 ("tools: kwbimage: Properly set srcaddr in kwbimage v0")
Fixes: e0c243c398 ("tools: kwbimage: Validate data checksum of v1 images")
Fixes: aa6943ca31 ("kwbimage: Add support for extracting images via dumpimage tool")
Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01 06:39:17 +01:00
Tom Rini
5b197eee33 Prepare v2023.04-rc3
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmP9LHYACgkQFHw5/5Y0
 tyw3Ogv+IhcqqlK1MpF6me6j0nyZpl5Vc29J+ghO8xPr/nzEhlcq8HUcBdM8QaEd
 3oMkD6m6HsZMWjrz/eWM5Oa742j/yqfbr+6H7NwFutyNOQ/aIrCoD9fbAzszd2ii
 fANFn0vftOApnqn0dHXqodam31+MrOWnffcz2jyJXvhwcFxYDcv5yboFsFA5GVtA
 5l3ko8PGaRp/RwNAqMlEWX3DgXWKjglIo+yiyntJqh3HJ+t3BMlwIrhq1NdWQxPk
 M3K5znl836bb10ULXeItGMtdlPviqRKzqqgy6HgVU/66qaoJUFzdL0kyydWqR/Zv
 5XrFvvyYT9go3IA6mnZmNsO4/L/lEUEOXRsQWoPxW/QROuNtltuEpxwjmg+pDLlr
 9uV/ZdEGtHj/fEPEs6BdslnrQmGGA0akzBh85jcofE8Lm7+7RB1uIj9hUrOub4Qr
 DKQHUORVmu3qVOQgK03VIHBg43figMCEU4voZbuFeVUdXC6FQHpQrxSxL7uemrvW
 Cg8/Hyrc
 =PwNP
 -----END PGP SIGNATURE-----

Merge tag 'v2023.04-rc3' into next

Prepare v2023.04-rc3
2023-02-27 17:28:21 -05:00
Tom Rini
7a826ded4a Dockerfile: Add missing "chmod" of u-boot-gen-combined
I had added this line locally, rebuild the image, but didn't ensure that
I had committed the correct version of the patch as well.

Fixes: 75b031ee4a ("Dockerfile: download binaries for Nokia RX-51")
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-02-27 17:18:51 -05:00
Heinrich Schuchardt
ed319bad22 Dockerfile: build qemu for Nokia n900
Using a pre-built QEMU saves a lot of time when testing.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-24 11:54:44 -05:00
Heinrich Schuchardt
75b031ee4a Dockerfile: download binaries for Nokia RX-51
Downloading files for a test may fail if the server is offline.
It is preferable to provide the files in our Docker image.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-24 11:54:44 -05:00
Rick Chen
7574b6476a riscv: binman: Add help message for missing blobs
Add the 'missing-msg' for more detailed output
on missing system firmware.

Signed-off-by: Rick Chen <rick@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
2023-02-17 19:07:48 +08:00
Simon Glass
48be546b70 checkpatch: Add a warning for pre-schema driver model tags
Help ensure that these don't creep into development by adding a check in
checkpatch for them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-14 09:43:27 -07:00
Simon Glass
0a06d71061 dm: doc: Move to new driver model schema
Now that Linux has accepted these tags, update the dtoc tool to use them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-14 09:43:27 -07:00
Simon Glass
e316fbabbf dm: treewide: Complete migration to new driver model schema
Update various build and test components to use the new schema.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-14 09:43:27 -07:00
Simon Glass
193d3dbd45 binman: Show the image name for the top-level section
At present we show 'main section' as the top-level section name. It may
be more helpful to show the actual image name. This is tricky because
Image is a parent class of Entry_section, so there is no distinction
between an image and a section.

Update it to show the image name.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-12 17:33:51 -07:00
Tom Rini
16bf3b6f8f CI, Docker: Update to Jammy 2023016 tag
Move to the latest tag for "Jammy" and rebuild the containers.

Signed-off-by: Tom Rini <trini@konsulko.com>
2023-02-11 12:22:35 -05:00
Simon Glass
71d3e7949c Docker: Support trace-cmd
Build trace-cmd as part of the docker image, so that trace tests can be
used. Unfortunately the version provided by distributions is a little old
and has bugs. It also does not support specifying the time base for the
trace, which is required to convert microseconds to nanaseconds.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:35 -05:00
Simon Glass
97f3024d16 trace: Provide a flamegraph that uses timing
Add a second variant of the flame graph that shows records in terms of the
number of microseconds used by each call stack. This is a useful way of
seeing where time is going within the execution of U-Boot.

This requires a call stack that records the start time of each function,
as well as a way of subtracting all time consumed by child functions, so
that this time is not counted twice by the flamegraph. The time values in
the output are just for the function itself, not for its children.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:35 -05:00
Simon Glass
47b89d61f2 trace: Support output of a flamegraph
It is useful to see how many times each function is called, particularly
in the context of its callers. A flamegraph is a way of showing this.

Support output in this format which can be used by the flamegraph.pl
script, to generate an SVG image for browsing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:35 -05:00
Simon Glass
b54d8cf0b5 trace: Support output of funcgraph records
Add support for writing ftrace records in the 'funcgraph' format, which
shows function entry and exit points as well as the time taken by each
function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:35 -05:00
Simon Glass
88716b5503 trace: Use text_base from the trace header
Use the information in the trace header instead of reading it from the
trace records. Add debugging to check that System.map and the trace header
agree on this value.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:35 -05:00
Simon Glass
b15a16adf5 trace: Drop use of objsection
This feature was only partly implemented and serves no current purpose.
Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:35 -05:00
Simon Glass
be16fc81b2 trace: Update proftool to use new binary format
The old text format is not much used anymore. Instead a new trace-cmd tool
has introduced a binary format for trace records.

Add support for generating this format. This involves removing the old
text format, adding various helpers for the new format and adjusting the
code to use an output file instead of stdout.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:35 -05:00
Simon Glass
9efc0b279b trace: Rename prof to trace and improve comments
The current use of 'profile' in some places is confusing. Update the code
to use the word 'trace' consistently. Change the flags to better match
their meaning and add some more comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-11 12:22:35 -05:00
Tom Rini
e38cdc684b Dockerfile: Update QEMU git location
Per https://www.qemu.org/contribute/ the official location of the QEMU
sources are https://gitlab.com/qemu-project/qemu.git

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-02-11 09:56:28 -05:00
Heinrich Schuchardt
eeb55254dd buildman: invalid reference to README
The readme file for buildman is called buildman.rst.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-10 13:05:39 +01:00
Simon Glass
b1dcc3355c tools: Drop xway-swap-bytes tool
This is very old and does not appear to be used. The CONFIG option
enabling it is no-longer present. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-07 14:33:50 -05:00
Simon Glass
aeca5194ce Drop ubsha1 tool
This seems to have been used by ppc4xx which was removed a while back.
The Kconfig does not exist so it is never built. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-07 14:33:49 -05:00
Simon Glass
efabbe60d2 imx: Rename CONFIG_MXS to CFG_MXS
This is not a Kconfig option so we should not be setting it in the
Makefile. Rename it to use a CFS_ prefix, since this is still used in
mxsimage.c

In general tools should support all the features without reference to
CONFIG options, but this is left to the maintainer to look at.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-07 14:33:48 -05:00
Simon Glass
65e62037dd moveconfig: Add an option to compare Kconfig against source
Sometimes the Makefile rules or source code refers to Kconfig options
which don't exist. Update the moveconfig tool to check this and produce
a series of reports about inconsistencies.

This can then be used to generate patches to correct the problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-07 14:33:47 -05:00
Pali Rohár
598e911f23 tools: default_image: Accept images with padding
If image file is stored on flash partition then it contains padding, which
is not part of the image itself. Image data size is stored in the image
header. So use image size from the header instead of expecting that total
image file size is size of the header plus size of the image data. This
allows dumpimage to parse image files with padding (e.g. dumped from flash
partition).

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-06 17:10:14 -05:00
Pali Rohár
3f837b06b7 tools: default_image: Verify header size
Before reading image header, verify that image size is at least size of
the image header.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-06 14:35:14 -05:00
Pali Rohár
afd82187b5 tools: imagetool: Skip autodetection of gpimage type
gpimage type requires only that two first 32-bit words of data file are
non-zero. So basically every random data file can be guessed and verified
as gpimage. So completely skip gpimage type from image autodetection code
to prevent lot of false positive results. Data file with gpimage type can
be still verified and parsed by explicitly specifying -T gpimage.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-06 14:35:14 -05:00
Pali Rohár
6c58aa1e61 tools: imagetool: Show error message when detecting image type failed
Signed-off-by: Pali Rohár <pali@kernel.org>
2023-02-06 14:35:14 -05:00
Pali Rohár
27e46a991c tools: imagetool: Fix error message when verify_header is undefined
Signed-off-by: Pali Rohár <pali@kernel.org>
2023-02-06 14:35:14 -05:00
Nikhil M Jain
03610ebf35 tools: logos: Add TI logo files
The default splashfile name saved is ti.gz. User can use these
logo files and use it to test splash screen.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
2023-02-04 18:19:00 +01:00
Mikhail Ilin
f75e92f7f7 tools: imx8image: Fix handle leak
The handle "fd" was created in imx8image.c:249 by calling the "fopen"
 function and is lost in imx8image.c:282.
 Should close the 'fd' file descriptor before exiting the
 parse_cfg_file(image_t *param_stack, char *name) function.

Fixes: a2b96ece5b ("tools: add i.MX8/8X image support")
Signed-off-by: Mikhail Ilin <ilin.mikhail.ol@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-30 23:23:01 +01:00
Mikhail Ilin
9017785acd tools: imx8mimage: Fix handle leak
The handle "fd" was created in imx8mimage.c:178 by calling
 the "fopen" function and is lost in imx8mimage.c:210.
 Should close the 'fd' file descriptor before exiting
 the parse_cfg_file(char *name) function.

Fixes: 6609c2663c ("tools: add i.MX8M image support")
Signed-off-by: Mikhail Ilin <ilin.mikhail.ol@gmail.com>
2023-01-30 23:23:01 +01:00
Mikhail Ilin
507a70b144 tools: imximage: Fix check array index
The struct dcd_v1_t is initialized to MAX_HW_CFG_SIZE_V1 (60)
 structs 'dcd_type_addr_data_t', so the indexes to use on its elements
 are [0,59]. But on line 478, the variable 'length' can take on the value
 60, which applies to array overflow: cd_v1->addr_data[length].type Thus,
 it is necessary to tighten the check on the 'size' variable on line 463.

Fixes: 0b0c6af387 ("Prepare v2020.01")
Signed-off-by: Mikhail Ilin <ilin.mikhail.ol@gmail.com>
2023-01-30 23:23:01 +01:00
Massimo Pegorer
b93a65209c mkimage: fit: Support signed configurations in 'auto' FITs
Extend support for signing in auto-generated (-f auto) FIT. Previously,
it was possible to get signed 'images' subnodes in the FIT using
options -g and -o together with -f auto. This patch allows signing
'configurations' subnodes instead of 'images' ones (which are hashed),
using option -f auto-conf instead of -f auto. Adding also -K <dtb> and
-r options, will add public key to <dtb> file with required = "conf"
property.

Summary:
    -f auto => FIT with crc32 images
    -f auto -g ... -o ... => FIT with signed images
    -f auto-conf -g ... -o ... => FIT with sha1 images and signed confs

Example: FIT with kernel, two device tree files, and signed
configurations; public key (needed to verify signatures) is
added to u-boot.dtb with required = "conf" property.

mkimage -f auto-conf -A arm -O linux -T kernel -C none -a 43e00000 \
        -e 0 -d vmlinuz -b /path/to/first.dtb -b /path/to/second.dtb \
        -k /folder/with/key-files -g keyname -o sha256,rsa4096 \
        -K u-boot.dtb -r kernel.itb

Example: Add public key with required = "conf" property to u-boot.dtb
without needing to sign anything. This will also create a useless FIT
named unused.itb.

mkimage -f auto-conf -d /dev/null -k /folder/with/key-files \
        -g keyname -o sha256,rsa4096 -K u-boot.dtb -r unused.itb

Signed-off-by: Massimo Pegorer <massimo.pegorer@vimar.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-27 12:51:27 -05:00
Simon Glass
a092f1e906 ifwitool: Fix member access
On a second and third look, a recent patch seems to be writing to the
wrong place - updating offsets from the address of the pointer instead
of what the pointer points to.

Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 2d1b2ac13f ("tool: ifwitool: Fix buffer overflow")
Acked-by: Sean Anderson <seanga2@gmail.com>
2023-01-27 12:51:26 -05:00
Simon Glass
060a65e899 binman: Fix a test-coverage regression
Unfortunately a recent patch snuck through without the require test
coverage. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 571bc4e67d ("binman: Support positioning an entry by and ELF symbol")
2023-01-26 10:47:45 -07:00
Samuel Holland
b01ae03c0b binman: Add 'min-size' entry property
This property sets the minimum size of an entry, including padding but
not alignment. It can be used to reserve space for growth of an entry,
or to enforce a minimum offset for later entries in the section.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-26 10:47:45 -07:00
Jonas Karlman
f584d44c23 binman: Add support for selecting firmware to use with split-elf
In some cases it is desired for SPL to start TF-A instead of U-Boot
proper. Add support for a new property fit,firmware that picks a
valid entry and prepends the remaining valid entries to the
loadables list generated by the split-elf generator.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-26 10:47:45 -07:00
Jonas Karlman
00b3d53f15 binman: Add special subnodes to the nodes generated by split-elf
Special nodes, hash and signature, is not being added to the nodes
generated for each segment in split-elf operation.

Copy the subnode logic used in _gen_fdt_nodes to _gen_split_elf to
ensure special nodes are added to the generated nodes.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-26 10:47:45 -07:00
Jonas Karlman
9b2fd2d228 binman: Add support for align argument to mkimage tool
Add support to indicate what alignment to use for the FIT and its
external data. Pass the alignment to mkimage via the -B flag.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-26 10:47:45 -07:00
Maxim Cournoyer
4c59078895 patman: symlink top level .checkpatch.conf
This makes it possible to run the patman test suite simply by invoking
'pytest' from the patman sub-directory:

  $ cd tools/patman
  $ pytest

Otherwise, the top level .checkpatch.conf would be ignored and
multiple test_checkpatch.py tests would fail.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-18 14:55:41 -07:00
Maxim Cournoyer
da413b5635 Revert "patman: invoke the checkpatch.pl script with '--u-boot' and '--strict'"
This reverts commit 648d8186dd, because
it broke usage of patman on Linux, whose check script doesn't know
about '--strict' or '--u-boot'.

Reported-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Sjoerd Simons <sjoerd@collabora.com>
2023-01-18 14:55:41 -07:00
Simon Glass
571bc4e67d binman: Support positioning an entry by and ELF symbol
In some cases it is useful to position an entry over the top of a symbol
in an ELF file. For example, if the symbol holds a version string then it
allows the string to be accessed from the fdtmap.

Add support for this.

Suggested-by: Pali Rohár <pali@kernel.org>
Suggested-by: Keith Short <keithshort@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-18 14:55:41 -07:00
Simon Glass
8f5afe21ae dtoc: Add a way to read a phandle with params
Add a function to read a phandle and associated name and offset. This is
useful for binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-18 14:55:41 -07:00
Simon Glass
c1157860c5 binman: Provide general support for updating ELF symbols
The current support for updating variables in a binary is hard-coded to
work with U-Boot:

- It assumes the image starts at __image_copy_start
- It uses the existing U-Boot-specific entry types

It is useful for other projects to use these feature.

Add properties to enable writing symbols for any blob, a way of specifying
the base symbol and a way of providing the ELF filename to allow symbol
lookup to take place.

With this it is possible to update a Zephyr image, such as zephyr.bin
after it has been built.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-18 14:55:41 -07:00
Simon Glass
9766f69c98 binman: Support overlapping entries
In some cases it is useful to have an entry overlap with another in a
section, either to update the contents within a blob, or to add an entry
to the fdtmap that covers only part of the blob.

Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-18 14:55:41 -07:00
Simon Glass
97fb8081ec binman: Add a function to check for special section nodes
This appears in two places in the code. Use a shared function instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-18 14:55:40 -07:00
Simon Glass
62ef2f7bf3 binman: Add a null entry
It is sometimes useful to define an entry which does not have its own
contents but does appear in the image. The contents are set by the section
which contains it, even though it appears as an entry in the fdtmap.

Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-18 14:55:40 -07:00