Skip to content
Wolfvak edited this page Jul 28, 2021 · 18 revisions

Table of Contents

Install dependencies

$ sudo apt install git build-essential flex bison gcc-arm-linux-gnueabi libssl-dev bc gcc-arm-none-eabi

Make sure you've also built firm_linux_loader, arm9linuxfw and buildroot.

Alternatively you can also fetch binaries off the repo releases.

Fetch sources

$ git clone https://github.com/linux-3ds/linux.git --depth=1

Fetch initrd (optional, if you don't build your own)

This is optional if you know how to create your own rootfs.cpio.gz, otherwise you may use this simple one for now until we create a more full featured release. This is the userspace that we bundle into the kernel image as a "ram disk" for simplicity so we can focus on driver development during kernel bringup.

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

The defconfig always attempts to integrate the rootfs from a file called rootfs.cpio.gz in the linux kernel tree directory, so if you want to build your own you can follow the instructions in the buildroot repo.

How to build (kernel)

$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make -j$(nproc) nintendo3ds_defconfig all

Put on SD Card

Place arch/arm/boot/zImage, arch/arm/boot/dts/nintendo3ds_ctr.dtb, and arch/arm/boot/dts/nintendo3ds_ktr.dtb on the sdcard under linux/

example:

$ cp arch/arm/boot/zImage /media/nick/6332-3234/linux/zImage
$ cp arch/arm/boot/dts/nintendo3ds_ctr.dtb /media/nick/6332-3234/linux/.
$ cp arch/arm/boot/dts/nintendo3ds_ktr.dtb /media/nick/6332-3234/linux/.

Booting

You need to boot the firm_linux_loader.firm file which will in turn load all the generated binaries (zImage, nintendo3ds_ctr.dtb or nintendo3ds_ktr.dtb depending on your model and arm9linuxfw.bin) into memory and boot the kernel.

Log in

The default rootfs will ask you a username and password, currently there are no users so you can log in as root with the password toor.