Skip to contentSkip to conversation

schemas: Add firmware node schema

PATCH Superseded Simon Glass 2 participants 5 messages Jul 20, 2023 – Aug 12, 2023

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 schemas: Add firmware node schema

Add a motivation and purpose for this new proposed node.

---

(no changes since v1)

 dtschema/schemas/firmware.yaml | 83 ++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 dtschema/schemas/firmware.yaml
dtschema/schemas/firmware.yaml new file +83 -0
new file mode 100644
index 0000000..4439a70
@@ -0,0 +1,83 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-clause
+# Copyright 2023 Google LLC
+#
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/firmware.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: /firmware Node
+
+maintainers:
+  - Simon Glass <[email protected]>
+
+description: |
+  The '/firmware' node does not represent a real device, but serves as a place
+  for recording information about the main firmware used on the device, such as
+  a map of its contents. This is used by the Operating System (OS), user space
+  programs and possibly other firmware components. Data in the '/firmware' node
+  does not itself represent the hardware.
+
+  Properties in this node should be common to (and used by) at least two
+  firmware projects, such as U-Boot and TF-A. Project-specific subnodes can be
+  used for properties which are specific to a single project.
+
+  Purpose of '/firmware' node
+  ---------------------------
+
+  Firmware has traditionally been fairly opaque to the OS, with the OS taking
+  no interest in its contents, version, layout or how it might be updated. This
+  is less than ideal, since firmware is an important part of the system and
+  visibility into its operation is every bit as important as visbility into the
+  OS and user-space programs within the system.
+
+  The traditional approach has been to let firmware deal with firmware, and the
+  OS deal with everything else. Updating firmware has been handled by firmware.
+  For example, the UEFI spec defines a way for the OS to post a 'capsule' which
+  is discovered next time the system boots, permitting firmware updates. But
+  firmware updates in firmware are highly problematic. They require a reboot
+  and a sometimes-lengthy wait with a strange-looking interface unfamiliar
+  to most users. It seems better to make the update as transparent as possible
+  to the user. As an example of that, ChromeOS has full knowledge of the
+  firmware version and layout, updates it in the background from user space and
+  instantly selects the new firmware when the user reboots or logs out.
+
+  A common objection to considering the system holistically is that some parts
+  of the system are inaccessible to the OS, such as a secure enclave. However
+  this does not preclude providing visibility into what is present in that
+  enclave. Firmware-version information is still useful. Firmware updates are
+  still needed and can still be initiated from user space.
+
+  Another objection is that firmware should provide an interface to the OS,
+  while keeping its structure private. This thinking is largely driven by
+  extrapolating from how firmware has been handled in the 'BIOS' days.
+  It should be considered a degenerate case rather than the norm. As complexity
+  increases, it creates an artificial boundary between two pieces of the whole.
+  Mechanisms then need to be invented to cross this unnecessary chasm. An
+  example of this is Intel's Dynamic Platform and Thermal Framework (DPTF),
+  which consists of user-space, OS and firmware components all working towards
+  a shared goal. We need a standard description of these cross-system pieces.
+
+  In order to 'teach the OS about firmware', we need a place to put this
+  information. That is the purpose of this node.
+
+  In an Open Source world the entire model of firmware needs to adjust to be
+  more open, more visible and managed just like any other part of the system.
+  The major goal is to standardise how firmware is presented to the OS and user
+  space, so that common utilities can be used to manage the entire system,
+  including the firmware. For example, fwupd can look in this node for
+  information on how to update the firmware, similar to how VBE works. [1]
+  It is likely that other purposes will come to light over time.
+
+  [1] https://github.com/fwupd/fwupd/tree/main/plugins/vbe
+
+properties:
+  $nodename:
+    const: firmware
+
+  "#address-cells": true
+  "#size-cells": true
+
+additionalProperties:
+  type: object
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#1 lore raw

PATCH v2 2/2 schemas: Add a schema for binman

With this version I have done with a generic name, in this case 'data', as suggested by Alper Nebi Yasak. This may be controversial, but we may as well have the dicussion now. I assume that there are no other ongoing attempts to define the layout of firmware in devicetree.

---

Changes in v2:
- Reworked significantly based on Alper's comments

 dtschema/schemas/firmware/binman/entry.yaml | 80 +++++++++++++++++++++
 dtschema/schemas/firmware/image.yaml        | 77 ++++++++++++++++++++
 2 files changed, 157 insertions(+)
 create mode 100644 dtschema/schemas/firmware/binman/entry.yaml
 create mode 100644 dtschema/schemas/firmware/image.yaml
dtschema/schemas/firmware/binman/entry.yaml new file +80 -0
new file mode 100644
index 0000000..d50f96d
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Google LLC
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/firmware/image/entry.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Image entry
+
+maintainers:
+  - Simon Glass <[email protected]>
+
+description: |
+  The entry node specifies a single entry in the firmware image.
+
+  Entries have a specific type, such as "u-boot" or "atf-bl31". This is provided
+  using compatible = "data,<type>".
+
+  Note: This definition is intended to be hierarchical, so that entries can
+  appear in other entries. Schema for that is TBD.
+
+properties:
+  $nodename:
+    pattern: "^[-a-z]+(-[0-9]+)?$"
+
+  compatible:
+    $ref: /schemas/types.yaml#/definitions/string
+
+  offset:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Provides the offset of this entry from the start of its parent section.
+
+      This may be omitted in the description provided by Binman, in which case
+      the value is calculated as part of image packing.
+
+  size:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Provides the size of this entry in bytes.
+
+      This may be omitted in the description provided by Binman, in which case
+      the value is calculated as part of image packing.
+
+  reg:
+    description: |
+      Defines the offset and size of this entry, with reference to its parent
+      image / section.
+
+      Note This is typically omitted in the description provided to Binman,
+      since the value is calculated as part of image packing. Separate
+      properties are provided for the size and offset of an entry, so that it is
+      easy to specify none, one or both. The `reg` property is the only one that
+      needs to be looked at once the image has been built.
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    firmware {
+      image {
+        compatible = "data,image";
+        #address-cells = <1>;
+        $size-cells = <1>;
+
+        u-boot@0 {
+          compatible = "data,u-boot";
+          reg = <0 0xa0000>;
+        };
+
+        atf-bl31@0x100000 {
+          compatible = "data,atf-bl31";
+          reg = <0x100000 0x20000>;
+        };
+      };
+    };
dtschema/schemas/firmware/image.yaml new file +77 -0

77 lines not on this page · raw message

Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#2 lore raw

Re: [PATCH v2 2/2] schemas: Add a schema for binman

Hi,

Quoted 188 lines · Simon Glass

With this version I have done with a generic name, in this case 'data', as suggested by Alper Nebi Yasak. This may be controversial, but we may as well have the dicussion now. I assume that there are no other ongoing attempts to define the layout of firmware in devicetree.

---

Changes in v2:
- Reworked significantly based on Alper's comments

 dtschema/schemas/firmware/binman/entry.yaml | 80 +++++++++++++++++++++
 dtschema/schemas/firmware/image.yaml        | 77 ++++++++++++++++++++
 2 files changed, 157 insertions(+)
 create mode 100644 dtschema/schemas/firmware/binman/entry.yaml
 create mode 100644 dtschema/schemas/firmware/image.yaml
dtschema/schemas/firmware/binman/entry.yaml new file +80 -0
new file mode 100644
index 0000000..d50f96d
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Google LLC
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/firmware/image/entry.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Image entry
+
+maintainers:
+  - Simon Glass <[email protected]>
+
+description: |
+  The entry node specifies a single entry in the firmware image.
+
+  Entries have a specific type, such as "u-boot" or "atf-bl31". This is provided
+  using compatible = "data,<type>".
+
+  Note: This definition is intended to be hierarchical, so that entries can
+  appear in other entries. Schema for that is TBD.
+
+properties:
+  $nodename:
+    pattern: "^[-a-z]+(-[0-9]+)?$"
+
+  compatible:
+    $ref: /schemas/types.yaml#/definitions/string
+
+  offset:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Provides the offset of this entry from the start of its parent section.
+
+      This may be omitted in the description provided by Binman, in which case
+      the value is calculated as part of image packing.
+
+  size:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Provides the size of this entry in bytes.
+
+      This may be omitted in the description provided by Binman, in which case
+      the value is calculated as part of image packing.
+
+  reg:
+    description: |
+      Defines the offset and size of this entry, with reference to its parent
+      image / section.
+
+      Note This is typically omitted in the description provided to Binman,
+      since the value is calculated as part of image packing. Separate
+      properties are provided for the size and offset of an entry, so that it is
+      easy to specify none, one or both. The `reg` property is the only one that
+      needs to be looked at once the image has been built.
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    firmware {
+      image {
+        compatible = "data,image";
+        #address-cells = <1>;
+        $size-cells = <1>;
+
+        u-boot@0 {
+          compatible = "data,u-boot";
+          reg = <0 0xa0000>;
+        };
+
+        atf-bl31@0x100000 {
+          compatible = "data,atf-bl31";
+          reg = <0x100000 0x20000>;
+        };
+      };
+    };
dtschema/schemas/firmware/image.yaml new file +77 -1
new file mode 100644
index 0000000..949b067
@@ -0,0 +1,77 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Google LLC
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/firmware/image.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Binman firmware layout
+
+maintainers:
+  - Simon Glass <[email protected]>
+
+description: |
+  The image node provides a layout for firmware, used when packaging firmware
+  from multiple projects. For now it just supports a very simple set of
+  features, as a starting point for discussion.
+
+  The Binman tool processes this node to produce a final image which can be
+  loaded into suitable storage device. Documentation is at:
+
+  https://u-boot.readthedocs.io/en/latest/develop/package/binman.html
+
+  The current image-description format is here:
+
+  https://u-boot.readthedocs.io/en/latest/develop/package/binman.html#image-description-format
+
+  It is desirable to reference the image from the storage-device node, perhaps
+  using an image-desc property:
+
+    spiflash@0 {
+      compatible = "spidev", "jedec,spi-nor";
+      image-desc = <&image>;
+    };
+
+  Note that the intention is to change Binman to use whatever schema is agreed
+  here.
+
+properties:
+  $nodename:
+    const: binman
+
+  compatible:
+    const: data,image
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 1
+
+required:
+  - compatible
+  - "#address-cell"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    firmware {
+      image {
+        compatible = "data,image";
+        #address-cells = <1>;
+        $size-cells = <1>;
+
+        u-boot@0 {
+          compatible = "data,u-boot";
+          reg = <0 0xa0000>;
+        };
+
+        atf-bl31@0x100000 {
+          compatible = "data,atf-bl31";
+          reg = <0x100000 0x20000>;
+        };
+      };
+    };
--
Quoted 1 line

2.41.0.487.g6d72f3e995-goog

Are there any more comments on this v2? Is there anyone else we should add to review this?

Regards,
Simon

Quoted 1 line
#3 lore raw

Re: [PATCH v2 2/2] schemas: Add a schema for binman

In reply to Simon Glass
Quoted 57 lines · Simon Glass

With this version I have done with a generic name, in this case 'data', as suggested by Alper Nebi Yasak. This may be controversial, but we may as well have the dicussion now. I assume that there are no other ongoing attempts to define the layout of firmware in devicetree.

---

Changes in v2:
- Reworked significantly based on Alper's comments

 dtschema/schemas/firmware/binman/entry.yaml | 80 +++++++++++++++++++++
 dtschema/schemas/firmware/image.yaml        | 77 ++++++++++++++++++++
 2 files changed, 157 insertions(+)
 create mode 100644 dtschema/schemas/firmware/binman/entry.yaml
 create mode 100644 dtschema/schemas/firmware/image.yaml
dtschema/schemas/firmware/binman/entry.yaml new file +34 -0
new file mode 100644
index 0000000..d50f96d
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Google LLC
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/firmware/image/entry.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Image entry
+
+maintainers:
+  - Simon Glass <[email protected]>
+
+description: |
+  The entry node specifies a single entry in the firmware image.
+
+  Entries have a specific type, such as "u-boot" or "atf-bl31". This is provided
+  using compatible = "data,<type>".
+
+  Note: This definition is intended to be hierarchical, so that entries can
+  appear in other entries. Schema for that is TBD.
+
+properties:
+  $nodename:
+    pattern: "^[-a-z]+(-[0-9]+)?$"
+
+  compatible:
+    $ref: /schemas/types.yaml#/definitions/string
+
+  offset:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Provides the offset of this entry from the start of its parent section.
+

dtschema/schemas/firmware/binman/entry.yaml line 44

Quoted 10 lines
dtschema/schemas/firmware/binman/entry.yaml new file +10 -0
+      This may be omitted in the description provided by Binman, in which case
+      the value is calculated as part of image packing.
+
+  size:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Provides the size of this entry in bytes.
+
+      This may be omitted in the description provided by Binman, in which case
+      the value is calculated as part of image packing.

So AFAIU, binman will take none/one/both of "offset" and "size" as inputs and will pass them to the output unmodified, instead adding a "reg" pair of their calculated final values?

Is there a schema-computational way to ensure that "reg" has to contain the same values as "offset" and "size"? Or is that not a restriction at all and "reg" overrides the others?

dtschema/schemas/firmware/binman/entry.yaml line 56

Quoted 12 lines
dtschema/schemas/firmware/binman/entry.yaml new file +12 -0
+
+  reg:
+    description: |
+      Defines the offset and size of this entry, with reference to its parent
+      image / section.
+
+      Note This is typically omitted in the description provided to Binman,
+      since the value is calculated as part of image packing. Separate
+      properties are provided for the size and offset of an entry, so that it is
+      easy to specify none, one or both. The `reg` property is the only one that
+      needs to be looked at once the image has been built.
+

Do we not need a $ref for "reg"? Is there anything applicable?

BTW, I'm not that familiar with device-tree interpretation, I occasionally saw 'reg' being used as an <offset size> pair, and was mostly just asking if it's appropriate.

(Also TIL "ranges", and I'm imagining ranges = <0 $size 4G-$size 4G>; as an end-at-4gb replacement/generalization :P, but I know, later, later.)

Quoted 53 lines
dtschema/schemas/firmware/binman/entry.yaml new file +24 -0
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    firmware {
+      image {
+        compatible = "data,image";
+        #address-cells = <1>;
+        $size-cells = <1>;
+
+        u-boot@0 {
+          compatible = "data,u-boot";
+          reg = <0 0xa0000>;
+        };
+
+        atf-bl31@0x100000 {
+          compatible = "data,atf-bl31";
+          reg = <0x100000 0x20000>;
+        };
+      };
+    };
dtschema/schemas/firmware/image.yaml new file +23 -0
new file mode 100644
index 0000000..949b067
@@ -0,0 +1,77 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Google LLC
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/firmware/image.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Binman firmware layout
+
+maintainers:
+  - Simon Glass <[email protected]>
+
+description: |
+  The image node provides a layout for firmware, used when packaging firmware
+  from multiple projects. For now it just supports a very simple set of
+  features, as a starting point for discussion.
+
+  The Binman tool processes this node to produce a final image which can be
+  loaded into suitable storage device. Documentation is at:
+
+  https://u-boot.readthedocs.io/en/latest/develop/package/binman.html
+

dtschema/schemas/firmware/image.yaml line 33

Quoted 10 lines
dtschema/schemas/firmware/image.yaml new file +10 -0
+  The current image-description format is here:
+
+  https://u-boot.readthedocs.io/en/latest/develop/package/binman.html#image-description-format
+
+  It is desirable to reference the image from the storage-device node, perhaps
+  using an image-desc property:
+
+    spiflash@0 {
+      compatible = "spidev", "jedec,spi-nor";
+      image-desc = <&image>;

Bikeshedding, but maybe "layout" or "data,layout" would be nicer.

dtschema/schemas/firmware/image.yaml line 41

Quoted 8 lines
dtschema/schemas/firmware/image.yaml new file +8 -0
+    };
+
+  Note that the intention is to change Binman to use whatever schema is agreed
+  here.
+
+properties:
+  $nodename:
+    const: binman

Doesn't match the example, and I guess you mean "^[-a-z]+(-[0-9]+)?$" like the entry one.

Quoted 36 lines
dtschema/schemas/firmware/image.yaml new file +36 -0
+
+  compatible:
+    const: data,image
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 1
+
+required:
+  - compatible
+  - "#address-cell"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    firmware {
+      image {
+        compatible = "data,image";
+        #address-cells = <1>;
+        $size-cells = <1>;
+
+        u-boot@0 {
+          compatible = "data,u-boot";
+          reg = <0 0xa0000>;
+        };
+
+        atf-bl31@0x100000 {
+          compatible = "data,atf-bl31";
+          reg = <0x100000 0x20000>;
+        };
+      };
+    };
#4 lore raw

Re: [PATCH v2 2/2] schemas: Add a schema for binman

Hi Alper,

Quoted 13 lines · Alper Nebi Yasak
Quoted 11 lines · Simon Glass

With this version I have done with a generic name, in this case 'data', as suggested by Alper Nebi Yasak. This may be controversial, but we may as well have the dicussion now. I assume that there are no other ongoing attempts to define the layout of firmware in devicetree.

---

Changes in v2:
- Reworked significantly based on Alper's comments

Quoted 7 lines

Review

Quoted 7 lines
 dtschema/schemas/firmware/binman/entry.yaml | 80 +++++++++++++++++++++
 dtschema/schemas/firmware/image.yaml        | 77 ++++++++++++++++++++
 2 files changed, 157 insertions(+)
 create mode 100644 dtschema/schemas/firmware/binman/entry.yaml
 create mode 100644 dtschema/schemas/firmware/image.yaml
(quoted diff) +0 -0

b/dtschema/schemas/firmware/binman/entry.yaml

Quoted 14 lines
Quoted 14 lines

new file mode 100644
index 0000000..d50f96d

dtschema/schemas/firmware/binman/entry.yaml new file +9 -0
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Google LLC
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/firmware/image/entry.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Image entry
Quoted 8 lines

dtschema/schemas/firmware/binman/entry.yaml

Quoted 8 lines
dtschema/schemas/firmware/binman/entry.yaml new file +8 -0
+
+maintainers:
+  - Simon Glass <[email protected]>
+
+description: |
+  The entry node specifies a single entry in the firmware image.
+
+  Entries have a specific type, such as "u-boot" or "atf-bl31". This

is provided

Quoted 3 lines

dtschema/schemas/firmware/binman/entry.yaml

Quoted 3 lines
dtschema/schemas/firmware/binman/entry.yaml new file +3 -0
+  using compatible = "data,<type>".
+
+  Note: This definition is intended to be hierarchical, so that

entries can

Quoted 5 lines
Quoted 5 lines
dtschema/schemas/firmware/binman/entry.yaml new file +5 -0
+  appear in other entries. Schema for that is TBD.
+
+properties:
+  $nodename:
+    pattern: "^[-a-z]+(-[0-9]+)?$"
Quoted 8 lines

dtschema/schemas/firmware/binman/entry.yaml

Quoted 8 lines
dtschema/schemas/firmware/binman/entry.yaml new file +8 -0
+
+  compatible:
+    $ref: /schemas/types.yaml#/definitions/string
+
+  offset:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Provides the offset of this entry from the start of its parent

section.

Quoted 2 lines

dtschema/schemas/firmware/binman/entry.yaml line 35

Quoted 2 lines
dtschema/schemas/firmware/binman/entry.yaml new file +2 -0
+
+      This may be omitted in the description provided by Binman, in

which case

Quoted 8 lines

dtschema/schemas/firmware/binman/entry.yaml

Quoted 8 lines
dtschema/schemas/firmware/binman/entry.yaml new file +8 -0
+      the value is calculated as part of image packing.
+
+  size:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Provides the size of this entry in bytes.
+
+      This may be omitted in the description provided by Binman, in

which case

Quoted 9 lines

dtschema/schemas/firmware/binman/entry.yaml line 44

Quoted 1 line
dtschema/schemas/firmware/binman/entry.yaml new file +1 -0
+      the value is calculated as part of image packing.

So AFAIU, binman will take none/one/both of "offset" and "size" as inputs and will pass them to the output unmodified, instead adding a "reg" pair of their calculated final values?

Is there a schema-computational way to ensure that "reg" has to contain the same values as "offset" and "size"? Or is that not a restriction at all and "reg" overrides the others?

Probably we can do that in Python. But I don't expect people would use 'reg' in the image description as it is a pain.

Quoted 5 lines

dtschema/schemas/firmware/binman/entry.yaml

Quoted 5 lines
dtschema/schemas/firmware/binman/entry.yaml new file +4 -0
+
+  reg:
+    description: |
+      Defines the offset and size of this entry, with reference to its

parent

Quoted 3 lines

dtschema/schemas/firmware/binman/entry.yaml

Quoted 3 lines
dtschema/schemas/firmware/binman/entry.yaml new file +3 -0
+      image / section.
+
+      Note This is typically omitted in the description provided to

Binman,

Quoted 2 lines

dtschema/schemas/firmware/binman/entry.yaml line 53

Quoted 2 lines
dtschema/schemas/firmware/binman/entry.yaml new file +2 -0
+      since the value is calculated as part of image packing. Separate
+      properties are provided for the size and offset of an entry, so

that it is

Quoted 1 line

dtschema/schemas/firmware/binman/entry.yaml line 54

Quoted 1 line
dtschema/schemas/firmware/binman/entry.yaml new file +1 -0
+      easy to specify none, one or both. The `reg` property is the

only one that

Quoted 4 lines

dtschema/schemas/firmware/binman/entry.yaml line 56

Quoted 2 lines
dtschema/schemas/firmware/binman/entry.yaml new file +2 -0
+      needs to be looked at once the image has been built.
+

Do we not need a $ref for "reg"? Is there anything applicable?

Not from what I can tell. I think it is special?

Quoted 7 lines

BTW, I'm not that familiar with device-tree interpretation, I occasionally saw 'reg' being used as an <offset size> pair, and was mostly just asking if it's appropriate.

(Also TIL "ranges", and I'm imagining ranges = <0 $size 4G-$size 4G>; as an end-at-4gb replacement/generalization :P, but I know, later, later.)

Right, that is an x86-ism but is pretty helpful as it is otherwise widely confusing to deal with these addresses.

Quoted 18 lines
Quoted 18 lines
dtschema/schemas/firmware/binman/entry.yaml new file +17 -0
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    firmware {
+      image {
+        compatible = "data,image";
+        #address-cells = <1>;
+        $size-cells = <1>;
+
+        u-boot@0 {
+          compatible = "data,u-boot";
+          reg = <0 0xa0000>;
+        };
Quoted 8 lines

Review

Quoted 8 lines
dtschema/schemas/firmware/binman/entry.yaml new file +7 -0
+
+        atf-bl31@0x100000 {
+          compatible = "data,atf-bl31";
+          reg = <0x100000 0x20000>;
+        };
+      };
+    };
(quoted diff) +0 -0

b/dtschema/schemas/firmware/image.yaml

Quoted 12 lines
Quoted 12 lines

new file mode 100644
index 0000000..949b067

dtschema/schemas/firmware/image.yaml new file +7 -0
@@ -0,0 +1,77 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Google LLC
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/firmware/image.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
Quoted 8 lines

dtschema/schemas/firmware/image.yaml

Quoted 8 lines
dtschema/schemas/firmware/image.yaml new file +8 -0
+
+title: Binman firmware layout
+
+maintainers:
+  - Simon Glass <[email protected]>
+
+description: |
+  The image node provides a layout for firmware, used when packaging

firmware

Quoted 4 lines

dtschema/schemas/firmware/image.yaml

Quoted 4 lines
dtschema/schemas/firmware/image.yaml new file +4 -0
+  from multiple projects. For now it just supports a very simple set of
+  features, as a starting point for discussion.
+
+  The Binman tool processes this node to produce a final image which

can be

Quoted 7 lines

dtschema/schemas/firmware/image.yaml line 27

Quoted 7 lines
dtschema/schemas/firmware/image.yaml new file +7 -0
+  loaded into suitable storage device. Documentation is at:
+
+  https://u-boot.readthedocs.io/en/latest/develop/package/binman.html
+
+  The current image-description format is here:
+
+

https://u-boot.readthedocs.io/en/latest/develop/package/binman.html#image-description-format

Quoted 2 lines

dtschema/schemas/firmware/image.yaml line 28

Quoted 2 lines
dtschema/schemas/firmware/image.yaml new file +2 -0
+
+  It is desirable to reference the image from the storage-device node,

perhaps

Quoted 7 lines

dtschema/schemas/firmware/image.yaml line 33

Quoted 5 lines
dtschema/schemas/firmware/image.yaml new file +5 -0
+  using an image-desc property:
+
+    spiflash@0 {
+      compatible = "spidev", "jedec,spi-nor";
+      image-desc = <&image>;

Bikeshedding, but maybe "layout" or "data,layout" would be nicer.

OK

Quoted 4 lines

dtschema/schemas/firmware/image.yaml line 36

Quoted 4 lines
dtschema/schemas/firmware/image.yaml new file +3 -0
+    };
+
+  Note that the intention is to change Binman to use whatever schema

is agreed

Quoted 8 lines

dtschema/schemas/firmware/image.yaml line 41

Quoted 5 lines
dtschema/schemas/firmware/image.yaml new file +5 -0
+  here.
+
+properties:
+  $nodename:
+    const: binman

Doesn't match the example, and I guess you mean "^[-a-z]+(-[0-9]+)?$" like the entry one.

Right.

Quoted 29 lines
Quoted 29 lines
dtschema/schemas/firmware/image.yaml new file +28 -0
+
+  compatible:
+    const: data,image
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 1
+
+required:
+  - compatible
+  - "#address-cell"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    firmware {
+      image {
+        compatible = "data,image";
+        #address-cells = <1>;
+        $size-cells = <1>;
+
+        u-boot@0 {
+          compatible = "data,u-boot";
+          reg = <0 0xa0000>;
Quoted 8 lines

dtschema/schemas/firmware/image.yaml line 77

Quoted 8 lines
dtschema/schemas/firmware/image.yaml new file +8 -0
+        };
+
+        atf-bl31@0x100000 {
+          compatible = "data,atf-bl31";
+          reg = <0x100000 0x20000>;
+        };
+      };
+    };

Regards,
Simon