Skip to content

Instantly share code, notes, and snippets.

@marius137
Last active September 26, 2024 22:36
Show Gist options
  • Save marius137/221747ea7648399b2a20e5cbc5b49e89 to your computer and use it in GitHub Desktop.
Save marius137/221747ea7648399b2a20e5cbc5b49e89 to your computer and use it in GitHub Desktop.
guide how to build and install 3dslinux

Prerequesites

I am using a clean debian 10 but every debian based distro should work. Non debian based distros might require some work (e.g. Different package names)

Installing required Packages.

  • Debian:
    • sudo apt install git build-essential flex bison gcc-arm-linux-gnueabi libssl-dev bc gcc-arm-none-eabi python3-pip
    • pip3 install -U git+https://github.com/TuxSH/firmtool.git

Add firmtool to PATH

  • Debian: export PATH=$PATH:/home/yourUserName/.local/bin

Building

I will build everything in a folder inside my home called 3dslinux. you can create one with mkdir ~/3dslinux

arm9linuxfw

Clone sources

cd ~/3dslinux
git clone https://github.com/linux-3ds/arm9linuxfw.git

Build

cd ~/3dslinux/arm9linuxfw
make

Linux

Clone Sources

cd ~/3dslinux
git clone https://github.com/linux-3ds/linux.git --depth=1

initrd

Use premade initrd (recommended)

cd ~/3dslinux/linux
wget https://github.com/linux-3ds/buildroot/releases/download/latest/rootfs.cpio.gz

Build your own initrd

Additional Dependencies
  • Lots of RAM and CPU Power.
    • I used a VM with 4 cores, 8GB ram and 20 GB swap and it took about 20 minutes
  • Debian sudo apt install rsync
Clone sources
cd ~/3dsliux
git clone https://github.com/linux-3ds/buildroot.git
Build
cd ~/3dslinux/buildroot
make nintendo3ds_defconfig
make all #this will take a long time depending on your hardware
Copying the rootfs into the kernel sources
cp ~/3dslinux/buildroot/output/images/rootfs.cpio.gz ~/3dslinux/linux

Building the Kernel

cd ~/3dslinux/linux
ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make -j$(nproc) nintendo3ds_defconfig all

Linux Loader

Clone sources

cd ~/3dslinux
git clone https://github.com/linux-3ds/firm_linux_loader.git

Build

cd ~/3dslinux/firm_linux_loader
CC=arm-none-eabi-gcc make

Putting everything on your SDCard

I am assuming you are using Luma CFW. If you are on a different CFW you might have to put the payload somewhere else.

# Create required folders
mkdir -p /path/to/SD/luma/payloads # might be different if you are not on Luma
mkdir -p /path/to/SD/linux

# Copy Linux 
cp ~/3dslinux/linux/arch/arm/boot/zImage /path/to/SD/linux
cp ~/3dslinux/linux/arch/arm/boot/dts/nintendo3ds_ctr.dtb /path/to/SD/linux
cp ~/3dslinux/linux/arch/arm/boot/dts/nintendo3ds_ktr.dtb /path/to/SD/linux

# Copy arm9linuxfw
cp ~/3dslinux/arm9linuxfw/arm9linuxfw.bin /path/to/SD/linux

# Copy Linux loader
# NOTE: This might be different, depending on your CFW
cp ~/3dslinux/firm_linux_loader/firm_linux_loader.firm /path/to/SD/luma/payloads

Booting

NOTE: this is for Luma CFW, if you have a different CFW, the steps might be different.

  • Power off your 3ds
  • hold start and power on your 3ds
  • you should now see the Luma3DS chainloader and a list of payloads
  • use the D-Pad to select firm-linux-loader and press A to boot.
  • Your screen will look glitched for a few seconds, don't worry, this is normal
  • After a few seconds the top screen will show the bootlog and after a couple more seconds the bottom screen will show a keyboard.
  • log in with username root and password toor

Optional Steps

boot linux with a button Combo (Luma)

  • plug your SD Card into your computer
  • rename luma/payloads/firm_linux_loader.firm to luma/payloads/down_firm_linux_loader.firm
  • now you can boot linux by holding down on your D-Pad while powering on
@marius137
Copy link
Author

If you are lazy you can get a prebuilt version here, just unzip the file on the root of your SD Card.

@marius137
Copy link
Author

I wrote a build script that will do everything for you automatically https://gist.github.com/marius137/4205310639616c026b7c248854d4a6a1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment