From: Simon Glass <sjg@chromium.org>
To: devicetree@vger.kernel.org
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
Tom Rini <trini@konsulko.com>,
Alper Nebi Yasak <alpernebiyasak@gmail.com>,
Neha Malcom Francis <n-francis@ti.com>,
Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>,
Philippe Reynes <philippe.reynes@softathome.com>,
Peng Fan <peng.fan@nxp.com>, Rob Herring <robh@kernel.org>,
Simon Glass <sjg@chromium.org>
Subject: [PATCH v2 2/2] schemas: Add a schema for binman
Date: Thu, 20 Jul 2023 13:56:02 -0600 [thread overview]
Message-ID: <20230720195617.2276563-2-sjg@chromium.org> (raw)
In-Reply-To: <20230720195617.2276563-1-sjg@chromium.org>
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.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
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
diff --git a/dtschema/schemas/firmware/binman/entry.yaml b/dtschema/schemas/firmware/binman/entry.yaml
new file mode 100644
index 0000000..d50f96d
--- /dev/null
+++ b/dtschema/schemas/firmware/binman/entry.yaml
@@ -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 <sjg@chromium.org>
+
+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>;
+ };
+ };
+ };
diff --git a/dtschema/schemas/firmware/image.yaml b/dtschema/schemas/firmware/image.yaml
new file mode 100644
index 0000000..949b067
--- /dev/null
+++ b/dtschema/schemas/firmware/image.yaml
@@ -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 <sjg@chromium.org>
+
+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>;
+ };
+ };
+ };
--
2.41.0.487.g6d72f3e995-goog
next prev parent reply other threads:[~2023-07-20 19:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-20 19:56 [PATCH v2 1/2] schemas: Add firmware node schema Simon Glass
2023-07-20 19:56 ` Simon Glass [this message]
2023-07-26 19:35 ` [PATCH v2 2/2] schemas: Add a schema for binman Simon Glass
2023-08-03 20:29 ` Alper Nebi Yasak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230720195617.2276563-2-sjg@chromium.org \
--to=sjg@chromium.org \
--cc=alpernebiyasak@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=n-francis@ti.com \
--cc=peng.fan@nxp.com \
--cc=philippe.reynes@softathome.com \
--cc=robh@kernel.org \
--cc=stefan.herbrechtsmeier@weidmueller.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).