Commit graph

2500 commits

Author SHA1 Message Date
Mattijs Korpershoek
a525656c5b android: boot: Add set_abootimg_addr() and set_avendor_bootimg_addr()
The only way to configure the load addresses for both bootimg and
vendor_bootimg is by using the "abootimg" command.
If we want to use the C API, there is no equivalent.

Add set_abootimg_addr() and set_avendor_bootimg_addr() so that we can
specify the load address from C.

This can be useful for implementing an Android bootmethod.

Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Reviewed-by: Julien Masson <jmasson@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Guillaume La Roque <glaroque@baylibre.com>
Tested-by: Guillaume La Roque <glaroque@baylibre.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-07-18 13:51:30 -06:00
Anand Moon
608a88c270 Fix Kconfig coding style from spaces to tab
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
	$ sed -e 's/^        /\t/' -i */Kconfig

Signed-off-by: Anand Moon <linux.amoon@gmail.com>
2024-07-05 13:57:02 -06:00
Maxim Moskalets
2abf14df5d cmd: bootm: add ELF file support
Some operating systems (e.g. seL4) and embedded applications are ELF
images. It is convenient to use FIT-images to implement trusted boot.
Added "elf" image type for booting using bootm command.

Signed-off-by: Maxim Moskalets <maximmosk4@gmail.com>
2024-07-05 13:57:02 -06:00
Tom Rini
f0a259c25f Merge patch series "m68k: Implement a default flush_dcache_all"
Tom Rini <trini@konsulko.com> says:

Prior to this series we had some de-facto required cache functions that
were either unimplemented on some architectures or differently named.
This would lead in some cases to having multiple "weak" functions
available as well. Rework things so that an architecture must provide
these functions and it is up to that architecture if a "weak" default
function makes sense, or not.
2024-07-03 14:42:11 -06:00
Tom Rini
7d6cee2cd0 cmd: cache: Remove weak functions
It should be up to an architecture to decide how to implement cache
functions, and if they need to use weak functions or not. Allowing the
cache command to be built without cache functionality implemented is
unhelpful. Further, guard the call to noncached_set_region with
CONFIG_SYS_NONCACHED_MEMORY as that's when it's implemented and again is
an architecture specific detail.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2024-07-03 14:42:01 -06:00
Tom Rini
005105b11c Merge tag 'ubifixes-for-v2024-10-rc1' of https://source.denx.de/u-boot/custodians/u-boot-ubi
ubi changes for v2024.10-rc1

fs: ubifs: Add support for ZSTD decompression
  from Piotr Wojtaszczyk

Fixes for ubi command from Martin Kurbanov
2024-07-03 09:06:07 -06:00
Jonathan Liu
d243b369e9 sandbox: enable support for the unlz4 command
This does not work with sandbox at present. Fix it up to use map_sysmem()
to convert an address to a pointer.

Signed-off-by: Jonathan Liu <net147@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix conflict and reformat to 80cols:
Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-03 07:36:32 +01:00
Martin Kurbanov
27b169f9d0 cmd: ubi: check 'updating' before calling ubi_more_update_data()
If 0 is passed to the 'bytes' parameter in the ubi_start_update(),
there is no need to call the ubi_more_update_data(). Otherwise,
there will be a double-free of 'vol->upd_buf'.

Also check that the ubi_start_update() was called before calling
the ubi_more_update_data().

Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
2024-07-03 08:05:19 +02:00
Martin Kurbanov
abae0b76f9 cmd: ubi: remove redundant initializations
Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
2024-07-03 08:05:19 +02:00
Tom Rini
2f96033923 Pull request efi-2024-10-rc1
Documentation:
       Update requirements.txt to use current Python module versions
       Add a page describing debugging U-Boot with GDB
       FIT: describe data-size as a conditionally mandatory property
       Correct link to FIT specification in SPL code.
       Correct kaslrseed command long text description
 
 UEFI:
       Add unit test checking that don't have kaslr-seed when measuring boot
       Deduplicate code for measured boot.
 
 Other:
       Print size information in fwu command
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEK7wKXt3/btL6/yA+hO4vgnE3U0sFAmaBU44ACgkQhO4vgnE3
 U0s1JRAAgyxfK6mjgS0rGI3wBv9N9twxYm/+2XcBFxqywcazuls31uNs+XO+U14u
 pS73qzRn4gempz8FxOEjlEhzN4ycEjlR1zpO39Z21/wq1TSGSVjnRPmGnBx5t19Y
 wxtptXr1A8mnaoqv3A3seEepC3/PDNSANjo/euHwHruepVM+f9VdotqVbr4Y4kFM
 qYHuIBKawjMWDy8BB0HlbMgGDDanZZKbXjus8h0RVrbHQePUgAiztZ5bQCRSp9A7
 uFNVvuIKSl2SUQ3kHIL9pwYhRCOXaNTSCsyiaxwfAMkhK9Em6QP2647ddvNNKAw2
 V4EUf52lTUnd527iLqjvEvKcGcrVNCoYWsKtuRS8YHk/2jn7BjPY/bHW8MCiWN3Z
 sG48Cqbq+fVG0+Qk2/I68kvGYGh4S4f9AeNihtQRXaxDzrLk1jBESakzUXI52ub3
 YK+aZ83t232n9pyXZe855Qxpcp5HLfg6ZtdjnB/Oqp7NpSpuPeo8FmFwZ2Nz/+5u
 qk29LwA5U8gO3N3qbwjIt7FpjlYuYyo8A3kiZttOy9epSM+0YrHx7V+dx8RJPKrD
 a1NT1dONWL2QhoYC5788o/L+WPJprEy38aY3LYrbdtxlbqoTV1RRg5/RVfD6D6vk
 lVR+RP/l/5iCa6nw5Cls6DZcMgV7DyCtyp0uMTJDVe7L62qhBFk=
 =7g5n
 -----END PGP SIGNATURE-----

Merge tag 'efi-2024-10-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi into next

Pull request efi-2024-10-rc1

Documentation:
      Update requirements.txt to use current Python module versions
      Add a page describing debugging U-Boot with GDB
      FIT: describe data-size as a conditionally mandatory property
      Correct link to FIT specification in SPL code.
      Correct kaslrseed command long text description

UEFI:
      Add unit test checking that don't have kaslr-seed when measuring boot
      Deduplicate code for measured boot.

Other:
      Print size information in fwu command
2024-06-30 10:59:42 -06:00
Heinrich Schuchardt
0b07b5ed81 cmd: correct kaslrseed description
The number of random bytes generated is hard coded as 8.
The command takes no argument.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-06-30 13:58:31 +02:00
Michal Simek
a53fb767cf cmd: fwu: Also print information about size
It is useful when structure is also used for saving vendor data covered
by CRC32.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-06-30 13:58:31 +02:00
Tom Rini
48641bfab7 Merge patch series "automatically add /chosen/kaslr-seed and deduplicate code"
Tim Harvey <tharvey@gateworks.com> says:

This series will automatically add /chosen/kaslr-seed to the dt if
DM_RNG is enabled
during the boot process.

If RANDOMIZE_BASE is enabled in the Linux kernel instructing it to
randomize the virtual address at which the kernel image is loaded, it
expects entropy to be provided by the bootloader by populating
/chosen/kaslr-seed with a 64-bit value from source of entropy at boot.

If we have DM_RNG enabled populate this value automatically when
fdt_chosen is called. We skip this if ARMV8_SEC_FIRMWARE_SUPPORT
is enabled as its implementation uses a different source of entropy
that is not yet implemented as DM_RNG. We also skip this if
MEASURED_BOOT is enabled as in that case any modifications to the
dt will cause measured boot to fail (although there are many other
places the dt is altered).

As this fdt node is added elsewhere create a library function and
use it to deduplicate code. We will provide a parameter to overwrite
the node if present.

For our automatic injection, we will use the first rng device and
not overwrite if already present with a non-zero value (which may
have been populated by an earlier boot stage). This way if a board
specific ft_board_setup() function wants to customize this behavior
it can call fdt_kaslrseed with a rng device index of its choosing and
set overwrite true.

Note that the kalsrseed command (CMD_KASLRSEED) is likely pointless now
but left in place in case boot scripts exist that rely on this command
existing and returning success. An informational message is printed to
alert users of this command that it is likely no longer needed.

Note that the Kernel's EFI STUB only relies on EFI_RNG_PROTOCOL for
randomization and completely ignores the kaslr-seed for its own
randomness needs (i.e the randomization of the physical placement of
the kernel). It gets weeded out from the DTB that gets handed over via
efi_install_fdt() as it would also mess up the measured boot DTB TPM
measurements as well.
2024-06-28 17:31:28 -06:00
Tim Harvey
909321bc6b use fdt_kaslrseed function to de-duplicate code
Use the fdt_kaslrseed function to deduplicate code doing the same thing.

Note that the kalsrseed command (CMD_KASLRSEED) is likely pointless now
but left in place in case boot scripts exist that rely on this command
existing and returning success. An informational message is printed to
alert users of this command that it is likely no longer needed.

Note that the Kernel's EFI STUB only relies on EFI_RNG_PROTOCOL for
randomization and completely ignores the kaslr-seed for its own
randomness needs (i.e the randomization of the physical placement of
the kernel). It gets weeded out from the DTB that gets handed over via
efi_install_fdt() as it would also mess up the measured boot DTB TPM
measurements as well.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Andy Yan <andy.yan@rock-chips.com>
Cc: Akash Gajjar <gajjar04akash@gmail.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Devarsh Thakkar <devarsht@ti.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Chris Morgan <macromorgan@hotmail.com>
Acked-by: Michal Simek <michal.simek@amd.com>
2024-06-28 17:30:45 -06:00
Simon Glass
52ff1f5da0 zboot: Correct use of state_mask argument
There is confusion in this function between the flag and state_mask
parameters, which prevents the boot from actually happening. Correct
this by using state_mask instead of flag for deciding which states to go
through.

This fixes booting of some 32-bit Debian kernels.

Note: Some sort of CI for this is in the works.

Fixes: 228c6722d4 ("x86: zboot: Avoid iteration in do_zboot_states()")

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-06-26 13:17:52 -06:00
Simon Glass
bce4c15f26 zboot: Add debugging for booting
Show the boot arguments and the state mask, to aid debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-06-26 13:17:52 -06:00
Sam Protsenko
04c63f134c cmd: gpt: Fix freeing gpt_pte in gpt_verify()
In case when either gpt_verify_headers() or gpt_verify_partitions()
fails, the memory allocated for gpt_pte will be freed in those functions
internally, but gpt_pte will still contain non-NULL dangling pointer.
The attempt to free it in those cases in gpt_verify() leads to "use
after free" error, which leads to a "Synchronous abort" exception.

This issue was found by running the next command on the device with
incorrect partition table:

    => gpt verify mmc 0 $partitions

which results to:

    No partition list provided - only basic check
    "Synchronous Abort" handler, esr 0x96000021, far 0xba247bff
    ....

Fix the issue by only freeing gpt_pte if none of those functions failed.

Fixes: bbb9ffac60 ("gpt: command: Extend gpt command to support GPT table verification")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
2024-06-26 13:17:51 -06:00
Tom Rini
b85ecb276b cmd: Make use of U_BOOT_LONGHELP when missing
After adding the U_BOOT_LONGHELP macro some new commands came in still
that were not making use if it. Switch these cases over and in a few
places add missing newlines as well.

Signed-off-by: Tom Rini <trini@konsulko.com>
2024-06-26 13:17:51 -06:00
Tom Rini
a7eada2432 Prepare v2024.07-rc5
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmZ5yTEACgkQFHw5/5Y0
 tywDtwv6AhYfLbudtOBBnDzEaZ0oC3ZbxfqwvSq4A16ftZoKdzv6stXLJg4L4nJ2
 u5OQo9DuSw+x1bE1bTo/ajumwJyymZ1SqQJZ7MlGJ/+ZARSpKOsN9J9JWNY9n2Ew
 A0PQ20WcDX93QjEMnS2cxfNx7jOBkKsWXAkgQ/K4ITxBmne55ioPmJvzxhGyHkPJ
 +JtOSEJxhHiFhxHy4ptb1sQSYs6wHxHt/im88CutyG/hYjaXp0xiuLQMXoIg4sQT
 P7Y4AtvDEjD6/y4VHG7Hg04pZMv255zQAGm2dlmOeOUT+Hsi0E9xrEnT7q0WOcjV
 tkx5HjxkLyGiQbHB4UFip8u/xfJb432HNGifCBBuIA6CP4zrM7VoKrs2Ql9xQ7UV
 mNFHPnwr5K0Ge+QvmJS9RgCfqFk+UgcfFHh+ReDVCGeW8WYfDNJzvfpx+UsrB98b
 APJ9JxnVmOo5WlA5FSLDrod2l4WXrLL8jo6LdxAKJWZTLWddpL2y/AA39lVq76vi
 EnSUt2Mf
 =t6QJ
 -----END PGP SIGNATURE-----

Merge tag 'v2024.07-rc5' into next

Prepare v2024.07-rc5
2024-06-24 13:34:52 -06:00
Heinrich Schuchardt
082b4675ff cmd: link to doc/usage/fit/x86-fit-boot.rst
Replace the outdated link.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-06-22 17:02:23 +02:00
Quentin Schulz
20a038317b cmd: fix typo in CMD_BOOTMETH help text
It's bootmeths and not bootmethds.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-06-20 11:41:43 -06:00
Tom Rini
e242cd9513 Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-watchdog into next
- misc cyclic infrastructure improvements (Rasmus)
- watchdog_reset cleanup (Rasmus)

CI: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=369&view=results
2024-06-16 09:10:13 -06:00
Rasmus Villemoes
008c4b3c31 cyclic: make clients embed a struct cyclic_info in their own data structure
There are of course not a whole lot of examples in-tree yet, but
before they appear, let's make this API change: Instead of separately
allocating a 'struct cyclic_info', make the users embed such an
instance in their own structure, and make the convention that the
callback simply receives the 'struct cyclic_info *', from which the
clients can get their own data using the container_of() macro.

This has a number of advantages.

First, it means cyclic_register() simply cannot fail, simplifying the
code. The necessary storage will simply be allocated automatically
when the client's own structure is allocated (often via
uclass_priv_auto or similar).

Second, code for which CONFIG_CYCLIC is just an option can more easily
be written without #ifdefs, if we just provide an empty struct
cyclic_info {}. For example, the nested CONFIG_IS_ENABLED()s in
https://lore.kernel.org/u-boot/20240316201416.211480-1-marek.vasut+renesas@mailbox.org/
are mostly due to the existence of the 'struct cyclic_info *' member
being guarded by #ifdef CONFIG_CYCLIC.

And we do probably want to avoid the extra memory overhead of that
member when !CONFIG_CYCLIC. But that is automatic if, instead of a
'struct cyclic_info *', one simply embeds a 'struct cyclic_info',
which will have size 0 when !CONFIG_CYCLIC. Also, the no-op
cyclic_register() function can just unconditionally be called, and the
compiler will see that (1) the callback is referenced, so not emit a
warning for a maybe-unused function and (2) see that it can actually
never be reached, so not emit any code for it.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2024-06-16 12:13:44 +02:00
Maxim Moskalets
46b6a3e6c7 cmd: move ELF load and boot to lib/elf.c
Loading and running the ELF image is the responsibility of the
library and should not be associated with the command line interface.

It is also required to run ELF images from FIT with the bootm command
so as not to depend on the command line interface.

Signed-off-by: Maxim Moskalets <maximmosk4@gmail.com>
2024-06-14 12:59:07 -06:00
Dmitry Gerasimov
822911d574 imxtract: add support for zstd-compressed images
Allow extraction of zstd-compressed images from FIT using imxtract
command. This is especially useful when one has to load an image via
some interface (e.g. SPI) rather that just to the memory.

Signed-off-by: Dmitry Gerasimov <di.gerasimov@gmail.com>
2024-06-13 16:30:47 -06:00
Quentin Schulz
ca6a992e09 cmd: sound: fix help text
There's never been a -q or -s argument handled in the command, so let's
remove it. This was highlighted during review[1] but somehow still got
through.

While at it, slightly "reword" in the help text how the len + freq
arguments are defined. Indeed, len and freq work in pair, it is possible
to define none of either, n of both, or n - 1 of freq if there are n
len, in which case the freq that goes with the last len would be the n -
1 (and not the default of 400Hz if neither len nor freq is passed). I
assume this isn't what's expected but leaving it for another patch if
need be to fix what happens in that very odd scenario.

[1] https://lore.kernel.org/u-boot/CAPnjgZ0QWNqVFZfEWHxRcFOA3E3gRAZCYs77nGUXKL0pLp+JLQ@mail.gmail.com/

Fixes: ea58b9a404 ("cmd: allow sound command to play multiple sounds")
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-06-13 09:31:56 -06:00
Tom Rini
9cf83a7da9 Pull request efi-next-20240611
UEFI:
 
 * Allow specifying a device-tree in an EFI load option
   using the efidebug or eficonfig command.
 * Let the EFI boot manager fall back to an OS provided device-tree
   if no device-tree is specified.
 -----BEGIN PGP SIGNATURE-----
 
 iQJWBAABCABAFiEEK7wKXt3/btL6/yA+hO4vgnE3U0sFAmZoOXUiHGhlaW5yaWNo
 LnNjaHVjaGFyZHRAY2Fub25pY2FsLmNvbQAKCRCE7i+CcTdTS36HEACegzro+P2f
 XZbdiRi0zN+ef5UkUVm/LECwBWXo0p9R5L3XWsRtxz8nqzG5JgB4lzDr0X3cRAVr
 uUeg6xf5LSXCbme/Ct68bi27F54Z0OQDmVlvPC/zUQ6CUDPg+0HFlHiBgKGvkAy+
 0HZY57OhXbviyuZ8JND/zL5GBGnyVGjyoghS0OvtSeWZ+6JIHYrMGH9fc1jtdS4+
 jleIkKE4NKIJPOPQVpCr84SgtbsfFeaOtsAM6u5Asd8FkmKLjcgNpKw5Kj03vJwP
 javMY/hG7LkAxHLEfDOe1A3z8AKqN+zrHZ0Rj7Xy+TdwEmh6IgsPkorPCjWa5g0W
 Cp7pjf2Bq/dAZLhHCMPFBQ/aSv9t3b+LSdrGYJUffwmjhcJ/6+J+2ioD50cJc31E
 Ov85HF7FpB9s82+3LL9QuFkQIdDdseNPCPUdEesA1GJjZUa8QrrrmmeTDuZZAmXm
 HpAy3/hw1lTYG/yPSavQdr0bZNTcersvpIqchI5b/SXfAH+riSSuGGobtaYE61su
 2esMKTMma1/aO2X3i7QCTntG4fKd/7Wfbf3lcjIJ3nuWlty+AvXZiD1nHM48d2P4
 U3/Wbsls60mlAG/P15/eC8jxhkanrbSXNwGOjJMbh+OmwUukhvYg+35t5qZkCwuW
 OHIFOWhFuIs+tsEUoOllZldDgmWB9hpjxg==
 =D5PO
 -----END PGP SIGNATURE-----

Merge tag 'efi-next-20240611' of https://source.denx.de/u-boot/custodians/u-boot-efi into next

Pull request efi-next-20240611

UEFI:

* Allow specifying a device-tree in an EFI load option
  using the efidebug or eficonfig command.
* Let the EFI boot manager fall back to an OS provided device-tree
  if no device-tree is specified.
2024-06-11 07:42:55 -06:00
Heinrich Schuchardt
535321c2ea efi_loader: rename struct efi_initrd_dp to efi_lo_dp_prefix
As we now also store device-tree device-paths in load options rename
struct efi_initrd_dp to efi_lo_dp_prefix.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-06-10 11:43:37 +02:00
Heinrich Schuchardt
d9f7f42451 cmd: efidebug: add support for setting fdt
We already support creating a load option where the device-path
field contains the concatenation of the binary device-path and
optionally the device path of the initrd which we expose via the
EFI_LOAD_FILE2_PROTOCOL.

Allow to append another device-path pointing to the device-tree
identified by the device-tree GUID.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-06-10 11:43:36 +02:00
Heinrich Schuchardt
58bef195f9 cmd: eficonfig: add support for setting fdt
We already support creating a load option where the device-path
field contains the concatenation of the binary device-path and
optionally the device path of the initrd which we expose via the
EFI_LOAD_FILE2_PROTOCOL.

Allow to append another device-path pointing to the device-tree
identified by the device-tree GUID.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-06-10 11:43:36 +02:00
Heinrich Schuchardt
bf03333d09 efi_loader: allow concatenation with contained end node
Allow appending a device-path to a device-path that contains an end node
as separator. We need this feature for creating boot options specifying
kernel, initrd, and dtb.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-06-10 11:43:36 +02:00
Roman Stratiienko
17b1656dcd abootimg: Add init_boot image support
Quote from [1]:

"For devices launching with Android 13, the generic ramdisk is removed
from the boot image and placed in a separate init_boot image.
This change leaves the boot image with only the GKI kernel."

While at it, update wrong error handling message when vendor_boot
cannot be loaded.

[1]: https://source.android.com/docs/core/architecture/partitions/generic-boot

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-06-07 16:20:33 -06:00
Tom Rini
77ba281c91 Merge patch series "'eeprom' command improvements"
Marek Behún <kabel@kernel.org> says:

This series contains improvements for the 'eeprom' command:
- refactors
- fixes
- improvements
- ability to use driver model EEPROMs (uclass UCLASS_I2C_EEPROM)
- more flexible EEPROM layout support

It should not cause any behavior change for any existing board.

This series is a dependency for some DDR issue fixes for Turris Omnia.
I will be sending that one separately.

github PR link (with CI):
  https://github.com/u-boot/u-boot/pull/540
- there is a failure for
    test.py for sandbox sandbox_clang
  but it seems unrelated to these changes
2024-06-07 10:48:41 -06:00
Marek Behún
57a9e8d86f cmd: eeprom: Extend to EEPROMs probed via driver model
Extend the 'eeprom' command to allow accessing EEPROMs probed via
driver model, uclass UCLASS_I2C_EEPROM.

When the CONFIG_I2C_EEPROM config option is enabled (and so the
i2c-eeprom driver is built), the 'eeprom' command now accepts driver
model device name as EEPROM specifier for the 'eeprom' command, in
addition to the legacy [[bus] devaddr] specifier.

Moreover if no device specifier is given, then the first
UCLASS_I2C_EEPROM device is used, if found.

Signed-off-by: Marek Behún <kabel@kernel.org>
2024-06-07 10:48:00 -06:00
Marek Behún
e5dbc80fe0 cmd: eeprom: Don't read/write whole EEPROM if not necessary
Don't read/write whole EEPROM if not necessary when printing / updating
EEPROM layout fields. Only read/write layout.data_size bytes.

Signed-off-by: Marek Behún <kabel@kernel.org>
2024-06-07 10:48:00 -06:00
Marek Behún
e9774afedd cmd: eeprom: Refactor command execution into function by action
Refactor the eeprom_execute_command() function into separate functions
do_eeprom_rw(), do_eeprom_print() and do_eeprom_update().

Signed-off-by: Marek Behún <kabel@kernel.org>
2024-06-07 10:48:00 -06:00
Marek Behún
15f0536f29 cmd: eeprom: Refactor eeprom device specifier parsing
In preparation for allowing to access eeprom by driver-model device
name, refactor the eeprom device specifier parsing. Instead of filling
two parameters (i2c_bus, i2c_addr), the parsing function now fills one
parameter of type struct eeprom_dev_spec.

Signed-off-by: Marek Behún <kabel@kernel.org>
2024-06-07 10:47:59 -06:00
Marek Behún
fda747c8f1 cmd: eeprom: Deduplicate parse_i2c_bus_addr() calls
Deduplicate the calls to parse_i2c_bus_addr().

Signed-off-by: Marek Behún <kabel@kernel.org>
2024-06-07 10:47:59 -06:00
Marek Behún
2d49dafe4a cmd: eeprom: Hide eeprom layout versioning behind a Kconfig option
Add a new Kconfig option EEPROM_LAYOUT_VERSIONS, and hide eeprom
layout versionsing code behind it. Only print the relevant help in
'eeprom' command usage if this option is enabled.

Enable this new option for cm_fx6_defconfig and cm_t43_defconfig.
These are the only boards using EEPROM layout versioning.

Signed-off-by: Marek Behún <kabel@kernel.org>
2024-06-07 10:47:59 -06:00
Marek Behún
642ec48c76 cmd: eeprom: Fix usage help for the eeprom command
The bus and devaddr arguments of the eeprom command are optional, and if
only one is given, it is assumed to be devaddr. Change the usage help
from
  <bus> <devaddr>
to
  [[bus] [devaddr]

Signed-off-by: Marek Behún <kabel@kernel.org>
2024-06-07 10:47:59 -06:00
Tom Rini
227be29df3 Prepare v2024.070-rc4
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmZeYVEACgkQFHw5/5Y0
 tyzD8Qv/fX57m3Vkq9WNJ06H1cEhSfnnCE6n6BvSA079wiEgu7xUwizECu1z00V3
 2NxTJojMuGoEFE4EhW8JLTeSak3qST1Wgvx3XWpATRxDnpQN5Pjl7X6N8AA5tCgg
 6KhMMiL8qND516kHDZvkkE4un+WLFOscBOTaPy6VwiTyMaQDFnO2kL7O8rai2ZeG
 LNL+ObnnxcnRtfRUqFv1cMKkK2vvMmQZBtOAWFb3MSJ4ZO/RLaMIpNqpx9ZK8Co9
 MgNW570DemJrnZ7z2VMMw5Bxafo++VUPDHIUywnT/FeMe8eQJWPGsRCqEYr6by2G
 vLIWgVV02ObdYLLCeUZv1TV8Hn7w2tNvPJKQCEGVTGC4Jb4K9vv+V6w9NdPgutNo
 zg9mHVEK/mcBrMNQZk9W+wzasZ6uem85h+KaQYIfrmCHqW4Q9gyA55Q6qw7tJe5L
 8DIdMbWWJ3icVl9wP+S5lI8nvHRVOgyuRDQxOjzb2IbZiSf4eopI4j6XJaEV04iu
 QzzFC2jn
 =xslu
 -----END PGP SIGNATURE-----

Merge tag 'v2024.07-rc4' into next

Prepare v2024.070-rc4
2024-06-04 08:09:09 -06:00
Heiko Schocher
8f8b4b0833 usb: remove not used variable in usb_ether_curr_dev
grepping for usb_ether_curr_dev in u-boot source code shows

$ grep -r usb_ether_curr_dev .
./cmd/usb.c:static int __maybe_unused usb_ether_curr_dev = -1; /* current ethernet device */
$

only declared but never used, so it can safely
removed from code.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
2024-06-01 21:42:09 +02:00
Tim Harvey
89aa8463cd tpm-v2: allow algorithm name to be configured for pcr_read and pcr_extend
For pcr_read and pcr_extend commands allow the digest algorithm to be
specified by an additional argument. If not specified it will default to
SHA256 for backwards compatibility.

Additionally update test_tpm2.py for the changes in output in pcr_read
which now shows the algo and algo length in the output.

A follow-on to this could be to extend all PCR banks with the detected
algo when the <digest_algo> argument is 'auto'.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-05-27 09:00:27 +03:00
Tom Rini
7e52d6ccfb Merge patch series "FWU: Add support for FWU metadata version 2"
Sughosh Ganu <sughosh.ganu@linaro.org> says:

The following patch series adds support for version 2 of the FWU
metadata. The version 2 metadata structure is defined in the latest
revision of the FWU specification [1].

The earlier versions of these patches were migrating to a version 2
only support in U-Boot, similar to TF-A. However, based on feedback
from ST [2], this series has been updated to support both versions. A
platform would still be needed to enable one of the two versions of
metadata through a config symbol.

TF-A has code which reads the FWU metadata and boots the platform from
the active partition. TF-A has decided to migrate the FWU code to a
version 2 only support. These changes have been merged in upstream
TF-A.

These changes have been tested on the ST DK2 board, which uses the GPT
based partitioning scheme. Both V1 and V2 metadata versions have been
tested on the DK2 board.

These changes need to be tested on platforms with MTD partitioned
storage devices.
2024-05-24 13:42:07 -06:00
Sughosh Ganu
7cfe0d8a48 cmd: fwu: make changes for supporting FWU metadata version 2
Add support for displaying data specific to FWU metadata version
2. Because the size of the v2 metadata structure is read from the
structure itself, allocate memory for the metadata structure by first
getting the size of the structure.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Tested-by: Michal Simek <michal.simek@amd.com>
2024-05-24 13:40:04 -06:00
Tom Rini
377e91c162 Merge patch series "Clean-up patch set for MbedTLS integration"
Raymond Mao <raymond.mao@linaro.org> says:

This patch set is picked from the previously posted serie:
"[RFC] Integrate MbedTLS v3.6 LTS with U-Boot"

They are not directly related to MbedTLS integration, but the
prerequisite for a few clean-up, refactoring and minor fixes.

For V2, the linker script patch is dropped and added one patch
to move the snprintf to stdio.h
2024-05-22 08:55:35 -06:00
Raymond Mao
cb73fe9eea include: Move snprintf to stdio.h
Move snprintf to stdio.h since it is needed by exteranl libraries.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-05-22 08:55:29 -06:00
Tom Rini
03de305ec4 Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"
As part of bringing the master branch back in to next, we need to allow
for all of these changes to exist here.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-20 13:35:03 -06:00
Tom Rini
d4781422d1 Prepare v2024.07-rc3
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmZLdOcACgkQFHw5/5Y0
 tyxIBgwAq83rYBPV5D4JIurAvQ3W34cYDFdDhlph7RFjd8eCfsyYIvHRjRBzQfMf
 YdMdOxsAzXVm/l//ZUOF4tuXHw74IsBgG8gZou8ggD4Crya5OvIbxKHGZAS24d/8
 dmqG8jSxrjwqkyxhAyHfmceL9rlNO7VCPY2YoP8GEZybmagN6LV4SREG+aTzGj5t
 ExWFpK24E90qXMH6XPbZs1kAPFsRr8HwyG5IlOMdpE1KL256gdTeEec/pT7cXt5M
 QcOm9nIJKDrgOvxSb4eGagmYP1K7upMyvhbqGrzTpV0PRYLNiVeLJMAiM2xVrhw9
 T9gNedIrDviUwoMNIWkDTQNobuXafro9Qh/eoXjELNvMKGYVet7Hp7WEwyaHEjuA
 hCgflFH3vmx/7oxQNb92jd2h1HCreX3SpzVY6T49lmAtQHIvzDdlQluiF8Vpgf/K
 CQT3CIGgKiWJ/si185UvIFwjyFdqDeZxIC/s/WD9u4XQP5Wpn3xImEK31/3lN5jw
 FeiehuIP
 =RH8n
 -----END PGP SIGNATURE-----

Merge tag 'v2024.07-rc3' into next

Prepare v2024.07-rc3
2024-05-20 10:16:33 -06:00
Tom Rini
d678a59d2d Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d, reversing
changes made to 2ee6f3a5f7.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19 08:16:36 -06:00