# # Spec file for building an x86_64 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 # Corrected by: Gemini # # Note: This spec file has been simplified to remove non-essential # build dependencies for a basic test build. # REVERTED: Versioning restored to the original scheme. %global mainline_version 6 %global mainline_subversion 16 %global patchlevel 0 %global release_version 1 %global kernel_version %{mainline_version}.%{mainline_subversion}.%{patchlevel} # Use macros for better portability and consistency %global _kernel_name kernel-mainline-ath %global kernel_release %{version}-%{release} Name: %{_kernel_name} Version: %{kernel_version} Release: %{release_version}%{?dist} Summary: The Linux kernel (patched for x86_64) License: GPLv2 and others #Source0: https://github.com/torvalds/linux # 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: bison BuildRequires: flex BuildRequires: python3-devel BuildRequires: grubby BuildRequires: kmod-devel BuildRequires: xz-devel BuildRequires: zlib-devel BuildRequires: glibc-devel BuildRequires: b4 BuildRequires: git BuildRequires: gnupg2 BuildRequires: rsync # CONFIRMED: Build is exclusively for x86_64. ExclusiveArch:  x86_64 %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 for x86_64. # Kernel devel subpackage %package devel Summary: Development files for the Linux kernel Requires: %{name} = %{version}-%{release} Provides: kernel-devel = %{kernel_release} %description devel This package provides the development files needed to build external kernel modules against this specific kernel version. %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 %build # Use the default configuration and build the kernel and its modules cd linux make defconfig # CONFIRMED: Use 'bzImage' target, which is specific to the x86 architecture. NPROCS=$(/usr/bin/getconf _NPROCESSORS_ONLN) make -j${NPROCS} bzImage make -j${NPROCS} modules %install cd linux # Install kernel modules make INSTALL_MOD_PATH=%{buildroot} KERNELRELEASE=%{kernel_release} modules_install # Explicitly create boot and src directories mkdir -p %{buildroot}/boot mkdir -p %{buildroot}/usr/src/kernels/%{kernel_release} # Copy built kernel files # CONFIRMED: Path is specific to x86, which is correct due to ExclusiveArch. cp -v arch/x86/boot/bzImage %{buildroot}/boot/vmlinuz-%{kernel_release} cp -v System.map %{buildroot}/boot/System.map-%{kernel_release} cp -v .config %{buildroot}/boot/config-%{kernel_release} # Install files for kernel-devel package # This correctly includes architecture-specific files needed for module builds. rsync -a ./%{buildroot}/usr/src/kernels/%{kernel_release}/ \ --include='Makefile' \ --include='Module.symvers' \ --include='.config' \ --include='include/***' \ --include='scripts/***' \ --include='arch/x86/include/***' \ --include='arch/x86/Makefile' \ --exclude='*' %post # Use grubby to add the new kernel to the bootloader grubby --add-kernel="/boot/vmlinuz-%{kernel_release}" \ --title="Linux Kernel %{kernel_release}" \ --copy-default \ --make-default %postun # This handles both upgrade and erase if [ $1 -eq 0 ]; then # Only remove on final package erasure grubby --remove-kernel="/boot/vmlinuz-%{kernel_release}" fi %files %defattr(-,root,root,-) /boot/vmlinuz-%{kernel_release} /boot/System.map-%{kernel_release} /boot/config-%{kernel_release} /lib/modules/%{kernel_release}/ %files devel %defattr(-,root,root,-) /usr/src/kernels/%{kernel_release}/ %changelog * Wed Aug 13 2025 Gemini - 6.16.0-1 - Reverted versioning to original scheme as requested. - Confirmed all build and install steps are tailored for x86_64. - Retained critical bug fixes (use 'git am') and safety improvements (removed headers/firmware packages). * Sun Aug 10 2025 Bhargavjit Bhuyan - 6.16.0-1 - Trimmed non-essential build dependencies for a more focused build. - Removed subpackages for debuginfo, documentation, and tools. * Sun Aug 10 2025 FlyingSaturn - 6.16-rc1 - Made some changes