[QUICK TUTO] How to boot Linux on your Switch

Discussion in 'Switch - Tutorials' started by natinusala, Apr 24, 2018.

  1. saneatsu

    saneatsu Advanced Member

    Newcomer
    2
    Apr 28, 2018
    United States
    For anyone on OS X that is seeing slow as card write times with dd, use /dev/rdiskX which is the raw disk access method instead of /dev/diskX which is unbuffered.

    This is the only difference for OSX’s dd command.
     
    cmsj and natinusala like this.
  2. cmsj

    cmsj Advanced Member

    Newcomer
    2
    Apr 25, 2018
    United Kingdom
    Ok, I've been quiet for a few days, but I'm back with some progress - not on better Switch hardware support, I drew a lot of blanks in my investigations there.

    But, I do now have a fully automated build system (using Docker) for the f0f exploit chain, the various bootloaders, the Linux kernel and an Ubuntu root filesystem.

    So what? Well, what it spits out right now is a tarball containing all of the scripts/executables/payloads for the f0f exploit, and an SD card image of Ubuntu :)

    There's one very big difference compared to the other f0f exploit payloads - specifically, this one only boots a kernel from /boot/ in the SD card, it doesn't send the kernel/DTB over USB. I plan on extending the u-boot script so that it will look for the files on SD and fall back to USB if it can't find them, but overall I think sending them over USB is kinda pointless from a user perspective.

    In terms of what's in the Ubuntu image, nothing has changed really since I was last posting - the rotation is still wrong on the first boot for example. Someone please figure out what I did wrong with my Xsession.d script, to fix that!

    One other big caveat right now is that the Linux partition doesn't resize itself to fill the SD card. I know how to do it, I just wanted to focus first on getting a full build chain that spits out everything required to install/boot Ubuntu.

    See https://github.com/cmsj/switch_linux_kit/releases/tag/1.0 for the downloads (ie the exploit chain and the SD card image) and some brief instructions :)

    — Posts automatically merged - Please don't double post! —

    Lots of credits to other folk on this:
    • Nold360 for his build scripts which I've significantly extended, and his Docker based toolchain builder, which I've also hacked up quite a bit
    • Open Source Robotics Foundation for their multiarch Ubuntu image builder
    • f0f obviously
    • Everyone who posted some kind of little fix to Xorg/etc that I've incorporated so far
     
    Last edited by cmsj, May 4, 2018
  3. natinusala
    OP

    natinusala Win32 error 31 is not an error

    Member
    11
    Dec 1, 2012
    France
    That's very nice ! I see that you're still using imx_usb_loader though, is it for the u-boot script ?
     
  4. uyjulian

    uyjulian Homebrewer

    Member
    9
    Nov 26, 2012
    United States
    United States
    Or just increase the bs= size...

    The problem with buffered access is that you don't know when it's safe to unplug the storage device.
     
  5. natinusala
    OP

    natinusala Win32 error 31 is not an error

    Member
    11
    Dec 1, 2012
    France
    Isn't that why sync exists ?
     
  6. saneatsu

    saneatsu Advanced Member

    Newcomer
    2
    Apr 28, 2018
    United States
    I believe sync just tells it to flush the buffer to make sure you can eject it quickly.

    And yes while bs does impact however on OS X disk access is usually cached/compressed. Using rdisk3 (for example) will bypass any caching and means you don’t need to sync either. Personally this moves a 32gb image from hour+ (at 3-4MB/s) to 30 min (20MB/s).
     
    uyjulian likes this.
  7. Rainbowfied Pokemaster

    Rainbowfied Pokemaster Member

    Newcomer
    2
    Jun 28, 2016
    United States
    Can anyone help me with this
     
  8. SapphireExile

    SapphireExile Advanced Member

    Newcomer
    3
    May 2, 2018
    United States
    Plant City, FL
    Seems to be a general GCC bug. Install the latest version.
     
  9. MrWhosHacking

    MrWhosHacking GBAtemp Regular

    Member
    3
    May 3, 2018
    United States
    No new sd card

    — Posts automatically merged - Please don't double post! —

    Message me
     
  10. cmsj

    cmsj Advanced Member

    Newcomer
    2
    Apr 25, 2018
    United Kingdom
    For now, yes. That will go away when I change u-boot's default command to boot from SD and fall back to USB injection. I'll keep shipping imx_usb_loader after that point, it just won't be used by default.
     
  11. natinusala
    OP

    natinusala Win32 error 31 is not an error

    Member
    11
    Dec 1, 2012
    France
    Last edited by natinusala, May 6, 2018
    lordelan likes this.
  12. wiiarctus

    wiiarctus GBAtemp Regular

    Member
    2
    Aug 29, 2016
    Germany
    Is it normal that with the "boot_linux.bat" it takes so long for me (over a minute) to load the kernel image binary file? (It's really annoying to wait that long to boot Linux, even twice for Wi-Fi, is there a way to make that faster? :whip:)
     
    Last edited by wiiarctus, May 6, 2018
  13. ShadowXin225

    ShadowXin225 Member

    Newcomer
    2
    Apr 30, 2018
    Australia
    is there a possibility for sound anytime soon or no? built the code up but what driver incomparability is causing the audio output to stuff up even using a bluetooth speaker?

    — Posts automatically merged - Please don't double post! —

    i got a bluetooth keyboard to work with it ps4 controller connects but may need input mapper ported other or ds4 hardware with the kde image is a slow lags with gba emulation using retro arch am i doing something incorrect ??

    — Posts automatically merged - Please don't double post! —

    i have not attempted using dolphin to test if theres a difference due to the reason of gba emulation being so buggy at this stage

    — Posts automatically merged - Please don't double post! —

    acutually someone place me on the right track for audio and ill try to get it working spent 6 and a half hours from starting learning new things so mos awell give this a shot ill attempt to compile but need a general push in the right direction vice versa when i can that is
     
  14. CuriousTommy

    CuriousTommy GBAtemp Advanced Fan

    Member
    4
    Jul 22, 2014
    United States
    I was also curious about the driver issues. For audio, the Switch uses a Realtek ALC5639, but (from what I understand) the datasheet (which describes how to communicate with the hardware) is not publicly available. So I guess someone would have to reverse engineer the Switch's driver to make a Linux driver...
     
  15. Raugo

    Raugo GBAtemp Fan

    Member
    6
    Nov 22, 2014
    CuriousTommy likes this.
  16. ShadowXin225

    ShadowXin225 Member

    Newcomer
    2
    Apr 30, 2018
    Australia
    it seems this audio device was made way back 2014 i found a post not sure if this would help us but
    amixer cset name="Stereo ADC MIXL ADC2 Switch" 0
    amixer cset name="Stereo ADC MIXR ADC2 Switch" 0
    amixer cset name="Int Mic Switch" 0
    amixer cset name="ADC Capture Switch" 1
    amixer cset name="RECMIXL BST1 Switch" 0
    amixer cset name="RECMIXR BST1 Switch" 0
    amixer cset name="RECMIXL BST2 Switch" 1
    amixer cset name="RECMIXR BST2 Switch" 1
    amixer cset name="Stereo ADC L1 Mux" "ADC"
    amixer cset name="Stereo ADC R1 Mux" "ADC"
    amixer cset name="Stereo ADC MIXL ADC1 Switch" 1
    amixer cset name="Stereo ADC MIXR ADC1 Switch" 1
    amixer cset name="Stereo ADC MIXL ADC2 Switch" 0
    amixer cset name="Stereo ADC MIXR ADC2 Switch" 0
    amixer cset name="IN1 Mode Control" "Single ended"
    amixer cset name="IN2 Mode Control" "Single ended"
    amixer cset name="Mic Jack Switch" 1

    — Posts automatically merged - Please don't double post! —

    i cant post hyperlinks being a new member but ill pull all the page in a box


    has a Realtek ALC5639 HD Audio codec with the following connectors:

    • 3.5mm audio stereo output (eg: for speakers)
    • 3.5mm audio input (eg: for microphone)
    • HDMI digital audio (eg: for a TV).
    Fixing the sound recording input
    , you might need to open a terminal and run the following to correctly configure sound recording on Jetson TK1:

    amixer cset name="Stereo ADC MIXL ADC2 Switch" 0
    amixer cset name="Stereo ADC MIXR ADC2 Switch" 0
    amixer cset name="Int Mic Switch" 0
    amixer cset name="ADC Capture Switch" 1
    amixer cset name="RECMIXL BST1 Switch" 0
    amixer cset name="RECMIXR BST1 Switch" 0
    amixer cset name="RECMIXL BST2 Switch" 1
    amixer cset name="RECMIXR BST2 Switch" 1
    amixer cset name="Stereo ADC L1 Mux" "ADC"
    amixer cset name="Stereo ADC R1 Mux" "ADC"
    amixer cset name="Stereo ADC MIXL ADC1 Switch" 1
    amixer cset name="Stereo ADC MIXR ADC1 Switch" 1
    amixer cset name="Stereo ADC MIXL ADC2 Switch" 0
    amixer cset name="Stereo ADC MIXR ADC2 Switch" 0
    amixer cset name="IN1 Mode Control" "Single ended"
    amixer cset name="IN2 Mode Control" "Single ended"
    amixer cset name="Mic Jack Switch" 1
     
  17. CuriousTommy

    CuriousTommy GBAtemp Advanced Fan

    Member
    4
    Jul 22, 2014
    United States
    Last edited by CuriousTommy, May 6, 2018
  18. ShadowXin225

    ShadowXin225 Member

    Newcomer
    2
    Apr 30, 2018
    Australia
    that is weird that it does not work since it is implanted into the kernal as the others said we might have to start from scratch
     
  19. lordelan

    lordelan GBAtemp Psycho!

    Member
    12
    Jan 4, 2015
    Germany
    Just out of curiousity as this popped up and I was thinking about this as well since day one, is it possible in Switch Linux to connect and mount a USB device (drive or flash stick)?
    And if yes, even in docked mode? Because people in the thread are saying the dock can't read from USB drives.
     
  20. Raugo

    Raugo GBAtemp Fan

    Member
    6
    Nov 22, 2014
    The Jetson TX1 use 'the nvidia,tegra-audio-t210ref-mobile-rt565x' driver, this driver is in the tegra-alt folder. What command you use to check the sound card? With dmesg I don't see nothing.
     
Quick Reply
Draft saved Draft deleted
Loading...