diff options
author | Simon Glass <sjg@chromium.org> | 2021-10-22 06:08:50 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-11-16 22:35:08 +0300 |
commit | 40b9e0dd0505cc505bb31823c11aad59f5abdd43 (patch) | |
tree | 815e25fc8e1df7716dae955201d3ad285b4597d2 /doc/develop | |
parent | 5ba9e01a3e70985e5839d941b307b894c13d78dc (diff) | |
download | u-boot-40b9e0dd0505cc505bb31823c11aad59f5abdd43.tar.xz |
doc: Improve environment documentation further
Make various other updates suggested during review of the rST conversion.
Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'doc/develop')
-rw-r--r-- | doc/develop/environment.rst | 51 | ||||
-rw-r--r-- | doc/develop/index.rst | 1 |
2 files changed, 52 insertions, 0 deletions
diff --git a/doc/develop/environment.rst b/doc/develop/environment.rst new file mode 100644 index 0000000000..0b86fafbff --- /dev/null +++ b/doc/develop/environment.rst @@ -0,0 +1,51 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Environment implementation +========================== + +See :doc:`../usage/environment` for usage information. + +Callback functions for environment variables +-------------------------------------------- + +For some environment variables, the behavior of u-boot needs to change +when their values are changed. This functionality allows functions to +be associated with arbitrary variables. On creation, overwrite, or +deletion, the callback will provide the opportunity for some side +effect to happen or for the change to be rejected. + +The callbacks are named and associated with a function using the +U_BOOT_ENV_CALLBACK macro in your board or driver code. + +These callbacks are associated with variables in one of two ways. The +static list can be added to by defining CONFIG_ENV_CALLBACK_LIST_STATIC +in the board configuration to a string that defines a list of +associations. The list must be in the following format:: + + entry = variable_name[:callback_name] + list = entry[,list] + +If the callback name is not specified, then the callback is deleted. +Spaces are also allowed anywhere in the list. + +Callbacks can also be associated by defining the ".callbacks" variable +with the same list format above. Any association in ".callbacks" will +override any association in the static list. You can define +CONFIG_ENV_CALLBACK_LIST_DEFAULT to a list (string) to define the +".callbacks" environment variable in the default or embedded environment. + +If CONFIG_REGEX is defined, the variable_name above is evaluated as a +regular expression. This allows multiple variables to be connected to +the same callback without explicitly listing them all out. + +The signature of the callback functions is:: + + int callback(const char *name, const char *value, enum env_op op, int flags) + +* name - changed environment variable +* value - new value of the environment variable +* op - operation (create, overwrite, or delete) +* flags - attributes of the environment variable change, see flags H_* in + include/search.h + +The return value is 0 if the variable change is accepted and 1 otherwise. diff --git a/doc/develop/index.rst b/doc/develop/index.rst index b3871b16f3..9592d193fc 100644 --- a/doc/develop/index.rst +++ b/doc/develop/index.rst @@ -16,6 +16,7 @@ Implementation devicetree/index distro driver-model/index + environment global_data logging makefiles |