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