mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Add debug menu option that dumps the boot flash of iPod 6G to a file
Change-Id: I7d7c3294cb45500297b903c40a3ec93c8a8ea33c
This commit is contained in:
parent
f2ea677b4d
commit
a20fe4a3ff
1 changed files with 32 additions and 0 deletions
|
@ -2714,6 +2714,37 @@ static bool dbg_syscfg(void) {
|
|||
|
||||
return simplelist_show_list(&info);
|
||||
}
|
||||
|
||||
#define FLASH_PAGES (FLASH_SIZE >> 12)
|
||||
#define FLASH_PAGE_SIZE (FLASH_SIZE >> 8)
|
||||
|
||||
static bool dbg_bootflash_dump(void) {
|
||||
splashf(HZ, "Please wait...");
|
||||
|
||||
int fd;
|
||||
|
||||
fd = creat("/bootflash.bin", 0666);
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
splashf(HZ * 3, "Error opening file");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t page[FLASH_PAGE_SIZE];
|
||||
bootflash_init(SPI_PORT);
|
||||
|
||||
for (int i = 0; i < FLASH_PAGES; i++) {
|
||||
bootflash_read(SPI_PORT, i << 12, FLASH_PAGE_SIZE, page);
|
||||
write(fd, page, FLASH_PAGE_SIZE);
|
||||
}
|
||||
|
||||
bootflash_close(SPI_PORT);
|
||||
close(fd);
|
||||
splashf(HZ * 3, "Dump saved to /bootflash.bin");
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****** The menu *********/
|
||||
|
@ -2833,6 +2864,7 @@ static const struct {
|
|||
|
||||
#if defined(IPOD_6G) && !defined(SIMULATOR)
|
||||
{"View SysCfg", dbg_syscfg },
|
||||
{"Dump bootflash to file", dbg_bootflash_dump },
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue