├── .gitmodules ├── 00_build.sh ├── 01_format_sdcard.txt ├── 02_exploit.sh ├── 03_uboot.sh └── README.md /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "coreboot"] 2 | path = coreboot 3 | branch = switch 4 | url = https://github.com/fail0verflow/switch-coreboot.git 5 | [submodule "shofel2"] 6 | path = shofel2 7 | url = https://github.com/fail0verflow/shofel2.git 8 | [submodule "u-boot"] 9 | path = u-boot 10 | branch = switch 11 | url = https://github.com/fail0verflow/switch-u-boot.git 12 | [submodule "linux"] 13 | path = linux 14 | branch = switch 15 | url = https://github.com/fail0verflow/switch-linux.git 16 | [submodule "imx_usb_loader"] 17 | path = imx_usb_loader 18 | url = https://github.com/boundarydevices/imx_usb_loader.git 19 | [submodule "librecore-utils"] 20 | path = librecore-utils 21 | url = https://github.com/librecore-org/librecore-utils 22 | -------------------------------------------------------------------------------- /00_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | set -e 4 | set -u 5 | 6 | cd shofel2/exploit 7 | make -j2 8 | 9 | cd /source 10 | cd u-boot 11 | export CROSS_COMPILE=aarch64-linux-gnu- 12 | make nintendo-switch_defconfig 13 | make -j2 14 | 15 | cd /source 16 | cd librecore-utils 17 | mkdir build || true 18 | cd build 19 | cmake .. 20 | make 21 | make install #needed?! 22 | #./build/util/cbfstool/cbfstool bootloader-dragon-google_smaug.7900.97.0.img extract -n fallback/tegra_mtc -f tegra_mtc.bin 23 | 24 | cd /source 25 | cd coreboot 26 | make nintendo_switch_defconfig 27 | make iasl 28 | make 29 | 30 | cd /source 31 | cd imx_usb_loader 32 | # why? 33 | # git reset --hard 0a322b01cacf03e3be727e3e4c3d46d69f2e343e 34 | make -j2 35 | 36 | cd /source 37 | cd linux 38 | export ARCH=arm64 39 | export CROSS_COMPILE=aarch64-linux-gnu- #useless 40 | make nintendo-switch_defconfig 41 | make -j2 42 | -------------------------------------------------------------------------------- /01_format_sdcard.txt: -------------------------------------------------------------------------------- 1 | See: https://github.com/fail0verflow/shofel2 2 | 3 | Root filesystems 4 | 5 | If all went well, you should have some penguins. You should probably put a root filesystem on your SD card. Userspace libraries and other patches coming soon. 6 | 7 | Here is an example on how to get Arch up and running. 8 | 9 | make a new MBR partition table on a fresh sdcard 10 | make two partitions on it 11 | format the second one as ext4 12 | mount that partition somewhere 13 | download Arch Linux ARM rootfs 14 | untar it into your partition as root. 15 | 16 | Here are some example commands you should not just copy paste into your terminal. 17 | 18 | $ mkdir -p /tmp/sdcard 19 | $ mount -t ext4 /dev/mmcblk0p2 /tmp/sdcard 20 | $ wget http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz 21 | $ sudo tar -xf ArchLinuxARM-aarch64-latest.tar.gz -C /tmp/sdcard 22 | $ sudo umount /dev/mmcblk0p2 23 | -------------------------------------------------------------------------------- /02_exploit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd shofel2/exploit 3 | sudo ./shofel2.py cbfs.bin ../../coreboot/build/coreboot.rom 4 | 5 | cd - 6 | -------------------------------------------------------------------------------- /03_uboot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd shofel2/usb_loader 4 | ../../u-boot/tools/mkimage -A arm64 -T script -C none -n "boot.scr" -d switch.scr switch.scr.img 5 | sudo ../../imx_usb_loader/imx_usb -c . # This command needs root or permissions to access usb devices 6 | 7 | cd - 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Switch Linux Kit 2 | Build Linux for Nintendo Switch from Sourcecode using [Docker Toolchain](https://hub.docker.com/r/nold360/switch_linux_toolchain/) 3 | 4 | ### Cloning 5 | ``` 6 | git clone https://github.com/Nold360/switch_linux_kit 7 | cd switch_linux_kit 8 | git submodule update --init 9 | ``` 10 | 11 | ### Compiling 12 | ***Note:*** You'll still need to get `coreboot/tegra_mtc.bin` on your own. 13 | 14 | ``` 15 | docker run -ti --rm -v$(pwd):/source nold360/switch_linux_toolchain bash 00_build.sh 16 | ``` 17 | 18 | ### Profit! 19 | ***Note:*** You still need to prepare a rootfs SD-Card like described [here](https://github.com/fail0verflow/shofel2) 20 | 21 | Then simply run the exploit & uboot-scripts: 22 | ``` 23 | bash -x 02_exploit.sh 24 | bash -x 03_uboot.sh 25 | 26 | ``` 27 | --------------------------------------------------------------------------------