Setting up a Homebrew Development Environment for Nintendo Platforms on Linux

Coding for Video Game Consoles

Through the wonderful world of homebrew, you can develop your own games, applications and run custom code on your favorite consoles or emulators. The Nintendo homebrew scene blew up in the early 2000s with the Game Boy Advance (GBA) and Nintendo DS as people found ways to execute custom software on these devices using independently built and open-source development tools. This meant you didn’t have to be part of an established game studio to make games, anyone who knew how to code, or wanted to learn how to code could do it themselves.

Today, these tools have continued to mature and expand to modern consoles like the Nintendo Switch. Nintendo has made it slightly easier to get your hands on their official development kit but if you go that route you’ll still have to go through an application process, convince them that you’ve got something good, and sign an NDA which will prohibit you from openly discussing their development tools. This is well within their right, and a necessary process if you are planning on selling your creation as an officially licensed Nintendo product. But what if you just want to start building games or software without a particular title in mind, or you want to build for older systems that are no longer in production?

Fortunately you can with freely available homebrew tools. Homebrew can be a great way to learn game development and familiarize yourself with console hardware. In this tutorial, we’ll be setting up a homebrew development environment for Linux. This was tested specifically on Ubuntu 22.04, but the instructions should work for virtually all modern Linux operating systems. A Windows version of this tutorial is available here, and a macOS version here. Once you’re set up, you’ll be able to start building games and writing code for any of the following consoles:

  • Game Boy Advance (GBA)
  • Nintendo DS
  • 3DS
  • Gamecube (GC)
  • Wii
  • Wii U
  • Nintendo Switch
      (See below for older Nintendo Consoles)

By the end of this tutorial, you’ll be able to build a ROM file that you can test right away on an emulator.

Although not covered in this tutorial, you can build homebrew for older Nintendo consoles as well:

Installing Homebrew Toolchains with DevkitPro

We’ll be using devkitPro, a tried and true producer of homebrew toolchains for Nintendo consoles. See their official Getting Started guide for full details. I've outlined the Linux specific steps below. Let’s get started:

On Linux:

  1. Download and install the devkitPro pacman installer. For Debian based Linux operating systems (like Ubuntu, Kali Linux etc.), install the devkitPro pacman installer with the following commands:

    $ wget
    $ chmod +x ./install-devkitpro-pacman
    $ sudo ./install-devkitpro-pacman

    For full and official instructions, and instructions for Non-Debian Linux operating systems, follow the instructions here
  2. Reboot you computer. This will make sure all the system paths are set correctly.

Now you can easily install the build tools for your Nintendo consoles of choice.

Installing Console Specific Tools

Let’s install the GBA tools as an example. Use:

$ sudo dkp-pacman -S gba-dev

In some cases, you may have to swap “dkp-pacman” for “pacman”. See devkitPro's Using Pacman for details. In such cases, you would use:

$ sudo pacman -S gba-dev

You can replace “gba-dev” with a different tag to install tools for other Nintendo consoles using the same command. See all the options here: Predefined Groups

We’ll now build a simple Hello World example to produce a .gba ROM. To test it we’ll need a GBA emulator.

Building a ROM and Testing it on an Emulator

  1. Visual Boy Advance (VBA) is one of the best and most popular open source emulators that’s been around for decades. Download and install VBA with:

    $ sudo snap install visualboyadvance-m --beta

    If you have any trouble see this.
  2. Create a new directory for your homebrew project:

    $ mkdir hello-gba

    With your installation of “gba-dev” (or for any other console) you will get a number of examples of source code you can compile and use to build off of. For me, the gba examples are in “/opt/devkitpro/examples/gba/“. You can also get the files here. Let’s grab the 'template' example which is really just a 'Hello World' program.
  3. Copy the contents of “/opt/devkitpro/examples/gba/template” to the “hello-gba” directory you created in the previous step:

    $ cp -a /opt/devkitpro/examples/gba/template/. <PATH_TO_FOLDER>/hello-gba/

    You can also grab the template example from here. Your “hello-gba” directory should now have a 'Makefile', 'template.pnproj' file, and a 'source/' folder with 'template.c' inside.
  4. Now cd into your project directory and build the example:

    $ cd <PATH_TO_FOLDER>/hello-gba
    $ make

    After running 'make' you should see output like this:

    Your project directory should now have a 'build/' directory, an .elf file and a .gba ROM—in our case named “hello-gba.gba”. Now let’s test that it works.
  5. Open “hello-gba.gba” with Visual Boy Advance:

    $ visualboyadvance-m hello-gba.gba

    This should pop up the emulator with the program. Note that once opened, you may want to go to Options > Video > Scaled Resize to scale it appropriately for your screen:

    Congrats! You’ve built a GBA ROM. If you want, you could run this on actual hardware with a GBA flashcart. You can pick up the EZ Flash Omega or EverDrive GBA series from Amazon, or shop around Ebay or AliExpress for less expensive options.

    From here you might want to try modifying the 'Hello World' example, building more GBA examples, and compiling programs for other consoles.

Building for Other Consoles

The process is very similar for other consoles:

  1. Install the tools for your target console with sudo (dkp-)pacman -S <PREDEFINED-GROUP> (See Groups)
  2. Get an emulator for the console
  3. Create a new project or build an example project to create a ROM
  4. Test the ROM on the emulator.
The devkitPro examples are a fantastic resource for getting started with basic functionality. Console specific examples are added when you install tools for each new console, and are also provided by the devkitPro team on their GitHub: See Examples. You can test whatever you build on an emulator, and if everything looks good, you can then test on actual hardware.

That does it for this tutorial. See our Tutorials Section for more tutorials like this one.