# Spec file for building a mainline Linux kernel with a custom configuration. # This file is for a personal or test build and is not a full-featured Fedora kernel spec. # # Author: Bhargavjit Bhuyan # # Note: This spec file has been simplified to remove non-essential # build dependencies for a basic test build. %global mainline_version 6 %global mainline_subversion 16 %global patchlevel 0 %global kernel_version %{mainline_version}.%{mainline_subversion}.%{patchlevel} %global release_version 1 # Use macros for better portability and consistency %global _kernel_name kernel-mainline-ath %global _kernel_release_name %{version}-%{release} Name: %{_kernel_name} Version: %{kernel_version} Release: %{release_version}%{?dist} Summary: The Linux kernel (patched) License: GPLv2 and others Source0: kernel-x86_64-fedora.config # Minimized list of essential BuildRequires for a core kernel and modules. BuildRequires: gcc BuildRequires: make BuildRequires: python3 BuildRequires: bc BuildRequires: elfutils-libelf-devel BuildRequires: ncurses-devel BuildRequires: openssl-devel BuildRequires: rpm-build BuildRequires: bison BuildRequires: flex BuildRequires: python3-devel BuildRequires: grubby BuildRequires: kmod BuildRequires: xz BuildRequires: zlib-devel BuildRequires: glibc-devel BuildRequires: b4 BuildRequires: git BuildRequires: dracut BuildRequires: gpg BuildRequires: gnupg2 ExclusiveArch: x86_64 # Use a macro and shell test to conditionally set a value, which is # compatible with strict spec file parsers. %global with_firmware %(test -d firmware && echo 1 || echo 0) %description The Linux kernel, the core of the Linux operating system. This package contains a specific build of the mainline kernel from the 'ath' git tree. # Kernel headers subpackage %package headers Summary: Header files for the Linux kernel BuildArch: noarch Provides: kernel-headers = %{version}-%{release} %description headers This package provides the kernel header files. These header files are used by glibc to build user-space applications. # Kernel devel subpackage %package devel Summary: Development files for the Linux kernel Requires: kernel-headers = %{version}-%{release} Provides: kernel-devel = %{version}-%{release} %description devel This package provides the development files needed to build external kernel modules. # Conditionally define the firmware package %if 0%{?with_firmware} # Firmware subpackage %package firmware Summary: Firmware files for the Linux kernel BuildArch: noarch %description firmware This package contains the firmware binary blobs required by the Linux kernel. %endif # The following subpackages and their related sections have been removed: # - debuginfo (requires dwarves, etc.) # - doc (requires asciidoc, etc.) # - tools and tools-devel (requires rsync, pciutils-devel, etc.) %prep git clone https://github.com/torvalds/linux.git cd linux git checkout -b aspm-patch 19272b37aa4f83ca52bdf9c16d5d81bdd1354494 b4 am 20250716-ath-aspm-fix-v1-0-dd3e62c1b692@oss.qualcomm.com && mv *.mbx aspm-patch.mbx git apply aspm-patch.mbx cp %{SOURCE0} ./.config # pwd %build # Change into the kernel source directory cd linux NPROCS=$(/usr/bin/getconf _NPROCESSORS_ONLN) # Use the configuration from the custom config file. make olddefconfig # Now build the kernel and modules with the complete configuration. make -j${NPROCS} bzImage make -j${NPROCS} modules %install # Change into the kernel source directory before installing cd linux # Install kernel modules make INSTALL_MOD_PATH=%{buildroot} modules_install # Explicitly create boot directory mkdir -p %{buildroot}/boot # Copy built kernel files cp -v arch/x86/boot/bzImage %{buildroot}/boot/vmlinuz-%{