Commit Graph

8 Commits

Author SHA1 Message Date
Richard Hughes
1981c63d58 Remove FuFirmwareImage and just use FuFirmware instead
This allows us to 'nest' firmware formats, and removes a ton of duplication.

The aim here is to deprecate FuFirmwareImage -- it's almost always acting
as a 'child' FuFirmware instance, and even copies most of the vfuncs to allow
custom types. If I'm struggling to work out what should be a FuFirmware and
what should be a FuFirmwareImage then a plugin author has no hope.

For simple payloads we were adding bytes into an image and then the image into
a firmware. This gets really messy when most plugins are treating the FuFirmware
*as* the binary firmware file.

The GBytes saved in the FuFirmware would be considered the payload with the
aim of not using FuFirmwareImage in the single-image case.
2021-03-09 21:14:12 +00:00
Benson Leung
72aea1f8ed cros-ec: Save new firmware version on successful write 2020-08-28 10:48:03 -07:00
Benson Leung
4ed2400cab cros-ec: Store image_idx in section
Makes it a bit easier to retrieve the image later.
2020-07-09 07:44:19 +01:00
Benson Leung
9326e19118 cros-ec: Give cros-ec-firmware a get_sections
Add a getter for the sections.
2020-07-09 07:44:19 +01:00
Benson Leung
d0cd862acf cros-ec: Add fu_cros_ec_firmware_pick_sections
Add this to allow the usb-device to mark which section of the firmware
image is writeable by setting the section's ustatus to FU_CROS_EC_FW_NEEDED.
2020-07-09 07:44:19 +01:00
Benson Leung
befd9a420e cros-ec: Convert cros-ec-firmware's sections to GPtrArray 2020-07-09 07:44:19 +01:00
Richard Hughes
d9f3bec6d0 trivial: Fix GtkDoc issue with FuFmapFirmware 2020-06-29 15:49:14 +01:00
Benson Leung
3a02ad5129 cros-ec: Add cros-ec-firmware
cros-ec firmware are in fmap layout, and have two sections
that this plugin will look for, the EC_RO, and EC_RW sections.

Tested using a servo_micro firmware:
$ fwupdtool firmware-parse servo_micro_v2.4.17-df61092c3.bin
<select fmap option>
FuCrosEcFirmware:
Version:                 2.4.17
  FuFirmwareImage:
  ID:                    EC_RO
  Index:                 0x1
  Version:               servo_micro_v2.4.17-df61092c3
  Data:                  0xf000
  FuFirmwareImage:
  ID:                    FR_MAIN
  Index:                 0x2
  Data:                  0xf000
  FuFirmwareImage:
  ID:                    RO_FRID
  Index:                 0x3
  Address:               0xc4
  Data:                  0x20
  FuFirmwareImage:
  ID:                    FMAP
  Index:                 0x4
  Address:               0x9a40
  Version:               1.0
  Data:                  0x15e
  FuFirmwareImage:
  ID:                    WP_RO
  Index:                 0x5
  Data:                  0x10000
  FuFirmwareImage:
  ID:                    EC_RW
  Index:                 0x6
  Address:               0x10000
  Version:               servo_micro_v2.4.17-df61092c3
  Data:                  0x10000
  FuFirmwareImage:
  ID:                    RW_FWID
  Index:                 0x7
  Address:               0x100c4
  Data:                  0x20
2020-06-20 07:24:32 +01:00