mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
fusee: embed a copy of emummc
This commit is contained in:
parent
5ae9bd5fe5
commit
e5402bd8b8
4 changed files with 46 additions and 22 deletions
|
@ -89,7 +89,7 @@ export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
|
||||||
$(AMS)/exosphere $(AMS)/exosphere/lp0fw $(AMS)/exosphere/rebootstub \
|
$(AMS)/exosphere $(AMS)/exosphere/lp0fw $(AMS)/exosphere/rebootstub \
|
||||||
$(AMS)/thermosphere $(AMS)/fusee/fusee-primary $(AMS)/sept/sept-primary \
|
$(AMS)/thermosphere $(AMS)/fusee/fusee-primary $(AMS)/sept/sept-primary \
|
||||||
$(AMS)/sept/sept-secondary $(KIPDIRS)
|
$(AMS)/sept/sept-secondary $(AMS)/emummc $(KIPDIRS)
|
||||||
|
|
||||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||||
KIPFILES := loader.kip pm.kip sm.kip ams_mitm.kip spl.kip boot.kip
|
KIPFILES := loader.kip pm.kip sm.kip ams_mitm.kip spl.kip boot.kip
|
||||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) fusee-primary.bin \
|
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) fusee-primary.bin \
|
||||||
exosphere.bin lp0fw.bin rebootstub.bin thermosphere.bin splash_screen.bmp \
|
exosphere.bin lp0fw.bin rebootstub.bin thermosphere.bin splash_screen.bmp \
|
||||||
sept-primary.bin sept-secondary.enc \
|
sept-primary.bin sept-secondary.enc emummc.kip \
|
||||||
$(KIPFILES)
|
$(KIPFILES)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
@ -128,7 +128,7 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean all
|
.PHONY: $(BUILD) clean all
|
||||||
.PHONY: check_fusee_primary check_exosphere check_sept check_thermosphere check_stratosphere
|
.PHONY: check_fusee_primary check_exosphere check_sept check_emummc check_thermosphere check_stratosphere
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
all: $(BUILD)
|
all: $(BUILD)
|
||||||
|
@ -142,6 +142,9 @@ check_exosphere:
|
||||||
check_sept:
|
check_sept:
|
||||||
@$(MAKE) -C $(AMS)/sept all
|
@$(MAKE) -C $(AMS)/sept all
|
||||||
|
|
||||||
|
check_emummc:
|
||||||
|
@$(MAKE) -C $(AMS)/emummc EMUMMCDIR=$(AMS)/emummc all
|
||||||
|
|
||||||
check_thermosphere:
|
check_thermosphere:
|
||||||
@$(MAKE) -C $(AMS)/thermosphere all
|
@$(MAKE) -C $(AMS)/thermosphere all
|
||||||
|
|
||||||
|
@ -149,7 +152,7 @@ check_stratosphere:
|
||||||
@$(MAKE) -C $(AMS)/stratosphere all
|
@$(MAKE) -C $(AMS)/stratosphere all
|
||||||
|
|
||||||
|
|
||||||
$(BUILD): check_fusee_primary check_exosphere check_sept check_thermosphere check_stratosphere
|
$(BUILD): check_fusee_primary check_exosphere check_sept check_emummc check_thermosphere check_stratosphere
|
||||||
@[ -d $@ ] || mkdir -p $@
|
@[ -d $@ ] || mkdir -p $@
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||||
|
|
||||||
|
@ -161,6 +164,7 @@ clean:
|
||||||
@$(MAKE) -C $(AMS)/thermosphere clean
|
@$(MAKE) -C $(AMS)/thermosphere clean
|
||||||
@$(MAKE) -C $(AMS)/stratosphere clean
|
@$(MAKE) -C $(AMS)/stratosphere clean
|
||||||
@$(MAKE) -C $(AMS)/sept clean
|
@$(MAKE) -C $(AMS)/sept clean
|
||||||
|
@$(MAKE) -C $(AMS)/emummc clean
|
||||||
@rm -fr $(BUILD) $(TARGET).bin $(TARGET).elf
|
@rm -fr $(BUILD) $(TARGET).bin $(TARGET).elf
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
|
@ -246,4 +246,6 @@ SECTIONS
|
||||||
PROVIDE(__splash_screen_bmp_size__ = splash_screen_bmp_end - splash_screen_bmp);
|
PROVIDE(__splash_screen_bmp_size__ = splash_screen_bmp_end - splash_screen_bmp);
|
||||||
PROVIDE(__thermosphere_bin_start__ = thermosphere_bin - __start__);
|
PROVIDE(__thermosphere_bin_start__ = thermosphere_bin - __start__);
|
||||||
PROVIDE(__thermosphere_bin_size__ = thermosphere_bin_end - thermosphere_bin);
|
PROVIDE(__thermosphere_bin_size__ = thermosphere_bin_end - thermosphere_bin);
|
||||||
|
PROVIDE(__emummc_kip_start__ = emummc_kip - __start__);
|
||||||
|
PROVIDE(__emummc_kip_size__ = emummc_kip_end - emummc_kip);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
#include "exosphere_bin.h"
|
#include "exosphere_bin.h"
|
||||||
#include "sept_secondary_enc.h"
|
#include "sept_secondary_enc.h"
|
||||||
#include "lp0fw_bin.h"
|
#include "lp0fw_bin.h"
|
||||||
|
#include "emummc_kip.h"
|
||||||
#include "lib/log.h"
|
#include "lib/log.h"
|
||||||
#undef u8
|
#undef u8
|
||||||
#undef u32
|
#undef u32
|
||||||
|
@ -451,8 +452,8 @@ uint32_t nxboot_main(void) {
|
||||||
void *warmboot_memaddr;
|
void *warmboot_memaddr;
|
||||||
void *package1loader;
|
void *package1loader;
|
||||||
size_t package1loader_size;
|
size_t package1loader_size;
|
||||||
void *emummc_kip;
|
void *emummc;
|
||||||
size_t emummc_kip_size;
|
size_t emummc_size;
|
||||||
uint32_t available_revision;
|
uint32_t available_revision;
|
||||||
FILE *boot0, *pk2file;
|
FILE *boot0, *pk2file;
|
||||||
void *exosphere_memaddr;
|
void *exosphere_memaddr;
|
||||||
|
@ -460,25 +461,33 @@ uint32_t nxboot_main(void) {
|
||||||
|
|
||||||
/* Configure emummc or mount the real NAND. */
|
/* Configure emummc or mount the real NAND. */
|
||||||
if (!nxboot_configure_emummc(&exo_emummc_cfg)) {
|
if (!nxboot_configure_emummc(&exo_emummc_cfg)) {
|
||||||
emummc_kip = NULL;
|
emummc = NULL;
|
||||||
emummc_kip_size = 0;
|
emummc_size = 0;
|
||||||
if (nxfs_mount_emmc() < 0) {
|
if (nxfs_mount_emmc() < 0) {
|
||||||
fatal_error("[NXBOOT] Failed to mount eMMC!\n");
|
fatal_error("[NXBOOT] Failed to mount eMMC!\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
emummc_kip_size = get_file_size("atmosphere/emummc.kip");
|
emummc_size = get_file_size("atmosphere/emummc.kip");
|
||||||
if (emummc_kip_size == 0) {
|
if (emummc_size != 0) {
|
||||||
fatal_error("[NXBOOT] Could not read emummc kip!\n");
|
/* Allocate memory for the TSEC firmware. */
|
||||||
}
|
emummc = memalign(0x100, emummc_size);
|
||||||
|
|
||||||
/* Allocate memory for the TSEC firmware. */
|
if (emummc == NULL) {
|
||||||
emummc_kip = memalign(0x100, emummc_kip_size);
|
fatal_error("[NXBOOT] Out of memory!\n");
|
||||||
|
}
|
||||||
if (emummc_kip == NULL) {
|
if (read_from_file(emummc, emummc_size, "atmosphere/emummc.kip") != emummc_size) {
|
||||||
fatal_error("[NXBOOT] Out of memory!\n");
|
fatal_error("[NXBOOT] Could not read the emummc kip!\n");
|
||||||
}
|
}
|
||||||
if (read_from_file(emummc_kip, emummc_kip_size, "atmosphere/emummc.kip") != emummc_kip_size) {
|
} else {
|
||||||
fatal_error("[NXBOOT] Could not read the emummc kip!\n");
|
/* Use embedded copy. */
|
||||||
|
emummc_size = emummc_kip_size;
|
||||||
|
emummc = memalign(0x100, emummc_size);
|
||||||
|
|
||||||
|
if (emummc == NULL) {
|
||||||
|
fatal_error("[NXBOOT] Out of memory!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(emummc, emummc_kip, emummc_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,7 +703,7 @@ uint32_t nxboot_main(void) {
|
||||||
print(SCREEN_LOG_LEVEL_INFO, u8"[NXBOOT] Configured Stratosphere...\n");
|
print(SCREEN_LOG_LEVEL_INFO, u8"[NXBOOT] Configured Stratosphere...\n");
|
||||||
|
|
||||||
/* Patch package2, adding Thermosphère + custom KIPs. */
|
/* Patch package2, adding Thermosphère + custom KIPs. */
|
||||||
package2_rebuild_and_copy(package2, MAILBOX_EXOSPHERE_CONFIGURATION->target_firmware, emummc_kip, emummc_kip_size);
|
package2_rebuild_and_copy(package2, MAILBOX_EXOSPHERE_CONFIGURATION->target_firmware, emummc, emummc_size);
|
||||||
|
|
||||||
/* Set detected FS version. */
|
/* Set detected FS version. */
|
||||||
MAILBOX_EXOSPHERE_CONFIGURATION->emummc_cfg.base_cfg.fs_version = stratosphere_get_fs_version();
|
MAILBOX_EXOSPHERE_CONFIGURATION->emummc_cfg.base_cfg.fs_version = stratosphere_get_fs_version();
|
||||||
|
|
|
@ -93,6 +93,7 @@ _metadata:
|
||||||
#define CONTENT_TYPE_SP2 5
|
#define CONTENT_TYPE_SP2 5
|
||||||
#define CONTENT_TYPE_KIP 6
|
#define CONTENT_TYPE_KIP 6
|
||||||
#define CONTENT_TYPE_BMP 7
|
#define CONTENT_TYPE_BMP 7
|
||||||
|
#define CONTENT_TYPE_EMC 8
|
||||||
|
|
||||||
_content_headers:
|
_content_headers:
|
||||||
/* ams_mitm content header */
|
/* ams_mitm content header */
|
||||||
|
@ -191,6 +192,14 @@ _content_headers:
|
||||||
.asciz "spl"
|
.asciz "spl"
|
||||||
.align 5
|
.align 5
|
||||||
|
|
||||||
|
/* emummc content header */
|
||||||
|
.word __emummc_kip_start__
|
||||||
|
.word __emummc_kip_size__
|
||||||
|
.word CONTENT_TYPE_EMC
|
||||||
|
.word 0xCCCCCCCC
|
||||||
|
.asciz "emummc"
|
||||||
|
.align 5
|
||||||
|
|
||||||
/* splash_screen content header */
|
/* splash_screen content header */
|
||||||
.word __splash_screen_bmp_start__
|
.word __splash_screen_bmp_start__
|
||||||
.word __splash_screen_bmp_size__
|
.word __splash_screen_bmp_size__
|
||||||
|
|
Loading…
Reference in a new issue