mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-22 12:51:39 +03:00
[FL-3882] Clean up of LFS traces (#3849)
* updater, storage: removed mentions of LFS from public APIs; updated corresponding strings * rpc: updated include path Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
c9791a280a
commit
feb1b2f349
@ -7,7 +7,7 @@
|
||||
#include <storage/storage.h>
|
||||
#include <lib/toolbox/md5_calc.h>
|
||||
#include <lib/toolbox/path.h>
|
||||
#include <update_util/lfs_backup.h>
|
||||
#include <update_util/int_backup.h>
|
||||
#include <toolbox/tar/tar_archive.h>
|
||||
|
||||
#include <pb_decode.h>
|
||||
@ -656,7 +656,7 @@ static void rpc_system_storage_backup_create_process(const PB_Main* request, voi
|
||||
|
||||
rpc_system_storage_reset_state(rpc_storage, session, true);
|
||||
|
||||
bool backup_ok = lfs_backup_create(
|
||||
bool backup_ok = int_backup_create(
|
||||
rpc_storage->api, request->content.storage_backup_create_request.archive_path);
|
||||
|
||||
rpc_send_and_release_empty(
|
||||
@ -676,7 +676,7 @@ static void rpc_system_storage_backup_restore_process(const PB_Main* request, vo
|
||||
|
||||
rpc_system_storage_reset_state(rpc_storage, session, true);
|
||||
|
||||
bool backup_ok = lfs_backup_unpack(
|
||||
bool backup_ok = int_backup_unpack(
|
||||
rpc_storage->api, request->content.storage_backup_restore_request.archive_path);
|
||||
|
||||
rpc_send_and_release_empty(
|
||||
|
@ -504,7 +504,7 @@ FS_Error storage_sd_info(Storage* storage, SDInfo* info);
|
||||
*/
|
||||
FS_Error storage_sd_status(Storage* storage);
|
||||
|
||||
/******************* Internal LFS Functions *******************/
|
||||
/************ Internal Storage Backup/Restore ************/
|
||||
|
||||
typedef void (*StorageNameConverter)(FuriString*);
|
||||
|
||||
|
@ -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/helpers/slideshow_filename.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>
|
||||
@ -21,14 +21,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);
|
||||
}
|
||||
|
||||
@ -145,12 +145,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)));
|
||||
|
||||
if(update_task->state.groups & UpdateTaskStageGroupResources) {
|
||||
TarUnpackProgress progress = {
|
||||
|
@ -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);
|
||||
#ifdef FURI_NDEBUG
|
||||
// Production
|
||||
|
@ -83,7 +83,7 @@ Even if something goes wrong, updater allows you to retry failed operations and
|
||||
| | | **50** | Package has mismatching HW target |
|
||||
| | | **60** | Missing DFU file |
|
||||
| | | **80** | Missing radio firmware file |
|
||||
| Backing up LFS | **2** | **0-100** | FS read/write error |
|
||||
| Backing up configuration| **2** | **0-100** | FS read/write error |
|
||||
| Checking radio FW | **3** | **0-99** | Error reading radio firmware file |
|
||||
| | | **100** | CRC mismatch |
|
||||
| Uninstalling radio FW | **4** | **0** | SHCI Delete command error |
|
||||
@ -101,7 +101,7 @@ Even if something goes wrong, updater allows you to retry failed operations and
|
||||
| | | **99-100** | Corrupted DFU file |
|
||||
| Writing flash | **10** | **0-100** | Block read/write error |
|
||||
| Validating flash | **11** | **0-100** | Block read/write error |
|
||||
| Restoring LFS | **12** | **0-100** | FS read/write error |
|
||||
| Restoring configuration | **12** | **0-100** | FS read/write error |
|
||||
| Updating resources | **13-15** | **0-100** | SD card read/write error |
|
||||
|
||||
## Building update packages
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "lfs_backup.h"
|
||||
#include "int_backup.h"
|
||||
|
||||
#include <toolbox/tar/tar_archive.h>
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#include <desktop/desktop_settings_filename.h>
|
||||
#include <notification/notification_settings_filename.h>
|
||||
|
||||
#define LFS_BACKUP_DEFAULT_LOCATION EXT_PATH(LFS_BACKUP_DEFAULT_FILENAME)
|
||||
#define INT_BACKUP_DEFAULT_LOCATION EXT_PATH(INT_BACKUP_DEFAULT_FILENAME)
|
||||
|
||||
static void backup_name_converter(FuriString* filename) {
|
||||
if(furi_string_empty(filename) || (furi_string_get_char(filename, 0) == '.')) {
|
||||
@ -34,18 +34,18 @@ static void backup_name_converter(FuriString* filename) {
|
||||
}
|
||||
}
|
||||
|
||||
bool lfs_backup_create(Storage* storage, const char* destination) {
|
||||
bool int_backup_create(Storage* storage, const char* destination) {
|
||||
const char* final_destination =
|
||||
destination && strlen(destination) ? destination : LFS_BACKUP_DEFAULT_LOCATION;
|
||||
destination && strlen(destination) ? destination : INT_BACKUP_DEFAULT_LOCATION;
|
||||
return storage_int_backup(storage, final_destination) == FSE_OK;
|
||||
}
|
||||
|
||||
bool lfs_backup_exists(Storage* storage, const char* source) {
|
||||
const char* final_source = source && strlen(source) ? source : LFS_BACKUP_DEFAULT_LOCATION;
|
||||
bool int_backup_exists(Storage* storage, const char* source) {
|
||||
const char* final_source = source && strlen(source) ? source : INT_BACKUP_DEFAULT_LOCATION;
|
||||
return storage_common_stat(storage, final_source, NULL) == FSE_OK;
|
||||
}
|
||||
|
||||
bool lfs_backup_unpack(Storage* storage, const char* source) {
|
||||
const char* final_source = source && strlen(source) ? source : LFS_BACKUP_DEFAULT_LOCATION;
|
||||
bool int_backup_unpack(Storage* storage, const char* source) {
|
||||
const char* final_source = source && strlen(source) ? source : INT_BACKUP_DEFAULT_LOCATION;
|
||||
return storage_int_restore(storage, final_source, backup_name_converter) == FSE_OK;
|
||||
}
|
18
lib/update_util/int_backup.h
Normal file
18
lib/update_util/int_backup.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define INT_BACKUP_DEFAULT_FILENAME "backup.tar"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool int_backup_create(Storage* storage, const char* destination);
|
||||
bool int_backup_exists(Storage* storage, const char* source);
|
||||
bool int_backup_unpack(Storage* storage, const char* source);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define LFS_BACKUP_DEFAULT_FILENAME "backup.tar"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool lfs_backup_create(Storage* storage, const char* destination);
|
||||
bool lfs_backup_exists(Storage* storage, const char* source);
|
||||
bool lfs_backup_unpack(Storage* storage, const char* source);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -9,6 +9,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <datetime/datetime.h>
|
||||
#include <core/common_defines.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -44,7 +45,7 @@ typedef enum {
|
||||
FuriHalRtcRegisterHeader, /**< RTC structure header */
|
||||
FuriHalRtcRegisterSystem, /**< Various system bits */
|
||||
FuriHalRtcRegisterVersion, /**< Pointer to Version */
|
||||
FuriHalRtcRegisterLfsFingerprint, /**< LFS geometry fingerprint */
|
||||
FuriHalRtcRegisterLfsFingerprint FURI_DEPRECATED, /**< LFS geometry fingerprint */
|
||||
FuriHalRtcRegisterFaultData, /**< Pointer to last fault message */
|
||||
FuriHalRtcRegisterPinFails, /**< Failed PINs count */
|
||||
/* Index of FS directory entry corresponding to FW update to be applied */
|
||||
|
Loading…
Reference in New Issue
Block a user