mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 12:21:18 +00:00
fusee: fix buildsystem, rename secondary -> package3
This commit is contained in:
parent
b7521465ee
commit
045f9b2f15
16 changed files with 246 additions and 139 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -95,4 +95,6 @@ dkms.conf
|
|||
**/build_nintendo_nx_x64
|
||||
**/build_nintendo_nx_x86
|
||||
|
||||
package3
|
||||
|
||||
stratosphere/test/
|
||||
|
|
37
Makefile
37
Makefile
|
@ -16,6 +16,26 @@ endif
|
|||
COMPONENTS := fusee stratosphere mesosphere exosphere thermosphere troposphere libraries
|
||||
|
||||
all: $(COMPONENTS)
|
||||
$(eval MAJORVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MAJOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
||||
| tr -s [:blank:] \
|
||||
| cut -d' ' -f3))
|
||||
$(eval MINORVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MINOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
||||
| tr -s [:blank:] \
|
||||
| cut -d' ' -f3))
|
||||
$(eval MICROVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MICRO\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
||||
| tr -s [:blank:] \
|
||||
| cut -d' ' -f3))
|
||||
$(eval S_MAJORVER = $(shell grep 'define ATMOSPHERE_SUPPORTED_HOS_VERSION_MAJOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
||||
| tr -s [:blank:] \
|
||||
| cut -d' ' -f3))
|
||||
$(eval S_MINORVER = $(shell grep 'define ATMOSPHERE_SUPPORTED_HOS_VERSION_MINOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
||||
| tr -s [:blank:] \
|
||||
| cut -d' ' -f3))
|
||||
$(eval S_MICROVER = $(shell grep 'define ATMOSPHERE_SUPPORTED_HOS_VERSION_MICRO\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
||||
| tr -s [:blank:] \
|
||||
| cut -d' ' -f3))
|
||||
@python fusee/build_package3.py $(CURDIR) release $(AMSHASH) $(MAJORVER) $(MINORVER) $(MICROVER) 0 $(S_MAJORVER) $(S_MINORVER) $(S_MICROVER) 0
|
||||
@echo "Built package3!"
|
||||
|
||||
thermosphere:
|
||||
$(MAKE) -C thermosphere all
|
||||
|
@ -64,9 +84,9 @@ dist-no-debug: all
|
|||
mkdir -p atmosphere-$(AMSVER)/atmosphere/config
|
||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/flags
|
||||
touch atmosphere-$(AMSVER)/atmosphere/flags/clean_stratosphere_for_0.19.0.flag
|
||||
cp fusee/fusee-primary/fusee-primary.bin atmosphere-$(AMSVER)/atmosphere/reboot_payload.bin
|
||||
cp fusee/fusee-secondary/fusee-secondary-experimental.bin atmosphere-$(AMSVER)/atmosphere/fusee-secondary.bin
|
||||
cp config_templates/BCT.ini atmosphere-$(AMSVER)/atmosphere/config_templates/BCT.ini
|
||||
cp fusee/fusee.bin atmosphere-$(AMSVER)/atmosphere/reboot_payload.bin
|
||||
cp fusee/package3 atmosphere-$(AMSVER)/atmosphere/package3
|
||||
cp config_templates/stratosphere.ini atmosphere-$(AMSVER)/atmosphere/config_templates/stratosphere.ini
|
||||
cp config_templates/override_config.ini atmosphere-$(AMSVER)/atmosphere/config_templates/override_config.ini
|
||||
cp config_templates/system_settings.ini atmosphere-$(AMSVER)/atmosphere/config_templates/system_settings.ini
|
||||
cp config_templates/exosphere.ini atmosphere-$(AMSVER)/atmosphere/config_templates/exosphere.ini
|
||||
|
@ -96,13 +116,10 @@ dist-no-debug: all
|
|||
cp troposphere/reboot_to_payload/reboot_to_payload.nro atmosphere-$(AMSVER)/switch/reboot_to_payload.nro
|
||||
cp troposphere/daybreak/daybreak.nro atmosphere-$(AMSVER)/switch/daybreak.nro
|
||||
cd atmosphere-$(AMSVER); zip -r ../atmosphere-$(AMSVER).zip ./*; cd ../;
|
||||
cp fusee/fusee-secondary/fusee-secondary.bin atmosphere-$(AMSVER)/atmosphere/fusee-secondary.bin
|
||||
cd atmosphere-$(AMSVER); zip -r ../atmosphere-$(AMSVER)-WITHOUT_MESOSPHERE.zip ./*; cd ../;
|
||||
rm -r atmosphere-$(AMSVER)
|
||||
rm -rf atmosphere-$(AMSVER)
|
||||
mkdir out
|
||||
mv atmosphere-$(AMSVER).zip out/atmosphere-$(AMSVER).zip
|
||||
mv atmosphere-$(AMSVER)-WITHOUT_MESOSPHERE.zip out/atmosphere-$(AMSVER)-WITHOUT_MESOSPHERE.zip
|
||||
cp fusee/fusee-primary/fusee-primary.bin out/fusee-primary.bin
|
||||
cp fusee/fusee.bin out/fusee.bin
|
||||
|
||||
dist: dist-no-debug
|
||||
$(eval MAJORVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MAJOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
||||
|
@ -117,8 +134,8 @@ dist: dist-no-debug
|
|||
$(eval AMSVER = $(MAJORVER).$(MINORVER).$(MICROVER)-$(AMSREV))
|
||||
rm -rf atmosphere-$(AMSVER)-debug
|
||||
mkdir atmosphere-$(AMSVER)-debug
|
||||
cp fusee/fusee-primary/fusee-primary.elf atmosphere-$(AMSVER)-debug/fusee-primary.elf
|
||||
cp fusee/fusee-secondary/fusee-secondary-experimental.elf atmosphere-$(AMSVER)-debug/fusee-secondary.elf
|
||||
cp fusee/loader_stub/loader_stub.elf atmosphere-$(AMSVER)-debug/fusee-loader-stub.elf
|
||||
cp fusee/program/program.elf atmosphere-$(AMSVER)-debug/fusee-program.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/warmboot/warmboot.elf atmosphere-$(AMSVER)-debug/exosphere-warmboot.elf
|
||||
|
|
44
fusee/Makefile
Normal file
44
fusee/Makefile
Normal file
|
@ -0,0 +1,44 @@
|
|||
ATMOSPHERE_BUILD_CONFIGS :=
|
||||
all: release
|
||||
|
||||
define ATMOSPHERE_ADD_TARGET
|
||||
|
||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||
|
||||
$(strip $1): fusee$(strip $2).bin
|
||||
|
||||
fusee$(strip $2).bin: loader_stub/loader_stub$(strip $2).bin
|
||||
@cp loader_stub/loader_stub$(strip $2).bin fusee$(strip $2).bin
|
||||
@echo "Built fusee$(strip $2).bin..."
|
||||
|
||||
check_program_$(strip $1):
|
||||
@$$(MAKE) -C program $(strip $1)
|
||||
|
||||
loader_stub/loader_stub$(strip $2).bin: check_program_$(strip $1)
|
||||
@$$(MAKE) -C loader_stub $(strip $1)
|
||||
|
||||
clean-$(strip $1): clean-program-$(strip $1) clean-loader_stub-$(strip $1)
|
||||
@rm -rf fusee$(strip $2).bin
|
||||
|
||||
clean-program-$(strip $1):
|
||||
@$$(MAKE) -C program clean-$(strip $1)
|
||||
|
||||
clean-loader_stub-$(strip $1):
|
||||
@$$(MAKE) -C loader_stub clean-$(strip $1)
|
||||
|
||||
endef
|
||||
|
||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, ))
|
||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug))
|
||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit))
|
||||
|
||||
clean: clean-program clean-loader_stub
|
||||
@rm -rf fusee*.bin package3*
|
||||
|
||||
clean-program:
|
||||
@$(MAKE) -C program clean
|
||||
|
||||
clean-loader_stub:
|
||||
@$(MAKE) -C loader_stub clean
|
||||
|
||||
.PHONY: all clean clean-program clean-loader_stub $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),check_program_$(config) check_warmboot_$(strip $1) clean-$(config) clean-program-$(config) clean-loader_stub-$(config) clean-warmboot-$(config))
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
import sys, lz4, hashlib
|
||||
import sys, lz4, hashlib, os
|
||||
from struct import unpack as up, pack as pk
|
||||
|
||||
def lz4_compress(data):
|
||||
|
@ -22,15 +22,15 @@ def get_overlay(program, i):
|
|||
|
||||
KIP_NAMES = ['Loader', 'NCM', 'ProcessManager', 'sm', 'boot', 'spl', 'ams_mitm']
|
||||
|
||||
def get_kips():
|
||||
emummc = read_file('../../../../emummc/emummc_unpacked.kip')
|
||||
loader = read_file('../../../../stratosphere/loader/loader.kip')
|
||||
ncm = read_file('../../../../stratosphere/ncm/ncm.kip')
|
||||
pm = read_file('../../../../stratosphere/pm/pm.kip')
|
||||
sm = read_file('../../../../stratosphere/sm/sm.kip')
|
||||
boot = read_file('../../../../stratosphere/boot/boot.kip')
|
||||
spl = read_file('../../../../stratosphere/spl/spl.kip')
|
||||
ams_mitm = read_file('../../../../stratosphere/ams_mitm/ams_mitm.kip')
|
||||
def get_kips(ams_dir):
|
||||
emummc = read_file(os.path.join(ams_dir, 'emummc/emummc_unpacked.kip'))
|
||||
loader = read_file(os.path.join(ams_dir, 'stratosphere/loader/loader.kip'))
|
||||
ncm = read_file(os.path.join(ams_dir, 'stratosphere/ncm/ncm.kip'))
|
||||
pm = read_file(os.path.join(ams_dir, 'stratosphere/pm/pm.kip'))
|
||||
sm = read_file(os.path.join(ams_dir, 'stratosphere/sm/sm.kip'))
|
||||
boot = read_file(os.path.join(ams_dir, 'stratosphere/boot/boot.kip'))
|
||||
spl = read_file(os.path.join(ams_dir, 'stratosphere/spl/spl.kip'))
|
||||
ams_mitm = read_file(os.path.join(ams_dir, 'stratosphere/ams_mitm/ams_mitm.kip'))
|
||||
return (emummc, {
|
||||
'Loader' : loader,
|
||||
'NCM' : ncm,
|
||||
|
@ -49,7 +49,7 @@ def write_kip_meta(f, kip, ofs):
|
|||
# Write hash
|
||||
f.write(hashlib.sha256(kip).digest())
|
||||
|
||||
def write_header(f, all_kips, meso_size):
|
||||
def write_header(f, all_kips, meso_size, git_revision, major, minor, micro, relstep, s_major, s_minor, s_micro, s_relstep):
|
||||
# Unpack kips
|
||||
emummc, kips = all_kips
|
||||
# Write reserved0 (previously entrypoint) as infinite loop instruction.
|
||||
|
@ -75,11 +75,11 @@ def write_header(f, all_kips, meso_size):
|
|||
# Write num_content_headers;
|
||||
f.write(pk('<I', 8 + len(KIP_NAMES)))
|
||||
# Write supported_hos_version;
|
||||
f.write(pk('<I', 0xCCCCCCCC)) # TODO
|
||||
f.write(pk('<BBBB', s_relstep, s_micro, s_minor, s_major)) # TODO
|
||||
# Write release_version;
|
||||
f.write(pk('<I', 0xCCCCCCCC)) # TODO
|
||||
f.write(pk('<BBBB', relstep, micro, minor, major)) # TODO
|
||||
# Write git_revision;
|
||||
f.write(pk('<I', 0xCCCCCCCC)) # TODO
|
||||
f.write(pk('<I', git_revision)) # TODO
|
||||
# Write content metas
|
||||
f.write(pk('<IIBBBBI16s', 0x000800, 0x001800, 2, 0, 0, 0, 0xCCCCCCCC, 'warmboot'))
|
||||
f.write(pk('<IIBBBBI16s', 0x002000, 0x002000, 12, 0, 0, 0, 0xCCCCCCCC, 'tsec_keygen'))
|
||||
|
@ -134,51 +134,63 @@ def write_kips(f, all_kips):
|
|||
f.write(b'\xCC' * (0x300000 - tot))
|
||||
|
||||
def main(argc, argv):
|
||||
if argc == 2:
|
||||
target = argv[1]
|
||||
if len(target) == 0:
|
||||
target = ''
|
||||
elif argc == 1:
|
||||
target = ''
|
||||
else:
|
||||
print('Usage: %s target' % argv[0])
|
||||
if argc != 12:
|
||||
print('Usage: %s ams_dir target revision major minor micro relstep s_major s_minor s_micro s_relstep' % argv[0])
|
||||
return 1
|
||||
all_kips = get_kips()
|
||||
with open('../../program%s.bin' % target, 'rb') as f:
|
||||
data = f.read()
|
||||
erista_mtc = get_overlay(data, 1)
|
||||
mariko_mtc = get_overlay(data, 2)
|
||||
# Parse arguments
|
||||
ams_dir = argv[1]
|
||||
target = '' if argv[2] == 'release' else ('_%s' % argv[2])
|
||||
revision = int(argv[3], 16)
|
||||
major = int(argv[4])
|
||||
minor = int(argv[5])
|
||||
micro = int(argv[6])
|
||||
relstep = int(argv[7])
|
||||
s_major = int(argv[8])
|
||||
s_minor = int(argv[9])
|
||||
s_micro = int(argv[10])
|
||||
s_relstep = int(argv[11])
|
||||
# Read/parse fusee
|
||||
fusee_program = read_file(os.path.join(ams_dir, 'fusee/program/program%s.bin' % target))
|
||||
fusee_bin = read_file(os.path.join(ams_dir, 'fusee/fusee%s.bin' % target))
|
||||
erista_mtc = get_overlay(fusee_program, 1)
|
||||
mariko_mtc = get_overlay(fusee_program, 2)
|
||||
erista_hsh = hashlib.sha256(erista_mtc[:-4]).digest()[:4]
|
||||
mariko_hsh = hashlib.sha256(mariko_mtc[:-4]).digest()[:4]
|
||||
fusee_program = lz4_compress(data[:0x2B000 - 8] + erista_hsh + mariko_hsh + get_overlay(data, 0)[:0x11000])
|
||||
mesosphere = read_file('../../../../mesosphere/mesosphere%s.bin' % target)
|
||||
with open('../../program%s.lz4' % target, 'wb') as f:
|
||||
f.write(fusee_program)
|
||||
with open('../../fusee-boogaloo%s.bin' % target, 'wb') as f:
|
||||
# Read other files
|
||||
exosphere = read_file(os.path.join(ams_dir, 'exosphere/exosphere%s.bin' % target))
|
||||
warmboot = read_file(os.path.join(ams_dir, 'exosphere/warmboot%s.bin' % target))
|
||||
mariko_fatal = read_file(os.path.join(ams_dir, 'exosphere/mariko_fatal%s.bin' % target))
|
||||
rebootstub = read_file(os.path.join(ams_dir, 'exosphere/program/rebootstub/rebootstub%s.bin' % target))
|
||||
mesosphere = read_file(os.path.join(ams_dir, 'mesosphere/mesosphere%s.bin' % target))
|
||||
all_kips = get_kips(ams_dir)
|
||||
tsec_keygen = read_file(os.path.join(ams_dir, 'fusee/program/tsec_keygen/tsec_keygen.bin'))
|
||||
splash_bin = read_file(os.path.join(ams_dir, 'fusee/program/splash_screen/splash_screen.bin'))
|
||||
assert len(splash_bin) == 0x3C0000
|
||||
with open(os.path.join(ams_dir, 'fusee/package3%s' % target), 'wb') as f:
|
||||
# Write header
|
||||
write_header(f, all_kips, len(mesosphere))
|
||||
write_header(f, all_kips, len(mesosphere), revision, major, minor, micro, relstep, s_major, s_minor, s_micro, s_relstep)
|
||||
# Write warmboot
|
||||
f.write(pad(read_file('../../../../exosphere/warmboot%s.bin' % target), 0x1800))
|
||||
f.write(pad(warmboot, 0x1800))
|
||||
# Write TSEC Keygen
|
||||
f.write(pad(read_file('../../tsec_keygen/tsec_keygen.bin'), 0x2000))
|
||||
f.write(pad(tsec_keygen, 0x2000))
|
||||
# Write Mariko Fatal
|
||||
f.write(pad(read_file('../../../../exosphere/mariko_fatal%s.bin' % target), 0x1C000))
|
||||
f.write(pad(mariko_fatal, 0x1C000))
|
||||
# Write Erista MTC
|
||||
f.write(erista_mtc[:-4] + erista_hsh)
|
||||
# Write Mariko MTC
|
||||
f.write(mariko_mtc[:-4] + mariko_hsh)
|
||||
# Write exosphere
|
||||
f.write(pad(read_file('../../../../exosphere/exosphere%s.bin' % target), 0xE000))
|
||||
f.write(pad(exosphere, 0xE000))
|
||||
# Write mesosphere
|
||||
f.write(pad(read_file('../../../../mesosphere/mesosphere%s.bin' % target), 0xAA000))
|
||||
f.write(pad(mesosphere, 0xAA000))
|
||||
# Write kips
|
||||
write_kips(f, all_kips)
|
||||
# Write Splash Screen
|
||||
f.write(pad(read_file('../../splash_screen/splash_screen.bin'), 0x3C0000))
|
||||
f.write(splash_bin)
|
||||
# Write fusee
|
||||
f.write(pad(fusee_program, 0x20000))
|
||||
f.write(pad(fusee_bin, 0x20000))
|
||||
# Write rebootstub
|
||||
f.write(pad(read_file('../../../../exosphere/program/rebootstub/rebootstub%s.bin' % target), 0x1000))
|
||||
f.write(pad(rebootstub, 0x1000))
|
||||
# Pad to 8 MB
|
||||
f.write(b'\xCC' * (0x800000 - 0x7E1000))
|
||||
|
|
@ -111,7 +111,7 @@ DEPENDS := $(OFILES:.o=.d)
|
|||
#---------------------------------------------------------------------------------
|
||||
|
||||
$(OUTPUT).lz4 : $(OUTPUT).bin
|
||||
@python $(TOPDIR)/split_bin.py "$(ATMOSPHERE_BUILD_TARGET)"
|
||||
@python $(TOPDIR)/lz4_compress.py $(OUTPUT).bin $(OUTPUT).lz4
|
||||
@echo built ... $(notdir $@)
|
||||
|
||||
$(OUTPUT).bin : $(OUTPUT).elf
|
||||
|
|
35
fusee/program/lz4_compress.py
Normal file
35
fusee/program/lz4_compress.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env python
|
||||
import sys, lz4, hashlib
|
||||
from struct import unpack as up, pack as pk
|
||||
|
||||
def lz4_compress(data):
|
||||
try:
|
||||
import lz4.block as block
|
||||
except ImportError:
|
||||
block = lz4.LZ4_compress
|
||||
return block.compress(data, 'high_compression', store_size=False)
|
||||
|
||||
def read_file(fn):
|
||||
with open(fn, 'rb') as f:
|
||||
return f.read()
|
||||
|
||||
def get_overlay(program, i):
|
||||
return program[0x2B000 + 0x14000 * i:0x2B000 + 0x14000 * (i+1)]
|
||||
|
||||
def main(argc, argv):
|
||||
if argc != 3:
|
||||
print('Usage: %s in out' % argv[0])
|
||||
return 1
|
||||
data = read_file(argv[1])
|
||||
erista_mtc = get_overlay(data, 1)
|
||||
mariko_mtc = get_overlay(data, 2)
|
||||
erista_hsh = hashlib.sha256(erista_mtc[:-4]).digest()[:4]
|
||||
mariko_hsh = hashlib.sha256(mariko_mtc[:-4]).digest()[:4]
|
||||
fusee_program = lz4_compress(data[:0x2B000 - 8] + erista_hsh + mariko_hsh + get_overlay(data, 0)[:0x11000])
|
||||
with open(argv[2], 'wb') as f:
|
||||
f.write(fusee_program)
|
||||
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(len(sys.argv), sys.argv))
|
|
@ -19,11 +19,11 @@
|
|||
|
||||
namespace ams::nxboot {
|
||||
|
||||
constexpr inline const size_t SecondaryArchiveSize = 8_MB;
|
||||
constexpr inline const size_t ExternalPackageSize = 8_MB;
|
||||
|
||||
constexpr inline const size_t InitialProcessStorageSizeMax = 3_MB / 8;
|
||||
|
||||
struct SecondaryArchiveContentMeta {
|
||||
struct ExternalPackageContentMeta {
|
||||
u32 offset;
|
||||
u32 size;
|
||||
u8 type;
|
||||
|
@ -31,17 +31,17 @@ namespace ams::nxboot {
|
|||
u32 pad;
|
||||
char name[0x10];
|
||||
};
|
||||
static_assert(sizeof(SecondaryArchiveContentMeta) == 0x20);
|
||||
static_assert(sizeof(ExternalPackageContentMeta) == 0x20);
|
||||
|
||||
struct SecondaryArchiveKipMeta {
|
||||
struct ExternalPackageKipMeta {
|
||||
u64 program_id;
|
||||
u32 offset;
|
||||
u32 size;
|
||||
se::Sha256Hash hash;
|
||||
};
|
||||
static_assert(sizeof(SecondaryArchiveKipMeta) == 0x30);
|
||||
static_assert(sizeof(ExternalPackageKipMeta) == 0x30);
|
||||
|
||||
struct SecondaryArchiveHeader {
|
||||
struct ExternalPackageHeader {
|
||||
static constexpr u32 Magic = util::FourCC<'F','S','S','0'>::Code;
|
||||
|
||||
u32 reserved0; /* Previously entrypoint. */
|
||||
|
@ -58,15 +58,15 @@ namespace ams::nxboot {
|
|||
u32 supported_hos_version;
|
||||
u32 release_version;
|
||||
u32 git_revision;
|
||||
SecondaryArchiveContentMeta content_metas[(0x400 - 0x40) / sizeof(SecondaryArchiveContentMeta)];
|
||||
SecondaryArchiveKipMeta emummc_meta;
|
||||
SecondaryArchiveKipMeta kip_metas[8];
|
||||
u8 reserved3[0x800 - (0x400 + 9 * sizeof(SecondaryArchiveKipMeta))];
|
||||
ExternalPackageContentMeta content_metas[(0x400 - 0x40) / sizeof(ExternalPackageContentMeta)];
|
||||
ExternalPackageKipMeta emummc_meta;
|
||||
ExternalPackageKipMeta kip_metas[8];
|
||||
u8 reserved3[0x800 - (0x400 + 9 * sizeof(ExternalPackageKipMeta))];
|
||||
};
|
||||
static_assert(sizeof(SecondaryArchiveHeader) == 0x800);
|
||||
static_assert(sizeof(ExternalPackageHeader) == 0x800);
|
||||
|
||||
struct SecondaryArchive {
|
||||
SecondaryArchiveHeader header; /* 0x000000-0x000800 */
|
||||
struct ExternalPackage {
|
||||
ExternalPackageHeader header; /* 0x000000-0x000800 */
|
||||
u8 warmboot[0x1800]; /* 0x000800-0x002000 */
|
||||
u8 tsec_keygen[0x2000]; /* 0x002000-0x004000 */
|
||||
u8 mariko_fatal[0x1C000]; /* 0x004000-0x020000 */
|
||||
|
@ -80,8 +80,8 @@ namespace ams::nxboot {
|
|||
u8 reboot_stub[0x1000]; /* 0x7E0000-0x7E1000 */
|
||||
u8 reserved[0x1F000]; /* 0x7E1000-0x800000 */
|
||||
};
|
||||
static_assert(sizeof(SecondaryArchive) == SecondaryArchiveSize);
|
||||
static_assert(sizeof(ExternalPackage) == ExternalPackageSize);
|
||||
|
||||
ALWAYS_INLINE const SecondaryArchive &GetSecondaryArchive() { return *reinterpret_cast<const SecondaryArchive *>(0xC0000000); }
|
||||
ALWAYS_INLINE const ExternalPackage &GetExternalPackage() { return *reinterpret_cast<const ExternalPackage *>(0xC0000000); }
|
||||
|
||||
}
|
|
@ -22,7 +22,7 @@
|
|||
#include "fusee_overlay_manager.hpp"
|
||||
#include "fusee_sd_card.hpp"
|
||||
#include "fusee_fatal.hpp"
|
||||
#include "fusee_secondary_archive.hpp"
|
||||
#include "fusee_external_package.hpp"
|
||||
#include "fusee_setup_horizon.hpp"
|
||||
#include "fusee_secmon_sync.hpp"
|
||||
|
||||
|
@ -30,41 +30,40 @@ namespace ams::nxboot {
|
|||
|
||||
namespace {
|
||||
|
||||
/* TODO: Change to fusee-secondary.bin when development is done. */
|
||||
constexpr const char SecondaryArchiveFilePath[] = "sdmc:/atmosphere/fusee-boogaloo.bin";
|
||||
constexpr const char ExternalPackageFilePath[] = "sdmc:/atmosphere/package3";
|
||||
|
||||
constinit fs::FileHandle g_archive_file;
|
||||
constinit fs::FileHandle g_package_file;
|
||||
|
||||
void OpenSecondaryArchive() {
|
||||
void OpenExternalPackage() {
|
||||
Result result;
|
||||
|
||||
/* Open fusee-secondary. */
|
||||
if (R_FAILED((result = fs::OpenFile(std::addressof(g_archive_file), SecondaryArchiveFilePath, fs::OpenMode_Read)))) {
|
||||
ShowFatalError("Failed to open %s!\n", SecondaryArchiveFilePath);
|
||||
/* Open external package. */
|
||||
if (R_FAILED((result = fs::OpenFile(std::addressof(g_package_file), ExternalPackageFilePath, fs::OpenMode_Read)))) {
|
||||
ShowFatalError("Failed to open %s!\n", ExternalPackageFilePath);
|
||||
}
|
||||
|
||||
/* Get file size. */
|
||||
s64 file_size;
|
||||
if (R_FAILED((result = fs::GetFileSize(std::addressof(file_size), g_archive_file)))) {
|
||||
ShowFatalError("Failed to get fusee-secondary size: 0x%08" PRIx32 "\n", result.GetValue());
|
||||
if (R_FAILED((result = fs::GetFileSize(std::addressof(file_size), g_package_file)))) {
|
||||
ShowFatalError("Failed to get package3 size: 0x%08" PRIx32 "\n", result.GetValue());
|
||||
}
|
||||
|
||||
/* Check file size. */
|
||||
if (static_cast<size_t>(file_size) != SecondaryArchiveSize) {
|
||||
ShowFatalError("fusee-secondary seems corrupted (size 0x%zx != 0x%zx)", static_cast<size_t>(file_size), SecondaryArchiveSize);
|
||||
if (static_cast<size_t>(file_size) != ExternalPackageSize) {
|
||||
ShowFatalError("package3 seems corrupted (size 0x%zx != 0x%zx)", static_cast<size_t>(file_size), ExternalPackageSize);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadFullSecondaryArchive() {
|
||||
void ReadFullExternalPackage() {
|
||||
Result result;
|
||||
|
||||
if (R_FAILED((result = fs::ReadFile(g_archive_file, 0, const_cast<void *>(static_cast<const void *>(std::addressof(GetSecondaryArchive()))), SecondaryArchiveSize)))) {
|
||||
ShowFatalError("Failed to read %s!\n", SecondaryArchiveFilePath);
|
||||
if (R_FAILED((result = fs::ReadFile(g_package_file, 0, const_cast<void *>(static_cast<const void *>(std::addressof(GetExternalPackage()))), ExternalPackageSize)))) {
|
||||
ShowFatalError("Failed to read %s!\n", ExternalPackageFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
void CloseSecondaryArchive() {
|
||||
fs::CloseFile(g_archive_file);
|
||||
void CloseExternalPackage() {
|
||||
fs::CloseFile(g_package_file);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -98,17 +97,17 @@ namespace ams::nxboot {
|
|||
/* If we have a fatal error, save and display it. */
|
||||
SaveAndShowFatalError();
|
||||
|
||||
/* Open the secondary archive. */
|
||||
OpenSecondaryArchive();
|
||||
/* Open the external package. */
|
||||
OpenExternalPackage();
|
||||
|
||||
/* Load the memory training overlay. */
|
||||
LoadOverlay(g_archive_file, OverlayId_MemoryTraining);
|
||||
LoadOverlay(g_package_file, OverlayId_MemoryTraining);
|
||||
|
||||
/* Do memory training. */
|
||||
DoMemoryTraining();
|
||||
|
||||
/* Read the rest of the archive file. */
|
||||
ReadFullSecondaryArchive();
|
||||
ReadFullExternalPackage();
|
||||
|
||||
/* Save the memory training overlay. */
|
||||
SaveMemoryTrainingOverlay();
|
||||
|
@ -117,8 +116,8 @@ namespace ams::nxboot {
|
|||
InitializeDisplay();
|
||||
ShowDisplay();
|
||||
|
||||
/* Close the secondary archive. */
|
||||
CloseSecondaryArchive();
|
||||
/* Close the external package. */
|
||||
CloseExternalPackage();
|
||||
|
||||
/* Perform rest of the boot process. */
|
||||
SetupAndStartHorizon();
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
#include <exosphere.hpp>
|
||||
#include "fusee_malloc.hpp"
|
||||
#include "fusee_secondary_archive.hpp"
|
||||
#include "fusee_fatal.hpp"
|
||||
|
||||
namespace ams::nxboot {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
#include <exosphere.hpp>
|
||||
#include "fusee_overlay_manager.hpp"
|
||||
#include "fusee_secondary_archive.hpp"
|
||||
#include "fusee_external_package.hpp"
|
||||
#include "fusee_fatal.hpp"
|
||||
|
||||
namespace ams::nxboot {
|
||||
|
@ -33,13 +33,13 @@ namespace ams::nxboot {
|
|||
u32 verif_hash;
|
||||
u32 store_hash;
|
||||
if (fuse::GetSocType() == fuse::SocType_Erista) {
|
||||
result = fs::ReadFile(archive_file, __builtin_offsetof(SecondaryArchive, ovl_mtc_erista), GetOverlayDestination(), sizeof(SecondaryArchive{}.ovl_mtc_erista));
|
||||
result = fs::ReadFile(archive_file, __builtin_offsetof(ExternalPackage, ovl_mtc_erista), GetOverlayDestination(), sizeof(ExternalPackage{}.ovl_mtc_erista));
|
||||
verif_hash = reinterpret_cast<const u32 *>(GetOverlayDestination())[-2];
|
||||
store_hash = reinterpret_cast<const u32 *>(GetOverlayDestination())[(sizeof(SecondaryArchive{}.ovl_mtc_erista) / sizeof(u32)) - 1];
|
||||
store_hash = reinterpret_cast<const u32 *>(GetOverlayDestination())[(sizeof(ExternalPackage{}.ovl_mtc_erista) / sizeof(u32)) - 1];
|
||||
} else /* if (fuse::GetSocType() == fuse::SocType_Mariko) */ {
|
||||
result = fs::ReadFile(archive_file, __builtin_offsetof(SecondaryArchive, ovl_mtc_mariko), GetOverlayDestination(), sizeof(SecondaryArchive{}.ovl_mtc_mariko));
|
||||
result = fs::ReadFile(archive_file, __builtin_offsetof(ExternalPackage, ovl_mtc_mariko), GetOverlayDestination(), sizeof(ExternalPackage{}.ovl_mtc_mariko));
|
||||
verif_hash = reinterpret_cast<const u32 *>(GetOverlayDestination())[-1];
|
||||
store_hash = reinterpret_cast<const u32 *>(GetOverlayDestination())[(sizeof(SecondaryArchive{}.ovl_mtc_mariko) / sizeof(u32)) - 1];
|
||||
store_hash = reinterpret_cast<const u32 *>(GetOverlayDestination())[(sizeof(ExternalPackage{}.ovl_mtc_mariko) / sizeof(u32)) - 1];
|
||||
}
|
||||
|
||||
if (R_FAILED(result)) {
|
||||
|
@ -64,19 +64,19 @@ namespace ams::nxboot {
|
|||
void SaveMemoryTrainingOverlay() {
|
||||
if (fuse::GetSocType() == fuse::SocType_Erista) {
|
||||
/* NOTE: Erista does not do memory clock restoration. */
|
||||
/* std::memcpy(const_cast<u8 *>(GetSecondaryArchive().ovl_mtc_erista), GetOverlayDestination(), sizeof(SecondaryArchive{}.ovl_mtc_erista)); */
|
||||
/* std::memcpy(const_cast<u8 *>(GetExternalPackage().ovl_mtc_erista), GetOverlayDestination(), sizeof(ExternalPackage{}.ovl_mtc_erista)); */
|
||||
} else /* if (fuse::GetSocType() == fuse::SocType_Mariko) */ {
|
||||
std::memcpy(const_cast<u8 *>(GetSecondaryArchive().ovl_mtc_mariko), GetOverlayDestination(), sizeof(SecondaryArchive{}.ovl_mtc_mariko) - 0x2000);
|
||||
std::memcpy(const_cast<u8 *>(GetExternalPackage().ovl_mtc_mariko), GetOverlayDestination(), sizeof(ExternalPackage{}.ovl_mtc_mariko) - 0x2000);
|
||||
}
|
||||
}
|
||||
|
||||
void RestoreMemoryTrainingOverlay() {
|
||||
if (fuse::GetSocType() == fuse::SocType_Erista) {
|
||||
/* NOTE: Erista does not do memory clock restoration. */
|
||||
/* std::memcpy(GetOverlayDestination(), GetSecondaryArchive().ovl_mtc_erista, sizeof(SecondaryArchive{}.ovl_mtc_erista)); */
|
||||
/* std::memcpy(GetOverlayDestination(), GetExternalPackage().ovl_mtc_erista, sizeof(ExternalPackage{}.ovl_mtc_erista)); */
|
||||
} else /* if (fuse::GetSocType() == fuse::SocType_Mariko) */ {
|
||||
std::memcpy(g_secmon_debug_storage, secmon::MemoryRegionPhysicalIramSecureMonitorDebug.GetPointer<void>(), sizeof(g_secmon_debug_storage));
|
||||
std::memcpy(GetOverlayDestination(), GetSecondaryArchive().ovl_mtc_mariko, sizeof(SecondaryArchive{}.ovl_mtc_mariko) - 0x2000);
|
||||
std::memcpy(GetOverlayDestination(), GetExternalPackage().ovl_mtc_mariko, sizeof(ExternalPackage{}.ovl_mtc_mariko) - 0x2000);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <exosphere.hpp>
|
||||
#include <exosphere/secmon/secmon_monitor_context.hpp>
|
||||
#include "fusee_key_derivation.hpp"
|
||||
#include "fusee_secondary_archive.hpp"
|
||||
#include "fusee_external_package.hpp"
|
||||
#include "fusee_setup_horizon.hpp"
|
||||
#include "fusee_ini.hpp"
|
||||
#include "fusee_emummc.hpp"
|
||||
|
@ -44,7 +44,7 @@ namespace ams::nxboot {
|
|||
if (soc_type == fuse::SocType_Erista) {
|
||||
clkrst::SetBpmpClockRate(clkrst::BpmpClockRate_408MHz);
|
||||
|
||||
if (!tsec::RunTsecFirmware(GetSecondaryArchive().tsec_keygen, sizeof(GetSecondaryArchive().tsec_keygen))) {
|
||||
if (!tsec::RunTsecFirmware(GetExternalPackage().tsec_keygen, sizeof(GetExternalPackage().tsec_keygen))) {
|
||||
ShowFatalError("Failed to run tsec_keygen firmware!\n");
|
||||
}
|
||||
|
||||
|
@ -428,10 +428,10 @@ namespace ams::nxboot {
|
|||
|
||||
void LoadWarmbootFirmware(fuse::SocType soc_type, ams::TargetFirmware target_firmware, const u8 *package1) {
|
||||
u8 *warmboot_dst = secmon::MemoryRegionPhysicalIramWarmbootBin.GetPointer<u8>();
|
||||
size_t warmboot_size = std::min(sizeof(GetSecondaryArchive().warmboot), secmon::MemoryRegionPhysicalIramWarmbootBin.GetSize());
|
||||
size_t warmboot_size = std::min(sizeof(GetExternalPackage().warmboot), secmon::MemoryRegionPhysicalIramWarmbootBin.GetSize());
|
||||
if (soc_type == fuse::SocType_Erista) {
|
||||
/* Copy the ams warmboot binary. */
|
||||
std::memcpy(warmboot_dst, GetSecondaryArchive().warmboot, warmboot_size);
|
||||
std::memcpy(warmboot_dst, GetExternalPackage().warmboot, warmboot_size);
|
||||
|
||||
/* Set the rsa modulus. */
|
||||
if (fuse::GetHardwareState() == fuse::HardwareState_Production) {
|
||||
|
@ -694,7 +694,7 @@ namespace ams::nxboot {
|
|||
|
||||
/* Get the size. */
|
||||
s64 size;
|
||||
if (R_FAILED((result = fs::GetFileSize(std::addressof(size), exo_file))) || size > sizeof(GetSecondaryArchive().exosphere)) {
|
||||
if (R_FAILED((result = fs::GetFileSize(std::addressof(size), exo_file))) || size > sizeof(GetExternalPackage().exosphere)) {
|
||||
ShowFatalError("Invalid SD exosphere size: 0x%08" PRIx32 ", %" PRIx64 "!\n", result.GetValue(), static_cast<u64>(size));
|
||||
}
|
||||
|
||||
|
@ -706,7 +706,7 @@ namespace ams::nxboot {
|
|||
}
|
||||
|
||||
if (!use_sd_exo) {
|
||||
std::memcpy(exosphere_dst, GetSecondaryArchive().exosphere, sizeof(GetSecondaryArchive().exosphere));
|
||||
std::memcpy(exosphere_dst, GetExternalPackage().exosphere, sizeof(GetExternalPackage().exosphere));
|
||||
}
|
||||
|
||||
/* Copy mariko fatal. */
|
||||
|
@ -726,7 +726,7 @@ namespace ams::nxboot {
|
|||
|
||||
/* Get the size. */
|
||||
s64 size;
|
||||
if (R_FAILED((result = fs::GetFileSize(std::addressof(size), mariko_program_file))) || size > sizeof(GetSecondaryArchive().mariko_fatal)) {
|
||||
if (R_FAILED((result = fs::GetFileSize(std::addressof(size), mariko_program_file))) || size > sizeof(GetExternalPackage().mariko_fatal)) {
|
||||
ShowFatalError("Invalid SD mariko_fatal size: 0x%08" PRIx32 ", %" PRIx64 "!\n", result.GetValue(), static_cast<u64>(size));
|
||||
}
|
||||
|
||||
|
@ -736,12 +736,12 @@ namespace ams::nxboot {
|
|||
}
|
||||
|
||||
/* Clear the remainder. */
|
||||
std::memset(mariko_fatal_dst + size, 0, sizeof(GetSecondaryArchive().mariko_fatal) - size);
|
||||
std::memset(mariko_fatal_dst + size, 0, sizeof(GetExternalPackage().mariko_fatal) - size);
|
||||
}
|
||||
}
|
||||
|
||||
if (!use_sd_mariko_fatal) {
|
||||
std::memcpy(mariko_fatal_dst, GetSecondaryArchive().mariko_fatal, sizeof(GetSecondaryArchive().mariko_fatal));
|
||||
std::memcpy(mariko_fatal_dst, GetExternalPackage().mariko_fatal, sizeof(GetExternalPackage().mariko_fatal));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "fusee_stratosphere.hpp"
|
||||
#include "fusee_fatal.hpp"
|
||||
#include "fusee_malloc.hpp"
|
||||
#include "fusee_secondary_archive.hpp"
|
||||
#include "fusee_external_package.hpp"
|
||||
#include "fs/fusee_fs_api.hpp"
|
||||
|
||||
namespace ams::nxboot {
|
||||
|
@ -726,11 +726,11 @@ namespace ams::nxboot {
|
|||
|
||||
/* Add the stratosphere kips. */
|
||||
{
|
||||
const auto &secondary_archive = GetSecondaryArchive();
|
||||
for (u32 i = 0; i < secondary_archive.header.num_kips; ++i) {
|
||||
const auto &meta = secondary_archive.header.kip_metas[i];
|
||||
const auto &external_package = GetExternalPackage();
|
||||
for (u32 i = 0; i < external_package.header.num_kips; ++i) {
|
||||
const auto &meta = external_package.header.kip_metas[i];
|
||||
|
||||
AddInitialProcess(reinterpret_cast<const InitialProcessHeader *>(secondary_archive.kips + meta.offset), std::addressof(meta.hash));
|
||||
AddInitialProcess(reinterpret_cast<const InitialProcessHeader *>(external_package.kips + meta.offset), std::addressof(meta.hash));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -893,8 +893,8 @@ namespace ams::nxboot {
|
|||
}
|
||||
|
||||
void RebuildPackage2(ams::TargetFirmware target_firmware, bool emummc_enabled) {
|
||||
/* Get the secondary archive. */
|
||||
const auto &secondary_archive = GetSecondaryArchive();
|
||||
/* Get the external package. */
|
||||
const auto &external_package = GetExternalPackage();
|
||||
|
||||
/* Clear package2 header. */
|
||||
auto *package2 = secmon::MemoryRegionDramPackage2.GetPointer<pkg2::Package2Header>();
|
||||
|
@ -918,8 +918,8 @@ namespace ams::nxboot {
|
|||
if (void *sd_meso = ReadFile(std::addressof(meso_size), "sdmc:/atmosphere/mesosphere.bin"); sd_meso != nullptr) {
|
||||
std::memcpy(payload_data, sd_meso, meso_size);
|
||||
} else {
|
||||
meso_size = secondary_archive.header.meso_size;
|
||||
std::memcpy(payload_data, secondary_archive.mesosphere, meso_size);
|
||||
meso_size = external_package.header.meso_size;
|
||||
std::memcpy(payload_data, external_package.mesosphere, meso_size);
|
||||
}
|
||||
|
||||
/* Read emummc, if needed. */
|
||||
|
@ -928,8 +928,8 @@ namespace ams::nxboot {
|
|||
if (emummc_enabled) {
|
||||
emummc = static_cast<const InitialProcessHeader *>(ReadFile(std::addressof(emummc_size), "sdmc:/atmosphere/emummc.kip"));
|
||||
if (emummc == nullptr) {
|
||||
emummc = reinterpret_cast<const InitialProcessHeader *>(secondary_archive.kips + secondary_archive.header.emummc_meta.offset);
|
||||
emummc_size = secondary_archive.header.emummc_meta.size;
|
||||
emummc = reinterpret_cast<const InitialProcessHeader *>(external_package.kips + external_package.header.emummc_meta.offset);
|
||||
emummc_size = external_package.header.emummc_meta.size;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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++) {
|
||||
|
|
Loading…
Reference in a new issue