Commit graph

3278 commits

Author SHA1 Message Date
Tom Rini
6bd2372094 env: Rework ENV_IS_EMBEDDED and related logic slightly
- Drop CONFIG_BUILD_ENVCRC as this is never set directly but instead
  means ENV_IS_EMBEDDED, so reference that in code and rename the Makefile
  usage to BUILD_ENVCRC.
- Remove extra-$(CONFIG_ENV_IS_EMBEDDED) line as it could never be true,
  and likely why there is an extra- line for CONFIG_ENV_IS_IN_FLASH (the
  only use case today of embedded environments).
- With these slight changes we can then see that using the calculated
  symbol of ENV_IS_EMBEDDED is the right thing to use in any code which
  needs to know this situation and can remove CONFIG_ENV_IS_EMBEDDED
  entirely.

Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-22 10:31:47 -05:00
Max Krummenacher
486aef08de u-boot-initial-env: rework make target
With LTO enabled the U-Boot initial environment is no longer stored
in an easy accessible section in env/common.o. I.e. the section name
changes from build to build, its content maybe compressed and it is
annotated with additional data.

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

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

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-08 09:29:02 -05:00
Marc Kleine-Budde
28f924f265 tools: mkimage: add new image type "fdt_legacy"
If the user select the image type "flat_dt" a FIT image will be build.
This breaks the legacy use case of putting a Flat Device Tree into a
legacy u-boot image.

Add a new image type "fdt_legacy" to build a legacy u-boot image
with a "flat_dt" type.

Link: https://lore.kernel.org/all/20221028155205.ojw6tcso2fofgnhm@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
2022-12-08 09:29:02 -05:00
Marc Kleine-Budde
72c3f5dbd9 tools: mkimage: don't print error message "Success" in case of failure
In case there's no struct image_type_params::set_header callback, no
"errno" will be set. Don't fail with an error message, followed by
"Success". Remove the printing of the human readable "errno" value.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-08 09:29:02 -05:00
Mikhail Ilin
4b95e8407e tools: fdtgrep: Fix handle leak
The handle "fd" was created in fdtgrep.c:708 by calling the
 "open" function and is lost in fdtgrep.c:716 and fdtgrep.c:723.
 Close file descriptor 'fd' before exiting with an error from function
 utilfdt_read_err_len(const char *filename, char **buffp, off_t *len).

Fixes: 1043d0a029 ("fdt: Add fdtgrep tool")
Signed-off-by: Mikhail Ilin <ilin.mikhail.ol@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-08 09:29:02 -05:00
Mikhail Ilin
17f8a74876 tools: mkimage: Fix nullptr at strchr()
The copy_datafile(ifd, params.datafile) function has been
 implemented to copy data by reducing the number of lines in the main
 function.

Signed-off-by: Mikhail Ilin <ilin.mikhail.ol@gmail.com>
2022-12-08 09:29:01 -05:00
Mikhail Ilin
2d1b2ac13f tool: ifwitool: Fix buffer overflow
An incorrect 1st parameter is passed to the fix_member()
 function. Should use a pointer to the beginning of the parent structure
 (bpdt or subpart_dir, because are boxed), not to their fields. Otherwise,
 this leads to an overrun of the structure boundary, since in the
 fix_member() function, an 'offset' is made, relative to the 1st argument,
 which itself is an 'offset' from the beginning of the structure.

Signed-off-by: Mikhail Ilin <ilin.mikhail.ol@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-08 09:25:44 -05:00
Mikhail Ilin
164232943c tool: ifwitool: The function localtime() can return NULL.
This will cause the local_time pointer is passed as the 4th argument
 to function strftime() to also point to NULL. This result in a
 segmentation fault. Thus, it's necessary to add a check of the local_time
 pointer to NULL.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Mikhail Ilin <ilin.mikhail.ol@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-08 09:25:44 -05:00
Jaehoon Chung
c059a22b77 tools: env: fw_env: Fix unused-result warning
Fix unused-result warning about fread.

tools/env/fw_env.c: In function ‘find_nvmem_device’:
tools/env/fw_env.c:1751:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
 1751 |   fread(buf, sizeof(buf), 1, fp);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-12-08 09:25:44 -05:00
Tom Rini
09ed7e62f3 CI: Update to gcc-12.2
- Update to gcc-12.2, and cherry-pick a fix in grub for risc-v

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-06 15:30:30 -05:00
Tom Rini
83e37a8345 buildman: Fetch 12.2.0 toolchains by default
Update the toolchain list to be first 12.2.0 and second 11.1.0 and
that's it.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-06 15:30:30 -05:00
Tom Rini
65cc0e2a65 global: Move remaining CONFIG_SYS_* to CFG_SYS_*
The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-05 16:06:08 -05:00
Marek Vasut
c246d69f31 tools: mkenvimage: Drop duplicate crc header include
This header was already included just above version.h,
do not include it twice.

Fixes: 3db7110857 ("crc32: Use the crc.h header for crc functions")
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-11-23 13:06:12 -05:00
Simon Glass
8dd0059f77 binman: Add documentation for the command line args
Add command-line documentation for binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-22 15:13:35 -07:00
Tom Rini
d7713ad36f buildman: Add --allow-missing flag to allow missing blobs
Add a new flag to buildman so that we will in turn pass
BINMAN_ALLOW_MISSING=1 to 'make'. Make use of this flag in CI.

Allow the settings file to control this.

Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-22 15:13:35 -07:00
Simon Glass
5f319fa728 buildman: Reinstate removal of temp output dir in tests
This was dropped my mistake. Reinstate it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: d829f1217c ("bulidman: Add support for a simple build")
2022-11-22 15:13:35 -07:00
Simon Glass
301cd7431a buildman: Ensure config_fname is inited
Init this variable at the top level since it is a global.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-22 15:13:35 -07:00
Simon Glass
85760a690d binman: Add a separate section about environment variables
These are documented in various several sections. Add a new section that
mentions them all in one place so it is easier to see what environment
variables can be used to control U-Boot's use of binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2022-11-22 15:13:35 -07:00
Simon Glass
35b6e53d0d buildman: Detect binman reporting missing blobs
Buildman should consider a build as a success (with warnings) if missing
blobs have been dealt with by binman, even though buildman itself returns
and error code overall. This is how other warnings are dealt with.

We cannot easily access the 103 exit code, so detect the problem in the
output.

With this change, missing blobs result in an exit code of 101, although
they still indicate failure.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-22 15:13:35 -07:00
Simon Glass
cd6889d896 buildman: Drop mention of old architectures
Support for some architectures has been removed since buildman was first
written. Also all toolchains are now available at kernel.org so we don't
need the links, except for arc where the kernel.org toolchain fails to
build all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-22 15:13:34 -07:00
Simon Glass
3da04ff1d3 buildman: Update the default settings file
The settings file omits a few lines which are useful for getting every
board building. Add these and update the documentation tool.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-22 15:13:34 -07:00
Simon Glass
ce59252df5 buildman: Update the arc toolchain
There is one on kernel.org but it does not build the hsdk_4xd board. Add
a link to one which does.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-22 15:13:34 -07:00
Simon Glass
274d05303d buildman: Drop mention of MAKEALL
This script was removed about 6 years ago so most people should be aware
that it is not needed anymore. Drop mention of it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-22 15:13:34 -07:00
Simon Glass
74df491051 buildman: Convert documentation to rST
Convert the buildman documentation to rST format and include it in the
'build' section.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <foss+uboot@0leil.net>
2022-11-22 15:13:34 -07:00
Simon Glass
b38da15a05 binman: Use an exit code when blobs are missing
At present binman returns success when told to handle missing/faked blobs
or missing bintools. This is confusing since in fact the resulting image
cannot work.

Use exit code 103 to signal this problem, with a -W option to convert
it to a warning.

Rename the flag to --ignore-missing since it controls bintools also.

Add documentation about exit codes while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-11-22 15:13:34 -07:00
Quentin Schulz
fb132b3727 Revert "binman: btool: gzip: fix packer name so that binary can be found"
This reverts commit daa2da754a.

This commit is not needed anymore since the btool_ prefix is
automatically stripped by bintool.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-11-22 15:13:34 -07:00
Quentin Schulz
478332a345 binman: bintool: remove btool_ prefix from btool names
The binary is looked on the system by the suffix of the packer class.
This means binman was looking for btool_gzip on the system and not gzip.

Since a btool can have its btool_ prefix missing but its module and
binary presence on the system appropriately found, there's no need to
actually keep this prefix after listing all possible btools, so let's
remove it.

This fixes gzip btool by letting Bintool.find_bintool_class handle the
missing prefix and still return the correct class which is then init
with gzip name instead of btool_gzip.

Additionally, there was an issue with the cached module global variable.
The variable only stores the module and not the associated class name
when calling find_bintool_class.
This means that when caching the module on the first call to
find_bintool_class, class_name would be set to Bintoolbtool_gzip but the
module_name gzip only, adding the module in the gzip key in the module
dictionary. When hitting the cache on next calls, the gzip key would be
found, so its value (the module) is used. However the default class_name
(Bintoolgzip) is used, failing the getattr call.

Instead, let's enforce the same class name: Bintool<packer>, whatever
the filename it is contained in.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-11-22 15:13:34 -07:00
Sughosh Ganu
f65ee99b9d mkeficapsule: Add support for setting OEM flags in capsule header
Add support for setting OEM flags in the capsule header. As per the
UEFI specification, bits 0-15 of the flags member of the capsule
header can be defined per capsule GUID.

The oemflags will be used for the FWU Multi Bank update feature, as
specified by the Dependable Boot specification[1]. Bit
15 of the flags member will be used to determine if the
acceptance/rejection of the updated images is to be done by the
firmware or an external component like the OS.

[1] - https://git.codelinaro.org/linaro/dependable-boot/mbfw/uploads/6f7ddfe3be24e18d4319e108a758d02e/mbfw.pdf

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
2022-10-31 14:47:33 -04:00
Sughosh Ganu
6da9271af1 mkeficapsule: Add support for generating empty capsules
The Dependable Boot specification[1] describes the structure of the
firmware accept and revert capsules. These are empty capsules which
are used for signalling the acceptance or rejection of the updated
firmware by the OS. Add support for generating these empty capsules.

[1] - https://git.codelinaro.org/linaro/dependable-boot/mbfw/uploads/6f7ddfe3be24e18d4319e108a758d02e/mbfw.pdf

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
2022-10-31 14:47:33 -04:00
Sughosh Ganu
873cf8ac70 test: dm: Add test cases for FWU Metadata uclass
Add test cases for accessing the FWU Metadata on the sandbox
platform. The sandbox platform also uses the metadata access driver
for GPT partitioned block devices.

The FWU feature will be tested on the sandbox64 variant with a raw
capsule. Remove the FIT capsule testing from sandbox64 defconfig --
the FIT capsule test will be run on the sandbox_flattree variant.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-10-31 14:47:33 -04:00
Simon Glass
d2afb9edce binman: Support writing symbols into ELF files
In some cases the ELF version of SPL builds may be packaged, rather
than a binary .bin file. Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31 11:02:44 -04:00
Simon Glass
3fbba5568c binman: Handle writing ELF symbols in the Entry class
This feature is used by several etypes and we plan to add more that use
it. Make symbol writing a feature of the base class to reduce the code
duplication.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31 11:01:31 -04:00
Simon Glass
2b8b27fb8d binman: Split out looking up a symbol into a function
Move this code into its own function so it can be used from tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31 11:01:31 -04:00
Simon Glass
28565796df binman: Allow obtaining a symbol value
Provide a function to obtain the integer value of an ELF symbol. This will
be used

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31 11:01:31 -04:00
Simon Glass
984639039f Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE
The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31 11:01:31 -04:00
Simon Glass
e8da1da82f buildman: Handle the MAINTAINERS 'N' tag
This is needed for some soon-to-be-applied patches. Scan the configs/
directory to see if any of the files match.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com>
Suggested-by: Tom Rini <trini@konsulko.com>
2022-10-31 08:54:42 -04:00
Tom Rini
218e2c45af - fix [hv]sync active vs back porch in dw_mipi_dsi
- simplefb rotation support
  - support splash as raw image from MMC
  - enhancements to Truetype console (multiple fonts and sizes)
  - drop old LCD support
 -----BEGIN PGP SIGNATURE-----
 
 iGwEABECACwWIQSC4hxrSoIUVfFO0kRM6ATMmsalXAUCY17nfA4cYWd1c3RAZGVu
 eC5kZQAKCRBM6ATMmsalXPPoAJ0UYyt3kwslUlAJhOC+KU9UlYnVuwCbBXIQyBua
 K5clq+GyxXfaDl2Hnvc=
 =XXVp
 -----END PGP SIGNATURE-----

Merge tag 'video-20221030' of https://source.denx.de/u-boot/custodians/u-boot-video

 - fix [hv]sync active vs back porch in dw_mipi_dsi
 - simplefb rotation support
 - support splash as raw image from MMC
 - enhancements to Truetype console (multiple fonts and sizes)
 - drop old LCD support
2022-10-30 17:16:35 -04:00
Simon Glass
b86986c7b3 video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO
Now that all the old code is gone, rename this option. Driver model
migration is now complete.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:07:17 +01:00
Simon Glass
1dc6517649 Drop CONFIG_LCD_LOGO
This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:07:16 +01:00
Neha Malcom Francis
3545e8595c binman: Add support for symlinking images
Adding support to symlink an image packaged using binman.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Sean Anderson
0abe3323f5 mkimage: fit: Fix signing of configs with external data
Just like we exclude data-size, data-position, and data-offset from
fit_config_check_sig, we must exclude them while signing as well.

While we're at it, use the FIT_DATA_* defines for fit_config_check_sig
as welll.

Fixes: 8edecd3110 ("fit: Fix verification of images with external data")
Fixes: c522949a29 ("rsa: sig: fix config signature check for fit with padding")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-26 11:36:06 -04:00
Simon Glass
3379926602 docker: Install pyelftools for builds
Binman needs this module to build sandbox_vpl and it is needed elsewhere
in CI.

Add it to the docker file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xpyron.glpk@gmx.de>
2022-10-17 10:38:47 -04:00
Andrew Davis
fa1f99a521 tools: k3_gen_x509_cert: Do not print SWRV on build
This matches the others here.

Signed-off-by: Andrew Davis <afd@ti.com>
2022-10-12 08:56:24 -04:00
Steven Lawrance
7c5eeb8309 image-pre-load: Move macros/definitions to image.h
Putting these definitions in a header will allow signatures to be
validated independently of bootm.

Signed-off-by: Steven Lawrance <steven.lawrance@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-11 15:40:48 -04:00
Heinrich Schuchardt
3672ed7127 buildman: differentiate between riscv32, riscv64
riscv32 needs a different toolchain than riscv64

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>
2022-10-07 08:42:51 -04:00
Heinrich Schuchardt
e2ce13c4a7 docker: install riscv32 toolchain
For building riscv32 targets we should use the riscv32 toolchain.
Add it to the Docker image.

Drop the riscv toolchain-alias as we do not need it in future.

While in here, update to the latest "jammy" tag.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>
[trini: Update to latest jammy tag]
Signed-off-by: Tom Rini <trini@konsulko.com>
2022-10-07 08:42:21 -04:00
Pali Rohár
cbd0043e20 tools: kwbimage: Verify maximal kwbimage header size
BootROM loads kwbimage header to L2-SRAM and BootROM reserve only 192 kB for it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2022-10-06 10:15:35 +02:00
Tom Rini
2d45913534 Merge branch 'next' 2022-10-03 15:39:46 -04:00
Simon Glass
f3543e6944 treewide: Drop image_header_t typedef
This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29 16:07:57 -04:00
Miaoqian Lin
316590db29 tools: env: Fix missing closedir in ubi_get_volnum_by_name
The function calls opendir() but missing the corresponding
closedir() before exit the function.
Add missing closedir() to fix it.

Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
2022-09-29 10:10:39 -04:00