aboutsummaryrefslogtreecommitdiff
path: root/cmd
AgeCommit message (Collapse)Author
2024-07-05Fix Kconfig coding style from spaces to tabAnand Moon
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-05cmd: bootm: add ELF file supportMaxim Moskalets
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-03Merge patch series "m68k: Implement a default flush_dcache_all"Tom Rini
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-03cmd: cache: Remove weak functionsTom Rini
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-03Merge tag 'ubifixes-for-v2024-10-rc1' of ↵Tom Rini
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-03sandbox: enable support for the unlz4 commandJonathan Liu
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-03cmd: ubi: check 'updating' before calling ubi_more_update_data()Martin Kurbanov
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-03cmd: ubi: remove redundant initializationsMartin Kurbanov
Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
2024-06-30Merge tag 'efi-2024-10-rc1' of ↵Tom Rini
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-30cmd: correct kaslrseed descriptionHeinrich Schuchardt
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-30cmd: fwu: Also print information about sizeMichal Simek
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-28Merge patch series "automatically add /chosen/kaslr-seed and deduplicate code"Tom Rini
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-28use fdt_kaslrseed function to de-duplicate codeTim Harvey
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-26zboot: Correct use of state_mask argumentSimon Glass
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: 228c6722d44 ("x86: zboot: Avoid iteration in do_zboot_states()") Signed-off-by: Simon Glass <sjg@chromium.org>
2024-06-26zboot: Add debugging for bootingSimon Glass
Show the boot arguments and the state mask, to aid debugging. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-06-26cmd: gpt: Fix freeing gpt_pte in gpt_verify()Sam Protsenko
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: bbb9ffac6066 ("gpt: command: Extend gpt command to support GPT table verification") Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
2024-06-26cmd: Make use of U_BOOT_LONGHELP when missingTom Rini
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-24Merge tag 'v2024.07-rc5' into nextTom Rini
Prepare v2024.07-rc5
2024-06-22cmd: link to doc/usage/fit/x86-fit-boot.rstHeinrich Schuchardt
Replace the outdated link. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-06-20cmd: fix typo in CMD_BOOTMETH help textQuentin Schulz
It's bootmeths and not bootmethds. Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-06-16Merge branch 'next' of ↵Tom Rini
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-16cyclic: make clients embed a struct cyclic_info in their own data structureRasmus Villemoes
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-14cmd: move ELF load and boot to lib/elf.cMaxim Moskalets
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-13imxtract: add support for zstd-compressed imagesDmitry Gerasimov
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-13cmd: sound: fix help textQuentin Schulz
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: ea58b9a404d4 ("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-11Merge tag 'efi-next-20240611' of ↵Tom Rini
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-10efi_loader: rename struct efi_initrd_dp to efi_lo_dp_prefixHeinrich Schuchardt
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-10cmd: efidebug: add support for setting fdtHeinrich Schuchardt
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-10cmd: eficonfig: add support for setting fdtHeinrich Schuchardt
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-10efi_loader: allow concatenation with contained end nodeHeinrich Schuchardt
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-07abootimg: Add init_boot image supportRoman Stratiienko
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-07Merge patch series "'eeprom' command improvements"Tom Rini
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-07cmd: eeprom: Extend to EEPROMs probed via driver modelMarek Behún
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-07cmd: eeprom: Don't read/write whole EEPROM if not necessaryMarek Behún
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-07cmd: eeprom: Refactor command execution into function by actionMarek Behún
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-07cmd: eeprom: Refactor eeprom device specifier parsingMarek Behún
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-07cmd: eeprom: Deduplicate parse_i2c_bus_addr() callsMarek Behún
Deduplicate the calls to parse_i2c_bus_addr(). Signed-off-by: Marek Behún <kabel@kernel.org>
2024-06-07cmd: eeprom: Hide eeprom layout versioning behind a Kconfig optionMarek Behún
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-07cmd: eeprom: Fix usage help for the eeprom commandMarek Behún
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-04Merge tag 'v2024.07-rc4' into nextTom Rini
Prepare v2024.070-rc4
2024-06-01usb: remove not used variable in usb_ether_curr_devHeiko Schocher
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-05-27tpm-v2: allow algorithm name to be configured for pcr_read and pcr_extendTim Harvey
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-24Merge patch series "FWU: Add support for FWU metadata version 2"Tom Rini
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-24cmd: fwu: make changes for supporting FWU metadata version 2Sughosh Ganu
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-22Merge patch series "Clean-up patch set for MbedTLS integration"Tom Rini
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-22include: Move snprintf to stdio.hRaymond Mao
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-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
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-20Merge tag 'v2024.07-rc3' into nextTom Rini
Prepare v2024.07-rc3
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
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 c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-13sandbox: make function 'do_undefined' properly compiles for PowerPCWHR
The 2 bytes 0xffff is too short for being a PowerPC instruction, resulting in an error similar to: /tmp/ccW8yjie.s: Assembler messages: /tmp/ccW8yjie.s: Error: unaligned opcodes detected in executable segment /tmp/ccW8yjie.s:223: Error: instruction address is not a multiple of 4 make[2]: *** [/tmp/ccyF4HIC.mk:17: /tmp/ccCKUFuF.ltrans5.ltrans.o] Error 1 Signed-off-by: WHR <msl0000023508@gmail.com>