Site Tools


Sidebar

software:switch:fedora

What?

Older notes for Linux@nintendo switch, which I do not yet want to delete. The new hints are here.

201905: attempts to recompile kernels for switch

These did not work out, but storing for reference which issues I hit with each of the approaches.

attempt to compile on Fedora30 userland

Booting old kernel 4.16.0-rc1 with Fed30 userland, then trying to build current L4T kernel as per here

  • building stops with strcpy errors, s/strcpy/memcpy/
  • building with 'make -j2' and higher leads to reboots, that was an issue on that kernel
  • The nvidia-code can eventually not be compiled (not GCC9 compatible?) because of something I could not fix:
/root/buildkernel/kernel/nvgpu/drivers/gpu/nvgpu/common/mm/vm.c:342:2: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
  342 |  strncpy(vm->name, name, min(strlen(name), sizeof(vm->name)));
  • ⇒ fails for me

attempt to run KVM guests on L4T

Failed with:

libvirtError: internal error: process exited while connecting to monitor: 2019-06-02 10:17:39.930+0000: Domain id=1 is tainted: host-cpu
2019-06-02T10:17:40.569376Z qemu-system-aarch64: Initialization of device arm_gic failed: KVM with user space irqchip only works when the host kernel supports KVM_CAP_ARM_USER_IRQ

Fedora hints

For older Fedora, the server spin did not contain 2 packages which are required for wlan. These needed to be downloaded from a mirror and deployed to the image:

# rpm2cpio /tmp/wpa_supplicant-*.aarch64.rpm | \
#    cpio --extract --verbose --make-directories --preserve
# rpm2cpio /tmp/NetworkManager-wifi*.rpm | \
#    cpio --extract --verbose --make-directories --preserve

Fedora30 sound notes

These steps are probably not required, but parking the commands here for a while.

# Now copying drivers from an L4T installation on partition2.
mount /dev/mmcblk0p2 /mnt/tmp2/
cd /mnt/tmp2

# 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

### before reboot, configure services
cd /etc/systemd/system/multi-user.target.wants/

### restores settings, not needed
# ln -s ../nvfb-early.service 
# ln -s ../nvfb.service 

# are following services needed?
#ln -s ../nv.service 
#ln -s ../nvargus-daemon.service

### physical zones service?
#ln -s ../nvphs.service 
### nvidia power model tool
#ln -s ../nvpmodel.service 
### NVS-SERVICE Embedded Sensor HAL Daemon
#ln -s ../nvs-service.service 

Hints for running older kernels

On older kernels, WLAN just became available after a soft reboot. As you can at that point not input anything into the console, a script can be used for reboots. I used this with Fedora28:

mkdir /mnt/tmp
mount /dev/mmcblk0p2 /mnt/tmp
cd /mnt/tmp

# On the switch kernelf from 2018, wlan just worked after a soft reboot of Linux.
# As we can not type in 'reboot', so we did modify /etc/rc.local so
# it does a reboot for us.  Use the following code in /etc/rc.local.
# This is no longer required on L4T kernels from 2019.
------
#!/bin/bash

[ -f /etc/flagfile ] || {
        echo "/etc/flagfile does not exist apparently, touching it and rebooting in 10sec"
        touch /etc/flagfile
        dmesg >/var/log/dmesg1
        sync
        sleep 10
        reboot
}

echo "not rebooting.. and removing flagfile."
rm /etc/flagfile
------
chmod +x etc/rc.local
ln -s /etc/rc.local etc/rc.d/rc.local

LXDE standalone

# adding LXDE to the startfile
echo 'exec /usr/bin/startlxde' >~/.xinitrc

# On my system, I use synergy to be able to use keyboard
# and mouse from a different system.  The third line runs
# synergy in client mode.
mkdir -p ~/.config/lxsession/LXDE
cat >~/.config/lxsession/LXDE/autostart<<EOT
@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@synergy-core --client 192.168.0.3
EOT

# then, X can be started manually
startx

Fedora 28 Xorg 3D support

After installing Fedora 28 as described here, at this point, X can be started, but has no 3D support. Fedora 28 has Tegra support in libdrm and mesa, lets rebuild it.

echo '%_topdir /root/rpmbuild' >~/.rpmmacros

dnf install rpm-build yum-utils rpmdevtools
rpmdev-setuptree

cd ~/rpmbuild
yumdownloader --source libdrm
rpm -ivh libdrm-2.4.92*fc28.src.rpm
cp SPECS/libdrm.spec SPECS/libdrm.spec.org
vi SPECS/libdrm.spec
# We are changing the release, so the Fedora version
# is not getting reinstalled.
# change 'Release:        1%{?dist}' into 'Release:        1.tegra%{?dist}'

# dependencies
dnf install -y docbook-style-xsl gcc kernel-headers \
  libatomic_ops-devel meson valgrind-devel
rpmbuild -ba --with tegra SPECS/libdrm.spec
# pay attention to:
# Message:   Tegra API      true

# Then install the rebuild package.
rpm -Fvh RPMS/aarch64/*2.4.92*
rpm -ql libdrm|grep tegra
/usr/lib64/libdrm_tegra.so.0
/usr/lib64/libdrm_tegra.so.0.0.0

# Now, Fedora28 has only mesa-18.0.1, but we need the current
# pre-18.2 version for tegra support.
# rawhide has mesa-18.1.0-rc3, rebuilding that might work,
# that version has tegra support:
# http://ftp.riken.jp/Linux/fedora/development/rawhide/Everything/source/tree/Packages/m/
# Instead, I used the specfile from rawhides mesa-18.1.0-rc3,
# and compiled the current git version of mesa-18.2-pre.

# Install build dependencies of the mesa-18.0.1 Fed28 package
dnf install -y autoconf automake bison clang-devel \
  elfutils-libelf-devel expat-devel flex gcc-c++ libXdamage-devel \
  libXext-devel libXfixes-devel libXi-devel libXmu-devel \
  libXxf86vm-devel libclc-devel libomxil-bellagio-devel \
  libselinux-devel libtool libudev-devel libva-devel \
  libvdpau-devel libxshmfence-devel llvm-devel makedepend \
  opencl-filesystem python2-libxml2 python2-mako python3-mako \
  xorg-x11-proto-devel libglvnd-devel wayland-protocols

### The custom Ubuntu packages use these options:
# ./configure --prefix=/usr/ --without-dri-drivers \
#  --disable-gallium-llvm --with-gallium-drivers=nouveau,tegra \
#  --enable-gbm --enable-egl --with-egl-platforms=drm,x11 \
#  --enable-gles1 --enable-gles2 --enable-opengl --enable-osmesa \
#  --enable-shared-glapi --enable-dri3 --enable-glx --enable-glx-tls \
#  --enable-texture-float

rpm -ivh mesa-18.1.0-0.2.rc3.fc29.src.rpm
cd /root/rpmbuild
git clone git://anongit.freedesktop.org/git/mesa/mesa
mv mesa mesa-18.2.0-git02c7916298
tar cf mesa-18.2.0-git02c7916298.tar mesa-18.2.0-rc
mv mesa-18.2.0-git02c7916298.tar SOURCES
mv SPECS/mesa.spec SPECS/mesa.spec.org
cd SPECS
wget https://fluxcoil.net/files/tmp/mesa-18.2.0-git02c7916298.spec

rpmbuild -bb mesa-18.2.0-git02c7916298.spec
cd ../RPMS/aarch64/
rpm -Fvh mesa*18.2.0*

# Then start X, and try somesoftware:
startx
glxgears

Fedora 30 mesa rebuild attempts Xorg 3D support

3D setup is not running proper, supertuxkart fails with 'libEGL warning: DRI2: failed too authenticate'. I got hinted that mesa needs to support GLVND, yet mesa-19.0.6-1.fc30 is already compiled with it. Recompiling does not change the issue. Compare compile flags with L4T? The m/mesa/ packages from L4T are original from Ubuntu, not switchroot. chromium on L4T nicely runs webgl sites like https://phoboslab.org/wipeout/

Attempting to rebuild mesa, but I can still not run webgl in firefox.

sudo dnf install rpm-build rpmdevtools

# as user
echo '%_topdir /root/rpmbuild' >~/.rpmmacros
rpmdev-setuptree
cd ~/rpmbuild
dnf download --source mesa mesa-libGLU mesa-libGLw
rpm -ivh mesa-19.0.6-1.fc30.src.rpm

sudo dnf builddep /home/chris/rpmbuild/SPECS/mesa.spec
rpmbuild -bb SPECS/mesa.spec >&rpmbuild.log

# the build is with glvnd:
$ grep -i glvnd rpmbuild.log |grep -v 'USE_LIBGLVND=1'|grep glvnd
[..] -Dglx=dri -Degl=true -Dglvnd=true [..]
Dependency libglvnd found: YES 1.1.0

rpm -Fvh RPMS/aarch64/mesa*
investigations

What is different on Fedora30 and L4T? I compared the buildflags for mesa. rebuilding the Fedora30 rpm, I see these:

+ /usr/bin/meson --buildtype=plain --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin --includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man --infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload --auto-features=enabled . aarch64-redhat-linux-gnu -Dcpp_std=gnu++11 -Dplatforms=x11,wayland,drm,surfaceless -Ddri3=true -Ddri-drivers=nouveau,r100,r200 -Dgallium-drivers=swrast,virgl,r300,nouveau,radeonsi,r600,freedreno,etnaviv,tegra,vc4,kmsro -Dgallium-vdpau=true -Dgallium-xvmc=false -Dgallium-omx=bellagio -Dgallium-va=true -Dgallium-xa=true -Dgallium-nine=true -Dgallium-opencl=icd -Dvulkan-drivers=amd -Dshared-glapi=true -Dgles1=false -Dgles2=true -Dopengl=true -Dgbm=true -Dglx=dri -Degl=true -Dglvnd=true -Dasm=true -Dllvm=true -Dshared-llvm=true -Dvalgrind=true -Dbuild-tests=false -Dselinux=true -Dosmesa=gallium

Here is the log from building the ubuntu mesa packages, this got used:

../configure --build=aarch64-linux-gnu --prefix=/usr --includedir=\${prefix}/include --mandir=\${prefix}/share/man --infodir=\${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=\${prefix}/lib/aarch64-linux-gnu --libexecdir=\${prefix}/lib/aarch64-linux-gnu --runstatedir=/run --disable-maintainer-mode --disable-dependency-tracking --enable-dri "--with-dri-drivers= nouveau r200 radeon" --with-dri-driverdir=/usr/lib/aarch64-linux-gnu/dri --with-dri-searchpath=/usr/lib/aarch64-linux-gnu/dri:\\\$\${ORIGIN}/dri:/usr/lib/dri "--with-vulkan-drivers= radeon" --enable-libglvnd --enable-osmesa --enable-glx-tls --enable-shared-glapi --disable-xvmc --disable-omx-bellagio --enable-driglx-direct --enable-gbm --enable-dri3 "--with-platforms=x11,surfaceless wayland drm" --enable-llvm --enable-opencl --enable-opencl-icd ac_cv_path_LLVM_CONFIG=llvm-config-7 --enable-nine --enable-vdpau --enable-va --enable-gallium-extra-hud --enable-lmsensors "--with-gallium-drivers= nouveau virgl freedreno tegra vc4 v3d r600 r300 radeonsi swrast" --disable-gles1 --enable-gles2

I can not spot relevant differences. Removed the similarities, its down to this:

fedora
-Dgallium-xvmc=false -Dgallium-omx=bellagio -Dgallium-xa=true -Dshared-glapi=true -Dopengl=true -Dglx=dri -Degl=true -Dasm=true -Dvalgrind=true -Dbuild-tests=false -Dselinux=true -Dosmesa=gallium

l4t
 --enable-dri --enable-osmesa --enable-glx-tls --enable-shared-glapi --disable-xvmc --disable-omx-bellagio --enable-driglx-direct --enable-opencl --enable-gallium-extra-hud --enable-lmsensors
software/switch/fedora.txt · Last modified: 2024/03/03 09:50 by chris