path: root/commands/of_property.c
Commit message (Collapse)AuthorAgeFilesLines
* commands/*: Replace license and copyright boilerplate by SPDX identfiersUwe Kleine-König2020-04-271-18/+4
| | | | | | | | | | | | | 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 <> Signed-off-by: Sascha Hauer <>
* 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 <> Signed-off-by: Sascha Hauer <>
* commands: of_property: copy value instead of resizingOleg.Karfich@wago.com2018-08-291-2/+1
| | | | | | | | | | | | | | Commit 748d1b8 adds the fixup feature to the above command. With this commit an unwanted free(data) on the freshly set property value is done if someone tries to set the value of an already present property (not the case for a new property). Furthermore in fixup mode the pointer fixup->data is freed when the fixup function is called more than once. This leads to a hanging system after calling of_dump -F many times. Fix this issues by copying the data to a new allocated memory area like a new property is created. Signed-off-by: Oleg Karfich <> Signed-off-by: Sascha Hauer <>
* commands/of_property: add option to apply changes as fixupBaeuerle, Florian2018-05-281-53/+138
| | | | | | | | | Add an -f option to the of_property command, which defers the device tree modification until boot time and thus applies the modification as a fixup on the linux device tree. Signed-off-by: Florian Bäuerle <> Signed-off-by: Sascha Hauer <>
* of: Allow for const propertiesSascha Hauer2018-01-311-0/+1
| | | | | | | | | | | | | | This adds support for const properties. We add a const void *value_const to struct property which will not be modified. The value of a property should no longer be used directly, but with the of_property_get_value() accessor which picks the right value. With this we can unflatten dtbs and use the property values directly from the dtb instead of copying them. This is useful for device trees which (ab)use properties to store huge data files, aka FIT images. To create a property whose value is not copied but used from the original input data we introduce of_new_property_const(). Signed-off-by: Sascha Hauer <>
* Fix spelling: pathes -> pathsWadim Egorov2015-01-281-1/+1
| | | | | Signed-off-by: Wadim Egorov <> Signed-off-by: Sascha Hauer <>
* complete: Add devicetree completionSascha Hauer2014-05-191-0/+2
| | | | | | | | The of_* commands take devicetree nodes as parameters. Add a devicetree completion function to ease passing nodes to these commands. Signed-off-by: Sascha Hauer <>
* commands: harmonize in-barebox documentationHolger Schurig2014-05-141-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does probably too much, but it's hard (and very cumbersome/time consuming) to break it out. What is does is this: * each command has one short description, e.g. "list MUX configuration" * made sure the short descriptions start lowercase * each command has one usage. That string contains just the options, e.g. "[-npn]". It's not part of the long help text. * that is, it doesn't say "[OPTIONS]" anymore, every usable option is listed by character in this (short) option string (the long description is in the long help text, as before) * help texts have been reworked, to make them - sometimes smaller - sometimes describe the options better - more often present themselves in a nicer format * all long help texts are now created with BUSYBOX_CMD_HELP_ macros, no more 'static const __maybe_unused char cmd_foobar_help[]' * made sure the long help texts starts uppercase * because cmdtp->name and cmdtp->opts together provide the new usage, all "Usage: foobar" texts have been removed from the long help texts * BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this is nicer in the source code * BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself * made sure no line gets longer than 77 characters * delibertely renamed cmdtp->usage, so that we can get compile-time errors (e.g. in out-of-tree modules that use register_command() * the 'help' command can now always emit the usage, even without compiled long help texts * 'help -v' gives a list of commands with their short description, this is similar like the old "help" command before my patchset * 'help -a' gives out help of all commands Signed-off-by: Holger Schurig <> Signed-off-by: Sascha Hauer <>
* commands: group 'help' outputHolger Schurig2014-05-141-0/+1
| | | | | | | | | | | | | | | | | | | The old output of "help" was just producing a long list, that usually scrolled of the screen (even on a X11 terminal). This list is more compact, and also sorted by groups. The old output format (plus grouping) is now available with 'help -v'. Example: Information commands: ?, devinfo, help, iomem, meminfo, version Boot commands: boot, bootm, go, loadb, loads, loadx, loady, saves, uimage ... Signed-off-by: Holger Schurig <> Signed-off-by: Sascha Hauer <>
* of_property command: allow to set phandlesSascha Hauer2013-08-141-2/+32
| | | | | | | | | With this properties with phandles can be created. A phandle is created when cells are parsed (in '<' '>') and a cell does not begin with a digit. The phandles can be specified either by alias or by full path. Signed-off-by: Sascha Hauer <>
* of_property command: allow to specify a node by aliasSascha Hauer2013-08-141-1/+1
| | | | | | | With this not only a full path can be used to specify a node, but also an alias. Signed-off-by: Sascha Hauer <>
* OF: base: sync of_find_node_by_path with linux OF APISebastian Hesselbarth2013-06-201-8/+2
| | | | | | | | | | | | | Barebox of_find_node_by_path requires a node to be passed as start node to start searching. Linux OF API does not pass this node and no current user of it in barebox is passing anything else than the root node. Therefore, we rename current function to of_find_node_by_path_from and introduce a Linux OF API compatible of_find_node_by_path that always passes the current root_node. Also, all current users of that function are updated to reflect the API change. Signed-off-by: Sebastian Hesselbarth <> Signed-off-by: Sascha Hauer <>
* OF: base: sync of_find_property with linux OF APISebastian Hesselbarth2013-06-201-1/+1
| | | | | | | | To start synchronizing OF API of barebox with linux OF API, this adds a length pointer to of_find_property. Also all current users of that function are updated to reflect the API change. Signed-off-by: Sebastian Hesselbarth <>
* of: property: fix error messageSteffen Trumtrar2013-04-261-2/+2
| | | | | | | At least in standard oxford english one not is enough. Signed-off-by: Steffen Trumtrar <> Signed-off-by: Sascha Hauer <>
* of: remove unused libfdtSascha Hauer2013-03-061-1/+0
| | | | | | | Now that we are completely independent of libfdt remove the unused code. Signed-off-by: Sascha Hauer <>
* of_property command: Fix crash with empty property valueSascha Hauer2013-03-061-2/+8
| | | | | | | | the of_property command crashes when an empty property value was given. This is because xrealloc is called with a length argument of 0. Fix this. Signed-off-by: Sascha Hauer <>
* of_* commands: print usage when insufficient arguments are givenSascha Hauer2013-03-061-0/+3
| | | | Signed-off-by: Sascha Hauer <>
* of: Add root node argument to of_find_node_by_pathSascha Hauer2013-03-061-2/+8
| | | | | | This makes of_find_node_by_path usable with multiple trees. Signed-off-by: Sascha Hauer <>
* commands: Add of_property commandSascha Hauer2013-01-191-0/+280
The of_property command allows to modify/add/delete properties. Parsing user input is based on U-Boot code with some fixes added for catching invalid input. Signed-off-by: Sascha Hauer <>