2022-04-13 20:50:25 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <m-string.h>
|
2022-04-27 15:53:48 +00:00
|
|
|
#include <furi_hal_flash.h>
|
2022-04-13 20:50:25 +00:00
|
|
|
|
2022-07-26 12:21:51 +00:00
|
|
|
/* Paths don't include /ext -- because at startup SD card is mounted as FS root */
|
2022-04-13 20:50:25 +00:00
|
|
|
#define UPDATE_MANIFEST_DEFAULT_NAME "update.fuf"
|
2022-05-11 09:45:01 +00:00
|
|
|
#define UPDATE_MANIFEST_POINTER_FILE_NAME ".fupdate"
|
2022-04-13 20:50:25 +00:00
|
|
|
|
2022-04-27 15:53:48 +00:00
|
|
|
typedef union {
|
|
|
|
uint8_t raw[6];
|
|
|
|
struct {
|
|
|
|
uint8_t major;
|
|
|
|
uint8_t minor;
|
|
|
|
uint8_t sub;
|
|
|
|
uint8_t branch;
|
|
|
|
uint8_t release;
|
|
|
|
uint8_t type;
|
|
|
|
} version;
|
|
|
|
} UpdateManifestRadioVersion;
|
|
|
|
_Static_assert(sizeof(UpdateManifestRadioVersion) == 6, "UpdateManifestRadioVersion size error");
|
|
|
|
|
2022-04-13 20:50:25 +00:00
|
|
|
typedef struct {
|
2022-05-11 09:45:01 +00:00
|
|
|
uint32_t manifest_version;
|
2022-04-13 20:50:25 +00:00
|
|
|
string_t version;
|
|
|
|
uint32_t target;
|
|
|
|
string_t staged_loader_file;
|
|
|
|
uint32_t staged_loader_crc;
|
|
|
|
string_t firmware_dfu_image;
|
|
|
|
string_t radio_image;
|
|
|
|
uint32_t radio_address;
|
2022-04-27 15:53:48 +00:00
|
|
|
UpdateManifestRadioVersion radio_version;
|
2022-04-19 08:03:28 +00:00
|
|
|
uint32_t radio_crc;
|
|
|
|
string_t resource_bundle;
|
2022-04-27 15:53:48 +00:00
|
|
|
FuriHalFlashRawOptionByteData ob_reference;
|
|
|
|
FuriHalFlashRawOptionByteData ob_compare_mask;
|
|
|
|
FuriHalFlashRawOptionByteData ob_write_mask;
|
2022-06-21 14:11:34 +00:00
|
|
|
string_t splash_file;
|
2022-04-13 20:50:25 +00:00
|
|
|
bool valid;
|
|
|
|
} UpdateManifest;
|
|
|
|
|
|
|
|
UpdateManifest* update_manifest_alloc();
|
|
|
|
|
|
|
|
void update_manifest_free(UpdateManifest* update_manifest);
|
|
|
|
|
|
|
|
bool update_manifest_init(UpdateManifest* update_manifest, const char* manifest_filename);
|
|
|
|
|
|
|
|
bool update_manifest_init_mem(
|
|
|
|
UpdateManifest* update_manifest,
|
|
|
|
const uint8_t* manifest_data,
|
|
|
|
const uint16_t length);
|
|
|
|
|
2022-04-27 15:53:48 +00:00
|
|
|
bool update_manifest_has_obdata(UpdateManifest* update_manifest);
|
|
|
|
|
2022-04-13 20:50:25 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2022-05-06 13:37:10 +00:00
|
|
|
#endif
|