summaryrefslogtreecommitdiffstats
path: root/cmd
Commit message (Collapse)AuthorAgeFilesLines
* cmd: correct long text loadb, loadx, loadyHeinrich Schuchardt2021-01-251-6/+6
| | | | | | | | | The first argument is the load address and not an offset. The second argument cannot be entered without the first one. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* cmd: change suppress newline in echo commandHeinrich Schuchardt2021-01-251-31/+18
| | | | | | | | | | | | | | | | | | | | | | By default the echo command emits its arguments followed by a line feed. If any of the arguments contains the sub-string "\c", the line feed is suppressed. This does not match shells used in Linux and BSD where the first argument has to be -n to suppress the line feed. The hush shell interferes with the parsing of backslashes. E.g. in the following command line quadruple backslashes are required for suppressing the line feed: for i in 1 2 3; do for j in 4 5; do echo \\\\c ${i}${j}; done; echo; done; To avoid unexpected behavior the patch changes echo to use -n as first argument to suppress the line feed. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* cmd: efidebug: always check return code from get_variable()AKASHI Takahiro2021-01-231-5/+7
| | | | | | | | | | | | | | | | | | | | | CID 316364 says: > Null pointer dereferences (FORWARD_NULL) > printf("Result total size: 0x%x\n", result->variable_total_size); at do_efi_capsule_res(). The code is basically safe because a buffer for "result" is allocated by malloc() and filled up by the second get_variable(), which fails any way if the allocation has failed. But the first (and second) get_variable() possibly returns an error other than EFI_SUCCESS. We always need to check the return code from get_variable() before accessing the data in "result". While this change won't suppress CID 316364, the resulting code is much safer. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: make the UEFI boot manager configurableHeinrich Schuchardt2021-01-202-6/+15
| | | | | | | | | Some boards are very tight on the binary size. Booting via UEFI is possible without using the boot manager. Provide a configuration option to make the boot manager available. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* cmd: Add a pwm commandPragnesh Patel2021-01-183-0/+124
| | | | | | | | | Add the command "pwm" for controlling the pwm channels. This command provides pwm invert/config/enable/disable functionalities via PWM uclass drivers Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* cmd: disk: Remove fit_print_contents APIRavik Hasija2021-01-161-1/+0
| | | | | | | | fit_print_contents prints similar fit information as printed in bootm stages. Removing this API reduces redundancy & provides improvement in boottime. Signed-off-by: Ravik Hasija <rahasij@linux.microsoft.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* bootmenu: Allow to quit it via ESC/CTRL+CPali Rohár2021-01-161-7/+35
| | | | | | | | | | | | | | | When ESC/CTRL+C is pressed interrupt bootmenu and jump into U-Boot console. As the last entry in bootmenu is always U-Boot console just choose the last entry when ESC or CTRL+C is pressed. ESC key is detected when either no other character appears after '\e' within 10ms or when non-'[' appears after '\e'. It is useful when bootmenu is part of boot process and you want to interrupt boot process by scripts which control U-Boot (serial) console. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* cmd: gpt: add eMMC and GPT supportCorneliu Doban2021-01-161-0/+161
| | | | | | | | | | | | | | | | | Add eMMC and GPT support. - GPT partition list and command to create the GPT added to u-boot environment - eMMC boot commands added to u-boot environment - new gpt commands (enumarate and setenv) that are used by broadcom update scripts and boot commands - eMMC specific u-boot configurations with environment saved in eMMC and GPT support Signed-off-by: Corneliu Doban <cdoban@broadcom.com> Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> [trini: Make gpt_setenv initialize ret to -1, given relevant return error values] Signed-off-by: Tom Rini <trini@konsulko.com>
* cmd: CMD_CPU depends on CPUHeinrich Schuchardt2021-01-161-0/+1
| | | | | | | | | | | | | | | | | | | Compiling with CONFIG_CMD_CPU=y and CONFIG_CPU=n fails with: aarch64-linux-gnu-ld.bfd: cmd/built-in.o: in function `print_cpu_list': /home/user/u-boot/cmd/cpu.c:34: undefined reference to `cpu_get_desc' aarch64-linux-gnu-ld.bfd: /home/user/u-boot/cmd/cpu.c:39: undefined reference to `cpu_get_info' Segmentation fault (core dumped) make: *** [Makefile:1757: u-boot] Error 139 make: *** Deleting file 'u-boot' See error report in https://stackoverflow.com/questions/64678347. Add the missing build dependency. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* cmd: Add MBR partition layout control utilityMarek Szyprowski2021-01-153-0/+323
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a 'mbr' command to let users create or verify MBR partition layout based on the provided text description. The partition layout is alternatively read from the 'mbr_parts' environment variable. This can be used in scripts to help system image flashing tools to ensure proper partition layout. The syntax of the text description of the partition list is similar to the one used by the 'gpt' command. Supported parameters are: name (currently ignored), start (partition start offset in bytes), size (in bytes or '-' to expand it to the whole free area), bootable (boolean flag) and id (MBR partition type). If one wants to create more than 4 partitions, an 'Extended' primary partition (with 0x05 ID) has to be explicitely provided as a one of the first 4 entries. Here is an example how to create a 6 partitions (3 on the 'extended volume'), some of the predefined sizes: > setenv mbr_parts 'name=boot,start=4M,size=128M,bootable,id=0x0e; name=rootfs,size=3072M,id=0x83; name=system-data,size=512M,id=0x83; name=[ext],size=-,id=0x05; name=user,size=-,id=0x83; name=modules,size=100M,id=0x83; name=ramdisk,size=8M,id=0x83' > mbr write mmc 0 Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
* efi_loader: implement EFI_DT_FIXUP_PROTOCOLHeinrich Schuchardt2021-01-132-80/+5
| | | | | | | | | | A boot manager like GRUB can use the protocol to * apply U-Boot's fix-ups to the a device-tree * let U-Boot make memory reservations according to the device-tree * install the device-tree as a configuration table Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* cmd: conitrace: increase wait for next keyHeinrich Schuchardt2021-01-131-2/+2
| | | | | | | | | At 9600 baud or less a 1 ms wait is too short to detect the end of an escape sequence. Increase the wait duration to 10 ms which will work down to 1200 baud. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: setting boot deviceHeinrich Schuchardt2021-01-131-55/+87
| | | | | | | | | | | | | | | | | | | | Up to now the bootefi command used the last file loaded to determine the boot partition. This has led to errors when the fdt had been loaded from another partition after the EFI binary. Before setting the boot device from a loaded file check if it is a PE-COFF image or a FIT image. For a PE-COFF image remember address and size, boot device and path. For a FIT image remember boot device and path. If the PE-COFF image is overwritten by loading another file, forget it. Do not allow to start an image via bootefi which is not the last loaded PE-COFF image. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: simplify running helloworld.efiHeinrich Schuchardt2021-01-131-11/+1
| | | | | | | | | | | Currently when executing 'bootefi hello' we copy helloworld.efi to the address identified by environment variable loadaddr. This is unexected behavior for a user. There is no need to copy helloworld.efi before executing it after relocation. Remove the copy action. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* Merge tag 'xilinx-for-v2021.04' of ↵Tom Rini2021-01-061-5/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next Xilinx changes for v2021.04 arm64: - DT updates microblaze: - Add support for NOR device support spi: - Fix unaligned data write issue nand: - Minor code change xilinx: - Fru fix in limit calculation - Fill git repo link for all Xilinx boards video: - Add support for seps525 spi display tools: - Minor Vitis file support cmd/common - Minor code indentation fixes serial: - Uartlite debug uart initialization fix
| * cmd: load: Fix code indentationMichal Simek2021-01-041-5/+4
| | | | | | | | | | | | | | | | | | Reported by smatch like: cmd/load.c:228 read_record() warn: inconsistent indenting Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | Merge tag 'dm-pull-5jan21' of git://git.denx.de/u-boot-dm into nextTom Rini2021-01-051-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | Driver model: make some udevice fields private Driver model: Rename U_BOOT_DEVICE et al. dtoc: Tidy up and add more tests ns16550 code clean-up x86 and sandbox minor fixes for of-platdata dtoc prepration for adding build-time instantiation
| * | dm: core: Access device flags through functionsSimon Glass2021-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | At present flags are stored as part of the device. In preparation for storing them separately, change the access to go through inline functions. Signed-off-by: Simon Glass <sjg@chromium.org>
* | | Merge tag 'v2021.01-rc5' into nextTom Rini2021-01-051-0/+5
|\ \ \ | |/ / |/| | | | | | | | | | | Prepare v2021.01-rc5 Signed-off-by: Tom Rini <trini@konsulko.com>
| * | cmd: ubi: don't allow to rename a volume to a name that already existPhilippe Reynes2021-01-041-0/+5
| |/ | | | | | | | | | | | | | | | | This commits add a check on the command ubi rename. This check avoids to rename a volume to with a name that is already used on another ubi volume. If two volumes has the same name, then the ubi device can't be mounted anymore. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
* | efidebug: capsule: Add a command to update capsule on diskSughosh Ganu2020-12-311-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a efidebug subcommand to initiate a firmware update using the efi firmware management protocol(fmp) set_image routine. The firmware update can be initiated through 'efidebug capsule disk-update' This would locate the efi capsule file on the efi system partition, and call the platform's set_image fmp routine to initiate the firmware update. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
* | cmd: Drop use of old sequence numbers in commandsSimon Glass2020-12-183-5/+5
| | | | | | | | | | | | Several commands use sequence numbers. Update them to use the new ones. Signed-off-by: Simon Glass <sjg@chromium.org>
* | dm: Avoid accessing seq directlySimon Glass2020-12-189-16/+17
| | | | | | | | | | | | | | | | | | | | At present various drivers etc. access the device's 'seq' member directly. This makes it harder to change the meaning of that member. Change access to go through a function instead. The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now. Signed-off-by: Simon Glass <sjg@chromium.org>
* | dm: treewide: Rename ..._platdata variables to just ..._platSimon Glass2020-12-133-12/+12
| | | | | | | | | | | | | | Try to maintain some consistency between these variables by using _plat as a suffix for them. Signed-off-by: Simon Glass <sjg@chromium.org>
* | dm: treewide: Rename dev_get_platdata() to dev_get_plat()Simon Glass2020-12-132-2/+2
| | | | | | | | | | | | Rename this to be consistent with the change from 'platdata'. Signed-off-by: Simon Glass <sjg@chromium.org>
* | dm: treewide: Rename 'platdata' variables to just 'plat'Simon Glass2020-12-1310-26/+26
| | | | | | | | | | | | | | | | | | | | We use 'priv' for private data but often use 'platdata' for platform data. We can't really use 'pdata' since that is ambiguous (it could mean private or platform data). Rename some of the latter variables to end with 'plat' for consistency. Signed-off-by: Simon Glass <sjg@chromium.org>
* | cmd: sandbox: implement exception commandHeinrich Schuchardt2020-12-134-1/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement the commands * exception undefined - execute an illegal instruction * exception sigsegv - cause a segment violation Here is a possible output: => exception undefined Illegal instruction pc = 0x55eb8d0a7575, pc_reloc = 0x57575 Resetting ... Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* | cli: Support macro processing with a fixed-size bufferSimon Glass2020-12-041-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | At present cli_simple_process_macros() requires that the caller provide an output buffer that is exactly CONFIG_SYS_CBSIZE bytes in length. This makes sense since it is designed to be used from the command line. But we also want to use it for bootargs substitution. Update the function to allow the caller to specify the buffer size. Also return an error if the buffer is exhausted. The caller can ignore that if preferred. Signed-off-by: Simon Glass <sjg@chromium.org>
* | env: Allow returning errors from hdelete_r()Simon Glass2020-12-041-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present this function returns 1 on success and 0 on failure. But in the latter case it provides no indication of what went wrong. If an attempt is made to delete a non-existent variable, the caller may want to ignore this error. This happens when setting a non-existent variable to "", for example. Update the function to return 0 on success and a useful error code on failure. Add a function comment too. Make sure that env_set() does not return an error if it is deleting a variable that doesn't exist. We could update env_set() to return useful error numbers also, but that is beyond the scope of this change. Signed-off-by: Simon Glass <sjg@chromium.org> wip
* | cmd: add "efidebug capsule" commandAKASHI Takahiro2020-12-031-0/+235
| | | | | | | | | | | | | | | | | | "efidebug capsule" is more or less a debugging utility. efidebug capsule update: invoke UpdateCapsule against data on memory efidebug capsule show: show a capsule header efidebug capsule result: dump a capsule result variable Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
* | cmd: efidebug: Add support for TCG2 final events tableIlias Apalodimas2020-12-031-0/+4
| | | | | | | | | | | | | | | | | | A previous commit is adding EFI_TCG2_PROTOCOL, which in it's eventlog support registers an EFI configuration table. Let's add the necessary GUID so 'efidebug table' command can display table names properly. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
* | tpm: use more than sha256 on pcr_extendIlias Apalodimas2020-12-031-1/+2
| | | | | | | | | | | | | | | | | | | | The current tpm2_pcr_extend is hardcoded using SHA256. Let's make the actual command to the TPM2 configurable so we can support a wider range of algorithms and keep the current command line as-is i.e limited to SHA256 only Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* | cmd: Kconfig: migrate CONFIG_SYS_PROMPT_HUSH_PS2Patrick Delaunay2020-12-011-0/+9
| | | | | | | | | | | | | | | | | | Move CONFIG_SYS_PROMPT_HUSH_PS2 in Kconfig, depending on CONFIG_HUSH_PARSER, and remove the default value defined in cli_hush.c under __U_BOOT__. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | setexpr: Add support for stringsSimon Glass2020-12-011-7/+75
| | | | | | | | | | | | | | | | Add support for dealing with string operands, including reading a string from memory into an environment variable and concatenating two strings. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Marek Behún <marek.behun@nic.cz>
* | setexpr: Convert to use a struct for valuesSimon Glass2020-12-011-44/+67
| | | | | | | | | | | | | | | | | | At present a ulong is used to hold operand values. This means that strings cannot be used. While most operations are not useful for strings, concatenation is. As a starting point to supporting strings, convert the code to use a struct instead of a ulong for operands. Signed-off-by: Simon Glass <sjg@chromium.org>
* | setexpr: Correct buffer overflow bug and enable testsSimon Glass2020-12-011-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | At present when more than one substitution is made this function overwrites its buffers. Fix this bug and update the tests now that they can pass. Also update the debug code to show all substrings, since at present it omits the final one. Fixes: 855f18ea0e6 ("setexpr: add regex substring matching and substitution") Signed-off-by: Simon Glass <sjg@chromium.org>
* | setexpr: Correct dropping of final unmatched stringSimon Glass2020-12-011-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present the 'nlen' variable increases with each loop. If the previous loop had back references, then subsequent loops without back references use the wrong value of nlen. The value is larger, meaning that the string terminator from nbuf is copied along to the main buffer, thus terminating the string prematurely. This leads to the final result being truncated, e.g. missing the last (unmatched) part of the string. So "match match tail" become "replaced replaced" instead of "replaced replaced tail". Fix this by resetting nlen to the correct value each time around the lop. Fixes: 855f18ea0e6 ("setexpr: add regex substring matching and substitution") Signed-off-by: Simon Glass <sjg@chromium.org>
* | setexpr: Add some tests for buffer overflow and backrefSimon Glass2020-12-011-17/+4
| | | | | | | | | | | | | | Add tests to check for buffer overflow using simple replacement as well as back references. At present these don't fully pass. Signed-off-by: Simon Glass <sjg@chromium.org>
* | setexpr: Split the core logic into its own functionSimon Glass2020-12-011-58/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present this function always allocates a large amount of stack, and selects its own size for buffers. This makes it hard to test the code for buffer overflow. Separate out the inner logic of the substitution so that tests can call this directly. This will allow checking that the algorithm does not overflow the buffer. Fix up one of the error lines at the same time, since it should be printing nbuf_size, not data_size. Signed-off-by: Simon Glass <sjg@chromium.org>
* | setexpr: Add explicit support for 32- and 64-bit intsSimon Glass2020-12-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present this function assumes that a size of 4 refers to a ulong. This is true on 32-bit machines but not commonly on 64-bit machines. This means that the 'l' specify does not work correctly with setexpr. Add an explicit case for 32-bit values so that 64-bit machines can still use the 'l' specifier. On 32-bit machines, 64-bit is still not supported. This corrects the operation of the default size (which is 4 for setexpr), so update the tests accordingly. The original code for reading from memory was included in 47ab5ad1457 ("cmd_setexpr: allow memory addresses in expressions") but I am not adding a Fixes: tag since that code was not written with 64-bit machines in mind. Signed-off-by: Simon Glass <sjg@chromium.org>
* | command: Add constants for cmd_get_data_size string / errorSimon Glass2020-12-012-3/+3
| | | | | | | | | | | | | | | | | | At present these values are open-coded in a few places. Add constants so the meaning is clear. Also add a comment to cmd_get_data_size() Signed-off-by: Simon Glass <sjg@chromium.org>
* | cmd: pxe: Use internal FDT if retrieving from FDTDIR failsAnton Leontiev2020-12-011-7/+14
|/ | | | | | | | As FDTDIR label doesn't specify exact file to be loaded, it should not fail if no file exists in the directory. In this case try to boot with internal FDT if it exists. Signed-off-by: Anton Leontiev <aleontiev@elvees.com>
* tpm: Change response length of tpm2_get_capability()Ilias Apalodimas2020-11-091-2/+2
| | | | | | | | | | | For implementing the EFI_TCG2_PROTOCOL we need the count field returned by the TPM when reading capabilities via tpm2_get_capability(). Adjust the implementation of the 'tpm2 get_capability' command accordingly. Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* cmd: conitrace: replace getc() by getchar()Heinrich Schuchardt2020-11-091-2/+2
| | | | | | | This command was missed when renaming getc() to getchar(). Fixes: c670aeee3df9 ("common: rename getc() to getchar()") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* cmd: log: Add commands to manipulate filtersSean Anderson2020-10-302-0/+242
| | | | | | | | | | | | | This adds several commands to add, list, and remove log filters. Due to the complexity of adding a filter, `log filter-list` uses options instead of positional arguments. These commands have been added as subcommands to log by using a dash to join the subcommand and subsubcommand. This is stylistic, and they could be converted to proper subsubcommands if it is wished. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* cmd: log: Make "log level" print all log levelsSean Anderson2020-10-301-3/+9
| | | | | | | | | This makes the log level command print all valid log levels. The default log level is annotated. This provides an easy way to see which log levels are compiled-in. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* cmd: log: Add commands to list categories and driversSean Anderson2020-10-301-0/+35
| | | | | | | | | This allows users to query which categories and drivers are available on their system. This allows them to construct filter-add commands without (e.g.) adjusting the log format to show categories and drivers. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* cmd: log: Split off log level parsingSean Anderson2020-10-301-6/+23
| | | | | | | | | Move parsing of log level into its own function so it can be re-used. This also adds support for using log level names instead of just the integer equivalent. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* cmd: log: Use sub-commands for logSean Anderson2020-10-301-27/+4
| | | | | | | This reduces duplicate code, and makes adding new sub-commands easier. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: log: Convert log_test from python to CSean Anderson2020-10-301-6/+0
| | | | | | | | | | | | | | | | When rebasing this series I had to renumber all my log tests because someone made another log test in the meantime. This involved updaing a number in several places (C and python), and it wasn't checked by the compiler. So I though "how hard could it be to just rewrite in C?" And though it wasn't hard, it *was* tedious. Tests are numbered the same as before to allow for easier review. A note that if a test fails, everything after it will probably also fail. This is because that test won't clean up its filters. There's no easy way to do the cleanup, except perhaps removing all filters in a wrapper function. Signed-off-by: Sean Anderson <seanga2@gmail.com>