aboutsummaryrefslogtreecommitdiff
path: root/cmd
AgeCommit message (Collapse)Author
2022-09-24serial: Call flush() before changing baudratePali Rohár
Changing baudrate is a sensitive operation. To ensure that U-Boot messages printed before changing baudrate are not lost, call new U-Boot console flush() function. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-21cmd: fdt: Add support for reading stringlist property valuesMarek Vasut
The fdt command currently handles stringlists as strings in 'fdt get value' subcommand. Since strings in FDT stringlists are separated by '\0', only the first value gets inserted into the environment variable passed to the 'fdt get value' command. Example, consider the following DT snippet: / { compatible = "foo", "bar" }; The following command only reports the first string in stringlist: => fdt get value var / compatible ; print var foo It is not possible to assign list of null-terminated strings into U-Boot environment variable. Add optional 'index' parameter to the subcommand 'fdt get value <var> <path> <prop> [<index>]' which lets user specify which string within the stringlist should be assigned into the 'var' variable. The default value of 'index' is 0 in case it is not present. This way the 'fdt' command API does not change and existing scripts are not broken. The following command now reports the Nth string in stringlist, counting from zero: => fdt get value var / compatible 1 ; print var bar Signed-off-by: Marek Vasut <marex@denx.de> Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com>
2022-09-19Merge branch 'master' into nextTom Rini
Signed-off-by: Tom Rini <trini@konsulko.com>
2022-09-18cyclic: Use schedule() instead of WATCHDOG_RESET()Stefan Roese
Globally replace all occurances of WATCHDOG_RESET() with schedule(), which handles the HW_WATCHDOG functionality and the cyclic infrastructure. Signed-off-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]
2022-09-16blk: Drop if_typeSimon Glass
Use the uclass ID instead. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2022-09-16blk: Switch over to using uclass IDsSimon Glass
We currently have an if_type (interface type) and a uclass id. These are closely related and we don't need to have both. Drop the if_type values and use the uclass ones instead. Maintain the existing, subtle, one-way conversion between UCLASS_USB and UCLASS_MASS_STORAGE for now, and add a comment. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-16cmd: Drop use of HAVE_BLOCK_DEVICESimon Glass
This condition is not needed for these commands, since BLK is enabled for all boards which use block devices and commands are not available in SPL, so even if SPL_BLK is not enabled, it doesn't affect commands. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-15xyz-modem: Allow to configure initial timeout for loadx and loadyPali Rohár
Now when loadx and loady commands could be aborted / cancelled by CTRL+C, allow to configure timeout for initial x/y-modem packet via env variable $loadxy_timeout and by default use value from new compile-time config option CONFIG_CMD_LOADXY_TIMEOUT. Value is in seconds and zero value means infinite timeout. Default value is 90s which is the value used before this change for loadx command. Other load commands loadb and loads already waits infinitely. Same behavior for loadx and loady commands can be achieved by setting $loadxy_timeout or CONFIG_CMD_LOADXY_TIMEOUT to 0. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-14Merge tag 'efi-next-2022-09-14' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-efi into next Pull request for efi next UEFI: Implement a command eficonfig to maintain Load Options and boot order via menus.
2022-09-14eficonfig: add "Change Boot Order" menu entryMasahisa Kojima
This commit adds the menu entry to update UEFI BootOrder variable. User moves the entry with UP/DOWN key, changes the order with PLUS/MINUS key, press SPACE to activate or deactivate the entry, then finalizes the order by ENTER key. If the entry is activated, the boot index is added into the BootOrder variable in the order of the list. The U-Boot menu framework is well designed for static menu, this commit implements the own menu display and key handling for dynamically change the order of menu entry. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
2022-09-14eficonfig: scan media device in eficonfig startupMasahisa Kojima
In eficonfig startup, scan media devices and update the UEFI boot option. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
2022-09-14bootmenu: add removable media entriesMasahisa Kojima
UEFI specification requires booting from removal media using a architecture-specific default image name such as BOOTAA64.EFI. This commit adds the removable media entries into bootmenu, so that user can select the removable media and boot with default image. The bootmenu automatically enumerates the possible bootable media devices supporting EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, add it as new UEFI boot option(BOOT####) and update BootOrder variable. This automatically generated UEFI boot option has the dedicated guid in the optional_data to distinguish it from the UEFI boot option user adds manually. This optional_data is removed when the efi bootmgr loads the selected UEFI boot option. This commit also provides the BOOT#### variable maintenance feature. Depending on the system hardware setup, some devices may not exist at a later system boot, so bootmenu checks the available device in each bootmenu invocation and automatically removes the BOOT#### variable corrensponding to the non-existent media device. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
2022-09-14eficonfig: add "Delete Boot Option" menu entryMasahisa Kojima
This commit adds the menu entry to delete the UEFI boot option. User moves the entry with UP/DOWN key, changes, then presses ENTER key to delete the selected boot option. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
2022-09-14eficonfig: add "Edit Boot Option" menu entryMasahisa Kojima
This commit adds the menu entry to edit the existing BOOT#### variable contents. User selects the item from the boot option list, then user can edit the description, file path and optional_data. Note that automatically generated boot option entry by bootmenu to support the removable media device is filtered out and user can not edit the automatically generated entry. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
2022-09-14eficonfig: menu-driven addition of UEFI boot optionMasahisa Kojima
This commit add the "eficonfig" command. The "eficonfig" command implements the menu-driven UEFI boot option maintenance feature. This commit implements the addition of new boot option. User can select the block device volume having efi_simple_file_system_protocol and select the file corresponding to the Boot#### variable. User can also enter the description and optional_data of the BOOT#### variable in utf8. This commit adds "include/efi_config.h", it contains the common definition to be used from other menus such as UEFI Secure Boot key management. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
2022-09-13cyclic: Add 'cyclic list' and 'cyclic demo' commandsStefan Roese
This patch adds the cyclic command, which currently only supports the 'list' subcommand, to list all currently registered cyclic functions. Here an example: => cyclic list function: cyclic_demo, cpu-time: 7010 us, frequency: 99.80 times/s function: cyclic_demo2, cpu-time: 1 us, frequency: 1.13 times/s As you can see, the cpu-time is accounted, so that cyclic functions that take too long might be discovered. Additionally the frequency is logged. The 'cyclic demo' commands registers the cyclic_demo() function to be executed all 'cycletime_ms' milliseconds. The only thing this function does is delaying by 'delay_us' microseconds. Signed-off-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-13cmd: bdinfo: introduce bdinfo_print_size() helperOvidiu Panait
Add bdinfo_print_size() helper to display size variables (such as cache sizes) in bdinfo format. The size is printed as "xxx Bytes", "xxx KiB", "xxx MiB", "xxx GiB", etc as needed; Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Ovidiu Panait <ovpanait@gmail.com> Reviewed-by: Jason Liu <jason.hui.liu@nxp.com> Link: https://lore.kernel.org/r/20220829170205.1274484-3-ovpanait@gmail.com Signed-off-by: Michal Simek <michal.simek@amd.com>
2022-09-13cmd: mvebu/bubt: Check for A38x/A37xx OTP secure bits and secure bootPali Rohár
For obvious reasons BootROMS rejects unsigned images when secure boot is enabled in OTP secure bits. So check for OPT secure bits and do not allow flashing unsigned images when secure boot is enabled. Access to OTP via U-Boot fuse API is currently implemented only for A38x and A37xx SoCs. Additionally Armada 3700 BootROM rejects signed trusted image when secure boot is not enabled in OTP. So add also check for this case. On the other hand Armada 38x BootROM acceps images with secure boot header when secure boot is not enabled in OTP. OTP secure bits may have burned also boot device source. Check it also and reject flashing images to target storage which does not match OTP. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-09-13cmd: mvebu/bubt: Check for A38x image data checksumPali Rohár
Currently for A38x image is checked only header checksum. So check also for image data checksum to prevent flashing broken image. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-09-12cmd: bdinfo: Enable dumping lmb data when LMB is enabledMichal Simek
The commit 9996cea75f5a ("lmb/bdinfo: dump lmb info via bdinfo") added support for dumping LMB information as the part of bdinfo. But code itself should be called only when LMB is enabled. Signed-off-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/r/3e40c8bb77550dfca9f7eb48fe644a018d971411.1662537127.git.michal.simek@amd.com
2022-09-09cmd: correct short text for tftpbootHeinrich Schuchardt
The command's name is a misnomer. The command loads a file but does not run (boot) it. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-09cmd: fix tftpput commandHeinrich Schuchardt
Calling tftpput with less than 2 arguments must lead to a failure. If tftpput is called with two arguments, these are the address and the size of the file to be transferred. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-07cmd: fpga: Convert to use fit_get_data_nodeSean Anderson
This converts the FIT loading process of the fpga command to use fit_get_data_node. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-09-06cmd/sbi: format KVM versionHeinrich Schuchardt
Format the KVM implementation number in a human readable form. With the patch output of the sbi command for Linux 5.19.1 looks like: => sbi SBI 0.3 KVM 5.19.1 Machine: Vendor ID 0 Architecture ID 7005c Implementation ID 7005c Extensions: SBI Base Functionality Timer Extension IPI Extension RFENCE Extension Hart State Management Extension System Reset Extension Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2022-09-03tpm: Allow reporting the internal stateSimon Glass
It is useful to read information about the current TPM state, where supported, e.g. for debugging purposes when verified boot fails. Add support for this to the TPM interface as well as Cr50. Add a simple sandbox test. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-09-03tpm: Require a digest source when extending the PCRSimon Glass
This feature is used for measured boot, so we can add a log entry to the TCPA with some information about where the digest comes from. It is not currently supported in the TPM drivers, but add it to the API so that code which expects it can signal its request. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-09-02cmd: Add pause commandSamuel Dionne-Riel
This command is being introduced with the goal of allowing user-friendly "generic use case" U-Boot builds to pause until user input under some situations. The main use case would be when a boot failure happens, to pause until the user has had time to acknowledge the current state. Tested using: make && ./u-boot -v -T -c 'ut lib lib_test_hush_pause' Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com> Cc: Simon Glass <sjg@chromium.org>
2022-08-31image-fit: don't set compression if it can't be readDaniel Golle
fit_image_get_comp() should not set value -1 in case it can't read the compression node. Instead, leave the value untouched in that case as it can be absent and a default value previously defined by the caller of fit_image_get_comp() should be used. As a result the warning message WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file! no longer shows if the compression node is actually absent. Signed-off-by: Daniel Golle <daniel@makrotopia.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-31i2c: fix stack buffer overflow vulnerability in i2c md commandMarek Vasut
This reinstates fix from commit 8f8c04bf1ebb ("i2c: fix stack buffer overflow vulnerability in i2c md command") without the changes unrelated to the actual fix. Avoid the underflow by setting only nbytes and linebytes as unsigned integers. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Heiko Schocher <hs@denx.de> Cc: Nicolas Iooss <nicolas.iooss+uboot@ledger.fr> Cc: Simon Glass <sjg@chromium.org> Cc: Tim Harvey <tharvey@gateworks.com> Acked-by: Tim Harvey <tharvey@gateworks.com>
2022-08-31Revert "i2c: fix stack buffer overflow vulnerability in i2c md command"Marek Vasut
This reverts commit 8f8c04bf1ebbd2f72f1643e7ad9617dafa6e5409. The commit is largely wrong and breaks most of i2c command functionality. The problem described in the aforementioned commit commit message is valid, however the commit itself does many more changes unrelated to fixing that one problem it describes. Those extra changes, namely the handling of i2c device address length as unsigned instead of signed integer, breaks the expectation that address length may be negative value. The negative value is used by DM to indicate that address length of device does not change. The actual bug documented in commit 8f8c04bf1ebbd2f72f1643e7ad9617dafa6e5409 can be fixed by extra sanitization in separate patch. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Heiko Schocher <hs@denx.de> Cc: Nicolas Iooss <nicolas.iooss+uboot@ledger.fr> Cc: Simon Glass <sjg@chromium.org> Cc: Tim Harvey <tharvey@gateworks.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-27Merge tag 'dm-pull-26aug22' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-dm binman/patman documentation improvements other minor fixes
2022-08-26vbe: Enable command only with BOOTSTD_FULLSimon Glass
Avoid enabling this command by default. This saves about 1KB of code space. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-08-26dm: core: fix a typo in help textSergei Antonov
Signed-off-by: Sergei Antonov <saproj@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-26pci: Add checks to prevent config space overflowPali Rohár
PCIe config space has address range 0-4095. So do not allow reading from addresses outside of this range. Lot of U-Boot drivers do not expect that passed value is not in this range. PCI DM read function is extended to fill read value to all ones or zeros when it fails as U-Boot callers ignores return value. Calling U-Boot command 'pci display.b 0.0.0 0 0x2000' now stops printing config space at the end (before 0x1000 address). Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-08-13cmd: efidebug: Add missing \n at the end of messageMichal Simek
Currently message is not intended that prompt end up at the end of debug line. For example like this: DFU alt info setting: done DFU entities configuration failed! (partition table does not match dfu_alt_info?) Firmware update failed: <NULL> Cannot handle a capsule at 10000000Zynq> Signed-off-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-08-12vbe: Add a new vbe commandSimon Glass
Add a command to look at VBE methods and their status. Provide a test for all of this as well. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Support bootflows with global bootmethsSimon Glass
Add support for handling this concept in bootflows. Update the 'bootflow' command to allow only the normal bootmeths to be used. This alllows skipping EFI bootmgr and VBE, for example. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Allow the bootdev to be optional in bootflowsSimon Glass
With global bootmeths we want to scan without a bootdev. Update the logic to allow this. Change the bootflow command to show the bootdev only when valid. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Allow bootmeths to be marked as globalSimon Glass
The current way of handling things like EFI bootmgr is a bit odd, since that bootmeth handles selection of the bootdev itself. VBE needs to work the same way, so we should support it properly. Add a flag that indicates that the bootmeth is global, rather than being invoked on each bootdev. Provide a helper to read a bootflow from the bootmeth. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Support sandbox with read interfaceSimon Glass
Update the 'read' command to work correctly with sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12video: Renname vbe.h to vesa.hSimon Glass
We want to use VBE to mean Verfiied Boot for Embedded in U-Boot. Rename the existing VBE (Vesa BIOS extensions) to allow this. Verified Boot for Embedded is documented doc/develop/vbe.rst Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-11Merge tag 'dm-pull-9aug22-take2' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-dm dtoc fixes with pylint, tests
2022-08-10boot: allow bootmeth-distro without CONFIG_NETJohn Keeping
Remove the dependency on CMD_PXE from BOOTMETH_DISTRO by introducing a new hidden kconfig symbol to control whether pxe_utils is compiled, allowing bootstd's distro method to be compiled without needing networking support enabled. Signed-off-by: John Keeping <john@metanate.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org> Correct build errors when CMD_BOOTM is not enabled: Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-10common: Drop display_options.h from common headerSimon Glass
Move this out of the common header and include it only where needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-05Merge tag 'tpm-030822' of https://source.denx.de/u-boot/custodians/u-boot-tpmTom Rini
EFI_RNG_PROTOCOL with a TPM
2022-08-04Audit <flash.h> inclusionTom Rini
A large number of files include <flash.h> as it used to be how various SPI flash related functions were found, or for other reasons entirely. In order to migrate some further CONFIG symbols to Kconfig we need to not include flash.h in cases where we don't have a NOR flash of some sort enabled. Furthermore, in cases where we are in common code and it doesn't make sense to try and further refactor the code itself in to new files we need to guard this inclusion. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-08-04cmd: remove deprecated LCD supportHeinrich Schuchardt
No board uses lcd_clear() anymore. So we can remove support for it. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-08-04cmd: undefined return value of do_extension_apply()Heinrich Schuchardt
If 'extension apply all' is executed and no extension is found, the return value of do_extension_apply() is undefined. Return CMD_RET_FAILURE in this case. Fixes: 2f84e9cf06d3 ("cmd: add support for a new "extension" command") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
2022-08-04cmd: fix do_adc_single()Vyacheslav Bocharov
The source code contains an error: - argv[2] contains <channel> arg, variable for env_set is in argv[3] - number of args is 4 Revert 54d24d72601321f4470c4edf31c6b29adae424a7 cmd: simplify do_adc_single() Fixes 9de612ae4ded53f742f5f99929c06d0839471ced cmd: adc: Add support for storing ADC result in env variable Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-02test: rng: Add a UT testcase for the rng commandSughosh Ganu
The 'rng' command dumps a number of random bytes on the console. Add a set of tests for the 'rng' command. The test function performs basic sanity testing of the command. Since a unit test is being added for the command, enable it by default in the sandbox platforms. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>