mirror of
https://github.com/CTCaer/hekate.git
synced 2024-12-25 06:18:11 +00:00
Enable exFAT support, don't split files if using it (fsync them instead at 2GiB boundaries), add RawNand dump option
This commit is contained in:
parent
ee30961b3a
commit
8a327030bd
@ -224,7 +224,7 @@
|
||||
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
|
||||
|
||||
|
||||
#define FF_FS_EXFAT 0
|
||||
#define FF_FS_EXFAT 1
|
||||
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
|
||||
/ When enable exFAT, also LFN needs to be enabled.
|
||||
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
|
||||
|
42
ipl/main.c
42
ipl/main.c
@ -389,7 +389,7 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||
char* outFilename = sd_path;
|
||||
u32 sdPathLen = strlen(sd_path);
|
||||
u32 numSplitParts = 0;
|
||||
if (totalSectors > (FAT32_FILESIZE_LIMIT/NX_EMMC_BLOCKSIZE))
|
||||
if ((sd_fs.fs_type != FS_EXFAT) && totalSectors > (FAT32_FILESIZE_LIMIT/NX_EMMC_BLOCKSIZE))
|
||||
{
|
||||
const u32 MULTIPART_SPLIT_SECTORS = MULTIPART_SPLIT_SIZE/NX_EMMC_BLOCKSIZE;
|
||||
numSplitParts = (totalSectors+MULTIPART_SPLIT_SECTORS-1)/MULTIPART_SPLIT_SECTORS;
|
||||
@ -465,6 +465,13 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||
lba_curr += num;
|
||||
totalSectors -= num;
|
||||
bytesWritten += num * NX_EMMC_BLOCKSIZE;
|
||||
|
||||
//force a flush after a lot of data if not splitting
|
||||
if (numSplitParts == 0 && bytesWritten >= MULTIPART_SPLIT_SIZE)
|
||||
{
|
||||
f_sync(&fp);
|
||||
bytesWritten = 0;
|
||||
}
|
||||
}
|
||||
tui_pbar(&gfx_con, 0, gfx_con.y, 100);
|
||||
|
||||
@ -478,7 +485,8 @@ typedef enum
|
||||
{
|
||||
DUMP_BOOT = 1,
|
||||
DUMP_SYSTEM = 2,
|
||||
DUMP_USER = 4
|
||||
DUMP_USER = 4,
|
||||
DUMP_RAW = 8
|
||||
} dumpType_t;
|
||||
|
||||
static void dump_emmc_selected(dumpType_t dumpType)
|
||||
@ -500,6 +508,7 @@ static void dump_emmc_selected(dumpType_t dumpType)
|
||||
goto out;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
if (dumpType & DUMP_BOOT)
|
||||
{
|
||||
static u32 BOOT_PART_SIZE = 0x400000;
|
||||
@ -508,7 +517,7 @@ static void dump_emmc_selected(dumpType_t dumpType)
|
||||
memset(&bootPart, 0, sizeof(bootPart));
|
||||
bootPart.lba_start = 0;
|
||||
bootPart.lba_end = (BOOT_PART_SIZE/NX_EMMC_BLOCKSIZE)-1;
|
||||
for (u32 i=0; i<2; i++)
|
||||
for (i=0; i<2; i++)
|
||||
{
|
||||
memcpy(bootPart.name, "BOOT", 4);
|
||||
bootPart.name[4] = (u8)('0' + i);
|
||||
@ -521,16 +530,16 @@ static void dump_emmc_selected(dumpType_t dumpType)
|
||||
dump_emmc_part(bootPart.name, &storage, &bootPart);
|
||||
gfx_putc(&gfx_con, '\n');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((dumpType & DUMP_SYSTEM) || (dumpType & DUMP_USER))
|
||||
if ((dumpType & DUMP_SYSTEM) || (dumpType & DUMP_USER) || (dumpType & DUMP_RAW))
|
||||
{
|
||||
sdmmc_storage_set_mmc_partition(&storage, 0);
|
||||
|
||||
if ((dumpType & DUMP_SYSTEM) || (dumpType & DUMP_USER))
|
||||
{
|
||||
LIST_INIT(gpt);
|
||||
nx_emmc_gpt_parse(&gpt, &storage);
|
||||
int i = 0;
|
||||
LIST_FOREACH_ENTRY(emmc_part_t, part, &gpt, link)
|
||||
{
|
||||
if ((dumpType & DUMP_USER) == 0 && !strcmp(part->name, "USER"))
|
||||
@ -546,6 +555,25 @@ static void dump_emmc_selected(dumpType_t dumpType)
|
||||
}
|
||||
}
|
||||
|
||||
if (dumpType & DUMP_RAW)
|
||||
{
|
||||
static u64 RAW_AREA_NUM_SECTORS = 0x3A3E000;
|
||||
|
||||
emmc_part_t rawPart;
|
||||
memset(&rawPart, 0, sizeof(rawPart));
|
||||
rawPart.lba_start = 0;
|
||||
rawPart.lba_end = RAW_AREA_NUM_SECTORS-1;
|
||||
strcpy(rawPart.name, "RawNand.bin");
|
||||
{
|
||||
gfx_printf(&gfx_con, "%02d: %s (%08X-%08X)\n", i++,
|
||||
rawPart.name, rawPart.lba_start, rawPart.lba_end);
|
||||
|
||||
dump_emmc_part(rawPart.name, &storage, &rawPart);
|
||||
gfx_putc(&gfx_con, '\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sdmmc_storage_end(&storage);
|
||||
gfx_puts(&gfx_con, "Done.\n");
|
||||
|
||||
@ -557,6 +585,7 @@ out:;
|
||||
void dump_emmc_system() { dump_emmc_selected(DUMP_SYSTEM); }
|
||||
void dump_emmc_user() { dump_emmc_selected(DUMP_USER); }
|
||||
void dump_emmc_boot() { dump_emmc_selected(DUMP_BOOT); }
|
||||
void dump_emmc_rawnand() { dump_emmc_selected(DUMP_RAW); }
|
||||
|
||||
void launch_firmware()
|
||||
{
|
||||
@ -669,6 +698,7 @@ menu_t menu_cinfo = {
|
||||
|
||||
ment_t ment_tools[] = {
|
||||
MDEF_BACK(),
|
||||
MDEF_HANDLER("Dump eMMC RawNand", dump_emmc_rawnand),
|
||||
MDEF_HANDLER("Dump eMMC SYS", dump_emmc_system),
|
||||
MDEF_HANDLER("Dump eMMC USER", dump_emmc_user),
|
||||
MDEF_HANDLER("Dump eMMC BOOT", dump_emmc_boot),
|
||||
|
Loading…
Reference in New Issue
Block a user