Constructor
FwupdPluginFirmwarenew_from_xml
since: 2.1.1
Declaration [src]
FuFirmware*
fu_firmware_new_from_xml (
const gchar* xml,
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.
Firmware subclasses should use fu_firmware_add_image_gtype() for subclassed image objects.
Available since: 2.1.1
Parameters
xml-
Type:
const gchar*XML text.
The data is owned by the caller of the function. The value is a NUL terminated UTF-8 string. 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 aNULLGError*.The argument will be left initialized to NULLby the constructor 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: FuFirmware
TRUE for success.
| The caller of the function takes ownership of the data, and is responsible for freeing it. |