1 # _arch is undefined if /usr/lib/rpm/platform/*/macros was not included.
2 %{!?_arch: %define _arch dummy}
3 %{!?make: %define make make}
4 %define makeflags %{?_smp_mflags} ARCH=%{ARCH}
5 %define __spec_install_post /usr/lib/rpm/brp-compress || :
6 %define debug_package %{nil}
9 Summary: The Linux Kernel
10 Version: %(echo %{KERNELRELEASE} | sed -e 's/-/_/g')
11 Release: %{pkg_release}
13 Group: System Environment/Kernel
14 Vendor: The Linux Community
15 URL: https://www.kernel.org
19 Provides: kernel-%{KERNELRELEASE}
20 BuildRequires: bc binutils bison dwarves
21 BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
22 BuildRequires: gcc make openssl openssl-devel perl python3 rsync
25 The Linux Kernel, the operating system core itself
28 Summary: Header files for the Linux kernel for use by glibc
29 Group: Development/System
30 Obsoletes: kernel-headers
31 Provides: kernel-headers = %{version}
33 Kernel-headers includes the C header files that specify the interface
34 between the Linux kernel and userspace libraries and programs. The
35 header files define structures and constants that are needed for
36 building most standard programs and are also needed for rebuilding the
41 Summary: Development package for building kernel modules to match the %{version} kernel
42 Group: System Environment/Kernel
44 %description -n kernel-devel
45 This package provides kernel headers and makefiles sufficient to build modules
46 against the %{version} kernel package.
52 patch -p1 < %{SOURCE2}
55 %{make} %{makeflags} KERNELRELEASE=%{KERNELRELEASE} KBUILD_BUILD_VERSION=%{release}
58 mkdir -p %{buildroot}/boot
60 mkdir -p %{buildroot}/boot/efi
61 cp $(%{make} %{makeflags} -s image_name) %{buildroot}/boot/efi/vmlinuz-%{KERNELRELEASE}
62 ln -s efi/vmlinuz-%{KERNELRELEASE} %{buildroot}/boot/
64 cp $(%{make} %{makeflags} -s image_name) %{buildroot}/boot/vmlinuz-%{KERNELRELEASE}
66 %{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} modules_install
67 %{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
68 cp System.map %{buildroot}/boot/System.map-%{KERNELRELEASE}
69 cp .config %{buildroot}/boot/config-%{KERNELRELEASE}
70 ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build
71 ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/source
73 %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}'
80 if [ -x /sbin/installkernel -a -r /boot/vmlinuz-%{KERNELRELEASE} -a -r /boot/System.map-%{KERNELRELEASE} ]; then
81 cp /boot/vmlinuz-%{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm
82 cp /boot/System.map-%{KERNELRELEASE} /boot/.System.map-%{KERNELRELEASE}-rpm
83 rm -f /boot/vmlinuz-%{KERNELRELEASE} /boot/System.map-%{KERNELRELEASE}
84 /sbin/installkernel %{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm
85 rm -f /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm
89 if [ -x /sbin/new-kernel-pkg ]; then
90 new-kernel-pkg --remove %{KERNELRELEASE} --rminitrd --initrdfile=/boot/initramfs-%{KERNELRELEASE}.img
91 elif [ -x /usr/bin/kernel-install ]; then
92 kernel-install remove %{KERNELRELEASE}
96 if [ -x /sbin/update-bootloader ]; then
97 /sbin/update-bootloader --remove %{KERNELRELEASE}
101 %defattr (-, root, root)
102 /lib/modules/%{KERNELRELEASE}
103 %exclude /lib/modules/%{KERNELRELEASE}/build
104 %exclude /lib/modules/%{KERNELRELEASE}/source
108 %defattr (-, root, root)
113 %defattr (-, root, root)
114 /usr/src/kernels/%{KERNELRELEASE}
115 /lib/modules/%{KERNELRELEASE}/build
116 /lib/modules/%{KERNELRELEASE}/source