summaryrefslogtreecommitdiffstats
path: root/commands
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/percent_pe' into masterSascha Hauer2020-10-144-9/+7
|\
| * treewide: replace strerror(-PTR_ERR(errno)) with %pe format specifierAhmad Fatoum2020-09-293-7/+5
| | | | | | | | | | | | | | | | | | Using %pe instead of PTR_ERR has the benefit of being less verbose and less error-prone (no negation necessary) while potentially reducing code size. Make use of it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * vsprintf: retire strerrorp in favor of %peAhmad Fatoum2020-09-291-2/+2
| | | | | | | | | | | | | | | | | | strerrorp() is only used along with printf. We now have a format specifier for printing error pointers directly, so use that and remove strerrorp. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc' into masterSascha Hauer2020-10-141-2/+2
|\ \
| * | commands: boot_order: note that it's OMAP specific in help textAhmad Fatoum2020-10-051-2/+2
| |/ | | | | | | | | | | | | | | Kconfig and online documentation don't indicate that it's OMAP specific. Fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / commands: uimage: fix indeterminate exit code of commandAhmad Fatoum2020-10-021-2/+2
|/ | | | | | | | | Depending on passed options, uimage may never assign ret a value. Fix this by returning COMMAND_SUCCESS by default. Reported-by: clang-analyzer-10 Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net' into masterSascha Hauer2020-09-252-1/+9
|\
| * fastboot: rename usbgadget.fastboot_* variables to fastboot.*Daniel Glöckner2020-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | There is nothing USB-specific in the defined usbgadget.fastboot_* variables. Rename them to be usable also for the UDP fastboot transport. The usbgadget.fastboot_function variable is used to define the files and devices accessible with the erase and flash commands. Since "function" is a term from the USB specification and the Fastboot specification uses the term "partition", we rename that variable to "fastboot.partitions". Signed-off-by: Daniel Glöckner <dg@emlix.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * Introduce slicesSascha Hauer2020-08-131-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | slices, the barebox idea of locking barebox has pollers which execute code in the background whenever one of the delay functions (udelay, mdelay, ...) or is_timeout() are called. This introduces resource problems when some device triggers a poller by calling a delay function and then the poller code calls into the same device again. As an example consider a I2C GPIO expander which drives a LED which shall be used as a heartbeat LED: poller -> LED on/off -> GPIO high/low -> I2C transfer The I2C controller has a timeout loop using is_timeout() and thus can trigger a poller run. With this the following can happen during an unrelated I2C transfer: I2C transfer -> is_timeout() -> poller -> LED on/off -> GPIO high/low -> I2C transfer We end up with issuing an I2C transfer during another I2C transfer and things go downhill. Due to the lack of interrupts we can't do real locking in barebox. We use a mechanism called slices instead. A slice describes a resource to which other slices can be attached. Whenever a slice is needed it must be acquired. Acquiring a slice never fails, it just increases the acquired counter of the slice and its dependent slices. when a slice shall be used inside a poller it must first be tested if the slice is already in use. If it is, we can't do the operation on the slice now and must return and hope that we have more luck in the next poller call. slices can be attached other slices as dependencies. In the example above LED driver would add a dependency to the GPIO controller and the GPIO driver would add a dependency to the I2C bus: GPIO driver probe: slice_add(&gpio->slice, i2c_device_slice(i2cdev)); LED driver probe: slice_add(&led->slice, gpio_slice(gpio)); The GPIO code would call slice_acquire(&gpio->slice) before doing any operation on the GPIO chip providing this GPIO, likewise the I2C core would call slice_acquire(&i2cbus->slice) before doing an operation on this I2C bus. The heartbeat poller code would call slice_acquired(led_slice(led)) and only continue when the slice is not acquired. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mmc' into masterSascha Hauer2020-09-251-9/+16
|\ \
| * | commands: mmc_extcsd: print_field: fix layoutJuergen Borleis2020-09-141-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | commands: mmc_extcsd: print_field: fix 32 bit overflowJuergen Borleis2020-09-141-8/+15
| |/ | | | | | | | | Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk_dump command: Allow printing a single clockSascha Hauer2020-09-231-2/+13
| | | | | | | | | | | | | | | | So far the clk_dump command can only print all clocks. With this patch we can limit the output to ancestors and children of a given clock. This makes it easier to find the desired information in big clock trees. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: setenv: allow use with hush shellAhmad Fatoum2020-09-183-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | setenv was so far restricted to the simple shell, because with hush, users could just do dev.var=VAL for setting variables in the environment. The hush syntax doesn't allow for setting all kinds of environment variables though, e.g. 5c00a000.tamp@5c00a000:reboot-mode.of.param can't be set with hush, because of the special characters. It could still be read by using the ${variable} syntax though. Allow setting these variables by making the setenv command generally available. The default is chosen to be 'y', because the command is deemed small and useful enough to have it there by default. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: setenv: support setenv dev.var=VAL syntaxAhmad Fatoum2020-09-181-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | In preparation for making setenv selectable under CONFIG_SHELL_HUSH, allow a `setenv dev.var=VAL syntax`: - makes command use less surprising for hush users - allows seamless integration with current device parameter complete While at it, propagate setenv's return code to the calling shell. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: reset: allow specifying reset by nameAhmad Fatoum2020-09-151-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far, we were fine by using the highest priority restart handler whenever more than one was available. There are reasons to want to configure this however: - When communicating with BootROM, e.g. to force boot from recovery mode: The reset chosen must not cause the reboot mode stored to volatile memory to vanish - When testing (undocumented) reset behavior, e.g. to analyze how the EFI reset behaves Extend the reset command to support this. When no extra command line option is supplied, the old behavior is maintained. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | boot: ignore all spaces between boot targetsAhmad Fatoum2020-09-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Boot targets are split by space. strsep unlike strtok(_r) returns an empty string for each pair of consecutive delimiters. Ignore this case. Note that this changes behavior: previously both boot '' global.boot.default= boot were identical to boot /env/boot With this change, this is no longer the case. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ls: align file size correctly on non-ARM 64-bit platformsAhmad Fatoum2020-09-151-1/+1
| | | | | | | | | | | | | | | | CONFIG_CPU_64 is ARM-specific. Use the generic CONFIG_64BIT instead for aligning the file size. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ls: don't print . and .. on recursive lsAhmad Fatoum2020-09-141-5/+6
|/ | | | | | | | They are already omitted on normal ls and they don't really add a new information, so drop them for the recursive case as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: dhrystone: remove unneeded and out-of-place <stdbool.h>Ahmad Fatoum2020-07-141-1/+0
| | | | | | | | | Our bool definitions come out of <linux/types.h>. <stdbool.h> shouldn't be used for normal barebox code. We already include <linux/types.h> by means of <common.h> above. So drop the <stdbool.h> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devinfo: print device parent along with device infoAhmad Fatoum2020-06-231-0/+3
| | | | | | | | | | | | Especially for "virtual" devices (e.g. wdog0 or mmc2), it is often useful to know the corresponding hardware device. Instead of always having to search through plain devinfo, just include this information in the output when running `devinfo device`. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/sandbox-compile-test'Sascha Hauer2020-06-112-7/+2
|\
| * commands: test: drop dead assignmentAhmad Fatoum2020-06-031-1/+0
| | | | | | | | | | | | | | | | last_expr is set to a different value few lines later. Drop the dead assignment. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * commands: tftp: drop unused variableAhmad Fatoum2020-06-031-6/+2
| | | | | | | | | | | | | | The flags variables is not used. Drop it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | poller: Add a poller commandSascha Hauer2020-05-201-0/+9
|/ | | | | | | The poller command allows to print which pollers are registered and also how many times we can run the registered pollers in one second. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2020-05-14115-1809/+365
|\
| * commands/*: Replace license and copyright boilerplate by SPDX identfiersUwe Kleine-König2020-04-27115-1809/+365
| | | | | | | | | | | | | | | | | | | | | | | | | | While at it also drop references to the non-existing CREDITS file and do some small rearrangements for some uniform formatting. (SPDX-License-Identifier first, then copyright texts and then an empty line.) The advantage is that these specifiers are machine-parseable which helps license conformance. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: remove left-over CMD_AT91MUX Kconfig optionAhmad Fatoum2020-04-291-16/+0
| | | | | | | | | | | | | | | | | | 71ff9bfebd ("pinctrl: at91: add pinctrl driver") removed the implementation of the command, but left the now useless config option. Remove it. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: fix misindented help textAhmad Fatoum2020-04-291-1/+1
|/ | | | | | | | Kconfiglib used by scripts/kconfig-lint.py chokes on this misindentation. Fix it Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net'Sascha Hauer2020-04-161-2/+2
|\
| * miitool: Use mdiobus_read()Sascha Hauer2020-03-311-2/+2
| | | | | | | | | | | | | | We have mdiobus_read(), so use it rather than accessing the read hook directly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2020-04-161-7/+4
|\ \
| * | commands: of_property: fix crashes on incorrect number of argumentsAhmad Fatoum2020-03-311-7/+4
| |/ | | | | | | | | | | | | | | | | | | | | of_property needs at least two parameters, the path and the property name. If we supply less, we risk crashes, e.g. by running of_property -fs /test Verify we got at least two parameters. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / commands: remove CONFIG_ prefix from Kconfig symbolAhmad Fatoum2020-04-141-1/+1
|/ | | | | | | | Kconfig symbols, unlike their preprocessor counterparts, don't have this prefix. Drop it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: boot: fixup create boot entries on demandAhmad Fatoum2020-02-191-1/+1
| | | | | | | | Don't try other boot entries if one succeeds. This is the behavior before the change, thus reinstate it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2020-02-183-31/+91
|\
| * i2c_probe command: Use kstrtointSascha Hauer2020-02-141-5/+25
| | | | | | | | | | | | | | Use kstrtoint rather than simple_strtoul to catch erroneous input like "i2c1" which previously was silently interpreted as "0". Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * commands: boot: create boot entries on demandAhmad Fatoum2020-02-141-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently create all boot entries before attempting boot. This is less than optimal, because this may involve probing devices that won't be used for actual boot. Fix this by not creating boot entries till the previous boot argument (command line argument or boot.default word) was found to be unbootable. This means that "boot mmc1 mmc0" will now not touch mmc0 if mmc1 had a bootable entry. This is only done when no menu or list was requested. As the boot entries are in a linked list, the allocation done for each boot argument could be omitted, but as the saving from skipping an allocation is easily dwarfed by the boot medium access, we just reallocate and enjoy the improved code clarity. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * commands: boot: refactor boot entry creation to use iteratorsAhmad Fatoum2020-02-141-16/+28
| | | | | | | | | | | | | | | | | | | | | | | | We currently create all boot entries before attempting boot. This is less than optimal, because this may involve probing devices that won't be used for actual boot. In preparation for changing this, refactor the code, so we only have one loop we need to touch. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * commands/test: Implement -b and -c to test for character and block devicesUwe Kleine-König2020-02-101-0/+14
| | | | | | | | | | | | | | These match the same options on coreutil's test(1). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * commands/test: Improve option parsing to handle "]" less specialUwe Kleine-König2020-02-101-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | Testing for *ap[1] != ']' is bogus during option processing. Instead test if there are options left to be processed. This fixes the return value for e.g. test -z ']lala' Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * commands/test: Bail out on incomplete command line optionsUwe Kleine-König2020-02-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes test emit an error (and fail) on e.g. test -f and also on unimplemented options like test -c /dev/null . Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | imd: add support for checksum generation/verificationSteffen Trumtrar2020-02-101-0/+2
|/ | | | | | | | | | Add a new imd type "checksum". This type consists of the CRC32 checksum of the whole barebox image minus the checksum itself. The checksum can be written to the imd field with the bareboximd host-tool. It can be verified with said tool or with "imd" on the target. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: led: print actual error code when led_set failsAhmad Fatoum2019-12-131-2/+2
| | | | | | | | If led_set fails, the error code is the return value, not errno. Fix this. While at replace the magic value in the command return code. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: miitool: handle powerdown-flagHubert Feurstein2019-12-131-1/+6
| | | | | Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Allow usage of default environment without environment file storageAlbert Schwarzkopf2019-12-111-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the default environment is only used when the barebox environment on the persistent store is not valid or when ENVFS_FLAGS_FORCE_BUILT_IN is set in the super block. However, ENVFS_FLAGS_FORCE_BUILT_IN can be cleared and the environmnet variables in the persistent store will be used again. This may not be desirable. This patch allows building CONFIG_DEFAULT_ENVIRONMENT independent of CONFIG_ENV_HANDLING. This can be useful if you never want to load or write values from the persistent store and you only need to read environment variables from your default environment. If CONFIG_ENV_HANDLING is not set, a message will be printed to the user indicating that changes to non-volatile variables won't be persisted. Move envfs functions that are needed when CONFIG_DEFAULT_ENVIRONMENT and/or CONFIG_ENV_HANDLING is set to a new file common/envfs-core.c. Signed-off-by: Albert Schwarzkopf <a.schwarzkopf@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: digest: don't be to restrictive with the length of verification filesHubert Feurstein2019-12-111-1/+1
| | | | | | | | Otherwise it is not possible to verify against a file created by shaXsum from linux. Usually there is the filename appended after the hash. Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/randfixes'Sascha Hauer2019-12-101-1/+1
|\
| * commands: keystore: use correct type for s_lenLucas Stach2019-12-021-1/+1
| | | | | | | | | | | | | | | | Fixes the follwing warning: "passing argument 2 of 'read_file_2' from incompatible pointer type". Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/gpio'Sascha Hauer2019-12-101-1/+3
|\ \