162306a36Sopenharmony_ci# _arch is undefined if /usr/lib/rpm/platform/*/macros was not included. 262306a36Sopenharmony_ci%{!?_arch: %define _arch dummy} 362306a36Sopenharmony_ci%{!?make: %define make make} 462306a36Sopenharmony_ci%define makeflags %{?_smp_mflags} ARCH=%{ARCH} 562306a36Sopenharmony_ci%define __spec_install_post /usr/lib/rpm/brp-compress || : 662306a36Sopenharmony_ci%define debug_package %{nil} 762306a36Sopenharmony_ci 862306a36Sopenharmony_ciName: kernel 962306a36Sopenharmony_ciSummary: The Linux Kernel 1062306a36Sopenharmony_ciVersion: %(echo %{KERNELRELEASE} | sed -e 's/-/_/g') 1162306a36Sopenharmony_ciRelease: %{pkg_release} 1262306a36Sopenharmony_ciLicense: GPL 1362306a36Sopenharmony_ciGroup: System Environment/Kernel 1462306a36Sopenharmony_ciVendor: The Linux Community 1562306a36Sopenharmony_ciURL: https://www.kernel.org 1662306a36Sopenharmony_ciSource0: linux.tar.gz 1762306a36Sopenharmony_ciSource1: config 1862306a36Sopenharmony_ciSource2: diff.patch 1962306a36Sopenharmony_ciProvides: kernel-%{KERNELRELEASE} 2062306a36Sopenharmony_ciBuildRequires: bc binutils bison dwarves 2162306a36Sopenharmony_ciBuildRequires: (elfutils-libelf-devel or libelf-devel) flex 2262306a36Sopenharmony_ciBuildRequires: gcc make openssl openssl-devel perl python3 rsync 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci%description 2562306a36Sopenharmony_ciThe Linux Kernel, the operating system core itself 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci%package headers 2862306a36Sopenharmony_ciSummary: Header files for the Linux kernel for use by glibc 2962306a36Sopenharmony_ciGroup: Development/System 3062306a36Sopenharmony_ciObsoletes: kernel-headers 3162306a36Sopenharmony_ciProvides: kernel-headers = %{version} 3262306a36Sopenharmony_ci%description headers 3362306a36Sopenharmony_ciKernel-headers includes the C header files that specify the interface 3462306a36Sopenharmony_cibetween the Linux kernel and userspace libraries and programs. The 3562306a36Sopenharmony_ciheader files define structures and constants that are needed for 3662306a36Sopenharmony_cibuilding most standard programs and are also needed for rebuilding the 3762306a36Sopenharmony_ciglibc package. 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci%if %{with_devel} 4062306a36Sopenharmony_ci%package devel 4162306a36Sopenharmony_ciSummary: Development package for building kernel modules to match the %{version} kernel 4262306a36Sopenharmony_ciGroup: System Environment/Kernel 4362306a36Sopenharmony_ciAutoReqProv: no 4462306a36Sopenharmony_ci%description -n kernel-devel 4562306a36Sopenharmony_ciThis package provides kernel headers and makefiles sufficient to build modules 4662306a36Sopenharmony_ciagainst the %{version} kernel package. 4762306a36Sopenharmony_ci%endif 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci%prep 5062306a36Sopenharmony_ci%setup -q -n linux 5162306a36Sopenharmony_cicp %{SOURCE1} .config 5262306a36Sopenharmony_cipatch -p1 < %{SOURCE2} 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci%build 5562306a36Sopenharmony_ci%{make} %{makeflags} KERNELRELEASE=%{KERNELRELEASE} KBUILD_BUILD_VERSION=%{release} 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci%install 5862306a36Sopenharmony_cimkdir -p %{buildroot}/boot 5962306a36Sopenharmony_ci%ifarch ia64 6062306a36Sopenharmony_cimkdir -p %{buildroot}/boot/efi 6162306a36Sopenharmony_cicp $(%{make} %{makeflags} -s image_name) %{buildroot}/boot/efi/vmlinuz-%{KERNELRELEASE} 6262306a36Sopenharmony_ciln -s efi/vmlinuz-%{KERNELRELEASE} %{buildroot}/boot/ 6362306a36Sopenharmony_ci%else 6462306a36Sopenharmony_cicp $(%{make} %{makeflags} -s image_name) %{buildroot}/boot/vmlinuz-%{KERNELRELEASE} 6562306a36Sopenharmony_ci%endif 6662306a36Sopenharmony_ci%{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} modules_install 6762306a36Sopenharmony_ci%{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install 6862306a36Sopenharmony_cicp System.map %{buildroot}/boot/System.map-%{KERNELRELEASE} 6962306a36Sopenharmony_cicp .config %{buildroot}/boot/config-%{KERNELRELEASE} 7062306a36Sopenharmony_ciln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build 7162306a36Sopenharmony_ci%if %{with_devel} 7262306a36Sopenharmony_ci%{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}' 7362306a36Sopenharmony_ci%endif 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci%clean 7662306a36Sopenharmony_cirm -rf %{buildroot} 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci%post 7962306a36Sopenharmony_ciif [ -x /sbin/installkernel -a -r /boot/vmlinuz-%{KERNELRELEASE} -a -r /boot/System.map-%{KERNELRELEASE} ]; then 8062306a36Sopenharmony_cicp /boot/vmlinuz-%{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm 8162306a36Sopenharmony_cicp /boot/System.map-%{KERNELRELEASE} /boot/.System.map-%{KERNELRELEASE}-rpm 8262306a36Sopenharmony_cirm -f /boot/vmlinuz-%{KERNELRELEASE} /boot/System.map-%{KERNELRELEASE} 8362306a36Sopenharmony_ci/sbin/installkernel %{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm 8462306a36Sopenharmony_cirm -f /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm 8562306a36Sopenharmony_cifi 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci%preun 8862306a36Sopenharmony_ciif [ -x /sbin/new-kernel-pkg ]; then 8962306a36Sopenharmony_cinew-kernel-pkg --remove %{KERNELRELEASE} --rminitrd --initrdfile=/boot/initramfs-%{KERNELRELEASE}.img 9062306a36Sopenharmony_cielif [ -x /usr/bin/kernel-install ]; then 9162306a36Sopenharmony_cikernel-install remove %{KERNELRELEASE} 9262306a36Sopenharmony_cifi 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ci%postun 9562306a36Sopenharmony_ciif [ -x /sbin/update-bootloader ]; then 9662306a36Sopenharmony_ci/sbin/update-bootloader --remove %{KERNELRELEASE} 9762306a36Sopenharmony_cifi 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci%files 10062306a36Sopenharmony_ci%defattr (-, root, root) 10162306a36Sopenharmony_ci/lib/modules/%{KERNELRELEASE} 10262306a36Sopenharmony_ci%exclude /lib/modules/%{KERNELRELEASE}/build 10362306a36Sopenharmony_ci/boot/* 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci%files headers 10662306a36Sopenharmony_ci%defattr (-, root, root) 10762306a36Sopenharmony_ci/usr/include 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci%if %{with_devel} 11062306a36Sopenharmony_ci%files devel 11162306a36Sopenharmony_ci%defattr (-, root, root) 11262306a36Sopenharmony_ci/usr/src/kernels/%{KERNELRELEASE} 11362306a36Sopenharmony_ci/lib/modules/%{KERNELRELEASE}/build 11462306a36Sopenharmony_ci%endif 115