summaryrefslogtreecommitdiffstats
path: root/commands
Commit message (Collapse)AuthorAgeFilesLines
* 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
|\ \
| * | gpio: Introduce GPIO namesSascha Hauer2019-11-271-1/+3
| |/ | | | | | | | | | | | | | | | | | | | | This introduces GPIO names. So far we only have labels which are given by the requester. In contrast names are given by the provider and do not change depending on whoever requests a GPIO. The gpio commands now also accept to reference a GPIO by name. The printing of the gpioinfo command is adjusted to nicely print both the label and the name. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: smc: make command usable when ARM_PSCI is undefinedAhmad Fatoum2019-11-192-1/+6
| | | | | | | | | | | | | | | | | | The smc command can be useful whenever PSCI is used, regardless of whether barebox provides the secure monitor or not. Have it depend on ARM_SMCCC instead. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: smc: verify PSCI_POWER_ON with interprocessor handshakeAhmad Fatoum2019-11-191-6/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | The use of psci_printf here, at least for the phytec-phycore-imx7, is racy, because access to the UART is not synchronized. This may lead to characters being swallowed and most certainly to garbled text. One way around this would be using separate UART ports for each core or even more generically, just dropping psci_printf and resorting to inter-core communication over shared-memory to check whether code execution succeeded. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: psci: make locally-used function staticAhmad Fatoum2019-11-191-1/+1
| | | | | | | | | | | | | | | | Fixes a warning that the function is global, but without prototype. No functional change. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: psci: properly wire in command helpAhmad Fatoum2019-11-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | This was supposed to happen in 9efa1f8b ("ARM: psci: wire in smc command help") along with some other changes. After rebases, the other changes remained but this one was lost.. Do this right this time and specify the appropriate BAREBOX_CMD_HELP. Fixes: 9efa1f8b ("ARM: psci: wire in smc command help") Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: psci: factor out smc command into commands/Ahmad Fatoum2019-11-193-0/+123
|/ | | | | | | | | | | So far, the smc command was only usable when barebox also provides the secure monitor. It's useful to have it when barebox is a PSCI consumer as well to test whether the secure monitor works. Factor out the code into commands/ in preparation to do so. No functional change. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/watchdog'Sascha Hauer2019-11-071-7/+27
|\
| * commands: wd: support configuring watchdog by nameAhmad Fatoum2019-10-291-7/+27
| | | | | | | | | | | | | | | | | | | | | | So far, wd has always configured the highest-priority watchdog when multiple are available. Add an optional -d parameter to support configuring the other watchdogs as well. The name passed can be either the watchdog device name (e.g. wdog0) or the hardware device name (e.g. efi-wdt). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * watchdog: export API to configure watchdogs by nameAhmad Fatoum2019-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | So far watchdog users could only configure the watchdog with the highest priority. In preparation for having the wd command configure a watchdog by name, extend watchdog_set_timeout with a struct watchdog *parameter and export functions to query default watchdog and to find watchdog by name. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: passwd: suggest sandbox for offline password generationAhmad Fatoum2019-10-231-2/+4
| | | | | | | | | | | | | | | | | | | | | | Users might want to generate the password while the target is offline. We don't provide a dedicated host tool for that, but barebox sandbox can be used. Document this possibility. While at it, remove a misplaced single quite and slash in the help text. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | edit: add vi alias with vi-style bindingsAhmad Fatoum2019-10-181-8/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The edit command already supports a few key bindings for code navigation. To improve user experience for vi-impaired users, add a vi alias that maps traditional vi key bindings to the barebox edit ones. This is done by adding a mode-aware read_modal_key that maps vi normal-mode keys to barebox edit. For operations that requires more than one barebox edit key, a backlog of two characters is additionally used. In interest of code size reduction, a command mode (and the associated readline overhead) are not implemented, the effect of the most common commands :q and :wq commands can be realized with vim-like ZQ and ZZ bindings instead. This increases the size of my LZO-compressed THUMB2 barebox by 843 bytes. Acked-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | edit: replace %c for literal with literal directlyAhmad Fatoum2019-10-181-9/+9
| | | | | | | | | | | | | | | | | | There's no need to use %c for ESC, when we can use the appropriate escape sequence directly. Do this and shave off 60~ bytes on my compressed THUMB-2 barebox. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | cp: complete command helpRobert Karszniewicz2019-10-181-1/+2
|/ | | | | Signed-off-by: Robert Karszniewicz <r.karszniewicz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/of-overlay'Sascha Hauer2019-10-173-0/+102
|\
| * commands: add of_overlay command for device tree overlaysMichael Tretter2019-09-163-0/+102
| | | | | | | | | | | | | | | | | | Add a new command "of_overlay" for applying device tree overlays, because it does not really fit into any other device tree related command and would create a mess with the command options. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/of'Sascha Hauer2019-10-173-0/+116
|\ \
| * | add of_diff commandSascha Hauer2019-09-123-0/+116
| |/ | | | | | | | | | | | | | | | | | | The of_diff command compares two device trees against each other and prints a diff-like result. This can be handy to find out the differences between the barebox live tree and the one we start the kernel with. Another usecase would be to examine the changes our of_fixup process introduces (of_diff - +) Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mmc'Sascha Hauer2019-10-174-3/+211
|\ \
| * | mci: implement command to switch a mmc device to enhanced modeUwe Kleine-König2019-09-123-0/+208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The command structure allows adding more subcommands and is designed to match the Linux program mmc from the mmc-utils. So later more commands can easily be added if need be. Compared to mmc-utils' mmc enh_area set <-y|-n|-c> <start KiB> <length KiB> <device> the command that is implemented here ( mmc enh_area [-c] <device> ) is easier to use (because you don't have to check the maximal allowed size by reading some registers and calculate the available size from them (which then must be calculated back to register values by the mmc command)) but less flexible as it doesn't allow all the crazy possibilities specified in the eMMC standard (yet?) but just creates an enhanced area with maximal size. In the future something like mmc enh_area -s 30k <device> could be used to not use the maximal but an explicit size. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>