# This spec file is designed to build a custom kernel RPM package. # It assumes you have a 'build_kernel.sh' script that handles the entire build process. # --- Preamble Section --- # General information about the package. Name: kernel-ath Version: 6.16.0_400 Release: 1%{?dist} Summary: Custom built Linux kernel License: GPLv2 Group: System Environment/Kernel URL: http://www.yourdomain.com BuildRequires: make, gcc, openssl-devel, elfutils-libelf-devel, python3-devel BuildRequires: %{_bindir}/bash BuildArch: x86_64 Source0: linux-ath-next # A more detailed description of the package. %description This package contains a custom-built Linux kernel for the x86_64 architecture. It was compiled using a custom build script. # --- Preparation Section --- # This section prepares the sources for building. # It assumes your build_kernel.sh script and the kernel source are in the # same directory as this spec file when you run rpmbuild. %prep # Unpack the source tarball. Assuming the source is in a directory named # 'kernel-source'. You may need to adjust this. # For simplicity, we assume your `build_kernel.sh` script and kernel source # are already in the source directory. # If your build script is in a separate file, you should copy it here. # For example: cp %{_sourcedir}/build_kernel.sh . # --- Build Section --- # This is the core section where your build script is executed. %build # Navigate to the source directory and run the build script. # IMPORTANT: This command is a placeholder. You must ensure your # build_kernel.sh script is executable and located correctly. # It's good practice for the build script to use the buildroot directory, # e.g., %{_builddir}/%{name}-%{version}, as its working directory. ./build-kernel.sh # --- Install Section --- # This section copies the built files into the destination directory. # This is a critical part and requires you to know where your `build_kernel.sh` # places the output files (vmlinuz, System.map, .config, modules). %install # Create the necessary directories in the build root. mkdir -p %{buildroot}/boot mkdir -p %{buildroot}/lib/modules # The following lines are ASSUMPTIONS about your build script's output. # You will likely need to adjust the source paths (%{_builddir}/...) # to match where your `build_kernel.sh` places the files. # Copy the kernel image cp ./arch/x86_64/boot/bzImage %{buildroot}/boot/vmlinuz-%{version} # Copy the System.map file cp ./System.map %{buildroot}/boot/System.map-%{version} # Copy the kernel configuration cp ./.config %{buildroot}/boot/config-%{version} # Install modules (usually handled by 'make modules_install') # If your build script does not run 'make modules_install' for you, # you will need to add that command here and adjust the paths. # We assume the modules are in the current working directory from the build. make modules_install DESTDIR=%{buildroot} # --- Files Section --- # This section lists all the files that will be included in the RPM package. %files /boot/vmlinuz-%{version} /boot/System.map-%{version} /boot/config-%{version} # The modules directory needs to be listed to include all modules /lib/modules/%{version} # --- Changelog Section --- %changelog * Wed Aug 07 2025 Bhargavjit Bhuyan - 1.0-1 - Initial RPM release for custom kernel.