mirror of
https://git.proxmox.com/git/fwupd
synced 2025-07-27 12:30:17 +00:00
Fix fwupdtool firmware-convert to work with image-less formats
Converting 'simple' non-nested formats like Intel Hex into nested formats like DfuSe needs us to create a binary child firmware to avoid missing data. Fixes https://github.com/fwupd/fwupd/issues/5493
This commit is contained in:
parent
2da924d8bc
commit
be33aaaf94
@ -2617,6 +2617,20 @@ fu_util_firmware_convert(FuUtilPrivate *priv, gchar **values, GError **error)
|
||||
fu_firmware_add_image(firmware_dst, img);
|
||||
}
|
||||
|
||||
/* copy data as fallback, preferring a binary blob to the export */
|
||||
if (images->len == 0) {
|
||||
g_autoptr(GBytes) fw = NULL;
|
||||
g_autoptr(FuFirmware) img = NULL;
|
||||
fw = fu_firmware_get_bytes(firmware_src, NULL);
|
||||
if (fw == NULL) {
|
||||
fw = fu_firmware_write(firmware_src, error);
|
||||
if (fw == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
img = fu_firmware_new_from_bytes(fw);
|
||||
fu_firmware_add_image(firmware_dst, img);
|
||||
}
|
||||
|
||||
/* write new file */
|
||||
blob_dst = fu_firmware_write(firmware_dst, error);
|
||||
if (blob_dst == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user