[PATCH v3 01/10] dt-bindings: mtd: partitions: add OpenWrt defined U-Boot Image

Rafał Miłecki zajec5 at gmail.com
Wed Jan 20 10:16:06 EST 2021


On 20.01.2021 15:35, Bjørn Mork wrote:
> @@ -0,0 +1,91 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mtd/partitions/openwrt,uimage.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: OpenWrt variations of U-Boot Image partitions
> +
> +maintainers:
> +  - Bjørn Mork <bjorn at mork.no>
> +
> +description: |
> +  The image format defined by the boot loader "Das U-Boot" is often
> +  modified or extended by device vendors. This defines a few optional
> +  properties which can be used to describe such modifications.
> +
> +# partition.txt defines common properties, but has not yet been
> +# converted to YAML
> +#allOf:
> +#  - $ref: ../partition.yaml#
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - openwrt,uimage
> +      - const: denx,uimage
> +
> +  openwrt,padding:
> +    description: Number of padding bytes between header and data
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    default: 0
> +
> +  openwrt,ih-magic:
> +    description: U-Boot Image Header magic number.
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    default: 0x27051956 # IH_MAGIC
> +
> +  openwrt,ih-type:
> +    description: U-Boot Image type
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    default: 2 # IH_TYPE_KERNEL
> +
> +  openwrt,offset:
> +    description:
> +      Offset between partition start and U-Boot Image in bytes
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    default: 0
> +
> +  openwrt,partition-magic:
> +    description:
> +      Magic number found at the start of the partition. Will only be
> +      validated if both this property and openwrt,offset is non-zero
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    default: 0
> +
> +required:
> +  - compatible
> +  - reg
> +
> +#unevaluatedProperties: false
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    // device with non-default magic
> +    partition at 300000 {
> +          compatible = "openwrt,uimage", "denx,uimage";
> +          reg = <0x00300000 0xe80000>;
> +          label = "firmware";
> +          openwrt,ih-magic = <0x4e474520>;
> +    };
> +  - |
> +    // device with U-Boot Image at an offset, with a partition magic value
> +    partition at 70000 {
> +          compatible = "openwrt,uimage", "denx,uimage";
> +          reg = <0x00070000 0x00790000>;
> +          label = "firmware";
> +          openwrt,offset = <20>;
> +          openwrt,partition-magic = <0x43535953>;
> +    };
> +  - |
> +    // device using a non-default image type
> +    #include "dt-bindings/mtd/partitions/uimage.h"
> +    partition at 6c0000 {
> +          compatible = "openwrt,uimage", "denx,uimage";
> +          reg = <0x6c0000 0x1900000>;
> +          label = "firmware";
> +          openwrt,ih-magic = <0x33373033>;
> +          openwrt,ih-type = <IH_TYPE_FILESYSTEM>;
> +    };

Did you check that binding with the dt_binding_check?

Something like:
make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mtd/partitions/openwrt,uimage.yaml
(you may need arch too, e.g. ARCH=arm64)

I think preferred license for yaml (that dt_binding_check checks for) is
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause



More information about the openwrt-devel mailing list