fusee: integrate mariko fatal.

This commit is contained in:
Michael Scire 2020-11-20 23:20:48 -08:00 committed by SciresM
parent 06dcc6bc17
commit 078a42f80c
6 changed files with 62 additions and 6 deletions

View file

@ -131,6 +131,7 @@ dist: dist-no-debug
cp exosphere/loader_stub/loader_stub.elf atmosphere-$(AMSVER)-debug/exosphere-loader-stub.elf cp exosphere/loader_stub/loader_stub.elf atmosphere-$(AMSVER)-debug/exosphere-loader-stub.elf
cp exosphere/program/program.elf atmosphere-$(AMSVER)-debug/exosphere-program.elf cp exosphere/program/program.elf atmosphere-$(AMSVER)-debug/exosphere-program.elf
cp exosphere/warmboot/warmboot.elf atmosphere-$(AMSVER)-debug/exosphere-warmboot.elf cp exosphere/warmboot/warmboot.elf atmosphere-$(AMSVER)-debug/exosphere-warmboot.elf
cp exosphere/mariko_fatal/mariko_fatal.elf atmosphere-$(AMSVER)-debug/exosphere-mariko-fatal.elf
cp exosphere/program/sc7fw/sc7fw.elf atmosphere-$(AMSVER)-debug/exosphere-sc7fw.elf cp exosphere/program/sc7fw/sc7fw.elf atmosphere-$(AMSVER)-debug/exosphere-sc7fw.elf
cp exosphere/program/rebootstub/rebootstub.elf atmosphere-$(AMSVER)-debug/exosphere-rebootstub.elf cp exosphere/program/rebootstub/rebootstub.elf atmosphere-$(AMSVER)-debug/exosphere-rebootstub.elf
cp mesosphere/kernel_ldr/kernel_ldr.elf atmosphere-$(AMSVER)-debug/kernel_ldr.elf cp mesosphere/kernel_ldr/kernel_ldr.elf atmosphere-$(AMSVER)-debug/kernel_ldr.elf

View file

@ -5,25 +5,39 @@ define ATMOSPHERE_ADD_TARGET
ATMOSPHERE_BUILD_CONFIGS += $(strip $1) ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
$(strip $1): exosphere$(strip $2).bin check_warmboot_$(strip $1) $(strip $1): exosphere$(strip $2).bin warmboot$(strip $2).bin mariko_fatal$(strip $2).bin
@cp warmboot/warmboot$(strip $2).bin warmboot$(strip $2).bin
exosphere$(strip $2).bin: loader_stub/loader_stub$(strip $2).bin exosphere$(strip $2).bin: loader_stub/loader_stub$(strip $2).bin
@cp loader_stub/loader_stub$(strip $2).bin exosphere$(strip $2).bin @cp loader_stub/loader_stub$(strip $2).bin exosphere$(strip $2).bin
@printf LENY >> exosphere$(strip $2).bin @printf LENY >> exosphere$(strip $2).bin
@echo "Built exosphere$(strip $2).bin..." @echo "Built exosphere$(strip $2).bin..."
warmboot$(strip $2).bin: warmboot/warmboot$(strip $2).bin
@cp warmboot/warmboot$(strip $2).bin warmboot$(strip $2).bin
@echo "Built warmboot$(strip $2).bin..."
mariko_fatal$(strip $2).bin: mariko_fatal/mariko_fatal$(strip $2).bin
@cp mariko_fatal/mariko_fatal$(strip $2).bin mariko_fatal$(strip $2).bin
@echo "Built mariko_fatal$(strip $2).bin..."
check_program_$(strip $1): check_program_$(strip $1):
@$$(MAKE) -C program $(strip $1) @$$(MAKE) -C program $(strip $1)
check_warmboot_$(strip $1): check_warmboot_$(strip $1):
@$$(MAKE) -C warmboot $(strip $1) @$$(MAKE) -C warmboot $(strip $1)
check_mariko_fatal_$(strip $1):
@$$(MAKE) -C mariko_fatal $(strip $1)
loader_stub/loader_stub$(strip $2).bin: check_program_$(strip $1) loader_stub/loader_stub$(strip $2).bin: check_program_$(strip $1)
@$$(MAKE) -C loader_stub $(strip $1) @$$(MAKE) -C loader_stub $(strip $1)
clean-$(strip $1): clean-program-$(strip $1) clean-loader_stub-$(strip $1) clean-warmboot-$(strip $1) warmboot/warmboot$(strip $2).bin: check_warmboot_$(strip $1)
@rm -rf exosphere$(strip $2).bin warmboot$(strip $2).bin
mariko_fatal/mariko_fatal$(strip $2).bin: check_mariko_fatal_$(strip $1)
clean-$(strip $1): clean-program-$(strip $1) clean-loader_stub-$(strip $1) clean-warmboot-$(strip $1) clean-mariko_fatal-$(strip $1)
@rm -rf exosphere$(strip $2).bin warmboot$(strip $2).bin mariko_fatal$(strip $2).bin
clean-program-$(strip $1): clean-program-$(strip $1):
@$$(MAKE) -C program clean-$(strip $1) @$$(MAKE) -C program clean-$(strip $1)
@ -34,6 +48,9 @@ clean-loader_stub-$(strip $1):
clean-warmboot-$(strip $1): clean-warmboot-$(strip $1):
@$$(MAKE) -C warmboot clean-$(strip $1) @$$(MAKE) -C warmboot clean-$(strip $1)
clean-mariko_fatal-$(strip $1):
@$$(MAKE) -C mariko_fatal clean-$(strip $1)
endef endef
$(eval $(call ATMOSPHERE_ADD_TARGET, release, )) $(eval $(call ATMOSPHERE_ADD_TARGET, release, ))
@ -41,7 +58,7 @@ $(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug))
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit)) $(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit))
clean: clean-program clean-loader_stub clean-warmboot clean: clean-program clean-loader_stub clean-warmboot
@rm -rf exosphere*.bin warmboot*.bin @rm -rf exosphere*.bin warmboot*.bin mariko_fatal*.bin
clean-program: clean-program:
@$(MAKE) -C program clean @$(MAKE) -C program clean
@ -52,4 +69,7 @@ clean-loader_stub:
clean-warmboot: clean-warmboot:
@$(MAKE) -C warmboot clean @$(MAKE) -C warmboot clean
clean-mariko_fatal:
@$(MAKE) -C mariko_fatal clean
.PHONY: all clean clean-program clean-loader_stub clean-warmboot $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),check_program_$(config) check_warmboot_$(strip $1) clean-$(config) clean-program-$(config) clean-loader_stub-$(config) clean-warmboot-$(config)) .PHONY: all clean clean-program clean-loader_stub clean-warmboot $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),check_program_$(config) check_warmboot_$(strip $1) clean-$(config) clean-program-$(config) clean-loader_stub-$(config) clean-warmboot-$(config))

View file

@ -100,7 +100,8 @@ 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 \ BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) fusee-primary.bin \
exosphere.bin warmboot.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-primary.bin sept-secondary_00.enc sept-secondary_01.enc emummc.kip \
sept-secondary_dev_00.enc sept-secondary_dev_01.enc mesosphere.bin kernel_ldr.bin $(KIPFILES) sept-secondary_dev_00.enc sept-secondary_dev_01.enc mesosphere.bin kernel_ldr.bin \
mariko_fatal.bin $(KIPFILES)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C # use CXX for linking C++ projects, CC for standard C

View file

@ -256,4 +256,6 @@ SECTIONS
PROVIDE(__kernel_ldr_bin_size__ = kernel_ldr_bin_end - kernel_ldr_bin); PROVIDE(__kernel_ldr_bin_size__ = kernel_ldr_bin_end - kernel_ldr_bin);
PROVIDE(__mesosphere_bin_start__ = mesosphere_bin - __start__); PROVIDE(__mesosphere_bin_start__ = mesosphere_bin - __start__);
PROVIDE(__mesosphere_bin_size__ = mesosphere_bin_end - mesosphere_bin); PROVIDE(__mesosphere_bin_size__ = mesosphere_bin_end - mesosphere_bin);
PROVIDE(__mariko_fatal_bin_start__ = mariko_fatal_bin - __start__);
PROVIDE(__mariko_fatal_bin_size__ = mariko_fatal_bin_end - mariko_fatal_bin);
} }

View file

@ -55,6 +55,7 @@
#define u8 uint8_t #define u8 uint8_t
#define u32 uint32_t #define u32 uint32_t
#include "exosphere_bin.h" #include "exosphere_bin.h"
#include "mariko_fatal_bin.h"
#include "mesosphere_bin.h" #include "mesosphere_bin.h"
#include "sept_secondary_00_enc.h" #include "sept_secondary_00_enc.h"
#include "sept_secondary_01_enc.h" #include "sept_secondary_01_enc.h"
@ -1006,6 +1007,24 @@ uint32_t nxboot_main(void) {
memcpy(exosphere_memaddr, exosphere_bin, exosphere_bin_size); memcpy(exosphere_memaddr, exosphere_bin, exosphere_bin_size);
} }
/* Copy the exosphere mariko fatal program to a good location. */
{
void * const mariko_fatal_dst = (void *)0x80020000;
memset(mariko_fatal_dst, 0, 0x20000);
const size_t sd_mf_size = get_file_size("atmosphere/mariko_fatal.bin");
if (sd_mf_size != 0) {
if (sd_mf_size > 0x20000) {
fatal_error("Error: atmosphere/mariko_fatal.bin is too large!\n");
}
if (read_from_file(mariko_fatal_dst, sd_mf_size, "atmosphere/mariko_fatal.bin") != sd_mf_size) {
fatal_error("Error: failed to read atmosphere/mariko_fatal.bin");
}
} else {
memcpy(mariko_fatal_dst, mariko_fatal_bin, mariko_fatal_bin_size);
}
}
/* Move BootConfig. */ /* Move BootConfig. */
print(SCREEN_LOG_LEVEL_INFO, "[NXBOOT] Moving BootConfig...\n"); print(SCREEN_LOG_LEVEL_INFO, "[NXBOOT] Moving BootConfig...\n");
nxboot_move_bootconfig(); nxboot_move_bootconfig();

View file

@ -107,6 +107,7 @@ _metadata:
#define CONTENT_TYPE_EMC 8 #define CONTENT_TYPE_EMC 8
#define CONTENT_TYPE_KLD 9 #define CONTENT_TYPE_KLD 9
#define CONTENT_TYPE_KRN 10 #define CONTENT_TYPE_KRN 10
#define CONTENT_TYPE_EXF 11
#define CONTENT_FLAG_NONE (0 << 0) #define CONTENT_FLAG_NONE (0 << 0)
@ -289,6 +290,18 @@ _content_headers:
.asciz "emummc" .asciz "emummc"
.align 5 .align 5
/* exosphere mariko fatal program content header */
.word __mariko_fatal_bin_start__
.word __mariko_fatal_bin_size__
.byte CONTENT_TYPE_EXF
.byte CONTENT_FLAG_NONE
.byte CONTENT_FLAG_NONE
.byte CONTENT_FLAG_NONE
.word 0xCCCCCCCC
.asciz "exosphere_fatal"
.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__