config: Add bootloader protection

`bootprotect=1` enables protection of the `bootloader` folder inside HOS.

This disallows any reading/writing of the folder and its contents inside HOS, preventing any corruption of it.

This of course has the side-effect of homebrew that depend on it (e.g. hekate Toolbox) to not work fully.
This commit is contained in:
CTCaer
2020-10-20 10:16:12 +03:00
parent bf222290b8
commit 2f5b52223c
7 changed files with 30 additions and 42 deletions

View File

@@ -42,8 +42,7 @@ void set_default_configuration()
h_cfg.autohosoff = 0;
h_cfg.autonogc = 1;
h_cfg.updater2p = 0;
h_cfg.brand = NULL;
h_cfg.tagline = NULL;
h_cfg.bootprotect = 0;
h_cfg.errors = 0;
h_cfg.eks = NULL;
h_cfg.sept_run = EMC(EMC_SCRATCH0) & EMC_SEPT_RUN;
@@ -118,16 +117,9 @@ int create_config_entry()
f_puts("\nupdater2p=", &fp);
itoa(h_cfg.updater2p, lbuf, 10);
f_puts(lbuf, &fp);
if (h_cfg.brand)
{
f_puts("\nbrand=", &fp);
f_puts(h_cfg.brand, &fp);
}
if (h_cfg.tagline)
{
f_puts("\ntagline=", &fp);
f_puts(h_cfg.tagline, &fp);
}
f_puts("\nbootprotect=", &fp);
itoa(h_cfg.bootprotect, lbuf, 10);
f_puts(lbuf, &fp);
f_puts("\n", &fp);
if (mainIniFound)

View File

@@ -30,8 +30,7 @@ typedef struct _hekate_config
u32 autohosoff;
u32 autonogc;
u32 updater2p;
char *brand;
char *tagline;
u32 bootprotect;
// Global temporary config.
bool se_keygen_done;
bool sept_run;

View File

@@ -241,10 +241,8 @@ void load_saved_configuration()
h_cfg.autonogc = atoi(kv->val);
else if (!strcmp("updater2p", kv->key))
h_cfg.updater2p = atoi(kv->val);
else if (!strcmp("brand", kv->key))
h_cfg.brand = kv->val;
else if (!strcmp("tagline", kv->key))
h_cfg.tagline = kv->val;
else if (!strcmp("bootprotect", kv->key))
h_cfg.bootprotect = atoi(kv->val);
}
break;