U-Boot environment variables layout

Schema identifier ($id): "http://devicetree.org/schemas/nvmem/layouts/u-boot,env.yaml#"

Schema dialect ($schema): "http://devicetree.org/meta-schemas/core.yaml#"

U-Boot uses environment variables to store device parameters and configuration. They may be used for booting process, setup or keeping end user info.

Data is stored using U-Boot specific formats (variant specific header and NUL separated key-value pairs).

Environment data can be stored on various storage entities, e.g.: 1. Raw flash partition 2. UBI volume

This binding allows marking storage device (as containing env data) and specifying used format.

Variables can be defined as NVMEM device subnodes.

Maintainers (maintainers): "Rafał Miłecki <rafal@milecki.pl>"

Properties and child nodes (properties) #

compatible — not listed as required here #

Exactly one of these rules must match (oneOf) #

Rule 1

A standalone env data block

Exact value (const): "u-boot,env"

Rule 2

Two redundant blocks with active one flagged

Exact value (const): "u-boot,env-redundant-bool"

Rule 3

Two redundant blocks with active having higher counter

Exact value (const): "u-boot,env-redundant-count"

Rule 4

Broadcom's variant with custom header

Exact value (const): "brcm,env"

reg — not listed as required here #

Partition offset and size for env on top of MTD

Maximum number of items (maxItems): 1

bootcmd — not listed as required here #

Value type (type): "object"

Command to use for automatic booting

env-size — not listed as required here #

Size in bytes of the environment data used by U-Boot for CRC calculation. If omitted, the full NVMEM region size is used.

Shared schema rule ($ref): /schemas/types.yaml#/definitions/uint32

ethaddr — not listed as required here #

Value type (type): "object"

Ethernet interfaces base MAC address.

Properties not matched by properties or patternProperties in this schema (additionalProperties) #

false

Not allowed by this rule.

Properties and child nodes (properties) #

#nvmem-cell-cells — not listed as required here

The first argument is a MAC address offset.

Exact value (const): 1

All of these rules must match (allOf) #

Rule 1 #

Condition (if) #

Properties and child nodes (properties)

$nodename — not listed as required here

This rule must not match (not)

Rule for matching array elements (contains)

String pattern (pattern): "^partition@[0-9a-f]+$"

When the condition matches (then) #

Properties and child nodes (properties)

reg — not listed as required here

false — Not permitted by this property rule.

Properties not matched by properties or patternProperties in this schema (additionalProperties) #

false

Not allowed by this rule.

Examples (examples) #

partitions {
    compatible = "fixed-partitions";
    #address-cells = <1>;
    #size-cells = <1>;

    partition@0 {
        reg = <0x0 0x40000>;
        label = "u-boot";
        read-only;
    };

    env: partition@40000 {
        compatible = "u-boot,env";
        reg = <0x40000 0x10000>;

        mac: ethaddr {
            #nvmem-cell-cells = <1>;
        };
    };
};
partitions {
    compatible = "fixed-partitions";
    #address-cells = <1>;
    #size-cells = <1>;

    partition@0 {
        reg = <0x0 0x100000>;
        compatible = "brcm,u-boot";
        label = "u-boot";

        partition-u-boot-env {
            compatible = "brcm,env";
            env-size = <0x20000>;

            ethaddr {
            };
        };
    };
};
partition@0 {
    reg = <0x0 0x100000>;
    label = "ubi";
    compatible = "linux,ubi";

    volumes {
        ubi-volume-u-boot-env {
            volname = "env";

            nvmem-layout {
                compatible = "u-boot,env";

                ethaddr {
                    #nvmem-cell-cells = <1>;
                };
            };
        };
    };
};

Source notes #

Annotations retained from the schema source

Line 1: SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause

Edit this page