summaryrefslogtreecommitdiff
path: root/cmd
AgeCommit message (Collapse)AuthorFilesLines
2021-12-27sandbox: Enable support for the gzip commandSimon Glass1-1/+3
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: Simon Glass <sjg@chromium.org>
2021-12-23fdt: Report the devicetree sourceSimon Glass1-0/+2
It can be confusing to figure out where the devicetree came from. It seems important enough to warrant a message during boot. Add information about the number of devices and uclasses too since it is helpful to have some idea what is going on with driver model. Report the devicetree source in bdinfo too. This looks something like this, with > marking the new line. U-Boot 2021.10-00190 (Oct 30 2021 - 09:01:29 -0600) DRAM: 128 MiB > Core: 42 devices, 11 uclasses, devicetree: passage Flash: 64 MiB Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-21Merge tag 'v2022.01-rc4' into nextTom Rini1-1/+2
Prepare v2022.01-rc4
2021-12-05sandbox: Drop CONFIG_HOST_MAX_DEVICESSimon Glass1-1/+1
This can go in the related header file. Drop the CONFIG option. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-12-05trace: sandbox: Use only the Kconfig optionsSimon Glass1-0/+2
At present there are Kconfig options for tracing, but sandbox uses plain #defines to set them. Correct this and make the tracing command default to enabled so that this is not needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-30tpm: use more algorithms than sha256 on pcr_readRuchika Gupta1-1/+2
The current tpm2_pcr_read is hardcoded using SHA256. Make the actual command to TPM configurable to use wider range of algorithms. The current command line is kept as is i.e limited to SHA-256 only. Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2021-11-29Merge tag 'v2022.01-rc3' into nextTom Rini1-6/+11
Prepare v2022.01-rc3 Signed-off-by: Tom Rini <trini@konsulko.com>
2021-11-29mbr: Correct verification checkSimon Glass1-4/+4
At present this command considers the partitions to be identical if the start and size are smaller than expected. It should check that they are the same. Fix this and tidy up the code style a little. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2021-11-29sf: Tidy up code to avoid #ifdefSimon Glass1-17/+13
Update this code to use IS_ENABLED() instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Pratyush Yadav <p.yadav@ti.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2021-11-29sf: Use const for the stage nameSimon Glass1-1/+1
This is not updated at runtime so should be marked const. Update the code accordingly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-11-17cmd: tpm-v1: fix load_key_by_sha1 compile errorsMathew McBride1-5/+5
This command is not compiled by default and has not been updated alongside changes to the tpmv1 API, such as passing the TPM udevice to the relevant functions. Signed-off-by: Mathew McBride <matt@traverse.com.au> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2021-11-17cmd: tpm-v1: fix compile error in TPMv1 list resources commandMathew McBride1-1/+6
This command is not compiled by default and was not updated to pass the udevice to tpm_get_capability. Signed-off-by: Mathew McBride <matt@traverse.com.au> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2021-11-16bootm: Tidy up use of autostart env varSimon Glass2-5/+2
This has different semantics in different places. Go with the bootm method and put it in a common function so that the behaviour is consistent in U-Boot. Update the docs. To be clear, this changes the way that 'bootelf' and standalone boot work. Before, if autostart was set to "fred" or "YES", for example, they would consider that a "yes". This may change behaviour for some boards, but the only in-tree boards which mention autostart use "no" to disable it, which will still work. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Wolfgang Denk <wd@denx.de>
2021-11-12pxe: Allow calling the pxe_get logic directlySimon Glass1-33/+59
Refactor this code so that we can call the 'pxe get' command without going through the command-line interpreter. This makes it easier to get the information we need, without going through environment variables. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-11-12pxe: Refactor sysboot to have one helperSimon Glass1-58/+36
The only difference between the three helpers is the filesystem type. Factor this out and call the filesystem functions directly, instead of through the command-line interpreter. This allows the file size to be obtained directly, instead of via an environment variable. We cannot do the same thing with PXE's tftpboot since there is no API at present to obtain information about the file that was read. So there is no point in changing pxe_getfile_func to use a ulong for the address, for example. This is as far as the refactoring can go for the present. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-11-12pxe: Return the file size from the getfile() functionSimon Glass2-4/+24
It is pretty strange that the pxe code uses the 'filesize' environment variable find the size of a file it has just read. Partly this is because it uses the command-line interpreter to parse its request to load the file. As a first step towards unwinding this, return it directly from the getfile() function. This makes the code a bit longer, for now, but will be cleaned up in future patches. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-11-12pxe: Clean up the use of bootfileSimon Glass2-8/+25
The 'bootfile' environment variable is read in the bowels of pxe_util to provide a directory to which all loaded files are relative. This is not obvious from the API to PXE and it is strange to make the caller set an environment variable rather than pass this as a parameter. The code is also convoluted, which this feature implemented by get_bootfile_path(). Update the API to improve this. Unfortunately this means that pxe_setup_ctx() can fail, so add error checking. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-11-12pxe: Move common parsing coding into pxe_utilSimon Glass2-25/+8
Both the syslinux and pxe commands use essentially the same code to parse and run extlinux.conf files. Move this into a common function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-11-12pxe: Move pxe_utils filesSimon Glass4-1668/+3
Move the header file into the main include/ directory so we can use it from the bootmethod code. Move the C file into boot/ since it relates to booting. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-11-12pxe: Tidy up the is_pxe globalSimon Glass4-16/+15
Move this into the context to avoid a global variable. Also rename it since the current name does not explain what it actually affects. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-11-12pxe: Add a userdata field to the contextSimon Glass4-5/+10
Allow the caller to provide some info which is passed back to the readfile() method. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-11-12pxe: Move do_getfile() into the contextSimon Glass4-24/+35
Rather than having a global variable, pass the function as part of the context. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-11-12pxe: Use a context pointerSimon Glass4-62/+97
At present the PXE functions pass around a pointer to command-table entry which is very strange. It is only needed in a few places and it is odd to pass around a data structure from another module in this way. For bootmethod we will need to provide some context information when reading files. Create a PXE context struct to hold the command-table-entry pointer and pass that around instead. We can then add more things to the context as needed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-11-12pxe: Move API comments to the header filesSimon Glass2-48/+74
Put the function comments in the header file so that the full API can we examined in one place. Expand the comments to cover parameters and return values. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-11-08cmd: sbi: show SBI implementation versionHeinrich Schuchardt1-8/+18
Let the sbi command show the SBI implementation version Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com> Reviewed-by: Rick Chen <rick@andestech.com>
2021-11-01pxe_utils: Clean up {bootm,zboot}_argv generationZhaofeng Li1-18/+27
Signed-off-by: Zhaofeng Li <hello@zhaofeng.li> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-11-01pxe_utils: Fix arguments to x86 zbootZhaofeng Li1-1/+11
bootm and zboot accept different arguments: > bootm [addr [arg ...]] > - boot application image stored in memory > passing arguments 'arg ...'; when booting a Linux kernel, > 'arg' can be the address of an initrd image > zboot [addr] [size] [initrd addr] [initrd size] [setup] [cmdline] > addr - The optional starting address of the bzimage. > If not set it defaults to the environment > variable "fileaddr". > size - The optional size of the bzimage. Defaults to > zero. > initrd addr - The address of the initrd image to use, if any. > initrd size - The size of the initrd image to use, if any. In the zboot flow, the current code will reuse the bootm args and attempt to pass the initrd arg (argv[2]) as the kernel size (should be argv[3]). zboot also expects the initrd address and size to be separate arguments. Let's untangle them and have separate argv/argc locals. Signed-off-by: Zhaofeng Li <hello@zhaofeng.li> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-30cmd: usb_mass_storage: Use part_get_info_by_dev_and_name_or_numSean Anderson1-2/+2
This allows specifying partitions using more extended syntax. This is particularly useful to access eMMC hardware partitions. For example, this allows something like ums 0 mmc 0.0,0.1,0.2,0.3 to expose four LUNs for each of the four default eMMC hardware partitions. Note that the comma syntax was already present, and this syntax is already documented. Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2021-10-29cmd: mmc: check whether card is SD or eMMC before hwpartitionJaehoon Chung1-0/+5
It doesn't need to follow more sequence to do the hwparititioning, because SD doesn't support hwpartitioning feature. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2021-10-29cmd: mmc: Support mmc hwpartition user enh start -Marek Vasut1-4/+29
Add option to extend the hardware partition to the maximum size by using the '-' dash sign instead of $cnt parameter. This is useful in case we want to switch the entire eMMC user area into pSLC mode, especially in case the device may be populated with different size eMMCs. With this change, we do not have to calculate the number of blocks of the user area manually. To switch the pSLC mode for user area, use e.g. the following. WARNING: This is a one-time irreversible change. => mmc hwpartition user enh 0 - wrrel on complete Signed-off-by: Marek Vasut <marex@denx.de> Cc: Fabio Estevam <festevam@gmail.com> Cc: Jaehoon Chung <jh80.chung@samsung.com> Cc: Peng Fan <peng.fan@nxp.com> Cc: Stefano Babic <sbabic@denx.de> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2021-10-28arm: mvebu: Fix comments about kwbimage structuresPali Rohár1-1/+1
kwbimage v1 is used on more SoCs. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2021-10-28arm: mvebu: Update name of kwbimage v1 field at offset 0x2-0x3Pali Rohár1-1/+1
At this offset is stored nand page size. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2021-10-26cmd: nand biterr - Add support for nand biterr commandBalamanikandan Gunasundar1-3/+124
The command shall be used to induce bit errors in the nand page manually. The code flips a bit in the specified offset without changing the ECC. This helps to see how the software handles the error. The patch is ported from https://patchwork.ozlabs.org/project/uboot/patch/\ 1325691123-19565-1-git-send-email-holger.brunck@keymile.com The implementation is inspired from 'mtd-utils/nand-utils/nandflipbits.c' Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@microchip.com>
2021-10-25loads: Block writes into LMB reserved areas of U-BootMarek Vasut1-0/+12
The loads srec loading may overwrite piece of U-Boot accidentally. Prevent that by using LMB to detect whether upcoming write would overwrite piece of reserved U-Boot code, and if that is the case, abort the srec loading. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-23Merge https://source.denx.de/u-boot/custodians/u-boot-spiTom Rini1-7/+2
- Fix mtd erase with mtdpart (Marek Behún) - NXP fspi driver fixes (Kuldeep Singh)
2021-10-23mtd: Remove mtd_erase_callback() entirelyMarek Behún1-7/+2
The original purpose of mtd_erase_callback() in Linux at the time it was imported to U-Boot, was to inform the caller that erasing is done (since it was an asynchronous operation). All supplied callback methods in U-Boot do nothing, but the mtd_erase_callback() function was (until previous patch) grossly abused in U-Boot's mtdpart implementation for completely different purpose. Since we got rid of the abusement, remove the mtd_erase_callback() function and the .callback member from struct erase_info entirely, in order to avoid such problems in the future. Signed-off-by: Marek Behún <marek.behun@nic.cz>
2021-10-22Merge tag 'efi-2022-01-rc1' of ↵Tom Rini1-10/+3
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2022-01-rc1 Documentation: Use Sphinx 3.43. Move system reset documentation to HTML UEFI: Fix linking EFI apps with LLVM Fix alignment of loaded image Correct simple network protocol test Code cleanup
2021-10-21env: Move non-cli env functions to env/common.cMarek Behún1-175/+0
Move the following functions from cmd/nvedit.c to env/common.c: env_set_ulong() env_set_hex() env_get_hex() eth_env_get_enetaddr() eth_env_set_enetaddr() env_get() from_env() env_get_f() env_get_ulong() since these functions are not specific for U-Boot's CLI. We leave env_set() in cmd/nvedit.c, since it calls _do_env_set(), which is a static function in that file. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-21env: Simplify env_match() and inline into env_get_f()Marek Behún1-14/+5
In the past the env_match() function was used to match envs with - name, i.e. string "name" - variable assignment, i.e. string "name=other_value" The latter is not the case anymore, since the env_match() function is now used only in env_get_f(), and so we can simplify the function into a simple strncmp() with an additional comparison to '='. Let's do this, and since the resulting function is quite simple, let's also inline its code into env_get_f(). Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-21env: Use memcpy() instead of ad-hoc code to copy variable valueMarek Behún1-12/+6
Copy the value of the found variable into given buffer with memcpy() instead of ad-hoc code. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-21env: Make return value of env_get_f() behave like sprintf() on successMarek Behún1-3/+5
Currently the env_get_f() function's return value behaves weirdly: it returns the number of bytes written into `buf`, but whether this is excluding the terminating NULL-byte or including it depends on whether there was enough space in `buf`. Change the function to always return the actual length of the value of the environment variable (excluding the terminating NULL-byte) on success. This makes it behave like sprintf(). All users of this function in U-Boot are compatible with this change. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-21env: Early return from env_get_f() on NULL nameMarek Behún1-3/+3
Test non-NULL name immediately, not in env_match(). Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-21env: Don't match empty variable name in env_match()Marek Behún1-1/+1
Do we really allow zero-length variable name? I guess not. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-21env: Use better name for variable in env_get_f()Marek Behún1-4/+4
The `nxt` variable actually points to the terminating null-byte of the current env var, and the next env var is at `nxt + 1`, not `nxt`. So a better name for this variable is `end`. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-21env: Use string pointer instead of indexes in env_get_f()Marek Behún1-16/+16
Since we no longer use env_get_char() to access n-th character of linearized environment data, but rather access the arrays themselves, we can convert the iteration to use string pointers instead of position indexes. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-21env: Inline env_get_char() into its only userMarek Behún1-14/+14
This function is a relic from the past when environment was read from underlying device one character at a time. It is used only in the case when getting an environemnt variable prior relocation, and the function is simple enough to be inlined there. Since env_get_char() is being changed to simple access to an array, we can drop the failing cases and simplify the code (this could have been done before, since env_get_char() did not fail even before). Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-21env: Change env_match() to static and remove from headerMarek Behún1-15/+15
This function was used by other parts of U-Boot in the past when environment was read from underlying device one character at a time. This is not the case anymore. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-21cmd: tlv_eepromSven Auhagen1-0/+3
The function show_eeprom is missing int i if debug is enabled. Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de> Reviewed-by: Stefan Roese <sr@denx.de>
2021-10-21efi_loader: avoid multiple local copies of lf2_initrd_guidHeinrich Schuchardt1-2/+1
Create the GUID as a global variable. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2021-10-21efi_loader: efi_dp_from_lo() unused parameter sizeHeinrich Schuchardt1-2/+1
Parameter size is never used in function efi_dp_from_lo(). Remove it. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>