Commit Graph

12 Commits

Author SHA1 Message Date
Richard Hughes
2bbb7d2b40 trivial: Merge some GtkDoc introspection fixes 2020-11-30 09:18:45 +00:00
Richard Hughes
ad69dbbe48 trivial: Fix 'returning FALSE in a pointer function' warning 2020-10-05 22:13:51 +01:00
Richard Hughes
aff64d3e75 trivial: Allow specifying zero-sized data sections
This can be done using '<data/>' to specify a zero-sized image.
2020-09-23 15:22:31 +01:00
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
Richard Hughes
86febb681b trivial: Fix a typo when calling fu_firmware_image_add_string() 2020-03-18 18:57:06 +00:00
Richard Hughes
47862828e1 trivial: Allow setting an ID of NULL for the FuFirmwareImage
There's no reason to prevent NULL, and doing so means the caller has to check
before setting the value. Only one subclassed type was actually doing this...
2020-01-16 11:24:55 -06:00
Mario Limonciello
6b0e66354b Convert libfwupdprivate to a shared library libfwupdplugin 2019-11-27 11:32:43 +00:00