From c75e61a40b3166f098e3935ac0eb579e6dbcee31 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 11 Jun 2020 01:48:36 -0700 Subject: [PATCH] fusee: switch to use exo2 instead of exo1 --- Makefile | 11 ++++++----- exosphere2/Makefile | 19 ++++++++++++------- fusee/fusee-primary/Makefile | 6 +++--- fusee/fusee-secondary/Makefile | 8 ++++---- fusee/fusee-secondary/linker.ld | 4 ++-- fusee/fusee-secondary/src/nxboot.c | 10 +++++----- fusee/fusee-secondary/src/start.s | 8 ++++---- sept/sept-secondary/Makefile | 6 +++--- 8 files changed, 39 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index b1f77f19f..2e3302b9d 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ thermosphere: $(MAKE) -C thermosphere all exosphere: thermosphere - $(MAKE) -C exosphere all + $(MAKE) -C exosphere2 all stratosphere: exosphere libraries $(MAKE) -C stratosphere all @@ -120,10 +120,11 @@ dist: dist-no-debug cp sept/sept-primary/sept-primary.elf atmosphere-$(AMSVER)-debug/sept-primary.elf cp sept/sept-secondary/sept-secondary.elf atmosphere-$(AMSVER)-debug/sept-secondary.elf cp sept/sept-secondary/key_derivation/key_derivation.elf atmosphere-$(AMSVER)-debug/sept-secondary-key-derivation.elf - cp exosphere/exosphere.elf atmosphere-$(AMSVER)-debug/exosphere.elf - cp exosphere/lp0fw/lp0fw.elf atmosphere-$(AMSVER)-debug/lp0fw.elf - cp exosphere/sc7fw/sc7fw.elf atmosphere-$(AMSVER)-debug/sc7fw.elf - cp exosphere/rebootstub/rebootstub.elf atmosphere-$(AMSVER)-debug/rebootstub.elf + cp exosphere2/loader_stub/loader_stub.elf atmosphere-$(AMSVER)-debug/exosphere-loader-stub.elf + cp exosphere2/program/program.elf atmosphere-$(AMSVER)-debug/exosphere-program.elf + cp exosphere2/warmboot/warmboot.elf atmosphere-$(AMSVER)-debug/exosphere-warmboot.elf + cp exosphere2/program/sc7fw/sc7fw.elf atmosphere-$(AMSVER)-debug/exosphere-sc7fw.elf + cp exosphere2/program/rebootstub/rebootstub.elf atmosphere-$(AMSVER)-debug/exosphere-rebootstub.elf cp mesosphere/kernel_ldr/kernel_ldr.elf atmosphere-$(AMSVER)-debug/kernel_ldr.elf cp stratosphere/ams_mitm/ams_mitm.elf atmosphere-$(AMSVER)-debug/ams_mitm.elf cp stratosphere/boot/boot.elf atmosphere-$(AMSVER)-debug/boot.elf diff --git a/exosphere2/Makefile b/exosphere2/Makefile index 20619aed9..8017acdef 100644 --- a/exosphere2/Makefile +++ b/exosphere2/Makefile @@ -1,9 +1,9 @@ -TARGETS := exosphere.bin program.lz4 -CLEAN_TARGETS := exosphere-clean program-clean boot_code-clean +TARGETS := exosphere.bin warmboot.bin program.lz4 +CLEAN_TARGETS := exosphere-clean program-clean boot_code-clean warmboot-clean SUBFOLDERS := $(MODULES) -all: exosphere.bin +all: exosphere.bin warmboot.bin clean: $(CLEAN_TARGETS) @rm -f exosphere.bin @@ -14,15 +14,16 @@ exosphere.bin: program.lz4 boot_code.lz4 @printf LENY >> exosphere.bin @echo "Built exosphere.bin..." -program.lz4: check_libexo +program.lz4: $(MAKE) -C program @cp program/program.lz4 program.lz4 @cp program/boot_code.lz4 boot_code.lz4 -boot_code.lz4: program.lz4 +warmboot.bin: + $(MAKE) -C warmboot + @cp warmboot/warmboot.bin warmboot.bin -check_libexo: - @$(MAKE) --no-print-directory -C ../libraries/libexosphere +boot_code.lz4: program.lz4 exosphere-clean: $(MAKE) -C loader_stub clean @@ -32,6 +33,10 @@ program-clean: $(MAKE) -C program clean @rm -f program.lz4 +warmboot-clean: + $(MAKE) -C warmboot clean + @rm -f warmboot.bin + boot_code-clean: @rm -f boot_code.lz4 diff --git a/fusee/fusee-primary/Makefile b/fusee/fusee-primary/Makefile index 3124e7925..dd3828792 100644 --- a/fusee/fusee-primary/Makefile +++ b/fusee/fusee-primary/Makefile @@ -77,7 +77,7 @@ export TOPDIR := $(CURDIR) export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ - $(AMS)/exosphere/rebootstub + $(AMS)/exosphere2/program/rebootstub export DEPSDIR := $(CURDIR)/$(BUILD) @@ -117,7 +117,7 @@ export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) all: check_rebootstub $(BUILD) check_rebootstub: - @$(MAKE) -C $(AMS)/exosphere/rebootstub all + @$(MAKE) -C $(AMS)/exosphere2/program/rebootstub all $(BUILD): check_rebootstub @[ -d $@ ] || mkdir -p $@ @@ -126,7 +126,7 @@ $(BUILD): check_rebootstub #--------------------------------------------------------------------------------- clean: @echo clean ... - @$(MAKE) -C $(AMS)/exosphere/rebootstub clean + @$(MAKE) -C $(AMS)/exosphere2/program/rebootstub clean @rm -fr $(BUILD) $(TARGET).bin $(TARGET).elf diff --git a/fusee/fusee-secondary/Makefile b/fusee/fusee-secondary/Makefile index af50dc965..b2798e1a1 100644 --- a/fusee/fusee-secondary/Makefile +++ b/fusee/fusee-secondary/Makefile @@ -87,7 +87,7 @@ export TOPDIR := $(CURDIR) export KIPDIRS := $(AMS)/stratosphere/loader $(AMS)/stratosphere/ncm $(AMS)/stratosphere/pm $(AMS)/stratosphere/sm $(AMS)/stratosphere/boot $(AMS)/stratosphere/spl $(AMS)/stratosphere/ams_mitm export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ - $(AMS)/exosphere $(AMS)/exosphere/lp0fw $(AMS)/exosphere/rebootstub \ + $(AMS)/exosphere2 $(AMS)/exosphere2/warmboot $(AMS)/exosphere2/program/rebootstub \ $(AMS)/thermosphere $(AMS)/fusee/fusee-primary $(AMS)/sept/sept-primary \ $(AMS)/sept/sept-secondary $(AMS)/emummc $(AMS)/mesosphere/kernel_ldr $(KIPDIRS) @@ -98,7 +98,7 @@ CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) KIPFILES := loader.kip ncm.kip pm.kip sm.kip ams_mitm.kip spl.kip boot.kip BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) fusee-primary.bin \ - exosphere.bin lp0fw.bin rebootstub.bin thermosphere.bin splash_screen.bmp \ + exosphere.bin warmboot.bin rebootstub.bin thermosphere.bin splash_screen.bmp \ sept-primary.bin sept-secondary_00.enc sept-secondary_01.enc emummc.kip \ sept-secondary_dev_00.enc sept-secondary_dev_01.enc kernel_ldr.bin $(KIPFILES) @@ -137,7 +137,7 @@ check_fusee_primary: @$(MAKE) -C $(AMS)/fusee/fusee-primary all check_exosphere: - @$(MAKE) -C $(AMS)/exosphere all + @$(MAKE) -C $(AMS)/exosphere2 all check_sept: @$(MAKE) -C $(AMS)/sept all @@ -166,7 +166,7 @@ $(BUILD): check_fusee_primary check_exosphere check_sept check_emummc check_ther clean: @echo clean ... @$(MAKE) -C $(AMS)/fusee/fusee-primary clean - @$(MAKE) -C $(AMS)/exosphere clean + @$(MAKE) -C $(AMS)/exosphere2 clean @$(MAKE) -C $(AMS)/thermosphere clean @$(MAKE) -C $(AMS)/libraries clean @$(MAKE) -C $(AMS)/mesosphere clean diff --git a/fusee/fusee-secondary/linker.ld b/fusee/fusee-secondary/linker.ld index 4ca97eb8f..610ff743b 100644 --- a/fusee/fusee-secondary/linker.ld +++ b/fusee/fusee-secondary/linker.ld @@ -228,8 +228,8 @@ SECTIONS PROVIDE(__fusee_primary_bin_size__ = fusee_primary_bin_end - fusee_primary_bin); PROVIDE(__loader_kip_start__ = loader_kip - __start__); PROVIDE(__loader_kip_size__ = loader_kip_end - loader_kip); - PROVIDE(__lp0fw_bin_start__ = lp0fw_bin - __start__); - PROVIDE(__lp0fw_bin_size__ = lp0fw_bin_end - lp0fw_bin); + PROVIDE(__warmboot_bin_start__ = warmboot_bin - __start__); + PROVIDE(__warmboot_bin_size__ = warmboot_bin_end - warmboot_bin); PROVIDE(__ncm_kip_start__ = ncm_kip - __start__); PROVIDE(__ncm_kip_size__ = ncm_kip_end - ncm_kip); PROVIDE(__pm_kip_start__ = pm_kip - __start__); diff --git a/fusee/fusee-secondary/src/nxboot.c b/fusee/fusee-secondary/src/nxboot.c index 28ec5fb34..45a0bca02 100644 --- a/fusee/fusee-secondary/src/nxboot.c +++ b/fusee/fusee-secondary/src/nxboot.c @@ -58,13 +58,13 @@ #include "sept_secondary_01_enc.h" #include "sept_secondary_dev_00_enc.h" #include "sept_secondary_dev_01_enc.h" -#include "lp0fw_bin.h" +#include "warmboot_bin.h" #include "emummc_kip.h" #undef u8 #undef u32 -extern const uint8_t lp0fw_bin[]; -extern const uint32_t lp0fw_bin_size; +extern const uint8_t warmboot_bin[]; +extern const uint32_t warmboot_bin_size; static const uint8_t retail_pkc_modulus[0x100] = { 0xF7, 0x86, 0x47, 0xAB, 0x71, 0x89, 0x81, 0xB5, 0xCF, 0x0C, 0xB0, 0xE8, 0x48, 0xA7, 0xFD, 0xAD, @@ -891,14 +891,14 @@ uint32_t nxboot_main(void) { } } else { /* Use Atmosphere's warmboot firmware implementation. */ - warmboot_fw_size = lp0fw_bin_size; + warmboot_fw_size = warmboot_bin_size; warmboot_fw = malloc(warmboot_fw_size); if (warmboot_fw == NULL) { fatal_error("[NXBOOT] Out of memory!\n"); } - memcpy(warmboot_fw, lp0fw_bin, warmboot_fw_size); + memcpy(warmboot_fw, warmboot_bin, warmboot_fw_size); if (warmboot_fw_size == 0) { fatal_error("[NXBOOT] Could not read the warmboot firmware from Package1!\n"); diff --git a/fusee/fusee-secondary/src/start.s b/fusee/fusee-secondary/src/start.s index 1b88db9fe..0050b053d 100644 --- a/fusee/fusee-secondary/src/start.s +++ b/fusee/fusee-secondary/src/start.s @@ -157,15 +157,15 @@ _content_headers: .asciz "Loader" .align 5 -/* lp0fw content header */ -.word __lp0fw_bin_start__ -.word __lp0fw_bin_size__ +/* warmboot content header */ +.word __warmboot_bin_start__ +.word __warmboot_bin_size__ .byte CONTENT_TYPE_WBT .byte CONTENT_FLAG_NONE .byte CONTENT_FLAG_NONE .byte CONTENT_FLAG_NONE .word 0xCCCCCCCC -.asciz "lp0fw" +.asciz "warmboot" .align 5 /* pm content header */ diff --git a/sept/sept-secondary/Makefile b/sept/sept-secondary/Makefile index 30a2d08a2..e8567f0dd 100644 --- a/sept/sept-secondary/Makefile +++ b/sept/sept-secondary/Makefile @@ -77,7 +77,7 @@ export TOPDIR := $(CURDIR) export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ - $(AMS)/exosphere/rebootstub \ + $(AMS)/exosphere2/program/rebootstub \ $(TOPDIR)/key_derivation export DEPSDIR := $(CURDIR)/$(BUILD) @@ -118,7 +118,7 @@ export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) all: check_rebootstub check_key_derivation $(BUILD) check_rebootstub: - @$(MAKE) -C $(AMS)/exosphere/rebootstub all + @$(MAKE) -C $(AMS)/exosphere2/program/rebootstub all check_key_derivation: @$(MAKE) -C key_derivation @@ -138,7 +138,7 @@ endif #--------------------------------------------------------------------------------- clean: @echo clean ... - @$(MAKE) -C $(AMS)/exosphere/rebootstub clean + @$(MAKE) -C $(AMS)/exosphere2/program/rebootstub clean @$(MAKE) -C key_derivation clean @rm -fr $(BUILD) $(TARGET).bin $(TARGET)_*.enc $(TARGET).elf