natinusala / painless-linux

Boot Linux on the Switch without imx_usb_loader - Windows, Linux, Mac OS & Android
165 stars 16 forks source link

Painless Linux

Boot Linux on the Switch without imx_usb_loader - Windows, Linux, Mac OS & Android

Disclaimer

I am not reponsible in case you brick or blow up your Switch, its LCD screen or its battery. Use this at your own risks, as Linux is known to cause battery calibration and RTC desync as well as potential damage to the LCD display.

You have been warned.

What am I booting ?

The system

It's Arch Linux ARM (ALARM) with the GNOME desktop manager and some utilities :

The default user is alarm, its password is alarm. The root password is root.

How to see and select the current GPU clock profile

The system comes with two scripts to see and select the current GPU clock profile. There are currently three profiles which can be enabled :

The system will reset to the normal profile at each reboot.

To see the current clock profile, run the get-gpu-clock-profile command as root. It will list all the available profiles, with a star next to the one currently activated.

To set the current clock profile, use the set-gpu-clock-profile command.

First boot

When booting for the first time, the system will expand the root partition to fill your entire SD card, and then reboot (like a Raspberry Pi). You will need to run the exploit again once the screen turns black to finalize the reboot process, like when enabling Wi-Fi.

Good practices

When shutting down the Switch from Linux, it doesn't actually power it off. Press the power button for 10 seconds and reboot into Horizon before shutting down from there.

How to use it

Step 0 : what you'll need

Step 1 : downloading things

  1. Clone or download this repository (here)
  2. Download the latest image file :

Step 2 : SD card preparation

Follow this guide with your SD card and the image file you downloaded.

TL;DR : on Windows use Etcher, on Linux & Mac OS use dd

Step 3 : booting Linux

From a Windows PC

On Windows, you will first need to install the required driver :

  1. Get your Switch in RCM mode and plug it into your PC
    • It should appear as "APX" in Windows
  2. Download and run the Zadig Driver Installer from here : https://zadig.akeo.ie/
  3. In the list, choose the device "APX"
    • If it's not showing up, check "List all devices" in the options
  4. At the right end of the green arrow, choose "libusbK (v3.0.7.0)"
  5. Click on the big "Install driver" button

Then, make sure that your Switch is plugged in your PC and in RCM mode. Open the folder of this repository (the one you downloaded and extracted) and run windows-boot.bat (or windows-win32-boot.bat on a 32bit machine). Voilà !

Having a Win32 error 31 is normal.

From a Linux PC or a Mac

Install Python 3 (usually already installed). Open a terminal to install the required package : pip3 install pyusb==1.0.0. I let you deal with permissions issues (hint : sudo works on Linux).

Then, plug your switch in your PC and put it in RCM mode. You should use a blue "SS" port as these have a greater chance of success (EHCI controller doesn't work, XHCI controller works, blue ports have a greater chance of using XHCI).

Once ready, run the linux-macos-boot.sh script from this repository's folder. Again, I let you deal with permissions issues (if it cannot find the module usb it means that you have insufficient permissions). Voilà !

From an Android device

  1. Download and install the latest release of this app : https://github.com/natinusala/switch_linux_launcher/releases/latest
  2. Run it - it will tell you that some files are missing, remember the folder in the dialog, it should look like one of these :
    • /storage/emulated/0/Android/data/io.mrarm.switchlinuxlauncher.noimx/files/shofel2
    • /sdcard/Android/data/io.mrarm.switchlinuxlauncher.noimx/files/shofel2
  3. Exit the app (if you can close the task using the multitask button it's better)
  4. From the payloads folder of the repository, copy the cbfs.bin and coreboot.rom files to the shofel2 folder on your Android device (the folder of the previous step)
  5. Run the app again - if the dialog doesn't show up then you can go on, otherwise you did something wrong
  6. (Optional) Depending on your device, you might need to enable "OTG" or "OTG Storage" in the Android settings
  7. Plug your Switch in your Android device
    • If the Switch is charging from your phone, you can go on
    • If your phone is charging from the Switch, try to reverse the cabling so that your phone charges the Switch instead
    • If nothing happens, I'm afraid your phone doesn't have OTG (or it's not enabled) - the exploit might now work
  8. Put your Switch in RCM mode
  9. Voilà !

Troubleshooting

What works / what doesn't work

Follow the steps on fail0verflow's repository, but instead of using their fork of u-boot, use mine. If you already built everything, you will need to rebuild u-boot using my fork and then rebuild coreboot.

Then, make sure that the first partition of the console's SD card is FAT32 and create a boot folder. Inside, put :

Put the SD card in the console.

Then, use shofel2 to run the coreboot you recompiled, like usual. Linux should boot immediately without the need to run imx_usb !

You should probably put a rootfs in mmcblk0p2.

Credits