fusee: fix buildsystem, rename secondary -> package3

This commit is contained in:
Michael Scire
2021-09-05 15:45:40 -07:00
committed by SciresM
parent b7521465ee
commit 045f9b2f15
16 changed files with 246 additions and 139 deletions

View File

@@ -64,9 +64,9 @@ namespace ams::mitm {
/* Emummc file protection. */
FsFile g_emummc_file;
/* Maintain exclusive access to the fusee-secondary archive. */
/* Maintain exclusive access to the fusee external package. */
FsFile g_stratosphere_file;
FsFile g_secondary_file;
FsFile g_package3_file;
constexpr inline bool IsHexadecimal(const char *str) {
while (*str) {
@@ -134,12 +134,12 @@ namespace ams::mitm {
/* NOTE: g_bis_key_file is intentionally not closed here. This prevents any other process from opening it. */
}
/* Open a reference to the fusee-secondary archive. */
/* As upcoming/current atmosphere releases will contain more than one zip which users much choose between, */
/* Open a reference to the fusee external package. */
/* As upcoming/current atmosphere releases may contain more than one zip which users much choose between, */
/* maintaining an open reference prevents cleanly the issue of "automatic" updaters selecting the incorrect */
/* zip, and encourages good updating hygiene -- atmosphere should not be updated on SD while HOS is alive. */
{
R_ABORT_UNLESS(mitm::fs::OpenSdFile(std::addressof(g_secondary_file), "/atmosphere/fusee-secondary.bin", ams::fs::OpenMode_Read));
R_ABORT_UNLESS(mitm::fs::OpenSdFile(std::addressof(g_package3_file), "/atmosphere/package3", ams::fs::OpenMode_Read));
R_ABORT_UNLESS(mitm::fs::OpenSdFile(std::addressof(g_stratosphere_file), "/atmosphere/stratosphere.romfs", ams::fs::OpenMode_Read));
}
}

View File

@@ -14,7 +14,7 @@ export OUTPUT := $(CURDIR)/$(TARGET)
export TOPDIR := $(CURDIR)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) $(TOPDIR)/../../fusee/fusee-primary
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) $(TOPDIR)/../../fusee
export DEPSDIR := $(CURDIR)/$(BUILD)
@@ -22,7 +22,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-primary.bin
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) fusee.bin
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
@@ -68,7 +68,7 @@ endif
all: $(BUILD)
check_fusee:
@$(MAKE) -C $(TOPDIR)/../../fusee/fusee-primary all
@$(MAKE) -C $(TOPDIR)/../../fusee release
$(BUILD): check_fusee
@[ -d $@ ] || mkdir -p $@
@@ -77,7 +77,7 @@ $(BUILD): check_fusee
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@$(MAKE) -C $(TOPDIR)/../../fusee/fusee-primary clean
@$(MAKE) -C $(TOPDIR)/../../fusee clean
@rm -fr $(BUILD) $(TARGET).kip $(TARGET).elf
@@ -96,12 +96,12 @@ $(OUTPUT).kip : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)
boot_power_utils.o: fusee-primary.bin.o
boot_power_utils.o: fusee.bin.o
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
fusee-primary.bin.o: fusee-primary.bin
fusee.bin.o: fusee.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

View File

@@ -16,7 +16,7 @@
#include <stratosphere.hpp>
#include "boot_power_utils.hpp"
#include "boot_pmic_driver.hpp"
#include "fusee-primary_bin.h"
#include "fusee_bin.h"
namespace ams::boot {
@@ -48,8 +48,8 @@ namespace ams::boot {
ClearIram();
/* Copy in payload. */
for (size_t ofs = 0; ofs < fusee_primary_bin_size; ofs += sizeof(g_work_page)) {
std::memcpy(g_work_page, &fusee_primary_bin[ofs], std::min(static_cast<size_t>(fusee_primary_bin_size - ofs), sizeof(g_work_page)));
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)));
exosphere::CopyToIram(IramPayloadBase + ofs, g_work_page, sizeof(g_work_page));
}
@@ -61,8 +61,8 @@ namespace ams::boot {
ClearIram();
/* Copy in payload. */
for (size_t ofs = 0; ofs < fusee_primary_bin_size; ofs += sizeof(g_work_page)) {
std::memcpy(g_work_page, &fusee_primary_bin[ofs], std::min(static_cast<size_t>(fusee_primary_bin_size - ofs), sizeof(g_work_page)));
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)));
exosphere::CopyToIram(IramPayloadBase + ofs, g_work_page, sizeof(g_work_page));
}
@@ -93,7 +93,7 @@ namespace ams::boot {
}
void SetInitialRebootPayload() {
::ams::SetInitialRebootPayload(fusee_primary_bin, fusee_primary_bin_size);
::ams::SetInitialRebootPayload(fusee_bin, fusee_bin_size);
}
void RebootForFatalError(ams::FatalErrorContext *ctx) {

View File

@@ -271,8 +271,7 @@ namespace ams::pm::resource {
/* Adjust memory limits for atmosphere. */
/* We take memory away from applet normally, but away from application on < 3.0.0 to avoid a rare hang on boot. */
/* NOTE: On Version 5.0.0+, we cannot set the pools so simply. We must instead modify the kernel, which we do */
/* via patches in fusee-secondary. */
/* NOTE: On Version 5.0.0+, we cannot set the pools so simply. We must instead rely on mesosphere support. */
const size_t extra_memory_size = hos_version == hos::Version_5_0_0 ? ExtraSystemMemorySizeAtmosphere500 : ExtraSystemMemorySizeAtmosphere;
const auto src_group = hos_version >= hos::Version_3_0_0 ? ResourceLimitGroup_Applet : ResourceLimitGroup_Application;
for (size_t i = 0; i < spl::MemoryArrangement_Count; i++) {