mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-29 21:12:06 +00:00
sept: Create sept folder if missing
This commit is contained in:
parent
e7f8b2c6c2
commit
281e5a138e
2 changed files with 12 additions and 6 deletions
|
@ -202,19 +202,22 @@ int reboot_to_sept(const u8 *tsec_fw, u32 kb, ini_sec_t *cfg_sec)
|
||||||
memcpy(tmp_cfg, &b_cfg, sizeof(boot_cfg_t));
|
memcpy(tmp_cfg, &b_cfg, sizeof(boot_cfg_t));
|
||||||
f_lseek(&fp, PATCHED_RELOC_SZ);
|
f_lseek(&fp, PATCHED_RELOC_SZ);
|
||||||
f_write(&fp, tmp_cfg, sizeof(boot_cfg_t), NULL);
|
f_write(&fp, tmp_cfg, sizeof(boot_cfg_t), NULL);
|
||||||
f_close(&fp);
|
|
||||||
update_sept_payload = false;
|
update_sept_payload = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f_close(&fp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
f_close(&fp);
|
||||||
f_rename("sept/payload.bin", "sept/payload.bak"); // Backup foreign payload.
|
f_rename("sept/payload.bin", "sept/payload.bak"); // Backup foreign payload.
|
||||||
|
}
|
||||||
f_close(&fp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_sept_payload)
|
if (update_sept_payload)
|
||||||
{
|
{
|
||||||
volatile reloc_meta_t *reloc = (reloc_meta_t *)(IPL_LOAD_ADDR + RELOC_META_OFF);
|
volatile reloc_meta_t *reloc = (reloc_meta_t *)(IPL_LOAD_ADDR + RELOC_META_OFF);
|
||||||
|
f_mkdir("sept");
|
||||||
f_open(&fp, "sept/payload.bin", FA_WRITE | FA_CREATE_ALWAYS);
|
f_open(&fp, "sept/payload.bin", FA_WRITE | FA_CREATE_ALWAYS);
|
||||||
f_write(&fp, (u8 *)reloc->start, reloc->end - reloc->start, NULL);
|
f_write(&fp, (u8 *)reloc->start, reloc->end - reloc->start, NULL);
|
||||||
f_close(&fp);
|
f_close(&fp);
|
||||||
|
|
|
@ -182,19 +182,22 @@ int reboot_to_sept(const u8 *tsec_fw, u32 kb)
|
||||||
memcpy(tmp_cfg, (boot_cfg_t *)b_cfg, sizeof(boot_cfg_t));
|
memcpy(tmp_cfg, (boot_cfg_t *)b_cfg, sizeof(boot_cfg_t));
|
||||||
f_lseek(&fp, PATCHED_RELOC_SZ);
|
f_lseek(&fp, PATCHED_RELOC_SZ);
|
||||||
f_write(&fp, tmp_cfg, sizeof(boot_cfg_t), NULL);
|
f_write(&fp, tmp_cfg, sizeof(boot_cfg_t), NULL);
|
||||||
f_close(&fp);
|
|
||||||
update_sept_payload = false;
|
update_sept_payload = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f_close(&fp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
f_close(&fp);
|
||||||
f_rename("sept/payload.bin", "sept/payload.bak"); // Backup foreign payload.
|
f_rename("sept/payload.bin", "sept/payload.bak"); // Backup foreign payload.
|
||||||
|
}
|
||||||
f_close(&fp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_sept_payload)
|
if (update_sept_payload)
|
||||||
{
|
{
|
||||||
volatile reloc_meta_t *reloc = (reloc_meta_t *)(nyx_str->hekate + RELOC_META_OFF);
|
volatile reloc_meta_t *reloc = (reloc_meta_t *)(nyx_str->hekate + RELOC_META_OFF);
|
||||||
|
f_mkdir("sept");
|
||||||
f_open(&fp, "sept/payload.bin", FA_WRITE | FA_CREATE_ALWAYS);
|
f_open(&fp, "sept/payload.bin", FA_WRITE | FA_CREATE_ALWAYS);
|
||||||
f_write(&fp, (u8 *)nyx_str->hekate, reloc->end - reloc->start, NULL);
|
f_write(&fp, (u8 *)nyx_str->hekate, reloc->end - reloc->start, NULL);
|
||||||
f_close(&fp);
|
f_close(&fp);
|
||||||
|
|
Loading…
Reference in a new issue