summaryrefslogtreecommitdiff
path: root/cmd
AgeCommit message (Collapse)AuthorFilesLines
2023-01-27cmd: fix mtest on 64 bit systemsHeinrich Schuchardt1-15/+11
* Use 16 digits on 64 bit systems. * Use 64 bit patterns on 64 bit systems. * Expect the sign bit in bit 63 on 64 bit systems. * Adjust the formatting of a constant. * Always print result on new line Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Stefan Roese <sr@denx.de>
2023-01-26cmd: fix return code of 'sf erase'Heinrich Schuchardt1-6/+6
If the offset or the size passed to the 'sf erase' command exceeds the size of the SPI flash displaying the command usage is not helpful. Return CMD_RET_FAILURE instead of CMD_RET_USAGE. Use the CMD_RET_* constants instead of 0, 1, -1. Simplify a logical expression in the final return statement. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Dhruva Gole <d-gole@ti.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2023-01-26cmd: simplify do_spi_flash()Heinrich Schuchardt1-13/+6
CMD_RET_USAGE == -1. The special handling of this value at the end of do_spi_flash() does not make any sense. To avoid future confusion use the CMD_RET_* constants and simplify the code. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2023-01-26cmd: fix return code of 'sf write' and 'sf read'Heinrich Schuchardt1-7/+7
If the offset or the size passed to the 'sf write' or 'sf read' command exceeds the size of the SPI flash displaying the command usage is not helpful. Return CMD_RET_FAILURE instead of CMD_RET_USAGE. Use the CMD_RET_* constants instead of 0, 1, -1. Simplify a logical expression in the final return statement. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2023-01-24bootstd: Drop the old bootflow_scan_first()Simon Glass1-1/+1
This function is not used outside tests. Drop it and rename bootflow_scan_dev() since it is how we start a scan now. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-24bootstd: Allow scanning a single bootdev labelSimon Glass1-53/+33
We want to support scanning a single label, like 'mmc' or 'usb0'. Add this feature by plumbing the label through to the iterator, setting a flag to indicate that only siblings of the initial device should be used. This means that scanning a bootdev by its name is not supported anymore. That feature doesn't seem very useful in practice, so it is no great loss. Add a test for bootdev_find_by_any() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-24bootstd: Add a hunter for the extension featureSimon Glass1-0/+25
This needs to run before any bootdev is used, so add a hunter for it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-24extension: Refactor to allow non-command usageSimon Glass1-4/+14
The current extension code is designed to be used from commands. We want to add a boot driver which uses it. To help with this, split the code into the command processing and a function which actually does the scan. Really the extension code should be in common/ or use driver model, but this is a start. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-24bootstd: Use hunters when scanning for bootflowsSimon Glass1-1/+4
Add a flag to control whether hunters are used when scanning for bootflows. Enable it by default and tidy up the flag comments a little. Fow now this has no effect, until a future patch enables this feature. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-24bootstd: Treat DHCP and PXE as bootdev labelsSimon Glass2-2/+2
These are associated with the ethernet boot device but do not match its uclass name, so handle them as special cases. Provide a way to pass flags through with the bootdev so that we know how to process it. The flags are checked by the bootmeths, to ensure that only the selected bootmeth is used. While these both use the network device, they work quite differently. It is common to run only one of these, or to run PXE before DHCP. Provide bootflow flags to control which methods are used. Check these in the two bootmeths so that only the chosen one is used. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-24bootstd: Include the device tree in the bootflowSimon Glass1-0/+6
Some bootmeths provide a way to load a device tree as well as the base OS image. Add a way to store this in the bootflow. Update the 'bootflow info' command to show this information. Note that the device tree is not allocated, but instead is stored at an address provided by an environment variable. This may need to be adjusted at some point, but for now it works well and fits in with the existing distro-boot scripts. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-24net: Add a function to run dhcpSimon Glass1-0/+35
At present this must be done by executing the command. Also it involves fiddling with the environment to determine the correct autoload behaviour. Ideally it should be possible to run network operations without even having the command line present (CONFIG_CMDLINE). For now, add a function to handle DHCP, so it can be called from a bootdev more easily. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-01-24bootstd: Support running bootdev huntersSimon Glass1-1/+6
Add a way to run a bootdev hunter to find bootdevs of a certain type. Add this to the 'bootdev hunt' command. Test for this are added in a later patch, since a useful test needs some hunters to work with. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-24bootstd: Add the concept of a bootdev hunterSimon Glass1-3/+32
Some bootdevs must be enumerated before they appear. For example, USB bootdevs are not visible until USB is enumerated. With standard boot this needs to happen automatically, since we only want to enumerate a bus if it is needed. Add a way to define bootdev 'hunters' which can be used to hunt for bootdevs of a given type. Track which ones have been used and add a command to list them. Include a clang work-around which seems to be needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-24vbe: Avoid a build failure when bloblist is not enabledSimon Glass1-2/+5
This needs to be able to work (at least partially) without the bloblist active. Add a condition for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-24dm: core: Support sorting devices with dm treeSimon Glass1-3/+7
Add a -s flag to sort the top-level devices in order of uclass ID. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-20global: Finish CONFIG -> CFG migrationTom Rini1-3/+3
At this point, the remaining places where we have a symbol that is defined as CONFIG_... are in fairly odd locations. While as much dead code has been removed as possible, some of these locations are simply less obvious at first. In other cases, this code is used, but was defined in such a way as to have been missed by earlier checks. Perform a rename of all such remaining symbols to be CFG_... rather than CONFIG_... Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-18cmd: part: Add partition-related type commandEnric Balletbo i Serra1-0/+35
This implements the following command: part type mmc 0:1 -> print partition type UUID part type mmc 0:1 uuid -> set environment variable to partition type UUID "part type" can be useful when writing a bootcmd which searches for a specific partition type to enable automatic discovery of partitions and their intended usage or mount point. Signed-off-by: Enric Balletbo i Serra <eballetbo@redhat.com> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: Fix when CONFIG_PARTITION_TYPE_GUID is disabled and have the command check for "types" before "type"] Signed-off-by: Tom Rini <trini@konsulko.com>
2023-01-18event: Correct dependencies on the EVENT frameworkTom Rini1-0/+1
The event framework is just that, a framework. Enabling it by itself does nothing, so we shouldn't ask the user about it. Reword (and correct typos) around this the option and help text. This also applies to DM_EVENT and EVENT_DYNAMIC. Only EVENT_DEBUG and CMD_EVENT should be visible to the user to select, when EVENT is selected. With this, it's time to address the larger problems. When functionality uses events, typically via EVENT_SPY, the appropriate framework then must be select'd and NOT imply'd. As the functionality will cease to work (and so, platforms will fail to boot) this is non-optional and where select is appropriate. Audit the current users of EVENT_SPY to have a more fine-grained approach to select'ing the framework where used. Also ensure the current users of event_register and also select EVENT_DYNAMIC. Cc: AKASHI Takahiro <takahiro.akashi@linaro.org> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Reported-by: Oliver Graute <Oliver.Graute@kococonnector.com> Reported-by: Francesco Dolcini <francesco.dolcini@toradex.com> Fixes: 7fe32b3442f0 ("event: Convert arch_cpu_init_dm() to use events") Fixes: 42fdcebf859f ("event: Convert misc_init_f() to use events") Fixes: c5ef2025579e ("dm: fix DM_EVENT dependencies") Signed-off-by: Tom Rini <trini@konsulko.com> Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Fabio Estevam <festevam@denx.de>
2023-01-18cmd: event: Remove additional event descriptionMichal Simek1-1/+1
The first name is taken from command name that's why shouldn't be listed in help. The similar change was also done by commit a84d3b6c5634 ("cmd: pwm: Remove additional pwm description"). Also remove additional spaces in help message. Before: event event list - list event spies After: event list - list event spies Signed-off-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-17bootstd: Support creating a boot menuSimon Glass1-2/+35
Create an expo to handle the boot menu. For now this is quite simple, with just a header, some menu items and a pointer to show the current one. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-17bootstd: Allow reading a logo for the OSSimon Glass1-0/+6
Some operating systems provide a logo in bmp format. Read this in if present so it can be displayed in the menu. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-17bootstd: Read the Operating System name for distro/scriptsSimon Glass1-0/+1
Add the concept of an OS name to the bootflow. This typically includes the OS name, version and kernel version. Implement this for the distro and script bootmeths so that it works with Armbian and older version of Fedora. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-17video: Add font functions to the vidconsole APISimon Glass1-2/+9
Support for fonts currently depends on the type of vidconsole in use. Add two new methods to enumerate fonts and to set the font. Fix a few other method comments while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-17image: Move common image code to image_board and commandSimon Glass1-180/+1
We should use the cmd/ directory for commands rather than for common code used elsewhere in U-Boot. Move the common 'source' code into image-board.c to achieve this. The image_source_script() function needs to call run_command_list() so seems to belong better in the command library. Move and rename it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-17image: Add a function to find a script in an imageSimon Glass1-101/+116
Split this functionality out of the 'source' command so it can be used from another place. For now leave it where it is, but a future patch will move it out of cmd/ Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16menu: Make use of CLI character processingSimon Glass2-7/+14
Avoid duplicating some of the escape-sequence processing here and use the CLI function instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16menu: Update bootmenu_loop() to return the codeSimon Glass2-3/+3
Use the return value to save having to pass around a pointer. This also resolves any ambiguity about what *key contains when the function is called. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16menu: Update bootmenu_autoboot_loop() to return the codeSimon Glass1-1/+1
Use the return value to save having to pass around a pointer. This also resolves any ambiguity about what *key contains when the function is called. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16menu: Rename KEY_... to BKEY_...Simon Glass2-18/+18
This enum values conflict with linux/input.h so rename them. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-12cmd: spi: Judge the number of added parameterschenzhipeng1-0/+3
When only sspi is entered, help information can be printed. Signed-off-by: chenzhipeng <chenzhipeng@eswincomputing.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-11cmd: exit: Fix return value propagation out of environment scriptsMarek Vasut1-2/+5
Make sure the 'exit' command as well as 'exit $val' command exits from environment scripts immediately and propagates return value out of those scripts fully. That means the following behavior is expected: " => setenv foo 'echo bar ; exit 1' ; run foo ; echo $? bar 1 => setenv foo 'echo bar ; exit 0' ; run foo ; echo $? bar 0 => setenv foo 'echo bar ; exit -2' ; run foo ; echo $? bar 0 " As well as the followin behavior: " => setenv foo 'echo bar ; exit 3 ; echo fail'; run foo; echo $? bar 3 => setenv foo 'echo bar ; exit 1 ; echo fail'; run foo; echo $? bar 1 => setenv foo 'echo bar ; exit 0 ; echo fail'; run foo; echo $? bar 0 => setenv foo 'echo bar ; exit -1 ; echo fail'; run foo; echo $? bar 0 => setenv foo 'echo bar ; exit -2 ; echo fail'; run foo; echo $? bar 0 => setenv foo 'echo bar ; exit ; echo fail'; run foo; echo $? bar 0 " Fixes: 8c4e3b79bd0 ("cmd: exit: Fix return value") Reviewed-by: Hector Palacios <hector.palacios@digi.com> Signed-off-by: Marek Vasut <marex@denx.de>
2023-01-11fastboot: remove #ifdef CONFIG when it is possiblePatrick Delaunay1-19/+16
Much of the fastboot code predates the introduction of Kconfig and has quite a few #ifdefs in it which is unnecessary now that we can use IS_ENABLED() et al. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Sean Anderson <sean.anderson@seco.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3l
2023-01-11cmd: change the return value when argc errorShenlin Liang1-1/+1
When the number of parameters is wrong, the return value should be processed in the same way as other cmds, return CMD_RET_USAGE so that it can print the information. Signed-off-by: Shenlin Liang <liangshenlin@eswincomputing.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-11cmd: mtdparts: add SYS_MTDPARTS_RUNTIME dependency on ↵Patrick Delaunay1-0/+2
CONFIG_MTDIDS/MTDPARTS_DEFAULT The two configuration CONFIG_MTDIDS_DEFAULT and CONFIG_MTDPARTS_DEFAULT are not needed with mtd configuration CONFIG_SYS_MTDPARTS_RUNTIME which allows the MTDIDS and MTDPARTS to be configured at runtime. This patch has no defconfig impacts because CONFIG_SYS_MTDPARTS_RUNTIME is only used by two platforms (stm32mp and igep00x0) which don't define CONFIG_MTDIDS_DEFAULT or CONFIG_MTDPARTS_DEFAULT. This patch solves an UBI environment load issue for NAND boot for stm32mp15 platform. In mtd_uboot.c, when GD_FLG_ENV_READY is not set, env_get_f() return a EMPTY string, define in default_environment[] because CONFIG_MTDIDS_DEFAULT="" and CONFIG_MTDPARTS_DEFAULT="", but a NULL pointer is expected to allow call of board_mtdparts_default. Without mtdparts, the env partition [CONFIG_ENV_UBI_PART="UBI"] is not found in env/ubi.c [CONFIG_ENV_IS_IN_UBI]. It is not a problem when env becomes ready, as these empty variables are removed form U-Boot environment in env_import() / himport_r(). Fixes: a331017c237c ("Complete migration of MTDPARTS_DEFAULT / MTDIDS_DEFAULT, include in environment") Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-09Merge branch 'next'Tom Rini10-80/+96
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-01-07efi_loader: carve out efi_get_memory_map_alloc()Heinrich Schuchardt1-14/+4
Carve out code from efidebug command used to read the memory map. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-01-04cmd: avoid endless loop in sound play commandHeinrich Schuchardt1-2/+2
A parameter starting with a hyphen leads to an endless loop in the sound play command. Leave it to dectoul() to handle the hyphen. It will return 0 for a negative number. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-31cmd: source: Support specifying config nameSean Anderson1-21/+53
As discussed previously [1,2], the source command is not safe to use with verified boot unless there is a key with required = "images" (which has its own problems). This is because if such a key is absent, signatures are verified but not required. It is assumed that configuration nodes will provide the signature. Because the source command does not use configurations to determine the image to source, effectively no verification takes place. To address this, allow specifying configuration nodes. We use the same syntax as the bootm command (helpfully provided for us by fit_parse_conf). By default, we first try the default config and then the default image. To force using a config, # must be present in the command (e.g. `source $loadaddr#my-conf`). For convenience, the config may be omitted, just like the address may be (e.g. `source \#`). This also works for images (`source :` behaves exactly like `source` currently does). [1] https://lore.kernel.org/u-boot/7d711133-d513-5bcb-52f2-a9dbaa9eeded@prevas.dk/ [2] https://lore.kernel.org/u-boot/042dcb34-f85f-351e-1b0e-513f89005fdd@gmail.com/ Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-31cmd: source: Clean up a few linesSean Anderson1-6/+4
This simplifies a few lines and corrects an error message. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-12-29cmd: net: wget: fix Kconfig dependencyMichael Walle1-1/+1
The wget command uses TCP, but fails to select PROT_TCP in Kconfig. Instead it selects the non-existing symbol TCP. Fix the typo. Signed-off-by: Michael Walle <michael@walle.cc>
2022-12-23global: Migrate CONFIG_SYS_I2C_DIRECT_BUS to CFGTom Rini1-2/+2
Perform a simple rename of CONFIG_SYS_I2C_DIRECT_BUS to CFG_SYS_I2C_DIRECT_BUS Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-23global: Migrate CONFIG_RAMDISK_ADDR to CFGTom Rini1-2/+2
Perform a simple rename of CONFIG_RAMDISK_ADDR to CFG_RAMDISK_ADDR Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-23global: Migrate CONFIG_POSTBOOTMENU to CFGTom Rini1-2/+2
Perform a simple rename of CONFIG_POSTBOOTMENU to CFG_POSTBOOTMENU Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-22Convert CONFIG_THOR_RESET_OFF to KconfigTom Rini1-0/+4
This converts the following to Kconfig: CONFIG_THOR_RESET_OFF Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-22i2c: Remove CONFIG_I2C_MULTI_BUSTom Rini1-9/+6
This functionality is part of the legacy I2C subsystem and is currently unused anywhere. Remove the remaining references. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-21Merge tag 'v2023.01-rc4' into nextTom Rini3-15/+29
Prepare v2023.01-rc4 Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-20eficonfig: EFI_VARIABLE_APPEND_WRITE is not set for null keyMasahisa Kojima1-2/+36
The signed null key with authenticated header is used to clear the PK, KEK, db and dbx. When CONFIG_EFI_MM_COMM_TEE is enabled (StMM and OP-TEE based RPMB storage is used as the EFI variable storage), clearing KEK, db and dbx by enrolling a signed null key does not work as expected if EFI_VARIABLE_APPEND_WRITE attritube is set. This commit checks the selected file is null key, then EFI_VARIABLE_APPEND_WRITE attibute will not be used for the null key. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-12-20eficonfig: avoid SetVariable between GetNextVariableName callsMasahisa Kojima1-16/+38
The current code calls efi_set_variable_int() to delete the invalid boot option between calls to efi_get_next_variable_name_int(), it may produce unpredictable results. This commit moves removal of the invalid boot option outside of the efi_get_next_variable_name_int() calls. EFI_NOT_FOUND returned from efi_get_next_variable_name_int() indicates we retrieved all EFI variables, it should be treated as EFI_SUCEESS. To address the checkpatch warning of too many leading tabs, combine two if statement into one. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-12-20eficonfig: carve out efi_get_next_variable_name_int callsMasahisa Kojima1-47/+15
To retrieve the EFI variable name by efi_get_next_variable_name_int(), the sequence of alloc -> efi_get_next_variable_name_int -> realloc -> efi_get_next_variable_name_int is required. In current code, this sequence repeatedly appears in the several functions. It should be curved out a common function. This commit also fixes the missing free() of var_name16 in eficonfig_delete_invalid_boot_option(). Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>