%define __brp_mangle_shebangs /usr/bin/true %global kernel switch-kernel- Name: nx-mainline-meta Version: 6.17 Release: 0 License: GPL BuildArch: aarch64 Summary: Mainline linux %{version} kernel and configuration for tegra SOURCE0: https://gitlab.com/l4t-community/gnu-linux/switchroot-pipeline/-/jobs/artifacts/master/raw/nouveau/uImage?job=nouveau#/uImage SOURCE1: https://gitlab.com/l4t-community/gnu-linux/switchroot-pipeline/-/jobs/artifacts/master/raw/nouveau/nx-plat.dtimg?job=nouveau#/nx-plat.dtimg SOURCE2: https://gitlab.com/l4t-community/gnu-linux/switchroot-pipeline/-/jobs/artifacts/master/raw/nouveau/modules.tar.gz?job=nouveau#/modules.tar.gz SOURCE3: https://gitlab.com/l4t-community/gnu-linux/switchroot-pipeline/-/jobs/artifacts/master/raw/nouveau/update.tar.gz?job=nouveau#/update.tar.gz SOURCE4: https://gitlab.com/l4t-community/gnu-linux/switchroot-pipeline/-/jobs/artifacts/master/raw/kernel-%{version}-src.zip?job=nouveau#/kernel-%{version}-src.zip SOURCE5: https://gitlab.com/l4t-community/gnu-linux/switchroot-pipeline/-/jobs/artifacts/master/raw/switchroot-fedoranouveau-boot.zip?job=bootstack_full_fedoranouveau#/switchroot-fedoranouveau-boot.zip SOURCE6: https://gitlab.com/l4t-community/gnu-linux/switchroot-pipeline/-/jobs/artifacts/master/raw/switch_configs/l4s_configs_mainline.tar.gz?job=switch_configs#/l4s_configs_mainline.tar.gz SOURCE7: https://gitlab.com/l4t-community/gnu-linux/switchroot-pipeline/-/jobs/artifacts/master/raw/l4s-bsp-icosa-32.3.1/l4s_bsp_icosa_32.3.1.tar.gz?job=bsp-tx1#/l4s_bsp.tar.gz SOURCE8: wallpaper_fedora.bmp BuildRequires: unzip # Bootstack Requires: nx-boot # Kernel Requires: %{kernel}headers Requires: %{kernel}modules Requires: %{kernel}core Requires: %{kernel}device-tree # Nouveau / GFX drivers Requires: vaapi-tegra-driver Requires: libva-vdpau-driver Requires: libva-utils Requires: nvidia-gpu-firmware Requires: vulkan Requires: xorg-x11-drv-nouveau # Wireless Requires: bluez Requires: iw Requires: wpa_supplicant # Switch configs Requires: switch-configs-mainline # Display #Requires: l4t-initial-setup-gui Requires: xrandr Requires: xinput # Userland support Requires: iio-sensor-proxy Requires: inotify-tools Requires: joycond Requires: libappindicator-gtk3 Requires: xf86-input-joystick Requires: onboard Requires: xbindkeys Requires: chromium Requires: upower Requires: v4l-utils Requires: alsa-utils #Requires: ffmpeg #Requires: ffmpeg-libs Requires: glib2-devel %description Linux kernel %{version} for tegra boards %package -n nx-boot Summary: NX Bootfiles Provides: %{name} = %{version} %description -n nx-boot %{summary} %package -n switch-configs-mainline Summary: Nintendo Switch configs file for mainline %description -n switch-configs-mainline %{summary} %package -n %{kernel}core Summary: Linux %{version} Kernel Image Provides: kernel-core %description -n %{kernel}core Linux %{version} Kernel Image %package -n %{kernel}headers Summary: Linux %{version} Kernel headers Provides: kernel-headers %description -n %{kernel}headers Linux %{version} Kernel headers %package -n %{kernel}modules Summary: Linux %{version} Kernel modules Provides: kernel-modules %description -n %{kernel}modules Linux %{version} Kernel modules %package -n %{kernel}device-tree Summary: Switch device-tree %description -n %{kernel}device-tree Switch device-tree %package -n %{kernel}devel Summary: Linux %{version} Kernel devel package Version: %{version} Release: %{version} Provides: kernel-devel AutoReq: 0 %description -n %{kernel}devel %{summary}. %install # switch-configs-mainline mkdir -p %{buildroot}/boot/switchroot/ %{buildroot}/.boot/bootloader/ %{buildroot}%{_exec_prefix}/lib/ %{buildroot}/%{_usrsrc} %{buildroot}/usr/lib/firmware/nvidia/tegra210/ %{buildroot}/usr/lib/firmware/nvidia/tegra210b01/ %{buildroot}/usr/share/backgrounds/ %{buildroot}/etc/ tar xf %{SOURCE7} cp usr/lib/firmware/tegra21x_xusb_firmware %{buildroot}/usr/lib/firmware/nvidia/tegra210/xusb.bin cp usr/lib/firmware/tegra210b01_xusb_firmware %{buildroot}/usr/lib/firmware/nvidia/tegra210b01/xusb.bin tar xf %{SOURCE6} -C %{buildroot} rm -rf %{buildroot}/opt/l4s/bin/Xsetup \ %{buildroot}/opt/l4s/bin/kill_sddm_osk \ %{buildroot}/opt/l4s/bin/yad \ %{buildroot}/usr/bin/gpu-info-l4t \ %{buildroot}/usr/bin/jc-dump-ltk \ %{buildroot}/usr/bin/mem-bench* \ %{buildroot}/usr/bin/nvidia-xconfig-l4t \ %{buildroot}/usr/bin/r2c \ %{buildroot}/usr/bin/tegrastats-l4t \ %{buildroot}/usr/bin/toggle-osk \ %{buildroot}/etc/profile.d/gsk-renderer.sh \ %{buildroot}/etc/profile.d/firefox.sh \ %{buildroot}/etc/systemd/system/kill-sddm-osk.service \ %{buildroot}/etc/skel/.xbindkeysrc \ %{buildroot}/root/.xbindkeysrc \ %{buildroot}/var/lib/sddm \ %{buildroot}/usr/lib/systemd/system-sleep/20_bluetooth \ %{buildroot}/etc/systemd/system/sddm.service.d \ %{buildroot}/etc/X11/xorg.conf.d/ for dir in $(ls %{buildroot}); do find "/%{buildroot}/${dir}" -not -type d -printf "/${dir}/%%P\n" >> switch-configs-mainline.txt done # Meta touch %{buildroot}/etc/switchroot_version.conf cat << EOF >> %{buildroot}/etc/switchroot_version.conf %{version} EOF install %{SOURCE8} %{buildroot}/usr/share/backgrounds/ # nx-boot unzip %{SOURCE5} cp -r switchroot/fedoranouveau/* %{buildroot}/boot/switchroot/ cp -r bootloader/* %{buildroot}/.boot/bootloader/ # switch-kernel tar xf %{SOURCE2} -C %{buildroot}%{_exec_prefix}/lib/ tar xf %{SOURCE3} -C %{buildroot}/ install -m 755 %{SOURCE0} %{buildroot}/boot/switchroot/ install -m 644 %{SOURCE1} %{buildroot}/boot/switchroot/ # Sources unzip %{SOURCE4} -d %{buildroot}%{_usrsrc} %pre -n nx-boot if [[ ! $(ls /dev/mmcblk0*) ]]; then echo "Running in OBS skipping boot dir mount" exit 0 fi mkdir -p /boot/switchroot /.boot if ! mountpoint -q /.boot && ! mountpoint -q /boot/switchroot; then MMC_BLK="$(cat /proc/cmdline | awk -F 'boot_m=' '{print substr($2,0,1)}' | tr -d '\n')" MMC_PART="$(cat /proc/cmdline | awk -F 'boot_p=' '{print substr($2,0,1)}' | tr -d '\n')" [ -z "${MMC_PART}" ] && MMC_PART=1 if [ -e /dev/mmcblk1 ]; then if [ -n "${MMC_BLK}" ]; then umount /dev/mmcblk"${MMC_BLK}"p"${MMC_PART}" sleep 1 if mount /dev/mmcblk"${MMC_BLK}"p"${MMC_PART}" /.boot/; then BOOT_DEV_FOUND="true"; fi else umount /dev/mmcblk1p1 sleep 1 if mount /dev/mmcblk1p1 /.boot; then BOOT_DEV_FOUND="true"; fi fi else umount /dev/mmcblk0p"${MMC_PART}" sleep 1 if mount /dev/mmcblk0p"${MMC_PART}" /.boot; then BOOT_DEV_FOUND="true"; fi fi if [ "${BOOT_DEV_FOUND}" != "true" ]; then exit 1; fi mount --bind /.boot/switchroot/fedora /boot/switchroot || exit 1 fi %pre -n %{kernel}core if [[ ! $(ls /dev/mmcblk0*) ]]; then echo "Running in OBS skipping boot dir mount" exit 0 fi mkdir -p /boot/switchroot /.boot if ! mountpoint -q /.boot && ! mountpoint -q /boot/switchroot; then MMC_BLK="$(cat /proc/cmdline | awk -F 'boot_m=' '{print substr($2,0,1)}' | tr -d '\n')" MMC_PART="$(cat /proc/cmdline | awk -F 'boot_p=' '{print substr($2,0,1)}' | tr -d '\n')" [ -z "${MMC_PART}" ] && MMC_PART=1 if [ -e /dev/mmcblk1 ]; then if [ -n "${MMC_BLK}" ]; then umount /dev/mmcblk"${MMC_BLK}"p"${MMC_PART}" sleep 1 if mount /dev/mmcblk"${MMC_BLK}"p"${MMC_PART}" /.boot/; then BOOT_DEV_FOUND="true"; fi else umount /dev/mmcblk1p1 sleep 1 if mount /dev/mmcblk1p1 /.boot; then BOOT_DEV_FOUND="true"; fi fi else umount /dev/mmcblk0p"${MMC_PART}" sleep 1 if mount /dev/mmcblk0p"${MMC_PART}" /.boot; then BOOT_DEV_FOUND="true"; fi fi if [ "${BOOT_DEV_FOUND}" != "true" ]; then exit 1; fi mount --bind /.boot/switchroot/fedora /boot/switchroot || exit 1 fi %pre -n %{kernel}device-tree if [[ ! $(ls /dev/mmcblk0*) ]]; then echo "Running in OBS skipping boot dir mount" exit 0 fi mkdir -p /boot/switchroot /.boot if ! mountpoint -q /.boot && ! mountpoint -q /boot/switchroot; then MMC_BLK="$(cat /proc/cmdline | awk -F 'boot_m=' '{print substr($2,0,1)}' | tr -d '\n')" MMC_PART="$(cat /proc/cmdline | awk -F 'boot_p=' '{print substr($2,0,1)}' | tr -d '\n')" [ -z "${MMC_PART}" ] && MMC_PART=1 if [ -e /dev/mmcblk1 ]; then if [ -n "${MMC_BLK}" ]; then umount /dev/mmcblk"${MMC_BLK}"p"${MMC_PART}" sleep 1 if mount /dev/mmcblk"${MMC_BLK}"p"${MMC_PART}" /.boot/; then BOOT_DEV_FOUND="true"; fi else umount /dev/mmcblk1p1 sleep 1 if mount /dev/mmcblk1p1 /.boot; then BOOT_DEV_FOUND="true"; fi fi else umount /dev/mmcblk0p"${MMC_PART}" sleep 1 if mount /dev/mmcblk0p"${MMC_PART}" /.boot; then BOOT_DEV_FOUND="true"; fi fi if [ "${BOOT_DEV_FOUND}" != "true" ]; then exit 1; fi mount --bind /.boot/switchroot/fedora /boot/switchroot || exit 1 fi # Initramfs %posttrans -n %{kernel}core dracut --kver '%{version}-nx+' --force -H --hostonly-mode=strict --kernel-cmdline="rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0" /boot/switchroot/initramfs.tmp mkimage -A arm64 -O linux -T ramdisk -C gzip -d /boot/switchroot/initramfs.tmp /boot/switchroot/initramfs rm /boot/switchroot/initramfs.tmp %posttrans -n %{kernel}devel ln -sfn %{_usrsrc}/kernel-nouveau %{_usrsrc}/linux %posttrans -n switch-configs-mainline if [ ! $(grep -q "/dev/root" /etc/fstab) ]; then echo "/dev/root / ext4 defaults 0 1" > /etc/fstab fi if [ ! $(grep -q "NVK_I_WANT_BROKEN_VULKAN_DRIVER=1" /etc/environment) ]; then echo "NVK_I_WANT_BROKEN_VULKAN_DRIVER=1" >> /etc/environment fi flatpak override --device=all flatpak override --share=network flatpak override --filesystem=/sys flatpak override --env=NVK_I_WANT_BROKEN_VULKAN_DRIVER=1 su - $SUDO_USER -c "flatpak override --user --device=all" su - $SUDO_USER -c "flatpak override --user --share=network" su - $SUDO_USER -c "flatpak override --user --filesystem=/sys" su - $SUDO_USER -c "flatpak override --user --env=NVK_I_WANT_BROKEN_VULKAN_DRIVER=1" %post systemctl enable bluetooth NetworkManager upower wpa_supplicant sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux touch /etc/systemd/zram-generator.conf ln -sfn /dev/null /etc/udev/rules.d/61-gdm.rules %files %dir /usr/share/backgrounds/ /usr/share/backgrounds/wallpaper_fedora.bmp /etc/switchroot_version.conf %files -n nx-boot /boot/switchroot/bl*.bin /boot/switchroot/*.bmp /boot/switchroot/boot.scr /.boot/bootloader/* %files -n switch-configs-mainline -f %{name}.txt %files -n %{kernel}core /boot/switchroot/uImage %files -n %{kernel}modules %{_exec_prefix}/lib/modules/* %files -n %{kernel}headers %{_includedir}/* %files -n %{kernel}device-tree /boot/switchroot/nx-plat.dtimg %files -n %{kernel}devel %{_usrsrc}/kernel-nouveau/* %changelog %{autochangelog}