Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into npdmfixup
- Loading branch information
Showing
235 changed files
with
6,274 additions
and
9,824 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
name: Bug Report | ||
about: Something doesn't work correctly in Atmosphère. | ||
|
||
--- | ||
|
||
## Bug Report | ||
|
||
### What's the issue you encountered? | ||
|
||
### How can the issue be reproduced? | ||
|
||
### Crash report? | ||
|
||
(If a crash report was created under /atmosphere/crash_reports/, please upload it to | ||
[gist](https://gist.github.com/) and paste the link here.) | ||
|
||
### Environment? | ||
|
||
- What bootloader (fusee, hekate, etc) was Atmosphère launched by: | ||
- Official release or unofficial build: | ||
- Do you have additional kips you're loading: | ||
- Additional info about your environment: | ||
|
||
### Additional context? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
name: Feature Request | ||
about: You want to suggest a new feature for Atmosphère. | ||
|
||
--- | ||
|
||
## Feature Request | ||
|
||
### What feature are you suggesting? | ||
|
||
### Why would this feature be useful? | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
name: Question | ||
about: Please ask questions in the ReSwitched discord, instead of making issues. | ||
|
||
--- | ||
|
||
We would like to use GitHub to keep track of problems/feature requests. | ||
|
||
If you have a question, please join the ReSwitched discord for help. | ||
|
||
- Discord link: https://discordapp.com/invite/DThbZ7z | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "common/include/boost"] | ||
path = common/include/boost | ||
url = https://github.com/Atmosphere-NX/ext-boost.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,55 @@ | ||
TOPTARGETS := all clean | ||
TOPTARGETS := all clean dist | ||
AMSREV := $(shell git rev-parse --short HEAD) | ||
ifneq (, $(strip $(shell git status --porcelain 2>/dev/null))) | ||
AMSREV := $(AMSREV)-dirty | ||
endif | ||
|
||
all: fusee | ||
fusee: | ||
all: fusee stratosphere exosphere thermosphere | ||
|
||
thermosphere: | ||
$(MAKE) -C thermosphere all | ||
|
||
exosphere: thermosphere | ||
$(MAKE) -C exosphere all | ||
|
||
stratosphere: exosphere | ||
$(MAKE) -C stratosphere all | ||
|
||
fusee: exosphere stratosphere | ||
$(MAKE) -C $@ all | ||
|
||
clean: | ||
$(MAKE) -C fusee clean | ||
rm -rf out | ||
|
||
dist: all | ||
$(eval MAJORVER = $(shell grep '\ATMOSPHERE_RELEASE_VERSION_MAJOR\b' common/include/atmosphere/version.h \ | ||
| tr -s [:blank:] \ | ||
| cut -d' ' -f3)) | ||
$(eval MINORVER = $(shell grep '\ATMOSPHERE_RELEASE_VERSION_MINOR\b' common/include/atmosphere/version.h \ | ||
| tr -s [:blank:] \ | ||
| cut -d' ' -f3)) | ||
$(eval MICROVER = $(shell grep '\ATMOSPHERE_RELEASE_VERSION_MICRO\b' common/include/atmosphere/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 -p atmosphere-$(AMSVER)/atmosphere/titles/0100000000000036 | ||
mkdir -p atmosphere-$(AMSVER)/atmosphere/titles/0100000000000032 | ||
cp fusee/fusee-secondary/fusee-secondary.bin atmosphere-$(AMSVER)/fusee-secondary.bin | ||
cp common/defaults/BCT.ini atmosphere-$(AMSVER)/BCT.ini | ||
cp common/defaults/loader.ini atmosphere-$(AMSVER)/atmosphere/loader.ini | ||
cp stratosphere/creport/creport.nsp atmosphere-$(AMSVER)/atmosphere/titles/0100000000000036/exefs.nsp | ||
cp stratosphere/set_mitm/set_mitm.nsp atmosphere-$(AMSVER)/atmosphere/titles/0100000000000032/exefs.nsp | ||
touch atmosphere-$(AMSVER)/atmosphere/titles/0100000000000032/boot2.flag | ||
cd atmosphere-$(AMSVER); zip -r ../atmosphere-$(AMSVER).zip ./*; cd ../; | ||
rm -r atmosphere-$(AMSVER) | ||
mkdir out | ||
mv atmosphere-$(AMSVER).zip out/atmosphere-$(AMSVER).zip | ||
cp fusee/fusee-primary/fusee-primary.bin out/fusee-primary.bin | ||
|
||
|
||
.PHONY: $(TOPTARGETS) fusee |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
BCT0 | ||
[stage1] | ||
stage2_path = fusee-secondary.bin | ||
stage2_addr = 0xF0000000 | ||
stage2_entrypoint = 0xF0000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[config] | ||
hbl_tid=010000000000100D | ||
hbl_path=atmosphere/hbl.nsp | ||
override_key=!R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Building Atmosphère | ||
The process for building Atmosphère is similar to building Fusée Gelée payloads and other Switch apps. | ||
|
||
In order to build Atmosphère you must have devkitARM and devkitA64 installed on your computer. You can find instructions on how to install and setup devkitARM and devkitA64 on various OSes [here](https://devkitpro.org/wiki/Getting_Started). | ||
|
||
Once you have finished installing devkitARM and devkitA64, simply clone the Atmosphère repo, change to it and run `make`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Changelog | ||
## 0.7.3 | ||
+ Loader and fs.mitm now try to reload loader.ini before reading it. This allows for changing the override button combination/HBL title id at runtime. | ||
+ Added a MitM between set:sys and qlaunch, used to override the system version string displayed in system settings. | ||
+ The displayed system version will now display `<Actual version> (AMS <x>.<y>.<z>)`. | ||
+ General system stability improvements to enhance the user's experience. | ||
## 0.7.2 | ||
+ Fixed a bug in fs.mitm's LayeredFS read implementation that caused some games to crash when trying to read files. | ||
+ Fixed a bug affecting 1.0.0 that caused games to crash with fatal error 2001-0106 on boot. | ||
+ Improved filenames output by the make dist target. | ||
+ General system stability improvements to enhance the user's experience. | ||
|
||
## 0.7.1 | ||
+ Fixed a bug preventing consoles on 4.0.0-4.1.0 from going to sleep and waking back up. | ||
+ Fixed a bug preventing consoles on < 4.0.0 from booting without specific KIPs on the SD card. | ||
+ An API was added to Atmosphère's Service Manager for deferring acquisition of all handles for specific services until after early initialization is completed. | ||
+ General system stability improvements to enhance the user's experience. | ||
|
||
## 0.7.0 | ||
+ First official release of Atmosphère. | ||
+ Supports the following featureset: | ||
+ Fusée, a custom bootloader. | ||
+ Supports loading/customizing of arbitrary KIPs from the SD card. | ||
+ Supports loading a custom kernel from the SD card ("/atmosphere/kernel.bin"). | ||
+ Supports compile-time defined kernel patches on a per-firmware basis. | ||
+ All patches at paths like /atmosphere/kip_patches/<user-defined patch name>/<SHA256 of KIP>.ips will be applied to the relevant KIPs, allowing for easy distribution of patches supporting multiple versions. | ||
+ Both the IPS and IPS32 formats are supported. | ||
+ All patches at paths like /atmosphere/kernel_patches/<user-defined patch name>/<SHA256 of Kernel>.ips will be applied to the kernel, allowing for easy distribution of patches supporting multiple versions. | ||
+ Both the IPS and IPS32 formats are supported. | ||
+ Configurable by editing BCT.ini on the SD card. | ||
+ Atmosphère should also be launchable by the alternative hekate bootloader, for those who prefer it. | ||
+ Exosphère, a fully-featured custom secure monitor. | ||
+ Exosphere is a re-implementation of Nintendo's TrustZone firmware, fully replicating all of its features. | ||
+ In addition, it has been extended to provide information on current Atmosphere API version, for homebrew wishing to make use of it. | ||
+ Stratosphère, a set of custom system modules. This includes: | ||
+ A loader system module. | ||
+ Reimplementation of Nintendo's loader, fully replicating all original functionality. | ||
+ Configurable by editing /atmosphere/loader.ini | ||
+ First class support for the Homebrew Loader. | ||
+ An exefs NSP (default "/atmosphere/hbl.nsp") will be used in place of the victim title's exefs. | ||
+ By default, HBL will replace the album applet, but any application should also be supported. | ||
+ Extended to support arbitrary redirection of executable content to the SD card. | ||
+ Files will be preferentially loaded from /atmosphere/titles/<titleid>/exefs/, if present. | ||
+ Files present in the original exefs a user wants to mark as not present may be "stubbed" by creating a .stub file on the SD. | ||
+ If present, a PFS0 at /atmosphere/titles/<titleid>/exefs.nsp will fully replace the original exefs. | ||
+ Redirection is optionally toggleable by holding down certain buttons (by default, holding R disables redirection). | ||
+ Full support for patching NSO content is implemented. | ||
+ All patches at paths like /atmosphere/exefs_patches/<user-defined patch name>/<Hex Build-ID for NSO to patch>.ips will be applied, allowing for easy distribution of patches supporting multiple firmware versions and/or titles. | ||
+ Both the IPS and IPS32 formats are supported. | ||
+ Extended to support launching content from loose executable files on the SD card, without requiring any official installation. | ||
+ This is done by specifying FsStorageId_None on launch. | ||
+ A service manager system module. | ||
+ Reimplementation of Nintendo's service manager, fully replicating all original functionality. | ||
+ Compile-time support for reintroduction of "smhax", allowing clients to optionally skip service access verification by skipping initialization. | ||
+ Extended to allow homebrew to acquire more handles to privileged services than Nintendo natively allows. | ||
+ Extended to add a new API for installing Man-In-The-Middle listeners for arbitrary services. | ||
+ API can additionally be used to safely detect whether a service has been registered in a non-blocking way with no side-effects. | ||
+ Full API documentation to come. | ||
+ A process manager system module. | ||
+ Reimplementation of Nintendo's process manager, fully replicating all original functionality. | ||
+ Extended to allow homebrew to acquire handles to arbitrary processes, and thus read/modify system memory without blocking execution. | ||
+ Extended to allow homebrew to retrieve information about system resource limits. | ||
+ Extended by embedding a full, extended implementation of Nintendo's boot2 system module. | ||
+ Title launch order has been optimized in order to grant access to the SD card faster. | ||
+ The error-collection system module is intentionally not launched, preventing many system telemetry error reports from being generated at all. | ||
+ Users may place their own custom sysmodules on the SD card and flag them for automatic boot2 launch by creating a /atmosphere/titles/<title ID>/boot2.flag file on their SD card. | ||
+ A custom fs.mitm system module. | ||
+ Uses Atmosphère's MitM API in order to provide an easy means for users to modify game content. | ||
+ Intercepts all FS commands sent by games, with special handling for commands used to mount RomFS/DLC content to enable easy creation and distribution of game/DLC mods. | ||
+ fs.mitm will parse the base RomFS image for a game, a RomFS image located at /atmosphere/titles/<title ID>/romfs.bin, and all loose files in /atmosphere/titles/<title ID>/romfs/, and merge them together into a single RomFS image. | ||
+ When merging, loose files are preferred to content in the SD card romfs.bin image, and files from the SD card image are preferred to those in the base image. | ||
+ Can additionally be used to intercept commands sent by arbitrary system titles (excepting those launched before SD card is active), by creating a /atmosphere/titles/<title ID>/fsmitm.flag file on the SD card. | ||
+ Can be forcibly disabled for any title, by creating a /atmosphere/titles/<title ID>/fsmitm_disable.flag file on the SD card. | ||
+ Redirection is optionally toggleable by holding down certain buttons (by default, holding R disables redirection). | ||
+ A custom crash report system module. | ||
+ Serves as a drop-in replacement for Nintendo's own creport system module. | ||
+ Generates detailed, human-readable reports on system crashes, saving to /atmosphere/crash_reports/<timestamp>_<title ID>.log. | ||
+ Because reports are not sent to the erpt sysmodule, this disables all crash report related telemetry. | ||
+ General system stability improvements to enhance the user's experience. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Exosphère | ||
Exosphère is a reimplementation of Arm's TrustZone (TZ), also known as Secure Monitor (Secure_Monitor.bin). It has the highest privilege mode available on the Switch’s processor, and has access to everything on the console. | ||
|
||
Exosphère will potentially play a big role in Jamais Vu and Déja Vu, which are upcoming software exploits for the Switch, allowing one to launch Atmosphère on a Fusée-Gélee patched (ipatched) Switch console, and will also enable one to launch into CFW directly from the Switch itself without the use of any sort of external device, such as a computer or RCM jig, provided they are on a low enough system firmware. | ||
|
||
## TrustZone/Secure Monitor | ||
TrustZone is responsible for all the cryptographic operations on the Switch. The idea behind the way it operates is that all the keys stay in the TrustZone, and userspace only gets "handles" to them. This would make sure that keydata never leaks and is kept secure. It also has a few more responsibilities, such as power management, providing a source of random numbers, and providing access to various pieces of information that are stored in the fuses. | ||
|
||
## Extensions | ||
Exosphère currently only contains one extension, an SMC allowing homebrew to find which version of Atmosphère is currently running, in order to find out what extensions are allowed to be used. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# BCT.ini | ||
BCT.ini is the configuration file used by fusée-primary and fusée-secondary. It is read by fusee-primary.bin to setup and boot fusee-secondary.bin and is also read by fusee-secondary.bin to configure Exosphère or to specify the environment it should boot. | ||
|
||
## Configuration | ||
This file is located at the root of your SD. | ||
``` | ||
BCT0 | ||
[stage1] | ||
stage2_path = fusee-secondary.bin | ||
stage2_addr = 0xF0000000 | ||
stage2_entrypoint = 0xF0000000 | ||
``` | ||
Add the following lines and replace the `X` according to the following list if you have trouble booting past the firmware version detection. | ||
`target_firmware` is the OFW major version. | ||
``` | ||
[exosphere] | ||
target_firmware = X | ||
``` | ||
``` | ||
1.0.0 = 1 | ||
2.X.X = 2 | ||
3.X.X = 3 | ||
4.X.X = 4 | ||
5.X.X = 5 | ||
6.0.0 = 6 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Fusée | ||
Fusée (not to be confused with Fusée Gelée) is a custom bootloader needed to start Atmosphère and replaces Nintendo's Package1loader/bootloader. It currently utilizes the [Tegra X1 RCM Vulnerability](https://nvidia.custhelp.com/app/answers/detail/a_id/4660/~/security-notice%3A-nvidia-tegra-rcm-vulnerability) in order to function. | ||
|
||
Fusée is split into two separate parts: fusée-primary and fusée-secondary. This is due to the RCM Vulnerability only allowing payloads of a limited filesize to be sent to the device. | ||
|
||
As of June 2018, there are new Switch systems being sold that prevent Fusée (or any payload that requires the Fusée Gelée exploit) from working due to having an ipatched bootrom. All ipatched systems share the HAC-S-JXE-C3 product code. While Fusée cannot work on these ipatched units, they still come on firmware 4.1.0, which is vulnerable to the upcoming Déja Vu software exploit. Note that if you update past 4.1.0 on one of these ipatched units, your odds of being able to install Atmosphère or run any homebrew become practically non-existent. | ||
|
||
Additionally, a hardware revision of the Switch known as “Mariko” is believed to be in development. No such units have been seen in stores yet, but it is expected Nintendo will roll them out silently. The Mariko units will most likely patch the bootrom vulnerability Fusée Gelée, which is currently used to access CFW, and will likely have their own proprietary bootloader. | ||
|
||
## Fusée-Primary | ||
Fusée-primary is the payload file (fusee-primary.bin) sent to the Switch from an external device. Once sent, fusée-primary makes initial preparations before loading fusée-secondary from the Switch’s SD Card. | ||
|
||
Fusée-primary can be configured via the [BCT.ini](../fusee/BCT.md) file located on the Switch’s SD card. | ||
|
||
## Fusée-Secondary | ||
Fusée-secondary is a payload file that stays on the root of the Switch’s SD Card (fusee-secondary.bin). It is automatically launched once fusée-primary has finished, and is responsible for preparing the Switch’s hardware for future running environments, such as the homebrew menu. Fusée-secondary is also responsible for validating and launching Exosphère. | ||
|
||
Fusée-secondary contains various [.kip modules](/docs/main.md#modules). These modules modify existing features in the OS, and can also add new ones. | ||
|
||
Fusée is also capable of chainloading other payloads such as Linux. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Stratosphère | ||
Stratosphère allows customization of the Horizon OS and Switch kernel. It includes custom sysmodules that extend the kernel and provide new features. It also includes a reimplementation of the loader sysmodules to hook important system actions. | ||
|
||
The sysmodules that Stratosphère includes are: | ||
+ [boot](../modules/boot.md): This module boots the system and initalizes hardware. | ||
+ [creport](../modules/creport.md): Reimplementation of Nintendo’s crash report system. Dumps all error logs to the SD card instead of saving them to the NAND and sending them to Nintendo. | ||
+ [fs_mitm](../modules/fs_mitm.md): This module can log, deny, delay, replace, and redirect any request made to the File System. | ||
+ [loader](../modules/loader.md): Enables modifying the code of binaries that are not stored inside the kernel. | ||
+ [pm](../modules/pm.md): Reimplementation of Nintendo’s Process Manager. | ||
+ [sm](../modules/sm.md): Reimplementation of Nintendo’s Service Manager. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Thermosphère | ||
Thermosphère is a hypervisor based implementation of emuNAND. An emuNAND is a copy of the firmware on the Switch’s internal memory (sysNAND), and is typically installed on an external SD Card. | ||
|
||
An emuNAND operates completely independently of the sysNAND. This allows one to make or test various modifications and homebrew safely without needing to restore their NAND backup afterwards by testing things on the emuNAND, and switching back to the sysNAND when finished. In the case of past Nintendo systems such as the 3DS, an emuNAND could also be used to update your system to the latest firmware while keeping your sysNAND on a lower version, however this may be more difficult to do on the Switch due to Nintendo using efuse technology for major system updates. | ||
|
||
Thermosphère is currently planned to be included in the 1.0 release of Atmosphère. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Troposphère | ||
Troposphère contains various application-level modifications to the OS, such as launching homebrew directly from the homemenu or executing cheat/gameshark codes, similar to Luma3DS. Troposphère is not yet implemented in Atmosphère. |
Oops, something went wrong.