hos: add bc based mem mode support
This commit is contained in:
21
README.md
21
README.md
@@ -66,7 +66,7 @@ Custom Graphical Nintendo Switch bootloader, firmware patcher, tools, and many m
|
|||||||
|
|
||||||
## Bootloader configuration
|
## Bootloader configuration
|
||||||
|
|
||||||
The bootloader can be configured via 'bootloader/hekate_ipl.ini' (if it is present on the SD card). Each ini section represents a boot entry, except for the special section 'config' that controls the global configuration.
|
The bootloader can be configured via `Nyx` -> `Options` or 'bootloader/hekate_ipl.ini'. The special section 'config' controls the actual global configuration. Any other ini section represents a boot entry and can only be edited manually via the ini.
|
||||||
|
|
||||||
|
|
||||||
There are four possible type of entries. "**[ ]**": Boot entry, "**{ }**": Caption, "**#**": Comment, "*newline*": .ini cosmetic newline.
|
There are four possible type of entries. "**[ ]**": Boot entry, "**{ }**": Caption, "**#**": Comment, "*newline*": .ini cosmetic newline.
|
||||||
@@ -75,7 +75,9 @@ There are four possible type of entries. "**[ ]**": Boot entry, "**{ }**": Capti
|
|||||||
**You can find a template [Here](./res/hekate_ipl_template.ini)**
|
**You can find a template [Here](./res/hekate_ipl_template.ini)**
|
||||||
|
|
||||||
|
|
||||||
### hekate Global Configuration keys/values (when entry is *[config]*):
|
### hekate Configuration keys/values (section *[config]*)
|
||||||
|
|
||||||
|
Use `Options` in Nyx to edit the following configuration:
|
||||||
|
|
||||||
| Config option | Description |
|
| Config option | Description |
|
||||||
| ------------------ | -------------------------------------------------------------- |
|
| ------------------ | -------------------------------------------------------------- |
|
||||||
@@ -91,7 +93,9 @@ There are four possible type of entries. "**[ ]**": Boot entry, "**{ }**": Capti
|
|||||||
| bootprotect=0 | 0: Disable, 1: Protect bootloader folder from being corrupted by disallowing reading or editing in HOS. |
|
| bootprotect=0 | 0: Disable, 1: Protect bootloader folder from being corrupted by disallowing reading or editing in HOS. |
|
||||||
|
|
||||||
|
|
||||||
### Boot entry key/value combinations:
|
### Boot entry key/value combinations
|
||||||
|
|
||||||
|
A boot entry needs to be manually added/edited with the user's chosen key/value combos.
|
||||||
|
|
||||||
| Config option | Description |
|
| Config option | Description |
|
||||||
| ---------------------- | ---------------------------------------------------------- |
|
| ---------------------- | ---------------------------------------------------------- |
|
||||||
@@ -141,7 +145,9 @@ You can define `kip1` to load an extra kip or many via the wildcard (`/*`) usage
|
|||||||
That's in case the kips are incompatible between them. If compatible, you can override `pkg3`/`fss0` kips with no issues (useful for testing with intermediate kip changes). In such cases, the `kip1` line must be **after** `pkg3`/`fss0` line.
|
That's in case the kips are incompatible between them. If compatible, you can override `pkg3`/`fss0` kips with no issues (useful for testing with intermediate kip changes). In such cases, the `kip1` line must be **after** `pkg3`/`fss0` line.
|
||||||
|
|
||||||
|
|
||||||
### Boot entry key/value combinations for Exosphère:
|
### Boot entry key/value combinations for Exosphère
|
||||||
|
|
||||||
|
The following can be paired together with a HOS boot entry:
|
||||||
|
|
||||||
| Config option | Description |
|
| Config option | Description |
|
||||||
| ---------------------- | ---------------------------------------------------------- |
|
| ---------------------- | ---------------------------------------------------------- |
|
||||||
@@ -150,6 +156,7 @@ That's in case the kips are incompatible between them. If compatible, you can ov
|
|||||||
| cal0blank=1 | Overrides Exosphère config `blank_prodinfo_{sys/emu}mmc`. If that key doesn't exist, `exosphere.ini` will be used. |
|
| cal0blank=1 | Overrides Exosphère config `blank_prodinfo_{sys/emu}mmc`. If that key doesn't exist, `exosphere.ini` will be used. |
|
||||||
| cal0writesys=1 | Overrides Exosphère config `allow_writing_to_cal_sysmmc`. If that key doesn't exist, `exosphere.ini` will be used. |
|
| cal0writesys=1 | Overrides Exosphère config `allow_writing_to_cal_sysmmc`. If that key doesn't exist, `exosphere.ini` will be used. |
|
||||||
| usb3force=1 | Overrides system settings mitm config `usb30_force_enabled`. If that key doesn't exist, `system_settings.ini` will be used. |
|
| usb3force=1 | Overrides system settings mitm config `usb30_force_enabled`. If that key doesn't exist, `system_settings.ini` will be used. |
|
||||||
|
| memmode=1 | Enables boot config memory mode for retail units. By default, max ram is limited to 4GB. Enabling this will automatically choose size. |
|
||||||
|
|
||||||
|
|
||||||
**Note**: `cal0blank`, `cal0writesys`, `usb3force`, as stated override the `exosphere.ini` or `system_settings.ini`. 0: Disable, 1: Enable, Key Missing: Use original value.
|
**Note**: `cal0blank`, `cal0writesys`, `usb3force`, as stated override the `exosphere.ini` or `system_settings.ini`. 0: Disable, 1: Enable, Key Missing: Use original value.
|
||||||
@@ -158,7 +165,7 @@ That's in case the kips are incompatible between them. If compatible, you can ov
|
|||||||
**Note2**: `blank_prodinfo_{sys/emu}mmc`, `allow_writing_to_cal_sysmmc` and `usb30_force_enabled` in `exosphere.ini` and `system_settings.ini` respectively, are the only atmosphere config keys that can affect hekate booting configuration externally, **if** the equivalent keys in hekate config are missing.
|
**Note2**: `blank_prodinfo_{sys/emu}mmc`, `allow_writing_to_cal_sysmmc` and `usb30_force_enabled` in `exosphere.ini` and `system_settings.ini` respectively, are the only atmosphere config keys that can affect hekate booting configuration externally, **if** the equivalent keys in hekate config are missing.
|
||||||
|
|
||||||
|
|
||||||
### Payload storage:
|
## Payload storage
|
||||||
|
|
||||||
hekate has a boot storage in the binary that helps it configure it outside of BPMP environment:
|
hekate has a boot storage in the binary that helps it configure it outside of BPMP environment:
|
||||||
|
|
||||||
@@ -174,7 +181,9 @@ hekate has a boot storage in the binary that helps it configure it outside of BP
|
|||||||
| '0xA0' emummc_path[120] | When `Boot to emuMMC` is set, it will override the current emuMMC (boot entry or emummc.ini). Must be NULL terminated. |
|
| '0xA0' emummc_path[120] | When `Boot to emuMMC` is set, it will override the current emuMMC (boot entry or emummc.ini). Must be NULL terminated. |
|
||||||
|
|
||||||
|
|
||||||
### Nyx Configuration keys/values (nyx.ini):
|
## Nyx Configuration keys/values (nyx.ini)
|
||||||
|
|
||||||
|
Use `Nyx Settings` in Nyx to edit the following configuration:
|
||||||
|
|
||||||
| Config option | Description |
|
| Config option | Description |
|
||||||
| ------------------ | ---------------------------------------------------------- |
|
| ------------------ | ---------------------------------------------------------- |
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018 naehrwert
|
* Copyright (c) 2018 naehrwert
|
||||||
* Copyright (c) 2018-2025 CTCaer
|
* Copyright (c) 2018-2026 CTCaer
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -63,9 +63,10 @@ enum {
|
|||||||
|
|
||||||
typedef struct _exo_ctxt_t
|
typedef struct _exo_ctxt_t
|
||||||
{
|
{
|
||||||
u32 hos_revision;
|
u32 hos_revision;
|
||||||
bool no_user_exceptions;
|
bool no_user_exceptions;
|
||||||
bool user_pmu;
|
bool user_pmu;
|
||||||
|
bool *force_mem_mode;
|
||||||
bool *usb3_force;
|
bool *usb3_force;
|
||||||
bool *cal0_blank;
|
bool *cal0_blank;
|
||||||
bool *cal0_allow_writes_sys;
|
bool *cal0_allow_writes_sys;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018 naehrwert
|
* Copyright (c) 2018 naehrwert
|
||||||
* Copyright (c) 2018-2025 CTCaer
|
* Copyright (c) 2018-2026 CTCaer
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -223,6 +223,20 @@ static int _config_exo_user_pmu_access(launch_ctxt_t *ctxt, const char *value)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int _config_exo_force_mem_mode(launch_ctxt_t *ctxt, const char *value)
|
||||||
|
{
|
||||||
|
// Override key found.
|
||||||
|
ctxt->exo_ctx.force_mem_mode = zalloc(sizeof(bool));
|
||||||
|
|
||||||
|
if (*value == '1')
|
||||||
|
{
|
||||||
|
DPRINTF("Enabled Auto Memory Mode\n");
|
||||||
|
*ctxt->exo_ctx.force_mem_mode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int _config_exo_usb3_force(launch_ctxt_t *ctxt, const char *value)
|
static int _config_exo_usb3_force(launch_ctxt_t *ctxt, const char *value)
|
||||||
{
|
{
|
||||||
// Override key found.
|
// Override key found.
|
||||||
@@ -312,6 +326,7 @@ static const cfg_handler_t _config_handlers[] = {
|
|||||||
{ "emummcforce", _config_emummc_forced },
|
{ "emummcforce", _config_emummc_forced },
|
||||||
{ "nouserexceptions", _config_dis_exo_user_exceptions },
|
{ "nouserexceptions", _config_dis_exo_user_exceptions },
|
||||||
{ "userpmu", _config_exo_user_pmu_access },
|
{ "userpmu", _config_exo_user_pmu_access },
|
||||||
|
{ "memmode", _config_exo_force_mem_mode },
|
||||||
{ "usb3force", _config_exo_usb3_force },
|
{ "usb3force", _config_exo_usb3_force },
|
||||||
{ "cal0blank", _config_exo_cal0_blanking },
|
{ "cal0blank", _config_exo_cal0_blanking },
|
||||||
{ "cal0writesys", _config_exo_cal0_writes_enable },
|
{ "cal0writesys", _config_exo_cal0_writes_enable },
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2025 CTCaer
|
* Copyright (c) 2018-2026 CTCaer
|
||||||
* Copyright (c) 2019 Atmosphère-NX
|
* Copyright (c) 2019 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -136,6 +136,7 @@ typedef struct _atm_fatal_error_ctx
|
|||||||
#define EXO_FLAG_CAL0_BLANKING BIT(5)
|
#define EXO_FLAG_CAL0_BLANKING BIT(5)
|
||||||
#define EXO_FLAG_CAL0_WRITES_SYS BIT(6)
|
#define EXO_FLAG_CAL0_WRITES_SYS BIT(6)
|
||||||
#define EXO_FLAG_ENABLE_USB3 BIT(7)
|
#define EXO_FLAG_ENABLE_USB3 BIT(7)
|
||||||
|
#define EXO_FLAG_BC_MEM_MODE BIT(8)
|
||||||
|
|
||||||
#define EXO_FW_VER(mj, mn) (((mj) << 24) | ((mn) << 16))
|
#define EXO_FW_VER(mj, mn) (((mj) << 24) | ((mn) << 16))
|
||||||
|
|
||||||
@@ -145,6 +146,7 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base)
|
|||||||
u32 exo_flags = 0;
|
u32 exo_flags = 0;
|
||||||
bool usb3_force = false;
|
bool usb3_force = false;
|
||||||
bool user_debug = false;
|
bool user_debug = false;
|
||||||
|
bool bc_mem_mode = false;
|
||||||
bool cal0_blanking = false;
|
bool cal0_blanking = false;
|
||||||
bool cal0_allow_writes_sys = false;
|
bool cal0_allow_writes_sys = false;
|
||||||
|
|
||||||
@@ -224,6 +226,8 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base)
|
|||||||
exo_cfg->uart_invert = atoi(kv->val);
|
exo_cfg->uart_invert = atoi(kv->val);
|
||||||
else if (!strcmp("log_baud_rate", kv->key))
|
else if (!strcmp("log_baud_rate", kv->key))
|
||||||
exo_cfg->uart_baudrate = atoi(kv->val);
|
exo_cfg->uart_baudrate = atoi(kv->val);
|
||||||
|
else if (!strcmp("enable_mem_mode", kv->key))
|
||||||
|
bc_mem_mode = atoi(kv->val);
|
||||||
else if (emu_cfg.enabled && !h_cfg.emummc_force_disable)
|
else if (emu_cfg.enabled && !h_cfg.emummc_force_disable)
|
||||||
{
|
{
|
||||||
if (!strcmp("blank_prodinfo_emummc", kv->key))
|
if (!strcmp("blank_prodinfo_emummc", kv->key))
|
||||||
@@ -283,6 +287,11 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base)
|
|||||||
if (ctxt->exo_ctx.user_pmu)
|
if (ctxt->exo_ctx.user_pmu)
|
||||||
exo_flags |= EXO_FLAG_USER_PMU;
|
exo_flags |= EXO_FLAG_USER_PMU;
|
||||||
|
|
||||||
|
// Enable Boot Config Memory Mode. Check if system_settings ini value is overridden. If not, check if enabled in ini.
|
||||||
|
if ((ctxt->exo_ctx.force_mem_mode && *ctxt->exo_ctx.force_mem_mode)
|
||||||
|
|| (!ctxt->exo_ctx.force_mem_mode && bc_mem_mode))
|
||||||
|
exo_flags |= EXO_FLAG_BC_MEM_MODE;
|
||||||
|
|
||||||
// Enable USB 3.0. Check if system_settings ini value is overridden. If not, check if enabled in ini.
|
// Enable USB 3.0. Check if system_settings ini value is overridden. If not, check if enabled in ini.
|
||||||
if ((ctxt->exo_ctx.usb3_force && *ctxt->exo_ctx.usb3_force)
|
if ((ctxt->exo_ctx.usb3_force && *ctxt->exo_ctx.usb3_force)
|
||||||
|| (!ctxt->exo_ctx.usb3_force && usb3_force))
|
|| (!ctxt->exo_ctx.usb3_force && usb3_force))
|
||||||
|
|||||||
Reference in New Issue
Block a user