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:
Bash:
pacman -S --noconfirm switch-dev devkitA64 dkp-toolchain-vars libnx switch-tools switch-mesa switch-libdrm_nouveau switch-sdl2

And 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

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

Additional you need the packages git make lz4 for all to work, use the command:

Bash:
Pacman -Sy --noconfirm 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 if there are changes on LibNX you need to build it and install on your setup.
If you haven't done already, setup the environment variables

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

Never forget to create the environment variables for DevKitPro
Bash:
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=/opt/devkitpro/devkitARM
export DEVKITPPC=/opt/devkitpro/devkitPPC

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.

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:
Sigpatch-IPS-Creator_1.5.7_Yandex.png





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

Attachments

  • 1695782853186.png
    1695782853186.png
    62.7 KB · Views: 59
  • 1695782902542.png
    1695782902542.png
    6.4 KB · Views: 60
Last edited by impeeza,

impeeza

¡Kabito!
OP
Member
Joined
Apr 5, 2011
Messages
6,435
Trophies
3
Age
46
Location
At my chair.
XP
19,134
Country
Colombia
For me MSYS2 was conflicting with my WSL setup and when I used another machine it just worked. Whereas on my original machine I opted for WSL instead of finding the conflicts or reinstalling stuff.


Maybe if you use WSL you had similar issues like mine was using python3 I think and I think I got that stratosphere error you posted. Anyway sorry if this is unhelpful and glad its all working now :D
Normally MSYS is an self contained platform and isolated of the rest of the Operating System.

The only one interaction between MSYS and OS is the Path environment variable, you can setup it, to be imported from OS to MSYS, so if the paths on your PATH variable of MSYS have been setting up wrong some OS executable could have precedence over the MSYS ones.

the commands where and export are your friend to help you to identify a conflict
 
  • Like
Reactions: leathan7 and Muxi

Muxi

Well-Known Member
Member
Joined
Jun 1, 2016
Messages
606
Trophies
0
Age
52
XP
2,142
Country
Germany
It is said that Python 2 is recommended for compiling Atmosphére. I have installed Python 3.12 and have no problems with it. The py script to personalize the package3 with a custom bootscreen also works perfectly.
 
  • Love
Reactions: impeeza

leathan7

Member
Newcomer
Joined
Oct 12, 2021
Messages
20
Trophies
0
Age
35
XP
97
Country
United States
Normally MSYS is an self contained platform and isolated of the rest of the Operating System.

The only one interaction between MSYS and OS is the Path environment variable, you can setup it, to be imported from OS to MSYS, so if the paths on your PATH variable of MSYS have been setting up wrong some OS executable could have precedence over the MSYS ones.

the commands where and export are your friend to help you to identify a conflict
Yup it was the path pointing to an incorrect python in my case. Thanks.
 
  • Love
Reactions: impeeza

s1m0n

New Member
Newbie
Joined
Oct 7, 2023
Messages
3
Trophies
0
Age
37
XP
31
Country
Germany
I just want to leave a quick thank you here...
Hello again and thank you very much again for the great instructions. I had to update the Switch for my brother-in-law and everything worked the first time
Thanks to these instructions🤍
 

GBAn00b1e

Member
Newcomer
Joined
Aug 12, 2023
Messages
6
Trophies
0
XP
127
Country
United States
Just finished to built Atmosphère on a Ubunto 22_10 virtual machine, it goes smooth.

The steps followed was:
Bash:
sudo dkp-pacman -Sy --noconfirm --needed zip git make lz4 libnx devkitA64 devkitARM devkitarm-rules hactool switch-dev dkp-toolchain-vars switch-tools switch-mesa switch-libdrm_nouveau switch-sdl2 switch-libjpeg-turbo switch-glm
sudo dkp-pacman -Syuu --noconfirm
sudo apt install python3
sudo apt install python3-pip
sudo pip install lz4 pycryptodome
sudo apt install python-is-python3
alias python='python3'

export DEVKITPRO=/opt/devkitpro
export DEVKITARM=${DEVKITPRO}/devkitARM
export DEVKITPPC=${DEVKITPRO}/devkitPPC
export PATH=${DEVKITPRO}/tools/bin:$PATH

Important!! you need to copy prod.keys file on $HOME/.switch/

  • Clone the repo
git clone --recursive https://github.com/Atmosphere-NX/Atmosphere
  • and then, run make
Bash:
cd Atmosphere
make

so the today's Atmosphère repo build well on Linux (At least Ubuntu 20)
Thank you!! This is the only way I was able to compile AMS. Tried using POP OS, but it didn't work so I swapped over to Ubuntu and it worked great. Thanks again...
 
  • Love
Reactions: impeeza

impeeza

¡Kabito!
OP
Member
Joined
Apr 5, 2011
Messages
6,435
Trophies
3
Age
46
Location
At my chair.
XP
19,134
Country
Colombia
Hi. I would try to build on ubuntu.

Where do I have to place the prod.keys file?

Thanks.
On any linux you must to put on ~/.switch/prod.keys or $HOME/.switch/prod.keys (shoud be the same)

On UBUNTU I did use this packages:

Bash:
sudo apt install lz4 zip git make gcc python3 python-is-python3 python3-pip
sudo pip install pycryptodome lz4
sudo dkp-Pacman -Syuu --noconfirm --needed libnx devkitA64 devkitARM devkitarm-rules hactool switch-dev dkp-toolchain-vars switch-tools switch-mesa switch-libdrm_nouveau switch-sdl2 switch-libjpeg-turbo switch-glm
Post automatically merged:

And do not forget you need the most recent version of LIBNX installed on your system in order to build the latest commit (35d93a7) of Atmosphère, you can get it in one of this ways:

1) The 1800_basic branch of https://github.com/Atmosphere-NX/libnx
Bash:
cd ~
rm -rf ~/libnx
git clone --recursive https://github.com/Atmosphere-NX/libnx.git
cd ~/libnx
git checkout 1800_basic
make all -j$(nproc)
make install -j$(nproc)

Or

2) The pull request #641 of https://github.com/switchbrew/libnx
Code:
cd ~
rm -rf ~/libnx
git clone --recursive https://github.com/switchbrew/libnx.git
cd ~/libnx
git fetch origin pull/641/head
git checkout -b pullrequest FETCH_HEAD
make all -j$(nproc)
make install -j$(nproc)
 
Last edited by impeeza,
  • Like
Reactions: josete2k

ItzMeGab

Member
Newcomer
Joined
Dec 5, 2023
Messages
12
Trophies
0
Age
25
XP
91
Country
Philippines
Is there an alternative tool that can be use in linux to make a patch?

Edit: Do you guys know how to convert png/bmp into bin files? I want to chamge splash.bin under img directories, I want to boot into fusee so the atmosphere logo will show, the insert splash script works well, but I have to do that everytime I compile a new build
 
Last edited by ItzMeGab,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Veho @ Veho:
    It's not a Nintendo / iQue official product, it's a 3rd party custom.
    +1
  • Veho @ Veho:
    Nothing special about it other than it's more comfortable than the Lite
    for people with beefy hands.
    +1
  • Jayro @ Jayro:
    I have yaoi anime hands, very lorge but slender.
  • Jayro @ Jayro:
    I'm Slenderman.
  • Veho @ Veho:
    I have hands.
  • BakerMan @ BakerMan:
    imagine not having hands, cringe
    +1
  • AncientBoi @ AncientBoi:
    ESPECIALLY for things I do to myself :sad:.. :tpi::rofl2: Or others :shy::blush::evil:
    +1
  • The Real Jdbye @ The Real Jdbye:
    @SylverReZ if you could find a v5 DS ML you would have the best of both worlds since the v5 units had the same backlight brightness levels as the DS Lite unlockable with flashme
  • The Real Jdbye @ The Real Jdbye:
    but that's a long shot
  • The Real Jdbye @ The Real Jdbye:
    i think only the red mario kart edition phat was v5
  • BigOnYa @ BigOnYa:
    A woman with no arms and no legs was sitting on a beach. A man comes along and the woman says, "I've never been hugged before." So the man feels bad and hugs her. She says "Well i've also never been kissed before." So he gives her a kiss on the cheek. She says "Well I've also never been fucked before." So the man picks her up, and throws her in the ocean and says "Now you're fucked."
    +2
  • BakerMan @ BakerMan:
    lmao
  • BakerMan @ BakerMan:
    anyways, we need to re-normalize physical media

    if i didn't want my games to be permanent, then i'd rent them
    +1
  • BigOnYa @ BigOnYa:
    Agreed, that why I try to buy all my games on disc, Xbox anyways. Switch games (which I pirate tbh) don't matter much, I stay offline 24/7 anyways.
  • AncientBoi @ AncientBoi:
    I don't pirate them, I Use Them :mellow:. Like I do @BigOnYa 's couch :tpi::evil::rofl2:
    +1
  • cearp @ cearp:
    @BakerMan - you can still "own" digital media, arguably easier and better than physical since you can make copies and backups, as much as you like.

    The issue is DRM
  • cearp @ cearp:
    You can buy drm free games / music / ebooks, and if you keep backups of your data (like documents and family photos etc), then you shouldn't lose the game. but with a disk, your toddler could put it in the toaster and there goes your $60

    :rofl2:
  • cearp @ cearp:
    still, I agree physical media is nice to have. just pointing out the issue is drm
  • rqkaiju2 @ rqkaiju2:
    i like physical media because it actually feels like you own it. thats why i plan on burning music to cds
  • cearp @ cearp:
    It's nice to not have to have a lot of physical things though, saves space
    +1
  • AncientBoi @ AncientBoi:
    Nor clothes 🤮 . Saves on time, soap, water and money having to wash them. :D
  • SylverReZ @ SylverReZ:
    @rqkaiju2, Physical media is a great source for archiving your data, none of that cloud storage shiz.
    +1
  • AncientBoi @ AncientBoi:
    [squeezes @SylverReZ onto a physical media, then archives you in my old stuff box] :tpi::rofl2::tpi:
    +1
    AncientBoi @ AncientBoi: [squeezes @SylverReZ onto a physical media, then archives you in my old stuff box]... +1