Building Atmosphère on Windows using MSYS2

Sometimes you need to build the binaries for Atmosphère, or you want to change something on the source code, for building your starting point should be: https://github.com/Atmosphere-NX/Atmosphere/blob/master/docs/building.md
On that document you can read:
Building Atmosphère is a very straightforward process that relies almost exclusively on tools provided by the devkitPro organization.​
Dependencies:
  • devkitA64
  • devkitARM
  • Python 2 (Python 3 may work as well, but this is not guaranteed)
  • LZ4
  • PyCryptodome (optional)
  • Hactool
Setup a DevKitPro environment: (https://devkitpro.org/wiki/Getting_Started)
Install the following packages via (dkp-)pacman:​
  • switch-dev
  • switch-glm
  • switch-libjpeg-turbo
  • devkitARM
  • devkitarm-rules
  • hactool
Install the following library via python's package manager pip, required by exosphere:​
  • lz4
Finally, clone the Atmosphère repository and run make under its root directory.​

That instructions are a little plain for we the noobs.

First you need Install a MSYS environment:
The latest instructions for install the MSYS environment are on https://gbatemp.net/threads/install-msys-environment.652234/ if you don't have one working, use them.

After you have the MSYS environment working you need to install DevKitPro
For that you can follow the instructions on the tutorial https://gbatemp.net/threads/setup-a-devkitpro-environment-on-windows.652238/

Now you can install DevKitPro packages:

You Need base DevKitPro packages:
Bash:
pacman -S --noconfirm switch-dev devkitA64 dkp-toolchain-vars libnx switch-tools switch-mesa switch-libdrm_nouveau switch-sdl2

And the Atmosphère prerequisites
Bash:
Pacman -Sy --noconfirm devkitA64 devkitARM devkitarm-rules hactool mingw-w64-x86_64-python mingw-w64-x86_64-python-lz4 mingw-w64-x86_64-python-pycryptodome switch-dev switch-glm switch-libjpeg-turbo mingw-w64-x86_64-python-pip

I had to add zip package because even if wasn't explicit indicated on the build page, the code needs it.

You also will need the packages git make lz4 for all to work, use the command:

Bash:
Pacman -Sy --noconfirm zip git make lz4


All packages on a combined command:​

Bash:
pacman -S --noconfirm switch-dev devkitA64 dkp-toolchain-vars libnx switch-tools switch-mesa switch-libdrm_nouveau switch-sdl2 devkitA64 devkitARM devkitarm-rules hactool mingw-w64-x86_64-python mingw-w64-x86_64-python-lz4 mingw-w64-x86_64-python-pycryptodome switch-dev switch-glm switch-libjpeg-turbo mingw-w64-x86_64-python-pip zip git make lz4


The package hactool need you to copy your own prod.keys file on $HOME/.switch folder. (c:\msys64\home\USERNAME\.switch if you use the default installation folder)


LibNX Dependency
Atmosphère depends heavily on LibNX, generally when a major version of firmware is released or great changes on the code are made, changes to LibNX are also made.
The Atmosphère team works on their own repo of LibNX (https://github.com/Atmosphere-NX/libnx) and forward Pull Request to official SwitchBrew LibNX repo (https://github.com/switchbrew/libnx).


So ONLY if there are changes on LibNX repository, no yet committed to DevKitPro release, you need to build it and install on your setup.
If you haven't done already, setup the environment variables
You can test it running the command
export
You should have this:
Bash:
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=${DEVKITPRO}/devkitARM
export DEVKITPPC=${DEVKITPRO}/devkitPPC
export PATH=${DEVKITPRO}/tools/bin:$PATH


Then go to the Atmosphere-NX/LibNX repo and look what is the new branch for the current firmware, by example, for Firmware 16.0.0 the branch name is "1600_Support"

1677718224337.png

Then go to your MSYS MinGW64 window and clone the Atmosphere-NX/LibNX repo

Bash:
cd ~
git clone --recursive https://github.com/Atmosphere-NX/libnx.git
cd libnx

And checkout the needed branch:

Bash:
git checkout 1600_support

Then build and install the new LibNX libraries

Bash:
make install -j$(nproc)

Now you can build Atmosphère with latest LibNX code; remember if you update the pacman LibNX package the changes get reversed and you need to build LibNX again.

Now is time to build the binaries
Clone the repository:
Bash:
cd ~
git clone --recursive https://github.com/Atmosphere-NX/Atmosphere

Go to new created Atmosphère folder
Bash:
cd Atmosphere

Be sure you have defined the environment variables for DevKitPro
You can test it running the command
export
You should have this:
Bash:
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=${DEVKITPRO}/devkitARM
export DEVKITPPC=${DEVKITPRO}/devkitPPC
export PATH=${DEVKITPRO}/tools/bin:$PATH


COPY YOUR PROD.KEYS FILE TO THE .SWITCH FOLDER:

Copy prod.keys file on $HOME/.switch
Bash:
mkdir ~/.switch
cp "c:\YOUR\CURRENT\PATH\TO\KEYS\PROD.KEYS" ~/.switch/prod.keys

In the case of MSYS for using localhost paths you must use "" by example in my case I use the commands:
Bash:
mkdir ~/.switch
cp "z:\Emulation\NSwitch\keys\switch\prod.keys" ~/.switch/prod.keys

Obviously you also can copy the file manually on windows to the equivalent path to ~/.switch/ which by default is c:\msys\home\USERNAME\.switch Where c:\msys is the installation folder and USERNAME is the current name for the user.


Atmosphère is a Python 2 project, even when python 2 has been deprecated by almost 5 years now. some * insist on never update it so as far as that is going, you need to change some files in order to work on python 3, on the files:
  • Atmosphere\fusee\program\update_mtc_tables.py
  • Atmosphere\fusee\program\update_sdram_params.py
The function XRANGE must to be changed to RANGE, edit the files and change xrange( to range( save the files and continue.

And now you are ready to start the building process:
Bash:
make -j$(nproc)

I do use the "-j$(nproc)" parameter to "bleed" all the available CPU to run the compiler, without that the whole process could take up to 1 hour.

Also Note:, if you use make -j is possible a Error 2 can be generated, run make again without parameters. The process will continue where failed, since the two latest versions of DevKitPro using the -j parameters is not synced and the make process can fail by timeouts.


I want to thank a lot to @binkinator and @godreborn for all the help and inspiration to make this guide, and want to ask you for help improving this guide.

Also special thanks to @godreborn for been a support of the users replies and suggestions to the OP.

Remember, as you are getting a new set of binaries, you need new set of sigpatches if you use it. So the great tool from @mrdude comes in hand, the latest release can be downloaded from: https://github.com/mrdude2478/IPS_Patch_Creator/releases/; you use the program to generate a new set of patches for your recently build package3 file.


Latest IPS Patch Creator:
https://gbatemp.net/download/ips-patch-creator-1-5-9.38850/




-Edited: add sigpatches step and clean up a little-
-Edit 2, add LibNX build-
 

Attachments

  • 1695782853186.png
    1695782853186.png
    62.7 KB · Views: 217
  • 1695782902542.png
    1695782902542.png
    6.4 KB · Views: 206
  • Sigpatch-IPS-Creator_1.5.7_Yandex.png
    Sigpatch-IPS-Creator_1.5.7_Yandex.png
    3.3 KB · Views: 136
Last edited by impeeza,
Well crap. I also overlooked what git page I was looking at. :lol: But now I'm more confused. I don't know why my image is not displaying at all then. Perhaps there are similar restrictions for Atmosphere logo replacement. I have no idea. All I know is that my bootlogo.bmp image never shows despite having hekate_ipl.ini pointing to it and bootwait set to 5.
Mate, please tell us again in very detailed way what are you trying to achieve. so we will try to lead you.
 
Mate, please tell us again in very detailed way what are you trying to achieve. so we will try to lead you.

Many details not needed. :) Simply tying to change the image that can be changed via logopath=bootloader/bootlogo.bmp in hekate_apl.ini

Appears from josete2k's reply that my image must follow similar requirements that the Hekate boot logo has. I assume it will work after I create a proper image that follows them.

The supported format is 32-bit (ARGB) BMP. Classic 24-bit (RGB) BMPs are not supported

Thanks for the clarification. I was thinking that it probably has the same or similar requirements as Hekate boot screen.

Edit: It still didn't work but I figured it out. In addition to needing 32-bit ARGB format, it also needed to be rotated 90 degrees counter-clockwise like the Hekate boot logo does. It is now working. :)
 
Last edited by Earthshine,
Hello there, on the console boot there are some images displayed:

  • Bootloader Logo, Some bootloaders can show loading pictures, by example Argon and Argon NX can show a file called bootlogo.bmp, Hekate can show a file set up on Hekate_ipl.ini file.
  • Sept Logo, is displayed when fusee initialize the graphical screen, is hardcoded on the Package3 binary. only can be changed by building a new atmosphère from source code, by changing the file \stratosphere\boot\source\boot_splash_screen_notext.inc . Also is displayed when using PKG3 method.
    View attachment 523009
  • Splash, is displayed by atmosphère when Package3 is full loaded, this image can be changed on a existing package3 file using the script /utilities/insert_splash_screen.py of the source code or building a new package3 from code by changing the file /img/splash.bin. This image is not shown when using Hekate PKG3 loading method.
    View attachment 523010
  • Boot Logo, is displayed by original firmware once the screen is full initialized. Can be changed by IPS patches, you can generate that set of patches using the instructions on thread https://gbatemp.net/threads/custom-boot-logo-for-switch.569031/ also there is a big collection of premade patches on the post https://gbatemp.net/threads/custom-boot-logo-for-switch.569031/post-10662039
    View attachment 523011

A sample of each logo is shown on https://gbatemp.net/threads/custom-boot-logo-for-switch.569031/post-10439867

More information on the threads:

https://gbatemp.net/threads/remove-atmosphere-splash-screen.629387/post-10626979

https://gbatemp.net/threads/remove-atmosphere-splash-screen.629387/post-10113987

https://gbatemp.net/threads/custom-boot-logo-for-switch.569031/post-10711678

https://gbatemp.net/threads/custom-boot-logo-for-switch.569031/
This logo is possible to add with more colors or only white?
IMG_2914.jpeg
 
This logo is possible to add with more colors or only white?
View attachment 523187
can be full color just try to keep it small because a full color full screen one can create a big packag3 file which can not be loaded by fusee.bin (but hekate can load it)
 
  • Like
Reactions: GoodmanBCN
Hey ! Where should I pull request ? I got lost here. Thank you !
you do not need to build LibNX if there is no new code on the repo, that happen only when a new Atmosphère is releases, most of the time you only need to install LibNX package and it will be updated.
 
Hi there
I am new here, newer tried myself a MSYS2
I am kinda stuck with a error here, can someone help me?

Got this error:

eldar@BoocemeisterPC MINGW64 ~/Atmosphere
$ make
Building nx_release
make[1]: Entering directory '/home/eldar/Atmosphere'
make -C /home/eldar/Atmosphere/emummc all
make[2]: Entering directory '/home/eldar/Atmosphere/emummc'
linking emummc.elf
C:/msys64/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/15.1.0/../../../../aarch64-none-elf/bin/ld.exe: cannot find -lnx: No such file or directory
collect2.exe: error: ld returned 1 exit status
make[3]: *** [/opt/devkitpro/libnx/switch_rules:81: /home/eldar/Atmosphere/emummc/emummc.elf] Error 1
make[2]: *** [Makefile:90: build] Error 2
make[2]: Leaving directory '/home/eldar/Atmosphere/emummc'
make[1]: *** [/home/eldar/Atmosphere/atmosphere.mk:124: emummc] Error 2
make[1]: Leaving directory '/home/eldar/Atmosphere'
make: *** [Makefile:39: nx_release] Error 2
 
Dumb question, sig patches are obsolete now (?) since everyone including myself is using sys-patch, do I still have to generate anything for my own build? Does the building process also generate a new fusee for my uses, or can I keep using the latest one out of the atmosphere github?

Also, it might be useful to know what files the makefile produces, and where to find the various outputs :unsure: . Does it build the hbl, or the hbmenu as well, for example? Pretty new to building stuff for the switch, at least I got the build to go off without a hitch :toot:
 
Dumb question, sig patches are obsolete now (?) since everyone including myself is using sys-patch,
No, they are the same way to apply the pathces. you can use one or the other or both

do I still have to generate anything for my own build?
depends of your setup, but if you build atmosphère from code, is good idea to generate the sigpatches for that build.

Does the building process also generate a new fusee for my uses, or can I keep using the latest one out of the atmosphere github
if you build atmosphère from code a new fuse.bin will be created.


Also, it might be useful to know what files the makefile produces, and where to find the various outputs :unsure: .
all the outputs are on the screen, the problem raise if you use -j , because all messages from different threads will be scrambled between them.

The binary files output will be on the /out/ folder


Does it build the hbl, or the hbmenu as well, for example? Pretty new to building stuff for the switch, at least I got the build to go off without a hitch :toot:

NO, HBL and HBMenu are different products, the official release include them as a bundle but SciresM put them manually on the zip file.

you can download latest from the github, and even you can build the most recent code.
 
Last edited by impeeza,
Hi friends,
I found lately a package3 for the 21.1.0 firmware which appears to have been modified by kefir to support tinfoil 20 in FW 21.1.0.
I tried desperatly to modify or extract the splash with no success, with the methods i found on internet (insert_splash_screen.py + extract_splash_screen.py). I believe he inserted an additional code for his own boot but as my coding knowledge is 0 i was wondering if someone would like to try ?
I add here his package3 for 21.1.0 supporting Tinfoil.
 
Last edited by Mirivedan,

Site & Scene News

Popular threads in this forum