1 # _arch is undefined if /usr/lib/rpm/platform/ 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-c 6 %define debug_package %{nil} 7 8 Name: kernel 9 Summary: The Linux Kernel 10 Version: %(echo %{KERNELRELEASE} | sed -e 's/- 11 Release: %{pkg_release} 12 License: GPL 13 Group: System Environment/Kernel 14 Vendor: The Linux Community 15 URL: https://www.kernel.org 16 Source0: linux.tar.gz 17 Source1: config 18 Source2: diff.patch 19 Provides: kernel-%{KERNELRELEASE} 20 BuildRequires: bc binutils bison dwarves 21 BuildRequires: (elfutils-libelf-devel or libel 22 BuildRequires: gcc make openssl openssl-devel 23 24 %description 25 The Linux Kernel, the operating system core it 26 27 %package headers 28 Summary: Header files for the Linux kernel for 29 Group: Development/System 30 Obsoletes: kernel-headers < %{version} 31 Provides: kernel-headers = %{version} 32 %description headers 33 Kernel-headers includes the C header files tha 34 between the Linux kernel and userspace librari 35 header files define structures and constants t 36 building most standard programs and are also n 37 glibc package. 38 39 %if %{with_devel} 40 %package devel 41 Summary: Development package for building kern 42 Group: System Environment/Kernel 43 AutoReqProv: no 44 %description -n kernel-devel 45 This package provides kernel headers and makef 46 against the %{version} kernel package. 47 %endif 48 49 %prep 50 %setup -q -n linux 51 cp %{SOURCE1} .config 52 patch -p1 < %{SOURCE2} 53 54 %build 55 %{make} %{makeflags} KERNELRELEASE=%{KERNELREL 56 57 %install 58 mkdir -p %{buildroot}/lib/modules/%{KERNELRELE 59 cp $(%{make} %{makeflags} -s image_name) %{bui 60 # DEPMOD=true makes depmod no-op. We do not pa 61 %{make} %{makeflags} INSTALL_MOD_PATH=%{buildr 62 %{make} %{makeflags} INSTALL_HDR_PATH=%{buildr 63 cp System.map %{buildroot}/lib/modules/%{KERNE 64 cp .config %{buildroot}/lib/modules/%{KERNELRE 65 if %{make} %{makeflags} run-command KBUILD_RUN 66 %{make} %{makeflags} INSTALL_DTBS_PATH 67 fi 68 ln -fns /usr/src/kernels/%{KERNELRELEASE} %{bu 69 %if %{with_devel} 70 %{make} %{makeflags} run-command KBUILD_RUN_CO 71 %endif 72 73 { 74 echo "/lib/modules/%{KERNELRELEASE}" 75 76 for x in alias alias.bin builtin.alias 77 devname softde 78 echo "%ghost /lib/modules/%{KE 79 done 80 81 for x in System.map config vmlinuz; do 82 echo "%ghost /boot/${x}-%{KERN 83 done 84 85 if [ -d "%{buildroot}/lib/modules/%{KE 86 find "%{buildroot}/lib/modules 87 fi 88 89 echo "%exclude /lib/modules/%{KERNELRE 90 } > %{buildroot}/kernel.list 91 92 %clean 93 rm -rf %{buildroot} 94 95 %post 96 if [ -x /usr/bin/kernel-install ]; then 97 /usr/bin/kernel-install add %{KERNELRE 98 fi 99 for file in vmlinuz System.map config; do 100 if ! cmp --silent "/lib/modules/%{KERN 101 cp "/lib/modules/%{KERNELRELEA 102 fi 103 done 104 if [ -d "/lib/modules/%{KERNELRELEASE}/dtb" ] 105 ! diff -rq "/lib/modules/%{KERNELRELEASE}/d 106 rm -rf "/boot/dtb-%{KERNELRELEASE}" 107 cp -r "/lib/modules/%{KERNELRELEASE}/d 108 fi 109 if [ ! -e "/lib/modules/%{KERNELRELEASE}/modul 110 /usr/sbin/depmod %{KERNELRELEASE} 111 fi 112 113 %preun 114 if [ -x /usr/bin/kernel-install ]; then 115 kernel-install remove %{KERNELRELEASE} 116 fi 117 118 %files -f %{buildroot}/kernel.list 119 %defattr (-, root, root) 120 %exclude /kernel.list 121 122 %files headers 123 %defattr (-, root, root) 124 /usr/include 125 126 %if %{with_devel} 127 %files devel 128 %defattr (-, root, root) 129 /usr/src/kernels/%{KERNELRELEASE} 130 /lib/modules/%{KERNELRELEASE}/build 131 %endif
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.