* [PATCH v2] dt-bindings: mtd: Add a schema for binman
@ 2023-09-22 19:34 Simon Glass
2023-09-23 2:05 ` Rob Herring
0 siblings, 1 reply; 2+ messages in thread
From: Simon Glass @ 2023-09-22 19:34 UTC (permalink / raw)
To: devicetree
Cc: Tom Rini, linux-mtd, U-Boot Mailing List, Rob Herring,
Simon Glass, Conor Dooley, Dhruva Gole, Krzysztof Kozlowski,
Miquel Raynal, Nick Terrell, Pratyush Yadav,
Rafał Miłecki, Richard Weinberger, Rob Herring,
Vignesh Raghavendra, linux-kernel
Binman[1] is a tool for creating firmware images. It allows you to
combine various binaries and place them in an output file.
Binman uses a DT schema to describe an image, in enough detail that
it can be automatically built from component parts, disassembled,
replaced, listed, etc.
Images are typically stored in flash, which is why this binding is
targeted at mtd. Previous discussion is at [2] [3].
This is only a starting point, an attempt to align on the best way to
add this to the schema.
[1] https://u-boot.readthedocs.io/en/stable/develop/package/binman.html
[2] https://lore.kernel.org/u-boot/20230821180220.2724080-3-sjg@chromium.org/
[3] https://www.spinics.net/lists/devicetree/msg626149.html
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Use "binman" for compatible instead of "u-boot,binman"
- Significantly rework the patch
- Use make dt_binding_check DT_SCHEMA_FILES=Documentation/../partitions
.../bindings/mtd/partitions/binman.yaml | 59 ++++++++++++++++++
.../mtd/partitions/binman/atf-bl31.yaml | 43 +++++++++++++
.../bindings/mtd/partitions/binman/entry.yaml | 62 +++++++++++++++++++
.../mtd/partitions/binman/u-boot.yaml | 43 +++++++++++++
.../bindings/mtd/partitions/partitions.yaml | 1 +
MAINTAINERS | 5 ++
6 files changed, 213 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mtd/partitions/binman.yaml
create mode 100644 Documentation/devicetree/bindings/mtd/partitions/binman/atf-bl31.yaml
create mode 100644 Documentation/devicetree/bindings/mtd/partitions/binman/entry.yaml
create mode 100644 Documentation/devicetree/bindings/mtd/partitions/binman/u-boot.yaml
diff --git a/Documentation/devicetree/bindings/mtd/partitions/binman.yaml b/Documentation/devicetree/bindings/mtd/partitions/binman.yaml
new file mode 100644
index 000000000000..31accab37055
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/partitions/binman.yaml
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Google LLC
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mtd/partitions/binman.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Binman firmware layout
+
+maintainers:
+ - Simon Glass <sjg@chromium.org>
+
+select: false
+
+description: |
+ The binman 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.
+
+ Documentation for Binman is available at:
+
+ https://u-boot.readthedocs.io/en/latest/develop/package/binman.html
+
+ with the current image-description format at:
+
+ https://u-boot.readthedocs.io/en/latest/develop/package/binman.html#image-description-format
+
+properties:
+ reg:
+ description: partition's offset and size within the flash
+ maxItems: 1
+
+ compatible:
+ const: binman
+
+ "#address-cells":
+ enum: [ 1, 2 ]
+
+ "#size-cells":
+ enum: [ 1, 2 ]
+
+required:
+ - compatible
+
+additionalProperties: false
+
+examples:
+ - |
+ binman {
+ compatible = "binman";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@100000 {
+ compatible = "brcm,bcm4908-firmware";
+ reg = <0x100000 0xf00000>;
+ };
+ };
diff --git a/Documentation/devicetree/bindings/mtd/partitions/binman/atf-bl31.yaml b/Documentation/devicetree/bindings/mtd/partitions/binman/atf-bl31.yaml
new file mode 100644
index 000000000000..7d28e7e1d01d
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/partitions/binman/atf-bl31.yaml
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Google LLC
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mtd/partitions/binman/atf-bl31.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ARM Trusted Firmware BL31
+
+maintainers:
+ - Simon Glass <sjg@chromium.org>
+
+description:
+ Holds a BL31 binary file from the ARM Trusted Firmware project.
+
+allOf:
+ - $ref: entry.yaml#
+
+properties:
+ compatible:
+ const: binman,atf-bl31
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ binman {
+ compatible = "binman";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ reg = <0x0 0xa0000>;
+ compatible = "binman,entry";
+ };
+
+ partition@100000 {
+ reg = <0x100000 0x200000>;
+ compatible = "binman,atf-bl31";
+ compression = "lz4";
+ };
+ };
diff --git a/Documentation/devicetree/bindings/mtd/partitions/binman/entry.yaml b/Documentation/devicetree/bindings/mtd/partitions/binman/entry.yaml
new file mode 100644
index 000000000000..9991c83aa0cf
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/partitions/binman/entry.yaml
@@ -0,0 +1,62 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Google LLC
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mtd/partitions/binman/entry.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Binman entry
+
+maintainers:
+ - Simon Glass <sjg@chromium.org>
+
+description: |
+ This node specifies a single, generic entry in the firmware.
+
+ Entries have a specific type, indicated by the compatible string.
+
+properties:
+ reg:
+ description: partition's offset and size within the flash
+ maxItems: 1
+
+ compression:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ Compression algorithm to use, chosen from a list of well-known algorithms.
+ The contents are compressed using this algorithm.
+
+ enum:
+ - none
+ - bzip2
+ - gzip
+ - lzop
+ - lz4
+ - lzma
+ - xz
+ - zstd
+
+required:
+ - compatible
+
+additionalProperties: true
+
+examples:
+ - |
+ binman {
+ compatible = "binman";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ reg = <0x0 0xa0000>;
+ compatible = "binman,entry";
+ };
+
+ partition@100000 {
+ reg = <0x100000 0x200000>;
+ compatible = "binman,entry";
+ compression = "lz4";
+ };
+ };
diff --git a/Documentation/devicetree/bindings/mtd/partitions/binman/u-boot.yaml b/Documentation/devicetree/bindings/mtd/partitions/binman/u-boot.yaml
new file mode 100644
index 000000000000..e5f3583f746c
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/partitions/binman/u-boot.yaml
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2023 Google LLC
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mtd/partitions/binman/u-boot.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: U-Boot
+
+maintainers:
+ - Simon Glass <sjg@chromium.org>
+
+description:
+ Holds a binary file (u-boot.bin) from the U-Boot project.
+
+allOf:
+ - $ref: entry.yaml#
+
+properties:
+ compatible:
+ const: binman,u-boot
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ binman {
+ compatible = "binman";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ reg = <0x0 0xa0000>;
+ compatible = "binman,u-boot";
+ };
+
+ partition@100000 {
+ reg = <0x100000 0x200000>;
+ compatible = "binman,atf-bl31";
+ compression = "lz4";
+ };
+ };
diff --git a/Documentation/devicetree/bindings/mtd/partitions/partitions.yaml b/Documentation/devicetree/bindings/mtd/partitions/partitions.yaml
index 1dda2c80747b..849fd15d085c 100644
--- a/Documentation/devicetree/bindings/mtd/partitions/partitions.yaml
+++ b/Documentation/devicetree/bindings/mtd/partitions/partitions.yaml
@@ -15,6 +15,7 @@ maintainers:
oneOf:
- $ref: arm,arm-firmware-suite.yaml
+ - $ref: binman.yaml
- $ref: brcm,bcm4908-partitions.yaml
- $ref: brcm,bcm947xx-cfe-partitions.yaml
- $ref: fixed-partitions.yaml
diff --git a/MAINTAINERS b/MAINTAINERS
index a4c30221eb30..ebcbfb4292e8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3505,6 +3505,11 @@ F: Documentation/filesystems/bfs.rst
F: fs/bfs/
F: include/uapi/linux/bfs_fs.h
+BINMAN
+M: Simon Glass <sjg@chromium.org>
+S: Supported
+F: Documentation/devicetree/bindings/mtd/partitions/binman*
+
BITMAP API
M: Yury Norov <yury.norov@gmail.com>
R: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
2.42.0.515.g380fc7ccd1-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] dt-bindings: mtd: Add a schema for binman
2023-09-22 19:34 [PATCH v2] dt-bindings: mtd: Add a schema for binman Simon Glass
@ 2023-09-23 2:05 ` Rob Herring
0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2023-09-23 2:05 UTC (permalink / raw)
To: Simon Glass
Cc: linux-kernel, Conor Dooley, Nick Terrell, Rob Herring,
Miquel Raynal, devicetree, Krzysztof Kozlowski, Dhruva Gole,
Pratyush Yadav, Richard Weinberger, Vignesh Raghavendra,
Rafał Miłecki, Tom Rini, U-Boot Mailing List, linux-mtd
On Fri, 22 Sep 2023 13:34:15 -0600, Simon Glass wrote:
> Binman[1] is a tool for creating firmware images. It allows you to
> combine various binaries and place them in an output file.
>
> Binman uses a DT schema to describe an image, in enough detail that
> it can be automatically built from component parts, disassembled,
> replaced, listed, etc.
>
> Images are typically stored in flash, which is why this binding is
> targeted at mtd. Previous discussion is at [2] [3].
>
> This is only a starting point, an attempt to align on the best way to
> add this to the schema.
>
> [1] https://u-boot.readthedocs.io/en/stable/develop/package/binman.html
> [2] https://lore.kernel.org/u-boot/20230821180220.2724080-3-sjg@chromium.org/
> [3] https://www.spinics.net/lists/devicetree/msg626149.html
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Use "binman" for compatible instead of "u-boot,binman"
> - Significantly rework the patch
> - Use make dt_binding_check DT_SCHEMA_FILES=Documentation/../partitions
>
> .../bindings/mtd/partitions/binman.yaml | 59 ++++++++++++++++++
> .../mtd/partitions/binman/atf-bl31.yaml | 43 +++++++++++++
> .../bindings/mtd/partitions/binman/entry.yaml | 62 +++++++++++++++++++
> .../mtd/partitions/binman/u-boot.yaml | 43 +++++++++++++
> .../bindings/mtd/partitions/partitions.yaml | 1 +
> MAINTAINERS | 5 ++
> 6 files changed, 213 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/mtd/partitions/binman.yaml
> create mode 100644 Documentation/devicetree/bindings/mtd/partitions/binman/atf-bl31.yaml
> create mode 100644 Documentation/devicetree/bindings/mtd/partitions/binman/entry.yaml
> create mode 100644 Documentation/devicetree/bindings/mtd/partitions/binman/u-boot.yaml
>
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/mtd/partitions/binman/atf-bl31.example.dtb: /example-0/binman/partition@0: failed to match any schema with compatible: ['binman,entry']
Documentation/devicetree/bindings/mtd/partitions/binman/entry.example.dtb: /example-0/binman/partition@0: failed to match any schema with compatible: ['binman,entry']
Documentation/devicetree/bindings/mtd/partitions/binman/entry.example.dtb: /example-0/binman/partition@100000: failed to match any schema with compatible: ['binman,entry']
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230922193417.1697379-1-sjg@chromium.org
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-23 2:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-22 19:34 [PATCH v2] dt-bindings: mtd: Add a schema for binman Simon Glass
2023-09-23 2:05 ` Rob Herring
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).