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