1 |
# upstream versioning |
2 |
%define kernelversion 5 |
3 |
%define patchlevel 1 |
4 |
# sublevel is now used for -stable patches |
5 |
%define sublevel 14 |
6 |
|
7 |
# kernel Makefile extraversion is substituted by |
8 |
# kpatch wich are either 0 (empty), rc (kpatch) |
9 |
%define kpatch 0 |
10 |
|
11 |
# this is the releaseversion |
12 |
%define mgarelease 1 |
13 |
|
14 |
# This is only to make life easier for people that creates derivated kernels |
15 |
# a.k.a name it kernel-tmb :) |
16 |
%define kname kernel-linus |
17 |
|
18 |
%define rpmtag %{distsuffix}%{mgaver} |
19 |
%if %kpatch |
20 |
%define rpmrel %mkrel 0.%{kpatch}.%{mgarelease} |
21 |
%else |
22 |
%define rpmrel %mkrel %{mgarelease} |
23 |
%endif |
24 |
|
25 |
# theese two never change, they are used to fool rpm/urpmi/smart |
26 |
%define fakever 1 |
27 |
%define fakerel %mkrel 1 |
28 |
|
29 |
# When we are using a pre/rc patch, the tarball is a sublevel -1 |
30 |
%if %kpatch |
31 |
%if %sublevel |
32 |
%define tar_ver %{kernelversion}.%{patchlevel} |
33 |
%else |
34 |
%define tar_ver %{kernelversion}.%(expr %{patchlevel} - 1) |
35 |
%endif |
36 |
%else |
37 |
%define tar_ver %{kernelversion}.%{patchlevel} |
38 |
%endif |
39 |
%define kversion %{kernelversion}.%{patchlevel}.%{sublevel} |
40 |
%define kverrel %{kversion}-%{rpmrel} |
41 |
|
42 |
# used for not making too long names for rpms or search paths |
43 |
%if %kpatch |
44 |
%define buildrpmrel 0.%{kpatch}.%{mgarelease}%{rpmtag} |
45 |
%else |
46 |
%define buildrpmrel %{mgarelease}%{rpmtag} |
47 |
%endif |
48 |
|
49 |
%define buildrel %{kversion}-%{buildrpmrel} |
50 |
|
51 |
%define klinus_notice NOTE: This kernel has no Mageia patches and no third-party drivers. |
52 |
|
53 |
# having different top level names for packges means that you have to remove them by hard :( |
54 |
%define top_dir_name %{kname}-%{_arch} |
55 |
|
56 |
%define build_dir ${RPM_BUILD_DIR}/%{top_dir_name} |
57 |
%define src_dir %{build_dir}/linux-%{tar_ver} |
58 |
|
59 |
# disable useless debug rpms... |
60 |
%global debug_package %{nil} |
61 |
%global _enable_debug_packages %{nil} |
62 |
%global __debug_package %{nil} |
63 |
%global __debug_install_post %{nil} |
64 |
%global _build_id_links none |
65 |
|
66 |
# no bytecompiling wanted as it breaks build on selftests we dont even ship |
67 |
# for older buildsystems |
68 |
%global _python_bytecompile_build 0 |
69 |
# for systems with >= rpm-mageia-setup-2.29-1.mga7 |
70 |
%global __brp_python_bytecompile %nil |
71 |
|
72 |
# build defines |
73 |
%define build_doc 1 |
74 |
%define build_source 1 |
75 |
%define build_devel 1 |
76 |
|
77 |
%define build_kernel 1 |
78 |
|
79 |
%define distro_branch %(perl -pe '/(\\d+)\\.(\\d)\\.?(\\d)?/; $_="$1.$2"' /etc/mageia-release) |
80 |
|
81 |
# End of user definitions |
82 |
%{?_without_kernel: %global build_kernel 0} |
83 |
%{?_without_doc: %global build_doc 0} |
84 |
%{?_without_source: %global build_source 0} |
85 |
%{?_without_devel: %global build_devel 0} |
86 |
|
87 |
%{?_with_kernel: %global build_kernel 1} |
88 |
%{?_with_doc: %global build_doc 1} |
89 |
%{?_with_source: %global build_source 1} |
90 |
%{?_with_devel: %global build_devel 1} |
91 |
|
92 |
%if %(if [ -z "$CC" ] ; then echo 0; else echo 1; fi) |
93 |
%define kmake %make_build CC="$CC" |
94 |
%else |
95 |
%define kmake %make_build |
96 |
%endif |
97 |
# there are places where parallel make doesn't work |
98 |
%define smake make |
99 |
|
100 |
# Parallelize xargs invocations on smp machines |
101 |
%define kxargs xargs %([ -z "$RPM_BUILD_NCPUS" ] \\\ |
102 |
&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\ |
103 |
[ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-P $RPM_BUILD_NCPUS") |
104 |
|
105 |
# Aliases for amd64 builds (better make source links?) |
106 |
%define target_cpu %(echo %{_target_cpu} | sed -e "s/amd64/x86_64/") |
107 |
%define target_arch %(echo %{_arch} | sed -e "s/amd64/x86_64/" -e 's/arm.*/arm/') |
108 |
|
109 |
# src.rpm description |
110 |
Summary: The Linux kernel (the core of the Linux operating system) |
111 |
Name: %{kname} |
112 |
Version: %{kversion} |
113 |
Release: %{rpmrel} |
114 |
License: GPLv2 |
115 |
Group: System/Kernel and hardware |
116 |
ExclusiveArch: %{ix86} x86_64 %{arm} |
117 |
ExclusiveOS: Linux |
118 |
URL: https://www.kernel.org/ |
119 |
|
120 |
#################################################################### |
121 |
# |
122 |
# Sources |
123 |
# |
124 |
### This is for full SRC RPM |
125 |
Source0: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/linux-%{tar_ver}.tar.xz |
126 |
Source1: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/linux-%{tar_ver}.tar.sign |
127 |
|
128 |
# This is for disabling mrproper and other targets on -devel rpms |
129 |
Source2: disable-mrproper-in-devel-rpms.patch |
130 |
|
131 |
Source4: README.kernel-sources |
132 |
|
133 |
# Kernel defconfigs |
134 |
Source20: i386_defconfig |
135 |
Source21: x86_64_defconfig |
136 |
Source22: arm_defconfig |
137 |
|
138 |
#################################################################### |
139 |
# |
140 |
# Patches |
141 |
|
142 |
# |
143 |
# Patch0 to Patch100 are for core kernel upgrades. |
144 |
# |
145 |
|
146 |
# Pre linus patch: https://cdn.kernel.org/pub/linux/kernel/v(kernelversion).(patchlevel)/testing |
147 |
|
148 |
%if %sublevel |
149 |
Patch1: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.xz |
150 |
%endif |
151 |
%if %kpatch |
152 |
# (tmb) Created with: |
153 |
# wget https://git.kernel.org/torvalds/p/v5.1-rc6/v5.0 -O patch-5.1-rc6 |
154 |
# xz -6e patch-5.1-rc6 |
155 |
Patch2: patch-%{kernelversion}.%{patchlevel}-%{kpatch}.xz |
156 |
%endif |
157 |
|
158 |
# critical fixes |
159 |
|
160 |
#END |
161 |
#################################################################### |
162 |
|
163 |
# global defines |
164 |
Autoreqprov: no |
165 |
BuildRequires: gcc |
166 |
BuildRequires: kmod >= 12-2 |
167 |
BuildRequires: bc |
168 |
BuildRequires: binutils >= 1:2.25.1 |
169 |
# for orc unwinder |
170 |
BuildRequires: elfutils-devel |
171 |
# for crypto stuff |
172 |
BuildRequires: pkgconfig(openssl) |
173 |
# since 4.16 |
174 |
BuildRequires: bison |
175 |
BuildRequires: flex |
176 |
|
177 |
%description |
178 |
Source package to build the Linux kernel. |
179 |
|
180 |
%{klinus_notice} |
181 |
|
182 |
|
183 |
# |
184 |
# kernel: Symmetric MultiProcessing kernel |
185 |
# |
186 |
%if %build_kernel |
187 |
%package -n %{kname}-%{buildrel} |
188 |
Version: %{fakever} |
189 |
Release: %{fakerel} |
190 |
%ifarch %{ix86} |
191 |
Summary: Linux Kernel for desktop use with i586 & 4GB RAM |
192 |
%else |
193 |
%ifarch %{arm} |
194 |
Summary: Linux Kernel for Arm machines based on Kirkwood |
195 |
%else |
196 |
Summary: Linux Kernel for desktop use with %{_arch} |
197 |
%endif |
198 |
%endif |
199 |
Group: System/Kernel and hardware |
200 |
Provides: should-restart = system |
201 |
Provides: installonlypkg(kernel) |
202 |
Provides: kernel = %{tar_ver} |
203 |
Provides: alsa |
204 |
Requires: bootloader-utils >= 1.16-1 |
205 |
Requires: dracut >= 046-2 |
206 |
Requires: kmod >= 12-2 |
207 |
Requires: sysfsutils >= 2.1.0-16 |
208 |
Requires: kernel-firmware >= 20170101-1 |
209 |
|
210 |
# conflict dkms packages that dont support kernel-4.14 |
211 |
Conflicts: dkms-broadcom-wl < 6.30.223.271-47 |
212 |
Conflicts: dkms-fglrx <= 15.302 |
213 |
Conflicts: dkms-nvidia-current < 384.98-2 |
214 |
Conflicts: dkms-nvidia340 < 340.104-3 |
215 |
Conflicts: dkms-nvidia304 < 304.137-2 |
216 |
Conflicts: dkms-virtualbox < 5.2.2-1 |
217 |
Conflicts: dkms-xtables-addons < 2.13-3 |
218 |
# (tmb) conflict older btrfs-progs to get the new in same transaction and in initrd |
219 |
Conflicts: btrfs-progs < 4.14-2 |
220 |
# (tmb) conflict too old radeon-firmware to get the uvd firmwares in initrd |
221 |
Conflicts: radeon-firmware < 20171123-1 |
222 |
# (tmb) conflict old firmware to get the firmwares in initrd |
223 |
Conflicts: kernel-firmware-nonfree < 20171123-1 |
224 |
# (tmb) conflict old microcode to get updated ones in initrd for early loading |
225 |
Conflicts: microcode < 0.20180807-1 |
226 |
# (tmb) conflict old theme to get mga5 theme in initrd |
227 |
Conflicts: mageia-gfxboot-theme < 4.5.6.6-1 |
228 |
# (tmb) conflict too old grub2(-efi) |
229 |
Conflicts: grub2 < 2.02-0.git9752.18 |
230 |
Conflicts: grub2-efi < 2.02-0.git9752.18 |
231 |
# (tmb) conflict too old efibootmgr |
232 |
Conflicts: efibootmgr < 0.11.0-7 |
233 |
# (tmb) conflict for vmmouse breakage (mga#16954) |
234 |
Conflicts: x11-driver-input-vmmouse < 13.1.0-1 |
235 |
|
236 |
%ifarch %{ix86} |
237 |
Conflicts: arch(x86_64) |
238 |
%endif |
239 |
|
240 |
%description -n %{kname}-%{buildrel} |
241 |
%ifarch %{ix86} |
242 |
This kernel is compiled for desktop use, single or multiple i586 |
243 |
processor(s)/core(s) and less than 4GB RAM, using HZ_1000, voluntary |
244 |
preempt, CFS cpu scheduler and cfq i/o scheduler. |
245 |
This kernel relies on in-kernel smp alternatives to switch between |
246 |
up & smp mode depending on detected hardware. To force the kernel |
247 |
to boot in single processor mode, use the "nosmp" boot parameter. |
248 |
%else |
249 |
%ifarch %{arm} |
250 |
This kernel is compiled for Arm Kirkwood boxes. It will run on openrd |
251 |
boards. It's configured using HZ_100, preempt, CFS cpu scheduler and |
252 |
cfq i/o scheduler. |
253 |
This kernel relies on in-kernel smp alternatives to switch between |
254 |
up & smp mode depending on detected hardware. To force the kernel |
255 |
to boot in single processor mode, use the "nosmp" boot parameter. |
256 |
%else |
257 |
This kernel is compiled for desktop use, single or multiple %{_arch} |
258 |
processor(s)/core(s), using HZ_1000, voluntary preempt, CFS cpu |
259 |
scheduler and cfq i/o scheduler. |
260 |
This kernel relies on in-kernel smp alternatives to switch between |
261 |
up & smp mode depending on detected hardware. To force the kernel |
262 |
to boot in single processor mode, use the "nosmp" boot parameter. |
263 |
%endif |
264 |
%endif |
265 |
|
266 |
%{klinus_notice} |
267 |
%endif # build_kernel |
268 |
|
269 |
|
270 |
# |
271 |
# kernel-source: kernel sources |
272 |
# |
273 |
%if %build_source |
274 |
%package -n %{kname}-source-%{buildrel} |
275 |
Version: %{fakever} |
276 |
Release: %{fakerel} |
277 |
Provides: %{kname}-source, kernel-source = %{kverrel} |
278 |
Provides: %{kname}-source-%{kernelversion}.%{patchlevel} |
279 |
Requires: glibc-devel, ncurses-devel, make, gcc, perl, diffutils |
280 |
Summary: The source code for the Linux kernel |
281 |
Group: Development/Kernel |
282 |
Autoreqprov: no |
283 |
Buildarch: noarch |
284 |
|
285 |
%description -n %{kname}-source-%{buildrel} |
286 |
The %{kname}-source package contains the source code files for the |
287 |
Linux kernel. Theese source files are only needed if you want to build |
288 |
your own custom kernel that is better tuned to your particular hardware. |
289 |
|
290 |
If you only want the files needed to build 3rdparty (nVidia, Ati, dkms-*,...) |
291 |
drivers against, install the *-devel-* rpm that is matching your kernel. |
292 |
|
293 |
%{klinus_notice} |
294 |
%endif #build_source |
295 |
|
296 |
|
297 |
# |
298 |
# kernel-devel: stripped kernel sources |
299 |
# |
300 |
%if %build_devel |
301 |
%package -n %{kname}-devel-%{buildrel} |
302 |
Version: %{fakever} |
303 |
Release: %{fakerel} |
304 |
Provides: kernel-devel = %{kverrel} |
305 |
Summary: The %{kname} devel files for 3rdparty modules build |
306 |
Group: Development/Kernel |
307 |
Autoreqprov: no |
308 |
Requires: glibc-devel, ncurses-devel, make, gcc, perl |
309 |
Requires: pkgconfig(libelf) |
310 |
%ifarch %{ix86} |
311 |
Conflicts: arch(x86_64) |
312 |
%endif |
313 |
|
314 |
%description -n %{kname}-devel-%{buildrel} |
315 |
This package contains the kernel-devel files that should be enough to build |
316 |
3rdparty drivers against for use with the %{kname}-%{buildrel}. |
317 |
|
318 |
If you want to build your own kernel, you need to install the full |
319 |
%{kname}-source-%{buildrel} rpm. |
320 |
|
321 |
%{klinus_notice} |
322 |
%endif #build_devel |
323 |
|
324 |
|
325 |
# |
326 |
# kernel-doc: documentation for the Linux kernel |
327 |
# |
328 |
%if %build_doc |
329 |
%package -n %{kname}-doc |
330 |
Version: %{kversion} |
331 |
Release: %{rpmrel} |
332 |
Summary: Various documentation bits found in the kernel source |
333 |
Group: Documentation |
334 |
Buildarch: noarch |
335 |
|
336 |
%description -n %{kname}-doc |
337 |
This package contains documentation files form the kernel source. Various |
338 |
bits of information about the Linux kernel and the device drivers shipped |
339 |
with it are documented in these files. You also might want install this |
340 |
package if you need a reference to the options that can be passed to Linux |
341 |
kernel modules at load time. |
342 |
|
343 |
%{klinus_notice} |
344 |
%endif #build_doc |
345 |
|
346 |
|
347 |
# |
348 |
# kernel-latest: virtual rpm |
349 |
# |
350 |
%if %build_kernel |
351 |
%package -n %{kname}-latest |
352 |
Version: %{kversion} |
353 |
Release: %{rpmrel} |
354 |
Summary: Virtual rpm for latest %{kname} |
355 |
Group: System/Kernel and hardware |
356 |
Requires: %{kname}-%{buildrel} |
357 |
%ifarch %{ix86} |
358 |
Conflicts: arch(x86_64) |
359 |
%endif |
360 |
|
361 |
%description -n %{kname}-latest |
362 |
This package is a virtual rpm that aims to make sure you always have the |
363 |
latest %{kname} installed... |
364 |
|
365 |
%{klinus_notice} |
366 |
%endif #build_kernel |
367 |
|
368 |
|
369 |
# |
370 |
# kernel-source-latest: virtual rpm |
371 |
# |
372 |
%if %build_source |
373 |
%package -n %{kname}-source-latest |
374 |
Version: %{kversion} |
375 |
Release: %{rpmrel} |
376 |
Summary: Virtual rpm for latest %{kname}-source |
377 |
Group: System/Kernel and hardware |
378 |
Requires: %{kname}-source-%{buildrel} |
379 |
Buildarch: noarch |
380 |
|
381 |
%description -n %{kname}-source-latest |
382 |
This package is a virtual rpm that aims to make sure you always have the |
383 |
latest %{kname}-source installed... |
384 |
|
385 |
%{klinus_notice} |
386 |
%endif #build_source |
387 |
|
388 |
|
389 |
# |
390 |
# kernel-devel-latest: virtual rpm |
391 |
# |
392 |
%if %build_devel |
393 |
%package -n %{kname}-devel-latest |
394 |
Version: %{kversion} |
395 |
Release: %{rpmrel} |
396 |
Summary: Virtual rpm for latest %{kname}-devel |
397 |
Group: System/Kernel and hardware |
398 |
Requires: %{kname}-devel-%{buildrel} |
399 |
%ifarch %{ix86} |
400 |
Conflicts: arch(x86_64) |
401 |
%endif |
402 |
|
403 |
%description -n %{kname}-devel-latest |
404 |
This package is a virtual rpm that aims to make sure you always have the |
405 |
latest %{kname}-devel installed... |
406 |
|
407 |
%{klinus_notice} |
408 |
%endif #build_devel |
409 |
|
410 |
|
411 |
# |
412 |
# End packages - here begins build stage |
413 |
# |
414 |
%prep |
415 |
%setup -q -n %top_dir_name -c |
416 |
|
417 |
pushd %src_dir |
418 |
|
419 |
%if %sublevel |
420 |
%patch1 -p1 |
421 |
%endif |
422 |
%if %kpatch |
423 |
%patch2 -p1 |
424 |
%endif |
425 |
|
426 |
# critical fixes |
427 |
|
428 |
popd |
429 |
|
430 |
# PATCH END |
431 |
|
432 |
|
433 |
# |
434 |
# Setup Begin |
435 |
# |
436 |
|
437 |
# Install defconfigs... |
438 |
install %{SOURCE20} %{build_dir}/linux-%{tar_ver}/arch/x86/configs/ |
439 |
install %{SOURCE21} %{build_dir}/linux-%{tar_ver}/arch/x86/configs/ |
440 |
install %{SOURCE22} %{build_dir}/linux-%{tar_ver}/arch/arm/configs/ |
441 |
|
442 |
# make sure the kernel has the sublevel we know it has... |
443 |
LC_ALL=C perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" linux-%{tar_ver}/Makefile |
444 |
|
445 |
|
446 |
%build |
447 |
# Common target directories |
448 |
%define _bootdir /boot |
449 |
%define _modulesdir /lib/modules |
450 |
%define _kerneldir /usr/src/%{kname}-%{buildrel} |
451 |
%define _develdir /usr/src/%{kname}-devel-%{buildrel} |
452 |
|
453 |
|
454 |
# Directories definition needed for building |
455 |
%define temp_root %{build_dir}/temp-root |
456 |
%define temp_boot %{temp_root}%{_bootdir} |
457 |
%define temp_modules %{temp_root}%{_modulesdir} |
458 |
%define temp_source %{temp_root}%{_kerneldir} |
459 |
%define temp_devel %{temp_root}%{_develdir} |
460 |
|
461 |
|
462 |
# Create a simulacro of buildroot |
463 |
rm -rf %{temp_root} |
464 |
install -d %{temp_root} |
465 |
|
466 |
|
467 |
# make sure we are in the directory |
468 |
cd %{src_dir} |
469 |
|
470 |
# fix missing exec flag on file introduced in 4.14.10-rc1 |
471 |
chmod 755 tools/objtool/sync-check.sh |
472 |
|
473 |
# make sure EXTRAVERSION says what we want it to say |
474 |
LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{buildrpmrel}/" Makefile |
475 |
|
476 |
# Prepare the kernel |
477 |
%smake -s mrproper |
478 |
%ifarch %{ix86} x86_64 |
479 |
cp arch/x86/configs/%{target_arch}_defconfig .config |
480 |
%else |
481 |
cp arch/%{target_arch}/configs/%{target_arch}_defconfig .config |
482 |
%endif |
483 |
%smake ARCH=%{_arch} oldconfig |
484 |
|
485 |
# Build the kernel |
486 |
%kmake ARCH=%{_arch} -s all |
487 |
# Install kernel |
488 |
install -d %{temp_boot} |
489 |
install -m 644 System.map %{temp_boot}/System.map-%{buildrel} |
490 |
install -m 644 .config %{temp_boot}/config-%{buildrel} |
491 |
%ifarch %{arm} |
492 |
cp -f arch/arm/boot/zImage %{temp_boot}/vmlinuz-%{buildrel} |
493 |
install -d %{temp_root}/usr/lib/linux-%{buildrel}/ |
494 |
for d in arch/arm/boot/dts/*.dtb; do \ |
495 |
install -D -m644 $d %{temp_root}/usr/lib/linux-%{buildrel}/$(basename $d); \ |
496 |
done |
497 |
%else |
498 |
cp -f arch/%{target_arch}/boot/bzImage %{temp_boot}/vmlinuz-%{buildrel} |
499 |
%endif |
500 |
|
501 |
# Install modules |
502 |
install -d %{temp_modules}/%{buildrel} |
503 |
%smake ARCH=%{_arch} INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=%{buildrel} modules_install |
504 |
|
505 |
# Save devel tree |
506 |
%if %build_devel |
507 |
mkdir -p %{temp_devel} |
508 |
for i in $(find . -name 'Makefile*'); do cp -R --parents $i %{temp_devel};done |
509 |
for i in $(find . -name 'Kconfig*' -o -name 'Kbuild*' -o -name config.mk); do cp -R --parents $i %{temp_devel};done |
510 |
cp -fR include %{temp_devel} |
511 |
cp -fR scripts %{temp_devel} |
512 |
cp -fR tools/include %{temp_devel}/tools/ |
513 |
# needed for selinux |
514 |
cp -R --parents security/selinux/include/*.h %{temp_devel} |
515 |
%ifarch %{arm} |
516 |
cp -fR arch/%{target_arch}/tools %{temp_devel}/arch/%{target_arch}/ |
517 |
cp -fR arch/%{target_arch}/kernel/signal.h %{temp_devel}/arch/%{target_arch}/kernel/ |
518 |
%endif |
519 |
%ifarch %{ix86} x86_64 |
520 |
cp -fR arch/x86/boot/{ctype.h,string.{c,h}} %{temp_devel}/arch/x86/boot/ |
521 |
cp -fR arch/x86/kernel/asm-offsets.{c,s} %{temp_devel}/arch/x86/kernel/ |
522 |
cp -fR arch/x86/kernel/asm-offsets_{32,64}.c %{temp_devel}/arch/x86/kernel/ |
523 |
cp -fR arch/x86/purgatory/* %{temp_devel}/arch/x86/purgatory/ |
524 |
cp -fR arch/x86/entry/syscalls/syscall* %{temp_devel}/arch/x86/entry/syscalls/ |
525 |
cp -fR arch/x86/include %{temp_devel}/arch/x86/ |
526 |
cp -fR arch/x86/tools %{temp_devel}/arch/x86/ |
527 |
%else |
528 |
cp -fR arch/%{target_arch}/kernel/asm-offsets.{c,s} %{temp_devel}/arch/%{target_arch}/kernel/ |
529 |
for f in $(find arch/%{target_arch} -name include); do cp -fR --parents $f %{temp_devel}; done |
530 |
%endif |
531 |
%ifarch x86_64 |
532 |
# orc unwinder needs theese |
533 |
cp -fR tools/build/Build{,.include} %{temp_devel}/tools/build |
534 |
cp -fR tools/build/fixdep.c %{temp_devel}/tools/build |
535 |
cp -fR tools/lib/{str_error_r.c,string.c} %{temp_devel}/tools/lib |
536 |
cp -fR tools/lib/subcmd/* %{temp_devel}/tools/lib/subcmd |
537 |
cp -fR tools/objtool/* %{temp_devel}/tools/objtool |
538 |
cp -fR tools/scripts/utilities.mak %{temp_devel}/tools/scripts |
539 |
%endif |
540 |
|
541 |
# Needed for generation of kernel/bounds.s |
542 |
cp -fR kernel/bounds.c %{temp_devel}/kernel/ |
543 |
|
544 |
# needed by include/generated/timeconst.h |
545 |
cp -fR kernel/time/timeconst.bc %{temp_devel}/kernel/time/ |
546 |
|
547 |
# ship config and symvers |
548 |
cp -fR .config Module.symvers %{temp_devel} |
549 |
|
550 |
# Needed for truecrypt build (Danny) |
551 |
cp -fR drivers/md/dm.h %{temp_devel}/drivers/md/ |
552 |
|
553 |
# Check and clean the -devel tree |
554 |
pushd %{temp_devel} >/dev/null |
555 |
%smake ARCH=%{_arch} -s prepare scripts clean |
556 |
rm -f .config.old |
557 |
popd >/dev/null |
558 |
|
559 |
# Disable mrproper and other targets |
560 |
patch -p1 -d %{temp_devel} -i %{SOURCE2} |
561 |
|
562 |
# Fix permissions |
563 |
chmod -R a+rX %{temp_devel} |
564 |
%endif # build_devel |
565 |
|
566 |
#make sure we are in the directory |
567 |
cd %src_dir |
568 |
|
569 |
# kernel-source is shipped as an unprepared tree |
570 |
%smake ARCH=%{_arch} -s mrproper |
571 |
|
572 |
|
573 |
### |
574 |
### Install |
575 |
### |
576 |
%install |
577 |
install -m 644 %{SOURCE4} . |
578 |
|
579 |
cd %src_dir |
580 |
# Directories definition needed for installing |
581 |
%define target_source %{buildroot}/%{_kerneldir} |
582 |
%define target_boot %{buildroot}%{_bootdir} |
583 |
%define target_modules %{buildroot}%{_modulesdir} |
584 |
%define target_devel %{buildroot}%{_develdir} |
585 |
|
586 |
# We want to be able to test several times the install part |
587 |
rm -rf %{buildroot} |
588 |
cp -a %{temp_root} %{buildroot} |
589 |
|
590 |
# Create directories infastructure |
591 |
%if %build_source |
592 |
install -d %{target_source} |
593 |
|
594 |
tar cf - . | tar xf - -C %{target_source} |
595 |
chmod -R a+rX %{target_source} |
596 |
|
597 |
# we remove all the source files that we don't ship |
598 |
|
599 |
# first architecture files |
600 |
for i in alpha arc avr32 blackfin c6x cris csky frv hexagon h8300 ia64 m32r mips \ |
601 |
microblaze m68k m68knommu metag mn10300 nds32 nios2 openrisc parisc powerpc ppc \ |
602 |
riscv s390 score sh sh64 sparc tile unicore32 v850 xtensa; do |
603 |
rm -rf %{target_source}/arch/$i |
604 |
|
605 |
%if %build_devel |
606 |
rm -rf %{target_devel}/arch/$i |
607 |
%endif |
608 |
done |
609 |
%ifnarch %{arm} |
610 |
rm -rf %{target_source}/arch/arm* |
611 |
rm -rf %{target_source}/include/kvm/arm* |
612 |
rm -rf %{target_source}/include/soc |
613 |
rm -rf %{target_source}/tools/arch/arm* |
614 |
%endif |
615 |
|
616 |
# remove arch files based on target arch in -devel rpms |
617 |
%if %build_devel |
618 |
%ifnarch %{ix86} x86_64 |
619 |
rm -rf %{target_devel}/arch/x86 |
620 |
%endif |
621 |
%ifnarch %{arm} |
622 |
rm -rf %{target_devel}/arch/arm |
623 |
rm -rf %{target_devel}/arch/arm64 |
624 |
rm -rf %{target_devel}/include/kvm/arm* |
625 |
rm -rf %{target_devel}/include/soc |
626 |
%endif |
627 |
%endif |
628 |
|
629 |
|
630 |
# other misc files |
631 |
rm -f %{target_source}/{.clang-format,.config.old,.config.cmd,.tmp_gas_check,.mailmap,.missing-syscalls.d,arch/.gitignore,.gitattributes,.get_maintainer.ignore,.cocciconfig} |
632 |
rm -rf %{target_source}/.tmp_depmod/ |
633 |
|
634 |
# clean tools tree |
635 |
pushd %{target_source} |
636 |
%smake -C tools clean |
637 |
%smake -C tools/build clean |
638 |
%smake -C tools/build/feature clean |
639 |
popd |
640 |
|
641 |
# nuke last as it gets re-created |
642 |
rm -f %{target_source}/.cache.mk |
643 |
|
644 |
#endif %build_source |
645 |
%endif |
646 |
|
647 |
|
648 |
# compressing modules |
649 |
find %{target_modules} -name "*.ko" | %kxargs xz -6e |
650 |
|
651 |
|
652 |
# We used to have a copy of PrepareKernel here |
653 |
# Now, we make sure that the thing in the linux dir is what we want it to be |
654 |
|
655 |
for i in %{target_modules}/*; do |
656 |
rm -f $i/build $i/source |
657 |
done |
658 |
|
659 |
|
660 |
# sniff, if we gzipped all the modules, we change the stamp :( |
661 |
# we really need the depmod -ae here |
662 |
pushd %{target_modules} |
663 |
for i in *; do |
664 |
/sbin/depmod -ae -b %{buildroot} -F %{target_boot}/System.map-$i $i |
665 |
echo $? |
666 |
done |
667 |
|
668 |
for i in *; do |
669 |
pushd $i |
670 |
echo "Creating module.description for $i" |
671 |
modules=`find . -name "*.ko.xz"` |
672 |
echo $modules | xargs /sbin/modinfo \ |
673 |
| perl -lne 'print "$name\t$1" if $name && /^description:\s*(.*)/; $name = $1 if m!^filename:\s*(.*)\.k?o!; $name =~ s!.*/!!' > modules.description |
674 |
popd |
675 |
done |
676 |
popd |
677 |
|
678 |
|
679 |
### |
680 |
### Clean |
681 |
### |
682 |
|
683 |
%clean |
684 |
rm -rf %{buildroot} |
685 |
# We don't want to remove this, the whole reason of its existence is to be |
686 |
# able to do several rpm --short-circuit -bi for testing install |
687 |
# phase without repeating compilation phase |
688 |
#rm -rf %{temp_root} |
689 |
|
690 |
|
691 |
### |
692 |
### Scripts |
693 |
### |
694 |
|
695 |
### kernel |
696 |
%if %build_kernel |
697 |
%preun -n %{kname}-%{buildrel} |
698 |
/sbin/installkernel -R %{buildrel} |
699 |
if [ -L /lib/modules/%{buildrel}/build ]; then |
700 |
rm -f /lib/modules/%{buildrel}/build |
701 |
fi |
702 |
if [ -L /lib/modules/%{buildrel}/source ]; then |
703 |
rm -f /lib/modules/%{buildrel}/source |
704 |
fi |
705 |
pushd /boot > /dev/null |
706 |
if [ -L vmlinuz-linus ]; then |
707 |
if [ "$(readlink vmlinuz-linus)" = "vmlinuz-%{buildrel}" ]; then |
708 |
rm -f vmlinuz-linus |
709 |
fi |
710 |
fi |
711 |
if [ -L initrd-linus.img ]; then |
712 |
if [ "$(readlink initrd-linus.img)" = "initrd-%{buildrel}.img" ]; then |
713 |
rm -f initrd-linus.img |
714 |
fi |
715 |
fi |
716 |
popd > /dev/null |
717 |
exit 0 |
718 |
|
719 |
%post -n %{kname}-%{buildrel} |
720 |
/sbin/installkernel -L %{buildrel} |
721 |
if [ -d /usr/src/%{kname}-devel-%{buildrel} ]; then |
722 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build |
723 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source |
724 |
fi |
725 |
pushd /boot > /dev/null |
726 |
if [ -L vmlinuz-linus ]; then |
727 |
rm -f vmlinuz-linus |
728 |
fi |
729 |
ln -sf vmlinuz-%{buildrel} vmlinuz-linus |
730 |
if [ -L initrd-linus.img ]; then |
731 |
rm -f initrd-linus.img |
732 |
fi |
733 |
ln -sf initrd-%{buildrel}.img initrd-linus.img |
734 |
popd > /dev/null |
735 |
|
736 |
%posttrans -n %{kname}-%{buildrel} |
737 |
if [ -x /usr/sbin/dkms_autoinstaller -a -d /usr/src/%{kname}-devel-%{buildrel} ]; then |
738 |
/usr/sbin/dkms_autoinstaller start %{buildrel} |
739 |
fi |
740 |
|
741 |
%postun -n %{kname}-%{buildrel} |
742 |
/sbin/kernel_remove_initrd %{buildrel} |
743 |
rm -rf /lib/modules/%{buildrel} > /dev/null |
744 |
%endif # build_kernel |
745 |
|
746 |
|
747 |
### kernel-devel |
748 |
%if %build_devel |
749 |
%post -n %{kname}-devel-%{buildrel} |
750 |
# place /build and /source symlinks in place. |
751 |
if [ -d /lib/modules/%{buildrel} ]; then |
752 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build |
753 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source |
754 |
fi |
755 |
|
756 |
%preun -n %{kname}-devel-%{buildrel} |
757 |
# we need to delete <modules>/{build,source} at uninstall |
758 |
if [ -L /lib/modules/%{buildrel}/build ]; then |
759 |
rm -f /lib/modules/%{buildrel}/build |
760 |
fi |
761 |
if [ -L /lib/modules/%{buildrel}/source ]; then |
762 |
rm -f /lib/modules/%{buildrel}/source |
763 |
fi |
764 |
exit 0 |
765 |
%endif #build_devel |
766 |
|
767 |
|
768 |
### |
769 |
### file lists |
770 |
### |
771 |
|
772 |
# kernel |
773 |
%if %build_kernel |
774 |
%files -n %{kname}-%{buildrel} |
775 |
%{_bootdir}/config-%{buildrel} |
776 |
%{_bootdir}/vmlinuz-%{buildrel} |
777 |
%{_bootdir}/System.map-%{buildrel} |
778 |
%dir %{_modulesdir}/%{buildrel}/ |
779 |
%{_modulesdir}/%{buildrel}/kernel |
780 |
%{_modulesdir}/%{buildrel}/modules.* |
781 |
%doc README.kernel-sources |
782 |
%ifarch %arm |
783 |
%dir /usr/lib/linux-%{buildrel} |
784 |
/usr/lib/linux-%{buildrel}/*.dtb |
785 |
%endif |
786 |
%endif # build_kernel |
787 |
|
788 |
# kernel-source |
789 |
%if %build_source |
790 |
%files -n %{kname}-source-%{buildrel} |
791 |
%doc %{_kerneldir}/LICENSES |
792 |
%dir %{_kerneldir} |
793 |
%dir %{_kerneldir}/arch |
794 |
%dir %{_kerneldir}/include |
795 |
%{_kerneldir}/.gitignore |
796 |
%{_kerneldir}/COPYING |
797 |
%{_kerneldir}/CREDITS |
798 |
%{_kerneldir}/Documentation |
799 |
%{_kerneldir}/Kbuild |
800 |
%{_kerneldir}/Kconfig |
801 |
%{_kerneldir}/MAINTAINERS |
802 |
%{_kerneldir}/Makefile |
803 |
%{_kerneldir}/README |
804 |
%{_kerneldir}/arch/Kconfig |
805 |
%ifarch %arm |
806 |
%{_kerneldir}/arch/arm |
807 |
%{_kerneldir}/arch/arm64 |
808 |
%endif |
809 |
%{_kerneldir}/arch/x86 |
810 |
%{_kerneldir}/arch/um |
811 |
%{_kerneldir}/block |
812 |
%{_kerneldir}/certs |
813 |
%{_kerneldir}/crypto |
814 |
%{_kerneldir}/drivers |
815 |
%{_kerneldir}/fs |
816 |
%{_kerneldir}/include/acpi |
817 |
%{_kerneldir}/include/asm-generic |
818 |
%{_kerneldir}/include/clocksource |
819 |
%{_kerneldir}/include/crypto |
820 |
%{_kerneldir}/include/drm |
821 |
%{_kerneldir}/include/dt-bindings |
822 |
%{_kerneldir}/include/kvm |
823 |
%{_kerneldir}/include/linux |
824 |
%{_kerneldir}/include/math-emu |
825 |
%{_kerneldir}/include/memory |
826 |
%{_kerneldir}/include/net |
827 |
%{_kerneldir}/include/pcmcia |
828 |
%{_kerneldir}/include/ras |
829 |
%{_kerneldir}/include/scsi |
830 |
%ifarch %arm |
831 |
%{_kerneldir}/include/soc |
832 |
%endif |
833 |
%{_kerneldir}/include/sound |
834 |
%{_kerneldir}/include/target |
835 |
%{_kerneldir}/include/trace |
836 |
%{_kerneldir}/include/uapi |
837 |
%{_kerneldir}/include/video |
838 |
%{_kerneldir}/include/media |
839 |
%{_kerneldir}/include/misc |
840 |
%{_kerneldir}/include/keys |
841 |
%{_kerneldir}/include/rdma |
842 |
%{_kerneldir}/include/xen |
843 |
%{_kerneldir}/init |
844 |
%{_kerneldir}/ipc |
845 |
%{_kerneldir}/kernel |
846 |
%{_kerneldir}/lib |
847 |
%{_kerneldir}/mm |
848 |
%{_kerneldir}/net |
849 |
%{_kerneldir}/samples |
850 |
%{_kerneldir}/scripts |
851 |
%{_kerneldir}/security |
852 |
%{_kerneldir}/sound |
853 |
%{_kerneldir}/tools |
854 |
%{_kerneldir}/usr |
855 |
%{_kerneldir}/virt |
856 |
%doc README.kernel-sources |
857 |
%endif # build_source |
858 |
|
859 |
# kernel-devel |
860 |
%if %build_devel |
861 |
%files -n %{kname}-devel-%{buildrel} |
862 |
%dir %{_develdir} |
863 |
%dir %{_develdir}/arch |
864 |
%dir %{_develdir}/include |
865 |
%{_develdir}/.config |
866 |
%{_develdir}/Documentation |
867 |
%{_develdir}/Kbuild |
868 |
%{_develdir}/Kconfig |
869 |
%{_develdir}/Makefile |
870 |
%{_develdir}/Module.symvers |
871 |
%{_develdir}/arch/Kconfig |
872 |
%ifarch %{arm} |
873 |
%{_develdir}/arch/arm |
874 |
%{_develdir}/arch/arm64 |
875 |
%endif |
876 |
%ifarch %{ix86} x86_64 |
877 |
%{_develdir}/arch/x86 |
878 |
%endif |
879 |
%{_develdir}/arch/um |
880 |
%{_develdir}/block |
881 |
%{_develdir}/certs |
882 |
%{_develdir}/crypto |
883 |
%{_develdir}/drivers |
884 |
%{_develdir}/fs |
885 |
%{_develdir}/include/acpi |
886 |
%{_develdir}/include/asm-generic |
887 |
%{_develdir}/include/clocksource |
888 |
%{_develdir}/include/config |
889 |
%{_develdir}/include/crypto |
890 |
%{_develdir}/include/drm |
891 |
%{_develdir}/include/dt-bindings |
892 |
%{_develdir}/include/generated |
893 |
%{_develdir}/include/keys |
894 |
%{_develdir}/include/kvm |
895 |
%{_develdir}/include/linux |
896 |
%{_develdir}/include/math-emu |
897 |
%{_develdir}/include/memory |
898 |
%{_develdir}/include/misc |
899 |
%{_develdir}/include/net |
900 |
%{_develdir}/include/pcmcia |
901 |
%{_develdir}/include/ras |
902 |
%{_develdir}/include/rdma |
903 |
%{_develdir}/include/scsi |
904 |
%ifarch %arm |
905 |
%{_develdir}/include/soc |
906 |
%endif |
907 |
%{_develdir}/include/sound |
908 |
%{_develdir}/include/target |
909 |
%{_develdir}/include/trace |
910 |
%{_develdir}/include/uapi |
911 |
%{_develdir}/include/video |
912 |
%{_develdir}/include/media |
913 |
%{_develdir}/include/xen |
914 |
%{_develdir}/init |
915 |
%{_develdir}/ipc |
916 |
%{_develdir}/kernel |
917 |
%{_develdir}/lib |
918 |
%{_develdir}/mm |
919 |
%{_develdir}/net |
920 |
%{_develdir}/samples |
921 |
%{_develdir}/scripts |
922 |
%{_develdir}/security |
923 |
%{_develdir}/sound |
924 |
%{_develdir}/tools |
925 |
%{_develdir}/usr |
926 |
%{_develdir}/virt |
927 |
%doc README.kernel-sources |
928 |
%endif # build_devel |
929 |
|
930 |
|
931 |
%if %build_doc |
932 |
%files -n %{kname}-doc |
933 |
%doc linux-%{tar_ver}/Documentation/* |
934 |
%endif # build_doc |
935 |
|
936 |
%if %build_kernel |
937 |
%files -n %{kname}-latest |
938 |
%endif # build_kernel |
939 |
|
940 |
%if %build_source |
941 |
%files -n %{kname}-source-latest |
942 |
%endif # build_source |
943 |
|
944 |
%if %build_devel |
945 |
%files -n %{kname}-devel-latest |
946 |
%endif # build_devel |