boot: use #embed for fusee

This commit is contained in:
Michael Scire 2025-05-04 13:23:38 -07:00 committed by SciresM
parent 66acab02db
commit b2dd3b7dce
2 changed files with 16 additions and 18 deletions

View file

@ -16,7 +16,6 @@
#include <stratosphere.hpp>
#include "boot_power_utils.hpp"
#include "boot_pmic_driver.hpp"
#include "fusee_bin.h"
namespace ams::boot {
@ -32,6 +31,10 @@ namespace ams::boot {
/* Globals. */
alignas(os::MemoryPageSize) u8 g_work_page[os::MemoryPageSize];
constexpr const u8 FuseeBin[] = {
#embed ATMOSPHERE_BOOT_FUSEE_PATH
};
/* Helpers. */
void ClearIram() {
/* Make page FFs. */
@ -48,8 +51,8 @@ namespace ams::boot {
ClearIram();
/* Copy in payload. */
for (size_t ofs = 0; ofs < fusee_bin_size; ofs += sizeof(g_work_page)) {
std::memcpy(g_work_page, fusee_bin + ofs, std::min(static_cast<size_t>(fusee_bin_size - ofs), sizeof(g_work_page)));
for (size_t ofs = 0; ofs < sizeof(FuseeBin); ofs += sizeof(g_work_page)) {
std::memcpy(g_work_page, FuseeBin + ofs, std::min(static_cast<size_t>(sizeof(FuseeBin) - ofs), sizeof(g_work_page)));
exosphere::CopyToIram(IramPayloadBase + ofs, g_work_page, sizeof(g_work_page));
}
@ -61,8 +64,8 @@ namespace ams::boot {
ClearIram();
/* Copy in payload. */
for (size_t ofs = 0; ofs < fusee_bin_size; ofs += sizeof(g_work_page)) {
std::memcpy(g_work_page, fusee_bin + ofs, std::min(static_cast<size_t>(fusee_bin_size - ofs), sizeof(g_work_page)));
for (size_t ofs = 0; ofs < sizeof(FuseeBin); ofs += sizeof(g_work_page)) {
std::memcpy(g_work_page, FuseeBin + ofs, std::min(static_cast<size_t>(sizeof(FuseeBin) - ofs), sizeof(g_work_page)));
exosphere::CopyToIram(IramPayloadBase + ofs, g_work_page, sizeof(g_work_page));
}
@ -93,7 +96,7 @@ namespace ams::boot {
}
void SetInitialRebootPayload() {
::ams::SetInitialRebootPayload(fusee_bin, fusee_bin_size);
::ams::SetInitialRebootPayload(FuseeBin, sizeof(FuseeBin));
}
void RebootForFatalError(ams::FatalErrorContext *ctx) {