Commit Graph

7 Commits

Author SHA1 Message Date
Richard Hughes
d0b205887a Allow subclassing FuFirmwareImage->build() 2020-09-23 15:22:31 +01:00
Richard Hughes
88dd7c4402 Add fu_firmware_image_get_bytes
Without a 'getter' it's impossible to obtain the raw data for the image
extractor or in a image subclass that wants to add a header or CRC.
2020-09-23 15:22:31 +01:00
Richard Hughes
c43208f3d6 Add fu_firmware_image_get_offset
This allows us to save the image file offset, rather than the destination
address and is really useful for debugging.
2020-09-23 15:22:31 +01:00
Richard Hughes
41400a8cc6 Allow contructing a firmware with multiple images
At the moment there are commands to convert one file format to another, but not
to 'merge' or alter them. Some firmware files are containers which can store
multiple images, each with optional id, idx and addresses.

This would allow us to, for instance, create a DfuSe file with two different
raw files that are flashed to different addresses on the SPI flash. It would
also allow us to create very small complicated container formats for fuzzing.

This can be used by writing a `firmware.builder.xml` file like:

   <?xml version="1.0" encoding="UTF-8"?>
   <firmware gtype="FuBcm57xxFirmware">
     <version>1.2.3</version>
     <image>
       <version>4.5.6</version>
       <id>header</id>
       <idx>456</idx>
       <addr>0x456</addr>
       <filename>header.bin</filename>
     </image>
     <image>
       <version>7.8.9</version>
       <id>payload</id>
       <idx>789</idx>
       <addr>0x789</addr>
       <data>aGVsbG8=</data>
     </image>
   </firmware>

...and then using something like:

   # fwupdtool firmware-convert firmware.builder.xml firmware.dfu builder dfu
2020-09-21 18:11:13 +01:00
Richard Hughes
f17db477eb Tag the FuFirmwareImage objects with the filename
For containers with multiple images it is sometimes very helpful to know what
file they've been loaded from. This would also allow us to 'explode' the
firmware container into seporate image files on disk.
2020-09-21 18:11:13 +01:00
Richard Hughes
366805e18e Add the missing fu_firmware_image_parse()
We provided the FuFirmwareImage->parse() vfunc, but did not provide any way to
actually call it...
2020-09-21 06:58:05 +01:00
Mario Limonciello
6b0e66354b Convert libfwupdprivate to a shared library libfwupdplugin 2019-11-27 11:32:43 +00:00