fwtool: add utility for appending and extracting firmware metadata/signatures
authorFelix Fietkau <nbd@nbd.name>
Mon, 14 Nov 2016 15:02:46 +0000 (16:02 +0100)
committerFelix Fietkau <nbd@nbd.name>
Sat, 19 Nov 2016 10:24:09 +0000 (11:24 +0100)
commit929641fa1fb23942581f64e6fa75ba87ba6111af
tree7770a34a417f1cf445e9323fc165260c0ea1a4b6
parent5e339a48aa95b4c7702829c09a99ccf3b99aad3e
fwtool: add utility for appending and extracting firmware metadata/signatures

This will be used to append extra information to images which allows the
system to verify if an image is compatible with the system.

The extra data is appended to the end of the image, where it will be
ignored when upgrading from systems that do not process this data yet:

If the image is a squashfs or jffs2 image, the extra data will land
after the end-of-filesystem marker, where it will be overwritten once
the system boots for the first timee.

If the image is a sysupgrade tar file, tar will simply ignore the extra
data when unpacking.

The layout of the metadata/signature chunks is constructed in a way
that the last part contains just a magic and size information, so that
the tool can quickly check if any valid data is present without having
to do a pattern search throughout the full image.

Chunks also contain CRC32 information to detect file corruption, even
when the image is not signed.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/system/fwtool/Makefile [new file with mode: 0644]
package/system/fwtool/src/crc32.h [new file with mode: 0644]
package/system/fwtool/src/fwimage.h [new file with mode: 0644]
package/system/fwtool/src/fwtool.c [new file with mode: 0644]
package/system/fwtool/src/utils.h [new file with mode: 0644]