[PATCH 08/10] scripts: Add Barebox TLV Generator Tooling

Sascha Hauer s.hauer at pengutronix.de
Mon Apr 14 08:00:05 PDT 2025


On Fri, Apr 11, 2025 at 09:40:43AM +0200, Ahmad Fatoum wrote:
> From: Chris Fiege <cfi at pengutronix.de>
> 
> This host-tooling creates binaries in the Barebox TLV format.
> It is intended to be used in the factory (either as script or library)
> and creates a tlv binary from a given schema and data.
> 
> For convenience an example schema and dataset are provided.
> 
> diff --git a/scripts/bareboxtlv-generator/requirements.txt b/scripts/bareboxtlv-generator/requirements.txt
> new file mode 100644
> index 000000000000..a1f7e3b3f2a3
> --- /dev/null
> +++ b/scripts/bareboxtlv-generator/requirements.txt
> @@ -0,0 +1,2 @@
> +crcmod
> +pyaml
> diff --git a/scripts/bareboxtlv-generator/schema-example.yaml b/scripts/bareboxtlv-generator/schema-example.yaml
> new file mode 100644
> index 000000000000..4927b869513d
> --- /dev/null
> +++ b/scripts/bareboxtlv-generator/schema-example.yaml
> @@ -0,0 +1,48 @@
> +magic: 0xc6895c21
> +max_size: 0x100

The first thing I tried with this was according to the user
documentation:

./bareboxtlv-generator.py --input-data data-example.yaml schema-example.yaml tlv.bin

And fed that into the barebox tlv command. I ended up with an empty node
because the magic doesn't match.

Can we change the magic to TLV_MAGIC_BAREBOX_V1 in the example and only
add things here that are supposed to be generic? That would make the
example more useful as a starting point.

> +
> +tags:
> +  factory-timestamp:
> +    tag: 0x0003
> +    format: "decimal"
> +    length: 8
> +    example: 1636451762
> +
> +  modification:
> +    tag: 0x0005
> +    format: decimal
> +    length: 1
> +    example: 42
> +    purpose: "0: Device unmodified; 1: Device has undocumented modifications"

0 is unmodified, 1 is modified and 42 is what? ;)

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list