summaryrefslogtreecommitdiffstats
path: root/commands
Commit message (Collapse)AuthorAgeFilesLines
* sandbox: retire CONFIG_LINUX symbol in favor of CONFIG_SANDBOXAhmad Fatoum2020-11-271-1/+1
| | | | | | | | | | | | | 5211e428cbab ("image: Convert the IH_... values to enums") removed the IH_ARCH_LINUX enumeration value leading to breakage of sandbox configurations that enable bootm. Instead of reinstating IH_ARCH_LINUX, just use IH_ARCH_SANDBOX and remove mention of CONFIG_LINUX altogether, it's always true anyway when CONFIG_SANDBOX is true. Fixes: 5211e428cbab ("image: Convert the IH_... values to enums") Cc: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd-nand'Sascha Hauer2020-11-102-2/+26
|\
| * nand command: Allow offsets with [kM] suffixesSascha Hauer2020-11-101-1/+1
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * nand command: Print OOB informationSascha Hauer2020-11-101-0/+5
| | | | | | | | | | | | | | | | NAND mtd devices carry information how the OOB area is used. So far there is no way to visualize it, so print it along with other NAND informations. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: Update to Linux-5.9Sascha Hauer2020-11-101-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This updates the barebox NAND layer and parts of the mtd layer to Linux-5.9. This patch is huge, but the barebox NAND layer is so far away from the Linux NAND layer that a step by step update would have taken ages. Unlike Linux barebox has functions to mark a block as good. This feature has been preserved. Also barebox used to make NAND write support optional, this feature is lost during the update for the sake of better compatibility to the Linux NAND layer. This patch has been tested: - GPMI aka nand_mxs on i.MX6 - nand_imx on i.MX25 - nand_omap_gpmc on AM335x - atmel_nand on Atmel sama5d3 - nand_denali on SoCFPGA Currently untested: - nand_orion - nand_mrvl_nfc - nand_s3c24xx The nand_denali driver is tested with the update of that driver to Linux-5.9 following in the next patch. I could only test the drivers with the NAND chips found on my boards, so there's still enough room for regressions, especially given that the NAND drivers themselves are mostly not updated. With the NAND layer being up-to-date with Linux it should hopefully be easy to update drivers to their Linux counterpart as well if necessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c_probe: Use "read_byte" command for probingAlexander Shiyan2020-11-091-2/+4
| | | | | | | | | | | | | | | | Some I2C adapters do not allow zero length data transfers, such as the AM335X. To use the i2c_probe command, let's use byte reading for this purpose. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: import memtester 4.3.0 from Debian GNU/LinuxPeter Mamonov2020-11-029-0/+906
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Memtester is an utility for testing the memory subsystem for faults. For hardware developers, memtester can be told to test memory starting at a particular physical address. This port is based on the sources from Debian GNU/Linux. Debian package meta data is as follows: Package: memtester Version: 4.3.0-5 Homepage: http://pyropus.ca/software/memtester/ APT-Sources: http://ftp.ru.debian.org/debian testing/main amd64 Packages Dissected version of this patch can be found at https://github.com/pmamonov/barebox/commits/memtester Changes since v2: 6fe3d86f9b add prefix to global variables names 81441f8ff8 drop `volatile` for buf/aligned pointers 336d1ddf5f close memfd if mmap() failed 4b52d3990d define rand32() as random32() 9fa593f130 tests: make global vars static ce00f1aadb fix error handling when parsing arguments 5107cc4b19 don't flush the console Changes since v1: 1acbafe7a2 init global vars on start 7664692fd4 use proper return value a10eba5b49 use strtoull_suffix() to parse memory size 001b623c16 add option to set TESTMASK 3acfe07d56 make tests[] static 528360ebd7 fix license Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: bootchooser: migrate menu entry to boot menuAhmad Fatoum2020-10-211-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | While the bootchooser command is not required for boot with bootchooser, it's still boot related and is more likely to be looked for in the boot menu than the misc menu. The boot menu has other commands like uimage which do not boot either, but are boot-related. While at it, add some Kconfig help text. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | 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>