User Tools

Site Tools


hardwarerelated:nintendo_switch

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hardwarerelated:nintendo_switch [2019/06/15 00:55]
chris [Links]
hardwarerelated:nintendo_switch [2019/08/31 10:50] (current)
chris [Generic hints]
Line 2: Line 2:
 Some notes regarding running Linux on the Nintendo Switch. First things first, thanks [[https://​github.com/​fail0verflow/​shofel2|fail0verflow]]. I did just play a bit on the software side, but fail0verflow was one of the 2 groups who found the way to run Linux, and established all the chain to make this possible, including providing the patched Linux kernel. You guys rock! Some notes regarding running Linux on the Nintendo Switch. First things first, thanks [[https://​github.com/​fail0verflow/​shofel2|fail0verflow]]. I did just play a bit on the software side, but fail0verflow was one of the 2 groups who found the way to run Linux, and established all the chain to make this possible, including providing the patched Linux kernel. You guys rock!
  
-{{https://​fluxcoil.net/​files/​tmp/​20180527_200130_nintendo_switch.jpg?400x200 ​}}+{{https://​fluxcoil.net/​files/​tmp/​20190707_124709_nintendo_switchc.jpg?600x400 ​}}
  
 ===== Links ===== ===== Links =====
-  * [[https://​arstechnica.com/​gaming/​2018/​04/​the-unpatchable-exploit-that-makes-every-current-nintendo-switch-hackable/​|Linux is now running on the Nintendo switch]] 
-  * https://​github.com/​natinusala/​painless-linux - one of the first distros with kernel on the sdcard 
   * https://​www.reddit.com/​r/​SwitchHaxing/​ -- reddit switch news   * https://​www.reddit.com/​r/​SwitchHaxing/​ -- reddit switch news
   * [[https://​media.ccc.de/​v/​c4.openchaos.2018.06.glitching-the-switch|"​glitching the switch"​ from Andreas Galauner]]   * [[https://​media.ccc.de/​v/​c4.openchaos.2018.06.glitching-the-switch|"​glitching the switch"​ from Andreas Galauner]]
-  * https://​switchbrew.org - switch homebrew 
-  * [[https://​www.youtube.com/​watch?​v=ChRZJod_vwc|xbox emulator running on L4T]] 
   * [[https://​fluxcoil.net/​software/​switch/​fedora|My older linux@switch notes]]   * [[https://​fluxcoil.net/​software/​switch/​fedora|My older linux@switch notes]]
   * [[https://​fluxcoil.net/​software/​switch/​debian|notes on Debian@switch]]   * [[https://​fluxcoil.net/​software/​switch/​debian|notes on Debian@switch]]
   * [[https://​www.youtube.com/​watch?​v=tmGImw8cs0o|cuda on switch?]]   * [[https://​www.youtube.com/​watch?​v=tmGImw8cs0o|cuda on switch?]]
   * [[https://​www.youtube.com/​watch?​v=_kXtIWThE2A|L4T installation video (uses Windows as base, not Linux)]]   * [[https://​www.youtube.com/​watch?​v=_kXtIWThE2A|L4T installation video (uses Windows as base, not Linux)]]
 +  * [[https://​forum.xda-developers.com/​nintendo-switch/​nintendo-switch-news-guides-discussion--development/​rom-switchroot-lineageos-15-1-t3951389|Android@switch is now also available]],​ thanks to https://​twitter.com/​switchroot_org
 +  * Gentoo/​switch links [[https://​github.com/​bell07/​gentoo-switch_overlay|bell07 overlay]] [[https://​github.com/​GavinDarkglider/​gentoo-switch_overlay|Darkglider overlay]]
 +  * [[/​hardwarerelated/​raspberry_pi_4#​benchmark_results|CPU/​memory performance of Raspberry pi 4, Nintendo switch and a Thinkpad L480]]
 ===== hardware ===== ===== hardware =====
   * cpu:   * cpu:
-    * Nvidia Tegra X1: 4x Cortex-A57, 4x Cortex-A53+    * Nvidia Tegra X1, model T210: 4x Cortex-A57, 4x Cortex-A53 ​(big.LITTLE approach, but Linux kernel 4.16 is just presenting the 4 A57 cores) 
 +    * **note:** several variants of the switch are around, newer ones do not allow to run unsigned code from the RCM. The serial number can be used to check this. [[https://​www.eurogamer.net/​articles/​digitalfoundry-2019-switch-new-tegra-x1-silicon-comes-into-focus|Cpu variant details]]
     * Nvidia Maxwell GPU     * Nvidia Maxwell GPU
     * 4GB LPDDR4 RAM     * 4GB LPDDR4 RAM
Line 30: Line 30:
  
 ===== Todo ===== ===== Todo =====
-  * Try again to recompile L4T kernelsIn the past these did just not boot, I was not able to get the information on '​why'​ out of the booting systemNow it seems like in HDMI-dock, the logs can be seen via HDMI+The Fedora30/​switch build does most of what I need nowJust these things might be interesting to look into: 
-  * Find interesting applications ​to demonstrate?​ supertuxcart?​ +  * 3D is not running properly in all details: supertuxkart do not run, and firefox plays no webgl. [[/​software/​switch/​fedora#​fedora_30_mesa_rebuild_attempts_xorg_3d_support|Investigation details.]] 
-  * Boot Fed30 into xorg/autologin +  * Research CUDA support. Would be awesome ​to utilize ​the tegra cores for image manipulation. Is CUDA here pure graphic, or AI style computing? The switch might be a nice platform for playing with AI code then! The switch Tegra has double the power of the Nvidia Jetson nano board[[https://​elinux.org/​Jetson/​Installing_CUDA|link1]] [[https://​developer.nvidia.com/​embedded/​develop/​software|link2]] [[https://​developer.nvidia.com/​embedded/​jetpack|link3]] 
-  * Automatic screen switching upon docking/undocking + 
-  * Centos7 might be interesting +===== Graphical demos/games ===== 
-  * try for hdmi-soundspeaker-test --channels 2 --rate 48000 --device hw:0,3​+What are people actually using the Nintendo switch/​Linux setups for? Some use it like a workstation on HDMI outputwith the option of undocking and using it on the roadOf course, databases, libreoffice and so on work. Some more graphical ideas to try out: 
 + 
 +{{ https://​fluxcoil.net/​files/​tmp/​20190616_184612_switch2s.jpg?​500x}} 
 + 
 +  * Use chromium (dnf -y install chromium) ​to run WebGL code: 
 +    * https://​phoboslab.org/​wipeout/​ 
 +    * http://​media.tojicode.com/​q3bsp/​ -- quake3 
 +    * http://​madebyevan.com/​webgl-water/​ 
 +  * 'dnf -y install glmark2 extremetuxracer'​ 
 +  * 'dnf install freedoom2'​ also runs nicely: '​prboom -window -iwad /usr/​share/​doom/​freedoom.wad'​. Explicit OpenGL rendering with '​-vidmode gl'. 
 +  * mplayer can play videos fetched with youtube-dl 
 +  * Recompile bb, with the patches from debian. ​ I did not get it compiled with libmikmod though, so no sound: https://​packages.debian.org/​sid/​bb 
 +  * Scummvm with '​Secret of Monkey Island'​ 
 +  * Amiga emulator https://​fs-uae.net/​ : packages just build for x86_64. Rebuilding fails, need to try to build directly. 
 +  * moonlight: streaming windows games to the switch, [[https://​gbatemp.net/​threads/​tutorial-compiling-and-installing-moonlight-embedded-on-l4t-ubuntu.537429/#​post-8619150|details]] 
 +  * running emulators:​ 
 +    * reicast: dreamcast emulator 
 +    * ishiiruka: sega emulator 
 +    * dolphin: gamecube/​wii emulator 
 +    * citra: 3DS emulator 
 +  * Karaoke applications like [[https://​usdx.eu/​|UltraStar Deluxe]] 
 + 
 +===== What works (not)? ===== 
 +  * For a start, setting up Lakka/​switch (a distro intended to run emulators) or the L4T Ubuntu is best for most people. These provide most features, for example audio support via the switch speakers. They can also run sshd, you can connect to wlan and look around. 
 +  * With more work you can also bootstrap Fedora30, details are here in the wiki. I have not published complete images for Fedora30. 
 + 
 +^distro ​          ^wlan ^xorg plain^xorg accelerated^audio^ 
 +|[[https://​lakka-switch.github.io/​documentation/​|Lakka/​switch]] ​    ​|yes ​ | yes  | yes | yes | 
 +|[[https://​gbatemp.net/​threads/​l4t-ubuntu-a-fully-featured-linux-on-your-switch.537301/​|L4T ubuntu]] |yes  | yes  | yes | yes| 
 +|[[/​hardwarerelated/​nintendo_switch#​installing_fedora|Fedora28/​29/​30]]|yes ​ | yes  | yes| yes | 
 +|[[https://​gbatemp.net/​threads/​quick-tuto-how-to-boot-linux-on-your-switch.501918/​|Arch Linux image]]|yes|yes|yes|no| 
 +|[[https://​github.com/​cmsj/​nintendo-switch-ubuntu-builder|Ubuntu 18.04]]|yes ​ | yes  | yes|no | 
 +|[[/​software/​switch/​debian|Debian sid]]       ​|yes ​ | yes  | no |no | 
 +|[[/​software/​switch/​opensuse|openSUSE Tumbleweed]]|yes| yes  | no |no | 
 + 
 + 
 +**Note:** There have been reports of hardware being sold after July 2018where unsigned payloads via USB can no longer be supplied, this prevents running own code like Linux on these models. 
 + 
 ===== Boot order for Linux@switch ===== ===== Boot order for Linux@switch =====
   - As first step, the switch needs to be booted into RCM, an early debug mode. For doing this for the first time, pins on the switch need to be crossed, for example using this [[https://​github.com/​fail0verflow/​shofel2/​tree/​master/​rcm-jig|RCM jig device]]. ​ When this succeeded one time, you can use Hekate to set '​autorcm',​ the switch will then after resets always enter RCM instead of booting Nintendos Horizon.   - As first step, the switch needs to be booted into RCM, an early debug mode. For doing this for the first time, pins on the switch need to be crossed, for example using this [[https://​github.com/​fail0verflow/​shofel2/​tree/​master/​rcm-jig|RCM jig device]]. ​ When this succeeded one time, you can use Hekate to set '​autorcm',​ the switch will then after resets always enter RCM instead of booting Nintendos Horizon.
Line 46: Line 84:
       * it can poweroff the switch       * it can poweroff the switch
     * [[https://​github.com/​fail0verflow/​shofel2|Shovel2]] can be used to upload Linux kernels via USB, coreboot is also here used. Userland to be booted could be on the microsd card, or supplied via NFS.     * [[https://​github.com/​fail0verflow/​shofel2|Shovel2]] can be used to upload Linux kernels via USB, coreboot is also here used. Userland to be booted could be on the microsd card, or supplied via NFS.
 +    * [[https://​github.com/​Guillem96/​argon-nx|ArgonNX]] has more eyecandy than hekate.
 +    * [[https://​wiki.gbatemp.net/​wiki/​List_of_Switch_payloads|This is a list of various payloads]]
   - Which kernel to run? There are basically 2 levels of kernel patches.   - Which kernel to run? There are basically 2 levels of kernel patches.
     * mid-2018 kernel, using the initial patches from Fail0verflow:​ no audio, problems charging the switch, resets when load is high (compile things only with 'make -j1'), wlan only works after one reset of the system. Yet, on this kernel one can see Linux console output directly on the screen after booting. This kernel is great for initially running for example Fedora30, Opensuse or Debian userlands: because you can use the screen to get debugging output, until you get the userland appropriately configured to log into wlan after booting. From that state on you can work via SSH.     * mid-2018 kernel, using the initial patches from Fail0verflow:​ no audio, problems charging the switch, resets when load is high (compile things only with 'make -j1'), wlan only works after one reset of the system. Yet, on this kernel one can see Linux console output directly on the screen after booting. This kernel is great for initially running for example Fedora30, Opensuse or Debian userlands: because you can use the screen to get debugging output, until you get the userland appropriately configured to log into wlan after booting. From that state on you can work via SSH.
Line 51: Line 91:
   - Which userland to run? L4T and Lakka come with kernel/​userland together. The kernels with switch patches can be used on other userlands though, like Fedora30, SuSE, Debian.   - Which userland to run? L4T and Lakka come with kernel/​userland together. The kernels with switch patches can be used on other userlands though, like Fedora30, SuSE, Debian.
  
 +===== Fedora boot order =====
 +2 variants can be used: 
  
-===== What works (not)? ===== +  - loading kernel/​initrd from sdcard 
-  ​* For a start, setting up Lakka/​switch (a distro intended to run emulators) ​or the L4T Ubuntu is best for most people. These provide most features, for example audio support ​via the switch speakersThey can also run sshd, you can connect to wlan and look around. +  ​or via USB.  ​
-  * With more work, you can also bootstrap Fedora30 with the features which L4T/Lakka have. Details are here in the wiki. I have not published complete images for Fedora30.+
  
-^distro ​          ^wlan ^xorg plain^xorg accelerated^audio^ +I use USB so far, it's easier to exchange kernels. Single steps (nicely summed up [[https://​wiki.postmarketos.org/​wiki/​Nintendo_Switch_(nintendo-nx)|here]]):
-|[[https://​lakka-switch.github.io/​documentation/​|Lakka/​switch]] ​    ​|yes ​ | yes  | yes | yes (via TV) | +
-|[[https://​gbatemp.net/​threads/​l4t-ubuntu-a-fully-featured-linux-on-your-switch.537301/​|L4T ubuntu]] |yes  | yes  | yes | yes| +
-|[[/​hardwarerelated/​nintendo_switch#​installing_fedora|Fedora28/​29/​30]]|yes ​ | yes  | yes| yes | +
-|[[https://​gbatemp.net/​threads/​quick-tuto-how-to-boot-linux-on-your-switch.501918/​|Arch Linux image]]|yes|yes|yes|no| +
-|[[https://​github.com/​cmsj/​nintendo-switch-ubuntu-builder|Ubuntu 18.04]]|yes ​ | yes  | yes|no | +
-|[[/​software/​switch/​debian|Debian sid]]       ​|yes ​ | yes  | no |no | +
-|[[/​software/​switch/​opensuse|opensuse Tumbleweed]]|yes| yes  | no |no | +
- +
- +
-**Note:** There have been reports of hardware being sold, where the payload via USB can no longer be supplied after firmware update [[https://​japanese.engadget.com/​2018/​07/​12/​switch/​|here are details]]. +
- +
-===== Fedora boot order ===== +
-2 variants can be used: loading kernel/​initrd from sdcard, or via USB.  ​I use USB so far, it's easier to exchange kernels. Single steps (nicely summed up [[https://​wiki.postmarketos.org/​wiki/​Nintendo_Switch_(nintendo-nx)|here]]:​+
   * Switch booting into to Tegra RCM flashing mode over USB   * Switch booting into to Tegra RCM flashing mode over USB
   * ShofEL2 boots Coreboot   * ShofEL2 boots Coreboot
Line 77: Line 105:
   * U-Boot script decompresses (if comressed kernel) and boots Linux   * U-Boot script decompresses (if comressed kernel) and boots Linux
  
-===== Installing Fedora ===== +===== Installing Fedora ​30 ===== 
-Installing ​Fedora for the switch on the microsd card, using a Fedora30 x86_64 as host. I created DOS style partitions on a 32GB card, and switch between the partitions in modifying the kernel command line. +I am installing ​Fedora for the switch on the microsd card, using a Fedora30 x86_64 as host. I created DOS style partitions on a 32GB card, and switch between the partitions in modifying the kernel command line. First, I installed L4T on the card, this  did setup partitions 1 (vfat) and 2 (ext4, L4T). After increasing the second partition to 16GB, I created a third partition and installed Fedora 30 there.
  
-  * First followed ​[[https://​gbatemp.net/​threads/​quick-tuto-how-to-boot-linux-on-your-switch.501918/​|these steps]] to compile a kernel ​and the required tools These were crosscompiled from Fedora30 x86_64. ​ The latest linaro-crosscompiler did not work, needed to use the older gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabi . +L4T is booting the linux kernel from the card, but am booting Fedora with kernel/​initrd supplied via USB. For this, I have compiled shovel2/​coreboot from [[https://​gbatemp.net/​threads/​quick-tuto-how-to-boot-linux-on-your-switch.501918/​|this guide]]. I also compiled the kernel ​as per these instructions,​ but it has many downsides over the L4T kernel. I am booting Fedora with the L4T kernelDetails on how I boot kernels are [[/software/​switch/​l4t-kernel-compile|here]] 
-  * As for installing the Fedora30 aarch64 userland for the switch, I used Fedora-Server-30-1.2.aarch64.raw.xz. Despite being the server spin, it comes with wpa_supplicant and Networkmanager-wifi.+ 
 +For installing the Fedora30 aarch64 userland for the switch, I used Fedora-Server-30-1.2.aarch64.raw.xz. Despite being the server spin, it comes with packages ​wpa_supplicant and Networkmanager-wifi.
    
 <​code>​ <​code>​
 ### preparing the new partition ### preparing the new partition
 mkfs.ext4 /​dev/​mmcblk0p3 mkfs.ext4 /​dev/​mmcblk0p3
-mount /dev/mmcblk0p4 ​/mnt/tmp3+mount /dev/mmcblk0p3 ​/mnt/tmp3
  
 ### deploying the image ### deploying the image
Line 98: Line 127:
  
 ### preparations ### preparations
-vi /etc/fstab+cd /mnt/tmp3 
 +vi etc/fstab
 # only need this: /​dev/​mmcblk0p3 / ext4 defaults 0 0 # only need this: /​dev/​mmcblk0p3 / ext4 defaults 0 0
  
Line 105: Line 135:
  
 echo switch.local >​etc/​hostname echo switch.local >​etc/​hostname
 +echo '​127.0.0.1 ​  ​switch.local switch'​ >>​etc/​hosts
  
 # disable console on tty1.  We have no input anyway, and can # disable console on tty1.  We have no input anyway, and can
-# see debugmessages that way.+# see debugmessages that way - via HDMI
 mv etc/​systemd/​system/​getty.target.wants/​getty@tty1.service root/ mv etc/​systemd/​system/​getty.target.wants/​getty@tty1.service root/
  
Line 113: Line 144:
 # I have my wlan already setup on my Fedora30 host system, # I have my wlan already setup on my Fedora30 host system,
 # so I can simply copy over the files # so I can simply copy over the files
-cp /etc/NetworkManager/system-connections/​keys-mynetwork \ +cp /etc/sysconfig/network-scripts/​keys-mynetwork \ 
-   /etc/NetworkManager/system-connections/​ifcfg-mynetwork \ +   /etc/sysconfig/network-scripts/​ifcfg-mynetwork \
-    etc/​NetworkManager/​system-connections/​ +
-cp /​etc/​NetworkManager/​system-connections/​keys-mynetwork \ +
-   /​etc/​NetworkManager/​system-connections/​ifcfg-mynetwork \+
     etc/​sysconfig/​network-scripts/​     etc/​sysconfig/​network-scripts/​
  
 # Now we can boot the system. ​ After the reboot, wlan should # Now we can boot the system. ​ After the reboot, wlan should
-# work.  Login via ssh into root, run dnf upgrade, ​and install +# work.  Login via ssh into root, run dnf upgrade, 
-the 2 packages ​cleanly so dnf is aware of them. +remove and install ​packages 
-dnf remove iscsi-initiator-utils-iscsiuio iscsi-initiator-utils clevis-luks+dnf remove iscsi-initiator-utils-iscsiuio iscsi-initiator-utils ​
 +  ​clevis-luks ​atmel-firmware 
 +dnf install -y langpacks-ja upower screen 
 +dnf update -y
  
 for i in auditd smartd pcscd ModemManager multipathd mdmonitor \ for i in auditd smartd pcscd ModemManager multipathd mdmonitor \
-         ​dmraid-activation initial-setup;​ do+         ​dmraid-activation initial-setup ​lvm2-monitor zram-swap \ 
 +         ​plymouth-start lm_sensors udisks2 ​; do
     systemctl disable $i     systemctl disable $i
 done done
  
-dnf install -y langpacks-ja upower screen +### tuning, seen in the L4T scripts 
-dnf update ​-y+cat >/​etc/​rc.local<<​EOT 
 +#​!/​usr/​bin/​bash 
 +echo 2048 > /​sys/​block/​mmcblk0/​queue/​read_ahead_kb 
 +echo 0 > "/​proc/​sys/​vm/​lazy_vfree_pages"​ 
 +EOT 
 +chmod +x /​etc/​rc.local 
 +/​etc/​rc.local 
 +ln -s /​etc/​rc.local /​etc/​rc.d/​rc.local
  
-# if you want rpmfusion+### if you want rpmfusion
 dnf install \ dnf install \
   https://​download1.rpmfusion.org/​free/​fedora/​rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \   https://​download1.rpmfusion.org/​free/​fedora/​rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
Line 140: Line 179:
  
  
-===== Fedora Xorg =====+===== Fedora Xorg/LXDM autologin ​=====
 <​code>​ <​code>​
 ssh root@switch ssh root@switch
  
 +# Install the basic environment.
 dnf -y groupinstall 'Basic Desktop'​ 'LXDE Desktop'​ dnf -y groupinstall 'Basic Desktop'​ 'LXDE Desktop'​
  
Line 150: Line 190:
 # - synergy, so I can use mouse/​keyboard of my linux box # - synergy, so I can use mouse/​keyboard of my linux box
 # - f29-backgrounds,​ because they are awesome :) # - f29-backgrounds,​ because they are awesome :)
-dnf install xvkbd synergy f29-backgrounds-base+dnf install ​-y xvkbd synergy f29-backgrounds-base ​mplayer
  
-# adding the LXDE to the startfile +# Now copying drivers from an L4T installation on partition2:
-echo 'exec /​usr/​bin/​startlxde'​ >​~/​.xinitrc +
- +
-# Now copying drivers from an L4T installation on partition2.+
 mount /​dev/​mmcblk0p2 /mnt/tmp2/ mount /​dev/​mmcblk0p2 /mnt/tmp2/
 cd /mnt/tmp2 cd /mnt/tmp2
Line 163: Line 200:
 cp usr/​lib/​xorg/​modules/​extensions/​libglxserver_nvidia.so \ cp usr/​lib/​xorg/​modules/​extensions/​libglxserver_nvidia.so \
   /​usr/​lib64/​xorg/​modules/​extensions/​   /​usr/​lib64/​xorg/​modules/​extensions/​
 +cp /​mnt/​tmp2/​usr/​bin/​dock-hotplug /usr/bin
  
 mkdir -p /​usr/​lib/​aarch64-linux-gnu mkdir -p /​usr/​lib/​aarch64-linux-gnu
Line 178: Line 216:
 cp -r lib/​firmware/​tegra21x lib/​firmware/​gm20b /​lib/​firmware/​ cp -r lib/​firmware/​tegra21x lib/​firmware/​gm20b /​lib/​firmware/​
 cp lib/​firmware/​bcm4354.hcd /​lib/​firmware/​ cp lib/​firmware/​bcm4354.hcd /​lib/​firmware/​
- 
-# ensure that the screen gets rotated after starting 
-mkdir -p ~/​.config/​autostart 
-cat <<EOT >​~/​.config/​autostart/​.desktop 
-[Desktop Entry] 
-Type=rotater 
-Exec=xrandr --output DSI-0 --rotate left 
-EOT 
  
 # special xorg config # special xorg config
Line 201: Line 231:
     # Allow X server to be started even if no display devices are connected.     # Allow X server to be started even if no display devices are connected.
     Option ​     "​AllowEmptyInitialConfiguration"​ "​true"​     Option ​     "​AllowEmptyInitialConfiguration"​ "​true"​
-        ​Option ​             "​Rotate"​ "​CW"​+    ​Option ​     "​Rotate"​ "​CW"​
 EndSection EndSection
  
 Section "​InputClass"​ Section "​InputClass"​
-        ​Identifier "evdev touchscreen catchall"​ +    ​Identifier "evdev touchscreen catchall"​ 
-        MatchIsTouchscreen "​on"​ +    MatchIsTouchscreen "​on"​ 
-        MatchDevicePath "/​dev/​input/​event*"​ +    MatchDevicePath "/​dev/​input/​event*"​ 
-        Driver "​evdev"​ +    Driver "​evdev"​ 
-        Option "​InvertX"​ "​no"​ +    Option "​InvertX"​ "​no"​ 
-        Option "​InvertY"​ "​no"​ +    Option "​InvertY"​ "​no"​ 
-        Option "​SwapAxes"​ "​no"​ +    Option "​SwapAxes"​ "​no"​ 
-        Option "​Calibration"​ "0 1279 0 719"+    Option "​Calibration"​ "0 1279 0 719"
 EndSection EndSection
 +
 +Section "​Monitor"​
 +    Identifier "​DFP-0"​
 +    Option "​Rotate"​ "​left"​
 +EndSection ​
 EOT EOT
  
-On my system, I use synergy to be able to use keyboard +MYUSER="​lxde"​ 
-# and mouse from a different system. ​ The third line runs +MYUSER="​chris"​ 
-# synergy in client mode. +useradd -m $MYUSER 
-mkdir -p ~/​.config/​lxsession/​LXDE + 
-cat >~/​.config/​lxsession/​LXDE/​autostart<<​EOT+mkdir -p /​home/​$MYUSER/​.config/​lxsession/​LXDE 
 +cat >/​home/​$MYUSER/​.config/​lxsession/​LXDE/​autostart<<​EOT
 @lxpanel --profile LXDE @lxpanel --profile LXDE
 @pcmanfm --desktop --profile LXDE @pcmanfm --desktop --profile LXDE
 @synergy-core --client 192.168.0.3 @synergy-core --client 192.168.0.3
 EOT EOT
 +chown -R $MYUSER /​home/​$MYUSER/​.config
  
-loading firmware +configure autologin 
-# mount /​dev/​mmcblk0p2 /mnt/tmp2 +vi /etc/lxdm/lxdm.conf 
-cd /mnt/tmp2/etc/systemd+# autologin=username ​ # <insert the username which you use 
-./nvwifibt-pre.sh +# session=/​usr/bin/​startlxde
-./nvwifibt.sh+
  
-thenX can be started manually +We need to ensure that our user later appears in the '​who'​ output. 
-startx+# That is important for the /​usr/​bin/​dock-hotplug scriptfor 
 +# switching screens. 
 +echo '​sessreg -a -l $DISPLAY -x /​etc/​X11/​xdm/​Xservers $USER &' >> \ 
 +  /​etc/​lxdm/​PostLogin 
 +echo '​sessreg -d -l $DISPLAY -x /​etc/​X11/​xdm/​Xservers $USER &' >> \ 
 +  /​etc/​lxdm/​PostLogout 
 + 
 +rm -f /​etc/​systemd/​system/​display-manager.service 
 +systemctl enable --now lxdm 
 +systemctl set-default graphical.target
 </​code>​ </​code>​
  
Line 242: Line 287:
 cd /mnt/tmp2 cd /mnt/tmp2
  
-dnf install -y alsa-ucm+dnf install -y alsa-ucm ​alsa-plugins-pulseaudio alsa-utils \ 
 +  pulseaudio pulseaudio-module-x11 pulseaudio-utils pavucontrol
 cp -r usr/​share/​alsa/​ucm/​tegra-snd-t210ref-mobile-rt565x/​ /​usr/​share/​alsa/​ucm/​ cp -r usr/​share/​alsa/​ucm/​tegra-snd-t210ref-mobile-rt565x/​ /​usr/​share/​alsa/​ucm/​
- +cp usr/share/alsa/cards/tegra-hda.conf ​/usr/share/alsa/cards
-# mv /​lib/​firmware/​nvidia /​lib/​firmware/​nvidia.org +
-cp -r lib/firmware/nvidia ​/lib/firmware +
-# cp lib/​firmware/​tegra21x_xusb_firmware /​lib/​firmware +
-# cp lib/​firmware/​nv-BT-Version lib/firmware/bcm4354.hcd ​/lib/firmware+
  
 cp -r opt/nvidia/ /opt/ cp -r opt/nvidia/ /opt/
-cp usr/​sbin/​nv* /usr/sbin/+cp usr/sbin/nv* usr/​sbin/​brcm* /usr/sbin/
 cp -r etc/nv* /etc/ cp -r etc/nv* /etc/
- 
-cp etc/​asound.conf.* /etc/ 
-cp etc/​udev/​rules.d/​90-alsa-asound-tegra.rules \ 
-  etc/​udev/​rules.d/​92-hdmi-audio-tegra.rules /​etc/​udev/​rules.d/​ 
 cp etc/​systemd/​nv* /​etc/​systemd cp etc/​systemd/​nv* /​etc/​systemd
 cp etc/​systemd/​system/​nv*service /​etc/​systemd/​system/​ cp etc/​systemd/​system/​nv*service /​etc/​systemd/​system/​
-cd /​etc/​systemd/​system/​multi-user.target.wants/​ 
-ln -s ../​nv.service ​ 
-ln -s ../​nvargus-daemon.service 
  
-### restores settings +cp etc/asound.conf.* /etc/
-# ln -s ../nvfb-early.service  +
-# ln -s ../nvfb.service ​+
  
-### physical zones service? +ensure that /​etc/​asound.conf is linked to 
-ln -s ../nvphs.service ​ +the appropriate file, depending on whether we are docked or not 
-### nvidia power model tool +cat >/​etc/​udev/​rules.d/92-dp-switch.rules<<​EOT 
-ln -../nvpmodel.service ​ +SUBSYSTEM!="​switch",​ GOTO="​dp_end"​ 
-### NVS-SERVICE Embedded Sensor HAL Daemon +KERNEL!="​dp",​ GOTO="​dp_end"​ 
-ln -../nvs-service.service ​+ATTRS{state}=="​1",​ TEST=="/​proc/​asound/​tegrahda",​ RUN+="/​bin/​ln -sf /etc/asound.conf.tegrahda ​/etc/asound.conf" 
 +ATTRS{state}=="​1",​ TEST=="/​usr/​bin/​dock-hotplug",​ RUN+="/​usr/​bin/​dock-hotplug"​ 
 +ATTRS{state}=="​0",​ TEST=="/​usr/​bin/​dock-hotplug",​ RUN+="/​usr/​bin/​dock-hotplug"​ 
 +ATTRS{state}=="​0",​ TEST=="/​proc/​asound/​tegrasndt210ref",​ RUN+="/​bin/​ln -sf /etc/asound.conf.tegrasndt210ref ​/etc/asound.conf"​ 
 +LABEL="​dp_end"​ 
 +EOT
  
-reboot+reboot
  
 +# for playing via alsa, this has to be active:
 alsamixer # I2S1 Mux -> ADMAIF1 alsamixer # I2S1 Mux -> ADMAIF1
-mplayer+ 
 +# we should now be able to start X, and have sound output: 
 +mplayer ​<​something>​  
 + 
 +# When the switch is docked, the screen should switch to HDMI 
 +# output automatically,​ via profile switch in /​usr/​bin/​dock-hotplug . 
 +# The profile can also be selected via '​pavucontrol'​ from X. 
 + 
 +# also for output testing:  
 +# speaker-test –channels 2 –rate 48000 –device hw:0,3​
 </​code>​ </​code>​
 +
 ===== Fedora/​switch FAQ ===== ===== Fedora/​switch FAQ =====
   * **Q:** Can I use XFS?    * **Q:** Can I use XFS? 
Line 288: Line 337:
   * **Q:** Can I compile kernels on Fedora30?   * **Q:** Can I compile kernels on Fedora30?
   * **A:** I did not succeed to recompile the L4T kernel on Fedora30/​switch with the native GCC9.  Seems like it does not go well with the tegra-specific patches from nvidia. Maybe with GCC8. Or compile custom kernels on L4T/switch, or crosscompile on Linux/​AMD64. As for debugging why a self compiled kernel is not booting: when docked, debug messages can be seen via HDMI output.   * **A:** I did not succeed to recompile the L4T kernel on Fedora30/​switch with the native GCC9.  Seems like it does not go well with the tegra-specific patches from nvidia. Maybe with GCC8. Or compile custom kernels on L4T/switch, or crosscompile on Linux/​AMD64. As for debugging why a self compiled kernel is not booting: when docked, debug messages can be seen via HDMI output.
 +  * **Q:** Why can I not run glxgears?
 +  * **A:** Run '​strace -f -o logg glxgears'​ to see details, might just be a permission issue. Accessing /​dev/​nvhost-ctrl or /dev/nvmap ?
 ===== EL8/aarch64 ===== ===== EL8/aarch64 =====
   * EL8 userland runs ok with the L4T kernel.   * EL8 userland runs ok with the L4T kernel.
Line 314: Line 365:
     * matchbox-window-manager ('/​usr/​bin/​matchbox-window-manager in ~/.xinitrc)     * matchbox-window-manager ('/​usr/​bin/​matchbox-window-manager in ~/.xinitrc)
   * No virtual keyboard x-application seems to be available. So this, or synergy, would have to be compiled and installed by hand.   * No virtual keyboard x-application seems to be available. So this, or synergy, would have to be compiled and installed by hand.
-===== Graphical demos/games ===== + 
-  * 'dnf -y install glmark2 extremetuxracer'​ is a good start +===== Generic hints =====
-  * 'dnf install freedoom2'​ also runs nicely: '​prboom -window -iwad /​usr/​share/​doom/​freedoom.wad'​. Explicit OpenGL rendering with '​-vidmode gl'. +
-  * mplayer can play videos fetched with youtube-dl +
-  * Recompile bb, with the patches from debian. ​ I did not get it compiled with libmikmod though, so no sound: https://​packages.debian.org/​sid/​bb +
-  * scummvm with '​Secret of Monkey Island'​ +
-  * Amiga emulator https://​fs-uae.net/​ : packages just build for x86_64. Rebuilding fails, need to try to build directly. +
-  * moonlight: streaming windows games to the switch, [[https://​gbatemp.net/​threads/​tutorial-compiling-and-installing-moonlight-embedded-on-l4t-ubuntu.537429/#​post-8619150|details]] +
-  * running emulators:​ +
-    * reicast: dreamcast emulator +
-    * ishiiruka: sega emulator +
-    * dolphin: gamecube/​wii emulator +
-    * citra: 3DS emulator +
-===== Generic ​xorg hints =====+
 === touchscreen detection not in sync === === touchscreen detection not in sync ===
-The touchscreen driver will work in horizontal mode by default, but the xorg screen might come up in vertical mode. Fix for LXDE:+The touchscreen driver will work in horizontal mode by default, but the xorg screen might come up in vertical mode. Above xorgs monitor definition should rotate the monitor ​for all Xorg windowmanagers,​ but the rotation could instead also be done at the windowmanager level. ​ Rotating the screen in LXDE:
 <​code>​ <​code>​
 mkdir -p ~/​.config/​autostart mkdir -p ~/​.config/​autostart
Line 337: Line 376:
 Exec=xrandr --output DSI-0 --rotate left Exec=xrandr --output DSI-0 --rotate left
 EOT EOT
 +</​code>​
 +
 +=== booting is slow ===
 +Use systemd to illustrate what takes time at boot, and consider to disable services. Also comparing the graph from Fedora30 with the one from L4T helps. This helped me tremendously getting boottime down, after turning the switch on, it takes now 29sec until the usable LXDE screen of Fedora30. I supply the kernel via usb instead of reading from disk, that is further potential for optimization,​ takes 5.2sec until kernel/​initrd etc. are transferred and the kernel is booted.
 +  * Generate graph: `systemd-analyze plot >​systemd_plot_fed30.svg`
 +  * Open in firefox: `firefox systemd_plot_fed30.svg`
 +
 +=== synergy L4T ===
 +<​code>​
 +# install synergy
 +apt-get install quicksynergy
 +# run this as client
 +/​usr/​bin/​synergyc -f --name switch.local 192.168.0.3
 +# run this if the mouse is not visible
 +gsettings set org.gnome.settings-daemon.plugins.cursor active fa
 +lse
 </​code>​ </​code>​
  
Line 345: Line 400:
   * files initrd: /​lib/​firmware/​tegra21x_xusb_firmware /​lib/​firmware/​tegra210b01_xusb_firmware   * files initrd: /​lib/​firmware/​tegra21x_xusb_firmware /​lib/​firmware/​tegra210b01_xusb_firmware
  
 +=== How to run the synergy server? ===
 +You are running the synergy client for mouse/​keyboard sharing, in the LXDE autostart. But what to run to get the server part? I use this:
 +<​code>​
 +[chris@電脳 ~]$ cat ./​synergy-server.sh ​
 +#​!/​usr/​bin/​bash
 +synergy-core --server --name ThinkPadL480 --config /​home/​chris/​synergy.conf
 +[chris@電脳 ~]$ 
 +[chris@電脳 ~]$ cat synergy.conf ​
 +section: screens
 +        ThinkPadL480:​
 +        switch.local:​
 +end
 +
 +section: links
 +        ThinkPadL480:​
 +                up = switch.local
 +        switch.local:​
 +                down = ThinkPadL480
 +end
 +[chris@電脳 ~]$ 
 +</​code>​
 +
 +=== L4T cleanup ===
 +Steps/​reminders after setting up L4T..
 +<​code>​
 +ssh-copy-add chris@switch
 +echo "alias su='​sudo su -'">>​~/​.bashrc
 +# as root
 +apt-get update
 +apt-get remove --purge kde-window-manager kinit kio kpackagetool5 kwayland-data kwin-common kwin-x11
 +apt-get dist-upgrade
 +apt-get install pv
 +</​code>​
 +
 +=== microsd card benchmark ===
 +Do this in the switch, as the reader is quite good, better than the one in my thinkpad.
 +<​code>​
 +pv /​dev/​mmcblk0 >/​dev/​null
 +Toshiba 32GB 100MB/sec : 80MB/sec
 +LAZOS 32GB             : 65MB/sec
 +</​code>​
 +
 +=== dealing with filesystem corruptions ===
 +I use 2 micro-sd cards, 16GB and 32GB. I run L4T and Fedora30/​L4T-kernel on the 32GB card, and see ext4 corruptions there, on both partitions. Using the RPM checksums to verify:
 +<​code>​
 +for i in $(rpm -qa|sort); do echo "### $i"; rpm -V $i; done  >>​logg
 +egrep -B1 -v '​^#​|\.uuid'​ logg2|grep -c '​^#'​
 +egrep -B1 -v '​^#​|\.uuid'​ logg2|grep '​^#'​
 +</​code>​
 +
 +=== overclocking ===
 +<​code>​
 +# enable overclocking
 +echo 1 >/​sys/​kernel/​tegra_cpufreq/​overclock
 +# set maximum frequency
 +echo 2091000 >/​sys/​devices/​system/​cpu/​cpufreq/​policy0/​scaling_max_freq
 +# cet current frequency
 +cat /​sys/​devices/​system/​cpu/​cpufreq/​policy0/​cpuinfo_cur_freq ​
 +# set governor
 +echo performance >/​sys/​devices/​system/​cpu/​cpufreq/​policy0/​scaling_governor
 +</​code>​
 +
 +=== microsd card not found ===
 +After having the switch not used for some weeks, microsd cards were no longer recognized. Kernels supplied via USB did not find the card/​partitions. Also hekate, when booted as payload via usb, did not find any cards - even ones which worked perfectly fine before. Plugging cards in multiple times/​taking out/​plugging in did apparently clean contacts, and the cards were recognized again.
 ===== Noteworthy games ===== ===== Noteworthy games =====
 The switch is a nice platform for portable gaming, and has many indie game titles. Unfortunately,​ many are not available in all regions. (-J) means: not available when Japan is set as region in the nintendo store. The switch is a nice platform for portable gaming, and has many indie game titles. Unfortunately,​ many are not available in all regions. (-J) means: not available when Japan is set as region in the nintendo store.
Line 357: Line 476:
   * Dead cells / jump'​n'​run (+J)   * Dead cells / jump'​n'​run (+J)
   * Enter the Gungeon (+J)   * Enter the Gungeon (+J)
 +  * Cadence of Hyrule Crypt of the NecroDancer
 +  * Hollow knight
hardwarerelated/nintendo_switch.1560552904.txt · Last modified: 2019/06/15 00:55 by chris