[libubootenv,RFC,4/4] docs: fw_env_config.md: document the FWU metadata format
Commit Message
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
docs/fw_env_config.md | 61 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
--
2.43.0
@@ -154,3 +154,64 @@ appvar:
offset : 0x10000
sectorsize : 0x10000
```
+
+FWU Metadata
+------------
+
+Depending on the key `format`, a namespace gives access to:
+
+- `uboot`: a U-Boot environment
+- `fwu-mdata`: the Arm FWU metadata, version 1 or 2
+
+`uboot` is the default, so `format` can be omitted and existing configurations
+keep working unchanged.
+
+The version of the FWU metadata is read from the metadata. Version 1 does not
+store its layout, which is given by two more keys:
+
+- `banks`: number of banks
+- `images`: number of images per bank
+
+With version 2 they are optional and checked against the metadata.
+
+The fields that select the bank to boot are exposed as variables, which cannot
+be created or deleted:
+
+| Variable | Description |
+|-------------------------|----------------------------------|
+| `active_index` | bank to boot |
+| `previous_active_index` | previously booted bank |
+| `bank<N>_state` | `accepted`, `valid` or `invalid` |
+
+When accessing the FWU metadata:
+
+- The other fields of the metadata are preserved.
+- Both copies are always written.
+- A list of variables from a file is rejected as a whole if one is invalid.
+- Use a separate `lockfile` to access several namespaces from the same process.
+
+Version 2:
+
+```yaml
+fwu:
+ format : fwu-mdata
+ size : 0x1000
+ lockfile : /run/fwu-mdata.lock
+ devices:
+ - path : /dev/disk/by-partlabel/metadata1
+ - path : /dev/disk/by-partlabel/metadata2
+```
+
+Version 1, with 2 banks of 3 images:
+
+```yaml
+fwu:
+ format : fwu-mdata
+ size : 0x1000
+ banks : 2
+ images : 3
+ lockfile : /run/fwu-mdata.lock
+ devices:
+ - path : /dev/disk/by-partlabel/metadata1
+ - path : /dev/disk/by-partlabel/metadata2
+```