1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 12:42:30 +04:00

[FL-2527] Updater: Migrating to new manifest path convention (#1213)

* Updater: Migrating to new manifest path convention
* RPC: Added update preparation status to RPC
* RPC: bumped protobuf submodule
* Bumped protobuf_version.h
* FuriCore: add missing include. Lib: make mlib smaller
* Explicitly tell where we have doubles and fix random in animations
* makefile: added -DLFS_NO_DEBUG
* Updater: path len constant dedup
* Updater: checking for hardware version match before parsing manifest
* LD: moved _DRIVER_CONTEXT sections to .bss, where they belong.
* LD: avoiding PROBGITS warning, moved _CONTEXT to data
* Updater: Added version check on update package - refusing to install outdated

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
hedger
2022-05-11 12:45:01 +03:00
committed by GitHub
parent dfdc33b076
commit 597ee5b939
32 changed files with 299 additions and 226 deletions

View File

@@ -26,6 +26,7 @@ UpdateManifest* update_manifest_alloc() {
string_init(update_manifest->staged_loader_file);
string_init(update_manifest->resource_bundle);
update_manifest->target = 0;
update_manifest->manifest_version = 0;
memset(update_manifest->ob_reference.bytes, 0, FURI_HAL_FLASH_OB_RAW_SIZE_BYTES);
memset(update_manifest->ob_compare_mask.bytes, 0, FURI_HAL_FLASH_OB_RAW_SIZE_BYTES);
memset(update_manifest->ob_write_mask.bytes, 0, FURI_HAL_FLASH_OB_RAW_SIZE_BYTES);
@@ -49,12 +50,11 @@ static bool
furi_assert(flipper_file);
string_t filetype;
uint32_t version = 0;
// TODO: compare filetype?
string_init(filetype);
update_manifest->valid =
flipper_format_read_header(flipper_file, filetype, &version) &&
flipper_format_read_header(flipper_file, filetype, &update_manifest->manifest_version) &&
flipper_format_read_string(flipper_file, MANIFEST_KEY_INFO, update_manifest->version) &&
flipper_format_read_uint32(
flipper_file, MANIFEST_KEY_TARGET, &update_manifest->target, 1) &&
@@ -68,7 +68,7 @@ static bool
string_clear(filetype);
if(update_manifest->valid) {
/* Optional fields - we can have dfu, radio, or both */
/* Optional fields - we can have dfu, radio, resources, or any combination */
flipper_format_read_string(
flipper_file, MANIFEST_KEY_DFU_FILE, update_manifest->firmware_dfu_image);
flipper_format_read_string(
@@ -131,8 +131,7 @@ static bool ob_data_check_masked_values_valid(
const FuriHalFlashRawOptionByteData* mask) {
bool valid = true;
for(size_t idx = 0; valid && (idx < FURI_HAL_FLASH_OB_TOTAL_VALUES); ++idx) {
valid &= (data->obs[idx]. dword & mask->obs[idx].dword) ==
data->obs[idx].dword;
valid &= (data->obs[idx].dword & mask->obs[idx].dword) == data->obs[idx].dword;
}
return valid;
}