%define _build_id_links none %if "%(rpm -q dkms | cut -d - -f 1)" == "dkms" %define with_dkms 1 %else %define with_dkms 0 %endif %if "%(rpm -q akmods | cut -d - -f 1)" == "dkms" %define with_akmods 1 %else %define with_akmods 0 %endif Name: kernel-pkgtest Summary: The Linux Kernel Version: 5.11.0 %define flaver pkgtest Release:%{flaver}.0%{?dist} %define rpmver %{version}-%{release} %define kbuildver %{rpmver} License: GPLv2 and Redistributable, no modifications permitted Group: System Environment/Kernel Vendor: The Linux Community URL: https://xanmod.org Source0: kernel-%{version}_%{flaver}.tar.gz # Secure boot signing certificates -- Pulled directly from Fedora DistGit # only intended for x86_64 Source1: redhatsecurebootca1.cer Source2: redhatsecurebootca5.cer Source3: redhatsecureboot301.cer Source4: redhatsecureboot501.cer Source5: x509.genkey.fedora Source6: mod-sign.sh %define secureboot_ca_0 %{SOURCE1} %define secureboot_ca_1 %{SOURCE2} %define secureboot_key_0 %{SOURCE3} %define secureboot_key_1 %{SOURCE4} %define pesign_name_0 redhatsecureboot301 %define pesign_name_1 redhatsecureboot501 %define kmodsign_cmd %{SOURCE6} ### Provides: %{name}-%{rpmver} %define __spec_install_post /usr/lib/rpm/brp-compress || : %define debug_package %{nil} BuildRequires: python3-devel gcc make perl-generators perl-interpreter openssl-devel bison flex findutils git-core perl-devel openssl elfutils-devel gawk binutils m4 tar hostname bzip2 bash gzip xz bc diffutils redhat-rpm-config net-tools elfutils patch rpm-build dwarves kmod libkcapi-hmaccalc perl-Carp rsync grubby pesign Requires: kernel-core-uname-r = %{rpmver}, kernel-modules-uname-r = %{rpmver} %description The kernel-%{flaver} meta package %package core Summary: Kernel core package Group: System Environment/Kernel Provides: kernel-core = %{rpmver}, kernel-core-uname-r = %{rpmver}, kernel-uname-r = %{rpmver}, kernel-%{_arch} = %{rpmver}, kernel-core(%{_arch}) = %{rpmver} Requires: bash, coreutils, dracut, linux-firmware, grubby, /usr/bin/kernel-install Supplements: %{name} %description core The kernel package contains the Linux kernel (vmlinuz), the core of any Linux operating system. The kernel handles the basic functions of the operating system: memory allocation, process allocation, device input and output, etc. %package modules Summary: Kernel modules to match the core kernel Group: System Environment/Kernel Provides: installonlypkg(kernel-module) = %{rpmver}, kernel-modules = %{rpmver}, kernel-modules(%{_arch}) = %{rpmver}, kernel-modules-uname-r = %{rpmver}, kernel-modules-%{_arch} = %{rpmver} Requires: kernel-uname-r = %{rpmver} %description modules This package provides kernel modules for the core kernel package. %package headers Summary: Header files for the Linux kernel for use by glibc Group: Development/System Provides: kernel-headers = %{rpmver}, glibc-kernheaders = 3.0-46, kernel-headers(%{_arch}) = %{rpmver} Obsoletes: kernel-headers < %{rpmver}, glibc-kernheaders < 3.0-46, kernel-headers-%{_arch} < %{rpmver} %description headers Kernel-headers includes the C header files that specify the interface between the Linux kernel and userspace libraries and programs. The header files define structures and constants that are needed for building most standard programs and are also needed for rebuilding the glibc package. %package devel Summary: Development package for building kernel modules to match the %{kbuildver} kernel Group: System Environment/Kernel AutoReqProv: no Requires: findutils perl-interpreter Provides: installonlypkg(kernel) = %{rpmver}, kernel-devel = %{rpmver}, kernel-devel-uname-r = %{kbuildver}, kernel-devel-%{_arch} = %{rpmver}, kernel-devel(%{_arch}) = %{rpmver} %description -n %{name}-devel This package provides kernel headers and makefiles sufficient to build modules against the %{kbuildver} kernel package. %prep %setup -q -n kernel-5.11.0 cp %{SOURCE5} certs/x509.genkey %build make %{?_smp_mflags} EXTRAVERSION=-%{release} gcc ./scripts/sign-file.c -o ./scripts/sign-file -lssl -lcrypto %install ImageName=$(make image_name | tail -n 1) mkdir -p %{buildroot}/boot # Signing part disabled make %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install make %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install cp System.map %{buildroot}/boot/System.map-%{rpmver} cp .config %{buildroot}/boot/config-%{rpmver} bzip2 -9 --keep vmlinux mv vmlinux.bz2 %{buildroot}/boot/vmlinuz-%{rpmver} rm -f %{buildroot}/lib/modules/%{rpmver}/build rm -f %{buildroot}/lib/modules/%{rpmver}/source mkdir -p %{buildroot}/usr/src/kernels/%{rpmver} tar cf - --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc --exclude .hg --exclude .git --exclude=*vmlinux* --exclude=*.mod --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation --exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s . | tar xf - -C %{buildroot}/usr/src/kernels/%{rpmver} cp %{buildroot}/boot/vmlinuz-%{rpmver} %{buildroot}/lib/modules/%{rpmver}/vmlinuz cd %{buildroot}/lib/modules/%{rpmver} ln -sf /usr/src/kernels/%{rpmver} build ln -sf /usr/src/kernels/%{rpmver} source %clean rm -rf %{buildroot} %post core if [ -x /sbin/installkernel -a -r /boot/vmlinuz-%{rpmver} -a -r /boot/System.map-%{rpmver} ]; then cp /boot/vmlinuz-%{rpmver} /boot/.vmlinuz-%{rpmver}-rpm cp /boot/System.map-%{rpmver} /boot/.System.map-%{rpmver}-rpm rm -f /boot/vmlinuz-%{rpmver} /boot/System.map-%{rpmver} /sbin/installkernel %{rpmver} /boot/.vmlinuz-%{rpmver}-rpm /boot/.System.map-%{rpmver}-rpm rm -f /boot/.vmlinuz-%{rpmver}-rpm /boot/.System.map-%{rpmver}-rpm fi depmod -a %{rpmver} dracut -f %{rpmver} if [ -x /usr/sbin/grub2-mkconfig ] ; then if [ -e /etc/grub2-efi.cfg ] ; then GRUBCFG='/etc/grub2-efi.cfg' elif [ -e /etc/grub2.cfg ] ; then GRUBCFG='/etc/grub2.cfg' fi grub2-mkconfig -o ${GRUBCFG} fi rm -f /%{rpmver} %preun core if [ -x /sbin/new-kernel-pkg ]; then new-kernel-pkg --remove %{rpmver} --rminitrd --initrdfile=/boot/initramfs-%{rpmver}.img elif [ -x /usr/bin/kernel-install ]; then kernel-install remove %{rpmver} else rm -f /boot/initramfs-%{rpmver}.img fi %postun core if [ -x /sbin/update-bootloader ]; then /sbin/update-bootloader --remove %{rpmver} fi if [ -x /usr/sbin/grub2-mkconfig ] ; then if [ -e /etc/grub2-efi.cfg ] ; then GRUBCFG='/etc/grub2-efi.cfg' elif [ -e /etc/grub2.cfg ] ; then GRUBCFG='/etc/grub2.cfg' fi grub2-mkconfig -o ${GRUBCFG} fi %files core %defattr (-, root, root) %exclude /%{rpmver} /boot/* %exclude /boot/vmlinux-%{rpmver} %files modules %defattr (-, root, root) /lib/modules/%{rpmver} %exclude /lib/modules/%{rpmver}/build %exclude /lib/modules/%{rpmver}/source %files headers %defattr (-, root, root) /usr/include %files devel %defattr (-, root, root) /usr/src/kernels/%{rpmver} /lib/modules/%{rpmver}/build /lib/modules/%{rpmver}/source