• Stars
    star
    111
  • Rank 312,751 (Top 7 %)
  • Language
    C
  • Created over 6 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Device trees, patches, etc for Linux on Switch

Switch-Linux

It's Linux for Switch.

It's Linux for Switch

Should I Be Using This?

Probably not, this repo has no hardware acceleration and I didn't anticipate fail0verflow releasing their Linux sources so soon (I thought I'd probably be developing this for at least another month or so). Either way, you probably want this and I don't really plan on contributing here.

I'll leave the repo up though to at least showcase how far I got with ~a week of development, probably could have gotten farther with some more time, maybe this will end up being retrofitted later :)

Requirements

  • u-boot running from either TrustZone takeover or bootrom hax. Neither is provided currently, however Switch-compatible u-boot can be found here
  • A properly-formatted SD card. Instructions can be found below in Compiling, Installation and Setup

Notes on PSCI

  • Nintendo's Horizon OS TrustZone component can provide PSCI calls which work for Linux (given patches provided on the repo). By default, the device tree is configured for Linux running from u-boot packaged in Nintendo's package2, with all PSCI calls being sent to SMC #1 instead of SMC #0.
  • Use of other trusted firmwares with PSCI on SMC #0 should be able to remove the need for these patches, however it is untested currently.

Notes on debugging

  • By default, the right Joy-Con rail is used for UART logging output, with pin 5 being the console's TX, and pin 8 being the console's RX. See here for details.

Compiling, Installation and Setup

Installation of u-boot will depend on loading methods used. However once u-boot is installed, the following instructions can be used:

  • Make sure your SD card is formatted with MBR partitioning, with the first partition being FAT32/exFAT and a second for ext3/ext4. If ext4 has issues booting, try ext3.
  • Download the generic ALARM image here and follow the instructions provided to install the filesystem to the ext3/ext4 filesystem on your SD card. You may need a Linux box to do these steps.
  • Clone linux-next using git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
  • cd linux-next && git checkout v4.15
  • Apply the provided patches in the repo using git am -3 -k <patch file>
  • NVIDIA has microcode required for their host1x/DRM subsystems. This should be compiled into the kernel or initramfs for early screen init.
    • Download the linux-firmware package from here
    • mkdir extra_firmware
    • Copy nvidia/tegra210/vic04_ucode.bin and nvidia/tegra210/xusb.bin from the package to linux-next/extra_firmware/nvidia/tegra210/vic04_ucode.bin and linux-next/extra_firmware/nvidia/tegra210/xusb.bin
    • It should be noted that while this may be useful for easy debugging, generated kernel images will be dirty and not strictly GPL compliant. It is recommended that, for image-based releases, that these files be installed to the initramfs.
    • TODO: These are pulled from the actual root partition (with linux-firmware installed to it) if panels are loaded as modules.
  • Ensure that you have an AArch64 cross-compiler installed.
  • export ARCH=arm64
  • export CROSS_COMPILE=aarch64-linux-gnu-
  • mkdir -p build/hac-001/
  • make O=build/hac-001/ hac_defconfig
  • make O=build/hac-001/ -j4 Image
  • Copy the Image file from build/hac-001/arch/arm64/boot/Image to the boot/ folder on your SD card's FAT partition.
  • In this repo, mkimage -A arm -T script -O linux -d u-boot/boot.txt u-boot/boot.scr and copy boot.scr to the boot/ directory on the FAT partition of your SD card.
  • make O=build/hac-001/ -j4 modules
  • sudo -E make O=build/hac-001/ modules_install INSTALL_MOD_PATH=/path/to/ALARM/rootfs/
  • ALARM has a default initramfs which needs to be wrapped for u-boot. mkimage -A arm -T ramdisk -C gzip -d /path/to/initramfs-linux.img /path/to/FAT/boot/initramfs.uImage
  • In the repo, cd device-tree && sh build.sh && cp tegra210-hac-001.dtb /path/to/FAT/boot/
  • Your FAT boot/ directory should have Image, initramfs.uImage, and tegra210-hac-001.dtb
  • Boot through u-boot. If an error has occurred, it will open a USB mass storage device for the SD card.

TODO

  • Get USB working
  • Get WiFi/BT(?) working
  • Get nouveau working
  • Get audio working
  • Get touchscreen working
  • DVFS work?
  • DisplayPort? Switch dock drivers?
  • Probably a lot more stuff.

More Repositories

1

OpenJKDF2

A cross-platform reimplementation of JKDF2 in C
C
495
star
2

HID-Joy-Con-Whispering

Talk to Joy-Con from a PC because it's cool
C
179
star
3

wii_u_modchip

A Pico-based Wii U modchip based on eFuse reset exploit
Python
150
star
4

lg_display_manager

I put way too much effort into controlling my LG DualUp's inputs from my laptop
Python
114
star
5

SaltySD

A collection of SD redirect patches for 3DS games
Assembly
74
star
6

u-boot

u-boot on the Nintendo Switch
C
67
star
7

MEH

Map Editor of Happiness, an open-source Pokemon Gen III map editor written in Java!
Java
66
star
8

SaltyNX

Background process for the Nintendo Switch for file/code modification
C
66
star
9

libusbd

Cross-OS library for implementing USB device-mode interfaces
C
49
star
10

GBA-Rick

Rick Astley on the GBA, for all your Rickrolling needs.
C
47
star
11

DesktopAdventures

A recreation of the Desktop Adventures engine in C
C
47
star
12

dsiwifi

AR6012/AR6013 LwIP drivers for DSi and 3DS
C
45
star
13

CVE-2020-12753-PoC

A proof-of-concept for CVE-2020-12753
Python
39
star
14

moooooooo

low-level Tegra X1 AArch64 emulator using Unicorn
C++
37
star
15

GBA-GB-ROMDumper

A GBA/GB(C) ROM dumper for the Arduino Mega (MEGA2560)
Arduino
34
star
16

DisFire

A compilable disassembly of Pokemon Fire Red for GBA
Assembly
32
star
17

gwcard

Gateway Card Init and Protocol Implementation
C
28
star
18

Wii-Glitching

Wii Mini Glitching Scripts/Resources for CWLite
Python
28
star
19

supermysterychunkhax

3DS Userland Exploit for Pokemon Super Mystery Dungeon
C
27
star
20

vive_ultimate_tracker_re

Reverse engineering the protocol for the VIVE wireless dongle and the 6DoF Ultimate tracker
Python
27
star
21

MysteryMachine-Patcher

Dumps and patches code for Mystery Machine
C++
26
star
22

xrsp_tests

Attempting to talk to Meta Quest's USB/XRSP interface
Python
26
star
23

stroopwafel

iosuhax for de_Fuse
C
25
star
24

bootstrap

ARM11 Kernel from ninjhax
C
25
star
25

HashtagBlessedII

Nintendo Switch/T210 hypervisor written in Rust
Rust
22
star
26

InfiniteCampusAPI

Infinite Campus API, written in Java
Java
20
star
27

nds2elf

Tools for converting Nintendo DS binaries to an ELF file for Ghidra/IDA
Python
20
star
28

GBAUtils

A Java library for creating GBA ROM Hacking Tools
Java
20
star
29

therainsdowninafrica

Nintendo Switch Horizon microkernel in-kernel SVC MiTM for doing literally anything
C++
18
star
30

monado

https://gitlab.freedesktop.org/monado/monado
C
16
star
31

macos_usb_gadget_poc

A userland USB gadget driver for macOS 12 which emulates a HID keyboard
C
15
star
32

v_hax

3DS Userland Exploit for VVVVVV v1.0
C
14
star
33

RealityKitShenanigans

Can I create a stereoscopic/40PPD Metal renderer in RealityKit? Probably.
Swift
14
star
34

arcshark

Super Smash Bros Ultimate arc extraction
C++
13
star
35

crotools

A collection of tools for CROs
C++
13
star
36

woominstaller

Homebrew Package Installer for Wii U
C
13
star
37

makefst

CDN FST packer and packager for Wii U homebrew
C
12
star
38

switch-repair-docs

Reverse-engineered schematics, pinouts, etc for Nintendo Switch repairs
12
star
39

woominstaller_gx2

Woominstaller but like, cooler looking or something.
C
11
star
40

everdrive-cfw

GBAOS alternative for Everdrive GBA flashcarts
C
11
star
41

ESP32-Joy-Con-Whisperer

Make Joy-Con spill their deepest, darkest secrets over UART with an ESP32
C
10
star
42

ESP32-GBA-SIO

Bitbanged GBA SIO with an ESP32
C
10
star
43

Q710-SIGNhax-EL3-Warmboot

Exploit for LG Q710ULM (Stylo 4 AMZ variant) for writing arbitrary contents to eMMC and patching aboot via S-EL3 warmboot takeover
C
10
star
44

pokeemerald-warprandomizer

A warp randomizer for pokeemerald
Python
9
star
45

gba-multiboot-dump

Dumps GBA Multiboot Transfers to EZIV SD
Makefile
9
star
46

3DS-Pong

Pong for 3DS using ctrulib
C++
8
star
47

twrp_sony_pdx203

TWRP for the Xperia 1 II
C++
8
star
48

FR-CrystalIntro

The Pokemon Crystal intro remade and recoded for the FireRed engine. Based on FR-CustomIntro
C
8
star
49

gx2test

Port of dimok's GX2 rotating cube test to wut, with proper multitasking
C++
8
star
50

LEGO-LOCO-Decompression-Tool

A tool used to decompress the strange file format for many Lego Loco files. Useful for modding and resource extraction.
Java
8
star
51

M_X-RuinsofAlph

The Ruins of Alph code by Mastermind_X released with permission.
C
8
star
52

RIPVR-Controller

My High School Senior Project - A VR controller from the ground-up
Python
7
star
53

gx2texture2D

Basic GX2 sample for rendering 2D textures
C
7
star
54

GW-Unlaunch

Unencrypted unlaunch.dat launcher for 3DS
PHP
7
star
55

Everdrive-GBA-DLDI

SD card DLDI for the Everdrive-GBA X5
C
6
star
56

Endless-Nuclear-Kittens

Endless Nuclear Kittens Engine from the Mojam Humble Bundle
Java
6
star
57

BEH

Because Eventual Happiness - A Rewrite of MEH in D
D
6
star
58

SEA

Java
6
star
59

mstar_extract_decompress

Extracting and decompressing MSTAR monitor firmwares
C
6
star
60

twrp_google_r11

TWRP for the Google Pixel Watch
Makefile
5
star
61

3DSGBA

GBA emulator for the 3DS.
C++
5
star
62

WiiU-Endless-Nuclear-Kittens

Endless Nuclear Kittens ported to Dlang ported to Wii U and WUT
D
5
star
63

FR-CustomIntro

A custom intro written in Assembly for Pokemon Fire Red
Assembly
5
star
64

VRRClarityTestbench

Apple Vision Pro clarity and VRR testbench, which uses mipmaps to display VRR maps
Swift
5
star
65

asm-language

Gedit syntax highlighting for arm assembly
4
star
66

pazaak-wiiu

Pazaak Homebrew for Wii U
C
4
star
67

FR-PokeGear

A custom menu option to recreate the PokeGear on Fire Red.
C
4
star
68

dither_experiments

Experimenting with Verilog-able scanline dithering
Python
4
star
69

FR-EM-Useful

Useful routines for Fire Red and Emerald, all stuck in a neat little .h
C
3
star
70

libsmusher

Library for decoding LucasArts SMUSH videos.
C
3
star
71

FR-TripleLayerTileHack

A hack that allows a third layer of tiles for block using reference-based selection
3
star
72

Wizard-DN

A blending-based D/N system for Gen III Pokemon Games
Assembly
3
star
73

stlink_gba_multiboot

ST-Link V2 firmware which can talk to GBA SIO
C
3
star
74

EM-SafariHax

Hacks the safari battle for a one-time guaranteed Pokemon
Assembly
2
star
75

openxr-simple-example-macos

WIP, openxr-simple-example on macOS kinda
C
2
star
76

minlibd

minlibd fork for DevKitPro
D
2
star
77

kernel_manifest-r11btwifi

Pixel Watch kernel manifest
2
star
78

OpenJKDF2-KVM

Unicorn/KVM shim for OpenJKDF2
C++
2
star
79

eyetrack_toybox

Experimenting with ML models for VR eye tracking
Python
2
star
80

smash-cros

Smash 4 3DS CRO modifications
C
2
star
81

FR-FollowMe

A Follow-Me System for Fire Red
Assembly
2
star
82

FR-Overworld

A small C file which allows the initialization and manipulation of the Fire Red overworld code
C
1
star
83

android_device_lge_q710

Makefile
1
star
84

DCPU-3DS

DCPU Emulator for 3DS
C++
1
star
85

FR-SafariHack

A hack that allows for the manipulation of the Safari Zone battle mode.
Assembly
1
star
86

OpenJK

Jedi Academy on crack
C++
1
star
87

nh2-cart-romfs

Read Cart/Digital game romFSs from ninjhax 2
C
1
star
88

EM-Second-Textbox

Creates a second textbox using the showcoins internal dialog system thingy thing.
Assembly
1
star
89

FR-SkittyTitlescreen

A custom title screen for Fire Red written in C
C
1
star
90

FR-IntroTemplate

Template for a custom FR Intro
C
1
star
91

FR-GSIntro

Gold and Silver Introduction recreated onto the FireRed engine
C
1
star