From a7f0701cbfbadea4066f388d14c080e5956c44fc Mon Sep 17 00:00:00 2001 From: CTCaer Date: Fri, 15 Oct 2021 16:47:06 +0300 Subject: [PATCH] hos: move storage end above final touches --- bootloader/hos/hos.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bootloader/hos/hos.c b/bootloader/hos/hos.c index d0e9250..62f92c0 100644 --- a/bootloader/hos/hos.c +++ b/bootloader/hos/hos.c @@ -1092,6 +1092,14 @@ int hos_launch(ini_sec_t *cfg) // Rebuild and encrypt package2. pkg2_build_encrypt((void *)PKG2_LOAD_ADDR, &ctxt, &kip1_info); + // Configure Exosphere if secmon is replaced. + if (is_exo) + config_exosphere(&ctxt, warmboot_base); + + // Unmount SD card and eMMC. + sd_end(); + sdmmc_storage_end(&emmc_storage); + gfx_printf("Rebuilt & loaded pkg2\n\n%kBooting...%k\n", 0xFF96FF00, 0xFFCCCCCC); // Clear pkg1/pkg2 keys. @@ -1135,15 +1143,6 @@ int hos_launch(ini_sec_t *cfg) if (fuse_read_hw_state() == FUSE_NX_HW_STATE_DEV) memcpy((void *)SECMON6_BCT_CFG_ADDR, bootConfigBuf, SZ_2K); } - free(bootConfigBuf); - - // Config Exosphère if booting full Atmosphère. - if (is_exo) - config_exosphere(&ctxt, warmboot_base); - - // Unmount SD card and eMMC. - sd_end(); - sdmmc_storage_end(&emmc_storage); // Finalize MC carveout. if (kb <= KB_FIRMWARE_VERSION_301 && !is_exo)