Compare commits
200 Commits
pc_testing
...
1.4.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32b590e7ab | ||
|
|
590f22933d | ||
|
|
0dd071b279 | ||
|
|
f1132fbf5a | ||
|
|
9cd57b6c61 | ||
|
|
bf66e40a7b | ||
|
|
77cc53227a | ||
|
|
59a295db79 | ||
|
|
e4b9930bf3 | ||
|
|
04c9004e05 | ||
|
|
1f8798ace7 | ||
|
|
ff7a80e592 | ||
|
|
e3ace4be15 | ||
|
|
36a33617a4 | ||
|
|
8ce4f19615 | ||
|
|
05fee5d53c | ||
|
|
f88606fbc1 | ||
|
|
e580c3970c | ||
|
|
2603136e8b | ||
|
|
3d3f8629af | ||
|
|
d178ea368a | ||
|
|
b444385762 | ||
|
|
0c3f1bed33 | ||
|
|
bf4fdf6188 | ||
|
|
13238fc4fd | ||
|
|
e7a1e0fee2 | ||
|
|
5a918f3bc9 | ||
|
|
ea82889e6c | ||
|
|
7f2cbba543 | ||
|
|
5ee7d8a5ed | ||
|
|
947fdcf6f6 | ||
|
|
2e73f33eb0 | ||
|
|
752704a798 | ||
|
|
d00406e089 | ||
|
|
dddb5bfdea | ||
|
|
ed0572bd53 | ||
|
|
b3bbc99cfb | ||
|
|
0ebbbc839f | ||
|
|
275c0234cb | ||
|
|
427130a122 | ||
|
|
ef07964ea0 | ||
|
|
e1aff401ba | ||
|
|
05de5538d6 | ||
|
|
9929517a83 | ||
|
|
545765d167 | ||
|
|
8d9e3f2a31 | ||
|
|
28f0940c58 | ||
|
|
d954e85826 | ||
|
|
7e6b369605 | ||
|
|
e702eab21c | ||
|
|
592b9c66d1 | ||
|
|
8e17feff94 | ||
|
|
6514e365ad | ||
|
|
efa4a346af | ||
|
|
d75f9bbedf | ||
|
|
ea7f51a279 | ||
|
|
a65b6df8d2 | ||
|
|
4e112de223 | ||
|
|
20d200471d | ||
|
|
5f2d713fe4 | ||
|
|
114d2598da | ||
|
|
36bdb83cfc | ||
|
|
a975689c59 | ||
|
|
a809e23320 | ||
|
|
4db485083b | ||
|
|
e96972c939 | ||
|
|
3545c0aac2 | ||
|
|
d85875b910 | ||
|
|
b1367942a2 | ||
|
|
c2c0a2e169 | ||
|
|
f5052b4bca | ||
|
|
70d67bb115 | ||
|
|
9056e0b05f | ||
|
|
895b6d0470 | ||
|
|
dfba595cdc | ||
|
|
175a34da43 | ||
|
|
02b126c2be | ||
|
|
b45671fd35 | ||
|
|
106599895d | ||
|
|
80154b0a54 | ||
|
|
62eb4d6989 | ||
|
|
b52e44e798 | ||
|
|
72baa4ff18 | ||
|
|
442656899f | ||
|
|
d7f89a0c31 | ||
|
|
2e6223d9d0 | ||
|
|
28f11a86fd | ||
|
|
a8b52dc123 | ||
|
|
9b47ddf01f | ||
|
|
0fbf007bcf | ||
|
|
4ad8dad416 | ||
|
|
8e258bde9d | ||
|
|
c0d5140ef0 | ||
|
|
1bef1b58d4 | ||
|
|
07cd682460 | ||
|
|
e5c3d264ec | ||
|
|
bbf22b4c60 | ||
|
|
dd78ede99f | ||
|
|
e5b1739f65 | ||
|
|
a4a2cc2218 | ||
|
|
5ffbed1bee | ||
|
|
ec44eaa263 | ||
|
|
20e53fcd82 | ||
|
|
64c6ef2de7 | ||
|
|
817ad8f98d | ||
|
|
dfa475a769 | ||
|
|
141ae5c7ab | ||
|
|
4646581e93 | ||
|
|
b69fa13576 | ||
|
|
0da15a30fd | ||
|
|
44d553d12e | ||
|
|
6f54ab5716 | ||
|
|
596a0f2551 | ||
|
|
ff828dc0bc | ||
|
|
027f3b4911 | ||
|
|
3fff114b14 | ||
|
|
f23f490cb4 | ||
|
|
c503629ac8 | ||
|
|
6b436739be | ||
|
|
4f763b2aa4 | ||
|
|
12d83106fd | ||
|
|
e3cb5e74b9 | ||
|
|
b1a4a0db67 | ||
|
|
847fee4901 | ||
|
|
f2b48d466f | ||
|
|
6e97dff27f | ||
|
|
be399772c0 | ||
|
|
45da60f902 | ||
|
|
01fd324d4f | ||
|
|
f95bdb87a0 | ||
|
|
91d3d242f5 | ||
|
|
383fc2cc99 | ||
|
|
1ca2f61527 | ||
|
|
cdc619a8a6 | ||
|
|
ff07ba4201 | ||
|
|
9d89835ff8 | ||
|
|
6e17317d5d | ||
|
|
79afa3b64c | ||
|
|
f3968f5f7c | ||
|
|
a8e23adffe | ||
|
|
401047f603 | ||
|
|
24739f245e | ||
|
|
8cb3cfd835 | ||
|
|
14e768cd10 | ||
|
|
ef1b67b87b | ||
|
|
8ef6c49d30 | ||
|
|
a89c5dd5d7 | ||
|
|
dfcb5005d2 | ||
|
|
f3e3649bd5 | ||
|
|
07f91f0a83 | ||
|
|
81005fa3f8 | ||
|
|
60d78bbf75 | ||
|
|
247852db3a | ||
|
|
51c145f6c9 | ||
|
|
74fddf667a | ||
|
|
027242e909 | ||
|
|
86f98e49c7 | ||
|
|
3579797309 | ||
|
|
77b3bfcd16 | ||
|
|
fa98bf9434 | ||
|
|
e975784179 | ||
|
|
dc643daaa7 | ||
|
|
e05df99342 | ||
|
|
0cfc93d423 | ||
|
|
588d761615 | ||
|
|
320a946fc7 | ||
|
|
ca142889c4 | ||
|
|
000713186f | ||
|
|
c35114bacc | ||
|
|
2d984822c6 | ||
|
|
32d443977e | ||
|
|
9866285f0e | ||
|
|
9911c44670 | ||
|
|
741efd04ec | ||
|
|
e13b81aa9e | ||
|
|
11e4bed199 | ||
|
|
ba4e7c5866 | ||
|
|
da1b24b9b5 | ||
|
|
cb3d20ef79 | ||
|
|
be9338eb33 | ||
|
|
7a69723021 | ||
|
|
d638bbbb62 | ||
|
|
df631d74f0 | ||
|
|
3c6d965e1a | ||
|
|
49cddd68e4 | ||
|
|
ee5f99fdb4 | ||
|
|
7456a77ba9 | ||
|
|
a3865e721a | ||
|
|
6aab36fc6a | ||
|
|
79b1835a2b | ||
|
|
646f84bad1 | ||
|
|
18168d54c3 | ||
|
|
edf80192d9 | ||
|
|
13697fa921 | ||
|
|
706b8492fd | ||
|
|
6368d8063a | ||
|
|
1933f35db6 | ||
|
|
64a97576d0 | ||
|
|
9a38be201a | ||
|
|
9545cbb4cb |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -84,12 +84,16 @@ dkms.conf
|
|||||||
|
|
||||||
.**/
|
.**/
|
||||||
|
|
||||||
|
# macOS horseshittery
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
# NOTE: make sure to make exceptions to this pattern when needed!
|
# NOTE: make sure to make exceptions to this pattern when needed!
|
||||||
*.bin
|
*.bin
|
||||||
*.enc
|
*.enc
|
||||||
|
|
||||||
**/out
|
**/out
|
||||||
**/build
|
**/build
|
||||||
|
**/lib
|
||||||
**/build_nintendo_nx_arm64
|
**/build_nintendo_nx_arm64
|
||||||
**/build_nintendo_nx_arm64_armv8a
|
**/build_nintendo_nx_arm64_armv8a
|
||||||
**/build_nintendo_nx_arm
|
**/build_nintendo_nx_arm
|
||||||
@@ -99,6 +103,8 @@ dkms.conf
|
|||||||
**/build_nintendo_nx_x64
|
**/build_nintendo_nx_x64
|
||||||
**/build_nintendo_nx_x86
|
**/build_nintendo_nx_x86
|
||||||
|
|
||||||
|
tools/*/
|
||||||
|
|
||||||
package3
|
package3
|
||||||
|
|
||||||
stratosphere/test/
|
stratosphere/test/
|
||||||
|
|||||||
200
Makefile
200
Makefile
@@ -1,186 +1,42 @@
|
|||||||
ifeq ($(strip $(DEVKITPRO)),)
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
|
all: nx_release
|
||||||
endif
|
clean: clean-nx_release
|
||||||
|
|
||||||
include $(DEVKITPRO)/devkitA64/base_tools
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
|
||||||
TOPTARGETS := all clean dist-no-debug dist
|
define ATMOSPHERE_ADD_TARGET
|
||||||
AMSBRANCH := $(shell git symbolic-ref --short HEAD)
|
|
||||||
AMSHASH := $(shell git rev-parse --short HEAD)
|
|
||||||
AMSREV := $(AMSBRANCH)-$(AMSHASH)
|
|
||||||
|
|
||||||
ifneq (, $(strip $(shell git status --porcelain 2>/dev/null)))
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
AMSREV := $(AMSREV)-dirty
|
|
||||||
endif
|
|
||||||
|
|
||||||
COMPONENTS := fusee stratosphere mesosphere exosphere emummc thermosphere troposphere libraries
|
$(strip $1):
|
||||||
|
@echo "Building $(strip $1)"
|
||||||
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/atmosphere.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
all: $(COMPONENTS)
|
clean-$(strip $1):
|
||||||
$(eval MAJORVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MAJOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
@echo "Cleaning $(strip $1)"
|
||||||
| tr -s [:blank:] \
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/atmosphere.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
| 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:
|
endef
|
||||||
$(MAKE) -C thermosphere all
|
|
||||||
|
|
||||||
exosphere: thermosphere
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
$(MAKE) -C exosphere all
|
|
||||||
|
|
||||||
stratosphere: exosphere libraries
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
$(MAKE) -C stratosphere all
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
|
))
|
||||||
|
|
||||||
mesosphere: exosphere libraries
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
$(MAKE) -C mesosphere all
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
|
))
|
||||||
|
|
||||||
troposphere: stratosphere
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
$(MAKE) -C troposphere all
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
|
))
|
||||||
|
|
||||||
emummc:
|
endef
|
||||||
$(MAKE) -C emummc all
|
|
||||||
|
|
||||||
fusee: exosphere mesosphere stratosphere
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm-cortex-a57,))
|
||||||
$(MAKE) -C $@ all
|
|
||||||
|
|
||||||
libraries:
|
clean-all: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
$(MAKE) -C libraries all
|
|
||||||
|
|
||||||
clean:
|
.PHONY: all clean clean-all $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
$(MAKE) -C fusee clean
|
|
||||||
$(MAKE) -C emummc clean
|
|
||||||
$(MAKE) -C libraries clean
|
|
||||||
$(MAKE) -C exosphere clean
|
|
||||||
$(MAKE) -C thermosphere clean
|
|
||||||
$(MAKE) -C mesosphere clean
|
|
||||||
$(MAKE) -C stratosphere clean
|
|
||||||
rm -rf out
|
|
||||||
|
|
||||||
dist-no-debug: all
|
|
||||||
$(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 AMSVER = $(MAJORVER).$(MINORVER).$(MICROVER)-$(AMSREV))
|
|
||||||
rm -rf atmosphere-$(AMSVER)
|
|
||||||
rm -rf out
|
|
||||||
mkdir atmosphere-$(AMSVER)
|
|
||||||
mkdir atmosphere-$(AMSVER)/atmosphere
|
|
||||||
mkdir atmosphere-$(AMSVER)/switch
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/fatal_errors
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/config_templates
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/config
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/flags
|
|
||||||
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
|
|
||||||
mkdir -p config_templates/kip_patches
|
|
||||||
cp -r config_templates/kip_patches atmosphere-$(AMSVER)/atmosphere/kip_patches
|
|
||||||
cp -r config_templates/hbl_html atmosphere-$(AMSVER)/atmosphere/hbl_html
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000008
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000000D
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000017
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000002B
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000032
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000034
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000036
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000037
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000003C
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000042
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000420
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000B240
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000D609
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000D623
|
|
||||||
cp stratosphere/boot2/boot2.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000008/exefs.nsp
|
|
||||||
cp stratosphere/dmnt/dmnt.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000000D/exefs.nsp
|
|
||||||
cp stratosphere/cs/cs.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000017/exefs.nsp
|
|
||||||
cp stratosphere/erpt/erpt.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000002B/exefs.nsp
|
|
||||||
cp stratosphere/eclct.stub/eclct.stub.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000032/exefs.nsp
|
|
||||||
cp stratosphere/fatal/fatal.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000034/exefs.nsp
|
|
||||||
cp stratosphere/creport/creport.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000036/exefs.nsp
|
|
||||||
cp stratosphere/ro/ro.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000037/exefs.nsp
|
|
||||||
cp stratosphere/jpegdec/jpegdec.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000003C/exefs.nsp
|
|
||||||
cp stratosphere/pgl/pgl.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000042/exefs.nsp
|
|
||||||
cp stratosphere/LogManager/LogManager.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000420/exefs.nsp
|
|
||||||
cp stratosphere/htc/htc.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000B240/exefs.nsp
|
|
||||||
cp stratosphere/dmnt.gen2/dmnt.gen2.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000D609/exefs.nsp
|
|
||||||
cp stratosphere/TioServer/TioServer.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000D623/exefs.nsp
|
|
||||||
@build_romfs atmosphere-$(AMSVER)/stratosphere_romfs atmosphere-$(AMSVER)/atmosphere/stratosphere.romfs
|
|
||||||
rm -r atmosphere-$(AMSVER)/stratosphere_romfs
|
|
||||||
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 ../;
|
|
||||||
rm -rf atmosphere-$(AMSVER)
|
|
||||||
mkdir out
|
|
||||||
mv atmosphere-$(AMSVER).zip out/atmosphere-$(AMSVER).zip
|
|
||||||
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 \
|
|
||||||
| 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 AMSVER = $(MAJORVER).$(MINORVER).$(MICROVER)-$(AMSREV))
|
|
||||||
rm -rf atmosphere-$(AMSVER)-debug
|
|
||||||
mkdir atmosphere-$(AMSVER)-debug
|
|
||||||
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
|
|
||||||
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/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/kernel.elf atmosphere-$(AMSVER)-debug/kernel.elf
|
|
||||||
cp stratosphere/ams_mitm/ams_mitm.elf atmosphere-$(AMSVER)-debug/ams_mitm.elf
|
|
||||||
cp stratosphere/boot/boot.elf atmosphere-$(AMSVER)-debug/boot.elf
|
|
||||||
cp stratosphere/boot2/boot2.elf atmosphere-$(AMSVER)-debug/boot2.elf
|
|
||||||
cp stratosphere/creport/creport.elf atmosphere-$(AMSVER)-debug/creport.elf
|
|
||||||
cp stratosphere/dmnt/dmnt.elf atmosphere-$(AMSVER)-debug/dmnt.elf
|
|
||||||
cp stratosphere/eclct.stub/eclct.stub.elf atmosphere-$(AMSVER)-debug/eclct.stub.elf
|
|
||||||
cp stratosphere/erpt/erpt.elf atmosphere-$(AMSVER)-debug/erpt.elf
|
|
||||||
cp stratosphere/fatal/fatal.elf atmosphere-$(AMSVER)-debug/fatal.elf
|
|
||||||
cp stratosphere/jpegdec/jpegdec.elf atmosphere-$(AMSVER)-debug/jpegdec.elf
|
|
||||||
cp stratosphere/loader/loader.elf atmosphere-$(AMSVER)-debug/loader.elf
|
|
||||||
cp stratosphere/ncm/ncm.elf atmosphere-$(AMSVER)-debug/ncm.elf
|
|
||||||
cp stratosphere/pgl/pgl.elf atmosphere-$(AMSVER)-debug/pgl.elf
|
|
||||||
cp stratosphere/pm/pm.elf atmosphere-$(AMSVER)-debug/pm.elf
|
|
||||||
cp stratosphere/ro/ro.elf atmosphere-$(AMSVER)-debug/ro.elf
|
|
||||||
cp stratosphere/sm/sm.elf atmosphere-$(AMSVER)-debug/sm.elf
|
|
||||||
cp stratosphere/spl/spl.elf atmosphere-$(AMSVER)-debug/spl.elf
|
|
||||||
cp troposphere/daybreak/daybreak.elf atmosphere-$(AMSVER)-debug/daybreak.elf
|
|
||||||
cd atmosphere-$(AMSVER)-debug; zip -r ../atmosphere-$(AMSVER)-debug.zip ./*; cd ../;
|
|
||||||
rm -r atmosphere-$(AMSVER)-debug
|
|
||||||
mv atmosphere-$(AMSVER)-debug.zip out/atmosphere-$(AMSVER)-debug.zip
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: $(TOPTARGETS) $(COMPONENTS)
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ In no particular order, we credit the following for their invaluable contributio
|
|||||||
|
|
||||||
* __switchbrew__ for the [libnx](https://github.com/switchbrew/libnx) project and the extensive [documentation, research and tool development](http://switchbrew.org) pertaining to the Nintendo Switch.
|
* __switchbrew__ for the [libnx](https://github.com/switchbrew/libnx) project and the extensive [documentation, research and tool development](http://switchbrew.org) pertaining to the Nintendo Switch.
|
||||||
* __devkitPro__ for the [devkitA64](https://devkitpro.org/) toolchain and libnx support.
|
* __devkitPro__ for the [devkitA64](https://devkitpro.org/) toolchain and libnx support.
|
||||||
* __ReSwitched Team__ for additional [documentation, research and tool development](https://reswitched.team/) pertaining to the Nintendo Switch.
|
* __ReSwitched Team__ for additional [documentation, research and tool development](https://reswitched.github.io/) pertaining to the Nintendo Switch.
|
||||||
* __ChaN__ for the [FatFs](http://elm-chan.org/fsw/ff/00index_e.html) module.
|
* __ChaN__ for the [FatFs](http://elm-chan.org/fsw/ff/00index_e.html) module.
|
||||||
* __Marcus Geelnard__ for the [bcl-1.2.0](https://sourceforge.net/projects/bcl/files/bcl/bcl-1.2.0) library.
|
* __Marcus Geelnard__ for the [bcl-1.2.0](https://sourceforge.net/projects/bcl/files/bcl/bcl-1.2.0) library.
|
||||||
* __naehrwert__ and __st4rk__ for the original [hekate](https://github.com/nwert/hekate) project and its hwinit code base.
|
* __naehrwert__ and __st4rk__ for the original [hekate](https://github.com/nwert/hekate) project and its hwinit code base.
|
||||||
|
|||||||
167
atmosphere.mk
Normal file
167
atmosphere.mk
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/libraries/config/common.mk
|
||||||
|
|
||||||
|
# Get Atmosphere version fields
|
||||||
|
ATMOSPHERE_MAJOR_VERSION := $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MAJOR\b' $(ATMOSPHERE_LIBRARIES_DIR)/libvapours/include/vapours/ams/ams_api_version.h | tr -s [:blank:] | cut -d' ' -f3)
|
||||||
|
ATMOSPHERE_MINOR_VERSION := $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MINOR\b' $(ATMOSPHERE_LIBRARIES_DIR)/libvapours/include/vapours/ams/ams_api_version.h | tr -s [:blank:] | cut -d' ' -f3)
|
||||||
|
ATMOSPHERE_MICRO_VERSION := $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MICRO\b' $(ATMOSPHERE_LIBRARIES_DIR)/libvapours/include/vapours/ams/ams_api_version.h | tr -s [:blank:] | cut -d' ' -f3)
|
||||||
|
ATMOSPHERE_SUPPORTED_HOS_MAJOR_VERSION := $(shell grep 'define ATMOSPHERE_SUPPORTED_HOS_VERSION_MAJOR\b' $(ATMOSPHERE_LIBRARIES_DIR)/libvapours/include/vapours/ams/ams_api_version.h | tr -s [:blank:] | cut -d' ' -f3)
|
||||||
|
ATMOSPHERE_SUPPORTED_HOS_MINOR_VERSION := $(shell grep 'define ATMOSPHERE_SUPPORTED_HOS_VERSION_MINOR\b' $(ATMOSPHERE_LIBRARIES_DIR)/libvapours/include/vapours/ams/ams_api_version.h | tr -s [:blank:] | cut -d' ' -f3)
|
||||||
|
ATMOSPHERE_SUPPORTED_HOS_MICRO_VERSION := $(shell grep 'define ATMOSPHERE_SUPPORTED_HOS_VERSION_MICRO\b' $(ATMOSPHERE_LIBRARIES_DIR)/libvapours/include/vapours/ams/ams_api_version.h | tr -s [:blank:] | cut -d' ' -f3)
|
||||||
|
|
||||||
|
ATMOSPHERE_VERSION := $(ATMOSPHERE_MAJOR_VERSION).$(ATMOSPHERE_MINOR_VERSION).$(ATMOSPHERE_MICRO_VERSION)-$(ATMOSPHERE_GIT_REVISION)
|
||||||
|
|
||||||
|
dist: dist-no-debug
|
||||||
|
$(eval DIST_DIR = $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/atmosphere-$(ATMOSPHERE_VERSION)-debug)
|
||||||
|
rm -rf $(DIST_DIR)
|
||||||
|
mkdir $(DIST_DIR)
|
||||||
|
cp $(CURRENT_DIRECTORY)/fusee/loader_stub/$(ATMOSPHERE_BOOT_OUT_DIR)/loader_stub.elf $(DIST_DIR)/fusee-loader-stub.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/fusee/program/$(ATMOSPHERE_BOOT_OUT_DIR)/program.elf $(DIST_DIR)/fusee-program.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/exosphere/loader_stub/$(ATMOSPHERE_OUT_DIR)/loader_stub.elf $(DIST_DIR)/exosphere-loader-stub.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/exosphere/program/$(ATMOSPHERE_OUT_DIR)/program.elf $(DIST_DIR)/exosphere-program.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/exosphere/warmboot/$(ATMOSPHERE_BOOT_OUT_DIR)/warmboot.elf $(DIST_DIR)/exosphere-warmboot.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/exosphere/mariko_fatal/$(ATMOSPHERE_OUT_DIR)/mariko_fatal.elf $(DIST_DIR)/exosphere-mariko-fatal.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/exosphere/program/sc7fw/$(ATMOSPHERE_BOOT_OUT_DIR)/sc7fw.elf $(DIST_DIR)/exosphere-sc7fw.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/exosphere/program/rebootstub/$(ATMOSPHERE_BOOT_OUT_DIR)/rebootstub.elf $(DIST_DIR)/exosphere-rebootstub.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/mesosphere/kernel_ldr/$(ATMOSPHERE_OUT_DIR)/kernel_ldr.elf $(DIST_DIR)/kernel_ldr.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/mesosphere/kernel/$(ATMOSPHERE_OUT_DIR)/kernel.elf $(DIST_DIR)/kernel.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/ams_mitm/$(ATMOSPHERE_OUT_DIR)/ams_mitm.elf $(DIST_DIR)/ams_mitm.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/boot/$(ATMOSPHERE_OUT_DIR)/boot.elf $(DIST_DIR)/boot.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/boot2/$(ATMOSPHERE_OUT_DIR)/boot2.elf $(DIST_DIR)/boot2.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/creport/$(ATMOSPHERE_OUT_DIR)/creport.elf $(DIST_DIR)/creport.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/cs/$(ATMOSPHERE_OUT_DIR)/cs.elf $(DIST_DIR)/cs.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/dmnt/$(ATMOSPHERE_OUT_DIR)/dmnt.elf $(DIST_DIR)/dmnt.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/dmnt.gen2/$(ATMOSPHERE_OUT_DIR)/dmnt.gen2.elf $(DIST_DIR)/dmnt.gen2.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/eclct.stub/$(ATMOSPHERE_OUT_DIR)/eclct.stub.elf $(DIST_DIR)/eclct.stub.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/erpt/$(ATMOSPHERE_OUT_DIR)/erpt.elf $(DIST_DIR)/erpt.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/fatal/$(ATMOSPHERE_OUT_DIR)/fatal.elf $(DIST_DIR)/fatal.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/htc/$(ATMOSPHERE_OUT_DIR)/htc.elf $(DIST_DIR)/htc.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/jpegdec/$(ATMOSPHERE_OUT_DIR)/jpegdec.elf $(DIST_DIR)/jpegdec.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/loader/$(ATMOSPHERE_OUT_DIR)/loader.elf $(DIST_DIR)/loader.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/LogManager/$(ATMOSPHERE_OUT_DIR)/LogManager.elf $(DIST_DIR)/LogManager.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/ncm/$(ATMOSPHERE_OUT_DIR)/ncm.elf $(DIST_DIR)/ncm.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/pgl/$(ATMOSPHERE_OUT_DIR)/pgl.elf $(DIST_DIR)/pgl.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/pm/$(ATMOSPHERE_OUT_DIR)/pm.elf $(DIST_DIR)/pm.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/ro/$(ATMOSPHERE_OUT_DIR)/ro.elf $(DIST_DIR)/ro.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/sm/$(ATMOSPHERE_OUT_DIR)/sm.elf $(DIST_DIR)/sm.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/spl/$(ATMOSPHERE_OUT_DIR)/spl.elf $(DIST_DIR)/spl.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/TioServer/$(ATMOSPHERE_OUT_DIR)/TioServer.elf $(DIST_DIR)/TioServer.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/troposphere/daybreak/daybreak.elf $(DIST_DIR)/daybreak.elf
|
||||||
|
cd $(DIST_DIR); zip -r ../atmosphere-$(ATMOSPHERE_VERSION)-debug.zip ./*; cd ../;
|
||||||
|
rm -rf $(DIST_DIR)
|
||||||
|
|
||||||
|
dist-no-debug: package3 $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
$(eval DIST_DIR = $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/atmosphere-$(ATMOSPHERE_VERSION))
|
||||||
|
rm -rf $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/*
|
||||||
|
rm -rf $(DIST_DIR)
|
||||||
|
mkdir $(DIST_DIR)
|
||||||
|
mkdir $(DIST_DIR)/atmosphere
|
||||||
|
mkdir $(DIST_DIR)/switch
|
||||||
|
mkdir -p $(DIST_DIR)/atmosphere/fatal_errors
|
||||||
|
mkdir -p $(DIST_DIR)/atmosphere/config_templates
|
||||||
|
mkdir -p $(DIST_DIR)/atmosphere/config
|
||||||
|
mkdir -p $(DIST_DIR)/atmosphere/flags
|
||||||
|
cp fusee/$(ATMOSPHERE_BOOT_OUT_DIR)/fusee.bin $(DIST_DIR)/atmosphere/reboot_payload.bin
|
||||||
|
cp fusee/$(ATMOSPHERE_BOOT_OUT_DIR)/package3 $(DIST_DIR)/atmosphere/package3
|
||||||
|
cp config_templates/stratosphere.ini $(DIST_DIR)/atmosphere/config_templates/stratosphere.ini
|
||||||
|
cp config_templates/override_config.ini $(DIST_DIR)/atmosphere/config_templates/override_config.ini
|
||||||
|
cp config_templates/system_settings.ini $(DIST_DIR)/atmosphere/config_templates/system_settings.ini
|
||||||
|
cp config_templates/exosphere.ini $(DIST_DIR)/atmosphere/config_templates/exosphere.ini
|
||||||
|
mkdir -p config_templates/kip_patches
|
||||||
|
cp -r config_templates/kip_patches $(DIST_DIR)/atmosphere/kip_patches
|
||||||
|
cp -r config_templates/hbl_html $(DIST_DIR)/atmosphere/hbl_html
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000008
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000000d
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000017
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000002b
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000032
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000034
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000036
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000037
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000003c
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000042
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000420
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000b240
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000d609
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000d623
|
||||||
|
cp stratosphere/boot2/$(ATMOSPHERE_OUT_DIR)/boot2.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000008/exefs.nsp
|
||||||
|
cp stratosphere/dmnt/$(ATMOSPHERE_OUT_DIR)/dmnt.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000000d/exefs.nsp
|
||||||
|
cp stratosphere/cs/$(ATMOSPHERE_OUT_DIR)/cs.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000017/exefs.nsp
|
||||||
|
cp stratosphere/erpt/$(ATMOSPHERE_OUT_DIR)/erpt.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000002b/exefs.nsp
|
||||||
|
cp stratosphere/eclct.stub/$(ATMOSPHERE_OUT_DIR)/eclct.stub.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000032/exefs.nsp
|
||||||
|
cp stratosphere/fatal/$(ATMOSPHERE_OUT_DIR)/fatal.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000034/exefs.nsp
|
||||||
|
cp stratosphere/creport/$(ATMOSPHERE_OUT_DIR)/creport.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000036/exefs.nsp
|
||||||
|
cp stratosphere/ro/$(ATMOSPHERE_OUT_DIR)/ro.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000037/exefs.nsp
|
||||||
|
cp stratosphere/jpegdec/$(ATMOSPHERE_OUT_DIR)/jpegdec.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000003c/exefs.nsp
|
||||||
|
cp stratosphere/pgl/$(ATMOSPHERE_OUT_DIR)/pgl.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000042/exefs.nsp
|
||||||
|
cp stratosphere/LogManager/$(ATMOSPHERE_OUT_DIR)/LogManager.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000420/exefs.nsp
|
||||||
|
cp stratosphere/htc/$(ATMOSPHERE_OUT_DIR)/htc.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000b240/exefs.nsp
|
||||||
|
cp stratosphere/dmnt.gen2/$(ATMOSPHERE_OUT_DIR)/dmnt.gen2.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000d609/exefs.nsp
|
||||||
|
cp stratosphere/TioServer/$(ATMOSPHERE_OUT_DIR)/TioServer.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000d623/exefs.nsp
|
||||||
|
@build_romfs $(DIST_DIR)/stratosphere_romfs $(DIST_DIR)/atmosphere/stratosphere.romfs
|
||||||
|
rm -r $(DIST_DIR)/stratosphere_romfs
|
||||||
|
cp troposphere/reboot_to_payload/reboot_to_payload.nro $(DIST_DIR)/switch/reboot_to_payload.nro
|
||||||
|
cp troposphere/daybreak/daybreak.nro $(DIST_DIR)/switch/daybreak.nro
|
||||||
|
cd $(DIST_DIR); zip -r ../atmosphere-$(ATMOSPHERE_VERSION).zip ./*; cd ../;
|
||||||
|
rm -rf $(DIST_DIR)
|
||||||
|
cp fusee/$(ATMOSPHERE_BOOT_OUT_DIR)/fusee.bin $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/fusee.bin
|
||||||
|
|
||||||
|
package3: emummc fusee stratosphere mesosphere exosphere troposphere
|
||||||
|
@python fusee/build_package3.py $(CURRENT_DIRECTORY) $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BOOT_OUT_DIR) $(ATMOSPHERE_GIT_HASH) $(ATMOSPHERE_MAJOR_VERSION) $(ATMOSPHERE_MINOR_VERSION) $(ATMOSPHERE_MICRO_VERSION) 0 $(ATMOSPHERE_SUPPORTED_HOS_MAJOR_VERSION) $(ATMOSPHERE_SUPPORTED_HOS_MINOR_VERSION) $(ATMOSPHERE_SUPPORTED_HOS_MICRO_VERSION) 0
|
||||||
|
@echo "Built package3!"
|
||||||
|
|
||||||
|
emummc:
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/emummc all
|
||||||
|
|
||||||
|
fusee: libexosphere_boot
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/fusee -f $(CURRENT_DIRECTORY)/fusee/fusee.mk ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
|
||||||
|
exosphere: libexosphere libexosphere_boot
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/exosphere -f $(CURRENT_DIRECTORY)/exosphere/exosphere.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE=1
|
||||||
|
|
||||||
|
stratosphere: fusee libstratosphere
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/stratosphere -f $(CURRENT_DIRECTORY)/stratosphere/stratosphere.mk ATMOSPHERE_CHECKED_LIBSTRATOSPHERE=1 ATMOSPHERE_CHECKED_FUSEE=1
|
||||||
|
|
||||||
|
mesosphere: libmesosphere
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/mesosphere -f $(CURRENT_DIRECTORY)/mesosphere/mesosphere.mk ATMOSPHERE_CHECKED_LIBMESOSPHERE=1
|
||||||
|
|
||||||
|
troposphere:
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/troposphere all
|
||||||
|
|
||||||
|
libexosphere:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
|
||||||
|
ifneq ($(strip $(ATMOSPHERE_LIBRARY_DIR)),$(strip $(ATMOSPHERE_BOOT_LIBRARY_DIR)))
|
||||||
|
libexosphere_boot:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
else
|
||||||
|
libexosphere_boot: libexosphere
|
||||||
|
endif
|
||||||
|
|
||||||
|
libmesosphere:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libmesosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libmesosphere/libmesosphere.mk
|
||||||
|
|
||||||
|
libstratosphere:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/libstratosphere.mk
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/fusee -f $(CURRENT_DIRECTORY)/fusee/fusee.mk clean ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/emummc clean
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/exosphere -f $(CURRENT_DIRECTORY)/exosphere/exosphere.mk clean
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/mesosphere -f $(CURRENT_DIRECTORY)/mesosphere/mesosphere.mk clean
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/stratosphere -f $(CURRENT_DIRECTORY)/stratosphere/stratosphere.mk clean
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/troposphere clean
|
||||||
|
$(MAKE) -C $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/libstratosphere.mk clean
|
||||||
|
$(MAKE) -C $(ATMOSPHERE_LIBRARIES_DIR)/libmesosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libmesosphere/libmesosphere.mk clean
|
||||||
|
$(MAKE) -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk clean
|
||||||
|
$(MAKE) -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk clean ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
rm -rf $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR) $(CURRENT_DIRECTORY)/$(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
.PHONY: dist dist-no-debug clean package3 emummc fusee stratosphere mesosphere exosphere troposphere
|
||||||
@@ -17,6 +17,9 @@
|
|||||||
; Note that this setting does nothing when log manager is not enabled/sd card logging is not enabled.
|
; Note that this setting does nothing when log manager is not enabled/sd card logging is not enabled.
|
||||||
; sd_card_log_output_directory = str!atmosphere/binlogs
|
; sd_card_log_output_directory = str!atmosphere/binlogs
|
||||||
; Atmosphere custom settings
|
; Atmosphere custom settings
|
||||||
|
[erpt]
|
||||||
|
; Control whether erpt reports should always be preserved, instead of automatically cleaning periodically.
|
||||||
|
; disable_automatic_report_cleanup = u8!0x0
|
||||||
[atmosphere]
|
[atmosphere]
|
||||||
; Reboot from fatal automatically after some number of milliseconds.
|
; Reboot from fatal automatically after some number of milliseconds.
|
||||||
; If field is not present or 0, fatal will wait indefinitely for user input.
|
; If field is not present or 0, fatal will wait indefinitely for user input.
|
||||||
|
|||||||
@@ -1,4 +1,66 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
## 1.4.1
|
||||||
|
+ A number of minor issues were fixed and improvements were made, including:
|
||||||
|
+ `dmnt` cheat toggle files are no longer ignored when they are missing a trailing newline.
|
||||||
|
+ The mechanism for automatically cleaning up `erpt_reports` added in 1.3.0 was fixed.
|
||||||
|
+ This was actually just very fundamentally broken and has never worked, but it is verified working now.
|
||||||
|
+ Minor fixes were made in `mesosphère` to match official kernel behavior (spin lock assembly was corrected, wrong result on failure in in GetProcessId was corrected).
|
||||||
|
+ A missing call to GetSdStatus when initializing SD cards at non uhs-i mode was added in the sdmmc driver.
|
||||||
|
+ `ams.mitm`'s memory usage was increased by 16 MB, to prevent crashing when building romfs for games with obscene file counts.
|
||||||
|
+ To quote the changelog for 1.2.3: "Animal Crossing's 2.0.0 update contains >99000 files [...] It's really hard to imagine any game being worse than Animal Crossing".
|
||||||
|
+ As it turns out, Fire Emblem: Engage has ~186000 files, and is approximately twice as bad as animal crossing.
|
||||||
|
+ The additional memory here is taken from the applet pool; no issues are expected to arise from this, but please report anything you may run into.
|
||||||
|
+ As usual, if you encounter a game that exhausts ams.mitm's memory (crashing it) when loading layeredfs mods, please contact `SciresM#0524`.
|
||||||
|
+ I am jinxing myself by saying this, but it's really hard to imagine any game being worse than Fire Emblem: Engage, but if it happens again I will drop everything to fix it as usual.
|
||||||
|
## 1.4.0
|
||||||
|
+ Support was added for 15.0.0.
|
||||||
|
+ `mesosphère` was updated to reflect the latest official kernel behavior.
|
||||||
|
+ `ncm` was updated to reflect the latest official kernel behavior.
|
||||||
|
+ A number of minor issues were fixed and improvements were made, including:
|
||||||
|
+ The capacity limit on registered add-on contents was fixed in NCM to reflect the increase that occurred in 12.0.0.
|
||||||
|
+ An off-by-one was fixed in mesosphere when computing the new value for an address arbiter signaled with ModifyByWaitingCountIfEqual.
|
||||||
|
+ dmnt.gen2's gdbstub now sanitizes thread names to prevent invalid characters from breaking gdb.
|
||||||
|
+ dmnt.gen2's gdbstub now reports the architecture tag correctly when attached to 32-bit processes.
|
||||||
|
+ Support for program-specific html manual content overrides was added for non-hbl takeover context.
|
||||||
|
+ A bug was fixed in how emummc constructed the alternate Nintendo directory path.
|
||||||
|
+ Previously, this was using `/*/Nintendo/Nintendo` instead of `/*/Nintendo`.
|
||||||
|
+ Code was added to automatically move the old folders to the new ones when booting into emummc.
|
||||||
|
+ A bug was fixed in boot that caused an incorrectly low input voltage limit to be set.
|
||||||
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
## 1.3.2
|
||||||
|
+ Support was improved for 14.0.0+.
|
||||||
|
+ `loader` was updated to reflect the latest official behaviors.
|
||||||
|
+ `ro` was updated to reflect the latest official behaviors.
|
||||||
|
+ A number of minor issues were fixed and improvements were made, including:
|
||||||
|
+ A memory leak was fixed in filesystem path management; this could cause a crash when launching games ~100 times, or when deleting/re-downloading games.
|
||||||
|
+ A bug was fixed that could cause threads to not see a newly signaled semaphore.
|
||||||
|
+ A number of minor inaccuracies were fixed in the updated FileSystem APIs.
|
||||||
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
## 1.3.1
|
||||||
|
+ Support was added for 14.1.0.
|
||||||
|
+ A number of minor under the hood improvements to accuracy were made to better reflect latest official system module behavior, particularly around FS apis.
|
||||||
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
## 1.3.0
|
||||||
|
+ Support was added for 14.0.0.
|
||||||
|
+ `mesosphère` was updated to reflect the latest official kernel behavior.
|
||||||
|
+ `erpt` was updated to reflect the latest official behaviors.
|
||||||
|
+ `pm` was updated to reflect the latest official behaviors.
|
||||||
|
+ `fatal` was updated to reflect the latest official behaviors.
|
||||||
|
+ A mechanism for automatically cleaning up `erpt_reports` was added.
|
||||||
|
+ When booting, if the console has more than 1000 reports inside `/atmosphere/erpt_reports`, the folder will be cleaned to empty.
|
||||||
|
+ This behavior can be disabled by setting `erpt!disable_automatic_report_cleanup` = u8!0x1 in system_settings.ini.
|
||||||
|
+ Atmosphère's build system was re-written, and now allows globally building for various builds/configs.
|
||||||
|
+ All boards now automatically support release/debugging/auditing targets; it is now possible to build a full debugging/auditing build of atmosphère for the first time.
|
||||||
|
+ Support was added for compiling libstratosphère to run on PC.
|
||||||
|
+ The currently implemented/tested targets are Windows (x64), Linux (x64, arm64), macOS (x64, arm64).
|
||||||
|
+ If you are a developer interested in adding support for another target, please reach out to `SciresM#0524` on discord.
|
||||||
|
+ This is intended to finally allow sanely testing Atmosphère's code, by allowing most of it to run on a PC (with access to a debugger) instead of on game console hardware.
|
||||||
|
+ In addition, this will allow making PC tools which reuse code written for Atmosphère directly..
|
||||||
|
+ **Please Note**: This has no relation to interacting with official software on PC whatsoever. This really allows for making tests and self-contained atmosphère-based command-line tools; the Atmosphère project continues to have zero interest in attempting to run official software of any kind.
|
||||||
|
+ In the course of adding this support (and working on tooling using it), a number of fairly major revisions were made to stratosphere (particularly surrounding filesystem code).
|
||||||
|
+ **Please Note**: A number of changes made for this (and ones necessary in the process of adding support for 14.0.0) are api-breaking.
|
||||||
|
+ If you're a developer and any of this caused your code to break, please feel free to contact `SciresM#0524` for help updating your program.
|
||||||
|
+ General system stability improvements to enhance the user's experience.
|
||||||
## 1.2.6
|
## 1.2.6
|
||||||
+ Support was added for 13.2.1.
|
+ Support was added for 13.2.1.
|
||||||
+ A number of minor issues were fixed and improvements were made, including:
|
+ A number of minor issues were fixed and improvements were made, including:
|
||||||
@@ -139,7 +201,7 @@
|
|||||||
+ Many, many other minor changes, please talk to SciresM#0524 or read the relevant commits if you want to know more.
|
+ Many, many other minor changes, please talk to SciresM#0524 or read the relevant commits if you want to know more.
|
||||||
+ A number of minor issues were fixed, including:
|
+ A number of minor issues were fixed, including:
|
||||||
+ Mesosphere's handling of SVC permissions on thread pin/unpin was updated to reflect official kernel behavior.
|
+ Mesosphere's handling of SVC permissions on thread pin/unpin was updated to reflect official kernel behavior.
|
||||||
+ util::CountTrailingZeroes() was fixed to calculate the correct value when used at compile-time.
|
+ util::CountTrailingZeros() was fixed to calculate the correct value when used at compile-time.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
## 1.1.1
|
## 1.1.1
|
||||||
+ A bug was fixed which caused some memory to leak when launching a game with mods enabled, eventually causing a crash after enough game launches without rebooting.
|
+ A bug was fixed which caused some memory to leak when launching a game with mods enabled, eventually causing a crash after enough game launches without rebooting.
|
||||||
|
|||||||
6
emummc/.gitrepo
vendored
6
emummc/.gitrepo
vendored
@@ -4,9 +4,9 @@
|
|||||||
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
|
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
|
||||||
;
|
;
|
||||||
[subrepo]
|
[subrepo]
|
||||||
remote = https://github.com/m4xw/emuMMC
|
remote = https://github.com/m4xw/emummc
|
||||||
branch = develop
|
branch = develop
|
||||||
commit = a9d56959460fc794ce2cb6405402c25a3e89c47f
|
commit = 4714b2df9eaf68fb85516b35f7f4265ab0413825
|
||||||
parent = ff719641396c635b735873fb2b020c910f768a04
|
parent = 99f6a96845b6097d50f5059eea9245d27876f26a
|
||||||
method = merge
|
method = merge
|
||||||
cmdver = 0.4.1
|
cmdver = 0.4.1
|
||||||
|
|||||||
2
emummc/README.md
vendored
2
emummc/README.md
vendored
@@ -2,7 +2,7 @@
|
|||||||
*A SDMMC driver replacement for Nintendo's Filesystem Services, by **m4xw***
|
*A SDMMC driver replacement for Nintendo's Filesystem Services, by **m4xw***
|
||||||
|
|
||||||
### Supported Horizon Versions
|
### Supported Horizon Versions
|
||||||
**1.0.0 - 13.1.0**
|
**1.0.0 - 15.0.0**
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
* Arbitrary SDMMC backend selection
|
* Arbitrary SDMMC backend selection
|
||||||
|
|||||||
16
emummc/source/FS/FS_offsets.c
vendored
16
emummc/source/FS/FS_offsets.c
vendored
@@ -59,6 +59,10 @@
|
|||||||
#include "offsets/1300_exfat.h"
|
#include "offsets/1300_exfat.h"
|
||||||
#include "offsets/1310.h"
|
#include "offsets/1310.h"
|
||||||
#include "offsets/1310_exfat.h"
|
#include "offsets/1310_exfat.h"
|
||||||
|
#include "offsets/1400.h"
|
||||||
|
#include "offsets/1400_exfat.h"
|
||||||
|
#include "offsets/1500.h"
|
||||||
|
#include "offsets/1500_exfat.h"
|
||||||
#include "../utils/fatal.h"
|
#include "../utils/fatal.h"
|
||||||
|
|
||||||
#define GET_OFFSET_STRUCT_NAME(vers) g_offsets##vers
|
#define GET_OFFSET_STRUCT_NAME(vers) g_offsets##vers
|
||||||
@@ -129,6 +133,10 @@ DEFINE_OFFSET_STRUCT(_1300);
|
|||||||
DEFINE_OFFSET_STRUCT(_1300_EXFAT);
|
DEFINE_OFFSET_STRUCT(_1300_EXFAT);
|
||||||
DEFINE_OFFSET_STRUCT(_1310);
|
DEFINE_OFFSET_STRUCT(_1310);
|
||||||
DEFINE_OFFSET_STRUCT(_1310_EXFAT);
|
DEFINE_OFFSET_STRUCT(_1310_EXFAT);
|
||||||
|
DEFINE_OFFSET_STRUCT(_1400);
|
||||||
|
DEFINE_OFFSET_STRUCT(_1400_EXFAT);
|
||||||
|
DEFINE_OFFSET_STRUCT(_1500);
|
||||||
|
DEFINE_OFFSET_STRUCT(_1500_EXFAT);
|
||||||
|
|
||||||
const fs_offsets_t *get_fs_offsets(enum FS_VER version) {
|
const fs_offsets_t *get_fs_offsets(enum FS_VER version) {
|
||||||
switch (version) {
|
switch (version) {
|
||||||
@@ -218,6 +226,14 @@ const fs_offsets_t *get_fs_offsets(enum FS_VER version) {
|
|||||||
return &(GET_OFFSET_STRUCT_NAME(_1310));
|
return &(GET_OFFSET_STRUCT_NAME(_1310));
|
||||||
case FS_VER_13_1_0_EXFAT:
|
case FS_VER_13_1_0_EXFAT:
|
||||||
return &(GET_OFFSET_STRUCT_NAME(_1310_EXFAT));
|
return &(GET_OFFSET_STRUCT_NAME(_1310_EXFAT));
|
||||||
|
case FS_VER_14_0_0:
|
||||||
|
return &(GET_OFFSET_STRUCT_NAME(_1400));
|
||||||
|
case FS_VER_14_0_0_EXFAT:
|
||||||
|
return &(GET_OFFSET_STRUCT_NAME(_1400_EXFAT));
|
||||||
|
case FS_VER_15_0_0:
|
||||||
|
return &(GET_OFFSET_STRUCT_NAME(_1500));
|
||||||
|
case FS_VER_15_0_0_EXFAT:
|
||||||
|
return &(GET_OFFSET_STRUCT_NAME(_1500_EXFAT));
|
||||||
default:
|
default:
|
||||||
fatal_abort(Fatal_UnknownVersion);
|
fatal_abort(Fatal_UnknownVersion);
|
||||||
}
|
}
|
||||||
|
|||||||
6
emummc/source/FS/FS_versions.h
vendored
6
emummc/source/FS/FS_versions.h
vendored
@@ -86,6 +86,12 @@ enum FS_VER
|
|||||||
FS_VER_13_1_0,
|
FS_VER_13_1_0,
|
||||||
FS_VER_13_1_0_EXFAT,
|
FS_VER_13_1_0_EXFAT,
|
||||||
|
|
||||||
|
FS_VER_14_0_0,
|
||||||
|
FS_VER_14_0_0_EXFAT,
|
||||||
|
|
||||||
|
FS_VER_15_0_0,
|
||||||
|
FS_VER_15_0_0_EXFAT,
|
||||||
|
|
||||||
FS_VER_MAX,
|
FS_VER_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
59
emummc/source/FS/offsets/1400.h
vendored
Normal file
59
emummc/source/FS/offsets/1400.h
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019 m4xw <m4x@m4xw.net>
|
||||||
|
* Copyright (c) 2019 Atmosphere-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef __FS_1400_H__
|
||||||
|
#define __FS_1400_H__
|
||||||
|
|
||||||
|
// Accessor vtable getters
|
||||||
|
#define FS_OFFSET_1400_SDMMC_ACCESSOR_GC 0x189F50
|
||||||
|
#define FS_OFFSET_1400_SDMMC_ACCESSOR_SD 0x18BD60
|
||||||
|
#define FS_OFFSET_1400_SDMMC_ACCESSOR_NAND 0x18A480
|
||||||
|
|
||||||
|
// Hooks
|
||||||
|
#define FS_OFFSET_1400_SDMMC_WRAPPER_READ 0x185AF0
|
||||||
|
#define FS_OFFSET_1400_SDMMC_WRAPPER_WRITE 0x185B50
|
||||||
|
#define FS_OFFSET_1400_RTLD 0x282B8
|
||||||
|
#define FS_OFFSET_1400_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x3C)))
|
||||||
|
|
||||||
|
#define FS_OFFSET_1400_CLKRST_SET_MIN_V_CLK_RATE 0x1A5D90
|
||||||
|
|
||||||
|
// Misc funcs
|
||||||
|
#define FS_OFFSET_1400_LOCK_MUTEX 0x17E9F0
|
||||||
|
#define FS_OFFSET_1400_UNLOCK_MUTEX 0x17EA40
|
||||||
|
|
||||||
|
#define FS_OFFSET_1400_SDMMC_WRAPPER_CONTROLLER_OPEN 0x185AA0
|
||||||
|
#define FS_OFFSET_1400_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x185AD0
|
||||||
|
|
||||||
|
// Misc Data
|
||||||
|
#define FS_OFFSET_1400_SD_MUTEX 0xF2E3F0
|
||||||
|
#define FS_OFFSET_1400_NAND_MUTEX 0xF292F8
|
||||||
|
#define FS_OFFSET_1400_ACTIVE_PARTITION 0xF29338
|
||||||
|
#define FS_OFFSET_1400_SDMMC_DAS_HANDLE 0xDFE9C8
|
||||||
|
|
||||||
|
// NOPs
|
||||||
|
#define FS_OFFSET_1400_SD_DAS_INIT 0x27004
|
||||||
|
|
||||||
|
// Nintendo Paths
|
||||||
|
#define FS_OFFSET_1400_NINTENDO_PATHS \
|
||||||
|
{ \
|
||||||
|
{.opcode_reg = 3, .adrp_offset = 0x0006D9C0, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 3, .adrp_offset = 0x0007AC24, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 4, .adrp_offset = 0x000813E8, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 4, .adrp_offset = 0x0009387C, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __FS_1400_H__
|
||||||
59
emummc/source/FS/offsets/1400_exfat.h
vendored
Normal file
59
emummc/source/FS/offsets/1400_exfat.h
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019 m4xw <m4x@m4xw.net>
|
||||||
|
* Copyright (c) 2019 Atmosphere-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef __FS_1400_EXFAT_H__
|
||||||
|
#define __FS_1400_EXFAT_H__
|
||||||
|
|
||||||
|
// Accessor vtable getters
|
||||||
|
#define FS_OFFSET_1400_EXFAT_SDMMC_ACCESSOR_GC 0x1952D0
|
||||||
|
#define FS_OFFSET_1400_EXFAT_SDMMC_ACCESSOR_SD 0x1970E0
|
||||||
|
#define FS_OFFSET_1400_EXFAT_SDMMC_ACCESSOR_NAND 0x195800
|
||||||
|
|
||||||
|
// Hooks
|
||||||
|
#define FS_OFFSET_1400_EXFAT_SDMMC_WRAPPER_READ 0x190E70
|
||||||
|
#define FS_OFFSET_1400_EXFAT_SDMMC_WRAPPER_WRITE 0x190ED0
|
||||||
|
#define FS_OFFSET_1400_EXFAT_RTLD 0x282B8
|
||||||
|
#define FS_OFFSET_1400_EXFAT_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x3C)))
|
||||||
|
|
||||||
|
#define FS_OFFSET_1400_EXFAT_CLKRST_SET_MIN_V_CLK_RATE 0x1B1110
|
||||||
|
|
||||||
|
// Misc funcs
|
||||||
|
#define FS_OFFSET_1400_EXFAT_LOCK_MUTEX 0x189D70
|
||||||
|
#define FS_OFFSET_1400_EXFAT_UNLOCK_MUTEX 0x189DC0
|
||||||
|
|
||||||
|
#define FS_OFFSET_1400_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0x190E20
|
||||||
|
#define FS_OFFSET_1400_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x190E50
|
||||||
|
|
||||||
|
// Misc Data
|
||||||
|
#define FS_OFFSET_1400_EXFAT_SD_MUTEX 0x10123F0
|
||||||
|
#define FS_OFFSET_1400_EXFAT_NAND_MUTEX 0x100D2F8
|
||||||
|
#define FS_OFFSET_1400_EXFAT_ACTIVE_PARTITION 0x100D338
|
||||||
|
#define FS_OFFSET_1400_EXFAT_SDMMC_DAS_HANDLE 0xE0B9C8
|
||||||
|
|
||||||
|
// NOPs
|
||||||
|
#define FS_OFFSET_1400_EXFAT_SD_DAS_INIT 0x27004
|
||||||
|
|
||||||
|
// Nintendo Paths
|
||||||
|
#define FS_OFFSET_1400_EXFAT_NINTENDO_PATHS \
|
||||||
|
{ \
|
||||||
|
{.opcode_reg = 3, .adrp_offset = 0x0006D9C0, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 3, .adrp_offset = 0x0007AC24, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 4, .adrp_offset = 0x000813E8, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 4, .adrp_offset = 0x0009387C, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __FS_1400_EXFAT_H__
|
||||||
59
emummc/source/FS/offsets/1500.h
vendored
Normal file
59
emummc/source/FS/offsets/1500.h
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019 m4xw <m4x@m4xw.net>
|
||||||
|
* Copyright (c) 2019 Atmosphere-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef __FS_1500_H__
|
||||||
|
#define __FS_1500_H__
|
||||||
|
|
||||||
|
// Accessor vtable getters
|
||||||
|
#define FS_OFFSET_1500_SDMMC_ACCESSOR_GC 0x183E20
|
||||||
|
#define FS_OFFSET_1500_SDMMC_ACCESSOR_SD 0x185AA0
|
||||||
|
#define FS_OFFSET_1500_SDMMC_ACCESSOR_NAND 0x1842E0
|
||||||
|
|
||||||
|
// Hooks
|
||||||
|
#define FS_OFFSET_1500_SDMMC_WRAPPER_READ 0x17FCF0
|
||||||
|
#define FS_OFFSET_1500_SDMMC_WRAPPER_WRITE 0x17FD50
|
||||||
|
#define FS_OFFSET_1500_RTLD 0x26518
|
||||||
|
#define FS_OFFSET_1500_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x3C)))
|
||||||
|
|
||||||
|
#define FS_OFFSET_1500_CLKRST_SET_MIN_V_CLK_RATE 0x1A0870
|
||||||
|
|
||||||
|
// Misc funcs
|
||||||
|
#define FS_OFFSET_1500_LOCK_MUTEX 0x1791A0
|
||||||
|
#define FS_OFFSET_1500_UNLOCK_MUTEX 0x1791F0
|
||||||
|
|
||||||
|
#define FS_OFFSET_1500_SDMMC_WRAPPER_CONTROLLER_OPEN 0x17FCB0
|
||||||
|
#define FS_OFFSET_1500_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x17FCD0
|
||||||
|
|
||||||
|
// Misc Data
|
||||||
|
#define FS_OFFSET_1500_SD_MUTEX 0xFF33F0
|
||||||
|
#define FS_OFFSET_1500_NAND_MUTEX 0xFEE2E8
|
||||||
|
#define FS_OFFSET_1500_ACTIVE_PARTITION 0xFEE328
|
||||||
|
#define FS_OFFSET_1500_SDMMC_DAS_HANDLE 0xFD38D8
|
||||||
|
|
||||||
|
// NOPs
|
||||||
|
#define FS_OFFSET_1500_SD_DAS_INIT 0x25454
|
||||||
|
|
||||||
|
// Nintendo Paths
|
||||||
|
#define FS_OFFSET_1500_NINTENDO_PATHS \
|
||||||
|
{ \
|
||||||
|
{.opcode_reg = 3, .adrp_offset = 0x00063050, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 3, .adrp_offset = 0x0006FDE8, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 4, .adrp_offset = 0x000768D4, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 4, .adrp_offset = 0x00089364, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __FS_1500_H__
|
||||||
59
emummc/source/FS/offsets/1500_exfat.h
vendored
Normal file
59
emummc/source/FS/offsets/1500_exfat.h
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019 m4xw <m4x@m4xw.net>
|
||||||
|
* Copyright (c) 2019 Atmosphere-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef __FS_1500_EXFAT_H__
|
||||||
|
#define __FS_1500_EXFAT_H__
|
||||||
|
|
||||||
|
// Accessor vtable getters
|
||||||
|
#define FS_OFFSET_1500_EXFAT_SDMMC_ACCESSOR_GC 0x18EDB0
|
||||||
|
#define FS_OFFSET_1500_EXFAT_SDMMC_ACCESSOR_SD 0x190A30
|
||||||
|
#define FS_OFFSET_1500_EXFAT_SDMMC_ACCESSOR_NAND 0x18F270
|
||||||
|
|
||||||
|
// Hooks
|
||||||
|
#define FS_OFFSET_1500_EXFAT_SDMMC_WRAPPER_READ 0x18AC80
|
||||||
|
#define FS_OFFSET_1500_EXFAT_SDMMC_WRAPPER_WRITE 0x18ACE0
|
||||||
|
#define FS_OFFSET_1500_EXFAT_RTLD 0x26518
|
||||||
|
#define FS_OFFSET_1500_EXFAT_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x3C)))
|
||||||
|
|
||||||
|
#define FS_OFFSET_1500_EXFAT_CLKRST_SET_MIN_V_CLK_RATE 0x1AB800
|
||||||
|
|
||||||
|
// Misc funcs
|
||||||
|
#define FS_OFFSET_1500_EXFAT_LOCK_MUTEX 0x184130
|
||||||
|
#define FS_OFFSET_1500_EXFAT_UNLOCK_MUTEX 0x184180
|
||||||
|
|
||||||
|
#define FS_OFFSET_1500_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0x18AC40
|
||||||
|
#define FS_OFFSET_1500_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x18AC60
|
||||||
|
|
||||||
|
// Misc Data
|
||||||
|
#define FS_OFFSET_1500_EXFAT_SD_MUTEX 0x10053F0
|
||||||
|
#define FS_OFFSET_1500_EXFAT_NAND_MUTEX 0x10002E8
|
||||||
|
#define FS_OFFSET_1500_EXFAT_ACTIVE_PARTITION 0x1000328
|
||||||
|
#define FS_OFFSET_1500_EXFAT_SDMMC_DAS_HANDLE 0xFE08D8
|
||||||
|
|
||||||
|
// NOPs
|
||||||
|
#define FS_OFFSET_1500_EXFAT_SD_DAS_INIT 0x25454
|
||||||
|
|
||||||
|
// Nintendo Paths
|
||||||
|
#define FS_OFFSET_1500_EXFAT_NINTENDO_PATHS \
|
||||||
|
{ \
|
||||||
|
{.opcode_reg = 3, .adrp_offset = 0x00063050, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 3, .adrp_offset = 0x0006FDE8, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 4, .adrp_offset = 0x000768D4, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 4, .adrp_offset = 0x00089364, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __FS_1500_EXFAT_H__
|
||||||
28
emummc/source/nx/cache.s
vendored
28
emummc/source/nx/cache.s
vendored
@@ -27,6 +27,10 @@ CODE_BEGIN armDCacheFlush
|
|||||||
bic x8, x0, x10
|
bic x8, x0, x10
|
||||||
mov x10, x1
|
mov x10, x1
|
||||||
|
|
||||||
|
mov w1, #1
|
||||||
|
mrs x0, tpidrro_el0
|
||||||
|
strb w1, [x0, #0x104]
|
||||||
|
|
||||||
armDCacheFlush_L0:
|
armDCacheFlush_L0:
|
||||||
dc civac, x8
|
dc civac, x8
|
||||||
add x8, x8, x9
|
add x8, x8, x9
|
||||||
@@ -34,6 +38,9 @@ armDCacheFlush_L0:
|
|||||||
bcc armDCacheFlush_L0
|
bcc armDCacheFlush_L0
|
||||||
|
|
||||||
dsb sy
|
dsb sy
|
||||||
|
|
||||||
|
strb wzr, [x0, #0x104]
|
||||||
|
|
||||||
ret
|
ret
|
||||||
CODE_END
|
CODE_END
|
||||||
|
|
||||||
@@ -48,6 +55,10 @@ CODE_BEGIN armDCacheClean
|
|||||||
bic x8, x0, x10
|
bic x8, x0, x10
|
||||||
mov x10, x1
|
mov x10, x1
|
||||||
|
|
||||||
|
mov w1, #1
|
||||||
|
mrs x0, tpidrro_el0
|
||||||
|
strb w1, [x0, #0x104]
|
||||||
|
|
||||||
armDCacheClean_L0:
|
armDCacheClean_L0:
|
||||||
dc cvac, x8
|
dc cvac, x8
|
||||||
add x8, x8, x9
|
add x8, x8, x9
|
||||||
@@ -55,6 +66,9 @@ armDCacheClean_L0:
|
|||||||
bcc armDCacheClean_L0
|
bcc armDCacheClean_L0
|
||||||
|
|
||||||
dsb sy
|
dsb sy
|
||||||
|
|
||||||
|
strb wzr, [x0, #0x104]
|
||||||
|
|
||||||
ret
|
ret
|
||||||
CODE_END
|
CODE_END
|
||||||
|
|
||||||
@@ -68,6 +82,10 @@ CODE_BEGIN armICacheInvalidate
|
|||||||
bic x8, x0, x10
|
bic x8, x0, x10
|
||||||
mov x10, x1
|
mov x10, x1
|
||||||
|
|
||||||
|
mov w1, #1
|
||||||
|
mrs x0, tpidrro_el0
|
||||||
|
strb w1, [x0, #0x104]
|
||||||
|
|
||||||
armICacheInvalidate_L0:
|
armICacheInvalidate_L0:
|
||||||
ic ivau, x8
|
ic ivau, x8
|
||||||
add x8, x8, x9
|
add x8, x8, x9
|
||||||
@@ -75,6 +93,9 @@ armICacheInvalidate_L0:
|
|||||||
bcc armICacheInvalidate_L0
|
bcc armICacheInvalidate_L0
|
||||||
|
|
||||||
dsb sy
|
dsb sy
|
||||||
|
|
||||||
|
strb wzr, [x0, #0x104]
|
||||||
|
|
||||||
ret
|
ret
|
||||||
CODE_END
|
CODE_END
|
||||||
|
|
||||||
@@ -89,6 +110,10 @@ CODE_BEGIN armDCacheZero
|
|||||||
bic x8, x0, x10
|
bic x8, x0, x10
|
||||||
mov x10, x1
|
mov x10, x1
|
||||||
|
|
||||||
|
mov w1, #1
|
||||||
|
mrs x0, tpidrro_el0
|
||||||
|
strb w1, [x0, #0x104]
|
||||||
|
|
||||||
armDCacheZero_L0:
|
armDCacheZero_L0:
|
||||||
dc zva, x8
|
dc zva, x8
|
||||||
add x8, x8, x9
|
add x8, x8, x9
|
||||||
@@ -96,5 +121,8 @@ armDCacheZero_L0:
|
|||||||
bcc armDCacheZero_L0
|
bcc armDCacheZero_L0
|
||||||
|
|
||||||
dsb sy
|
dsb sy
|
||||||
|
|
||||||
|
strb wzr, [x0, #0x104]
|
||||||
|
|
||||||
ret
|
ret
|
||||||
CODE_END
|
CODE_END
|
||||||
|
|||||||
@@ -1,75 +1,41 @@
|
|||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
all: release
|
all: nx_release
|
||||||
|
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): exosphere$(strip $2).bin warmboot$(strip $2).bin mariko_fatal$(strip $2).bin
|
$(strip $1):
|
||||||
|
@echo "Building $(strip $1)"
|
||||||
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/exosphere.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
exosphere$(strip $2).bin: loader_stub/loader_stub$(strip $2).bin
|
clean-$(strip $1):
|
||||||
@cp loader_stub/loader_stub$(strip $2).bin exosphere$(strip $2).bin
|
@echo "Cleaning $(strip $1)"
|
||||||
@printf LENY >> exosphere$(strip $2).bin
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/exosphere.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
@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):
|
|
||||||
@$$(MAKE) -C program $(strip $1)
|
|
||||||
|
|
||||||
check_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)
|
|
||||||
@$$(MAKE) -C loader_stub $(strip $1)
|
|
||||||
|
|
||||||
warmboot/warmboot$(strip $2).bin: check_warmboot_$(strip $1)
|
|
||||||
|
|
||||||
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):
|
|
||||||
@$$(MAKE) -C program clean-$(strip $1)
|
|
||||||
|
|
||||||
clean-loader_stub-$(strip $1):
|
|
||||||
@$$(MAKE) -C loader_stub clean-$(strip $1)
|
|
||||||
|
|
||||||
clean-warmboot-$(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, ))
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug))
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit))
|
|
||||||
|
|
||||||
clean: clean-program clean-loader_stub clean-warmboot
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
@rm -rf exosphere*.bin warmboot*.bin mariko_fatal*.bin
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
|
))
|
||||||
|
|
||||||
clean-program:
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
@$(MAKE) -C program clean
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
|
))
|
||||||
|
|
||||||
clean-loader_stub:
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
@$(MAKE) -C loader_stub clean
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
|
))
|
||||||
|
|
||||||
clean-warmboot:
|
endef
|
||||||
@$(MAKE) -C warmboot clean
|
|
||||||
|
|
||||||
clean-mariko_fatal:
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm-cortex-a57,))
|
||||||
@$(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))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|||||||
75
exosphere/exosphere.mk
Normal file
75
exosphere/exosphere.mk
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../libraries/config/common.mk
|
||||||
|
|
||||||
|
all: $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/exosphere.bin $(CURRENT_DIRECTORY)/warmboot/$(ATMOSPHERE_BOOT_OUT_DIR)/warmboot.bin $(CURRENT_DIRECTORY)/mariko_fatal/$(ATMOSPHERE_OUT_DIR)/mariko_fatal.bin
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/exosphere.bin: $(CURRENT_DIRECTORY)/loader_stub/$(ATMOSPHERE_OUT_DIR)/loader_stub.bin $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
@cp $(CURRENT_DIRECTORY)/loader_stub/$(ATMOSPHERE_OUT_DIR)/loader_stub.bin $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/exosphere.bin
|
||||||
|
@printf LENY >> $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/exosphere.bin
|
||||||
|
@echo "Built exosphere.bin..."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/loader_stub/$(ATMOSPHERE_OUT_DIR)/loader_stub.bin: check_loader_stub
|
||||||
|
@$(SILENTCMD)echo "Checked loader stub."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/program/$(ATMOSPHERE_OUT_DIR)/program.lz4: check_program
|
||||||
|
@$(SILENTCMD)echo "Checked program."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/warmboot/$(ATMOSPHERE_BOOT_OUT_DIR)/warmboot.bin: check_warmboot
|
||||||
|
@$(SILENTCMD)echo "Checked warmboot."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/mariko_fatal/$(ATMOSPHERE_OUT_DIR)/mariko_fatal.bin: check_mariko_fatal
|
||||||
|
@$(SILENTCMD)echo "Checked mariko fatal."
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
ifneq ($(strip $(ATMOSPHERE_LIBRARY_DIR)),$(strip $(ATMOSPHERE_BOOT_LIBRARY_DIR)))
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_BOOT_LIBRARY_DIR)/libexosphere.a: check_boot_lib
|
||||||
|
@$(SILENTCMD)echo "Checked boot library."
|
||||||
|
endif
|
||||||
|
|
||||||
|
check_loader_stub: $(CURRENT_DIRECTORY)/program/$(ATMOSPHERE_OUT_DIR)/program.lz4
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/loader_stub -f $(CURRENT_DIRECTORY)/loader_stub/loader_stub.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_EXOSPHERE_PROGRAM=1
|
||||||
|
|
||||||
|
check_program: $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_BOOT_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/program -f $(CURRENT_DIRECTORY)/program/program.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE=1
|
||||||
|
|
||||||
|
check_mariko_fatal: $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/mariko_fatal -f $(CURRENT_DIRECTORY)/mariko_fatal/mariko_fatal.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE=1
|
||||||
|
|
||||||
|
check_warmboot: $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_BOOT_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/warmboot -f $(CURRENT_DIRECTORY)/warmboot/warmboot.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE=1 ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE),1)
|
||||||
|
check_boot_lib:
|
||||||
|
else
|
||||||
|
check_boot_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/loader_stub -f $(CURRENT_DIRECTORY)/loader_stub/loader_stub.mk clean
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/program -f $(CURRENT_DIRECTORY)/program/program.mk clean
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/mariko_fatal -f $(CURRENT_DIRECTORY)/mariko_fatal/mariko_fatal.mk clean
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/warmboot -f $(CURRENT_DIRECTORY)/warmboot/warmboot.mk clean ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk clean
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk clean ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
@rm -fr $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
@for i in $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR); do [ -d $$i ] && rmdir --ignore-fail-on-non-empty $$i || true; done
|
||||||
|
|
||||||
|
.PHONY: all clean check_lib check_boot_lib check_loader_stub check_program check_mariko_fatal check_warmboot
|
||||||
@@ -1,158 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm-cortex-a57
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
BINFILES :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_SRC) program.lz4.o boot_code.lz4.o
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
ATMOSPHERE_BUILD_TARGET_IDENTIFIER=$(strip $1)\
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/loader_stub.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX=$(strip $2)\
|
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).elf $$(OUTPUT_BASE)$(strip $2).lz4 boot_code$(strip $2).lz4
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/loader_stub.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm-cortex-a57,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
|
|
||||||
program.lz4.o: program_lz4.h
|
|
||||||
|
|
||||||
program_lz4.h: $(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@rm -rf tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@mkdir -p tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@cp $(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4 tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/program.lz4
|
|
||||||
@bin2s -a 8 -H program_lz4.h tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/program.lz4 | $(AS) -o program.lz4.o
|
|
||||||
@rm -rf tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
$(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4:
|
|
||||||
@$(MAKE) __RECURSIVE__=0 --no-print-directory -C $(TOPDIR)/../program $(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
boot_code.lz4.o: boot_code_lz4.h
|
|
||||||
|
|
||||||
boot_code_lz4.h: $(TOPDIR)/../program/boot_code$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@rm -rf tmp_boot_code_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@mkdir -p tmp_boot_code_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@cp $(TOPDIR)/../program/boot_code$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4 tmp_boot_code_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/boot_code.lz4
|
|
||||||
@bin2s -a 8 -H boot_code_lz4.h tmp_boot_code_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/boot_code.lz4 | $(AS) -o boot_code.lz4.o
|
|
||||||
@rm -rf tmp_boot_code_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
$(TOPDIR)/../program/boot_code$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4: $(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : program_lz4.h boot_code_lz4.h
|
|
||||||
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
132
exosphere/loader_stub/loader_stub.mk
Normal file
132
exosphere/loader_stub/loader_stub.mk
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
|
||||||
|
$(CURRENT_DIRECTORY)/../program/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES := program.lz4 boot_code.lz4
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib check_exo_program
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a $(CURRENT_DIRECTORY)/../program/$(ATMOSPHERE_OUT_DIR)/program.lz4
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/../program/$(ATMOSPHERE_OUT_DIR)/program.lz4: check_exo_program
|
||||||
|
@$(SILENTCMD)echo "Checked exosphere program."
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_EXOSPHERE_PROGRAM),1)
|
||||||
|
check_exo_program:
|
||||||
|
else
|
||||||
|
check_exo_program: check_lib
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/../program -f $(CURRENT_DIRECTORY)/../program/program.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
program.lz4.o: program.lz4
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
boot_code.lz4.o: boot_code.lz4
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(OFILES_BIN)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /loader_stub.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /loader_stub.ld) --gc-sections --nmagic
|
||||||
@@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
|
|
||||||
NORETURN void AbortImpl(const char *file, int line, const char *func, const char *expr, u64 value, const char *format, ...) {
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line) {
|
||||||
AMS_UNUSED(file, line, func, expr, value, format);
|
AMS_UNUSED(expr, func, line, file);
|
||||||
ams::secmon::loader::ErrorReboot();
|
ams::secmon::loader::ErrorReboot();
|
||||||
}
|
}
|
||||||
|
|
||||||
NORETURN void AbortImpl(const char *file, int line, const char *func, const char *expr, u64 value) {
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line, const char *format, ...) {
|
||||||
AMS_UNUSED(file, line, func, expr, value);
|
AMS_UNUSED(expr, func, line, file, format);
|
||||||
ams::secmon::loader::ErrorReboot();
|
ams::secmon::loader::ErrorReboot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,141 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm-cortex-a57
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
BINFILES :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/mariko_fatal.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).elf
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/mariko_fatal.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm-cortex-a57,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
diskio.o ff.o: CFLAGS += -Wno-error
|
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# you need a rule like this for each extension you use as binary data
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o %_bin.h: %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
115
exosphere/mariko_fatal/mariko_fatal.mk
Normal file
115
exosphere/mariko_fatal/mariko_fatal.mk
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES :=
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(HFILES_BIN)
|
||||||
|
|
||||||
|
diskio.o ff.o: CFLAGS += -Wno-error -Wno-unused-parameter -Wno-implicit-fallthrough
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /mariko_fatal.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /mariko_fatal.ld) --gc-sections --nmagic
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
|
|
||||||
void AbortImpl() {
|
NORETURN void AbortImpl() {
|
||||||
AMS_SECMON_LOG("AbortImpl was called\n");
|
AMS_SECMON_LOG("AbortImpl was called\n");
|
||||||
AMS_LOG_FLUSH();
|
AMS_LOG_FLUSH();
|
||||||
reg::Write(0x4, 0xAAAAAAAA);
|
reg::Write(0x4, 0xAAAAAAAA);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace ams::secmon::fatal {
|
|||||||
/* Write the context to the file. */
|
/* Write the context to the file. */
|
||||||
R_TRY(fs::WriteFile(file, 0, ctx, sizeof(*ctx), fs::WriteOption::Flush));
|
R_TRY(fs::WriteFile(file, 0, ctx, sizeof(*ctx), fs::WriteOption::Flush));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ namespace ams::secmon::fatal {
|
|||||||
//sdmmc::Deactivate(Port);
|
//sdmmc::Deactivate(Port);
|
||||||
R_TRY(sdmmc::Activate(Port));
|
R_TRY(sdmmc::Activate(Port));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CheckSdCardConnection(sdmmc::SpeedMode *out_sm, sdmmc::BusWidth *out_bw) {
|
Result CheckSdCardConnection(sdmmc::SpeedMode *out_sm, sdmmc::BusWidth *out_bw) {
|
||||||
return sdmmc::CheckSdCardConnection(out_sm, out_bw, Port);
|
R_RETURN(sdmmc::CheckSdCardConnection(out_sm, out_bw, Port));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadSdCard(void *dst, size_t size, size_t sector_index, size_t sector_count) {
|
Result ReadSdCard(void *dst, size_t size, size_t sector_index, size_t sector_count) {
|
||||||
@@ -78,7 +78,7 @@ namespace ams::secmon::fatal {
|
|||||||
sector_count -= cur_sectors;
|
sector_count -= cur_sectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result WriteSdCard(size_t sector_index, size_t sector_count, const void *src, size_t size) {
|
Result WriteSdCard(size_t sector_index, size_t sector_count, const void *src, size_t size) {
|
||||||
@@ -104,7 +104,7 @@ namespace ams::secmon::fatal {
|
|||||||
sector_count -= cur_sectors;
|
sector_count -= cur_sectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,45 +34,45 @@ namespace ams::fs {
|
|||||||
Result TranslateFatFsError(FRESULT res) {
|
Result TranslateFatFsError(FRESULT res) {
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case FR_OK:
|
case FR_OK:
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
case FR_DISK_ERR:
|
case FR_DISK_ERR:
|
||||||
return fs::ResultMmcAccessFailed();
|
R_THROW(fs::ResultMmcAccessFailed());
|
||||||
case FR_INT_ERR:
|
case FR_INT_ERR:
|
||||||
return fs::ResultPreconditionViolation();
|
R_THROW(fs::ResultPreconditionViolation());
|
||||||
case FR_NOT_READY:
|
case FR_NOT_READY:
|
||||||
return fs::ResultMmcAccessFailed();
|
R_THROW(fs::ResultMmcAccessFailed());
|
||||||
case FR_NO_FILE:
|
case FR_NO_FILE:
|
||||||
return fs::ResultPathNotFound();
|
R_THROW(fs::ResultPathNotFound());
|
||||||
case FR_NO_PATH:
|
case FR_NO_PATH:
|
||||||
return fs::ResultPathNotFound();
|
R_THROW(fs::ResultPathNotFound());
|
||||||
case FR_INVALID_NAME:
|
case FR_INVALID_NAME:
|
||||||
return fs::ResultInvalidPath();
|
R_THROW(fs::ResultInvalidPath());
|
||||||
case FR_DENIED:
|
case FR_DENIED:
|
||||||
return fs::ResultPermissionDenied();
|
R_THROW(fs::ResultPermissionDenied());
|
||||||
case FR_EXIST:
|
case FR_EXIST:
|
||||||
return fs::ResultPathAlreadyExists();
|
R_THROW(fs::ResultPathAlreadyExists());
|
||||||
case FR_INVALID_OBJECT:
|
case FR_INVALID_OBJECT:
|
||||||
return fs::ResultInvalidArgument();
|
R_THROW(fs::ResultInvalidArgument());
|
||||||
case FR_WRITE_PROTECTED:
|
case FR_WRITE_PROTECTED:
|
||||||
return fs::ResultWriteNotPermitted();
|
R_THROW(fs::ResultWriteNotPermitted());
|
||||||
case FR_INVALID_DRIVE:
|
case FR_INVALID_DRIVE:
|
||||||
return fs::ResultInvalidMountName();
|
R_THROW(fs::ResultInvalidMountName());
|
||||||
case FR_NOT_ENABLED:
|
case FR_NOT_ENABLED:
|
||||||
return fs::ResultInvalidMountName(); /* BAD/TODO */
|
R_THROW(fs::ResultInvalidMountName()); /* BAD/TODO */
|
||||||
case FR_NO_FILESYSTEM:
|
case FR_NO_FILESYSTEM:
|
||||||
return fs::ResultInvalidMountName(); /* BAD/TODO */
|
R_THROW(fs::ResultInvalidMountName()); /* BAD/TODO */
|
||||||
case FR_TIMEOUT:
|
case FR_TIMEOUT:
|
||||||
return fs::ResultTargetLocked(); /* BAD/TODO */
|
R_THROW(fs::ResultTargetLocked()); /* BAD/TODO */
|
||||||
case FR_LOCKED:
|
case FR_LOCKED:
|
||||||
return fs::ResultTargetLocked();
|
R_THROW(fs::ResultTargetLocked());
|
||||||
case FR_NOT_ENOUGH_CORE:
|
case FR_NOT_ENOUGH_CORE:
|
||||||
return fs::ResultPreconditionViolation(); /* BAD/TODO */
|
R_THROW(fs::ResultPreconditionViolation()); /* BAD/TODO */
|
||||||
case FR_TOO_MANY_OPEN_FILES:
|
case FR_TOO_MANY_OPEN_FILES:
|
||||||
return fs::ResultPreconditionViolation(); /* BAD/TODO */
|
R_THROW(fs::ResultPreconditionViolation()); /* BAD/TODO */
|
||||||
case FR_INVALID_PARAMETER:
|
case FR_INVALID_PARAMETER:
|
||||||
return fs::ResultInvalidArgument();
|
R_THROW(fs::ResultInvalidArgument());
|
||||||
default:
|
default:
|
||||||
return fs::ResultInternal();
|
R_THROW(fs::ResultInternal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,11 +125,11 @@ namespace ams::fs {
|
|||||||
/* Expand the file. */
|
/* Expand the file. */
|
||||||
R_TRY(TranslateFatFsError(f_expand(std::addressof(fp), size, 1)));
|
R_TRY(TranslateFatFsError(f_expand(std::addressof(fp), size, 1)));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CreateDirectory(const char *path) {
|
Result CreateDirectory(const char *path) {
|
||||||
return TranslateFatFsError(f_mkdir(path));
|
R_RETURN(TranslateFatFsError(f_mkdir(path)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result OpenFile(FileHandle *out_file, const char *path, int mode) {
|
Result OpenFile(FileHandle *out_file, const char *path, int mode) {
|
||||||
@@ -144,10 +144,10 @@ namespace ams::fs {
|
|||||||
out_file->_handle = fp;
|
out_file->_handle = fp;
|
||||||
g_files_opened[i] = true;
|
g_files_opened[i] = true;
|
||||||
g_open_modes[i] = mode;
|
g_open_modes[i] = mode;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fs::ResultOpenCountLimit();
|
R_THROW(fs::ResultOpenCountLimit());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) {
|
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) {
|
||||||
@@ -164,11 +164,11 @@ namespace ams::fs {
|
|||||||
/* Check that we read the correct amount. */
|
/* Check that we read the correct amount. */
|
||||||
R_UNLESS(br == size, fs::ResultOutOfRange());
|
R_UNLESS(br == size, fs::ResultOutOfRange());
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size) {
|
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size) {
|
||||||
return ReadFile(handle, offset, buffer, size, fs::ReadOption::None);
|
R_RETURN(ReadFile(handle, offset, buffer, size, fs::ReadOption::None));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) {
|
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) {
|
||||||
@@ -185,21 +185,21 @@ namespace ams::fs {
|
|||||||
/* Set the output size. */
|
/* Set the output size. */
|
||||||
*out = br;
|
*out = br;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size) {
|
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size) {
|
||||||
return ReadFile(out, handle, offset, buffer, size, fs::ReadOption::None);
|
R_RETURN(ReadFile(out, handle, offset, buffer, size, fs::ReadOption::None));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetFileSize(s64 *out, FileHandle handle) {
|
Result GetFileSize(s64 *out, FileHandle handle) {
|
||||||
FIL *fp = GetInternalFile(handle);
|
FIL *fp = GetInternalFile(handle);
|
||||||
*out = f_size(fp);
|
*out = f_size(fp);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FlushFile(FileHandle handle) {
|
Result FlushFile(FileHandle handle) {
|
||||||
return TranslateFatFsError(f_sync(GetInternalFile(handle)));
|
R_RETURN(TranslateFatFsError(f_sync(GetInternalFile(handle))));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result WriteFile(FileHandle handle, s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) {
|
Result WriteFile(FileHandle handle, s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) {
|
||||||
@@ -218,7 +218,7 @@ namespace ams::fs {
|
|||||||
R_TRY(FlushFile(handle));
|
R_TRY(FlushFile(handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SetFileSize(FileHandle handle, s64 size) {
|
Result SetFileSize(FileHandle handle, s64 size) {
|
||||||
@@ -242,7 +242,7 @@ namespace ams::fs {
|
|||||||
/* Check that our expansion succeeded. */
|
/* Check that our expansion succeeded. */
|
||||||
AMS_ASSERT(f_size(fp) == static_cast<FSIZE_t>(size));
|
AMS_ASSERT(f_size(fp) == static_cast<FSIZE_t>(size));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetFileOpenMode(FileHandle handle) {
|
int GetFileOpenMode(FileHandle handle) {
|
||||||
|
|||||||
@@ -1,163 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm-cortex-a57
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_SRC) rebootstub.bin.o sc7fw.bin.o
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
ATMOSPHERE_BUILD_TARGET_IDENTIFIER=$(strip $1)\
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/program.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX=$(strip $2)\
|
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).elf $$(OUTPUT_BASE)$(strip $2).lz4 boot_code$(strip $2).lz4
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/program.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm-cortex-a57,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).lz4 : $(OUTPUT).bin
|
|
||||||
@python $(TOPDIR)/split_program.py $(OUTPUT).bin "$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX)" $(dir $(OUTPUT))
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
secmon_crt0_cpp.o secmon_make_page_table.o : CFLAGS += -fno-builtin
|
|
||||||
|
|
||||||
rebootstub.bin.o: rebootstub_bin.h
|
|
||||||
|
|
||||||
rebootstub_bin.h: $(TOPDIR)/rebootstub/rebootstub$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).bin
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@rm -rf tmp_rebootstub_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@mkdir -p tmp_rebootstub_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@cp $(TOPDIR)/rebootstub/rebootstub$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).bin tmp_rebootstub_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/rebootstub.bin
|
|
||||||
@bin2s -a 8 -H rebootstub_bin.h tmp_rebootstub_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/rebootstub.bin | $(AS) -o rebootstub.bin.o
|
|
||||||
@rm -rf tmp_rebootstub_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
$(TOPDIR)/rebootstub/rebootstub$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).bin:
|
|
||||||
@$(MAKE) __RECURSIVE__=0 --no-print-directory -C $(TOPDIR)/rebootstub $(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
sc7fw.bin.o: sc7fw_bin.h
|
|
||||||
|
|
||||||
sc7fw.bin.o sc7fw_bin.h: $(TOPDIR)/sc7fw/sc7fw$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).bin
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@rm -rf tmp_sc7fw_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@mkdir -p tmp_sc7fw_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@cp $(TOPDIR)/sc7fw/sc7fw$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).bin tmp_sc7fw_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/sc7fw.bin
|
|
||||||
@bin2s -a 8 -H sc7fw_bin.h tmp_sc7fw_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/sc7fw.bin | $(AS) -o sc7fw.bin.o
|
|
||||||
@rm -rf tmp_sc7fw_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
$(TOPDIR)/sc7fw/sc7fw$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).bin:
|
|
||||||
@$(MAKE) __RECURSIVE__=0 --no-print-directory -C $(TOPDIR)/sc7fw $(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : rebootstub_bin.h sc7fw_bin.h
|
|
||||||
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
162
exosphere/program/program.mk
Normal file
162
exosphere/program/program.mk
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
|
||||||
|
$(CURRENT_DIRECTORY)/sc7fw/$(ATMOSPHERE_BOOT_OUT_DIR) \
|
||||||
|
$(CURRENT_DIRECTORY)/rebootstub/$(ATMOSPHERE_BOOT_OUT_DIR)
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES := sc7fw.bin rebootstub.bin
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib check_boot_lib check_sc7fw check_rebootstub
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a $(CURRENT_DIRECTORY)/sc7fw/$(ATMOSPHERE_BOOT_OUT_DIR)/sc7fw.bin $(CURRENT_DIRECTORY)/rebootstub/$(ATMOSPHERE_BOOT_OUT_DIR)/rebootstub.bin
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
|
||||||
|
ifneq ($(strip $(ATMOSPHERE_LIBRARY_DIR)),$(strip $(ATMOSPHERE_BOOT_LIBRARY_DIR)))
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_BOOT_LIBRARY_DIR)/libexosphere.a: check_boot_lib
|
||||||
|
@$(SILENTCMD)echo "Checked boot library."
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/sc7fw/$(ATMOSPHERE_BOOT_OUT_DIR)/sc7fw.bin: check_sc7fw
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/rebootstub/$(ATMOSPHERE_BOOT_OUT_DIR)/rebootstub.bin: check_rebootstub
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_SC7FW),1)
|
||||||
|
check_sc7fw:
|
||||||
|
else
|
||||||
|
check_sc7fw: $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_BOOT_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/sc7fw -f $(CURRENT_DIRECTORY)/sc7fw/sc7fw.mk ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))" ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_REBOOTSTUB),1)
|
||||||
|
check_rebootstub:
|
||||||
|
else
|
||||||
|
check_rebootstub: $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_BOOT_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/rebootstub -f $(CURRENT_DIRECTORY)/rebootstub/rebootstub.mk ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))" ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE),1)
|
||||||
|
check_boot_lib:
|
||||||
|
else
|
||||||
|
check_boot_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/rebootstub -f $(CURRENT_DIRECTORY)/rebootstub/rebootstub.mk clean ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/sc7fw -f $(CURRENT_DIRECTORY)/sc7fw/sc7fw.mk clean ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).lz4 : $(OUTPUT).bin
|
||||||
|
@python $(CURRENT_DIRECTORY)/split_program.py $(OUTPUT).bin $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
secmon_crt0_cpp.o secmon_make_page_table.o : CFLAGS += -fno-builtin
|
||||||
|
|
||||||
|
sc7fw.bin.o: sc7fw.bin
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
rebootstub.bin.o: rebootstub.bin
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(OFILES_BIN)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /program.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /program.ld) --gc-sections --nmagic
|
||||||
@@ -1,139 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm7tdmi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
BINFILES :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/rebootstub.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).elf
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/rebootstub.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm7tdmi,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# you need a rule like this for each extension you use as binary data
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o %_bin.h: %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
113
exosphere/program/rebootstub/rebootstub.mk
Normal file
113
exosphere/program/rebootstub/rebootstub.mk
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES :=
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(HFILES_BIN)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /rebootstub.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /rebootstub.ld) --gc-sections --nmagic
|
||||||
@@ -50,7 +50,7 @@ namespace ams::rebootstub {
|
|||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
|
|
||||||
void AbortImpl() {
|
NORETURN void AbortImpl() {
|
||||||
/* Halt the bpmp. */
|
/* Halt the bpmp. */
|
||||||
rebootstub::Halt();
|
rebootstub::Halt();
|
||||||
|
|
||||||
|
|||||||
@@ -1,139 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm7tdmi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
BINFILES :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/sc7fw.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).elf
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/sc7fw.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm7tdmi,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# you need a rule like this for each extension you use as binary data
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o %_bin.h: %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
113
exosphere/program/sc7fw/sc7fw.mk
Normal file
113
exosphere/program/sc7fw/sc7fw.mk
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES :=
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(HFILES_BIN)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /sc7fw.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /sc7fw.ld) --gc-sections --nmagic
|
||||||
@@ -111,7 +111,7 @@ namespace ams::sc7fw {
|
|||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
|
|
||||||
void AbortImpl() {
|
NORETURN void AbortImpl() {
|
||||||
sc7fw::ExceptionHandler();
|
sc7fw::ExceptionHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,10 +85,10 @@ _ZN3ams6secmon4boot15VolatileKeyDataE:
|
|||||||
/* We can get away with only including latest because exosphere supports newer-than-expected master key in engine. */
|
/* We can get away with only including latest because exosphere supports newer-than-expected master key in engine. */
|
||||||
/* TODO: Update on next change of keys. */
|
/* TODO: Update on next change of keys. */
|
||||||
/* Mariko Development Master Kek Source. */
|
/* Mariko Development Master Kek Source. */
|
||||||
.byte 0x4D, 0x5A, 0xB2, 0xC9, 0xE9, 0xE4, 0x4E, 0xA4, 0xD3, 0xBF, 0x94, 0x12, 0x36, 0x30, 0xD0, 0x7F
|
.byte 0x18, 0xA5, 0x6F, 0xEF, 0x72, 0x11, 0x62, 0xC5, 0x1A, 0x14, 0xF1, 0x8C, 0x21, 0x83, 0x27, 0xB7
|
||||||
|
|
||||||
/* Mariko Production Master Kek Source. */
|
/* Mariko Production Master Kek Source. */
|
||||||
.byte 0x52, 0x71, 0x9B, 0xDF, 0xA7, 0x8B, 0x61, 0xD8, 0xD5, 0x85, 0x11, 0xE4, 0x8E, 0x4F, 0x74, 0xC6
|
.byte 0xEC, 0x61, 0xBC, 0x82, 0x1E, 0x0F, 0x5A, 0xC3, 0x2B, 0x64, 0x3F, 0x9D, 0xD6, 0x19, 0x22, 0x2D
|
||||||
|
|
||||||
/* Development Master Key Vectors. */
|
/* Development Master Key Vectors. */
|
||||||
.byte 0x46, 0x22, 0xB4, 0x51, 0x9A, 0x7E, 0xA7, 0x7F, 0x62, 0xA1, 0x1F, 0x8F, 0xC5, 0x3A, 0xDB, 0xFE /* Zeroes encrypted with Master Key 00. */
|
.byte 0x46, 0x22, 0xB4, 0x51, 0x9A, 0x7E, 0xA7, 0x7F, 0x62, 0xA1, 0x1F, 0x8F, 0xC5, 0x3A, 0xDB, 0xFE /* Zeroes encrypted with Master Key 00. */
|
||||||
@@ -104,6 +104,8 @@ _ZN3ams6secmon4boot15VolatileKeyDataE:
|
|||||||
.byte 0x6C, 0x2E, 0xCD, 0xB3, 0x34, 0x61, 0x77, 0xF5, 0xF9, 0xB1, 0xDD, 0x61, 0x98, 0x19, 0x3E, 0xD4 /* Master key 09 encrypted with Master key 0A. */
|
.byte 0x6C, 0x2E, 0xCD, 0xB3, 0x34, 0x61, 0x77, 0xF5, 0xF9, 0xB1, 0xDD, 0x61, 0x98, 0x19, 0x3E, 0xD4 /* Master key 09 encrypted with Master key 0A. */
|
||||||
.byte 0x21, 0x88, 0x6B, 0x10, 0x9E, 0x83, 0xD6, 0x52, 0xAB, 0x08, 0xDB, 0x6D, 0x39, 0xFF, 0x1C, 0x9C /* Master key 0A encrypted with Master key 0B. */
|
.byte 0x21, 0x88, 0x6B, 0x10, 0x9E, 0x83, 0xD6, 0x52, 0xAB, 0x08, 0xDB, 0x6D, 0x39, 0xFF, 0x1C, 0x9C /* Master key 0A encrypted with Master key 0B. */
|
||||||
.byte 0x8A, 0xCE, 0xC4, 0x7F, 0xBE, 0x08, 0x61, 0x88, 0xD3, 0x73, 0x64, 0x51, 0xE2, 0xB6, 0x53, 0x15 /* Master key 0B encrypted with Master key 0C. */
|
.byte 0x8A, 0xCE, 0xC4, 0x7F, 0xBE, 0x08, 0x61, 0x88, 0xD3, 0x73, 0x64, 0x51, 0xE2, 0xB6, 0x53, 0x15 /* Master key 0B encrypted with Master key 0C. */
|
||||||
|
.byte 0x08, 0xE0, 0xF4, 0xBE, 0xAA, 0x6E, 0x5A, 0xC3, 0xA6, 0xBC, 0xFE, 0xB9, 0xE2, 0xA3, 0x24, 0x12 /* Master key 0C encrypted with Master key 0D. */
|
||||||
|
.byte 0xD6, 0x80, 0x98, 0xC0, 0xFA, 0xC7, 0x13, 0xCB, 0x93, 0xD2, 0x0B, 0x82, 0x4C, 0xA1, 0x7B, 0x8D /* Master key 0D encrypted with Master key 0E. */
|
||||||
|
|
||||||
/* Production Master Key Vectors. */
|
/* Production Master Key Vectors. */
|
||||||
.byte 0x0C, 0xF0, 0x59, 0xAC, 0x85, 0xF6, 0x26, 0x65, 0xE1, 0xE9, 0x19, 0x55, 0xE6, 0xF2, 0x67, 0x3D /* Zeroes encrypted with Master Key 00. */
|
.byte 0x0C, 0xF0, 0x59, 0xAC, 0x85, 0xF6, 0x26, 0x65, 0xE1, 0xE9, 0x19, 0x55, 0xE6, 0xF2, 0x67, 0x3D /* Zeroes encrypted with Master Key 00. */
|
||||||
@@ -119,6 +121,8 @@ _ZN3ams6secmon4boot15VolatileKeyDataE:
|
|||||||
.byte 0xB8, 0x96, 0x9E, 0x4A, 0x00, 0x0D, 0xD6, 0x28, 0xB3, 0xD1, 0xDB, 0x68, 0x5F, 0xFB, 0xE1, 0x2A /* Master key 09 encrypted with Master key 0A. */
|
.byte 0xB8, 0x96, 0x9E, 0x4A, 0x00, 0x0D, 0xD6, 0x28, 0xB3, 0xD1, 0xDB, 0x68, 0x5F, 0xFB, 0xE1, 0x2A /* Master key 09 encrypted with Master key 0A. */
|
||||||
.byte 0xC1, 0x8D, 0x16, 0xBB, 0x2A, 0xE4, 0x1D, 0xD4, 0xC2, 0xC1, 0xB6, 0x40, 0x94, 0x35, 0x63, 0x98 /* Master key 0A encrypted with Master key 0B. */
|
.byte 0xC1, 0x8D, 0x16, 0xBB, 0x2A, 0xE4, 0x1D, 0xD4, 0xC2, 0xC1, 0xB6, 0x40, 0x94, 0x35, 0x63, 0x98 /* Master key 0A encrypted with Master key 0B. */
|
||||||
.byte 0xA3, 0x24, 0x65, 0x75, 0xEA, 0xCC, 0x6E, 0x8D, 0xFB, 0x5A, 0x16, 0x50, 0x74, 0xD2, 0x15, 0x06 /* Master key 0B encrypted with Master key 0C. */
|
.byte 0xA3, 0x24, 0x65, 0x75, 0xEA, 0xCC, 0x6E, 0x8D, 0xFB, 0x5A, 0x16, 0x50, 0x74, 0xD2, 0x15, 0x06 /* Master key 0B encrypted with Master key 0C. */
|
||||||
|
.byte 0x83, 0x67, 0xAF, 0x01, 0xCF, 0x93, 0xA1, 0xAB, 0x80, 0x45, 0xF7, 0x3F, 0x72, 0xFD, 0x3B, 0x38 /* Master key 0C encrypted with Master key 0D. */
|
||||||
|
.byte 0xB1, 0x81, 0xA6, 0x0D, 0x72, 0xC7, 0xEE, 0x15, 0x21, 0xF3, 0xC0, 0xB5, 0x6B, 0x61, 0x6D, 0xE7 /* Master key 0D encrypted with Master key 0E. */
|
||||||
|
|
||||||
/* Device Master Key Source Sources. */
|
/* Device Master Key Source Sources. */
|
||||||
.byte 0x8B, 0x4E, 0x1C, 0x22, 0x42, 0x07, 0xC8, 0x73, 0x56, 0x94, 0x08, 0x8B, 0xCC, 0x47, 0x0F, 0x5D /* 4.0.0 Device Master Key Source Source. */
|
.byte 0x8B, 0x4E, 0x1C, 0x22, 0x42, 0x07, 0xC8, 0x73, 0x56, 0x94, 0x08, 0x8B, 0xCC, 0x47, 0x0F, 0x5D /* 4.0.0 Device Master Key Source Source. */
|
||||||
@@ -131,6 +135,8 @@ _ZN3ams6secmon4boot15VolatileKeyDataE:
|
|||||||
.byte 0x14, 0xB8, 0x74, 0x12, 0xCB, 0xBD, 0x0B, 0x8F, 0x20, 0xFB, 0x30, 0xDA, 0x27, 0xE4, 0x58, 0x94 /* 9.1.0 Device Master Key Source Source. */
|
.byte 0x14, 0xB8, 0x74, 0x12, 0xCB, 0xBD, 0x0B, 0x8F, 0x20, 0xFB, 0x30, 0xDA, 0x27, 0xE4, 0x58, 0x94 /* 9.1.0 Device Master Key Source Source. */
|
||||||
.byte 0xAA, 0xFD, 0xBC, 0xBB, 0x25, 0xC3, 0xA4, 0xEF, 0xE3, 0xEE, 0x58, 0x53, 0xB7, 0xF8, 0xDD, 0xD6 /* 12.1.0 Device Master Key Source Source. */
|
.byte 0xAA, 0xFD, 0xBC, 0xBB, 0x25, 0xC3, 0xA4, 0xEF, 0xE3, 0xEE, 0x58, 0x53, 0xB7, 0xF8, 0xDD, 0xD6 /* 12.1.0 Device Master Key Source Source. */
|
||||||
.byte 0xE4, 0xF3, 0x45, 0x6F, 0x18, 0xA1, 0x89, 0xF8, 0xDA, 0x4C, 0x64, 0x75, 0x68, 0xE6, 0xBD, 0x4F /* 13.0.0 Device Master Key Source Source. */
|
.byte 0xE4, 0xF3, 0x45, 0x6F, 0x18, 0xA1, 0x89, 0xF8, 0xDA, 0x4C, 0x64, 0x75, 0x68, 0xE6, 0xBD, 0x4F /* 13.0.0 Device Master Key Source Source. */
|
||||||
|
.byte 0x5B, 0x94, 0x63, 0xF7, 0xAD, 0x96, 0x1B, 0xA6, 0x23, 0x30, 0x06, 0x4D, 0x01, 0xE4, 0xCE, 0x1D /* 14.0.0 Device Master Key Source Source. */
|
||||||
|
.byte 0x5E, 0xC9, 0xC5, 0x0A, 0xD0, 0x5F, 0x8B, 0x7B, 0xA7, 0x39, 0xEA, 0xBC, 0x60, 0x0F, 0x74, 0xE6 /* 15.0.0 Device Master Key Source Source. */
|
||||||
|
|
||||||
/* Development Device Master Kek Sources. */
|
/* Development Device Master Kek Sources. */
|
||||||
.byte 0xD6, 0xBD, 0x9F, 0xC6, 0x18, 0x09, 0xE1, 0x96, 0x20, 0x39, 0x60, 0xD2, 0x89, 0x83, 0x31, 0x34 /* 4.0.0 Device Master Kek Source. */
|
.byte 0xD6, 0xBD, 0x9F, 0xC6, 0x18, 0x09, 0xE1, 0x96, 0x20, 0x39, 0x60, 0xD2, 0x89, 0x83, 0x31, 0x34 /* 4.0.0 Device Master Kek Source. */
|
||||||
@@ -143,6 +149,8 @@ _ZN3ams6secmon4boot15VolatileKeyDataE:
|
|||||||
.byte 0x9D, 0xB1, 0xAE, 0xCB, 0xF6, 0xF6, 0xE3, 0xFE, 0xAB, 0x6F, 0xCB, 0xAF, 0x38, 0x03, 0xFC, 0x7B /* 9.1.0 Device Master Kek Source. */
|
.byte 0x9D, 0xB1, 0xAE, 0xCB, 0xF6, 0xF6, 0xE3, 0xFE, 0xAB, 0x6F, 0xCB, 0xAF, 0x38, 0x03, 0xFC, 0x7B /* 9.1.0 Device Master Kek Source. */
|
||||||
.byte 0xC4, 0xBB, 0xF3, 0x9F, 0xA3, 0xAA, 0x00, 0x99, 0x7C, 0x97, 0xAD, 0x91, 0x8F, 0xE8, 0x45, 0xCB /* 12.1.0 Device Master Kek Source. */
|
.byte 0xC4, 0xBB, 0xF3, 0x9F, 0xA3, 0xAA, 0x00, 0x99, 0x7C, 0x97, 0xAD, 0x91, 0x8F, 0xE8, 0x45, 0xCB /* 12.1.0 Device Master Kek Source. */
|
||||||
.byte 0x20, 0x20, 0xAA, 0xFB, 0x89, 0xC2, 0xF0, 0x70, 0xB5, 0xE0, 0xA3, 0x11, 0x8A, 0x29, 0x8D, 0x0F /* 13.0.0 Device Master Kek Source. */
|
.byte 0x20, 0x20, 0xAA, 0xFB, 0x89, 0xC2, 0xF0, 0x70, 0xB5, 0xE0, 0xA3, 0x11, 0x8A, 0x29, 0x8D, 0x0F /* 13.0.0 Device Master Kek Source. */
|
||||||
|
.byte 0xCE, 0x14, 0x74, 0x66, 0x98, 0xA8, 0x6D, 0x7D, 0xBD, 0x54, 0x91, 0x68, 0x5F, 0x1D, 0x0E, 0xEA /* 14.0.0 Device Master Kek Source. */
|
||||||
|
.byte 0xAE, 0x05, 0x48, 0x65, 0xAB, 0x17, 0x9D, 0x3D, 0x51, 0xB7, 0x56, 0xBD, 0x9B, 0x0B, 0x5B, 0x6E /* 15.0.0 Device Master Kek Source. */
|
||||||
|
|
||||||
/* Production Device Master Kek Sources. */
|
/* Production Device Master Kek Sources. */
|
||||||
.byte 0x88, 0x62, 0x34, 0x6E, 0xFA, 0xF7, 0xD8, 0x3F, 0xE1, 0x30, 0x39, 0x50, 0xF0, 0xB7, 0x5D, 0x5D /* 4.0.0 Device Master Kek Source. */
|
.byte 0x88, 0x62, 0x34, 0x6E, 0xFA, 0xF7, 0xD8, 0x3F, 0xE1, 0x30, 0x39, 0x50, 0xF0, 0xB7, 0x5D, 0x5D /* 4.0.0 Device Master Kek Source. */
|
||||||
@@ -155,3 +163,5 @@ _ZN3ams6secmon4boot15VolatileKeyDataE:
|
|||||||
.byte 0xCE, 0xFE, 0x41, 0x0F, 0x46, 0x9A, 0x30, 0xD6, 0xF2, 0xE9, 0x0C, 0x6B, 0xB7, 0x15, 0x91, 0x36 /* 9.1.0 Device Master Kek Source. */
|
.byte 0xCE, 0xFE, 0x41, 0x0F, 0x46, 0x9A, 0x30, 0xD6, 0xF2, 0xE9, 0x0C, 0x6B, 0xB7, 0x15, 0x91, 0x36 /* 9.1.0 Device Master Kek Source. */
|
||||||
.byte 0xC2, 0x65, 0x34, 0x6E, 0xC7, 0xC6, 0x5D, 0x97, 0x3E, 0x34, 0x5C, 0x6B, 0xB3, 0x7E, 0xC6, 0xE3 /* 12.1.0 Device Master Kek Source. */
|
.byte 0xC2, 0x65, 0x34, 0x6E, 0xC7, 0xC6, 0x5D, 0x97, 0x3E, 0x34, 0x5C, 0x6B, 0xB3, 0x7E, 0xC6, 0xE3 /* 12.1.0 Device Master Kek Source. */
|
||||||
.byte 0x77, 0x52, 0x92, 0xF0, 0xAA, 0xE3, 0xFB, 0xE0, 0x60, 0x16, 0xB3, 0x78, 0x68, 0x53, 0xF7, 0xA8 /* 13.0.0 Device Master Kek Source. */
|
.byte 0x77, 0x52, 0x92, 0xF0, 0xAA, 0xE3, 0xFB, 0xE0, 0x60, 0x16, 0xB3, 0x78, 0x68, 0x53, 0xF7, 0xA8 /* 13.0.0 Device Master Kek Source. */
|
||||||
|
.byte 0x67, 0xD5, 0xD6, 0x0C, 0x08, 0xF5, 0xA3, 0x11, 0xBD, 0x6D, 0x5A, 0xEB, 0x96, 0x24, 0xB0, 0xD2 /* 14.0.0 Device Master Kek Source. */
|
||||||
|
.byte 0x7C, 0x30, 0xED, 0x8B, 0x39, 0x25, 0x2C, 0x08, 0x8F, 0x48, 0xDC, 0x28, 0xE6, 0x1A, 0x6B, 0x49 /* 15.0.0 Device Master Kek Source. */
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ namespace ams::secmon::boot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check that the key generation is one that we can use. */
|
/* Check that the key generation is one that we can use. */
|
||||||
static_assert(pkg1::KeyGeneration_Count == 13);
|
static_assert(pkg1::KeyGeneration_Count == 15);
|
||||||
if (key_generation >= pkg1::KeyGeneration_Count) {
|
if (key_generation >= pkg1::KeyGeneration_Count) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace ams::diag {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbortImpl() {
|
NORETURN void AbortImpl() {
|
||||||
/* Perform any necessary (typically none) debugging. */
|
/* Perform any necessary (typically none) debugging. */
|
||||||
if constexpr (SaveSystemStateForDebug) {
|
if constexpr (SaveSystemStateForDebug) {
|
||||||
SaveSystemStateForDebugAbort();
|
SaveSystemStateForDebugAbort();
|
||||||
|
|||||||
@@ -365,9 +365,9 @@ namespace ams::secmon {
|
|||||||
reg::Write(MC + MC_SECURITY_CARVEOUT4_CFG0, carveout_config);
|
reg::Write(MC + MC_SECURITY_CARVEOUT4_CFG0, carveout_config);
|
||||||
|
|
||||||
/* Configure carveout 5. */
|
/* Configure carveout 5. */
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT5_BOM, g_kernel_carveouts[0].address >> 0);
|
reg::Write(MC + MC_SECURITY_CARVEOUT5_BOM, g_kernel_carveouts[1].address >> 0);
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT5_BOM_HI, g_kernel_carveouts[0].address >> 32);
|
reg::Write(MC + MC_SECURITY_CARVEOUT5_BOM_HI, g_kernel_carveouts[1].address >> 32);
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT5_SIZE_128KB, g_kernel_carveouts[0].size / 128_KB);
|
reg::Write(MC + MC_SECURITY_CARVEOUT5_SIZE_128KB, g_kernel_carveouts[1].size / 128_KB);
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT5_CLIENT_ACCESS0, ClientAccess0);
|
reg::Write(MC + MC_SECURITY_CARVEOUT5_CLIENT_ACCESS0, ClientAccess0);
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT5_CLIENT_ACCESS1, ClientAccess1);
|
reg::Write(MC + MC_SECURITY_CARVEOUT5_CLIENT_ACCESS1, ClientAccess1);
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT5_CLIENT_ACCESS2, client_access_2);
|
reg::Write(MC + MC_SECURITY_CARVEOUT5_CLIENT_ACCESS2, client_access_2);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace ams::secmon::smc {
|
|||||||
[fuse::DramId_IcosaSamsung6GB] = pkg1::MemorySize_6GB,
|
[fuse::DramId_IcosaSamsung6GB] = pkg1::MemorySize_6GB,
|
||||||
[fuse::DramId_HoagHynix1y4GB] = pkg1::MemorySize_4GB,
|
[fuse::DramId_HoagHynix1y4GB] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_AulaHynix1y4GB] = pkg1::MemorySize_4GB,
|
[fuse::DramId_AulaHynix1y4GB] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_IowaX1X2Samsung4GB] = pkg1::MemorySize_4GB,
|
[fuse::DramId_Deprecated7] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_IowaSansung4GB] = pkg1::MemorySize_4GB,
|
[fuse::DramId_IowaSansung4GB] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_IowaSamsung8GB] = pkg1::MemorySize_8GB,
|
[fuse::DramId_IowaSamsung8GB] = pkg1::MemorySize_8GB,
|
||||||
[fuse::DramId_IowaHynix4GB] = pkg1::MemorySize_4GB,
|
[fuse::DramId_IowaHynix4GB] = pkg1::MemorySize_4GB,
|
||||||
@@ -61,19 +61,25 @@ namespace ams::secmon::smc {
|
|||||||
[fuse::DramId_HoagSamsung8GB] = pkg1::MemorySize_8GB,
|
[fuse::DramId_HoagSamsung8GB] = pkg1::MemorySize_8GB,
|
||||||
[fuse::DramId_HoagHynix4GB] = pkg1::MemorySize_4GB,
|
[fuse::DramId_HoagHynix4GB] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_HoagMicron4GB] = pkg1::MemorySize_4GB,
|
[fuse::DramId_HoagMicron4GB] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_IowaSamsung4GBY] = pkg1::MemorySize_4GB,
|
[fuse::DramId_Deprecated16] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_IowaSamsung1y4GBX] = pkg1::MemorySize_4GB,
|
[fuse::DramId_IowaSamsung1y4GBX] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_IowaSamsung1y8GBX] = pkg1::MemorySize_8GB,
|
[fuse::DramId_IowaSamsung1y8GBX] = pkg1::MemorySize_8GB,
|
||||||
[fuse::DramId_HoagSamsung1y4GBX] = pkg1::MemorySize_4GB,
|
[fuse::DramId_HoagSamsung1y4GBX] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_IowaSamsung1y4GBY] = pkg1::MemorySize_4GB,
|
[fuse::DramId_IowaSamsung1z4GB] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_IowaSamsung1y8GBY] = pkg1::MemorySize_8GB,
|
[fuse::DramId_HoagSamsung1z4GB] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_AulaSamsung1y4GB] = pkg1::MemorySize_4GB,
|
[fuse::DramId_AulaSamsung1z4GB] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_HoagSamsung1y8GBX] = pkg1::MemorySize_8GB,
|
[fuse::DramId_HoagSamsung1y8GBX] = pkg1::MemorySize_8GB,
|
||||||
[fuse::DramId_AulaSamsung1y4GBX] = pkg1::MemorySize_4GB,
|
[fuse::DramId_AulaSamsung1y4GBX] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_IowaMicron1y4GB] = pkg1::MemorySize_4GB,
|
[fuse::DramId_IowaMicron1y4GB] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_HoagMicron1y4GB] = pkg1::MemorySize_4GB,
|
[fuse::DramId_HoagMicron1y4GB] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_AulaMicron1y4GB] = pkg1::MemorySize_4GB,
|
[fuse::DramId_AulaMicron1y4GB] = pkg1::MemorySize_4GB,
|
||||||
[fuse::DramId_AulaSamsung1y8GBX] = pkg1::MemorySize_8GB,
|
[fuse::DramId_AulaSamsung1y8GBX] = pkg1::MemorySize_8GB,
|
||||||
|
[fuse::DramId_IowaX1X2Samsung4GB] = pkg1::MemorySize_4GB,
|
||||||
|
[fuse::DramId_HoagX1X2Samsung4GB] = pkg1::MemorySize_4GB,
|
||||||
|
[fuse::DramId_AulaX1X2Samsung4GB] = pkg1::MemorySize_4GB,
|
||||||
|
[fuse::DramId_IowaSamsung4GBY] = pkg1::MemorySize_4GB,
|
||||||
|
[fuse::DramId_HoagSamsung4GBY] = pkg1::MemorySize_4GB,
|
||||||
|
[fuse::DramId_AulaSamsung4GBY] = pkg1::MemorySize_4GB,
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr const pkg1::MemoryMode MemoryModes[] = {
|
constexpr const pkg1::MemoryMode MemoryModes[] = {
|
||||||
|
|||||||
@@ -408,6 +408,7 @@ namespace ams::secmon::smc {
|
|||||||
/* Log our suspension. */
|
/* Log our suspension. */
|
||||||
/* NOTE: Nintendo only does this on dev, but we will always do it. */
|
/* NOTE: Nintendo only does this on dev, but we will always do it. */
|
||||||
if (true /* !pkg1::IsProduction() */) {
|
if (true /* !pkg1::IsProduction() */) {
|
||||||
|
log::Initialize(secmon::GetLogPort(), secmon::GetLogBaudRate(), secmon::GetLogFlags());
|
||||||
log::SendText("OYASUMI\n", 8);
|
log::SendText("OYASUMI\n", 8);
|
||||||
log::Flush();
|
log::Flush();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,17 +20,17 @@ def split_binary(data):
|
|||||||
#print ('%X %X %X %X' % (START, BOOT_CODE_START, BOOT_CODE_END, PROGRAM_START))
|
#print ('%X %X %X %X' % (START, BOOT_CODE_START, BOOT_CODE_END, PROGRAM_START))
|
||||||
boot_code = data[BOOT_CODE_START - START:BOOT_CODE_END - BOOT_CODE_START]
|
boot_code = data[BOOT_CODE_START - START:BOOT_CODE_END - BOOT_CODE_START]
|
||||||
program = data[PROGRAM_START - START:]
|
program = data[PROGRAM_START - START:]
|
||||||
return [('boot_code%s.lz4', lz4_compress(boot_code)), ('program%s.lz4', lz4_compress(program))]
|
return [('boot_code.lz4', lz4_compress(boot_code)), ('program.lz4', lz4_compress(program))]
|
||||||
|
|
||||||
def main(argc, argv):
|
def main(argc, argv):
|
||||||
if argc != 4:
|
if argc != 3:
|
||||||
print('Usage: %s in suffix outdir' % argv[0])
|
print('Usage: %s in outdir' % argv[0])
|
||||||
return 1
|
return 1
|
||||||
with open(argv[1], 'rb') as f:
|
with open(argv[1], 'rb') as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
assert len(data) >= 0x40
|
assert len(data) >= 0x40
|
||||||
for (fn, fdata) in split_binary(data):
|
for (fn, fdata) in split_binary(data):
|
||||||
with open('%s/%s' % (argv[3], fn % argv[2]), 'wb') as f:
|
with open('%s/%s' % (argv[2], fn), 'wb') as f:
|
||||||
f.write(fdata)
|
f.write(fdata)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|||||||
@@ -1,139 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm7tdmi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
BINFILES :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/warmboot.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).elf
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/warmboot.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm7tdmi,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# you need a rule like this for each extension you use as binary data
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o %_bin.h: %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace ams::warmboot {
|
|||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
|
|
||||||
void AbortImpl() {
|
NORETURN void AbortImpl() {
|
||||||
warmboot::ExceptionHandler();
|
warmboot::ExceptionHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
113
exosphere/warmboot/warmboot.mk
Normal file
113
exosphere/warmboot/warmboot.mk
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES :=
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(HFILES_BIN)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /warmboot.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /warmboot.ld) --gc-sections --nmagic
|
||||||
@@ -1,44 +1,41 @@
|
|||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
all: release
|
all: nx_release
|
||||||
|
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): fusee$(strip $2).bin
|
$(strip $1):
|
||||||
|
@echo "Building $(strip $1)"
|
||||||
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/fusee.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
fusee$(strip $2).bin: loader_stub/loader_stub$(strip $2).bin
|
clean-$(strip $1):
|
||||||
@cp loader_stub/loader_stub$(strip $2).bin fusee$(strip $2).bin
|
@echo "Cleaning $(strip $1)"
|
||||||
@echo "Built fusee$(strip $2).bin..."
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/fusee.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
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
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, ))
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug))
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit))
|
|
||||||
|
|
||||||
clean: clean-program clean-loader_stub
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
@rm -rf fusee*.bin package3*
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
|
))
|
||||||
|
|
||||||
clean-program:
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
@$(MAKE) -C program clean
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
|
))
|
||||||
|
|
||||||
clean-loader_stub:
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
@$(MAKE) -C loader_stub clean
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
|
))
|
||||||
|
|
||||||
.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))
|
endef
|
||||||
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm7tdmi,))
|
||||||
|
|
||||||
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ def get_overlay(program, i):
|
|||||||
|
|
||||||
KIP_NAMES = [b'Loader', b'NCM', b'ProcessManager', b'sm', b'boot', b'spl', b'ams_mitm']
|
KIP_NAMES = [b'Loader', b'NCM', b'ProcessManager', b'sm', b'boot', b'spl', b'ams_mitm']
|
||||||
|
|
||||||
def get_kips(ams_dir):
|
def get_kips(ams_dir, build_out_dir):
|
||||||
emummc = read_file(os.path.join(ams_dir, 'emummc/emummc_unpacked.kip'))
|
emummc = read_file(os.path.join(ams_dir, 'emummc/emummc_unpacked.kip'))
|
||||||
loader = read_file(os.path.join(ams_dir, 'stratosphere/loader/loader.kip'))
|
loader = read_file(os.path.join(ams_dir, 'stratosphere/loader/%s/loader.kip' % build_out_dir))
|
||||||
ncm = read_file(os.path.join(ams_dir, 'stratosphere/ncm/ncm.kip'))
|
ncm = read_file(os.path.join(ams_dir, 'stratosphere/ncm/%s/ncm.kip' % build_out_dir))
|
||||||
pm = read_file(os.path.join(ams_dir, 'stratosphere/pm/pm.kip'))
|
pm = read_file(os.path.join(ams_dir, 'stratosphere/pm/%s/pm.kip' % build_out_dir))
|
||||||
sm = read_file(os.path.join(ams_dir, 'stratosphere/sm/sm.kip'))
|
sm = read_file(os.path.join(ams_dir, 'stratosphere/sm/%s/sm.kip' % build_out_dir))
|
||||||
boot = read_file(os.path.join(ams_dir, 'stratosphere/boot/boot.kip'))
|
boot = read_file(os.path.join(ams_dir, 'stratosphere/boot/%s/boot.kip' % build_out_dir))
|
||||||
spl = read_file(os.path.join(ams_dir, 'stratosphere/spl/spl.kip'))
|
spl = read_file(os.path.join(ams_dir, 'stratosphere/spl/%s/spl.kip' % build_out_dir))
|
||||||
ams_mitm = read_file(os.path.join(ams_dir, 'stratosphere/ams_mitm/ams_mitm.kip'))
|
ams_mitm = read_file(os.path.join(ams_dir, 'stratosphere/ams_mitm/%s/ams_mitm.kip' % build_out_dir))
|
||||||
return (emummc, {
|
return (emummc, {
|
||||||
b'Loader' : loader,
|
b'Loader' : loader,
|
||||||
b'NCM' : ncm,
|
b'NCM' : ncm,
|
||||||
@@ -134,39 +134,40 @@ def write_kips(f, all_kips):
|
|||||||
f.write(b'\xCC' * (0x300000 - tot))
|
f.write(b'\xCC' * (0x300000 - tot))
|
||||||
|
|
||||||
def main(argc, argv):
|
def main(argc, argv):
|
||||||
if argc != 12:
|
if argc != 13:
|
||||||
print('Usage: %s ams_dir target revision major minor micro relstep s_major s_minor s_micro s_relstep' % argv[0])
|
print('Usage: %s ams_dir build_out_dir build_boot_out_dir revision major minor micro relstep s_major s_minor s_micro s_relstep' % argv[0])
|
||||||
return 1
|
return 1
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
ams_dir = argv[1]
|
ams_dir = argv[1]
|
||||||
target = '' if argv[2] == 'release' else ('_%s' % argv[2])
|
build_out_dir = argv[2]
|
||||||
revision = int(argv[3][:8], 16)
|
build_boot_out_dir = argv[3]
|
||||||
major = int(argv[4])
|
revision = int(argv[4][:8], 16)
|
||||||
minor = int(argv[5])
|
major = int(argv[5])
|
||||||
micro = int(argv[6])
|
minor = int(argv[6])
|
||||||
relstep = int(argv[7])
|
micro = int(argv[7])
|
||||||
s_major = int(argv[8])
|
relstep = int(argv[8])
|
||||||
s_minor = int(argv[9])
|
s_major = int(argv[9])
|
||||||
s_micro = int(argv[10])
|
s_minor = int(argv[10])
|
||||||
s_relstep = int(argv[11])
|
s_micro = int(argv[11])
|
||||||
|
s_relstep = int(argv[12])
|
||||||
# Read/parse fusee
|
# Read/parse fusee
|
||||||
fusee_program = read_file(os.path.join(ams_dir, 'fusee/program/program%s.bin' % target))
|
fusee_program = read_file(os.path.join(ams_dir, 'fusee/program/%s/program.bin' % build_boot_out_dir))
|
||||||
fusee_bin = read_file(os.path.join(ams_dir, 'fusee/fusee%s.bin' % target))
|
fusee_bin = read_file(os.path.join(ams_dir, 'fusee/%s/fusee.bin' % build_boot_out_dir))
|
||||||
erista_mtc = get_overlay(fusee_program, 1)
|
erista_mtc = get_overlay(fusee_program, 1)
|
||||||
mariko_mtc = get_overlay(fusee_program, 2)
|
mariko_mtc = get_overlay(fusee_program, 2)
|
||||||
erista_hsh = hashlib.sha256(erista_mtc[:-4]).digest()[:4]
|
erista_hsh = hashlib.sha256(erista_mtc[:-4]).digest()[:4]
|
||||||
mariko_hsh = hashlib.sha256(mariko_mtc[:-4]).digest()[:4]
|
mariko_hsh = hashlib.sha256(mariko_mtc[:-4]).digest()[:4]
|
||||||
# Read other files
|
# Read other files
|
||||||
exosphere = read_file(os.path.join(ams_dir, 'exosphere/exosphere%s.bin' % target))
|
exosphere = read_file(os.path.join(ams_dir, 'exosphere/%s/exosphere.bin' % build_out_dir))
|
||||||
warmboot = read_file(os.path.join(ams_dir, 'exosphere/warmboot%s.bin' % target))
|
warmboot = read_file(os.path.join(ams_dir, 'exosphere/warmboot/%s/warmboot.bin' % build_boot_out_dir))
|
||||||
mariko_fatal = read_file(os.path.join(ams_dir, 'exosphere/mariko_fatal%s.bin' % target))
|
mariko_fatal = read_file(os.path.join(ams_dir, 'exosphere/mariko_fatal/%s/mariko_fatal.bin' % build_out_dir))
|
||||||
rebootstub = read_file(os.path.join(ams_dir, 'exosphere/program/rebootstub/rebootstub%s.bin' % target))
|
rebootstub = read_file(os.path.join(ams_dir, 'exosphere/program/rebootstub/%s/rebootstub.bin' % build_boot_out_dir))
|
||||||
mesosphere = read_file(os.path.join(ams_dir, 'mesosphere/mesosphere%s.bin' % target))
|
mesosphere = read_file(os.path.join(ams_dir, 'mesosphere/%s/mesosphere.bin' % build_out_dir))
|
||||||
all_kips = get_kips(ams_dir)
|
all_kips = get_kips(ams_dir, build_out_dir)
|
||||||
tsec_keygen = read_file(os.path.join(ams_dir, 'fusee/program/tsec_keygen/tsec_keygen.bin'))
|
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, 'img/splash.bin'))
|
splash_bin = read_file(os.path.join(ams_dir, 'img/splash.bin'))
|
||||||
assert len(splash_bin) == 0x3C0000
|
assert len(splash_bin) == 0x3C0000
|
||||||
with open(os.path.join(ams_dir, 'fusee/package3%s' % target), 'wb') as f:
|
with open(os.path.join(ams_dir, 'fusee/%s/package3' % build_boot_out_dir), 'wb') as f:
|
||||||
# Write header
|
# Write header
|
||||||
write_header(f, all_kips, len(warmboot), len(tsec_keygen), len(mariko_fatal), len(exosphere), len(mesosphere), len(fusee_bin), len(rebootstub), revision, major, minor, micro, relstep, s_major, s_minor, s_micro, s_relstep)
|
write_header(f, all_kips, len(warmboot), len(tsec_keygen), len(mariko_fatal), len(exosphere), len(mesosphere), len(fusee_bin), len(rebootstub), revision, major, minor, micro, relstep, s_major, s_minor, s_micro, s_relstep)
|
||||||
# Write warmboot
|
# Write warmboot
|
||||||
|
|||||||
48
fusee/fusee.mk
Normal file
48
fusee/fusee.mk
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../libraries/config/common.mk
|
||||||
|
|
||||||
|
all: $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/fusee.bin
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/fusee.bin: $(CURRENT_DIRECTORY)/loader_stub/$(ATMOSPHERE_OUT_DIR)/loader_stub.bin $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
@cp $(CURRENT_DIRECTORY)/loader_stub/$(ATMOSPHERE_OUT_DIR)/loader_stub.bin $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/fusee.bin
|
||||||
|
@echo "Built fusee.bin..."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/loader_stub/$(ATMOSPHERE_OUT_DIR)/loader_stub.bin: check_loader_stub
|
||||||
|
@$(SILENTCMD)echo "Checked loader stub."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/program/$(ATMOSPHERE_OUT_DIR)/program.bin: check_program
|
||||||
|
@$(SILENTCMD)echo "Checked program."
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
check_loader_stub: $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a $(CURRENT_DIRECTORY)/program/$(ATMOSPHERE_OUT_DIR)/program.bin
|
||||||
|
@$(SILENTCMD)echo "Checking loader stub..."
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/loader_stub -f $(CURRENT_DIRECTORY)/loader_stub/loader_stub.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_FUSEE_PROGRAM=1
|
||||||
|
|
||||||
|
check_program: $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(SILENTCMD)echo "Checking program..."
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/program -f $(CURRENT_DIRECTORY)/program/program.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/loader_stub -f $(CURRENT_DIRECTORY)/loader_stub/loader_stub.mk clean
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/program -f $(CURRENT_DIRECTORY)/program/program.mk clean
|
||||||
|
@rm -fr $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
@for i in $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR); do [ -d $$i ] && rmdir --ignore-fail-on-non-empty $$i || true; done
|
||||||
|
|
||||||
|
.PHONY: all clean check_lib check_loader_stub check_program
|
||||||
@@ -1,154 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm7tdmi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
BINFILES :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC) program.lz4.o
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
ATMOSPHERE_BUILD_TARGET_IDENTIFIER=$(strip $1) \
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/loader_stub.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX=$(strip $2) \
|
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).elf
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/loader_stub.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm7tdmi,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
program.lz4.o: program_lz4.h
|
|
||||||
|
|
||||||
program_lz4.h: $(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@rm -rf tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@mkdir -p tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@cp $(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4 tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/program.lz4
|
|
||||||
@bin2s -a 8 -H program_lz4.h tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/program.lz4 | $(AS) -o program.lz4.o
|
|
||||||
@rm -rf tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
$(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4:
|
|
||||||
@$(MAKE) __RECURSIVE__=0 --no-print-directory -C $(TOPDIR)/../program $(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN) program_lz4.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# you need a rule like this for each extension you use as binary data
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o %_bin.h: %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
127
fusee/loader_stub/loader_stub.mk
Normal file
127
fusee/loader_stub/loader_stub.mk
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) $(CURRENT_DIRECTORY)/../program/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES := program.lz4
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a $(CURRENT_DIRECTORY)/../program/$(ATMOSPHERE_OUT_DIR)/program.lz4
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/../program/$(ATMOSPHERE_OUT_DIR)/program.lz4: check_fusee_program
|
||||||
|
@$(SILENTCMD)echo "Checked fusee program."
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_FUSEE_PROGRAM),1)
|
||||||
|
check_fusee_program:
|
||||||
|
else
|
||||||
|
check_fusee_program: check_lib
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/../program -f $(CURRENT_DIRECTORY)/../program/program.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
program.lz4.o: program.lz4
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(OFILES_BIN)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /loader_stub.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /loader_stub.ld) --gc-sections --nmagic
|
||||||
@@ -18,13 +18,15 @@
|
|||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
|
|
||||||
NORETURN void AbortImpl(const char *file, int line, const char *func, const char *expr, u64 value, const char *format, ...) {
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line) {
|
||||||
AMS_UNUSED(file, line, func, expr, value, format);
|
AMS_UNUSED(expr, func, line, file);
|
||||||
|
|
||||||
ams::nxboot::loader::ErrorStop();
|
ams::nxboot::loader::ErrorStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
NORETURN void AbortImpl(const char *file, int line, const char *func, const char *expr, u64 value) {
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line, const char *format, ...) {
|
||||||
AMS_UNUSED(file, line, func, expr, value);
|
AMS_UNUSED(expr, func, line, file, format);
|
||||||
|
|
||||||
ams::nxboot::loader::ErrorStop();
|
ams::nxboot::loader::ErrorStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,144 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm7tdmi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
BINFILES :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
ATMOSPHERE_BUILD_TARGET=$(strip $2) \
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/program.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).lz4 $$(OUTPUT_BASE)$(strip $2).elf
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/program.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm7tdmi,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).lz4 : $(OUTPUT).bin
|
|
||||||
@python $(TOPDIR)/lz4_compress.py $(OUTPUT).bin $(OUTPUT).lz4
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# you need a rule like this for each extension you use as binary data
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o %_bin.h: %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user