diff --git a/bootloader/config.c b/bootloader/config.c index 2de4491..04fd638 100644 --- a/bootloader/config.c +++ b/bootloader/config.c @@ -23,6 +23,7 @@ #include "gfx/tui.h" #include #include +#include #include #include #include @@ -49,6 +50,7 @@ void set_default_configuration() h_cfg.aes_slots_new = false; h_cfg.rcm_patched = fuse_check_patched_rcm(); h_cfg.emummc_force_disable = false; + h_cfg.t210b01 = hw_get_chip_id() == GP_HIDREV_MAJOR_T210B01; } int create_config_entry() diff --git a/bootloader/config.h b/bootloader/config.h index 5dd9ea1..894cdf9 100644 --- a/bootloader/config.h +++ b/bootloader/config.h @@ -32,6 +32,7 @@ typedef struct _hekate_config u32 updater2p; u32 bootprotect; // Global temporary config. + bool t210b01; bool se_keygen_done; bool sept_run; bool aes_slots_new; diff --git a/bootloader/main.c b/bootloader/main.c index dd424c8..9b772c6 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -1103,16 +1103,14 @@ static void _patched_rcm_protection() sdmmc_storage_t storage; sdmmc_t sdmmc; - u32 chip_id = (APB_MISC(APB_MISC_GP_HIDREV) >> 4) & 0xF; - - if (!h_cfg.rcm_patched || chip_id != GP_HIDREV_MAJOR_T210) + if (!h_cfg.rcm_patched || hw_get_chip_id() == GP_HIDREV_MAJOR_T210B01) return; // Check if AutoRCM is enabled and protect from a permanent brick. if (!sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400)) return; - u8 *tempbuf = (u8 *)malloc(0x200); + u8 *buf = (u8 *)malloc(0x200); sdmmc_storage_set_mmc_partition(&storage, EMMC_BOOT0); u8 corr_mod_byte0; @@ -1125,18 +1123,23 @@ static void _patched_rcm_protection() for (i = 0; i < 4; i++) { sect = (0x200 + (0x4000 * i)) / NX_EMMC_BLOCKSIZE; - sdmmc_storage_read(&storage, sect, 1, tempbuf); + sdmmc_storage_read(&storage, sect, 1, buf); + + // Check if 2nd byte of modulus is correct. + if (buf[0x11] == 0x86) + goto out; // If AutoRCM is enabled, disable it. - if (tempbuf[0x10] != corr_mod_byte0) + if (buf[0x10] != corr_mod_byte0) { - tempbuf[0x10] = corr_mod_byte0; + buf[0x10] = corr_mod_byte0; - sdmmc_storage_write(&storage, sect, 1, tempbuf); + sdmmc_storage_write(&storage, sect, 1, buf); } } - free(tempbuf); +out: + free(buf); sdmmc_storage_end(&storage); } @@ -1553,7 +1556,7 @@ void ipl_main() // Load emuMMC configuration from SD. emummc_load_cfg(); - // Show library errors. + // Show exception, library errors and L4T kernel panics. _show_errors(); // Load saved configuration and auto boot if enabled. diff --git a/nyx/nyx_gui/config.c b/nyx/nyx_gui/config.c index 42d0226..0a85090 100644 --- a/nyx/nyx_gui/config.c +++ b/nyx/nyx_gui/config.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -50,6 +51,7 @@ void set_default_configuration() h_cfg.rcm_patched = fuse_check_patched_rcm(); h_cfg.sbk_set = FUSE(FUSE_PRIVATE_KEY0) == 0xFFFFFFFF; h_cfg.emummc_force_disable = false; + h_cfg.t210b01 = hw_get_chip_id() == GP_HIDREV_MAJOR_T210B01; sd_power_cycle_time_start = 0; } diff --git a/nyx/nyx_gui/config.h b/nyx/nyx_gui/config.h index 308b0f7..1e2f60f 100644 --- a/nyx/nyx_gui/config.h +++ b/nyx/nyx_gui/config.h @@ -32,6 +32,7 @@ typedef struct _hekate_config u32 updater2p; u32 bootprotect; // Global temporary config. + bool t210b01; bool se_keygen_done; bool sept_run; bool aes_slots_new; diff --git a/nyx/nyx_gui/frontend/gui_tools.c b/nyx/nyx_gui/frontend/gui_tools.c index af006da..6b40e01 100644 --- a/nyx/nyx_gui/frontend/gui_tools.c +++ b/nyx/nyx_gui/frontend/gui_tools.c @@ -75,6 +75,9 @@ bool get_autorcm_status(bool change) sdmmc_t sdmmc; bool enabled = false; + if (h_cfg.t210b01) + return false; + sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400); u8 *tempbuf = (u8 *)malloc(0x200);