diff --git a/stratosphere/boot/source/boot_power_utils.cpp b/stratosphere/boot/source/boot_power_utils.cpp index 3f057e87c..a4d8104be 100644 --- a/stratosphere/boot/source/boot_power_utils.cpp +++ b/stratosphere/boot/source/boot_power_utils.cpp @@ -16,7 +16,6 @@ #include #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(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(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(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(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) { diff --git a/stratosphere/boot/system_module.mk b/stratosphere/boot/system_module.mk index be26006df..f460aae73 100644 --- a/stratosphere/boot/system_module.mk +++ b/stratosphere/boot/system_module.mk @@ -23,7 +23,7 @@ CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c) CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp) SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s) -BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) fusee.bin +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) #--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C @@ -67,15 +67,18 @@ endif .PHONY: clean all check_lib check_fusee #--------------------------------------------------------------------------------- -all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/$(ATMOSPHERE_LIBRARY_DIR)/libstratosphere.a +all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/$(ATMOSPHERE_LIBRARY_DIR)/libstratosphere.a $(ATMOSPHERE_LIBRARIES_DIR)/../fusee/$(ATMOSPHERE_BOOT_OUT_DIR)/fusee.bin @$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURDIR)/$(ATMOSPHERE_OUT_DIR)/$(TARGET) \ DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \ --no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \ -f $(THIS_MAKEFILE) -$(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/$(ATMOSPHERE_LIBRARY_DIR)/libstratosphere.a: check_lib check_fusee +$(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/$(ATMOSPHERE_LIBRARY_DIR)/libstratosphere.a: check_lib @$(SILENTCMD)echo "Checked library." +$(ATMOSPHERE_LIBRARIES_DIR)/../fusee/$(ATMOSPHERE_BOOT_OUT_DIR)/fusee.bin: check_fusee + @$(SILENTCMD)echo "Checked fusee." + ifeq ($(ATMOSPHERE_CHECKED_LIBSTRATOSPHERE),1) check_lib: else @@ -124,15 +127,7 @@ $(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/$(ATMOSPHERE_LIBRARY_DIR @npdmtool $< $@ @echo built ... $(notdir $@) -boot_power_utils.o: fusee.bin.o - -#--------------------------------------------------------------------------------- -# you need a rule like this for each extension you use as binary data -#--------------------------------------------------------------------------------- -fusee.bin.o: fusee.bin -#--------------------------------------------------------------------------------- - @echo $(notdir $<) - @$(bin2o) +boot_power_utils.o: CXXFLAGS += -DATMOSPHERE_BOOT_FUSEE_PATH=\"$(ATMOSPHERE_LIBRARIES_DIR)/../fusee/$(ATMOSPHERE_BOOT_OUT_DIR)/fusee.bin\" -include $(DEPENDS)