Looking for custom tlv documentation #2273
-
|
I am trying to add additional data to my images, which should be used as an additional information about whether the image should be booted or not (one hardware with one bootloader becoming different devices later in the production process). So the data should be combined with the image and needs to be signed as part of the image. But which tags are actually free to use? @michalek-no maybe you can shed some light on this since it looks like you added the info about that option recently. So I guess you worked with it as well? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
|
The list of the TLV types used by MCUboot can be found in image.h. In that header, there are areas defined for vendor-specific types: mcuboot/boot/bootutil/include/bootutil/image.h Lines 134 to 143 in 6cbea0a The API for iterating over the TLVs of an image can be found at the end of the same header. |
Beta Was this translation helpful? Give feedback.
-
|
For those who are wondering how this is done, I actually took matters into my own hands and tried doing it myself. I may have to do this because my application will likely be keeping firmware images in LittleFS, then when an OTA update is to be performed, it'll copy one of those images to the I coded up a simple Python script that demonstrates what's needed: Zephyr gives you an Intel hex file in I've got an image with some custom TLVs here, when I run my script I get output like the following: How does this get done in C? I haven't written that yet, but a rough guide on what needs to happen: Firmware image layoutAll data from the beginning of the image up to the unprotected TLV header is For single-image projects, we verify the image and protected TLVs, we hash That hash is then digitally signed with a ECDSA key, the result of which is Reading TLVsTo read TLVs, there are some functions in
Consequently, we've had to go the "Not Invented Here" route and re-invent The following is a description of the process for reading an image. Note The first 32 bytes of the image binary is the MCUBoot image header. This
We must check that Each region begins with a TLV Info header which has the following structure:
We jump to offset
At this point, we either know where the protected TLV region is, or know
We now know the address ranges of our TLV regions. To find a particular
So that's what I've found out by digging through the code today and trying a few experiments, and if your use case falls outside of what MCUBoot's APIs permit, that might get you a little further. C implementations should probably include the |
Beta Was this translation helpful? Give feedback.
The list of the TLV types used by MCUboot can be found in image.h. In that header, there are areas defined for vendor-specific types:
mcuboot/boot/bootutil/include/bootutil/image.h
Lines 134 to 143 in 6cbea0a
The API for iterating over the TLVs of an image can be found at the end of the same header.