From 9bbe08f3ec4c7546fdb5f5599755f6101294dc19 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sat, 19 Mar 2022 19:38:29 +0000 Subject: x1000: bootloader: add whole-chip flash dump option I don't expect this will be all that useful, but why not... Change-Id: Ieb486bb719c5cc61e0f3e95f9fb603a1c30c6528 --- bootloader/x1000/recovery.c | 1 + bootloader/x1000/utils.c | 8 ++++++++ bootloader/x1000/x1000bootloader.h | 1 + 3 files changed, 10 insertions(+) diff --git a/bootloader/x1000/recovery.c b/bootloader/x1000/recovery.c index 369244209e..d70c3b9305 100644 --- a/bootloader/x1000/recovery.c +++ b/bootloader/x1000/recovery.c @@ -71,6 +71,7 @@ static const struct menuitem debug_menu_items[] = { #ifdef OF_RECOVERY_ADDR {MENUITEM_ACTION, "Dump OF recovery", &dump_of_recovery}, #endif + {MENUITEM_ACTION, "Dump entire flash", &dump_entire_flash}, {MENUITEM_ACTION, "Main menu", &to_main_menu}, }; diff --git a/bootloader/x1000/utils.c b/bootloader/x1000/utils.c index 1b56bdf50a..837160a113 100644 --- a/bootloader/x1000/utils.c +++ b/bootloader/x1000/utils.c @@ -250,3 +250,11 @@ void dump_of_recovery(void) dump_flash_file("/of_recovery.img", OF_RECOVERY_ADDR, OF_RECOVERY_LENGTH); #endif } + +void dump_entire_flash(void) +{ +#if defined(FIIO_M3K) || defined(SHANLING_Q1) || defined(EROS_QN) + /* TODO: this should read the real chip size instead of hardcoding it */ + dump_flash_file("/flash.img", 0, 2048 * 64 * 1024); +#endif +} diff --git a/bootloader/x1000/x1000bootloader.h b/bootloader/x1000/x1000bootloader.h index a7c9927f1b..f6231bbd54 100644 --- a/bootloader/x1000/x1000bootloader.h +++ b/bootloader/x1000/x1000bootloader.h @@ -171,6 +171,7 @@ int dump_flash(int fd, uint32_t addr, uint32_t length); int dump_flash_file(const char* file, uint32_t addr, uint32_t length); void dump_of_player(void); void dump_of_recovery(void); +void dump_entire_flash(void); void recovery_menu(void) __attribute__((noreturn)); -- cgit v1.2.3