aboutsummaryrefslogtreecommitdiff
path: root/cmd
AgeCommit message (Collapse)Author
2024-01-29cmd: in do_efi_capsule_esrt use efi_get_configuration_tableHeinrich Schuchardt
Use library function efi_get_configuration_table() to find the ESRT. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-26cmd: provide command to display SMBIOS informationHeinrich Schuchardt
U-Boot can either generated an SMBIOS table or copy it from a prior boot stage, e.g. QEMU. Provide a command to display the SMBIOS information. Currently only type 1 and 2 are translated to human readable text. Other types may be added later. Currently only a hexdump and the list of strings is provided for these. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-24cmd: bootmenu: rename U-Boot console to ExitSvyatoslav Ryhel
It seems that the U-Boot console entry of the bootmenu has lost its original meaning. Now, even if it is chosen, the probability that you will enter the actual U-Boot console is quite low. Boot env, bootflow, bootcommand script may appear, but not the actual console. Hence, let's remove ambiguity and name this entry by what it actually does: 'Exit' the bootmenu. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
2024-01-24cmd: increase default for SYS_MAXARGSHeinrich Schuchardt
The value of CONFIG SYS_MAXARGS limits the usability of the 'for' command. The current default of 16 is too low for some use case. Cf. https://bugs.launchpad.net/snap-core18/+bug/1910094 Increase the default to 64. Reported-by: Dave Jones <dave.jones@canonical.com> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-01-22cmd/flash: Make this default y for CFI and NOR onlyTom Rini
This command is only useful on CFI and NOR type flashes and not others. Update the dependency so that it's not enabled by default in other cases. This will lead to a number of platforms no longer building this command, where it was not useful. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-01-22cmd/mtdparts: Make this select MTD_PARTITIONSTom Rini
Rather than rely on someone selecting or implying this hidden symbol that the command requires, select it explicitly. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-01-18cmd: license: Add CONFIG_GZIP dependencyIvan Orlov
'License' command processing code could be successfully compiled only when CONFIG_GZIP option is enabled, otherwise it can't find the 'gunzip' function definition (it is defined in lib/gunzip.c). Add CONFIG_GZIP dependency to 'license' command config option in the corresponding Kconfig. Signed-off-by: Ivan Orlov <ivan.orlov@codethink.co.uk>
2024-01-18cmd: bootflow: remove dead code in do_bootflow_cmdline()Heinrich Schuchardt
Checking argc < 3 twice is redundant. Addresses-Coverity-ID: 477198 Logically dead code Fixes: 921f63e57238 ("bootflow: Allow setting a cmdline arg with no value") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-01-18getchar(): Correct usageTom Rini
The function getchar() returns an 'int' and not a 'char'. Coverity notes that "Assigning the return value of getchar to char ... truncates its value." and so for the most part we can resolve this easily by using 'int' as intended, and often used throughout the codebase. A few places are not so simple and would require further re-architecting of the code in order to change this, so we leave them be. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-01-18Revert "cmd: Set modern hush as default shell"Tom Rini
Currently at least two SoC families are able to cause a crash using their regular boot scripts, with the new parser. For now, revert to the old parser as default. This reverts commit 78912cfde281146d28254b230ecaa9b06722e6ff. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-01-17Merge tag 'efi-2024-04-rc1-2' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-efi Documentation: * add generated index to table of contents * create index entries for commands * update Python packages used to build the documentation * fix typos in dfu documentation UEFI: * split unrelated code from efi_bootmgr.c * rename CONFIG_BOOTEFI_BOOTMGR to CONFIG_EFI_BOOTMGR * net: tftp: remove explicit EFI configuration dependency * fs: remove explicit EFI configuration dependency Other: * Add Goldfish RTC driver and make it available on RISC-V QEMU
2024-01-17cmd/mem.c: fix wrong use of ifdef, drop pointless SUPPORT_64BIT_DATA macroRasmus Villemoes
The macro MEM_SUPPORT_64BIT_DATA is always defined, as either 1 or 0, so using "#ifdef MEM_SUPPORT_64BIT_DATA" doesn't do what one expects. This means that currently all 32 bit targets get compiled with the .q suffix mentioned in the help text, while it doesn't actually work. Use the proper "#if" instead. There's really no point defining another similarly-named macro with exactly the same value, so just use MEM_SUPPORT_64BIT_DATA throughout. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2024-01-17efi_loader: rename BOOTEFI_BOOTMGR to EFI_BOOTMGRAKASHI Takahiro
At this point, EFI boot manager interfaces is fully independent from bootefi command. So just rename the configuration parameter. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-01-17efi_loader: split unrelated code from efi_bootmgr.cAKASHI Takahiro
Some code moved from cmd/bootefi.c is actually necessary only for "bootefi <addr>" command (starting an image manually loaded by a user using U-Boot load commands or other methods (like JTAG debugger). The code will never been opted out as unused code by a compiler which doesn't know how EFI boot manager is implemented. So introduce a new configuration, CONFIG_EFI_BINARY_EXEC, to enforce them opted out explicitly. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2024-01-16cmd/mem.c: use memmove in do_mem_cp()Rasmus Villemoes
There's no 'mv' shell command for handling overlapping src and dst regions, and there's no point introducing one, when we can just make the existing 'cp' command DTRT in all cases. memmove() should at most be a few instructions more then memcpy() (to detect the appropriate direction to do the copy), which is of course completely in the noise with all the string processing that a shell command does. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2024-01-15cmd: mtd: avoid unintentional integer overflowHeinrich Schuchardt
mtd dump beyond 4 GiB will show incorrect results. Multiplying two u32 will yield a u32. Add a missing cast. Fixes: 5db66b3aee6f ("cmd: mtd: add 'mtd' command") Addresses-Coverity-ID: 477205 ("Unintentional integer overflow") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/all/20240111073155.19545-1-heinrich.schuchardt@canonical.com Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2024-01-13cmd: efidebug: check pointer after memory allocationHeinrich Schuchardt
After calling efi_alloc() we must check that the return value is not NULL. Fixes: f01c961ee34c ("cmd: efidebug: add uri device path") Addresses-Coverity-ID: 477185 Dereference null return value Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-13efi_loader: Clean up efi_dp_append and efi_dp_concatIlias Apalodimas
Looking back at the initrd storing functionality, we introduced three functions, efi_dp_append_or_concatenate(), efi_dp_append/concat(). In hindsight we could have simplified that by a lot. First of all none of the functions append anything. They all allocate a new device path and concatenate the contents of two device paths in one. A boolean parameter controls the final device path -- if that's true an end node is injected between the two device paths. So let's rewrite this and make it a bit easier to read. Get rid of efi_dp_append(), efi_dp_concat() and rename efi_dp_append_or_concatenate() to efi_dp_concat(). This is far more intuitive and the only adjustment that is needed is an extra boolean argument on all callsites. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-01-07cmd: acpi: check HW reduced flag in acpi listHeinrich Schuchardt
On non x86 platforms the hardware reduce flag must be set in the FADT table. Write an error message if the flag is missing. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org> Rebased on -next to use nomap, add hyphens: Signed-off-by: Simon Glass <sjg@chromium.org>
2024-01-07cmd: acpi: fix listing DSDT and FACSHeinrich Schuchardt
If field X_FIRMWARE_CTRL is filled, field FIRMWARE must be ignored. If field X_DSDT is filled, field DSDT must be ignored. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org> Rebased on -next to use nomap: Signed-off-by: Simon Glass <sjg@chromium.org>
2024-01-07acpi: Write pointers to tables instead of addressesSimon Glass
Sandbox uses an API to map between addresses and pointers. This allows it to have (emulated) memory at zero and avoid arch-specific addressing details. It also allows memory-mapped peripherals to work. As an example, on many machines sandbox maps address 100 to pointer value 10000000. However this is not correct for ACPI, if sandbox starts another program (e.g EFI app) and passes it the tables. That app has no knowledge of sandbox's address mapping. So to make this work we want to store 10000000 as the value in the table. Add two new 'nomap' functions which clearly make this exeption to how sandbox works. This should allow EFI apps to access ACPI tables with sandbox, e.g. for testing purposes. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2023-12-28Merge patch series "Modernize U-Boot shell"Tom Rini
Francis Laniel <francis.laniel@amarulasolutions.com> says: During 2021 summer, Sean Anderson wrote a contribution to add a new shell, based on LIL, to U-Boot [1, 2]. While one of the goals of this contribution was to address the fact actual U-Boot shell, which is based on Busybox hush, is old there was a discussion about adding a new shell versus updating the actual one [3, 4]. So, in this series, with Harald Seiler, we updated the actual U-Boot shell to reflect what is currently in Busybox source code. Basically, this contribution is about taking a snapshot of Busybox shell/hush.c file (as it exists in commit 37460f5da) and adapt it to suit U-Boot needs. This contribution was written to be as backward-compatible as possible to avoid breaking the existing. So, the modern hush flavor offers the same as the actual, that is to say: 1. Variable expansion. 2. Instruction lists (;, && and ||). 3. If, then and else. 4. Loops (for, while and until). No new features offered by Busybox hush were implemented (e.g. functions). It is possible to change the parser at runtime using the "cli" command: => cli print old => cli set modern => cli print modern => cli set old The default parser is the old one. Note that to use both parser, you would need to set both CONFIG_HUSH_MODERN_PARSER and CONFIG_HUSH_OLD_PARSER. In terms of testing, new unit tests were added to ut to ensure the new behavior is the same as the old one and it does not add regression. Nonetheless, if old behavior was buggy and fixed upstream, the fix is then added to U-Boot [5]. In sandbox, all of these tests pass smoothly: => printenv board board=sandbox => ut hush Running 20 hush tests ... Failures: 0 => cli set modern => ut hush Running 20 hush tests ... Failures: 0 Thanks to the effort of Harald Seiler, I was successful booting a board: => printenv fdtfile fdtfile=amlogic/meson-gxl-s905x-libretech-cc.dtb => cli get old => boot ... root@lepotato:~# root@lepotato:~# reboot ... => cli set modern => cli get modern => printenv fdtfile fdtfile=amlogic/meson-gxl-s905x-libretech-cc.dtb => boot ... root@lepotato:~# This contribution indeed adds a lot of code and there were concern about its size [6, 7]. With regard to the amount of code added, the cli_hush_upstream.c is 13030 lines long but it seems a smaller subset is really used: gcc -D__U_BOOT__ -E common/cli_hush_upstream.c | wc -l 2870 Despite this, it is better to still have the whole upstream code for the sake of easing maintenance. With regard to memory size, I conducted some experiments for version 8 of this series and for a subset of arm64 boards and found the worst case to be 4K [8]. Tom Rini conducted more research on this and also found the increase to be acceptable [9]. If you want to review it - your review will really be appreciated - here are some information regarding the commits: * commits marked as "test:" deal with unit tests. * commit "cli: Add Busybox upstream hush.c file." copies Busybox shell/hush.c into U-Boot tree, this explain why this commit contains around 12000 additions. * commit "cli: Port Busybox 2021 hush to U-Boot." modifies previously added file to permit us to use this as new shell. The really good idea of #include'ing Busybox code into a wrapper file to define some particular functions while minimizing modifications to upstream code comes from Harald Seiler. * commit "cmd: Add new parser command" adds a new command which permits selecting parser at runtime. I am not really satisfied with the fact it calls cli_init() and cli_loop() each time the parser is set, so your reviews would be welcomed. * Other commits focus on enabling features we need (e.g. if).
2023-12-28cmd: Set modern hush as default shellFrancis Laniel
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
2023-12-28cli: Enables using modern hush parser as command line parserFrancis Laniel
If one defines HUSH_MODERN_PARSER, it is then possible to use modern parser with: => cli get old => cli set modern => cli get modern Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
2023-12-28cmd: Add new cli commandFrancis Laniel
This command can be used to print the current parser with 'cli get'. It can also be used to set the current parser with 'cli set'. For the moment, only one value is valid for set: old. Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
2023-12-28cli: Add menu for hush parserFrancis Laniel
For the moment, the menu contains only entry: HUSH_OLD_PARSER which is the default. The goal is to prepare the field to add a new hush parser which guarantees actual behavior is still correct. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
2023-12-21Merge patch series "Complete decoupling of bootm logic from commands"Tom Rini
Simon Glass <sjg@chromium.org> says: This series continues refactoring the bootm code to allow it to be used with CONFIG_COMMAND disabled. The OS-handling code is refactored and a new bootm_run() function is created to run through the bootm stages. This completes the work. A booti_go() function is created also, in case it proves useful, but at last for now standard boot does not use this. This is cmdd (part d of CMDLINE refactoring) It depends on dm/bootstda-working which depends on dm/cmdc-working
2023-12-21bootm: Create a function to run through the bootz statesSimon Glass
In a few places, the bootz command is used to handle a boot. We want these to be done without needing CONFIG_CMDLINE, so add a new bootz_run() function to handle this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21bootm: Create a function to run through the bootm statesSimon Glass
In quite a few places, the bootm command is used to handle a boot. We want these to be done without needing CONFIG_CMDLINE, so add a new bootm_run() function to handle this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21bootm: Rename do_bootm_states() to bootm_run_states()Simon Glass
Rename the function to bootm_run_states() to better indicate ts purpose. The 'do_' prefix is used to indicate a command processor, which this is now not. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21bootm: Drop arguments from do_bootm_states()Simon Glass
Use the bootm_info struct to hold the information required by bootm. Now that none of the functions called from do_bootm_states() needs an argv[] list, change the arguments of do_bootm_states() as well. Take care to use the same value for boot_progress even though it is a little inconsistent. For booti make sure it only uses argv[] and argc at the top of the function, so we can eventually refactor to remove these parameters. With bootm, some OSes need access to the arguments provided to the command, so set these up in the bootm_info struct, for bootm only. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21bootz: Avoid use of #ifdefSimon Glass
Use the compiler to get the set of states, instead of the preprocessor. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-21booti: Avoid use of #ifdefSimon Glass
Use the compiler to get the set of states, instead of the preprocessor. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-12-20cmd: part: Cover both part type entries with GUID ifdefMarek Vasut
The 'part type' subcommand depends on GUID partition table support. The help text exposes one of two 'part type' subcommand entries, hide both in case GUID partition table support is not enabled to avoid confusing users. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-12-20bootflow: Allow setting a cmdline arg with no valueSimon Glass
This is supposed to be supported by the 'bootflow cmd' command, at least according to the help. There is a 'bootflow cmd clear' but it is often more intuitive to use 'bootcmd cmd set' with an empty value. Update the command to pass BOOTFLOWCL_EMPTY in this case. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-12-20arm: afs: Set the filesize env. var. on loadRobert Catherall
The `afs load` command copies data to RAM. Set the filesize environment variable to record how much data was 'loaded' Signed-off-by: Robert Catherall <robert.catherall@arm.com> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Andre Przywara <andre.przywara@arm.com>
2023-12-20imxtract: specify max gunzip sizeNikita Shubin
Specify max gunzip size from config to override SYS_XIMG_LEN default value wich is 0x800000. In case we have a large portion of FIT image, for example gzipped kernel with decompressed size large than 0x800000 we should enlarge imxract area, otherwise extracting it will fail. It used to be a hardcoded define in cmd/ximg.c and we are moving it to config. Signed-off-by: Nikita Shubin <n.shubin@yadro.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-12-18Merge tag 'v2024.01-rc5' into nextTom Rini
Prepare v2024.01-rc5
2023-12-17bootmeth: use efi_loader interfaces instead of bootefi commandAKASHI Takahiro
Now that efi_loader subsystem provides interfaces that are equivalent with bootefi command, we can replace command invocations with APIs. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2023-12-17cmd: efidebug: ease efi configuration dependencyAKASHI Takahiro
Now it is clear that the command actually depends on interfaces, not "bootefi bootmgr" command. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2023-12-17cmd: bootefi: move library interfaces under lib/efi_loaderAKASHI Takahiro
In the prior commits, interfaces for executing EFI binary and boot manager were carved out. Move them under efi_loader directory so that they can be called from other places without depending on bootefi command. Only efi_selftest-related code will be left in bootefi.c. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2023-12-17cmd: bootefi: localize global device paths for efi_selftestAKASHI Takahiro
Device paths allocated in bootefi_test_prepare() will be immediately consumed by do_efi_selftest() and there is no need to keep them for later use. Introduce test-specific varialbles to make it easier to move other bootmgr functions into library directory in the next commit. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2023-12-17cmd: bootefi: carve out binary execution interfaceAKASHI Takahiro
Carve binary execution code out of do_bootefi_image() in order to move binary-execution specific code into library directory in the later commit. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2023-12-17cmd: bootefi: carve out EFI boot manager interfaceAKASHI Takahiro
Carve EFI boot manager related code out of do_bootefi_image() in order to move boot manager specific code into library directory in the later commit. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2023-12-17cmd: bootefi: re-organize do_bootefi()AKASHI Takahiro
Replicate some code and re-organize do_bootefi() into three cases, which will be carved out as independent functions in the next two commits. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2023-12-17cmd: bootefi: unfold do_bootefi_image()AKASHI Takahiro
Unfold do_bootefi_image() into do_bootefi() in order to make it easier to re-organize do_bootefi() in the next commit. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2023-12-15cmd: clk: Make soc_clk_dump staticIgor Prusov
After introducing dump to clk_ops there is no need to override or expose this symbol anymore. Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Tested-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Sean Anderson <seanga2@gmail.com> Signed-off-by: Igor Prusov <ivprusov@sberdevices.ru> Link: https://lore.kernel.org/r/20231109105516.24892-9-ivprusov@sberdevices.ru
2023-12-15cmd: clk: Use dump function from clk_opsIgor Prusov
Add another loop to dump additional info from clock providers that implement dump operation. Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Tested-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Sean Anderson <seanga2@gmail.com> Signed-off-by: Igor Prusov <ivprusov@sberdevices.ru> Link: https://lore.kernel.org/r/20231109105516.24892-7-ivprusov@sberdevices.ru
2023-12-13cmd: check argc for acpi dumpHeinrich Schuchardt
'acpi dump' without parameter results in a NULL dereference. Check the number of arguments. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-12-13cmd: acpi: fix acpi list commandHeinrich Schuchardt
ACPI tables may comprise either RSDT, XSDT, or both. The current code fails to check the presence of the RSDT table before accessing it. This leads to an exception if the RSDT table is not provided. The XSDT table takes precedence over the RSDT table. The return values of list_rsdt() and list_rsdp() are always zero and not checked. Remove the return values. Addresses in the XSDT table are 64-bit. Adjust the output accordingly. As the RSDT table has to be ignored if the XSDT command is present there is no need to compare the tables in a display command. Anyway the specification does not require that the sequence of addresses in the RSDT and XSDT table are the same. The FACS table header does not provide revision information. Correct the description of dump_hdr(). Adjust the ACPI test to match the changed output format of the 'acpi list' command. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>