Nintendo 3DS (nintendo-ctr)

The Nintendo 3DS is a handheld video game console released by Nintendo in 2011. A later revision, the New Nintendo 3DS, was released in 2014.

Contributors

 * knuxify

Maintainer(s)

 * knuxify

Status
The device boots with the APKBUILDs from this pmaports fork. Unfortunately, due to the lack of SD card write support, pretty much nothing works (notably, it is impossible to log in in the console).

Software used
This port makes use of the 3DS Linux fork, arm9linuxfw and firm_linux_loader maintained by members of the linux-3ds organization on GitHub.

Installation
This will not overwrite your 3DS's internal memory. The kernel is loaded off the SD card by the firm_linux_loader (which can be triggered at startup from Luma3DS's firmware selection menu).

In, choose:
 * if you own an Old 3DS, Old 3DS XL or Old 2DS.
 * if you own a New 3DS, New 3DS XL or New 2DS XL

Then, choose one of the following installation methods:

Method 1 - repartitioning your existing SD card
postmarketOS expects the SD card to have two partitions: a boot partition and a root partition. Since Linux and the main 3DS OS share the entire SD card, we need to repartition it to satisfy both of them.

Using your favorite repartitioning tool (explaining how to use them is out-of-scope for this guide - for starters, check out GParted, which is available in pretty much every Linux distro), modify the partitions on your SD card as such:


 * First partition - FAT32, label:  - this partition will function as the main 3DS SD card storage as well as the postmarketOS boot partition.
 * Second partition - ext4, label:  - this is the root partition for postmarketOS.

The labels are important! They allow the postmarketOS initramfs to find the necessary partitions.

Once you're done with the re-partitioning:


 * Run  and.
 * Run  to extract the rootfs from the device image (replace ctr with ktr if you're using a New Nintendo 3DS.) Note that this assumes you have the boot partition size set to the default value of 256MB; if that is not the case, you can run   and replace the skip value with the start value of the second partition.
 * Finally, run  (replace mmcblk0 with your SD card's block device).

Now, we need to add the files necessary for booting. Mount the  partition, as we will be adding files to it.

The following commands will prepare a folder named " " in your home directory, which will contain all the necessary files:

codename="ctr" # replace with ctr or ktr depending on your console mkdir ~/linux3ds mkdir ~/linux3ds/linux mkdir -p ~/linux3ds/luma/payloads pmbootstrap export cp /tmp/postmarketOS-export/vmlinuz ~/linux3ds/linux/zImage cp /tmp/postmarketOS-export/initramfs ~/linux3ds/linux/initramfs.cpio.gz cp ~/.local/var/pmbootstrap/chroot_rootfs_nintendo-*tr/boot/nintendo3ds_*tr.dtb ~/linux3ds/linux cp ~/.local/var/pmbootstrap/chroot_rootfs_nintendo-*tr/lib/firmware/3ds/arm9linuxfw.bin ~/linux3ds/linux cp ~/.local/var/pmbootstrap/chroot_rootfs_nintendo-*tr/lib/firmware/3ds/firm_linux_loader.firm ~/linux3ds/luma/payloads cp /tmp/postmarketOS-export/initramfs-extra ~/linux3ds/initramfs-extra

Copy the contents of the linux3ds folder to the root of the  partition.

Method 2 - on a separate SD card
This method uses a separate SD card just for postmarketOS, and allows us to use  to partition the SD card.

Replace  in the following commands with your SD card's block device name.


 * Run.
 * Once it's done, run
 * Copy the necessary Luma3DS boot files (boot.firm, etc.) and the files necessary to boot postmarketOS (see the commands in the previous method) to the  partition.

Booting
While booting your 3DS (on the Luma3DS splash screen, if enabled) hold the Start button. If you only have one payload installed (luma/payloads only has firm_linux_loader.firm in it), Linux will boot automatically. Otherwise, a menu will pop up allowing you to select a firmware. Choose  from the list.

You'll first see garbage on the screen, and after a few seconds the kernel logs should appear.