# Maintainer: Azkali Manad Name: l4s-bsp-kernel Version: 32.3.1 Release: 29.346 License: GPL-2.0-only Summary: L4S custom BSP ExclusiveArch: aarch64 BuildRequires: unzip BuildRequires: tar BuildRequires: gzip %undefine __brp_mangle_shebangs # Sources SOURCE0: https://gitlab.com/api/v4/projects/58434590/jobs/artifacts/master/download?job=32.3.1#/artifacts.zip SOURCE1: https://gitlab.com/api/v4/projects/58444390/jobs/artifacts/master/raw/initramfs?job=build#/initramfs %prep unzip %{SOURCE0} %define kernel switch-kernel %define kernel_ver 4.9.140 %description %{summary}. # Kernel packages %package -n %{kernel}-core Summary: Linux %{kernel_ver} Kernel Image Version: %{kernel_ver} Release: %{release} Requires: %{kernel}-modules = %{kernel_ver}-%{release} Requires: switch-bootfiles Requires: uboot-tools Requires: gdisk %description -n %{kernel}-core %{summary}. %package -n %{kernel}-headers Summary: Linux %{kernel_ver} Kernel headers Version: %{kernel_ver} Release: %{release} Provides: kernel-headers %description -n %{kernel}-headers %{summary}. %package -n %{kernel}-modules Summary: Linux %{kernel_ver} Kernel modules Version: %{kernel_ver} Release: %{release} Requires: %{kernel}-core = %{kernel_ver}-%{release} Provides: kernel-modules %description -n %{kernel}-modules %{summary}. %package -n %{kernel}-devel Summary: Linux %{kernel_ver} Kernel devel package Version: %{kernel_ver} Release: %{release} Provides: kernel-devel AutoReq: 0 %description -n %{kernel}-devel %{summary}. %package -n %{kernel}-switch-device-tree Summary: Switch device-tree Version: %{kernel_ver} Release: %{release} Requires: %{kernel}-core = %{kernel_ver}-%{release} %description -n %{kernel}-switch-device-tree %{summary}. %package -n %{kernel}-switch-initramfs Summary: Switch initramfs Version: %{kernel_ver} Release: %{release} Requires: %{kernel}-core = %{kernel_ver}-%{release} %description -n %{kernel}-switch-initramfs %{summary}. %install cd %{buildroot} mkdir -p %{buildroot}/boot/switchroot %{buildroot}%{_exec_prefix}/lib %{buildroot}%{_usrsrc} %{buildroot}%{_exec_prefix}/lib/aarch64-linux-gnu/tegra/ %{buildroot}/etc/ld.so.conf.d/ # Kernel install -m 755 %{_builddir}/uImage %{buildroot}/boot/switchroot install -m 644 %{_builddir}/nx-plat.dtimg %{buildroot}/boot/switchroot # Kernel modules tar xf %{_builddir}/modules.tar.gz -C %{buildroot}%{_exec_prefix}/lib/ find %{buildroot}%{_exec_prefix}/lib/ \( -type f -o -type l \) | awk -F %{buildroot} '{print $2}' > %{_builddir}/swr-%{kernel}-modules # Kernel headers tar xf %{_builddir}/update.tar.gz -C %{buildroot} find %{buildroot}%{_includedir} \( -type f -o -type l \) | awk -F %{buildroot} '{print $2}' > %{_builddir}/swr-%{kernel}-headers # Kernel devel unzip %{_builddir}/kernel-4.9-src.zip -d %{buildroot}%{_usrsrc} find %{buildroot}%{_usrsrc} \( -type f -o -type l \) | awk -F %{buildroot} '{print $2}' > %{_builddir}/%{kernel}-devel # Initramfs install -m 644 %{SOURCE1} %{buildroot}/boot/switchroot/initramfs %pre -n %{kernel}-core # Offline image installs must not mount the build host's MMC devices. if [ ! -d /run/systemd/system ] || systemd-detect-virt --chroot --quiet; then exit 0 fi [ -b /dev/mmcblk0 ] || exit 0 mkdir -p /boot/switchroot /.boot if ! mountpoint -q /boot/switchroot; then if ! mountpoint -q /.boot; 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 fi BOOT_DIR=switchroot/fedora for argument in $(cat /proc/cmdline); do case "$argument" in swr_dir=*) BOOT_DIR="${argument#swr_dir=}" ;; esac done BOOT_DIR="${BOOT_DIR#/}" BOOT_DIR="${BOOT_DIR%/}" case "$BOOT_DIR" in switchroot/*) BOOT_EDITION="${BOOT_DIR#switchroot/}" ;; *) exit 1 ;; esac case "$BOOT_EDITION" in ""|*[!a-zA-Z0-9_-]*) echo "Invalid boot directory: $BOOT_DIR"; exit 1 ;; esac mount --bind "/.boot/$BOOT_DIR" /boot/switchroot || exit 1 fi %pre -n %{kernel}-switch-device-tree # Offline image installs must not mount the build host's MMC devices. if [ ! -d /run/systemd/system ] || systemd-detect-virt --chroot --quiet; then exit 0 fi [ -b /dev/mmcblk0 ] || exit 0 mkdir -p /boot/switchroot /.boot if ! mountpoint -q /boot/switchroot; then if ! mountpoint -q /.boot; 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 fi BOOT_DIR=switchroot/fedora for argument in $(cat /proc/cmdline); do case "$argument" in swr_dir=*) BOOT_DIR="${argument#swr_dir=}" ;; esac done BOOT_DIR="${BOOT_DIR#/}" BOOT_DIR="${BOOT_DIR%/}" case "$BOOT_DIR" in switchroot/*) BOOT_EDITION="${BOOT_DIR#switchroot/}" ;; *) exit 1 ;; esac case "$BOOT_EDITION" in ""|*[!a-zA-Z0-9_-]*) echo "Invalid boot directory: $BOOT_DIR"; exit 1 ;; esac mount --bind "/.boot/$BOOT_DIR" /boot/switchroot || exit 1 fi # Initramfs #%posttrans -n %{kernel}-core #dracut --kver '%{kernel_ver}-l4t+' --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 kernel-4.9 %{_usrsrc}linux %files -n %{kernel}-core /boot/switchroot/uImage %files -n %{kernel}-switch-device-tree /boot/switchroot/nx-plat.dtimg %files -n %{kernel}-devel %{_usrsrc} %files -n %{kernel}-headers -f %{_builddir}/swr-%{kernel}-headers %files -n %{kernel}-modules -f %{_builddir}/swr-%{kernel}-modules %files -n %{kernel}-switch-initramfs /boot/switchroot/initramfs %changelog * Sat Oct 31 2026 azkali - 32.3.1-29 - Rotate the boot console to match the panel orientation. * Sat Oct 31 2026 azkali - 32.3.1-28 - Ship the initramfs that skips the boot logo without splash. * Sun Oct 18 2026 azkali - 32.3.1-27 - Guard offline package installs and restrict builds to aarch64.