# U-Boot environment variables layout

_Peios Kernel / Hardware and drivers / Device-tree binding reference / Nvmem bindings / layouts_

> Device-tree binding reference for U-Boot environment variables layout.

<!-- SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -->


<a id="dt-root"></a>

**Schema identifier (<code>&#36;id</code>):** <span id="dt-09f478f44eb202ea573e"><code>&#34;http&#58;&#47;&#47;devicetree&#46;org&#47;schemas&#47;nvmem&#47;layouts&#47;u&#45;boot&#44;env&#46;yaml&#35;&#34;</code></span>

**Schema dialect (<code>&#36;schema</code>):** <span id="dt-dcb375baab6014763a68"><code>&#34;http&#58;&#47;&#47;devicetree&#46;org&#47;meta&#45;schemas&#47;core&#46;yaml&#35;&#34;</code></span>

<a id="dt-e46b5a5dd81dbd751c9f"></a>

<div id="dt-6d1c5ef59f0239d38c02">
<p style="white-space: pre-wrap">U-Boot uses environment variables to store device parameters and
configuration. They may be used for booting process, setup or keeping end user
info.</p>
<p style="white-space: pre-wrap">Data is stored using U-Boot specific formats (variant specific header and NUL
separated key-value pairs).</p>
<p style="white-space: pre-wrap">Environment data can be stored on various storage entities, e.g.:
1. Raw flash partition
2. UBI volume</p>
<p style="white-space: pre-wrap">This binding allows marking storage device (as containing env data) and
specifying used format.</p>
<p style="white-space: pre-wrap">Variables can be defined as NVMEM device subnodes.</p>
</div>

**Maintainers (<code>maintainers</code>):** <a id="dt-fbc39820abb8bb999095"></a> <span id="dt-fb78ddfc22abfc6fe56d"><code>&#34;Rafał Miłecki &#60;rafal&#64;milecki&#46;pl&#62;&#34;</code></span>

<a id="dt-e1f655ed0ff4d595dadc"></a>

## Properties and child nodes (<code>properties</code>)

<a id="dt-5c1d81699dcbe840de83"></a>

### <code>compatible</code> — not listed as required here

<a id="dt-39566f01414e34c67b85"></a>

#### Exactly one of these rules must match (<code>oneOf</code>)

<a id="dt-fe13e24e5c9612880f47"></a>

**Rule 1**

> <div id="dt-ab1c3e7063bd95dc962e">
> <p style="white-space: pre-wrap">A standalone env data block</p>
> </div>
>
> **Exact value (<code>const</code>):** <span id="dt-d1fe1b456a54b64074d3"><code>&#34;u&#45;boot&#44;env&#34;</code></span>

<a id="dt-7482b6e745c4f056161a"></a>

**Rule 2**

> <div id="dt-4b64ce44adfe069638c4">
> <p style="white-space: pre-wrap">Two redundant blocks with active one flagged</p>
> </div>
>
> **Exact value (<code>const</code>):** <span id="dt-58a429cd4bf531951c0d"><code>&#34;u&#45;boot&#44;env&#45;redundant&#45;bool&#34;</code></span>

<a id="dt-39cb5b72c94e12bd53ea"></a>

**Rule 3**

> <div id="dt-34ebc3371373135d1528">
> <p style="white-space: pre-wrap">Two redundant blocks with active having higher counter</p>
> </div>
>
> **Exact value (<code>const</code>):** <span id="dt-710bc579d54b8b6b1f6c"><code>&#34;u&#45;boot&#44;env&#45;redundant&#45;count&#34;</code></span>

<a id="dt-61219c29f99de6d21702"></a>

**Rule 4**

> <div id="dt-2e7dbd5da540c0c7ff41">
> <p style="white-space: pre-wrap">Broadcom's variant with custom header</p>
> </div>
>
> **Exact value (<code>const</code>):** <span id="dt-bb8aa9a35453860e510c"><code>&#34;brcm&#44;env&#34;</code></span>

<a id="dt-9c1635fdb65d87e33d77"></a>

### <code>reg</code> — not listed as required here

<div id="dt-571d87f60678ead6c5ff">
<p style="white-space: pre-wrap">Partition offset and size for env on top of MTD</p>
</div>

**Maximum number of items (<code>maxItems</code>):** <span id="dt-71421d35675d9a533ad2"><code>1</code></span>

<a id="dt-0f7f84ced9dbd22e89f8"></a>

### <code>bootcmd</code> — not listed as required here

**Value type (<code>type</code>):** <span id="dt-94519da22d1b7524e1a8"><code>&#34;object&#34;</code></span>

<div id="dt-885c13aabc0592e727b5">
<p style="white-space: pre-wrap">Command to use for automatic booting</p>
</div>

<a id="dt-60ac7e7032fbd58288d4"></a>

### <code>env&#45;size</code> — not listed as required here

<div id="dt-26d30aafc534826db474">
<p style="white-space: pre-wrap">Size in bytes of the environment data used by U-Boot for CRC calculation. If omitted, the full NVMEM region size is used.</p>
</div>

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-a631f152dfbfbe2f24eb">[<code>&#47;schemas&#47;types&#46;yaml&#35;&#47;definitions&#47;uint32</code>](</kernel/hardware/devicetree-bindings/dt-shared/types.md#dt-d57795d6573ee5d67d37>)</span>

<a id="dt-67f4317a8fafef35053c"></a>

### <code>ethaddr</code> — not listed as required here

**Value type (<code>type</code>):** <span id="dt-13505448b8d991e9871c"><code>&#34;object&#34;</code></span>

<div id="dt-200072de8e13fc7dbe83">
<p style="white-space: pre-wrap">Ethernet interfaces base MAC address.</p>
</div>

<a id="dt-afa33ee76df4dcac97a0"></a>

#### Properties not matched by properties or patternProperties in this schema (<code>additionalProperties</code>)

<code>false</code>

Not allowed by this rule.

<a id="dt-a73b48cb9d6da7673a4f"></a>

#### Properties and child nodes (<code>properties</code>)

<a id="dt-8942c92d2e023568e904"></a>

**<code>&#35;nvmem&#45;cell&#45;cells</code> — not listed as required here**

<div id="dt-ef4d72abec7e5e48b1dc">
<p style="white-space: pre-wrap">The first argument is a MAC address offset.</p>
</div>

**Exact value (<code>const</code>):** <span id="dt-e9ec3698469f07a9aad9"><code>1</code></span>

<a id="dt-935ee547587f3e75de61"></a>

## All of these rules must match (<code>allOf</code>)

<a id="dt-d33de94ac1d3652cd22a"></a>

### Rule 1

> <a id="dt-3bbb54dfa1f05dfb4d25"></a>
>
> #### Condition (<code>if</code>)
>
> > <a id="dt-97f47e9dc804c839f86d"></a>
> >
> > **Properties and child nodes (<code>properties</code>)**
> >
> > <a id="dt-e8b2cdca19260a8576bd"></a>
> >
> > **<code>&#36;nodename</code> — not listed as required here**
> >
> > <a id="dt-1301a2821f01ae2f67c7"></a>
> >
> > **This rule must not match (<code>not</code>)**
> >
> > > <a id="dt-d6c85be244c431121464"></a>
> > >
> > > **Rule for matching array elements (<code>contains</code>)**
> > >
> > > > **String pattern (<code>pattern</code>):** <span id="dt-dbb1a49728d7cb517f91"><code>&#34;&#94;partition&#64;&#91;0&#45;9a&#45;f&#93;&#43;&#36;&#34;</code></span>
>
> <a id="dt-1ba25143802b75b74702"></a>
>
> #### When the condition matches (<code>then</code>)
>
> > <a id="dt-b212c2ef78c22fab2e20"></a>
> >
> > **Properties and child nodes (<code>properties</code>)**
> >
> > <a id="dt-f6af340cf87a1ddfe255"></a>
> >
> > **<code>reg</code> — not listed as required here**
> >
> > <code>false</code> — Not permitted by this property rule.

<a id="dt-738c4b4f9e483441138b"></a>

## Properties not matched by properties or patternProperties in this schema (<code>additionalProperties</code>)

<code>false</code>

Not allowed by this rule.

<a id="dt-1a130cabaa8a47b058bf"></a>

## Examples (<code>examples</code>)

<pre id="dt-0bd6510295af0c95ff2d"><code class="language-dts">partitions {
    compatible = "fixed-partitions";
    #address-cells = &lt;1&gt;;
    #size-cells = &lt;1&gt;;

    partition@0 {
        reg = &lt;0x0 0x40000&gt;;
        label = "u-boot";
        read-only;
    };

    env: partition@40000 {
        compatible = "u-boot,env";
        reg = &lt;0x40000 0x10000&gt;;

        mac: ethaddr {
            #nvmem-cell-cells = &lt;1&gt;;
        };
    };
};
</code></pre>

<pre id="dt-bae0d43ea48e35208b4a"><code class="language-dts">partitions {
    compatible = "fixed-partitions";
    #address-cells = &lt;1&gt;;
    #size-cells = &lt;1&gt;;

    partition@0 {
        reg = &lt;0x0 0x100000&gt;;
        compatible = "brcm,u-boot";
        label = "u-boot";

        partition-u-boot-env {
            compatible = "brcm,env";
            env-size = &lt;0x20000&gt;;

            ethaddr {
            };
        };
    };
};
</code></pre>

<pre id="dt-d0212a4cd671f89a0b40"><code class="language-dts">partition@0 {
    reg = &lt;0x0 0x100000&gt;;
    label = "ubi";
    compatible = "linux,ubi";

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

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

                ethaddr {
                    #nvmem-cell-cells = &lt;1&gt;;
                };
            };
        };
    };
};
</code></pre>

## Source notes

<details>
<summary>Annotations retained from the schema source</summary>

<p id="dt-comment-0"><strong>Line 1:</strong> <span> SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause</span></p>

</details>
