# SPDX-License-Identifier: GPL-2.0-or-later # # Kernel SRPM for the AYANEO Pocket DS (Snapdragon 8 Gen 2 / SM8550 / qcs8550). # # Aggressively trimmed from upstream Fedora's multi-arch / multi-variant # kernel.spec: this build is aarch64-only, single-variant (stock), single # device (Pocket DS), and uses one config (rocknix-linux.aarch64.conf). # # Boot artefact: /boot/Image — an Android-style boot.img v0 produced by # mkbootimg, wrapping gzip(arch/arm64/boot/Image) ++ qcs8550-ayaneo-pocketds.dtb # with a baked-in kernel cmdline. The ROCKNIX-signed Qualcomm ABL loads # that file directly off the FAT ROCKNIX partition (\boot\Image), # extracts the kernel + DTB, and jumps. No UKI, no vmlinuz.efi. # # The raw Image is also installed at /lib/modules//Image (no /boot/ # duplicate) so kernel-install / recovery flows can find a non-wrapped # kernel matching the modules tree. # # DTBs: built from the in-tree arch/arm64/boot/dts/qcom/qcs8550-*.dts files # already present on the linux-pocketds:pocketds/v7.0 branch (the rocknix # patches are upstream of that branch — no patch application needed here). %global package_name kernel %global tarfile_release 7.0 # Don't generate kernel-debuginfo / kernel-debugsource subpackages. The kernel # is built with -g but we ship it as-is in /boot/Image; producing debuginfo # RPMs requires a -debuginfo subpackage definition with %files, which we # deliberately don't carry. Without these stubs rpmbuild's auto-debugsource # step fails with "Empty %files file debugsourcefiles.list". %global debug_package %{nil} %global _enable_debug_packages 0 %global _build_id_links none Name: %{package_name} Version: 7.0.0 # `.pocketds` suffix bumps NVR above Fedora's vanilla kernel-7.0.0-62.fc44 # so that mkosi (and dnf in general) installs our rocknix-patched + # boot.img-wrapped kernel rather than the upstream Fedora signed build. Release: 62.pocketds%{?dist} Summary: Linux kernel for the AYANEO Pocket DS (SM8550) License: GPL-2.0-only WITH Linux-syscall-note URL: https://gitlab.com/linux-pocketds/linux ExclusiveArch: aarch64 ExclusiveOS: Linux # Pre-patched kernel tree (rocknix patches + qcs8550-*.dts files already in tree) Source0: https://gitlab.com/linux-pocketds/linux/-/archive/pocketds/v%{tarfile_release}/linux-pocketds-v%{tarfile_release}.tar.gz#/linux-%{tarfile_release}.tar.gz Source1: rocknix-linux.aarch64.conf BuildRequires: bash bc bison binutils diffutils elfutils-devel findutils flex BuildRequires: gawk gcc gcc-c++ gettext-devel git-core hostname kmod make BuildRequires: ncurses-devel net-tools openssl openssl-devel patch perl-interpreter BuildRequires: python3-devel rsync tar which xz zlib-devel BuildRequires: dtc # android-tools provides /usr/bin/mkbootimg which we use to wrap the kernel # + DTB into a v0 boot.img header that the ROCKNIX-signed ABL consumes. BuildRequires: android-tools Requires: coreutils Requires: systemd >= 203 Requires: linux-firmware Provides: kernel-uname-r = %{version}-%{release}.%{_arch} Provides: kernel-modules = %{version}-%{release} Provides: kernel-modules-core = %{version}-%{release} Provides: kernel-modules-extra = %{version}-%{release} Provides: kernel-core = %{version}-%{release} Provides: installonlypkg(kernel) %define KernelVer %{version}-%{release}.%{_arch} %define image_install_path boot %define hdrarch arm64 %define asmarch arm64 %description The Linux kernel built for the AYANEO Pocket DS handheld. Single-variant, aarch64-only, configured from rocknix-linux.aarch64.conf. Installs an Android-style boot.img (kernel + DTB + cmdline) at /boot/Image; the ROCKNIX-signed ABL chain-loads that directly off the FAT ROCKNIX partition. %package devel Summary: Development files for building modules against the Pocket DS kernel Provides: kernel-devel = %{version}-%{release} Provides: kernel-devel-uname-r = %{KernelVer} Requires: kernel-uname-r = %{KernelVer} %description devel Headers, Makefiles, and scripts for building external modules against the Pocket DS kernel. # ---------------------------------------------------------------- prep ---- %prep %setup -q -n linux-pocketds-v%{tarfile_release} # Drop the .config in place cp %{SOURCE1} .config # Substitute ROCKNIX build-system placeholders that their image-builder # normally fills in via sed: # @INITRAMFS_SOURCE@ — path to a cpio source for an embedded initramfs. # We don't ship one (raw /boot/Image boot, no initrd # in the kernel image), so blank it out. # @DEVICENAME@ — the device hostname baked into the kernel. sed -i \ -e 's|"@INITRAMFS_SOURCE@"|""|' \ -e 's|"@DEVICENAME@"|"pocketds"|' \ .config # Fix Makefile typo in upstream linux-pocketds tree: `dtb-y` entries must # reference the *compiled* .dtb name, not the .dts source. With `.dts` the # build invokes dtc but `dtbs_install` copies the source instead of the # compiled blob. sed -i 's|qcs8550-ayaneo-pocketds\.dts$|qcs8550-ayaneo-pocketds.dtb|' \ arch/arm64/boot/dts/qcom/Makefile # Make sure setlocalversion can't append a +/-dirty suffix. touch .scmversion rm -f localversion-next localversion-rt # --------------------------------------------------------------- build ---- %build make ARCH=%{asmarch} olddefconfig # Pin the build salt so module signatures and modules.builtin reference KernelVer perl -p -i -e "s/^CONFIG_BUILD_SALT.*/CONFIG_BUILD_SALT=\"%{KernelVer}\"/" .config make %{?_smp_mflags} ARCH=%{asmarch} \ KCFLAGS="$KCFLAGS" \ KERNELRELEASE=%{KernelVer} \ Image modules dtbs # ------------------------------------------------------------- install ---- %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/boot mkdir -p $RPM_BUILD_ROOT/lib/modules/%{KernelVer} # Raw arm64 kernel — kept under /lib/modules//Image so kernel-install # / dracut / recovery flows can find the unwrapped kernel matching the # modules tree. The bootable artefact at /boot/Image is the wrapped # boot.img produced below. install -m 0644 arch/arm64/boot/Image $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/Image # ROCKNIX-style boot.img — gzip(Image) ++ DTB inside an mkbootimg v0 header. # The ABL parses the header, extracts the kernel.gz + DTB into RAM, and # jumps. Cmdline is baked here because direct-Image boot has no other # mechanism to inject one. Mirror this in image/mkosi.conf if you change # it. _abltmp=$(mktemp -d) gzip -c arch/arm64/boot/Image > ${_abltmp}/kernel.gz cat arch/arm64/boot/dts/qcom/qcs8550-ayaneo-pocketds.dtb \ >> ${_abltmp}/kernel.gz printf "dummy" > ${_abltmp}/ramdisk mkbootimg \ --kernel ${_abltmp}/kernel.gz \ --ramdisk ${_abltmp}/ramdisk \ --kernel_offset 0x00000000 \ --ramdisk_offset 0x00000000 \ --tags_offset 0x00000000 \ --os_version 12.0.0 \ --os_patch_level "$(date '+%%Y-%%m')" \ --header_version 0 \ --cmdline "quiet rootwait console=tty0 allow_mismatched_32bit_el0 fw_devlink.strict=1 pcie_ports=compat irqaffinity=0-2 cgroup.memory=nokmem,nosocket nosoftlockup usbcore.interrupt_interval_override=045e:028e:2 root=PARTLABEL=STORAGE rw" \ -o $RPM_BUILD_ROOT/boot/Image rm -rf ${_abltmp} # Config + System.map — diagnostic + module dep resolution install -m 0644 .config $RPM_BUILD_ROOT/boot/config-%{KernelVer} install -m 0644 .config $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/config install -m 0644 System.map $RPM_BUILD_ROOT/boot/System.map-%{KernelVer} install -m 0644 System.map $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/System.map # DTBs — install ALL DTBs the kernel built, then prune to keep only the # Pocket DS one. The rocknix .config has CONFIG_ARCH_QCOM=y which makes # Kbuild compile every Qualcomm DTB (~700 of them, ~30MB) — we only need # qcs8550-ayaneo-pocketds.dtb on the FAT ROCKNIX partition. Mirror the # trimmed tree under /lib/modules//dtb/ for any consumer that # walks the modules dir. mkdir -p $RPM_BUILD_ROOT/boot/dtb-%{KernelVer} make ARCH=%{asmarch} INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/boot/dtb-%{KernelVer} dtbs_install find $RPM_BUILD_ROOT/boot/dtb-%{KernelVer} -type f \ ! -name 'qcs8550-ayaneo-pocketds.dtb' -delete find $RPM_BUILD_ROOT/boot/dtb-%{KernelVer} -type d -empty -delete mkdir -p $RPM_BUILD_ROOT/boot/dtb-%{KernelVer}/qcom cp -r $RPM_BUILD_ROOT/boot/dtb-%{KernelVer} $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/dtb # Kernel modules make %{?_smp_mflags} ARCH=%{asmarch} \ INSTALL_MOD_PATH=$RPM_BUILD_ROOT \ KERNELRELEASE=%{KernelVer} \ modules_install mod-fw= # Drop module symlinks pointing at the build root (rebuilt by kernel-devel) rm -f $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build rm -f $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/source # kernel-devel: headers + Makefile / Kconfig / scripts to build out-of-tree mkdir -p $RPM_BUILD_ROOT/usr/src/kernels/%{KernelVer} DEVEL=$RPM_BUILD_ROOT/usr/src/kernels/%{KernelVer} cp --parents $(find -type f \( -name "Makefile*" -o -name "Kconfig*" \)) $DEVEL/ cp Module.symvers $DEVEL/ cp System.map $DEVEL/ cp .config $DEVEL/ cp -a include $DEVEL/ cp -a scripts $DEVEL/ mkdir -p $DEVEL/arch/arm64 cp -a arch/arm64/include $DEVEL/arch/arm64/ cp -a arch/arm64/Makefile $DEVEL/arch/arm64/ cp -a arch/arm64/Kconfig $DEVEL/arch/arm64/ 2>/dev/null || : # Symlink build/source -> kernel-devel tree ln -s /usr/src/kernels/%{KernelVer} $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build ln -s /usr/src/kernels/%{KernelVer} $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/source # Initramfs placeholder so dnf/rpm reserves boot space (~40 MiB) dd if=/dev/zero of=$RPM_BUILD_ROOT/boot/initramfs-%{KernelVer}.img bs=1M count=40 # Run depmod against the staged tree /sbin/depmod -aeF $RPM_BUILD_ROOT/boot/System.map-%{KernelVer} \ -b $RPM_BUILD_ROOT %{KernelVer} # ----------------------------------------------------------- post-scripts ---- %post if [ -x /usr/bin/kernel-install ]; then /usr/bin/kernel-install add %{KernelVer} /lib/modules/%{KernelVer}/Image || : fi %postun if [ -x /usr/bin/kernel-install ]; then /usr/bin/kernel-install remove %{KernelVer} || : fi # --------------------------------------------------------------- files ---- %files %defattr(-,root,root) /boot/Image /boot/config-%{KernelVer} /boot/System.map-%{KernelVer} /boot/dtb-%{KernelVer} %ghost /boot/initramfs-%{KernelVer}.img /lib/modules/%{KernelVer} %files devel %defattr(-,root,root) /usr/src/kernels/%{KernelVer} %changelog * Fri May 01 2026 Pocket DS Maintainers - 7.0.0-62 - Rebase on upstream Fedora kernel 7.0.0-62 source tree - Slim spec to single-arch (aarch64) / single-variant / single-device build - Boot artefact is /boot/Image (raw arm64 Image), no UKI / vmlinuz.efi - Config: rocknix-linux.aarch64.conf