Virtual Method

FwupdPluginFirmwarebuild

since: 1.5.0

Declaration [src]

gboolean
build (
  FuFirmware* self,
  XbNode* n,
  GError** error
)

Description [src]

Builds a firmware from an XML manifest. The manifest would typically have the following form:

<?xml version="1.0" encoding="UTF-8"?>
<firmware gtype="FuBcm57xxFirmware">
  <version>1.2.3</version>
  <firmware gtype="FuBcm57xxStage1Image">
    <version>7.8.9</version>
    <id>stage1</id>
    <idx>0x01</idx>
    <filename>stage1.bin</filename>
  </firmware>
  <firmware gtype="FuBcm57xxStage2Image">
    <id>stage2</id>
    <data/> <!-- empty! -->
  </firmware>
  <firmware gtype="FuBcm57xxDictImage">
    <id>ape</id>
    <addr>0x7</addr>
    <data>aGVsbG8gd29ybGQ=</data> <!-- base64 -->
  </firmware>
</firmware>

This would be used in a build-system to merge images from generated files: fwupdtool firmware-build fw.builder.xml test.fw

Static binary content can be specified in the <firmware>/<data> section and is encoded as base64 text if not empty.

Additionally, extra nodes can be included under nested <firmware> objects which can be parsed by the subclassed objects. You should verify the subclassed object FuFirmware->build vfunc for the specific additional options supported.

Plugins should manually g_type_ensure() subclassed image objects if not constructed as part of the plugin fu_plugin_init() or fu_plugin_setup() functions.

Available since: 1.5.0

Parameters

n

Type: XbNode

A Xmlb node.

The data is owned by the caller of the method.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the virtual function if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gboolean

TRUE for success.