mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Merge remote-tracking branch 'ofw/dev' into mntm-dev
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#include <toolbox/tar/tar_archive.h>
|
||||
#include <toolbox/args.h>
|
||||
#include <update_util/update_manifest.h>
|
||||
#include <update_util/lfs_backup.h>
|
||||
#include <update_util/int_backup.h>
|
||||
#include <update_util/update_operation.h>
|
||||
|
||||
typedef void (*cmd_handler)(FuriString* args);
|
||||
@@ -35,7 +35,7 @@ static void updater_cli_install(FuriString* manifest_path) {
|
||||
static void updater_cli_backup(FuriString* args) {
|
||||
printf("Backup /int to '%s'\r\n", furi_string_get_cstr(args));
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
bool success = lfs_backup_create(storage, furi_string_get_cstr(args));
|
||||
bool success = int_backup_create(storage, furi_string_get_cstr(args));
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
printf("Result: %s\r\n", success ? "OK" : "FAIL");
|
||||
}
|
||||
@@ -43,7 +43,7 @@ static void updater_cli_backup(FuriString* args) {
|
||||
static void updater_cli_restore(FuriString* args) {
|
||||
printf("Restore /int from '%s'\r\n", furi_string_get_cstr(args));
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
bool success = lfs_backup_unpack(storage, furi_string_get_cstr(args));
|
||||
bool success = int_backup_unpack(storage, furi_string_get_cstr(args));
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
printf("Result: %s\r\n", success ? "OK" : "FAIL");
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ static const char* update_task_stage_descr[] = {
|
||||
[UpdateTaskStageRadioInstall] = "Installing radio FW",
|
||||
[UpdateTaskStageRadioBusy] = "Core 2 busy",
|
||||
[UpdateTaskStageOBValidation] = "Validating opt. bytes",
|
||||
[UpdateTaskStageLfsBackup] = "Backing up LFS",
|
||||
[UpdateTaskStageLfsRestore] = "Restoring LFS",
|
||||
[UpdateTaskStageIntBackup] = "Backing up configuration",
|
||||
[UpdateTaskStageIntRestore] = "Restoring configuration",
|
||||
[UpdateTaskStageResourcesFileCleanup] = "Cleaning up files",
|
||||
[UpdateTaskStageResourcesDirCleanup] = "Cleaning up directories",
|
||||
[UpdateTaskStageResourcesFileUnpack] = "Extracting resources",
|
||||
@@ -82,7 +82,7 @@ static const struct {
|
||||
},
|
||||
#ifndef FURI_RAM_EXEC
|
||||
{
|
||||
.stage = UpdateTaskStageLfsBackup,
|
||||
.stage = UpdateTaskStageIntBackup,
|
||||
.percent_min = 0,
|
||||
.percent_max = 100,
|
||||
.descr = "FS R/W error",
|
||||
@@ -193,10 +193,10 @@ static const struct {
|
||||
#endif
|
||||
#ifndef FURI_RAM_EXEC
|
||||
{
|
||||
.stage = UpdateTaskStageLfsRestore,
|
||||
.stage = UpdateTaskStageIntRestore,
|
||||
.percent_min = 0,
|
||||
.percent_max = 100,
|
||||
.descr = "LFS I/O error",
|
||||
.descr = "SD card I/O error",
|
||||
},
|
||||
{
|
||||
.stage = UpdateTaskStageResourcesFileCleanup,
|
||||
@@ -245,7 +245,7 @@ static const UpdateTaskStageGroupMap update_task_stage_progress[] = {
|
||||
[UpdateTaskStageProgress] = STAGE_DEF(UpdateTaskStageGroupMisc, 0),
|
||||
|
||||
[UpdateTaskStageReadManifest] = STAGE_DEF(UpdateTaskStageGroupPreUpdate, 45),
|
||||
[UpdateTaskStageLfsBackup] = STAGE_DEF(UpdateTaskStageGroupPreUpdate, 5),
|
||||
[UpdateTaskStageIntBackup] = STAGE_DEF(UpdateTaskStageGroupPreUpdate, 5),
|
||||
|
||||
[UpdateTaskStageRadioImageValidate] = STAGE_DEF(UpdateTaskStageGroupRadio, 15),
|
||||
[UpdateTaskStageRadioErase] = STAGE_DEF(UpdateTaskStageGroupRadio, 25),
|
||||
@@ -259,7 +259,7 @@ static const UpdateTaskStageGroupMap update_task_stage_progress[] = {
|
||||
[UpdateTaskStageFlashWrite] = STAGE_DEF(UpdateTaskStageGroupFirmware, 100),
|
||||
[UpdateTaskStageFlashValidate] = STAGE_DEF(UpdateTaskStageGroupFirmware, 20),
|
||||
|
||||
[UpdateTaskStageLfsRestore] = STAGE_DEF(UpdateTaskStageGroupPostUpdate, 5),
|
||||
[UpdateTaskStageIntRestore] = STAGE_DEF(UpdateTaskStageGroupPostUpdate, 5),
|
||||
|
||||
[UpdateTaskStageResourcesFileCleanup] = STAGE_DEF(UpdateTaskStageGroupResources, 100),
|
||||
[UpdateTaskStageResourcesDirCleanup] = STAGE_DEF(UpdateTaskStageGroupResources, 50),
|
||||
|
||||
@@ -16,7 +16,7 @@ typedef enum {
|
||||
UpdateTaskStageProgress = 0,
|
||||
|
||||
UpdateTaskStageReadManifest,
|
||||
UpdateTaskStageLfsBackup,
|
||||
UpdateTaskStageIntBackup,
|
||||
|
||||
UpdateTaskStageRadioImageValidate,
|
||||
UpdateTaskStageRadioErase,
|
||||
@@ -30,7 +30,7 @@ typedef enum {
|
||||
UpdateTaskStageFlashWrite,
|
||||
UpdateTaskStageFlashValidate,
|
||||
|
||||
UpdateTaskStageLfsRestore,
|
||||
UpdateTaskStageIntRestore,
|
||||
UpdateTaskStageResourcesFileCleanup,
|
||||
UpdateTaskStageResourcesDirCleanup,
|
||||
UpdateTaskStageResourcesFileUnpack,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <desktop/views/desktop_view_slideshow.h>
|
||||
#include <toolbox/path.h>
|
||||
#include <update_util/dfu_file.h>
|
||||
#include <update_util/lfs_backup.h>
|
||||
#include <update_util/int_backup.h>
|
||||
#include <update_util/update_operation.h>
|
||||
#include <update_util/resources/manifest.h>
|
||||
#include <toolbox/tar/tar_archive.h>
|
||||
@@ -23,14 +23,14 @@ static bool update_task_pre_update(UpdateTask* update_task) {
|
||||
backup_file_path = furi_string_alloc();
|
||||
path_concat(
|
||||
furi_string_get_cstr(update_task->update_path),
|
||||
LFS_BACKUP_DEFAULT_FILENAME,
|
||||
INT_BACKUP_DEFAULT_FILENAME,
|
||||
backup_file_path);
|
||||
|
||||
update_task_set_progress(update_task, UpdateTaskStageLfsBackup, 0);
|
||||
update_task_set_progress(update_task, UpdateTaskStageIntBackup, 0);
|
||||
/* to avoid bootloops */
|
||||
furi_hal_rtc_set_boot_mode(FuriHalRtcBootModeNormal);
|
||||
if((success =
|
||||
lfs_backup_create(update_task->storage, furi_string_get_cstr(backup_file_path)))) {
|
||||
int_backup_create(update_task->storage, furi_string_get_cstr(backup_file_path)))) {
|
||||
furi_hal_rtc_set_boot_mode(FuriHalRtcBootModeUpdate);
|
||||
}
|
||||
|
||||
@@ -131,12 +131,12 @@ static bool update_task_post_update(UpdateTask* update_task) {
|
||||
do {
|
||||
path_concat(
|
||||
furi_string_get_cstr(update_task->update_path),
|
||||
LFS_BACKUP_DEFAULT_FILENAME,
|
||||
INT_BACKUP_DEFAULT_FILENAME,
|
||||
file_path);
|
||||
|
||||
update_task_set_progress(update_task, UpdateTaskStageLfsRestore, 0);
|
||||
update_task_set_progress(update_task, UpdateTaskStageIntRestore, 0);
|
||||
|
||||
CHECK_RESULT(lfs_backup_unpack(update_task->storage, furi_string_get_cstr(file_path)));
|
||||
CHECK_RESULT(int_backup_unpack(update_task->storage, furi_string_get_cstr(file_path)));
|
||||
|
||||
// Fix flags for production / development
|
||||
#ifdef FURI_DEBUG
|
||||
|
||||
@@ -341,7 +341,7 @@ int32_t update_task_worker_flash_writer(void* context) {
|
||||
}
|
||||
|
||||
furi_hal_rtc_set_boot_mode(FuriHalRtcBootModePostUpdate);
|
||||
// Format LFS before restoring backup on next boot
|
||||
// Clean up /int before restoring backup on next boot
|
||||
furi_hal_rtc_set_flag(FuriHalRtcFlagStorageFormatInternal);
|
||||
|
||||
update_task_set_progress(update_task, UpdateTaskStageCompleted, 100);
|
||||
|
||||
Reference in New Issue
Block a user