1 |
# upstream versioning |
2 |
%define kernelversion 4 |
3 |
%define patchlevel 1 |
4 |
# sublevel is now used for -stable patches |
5 |
%define sublevel 4 |
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}.%{patchlevel}/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.xz |
158 |
Source11: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.sign |
159 |
%endif |
160 |
%if %kpatch |
161 |
Patch2: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/testing/patch-%{kernelversion}.%{patchlevel}-%{kpatch}.xz |
162 |
Source12: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/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 |
BuildRequires: binutils >= 1:2.25.1 |
179 |
%ifarch %{arm} |
180 |
BuildRequires: uboot-mkimage |
181 |
%endif |
182 |
|
183 |
%description |
184 |
Source package to build the Linux kernel. |
185 |
|
186 |
%{klinus_notice} |
187 |
|
188 |
|
189 |
# |
190 |
# kernel: Symmetric MultiProcessing kernel |
191 |
# |
192 |
%if %build_kernel |
193 |
%package -n %{kname}-%{buildrel} |
194 |
Version: %{fakever} |
195 |
Release: %{fakerel} |
196 |
%ifarch %{ix86} |
197 |
Summary: Linux Kernel for desktop use with i586 & 4GB RAM |
198 |
%else |
199 |
%ifarch %{arm} |
200 |
Linux Kernel for Arm machines based on Kirkwood |
201 |
%else |
202 |
Summary: Linux Kernel for desktop use with %{_arch} |
203 |
%endif |
204 |
%endif |
205 |
Group: System/Kernel and hardware |
206 |
Provides: should-restart = system |
207 |
Provides: kernel = %{tar_ver} |
208 |
Provides: alsa |
209 |
Requires: bootloader-utils >= 1.16-1 |
210 |
Requires: dracut >= 033-1 |
211 |
Requires: kmod >= 12-2 |
212 |
Requires: sysfsutils >= 2.1.0-16 |
213 |
Requires: kernel-firmware >= 20150722-1 |
214 |
# conflict dkms packages not supporting kernel 3.15 |
215 |
Conflicts: dkms-broadcom-wl < 6.30.223.141-5 |
216 |
Conflicts: dkms-fglrx < 14.010.1006-3 |
217 |
Conflicts: dkms-nvidia-current < 337.25-1 |
218 |
Conflicts: dkms-nvidia304 < 304.121-2 |
219 |
Conflicts: dkms-nvidia173 < 173.14.39-3 |
220 |
# (tmb) nvidia96xx does not support this kernel or x11-server-1.13 |
221 |
Conflicts: dkms-nvidia96xx <= 96.43.23 |
222 |
Conflicts: dkms-xtables-addons < 2.5-3 |
223 |
# (tmb) conflict too old lvm2 rules to make upgrades work (tv, mga #9536) |
224 |
Conflicts: lvm2 < 2.02.98-3 |
225 |
# (tmb) conflict too old drakxtools-backend to avoid bogus root=/dev/ (#9536) |
226 |
Conflicts: drakxtools-backend < 15.37-1 |
227 |
# (tmb) conflict older btrfs-progs to get the new in same transaction and in initrd |
228 |
Conflicts: btrfs-progs < 0.20-0.rc1.20130607.2 |
229 |
# (tmb) conflict too old plymouth (#10128) |
230 |
Conflicts: plymouth < 0.8.6.1-8 |
231 |
# (tmb) conflict too old radeon-firmware to get the uvd firmwares in initrd |
232 |
Conflicts: radeon-firmware < 20150722-1 |
233 |
%ifarch %{ix86} |
234 |
Conflicts: arch(x86_64) |
235 |
%endif |
236 |
|
237 |
%description -n %{kname}-%{buildrel} |
238 |
%ifarch %{ix86} |
239 |
This kernel is compiled for desktop use, single or multiple i586 |
240 |
processor(s)/core(s) and less than 4GB RAM, using HZ_1000, voluntary |
241 |
preempt, CFS cpu scheduler and cfq i/o scheduler. |
242 |
This kernel relies on in-kernel smp alternatives to switch between |
243 |
up & smp mode depending on detected hardware. To force the kernel |
244 |
to boot in single processor mode, use the "nosmp" boot parameter. |
245 |
%else |
246 |
%ifarch %{arm} |
247 |
This kernel is compiled for Arm Kirkwood boxes. It will run on openrd |
248 |
boards. It's configured using HZ_100, preempt, CFS cpu scheduler and |
249 |
cfq i/o scheduler. |
250 |
This kernel relies on in-kernel smp alternatives to switch between |
251 |
up & smp mode depending on detected hardware. To force the kernel |
252 |
to boot in single processor mode, use the "nosmp" boot parameter. |
253 |
%else |
254 |
This kernel is compiled for desktop use, single or multiple %{_arch} |
255 |
processor(s)/core(s), using HZ_1000, voluntary preempt, CFS cpu |
256 |
scheduler and cfq i/o scheduler. |
257 |
This kernel relies on in-kernel smp alternatives to switch between |
258 |
up & smp mode depending on detected hardware. To force the kernel |
259 |
to boot in single processor mode, use the "nosmp" boot parameter. |
260 |
%endif |
261 |
%endif |
262 |
|
263 |
%{klinus_notice} |
264 |
%endif # build_kernel |
265 |
|
266 |
|
267 |
# |
268 |
# kernel-source: kernel sources |
269 |
# |
270 |
%if %build_source |
271 |
%package -n %{kname}-source-%{buildrel} |
272 |
Version: %{fakever} |
273 |
Release: %{fakerel} |
274 |
Provides: %{kname}-source, kernel-source = %{kverrel} |
275 |
Provides: %{kname}-source-%{kernelversion}.%{patchlevel} |
276 |
Requires: glibc-devel, ncurses-devel, make, gcc, perl, diffutils |
277 |
Summary: The source code for the Linux kernel |
278 |
Group: Development/Kernel |
279 |
Autoreqprov: no |
280 |
Buildarch: noarch |
281 |
|
282 |
%description -n %{kname}-source-%{buildrel} |
283 |
The %{kname}-source package contains the source code files for the |
284 |
Linux kernel. Theese source files are only needed if you want to build |
285 |
your own custom kernel that is better tuned to your particular hardware. |
286 |
|
287 |
If you only want the files needed to build 3rdparty (nVidia, Ati, dkms-*,...) |
288 |
drivers against, install the *-devel-* rpm that is matching your kernel. |
289 |
|
290 |
%{klinus_notice} |
291 |
%endif #build_source |
292 |
|
293 |
|
294 |
# |
295 |
# kernel-devel: stripped kernel sources |
296 |
# |
297 |
%if %build_devel |
298 |
%package -n %{kname}-devel-%{buildrel} |
299 |
Version: %{fakever} |
300 |
Release: %{fakerel} |
301 |
Provides: kernel-devel = %{kverrel} |
302 |
Summary: The %{kname} devel files for 3rdparty modules build |
303 |
Group: Development/Kernel |
304 |
Autoreqprov: no |
305 |
Requires: glibc-devel, ncurses-devel, make, gcc, perl |
306 |
%ifarch %{ix86} |
307 |
Conflicts: arch(x86_64) |
308 |
%endif |
309 |
|
310 |
%description -n %{kname}-devel-%{buildrel} |
311 |
This package contains the kernel-devel files that should be enough to build |
312 |
3rdparty drivers against for use with the %{kname}-%{buildrel}. |
313 |
|
314 |
If you want to build your own kernel, you need to install the full |
315 |
%{kname}-source-%{buildrel} rpm. |
316 |
|
317 |
%{klinus_notice} |
318 |
%endif #build_devel |
319 |
|
320 |
|
321 |
# |
322 |
# kernel-doc: documentation for the Linux kernel |
323 |
# |
324 |
%if %build_doc |
325 |
%package -n %{kname}-doc |
326 |
Version: %{kversion} |
327 |
Release: %{rpmrel} |
328 |
Summary: Various documentation bits found in the kernel source |
329 |
Group: Documentation |
330 |
Buildarch: noarch |
331 |
|
332 |
%description -n %{kname}-doc |
333 |
This package contains documentation files form the kernel source. Various |
334 |
bits of information about the Linux kernel and the device drivers shipped |
335 |
with it are documented in these files. You also might want install this |
336 |
package if you need a reference to the options that can be passed to Linux |
337 |
kernel modules at load time. |
338 |
|
339 |
%{klinus_notice} |
340 |
%endif #build_doc |
341 |
|
342 |
|
343 |
# |
344 |
# kernel-latest: virtual rpm |
345 |
# |
346 |
%if %build_kernel |
347 |
%package -n %{kname}-latest |
348 |
Version: %{kversion} |
349 |
Release: %{rpmrel} |
350 |
Summary: Virtual rpm for latest %{kname} |
351 |
Group: System/Kernel and hardware |
352 |
Requires: %{kname}-%{buildrel} |
353 |
%ifarch %{ix86} |
354 |
Conflicts: arch(x86_64) |
355 |
%endif |
356 |
|
357 |
%description -n %{kname}-latest |
358 |
This package is a virtual rpm that aims to make sure you always have the |
359 |
latest %{kname} installed... |
360 |
|
361 |
%{klinus_notice} |
362 |
%endif #build_kernel |
363 |
|
364 |
|
365 |
# |
366 |
# kernel-source-latest: virtual rpm |
367 |
# |
368 |
%if %build_source |
369 |
%package -n %{kname}-source-latest |
370 |
Version: %{kversion} |
371 |
Release: %{rpmrel} |
372 |
Summary: Virtual rpm for latest %{kname}-source |
373 |
Group: System/Kernel and hardware |
374 |
Requires: %{kname}-source-%{buildrel} |
375 |
Buildarch: noarch |
376 |
|
377 |
%description -n %{kname}-source-latest |
378 |
This package is a virtual rpm that aims to make sure you always have the |
379 |
latest %{kname}-source installed... |
380 |
|
381 |
%{klinus_notice} |
382 |
%endif #build_source |
383 |
|
384 |
|
385 |
# |
386 |
# kernel-devel-latest: virtual rpm |
387 |
# |
388 |
%if %build_devel |
389 |
%package -n %{kname}-devel-latest |
390 |
Version: %{kversion} |
391 |
Release: %{rpmrel} |
392 |
Summary: Virtual rpm for latest %{kname}-devel |
393 |
Group: System/Kernel and hardware |
394 |
Requires: %{kname}-devel-%{buildrel} |
395 |
%ifarch %{ix86} |
396 |
Conflicts: arch(x86_64) |
397 |
%endif |
398 |
|
399 |
%description -n %{kname}-devel-latest |
400 |
This package is a virtual rpm that aims to make sure you always have the |
401 |
latest %{kname}-devel installed... |
402 |
|
403 |
%{klinus_notice} |
404 |
%endif #build_devel |
405 |
|
406 |
|
407 |
# |
408 |
# End packages - here begins build stage |
409 |
# |
410 |
%prep |
411 |
%setup -q -n %top_dir_name -c |
412 |
|
413 |
pushd %src_dir |
414 |
|
415 |
%if %sublevel |
416 |
%patch1 -p1 |
417 |
%endif |
418 |
%if %kpatch |
419 |
%patch2 -p1 |
420 |
%endif |
421 |
%if %extstable |
422 |
%patch3 -p1 |
423 |
%endif |
424 |
|
425 |
# critical fixes |
426 |
|
427 |
popd |
428 |
|
429 |
# PATCH END |
430 |
|
431 |
|
432 |
# |
433 |
# Setup Begin |
434 |
# |
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 |
# make sure EXTRAVERSION says what we want it to say |
471 |
%if %extstable |
472 |
LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = .%{extstable}-%{buildrpmrel}/" Makefile |
473 |
%else |
474 |
LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{buildrpmrel}/" Makefile |
475 |
%endif |
476 |
|
477 |
# Prepare the kernel |
478 |
%smake -s mrproper |
479 |
%ifarch %{ix86} x86_64 |
480 |
cp arch/x86/configs/%{target_arch}_defconfig .config |
481 |
%else |
482 |
cp arch/%{target_arch}/%{target_arch}_defconfig .config |
483 |
%endif |
484 |
%smake oldconfig |
485 |
|
486 |
# Build the kernel |
487 |
%kmake -s all |
488 |
%ifarch %{arm} |
489 |
%kmake uImage |
490 |
%endif |
491 |
# Install kernel |
492 |
install -d %{temp_boot} |
493 |
install -m 644 System.map %{temp_boot}/System.map-%{buildrel} |
494 |
install -m 644 .config %{temp_boot}/config-%{buildrel} |
495 |
%ifarch %{arm} |
496 |
cp -f arch/%{target_arch}/boot/uImage %{temp_boot}/uImage-$KernelVer |
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 INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=%{buildrel} modules_install |
504 |
|
505 |
# remove /lib/firmware, we use a separate kernel-firmware |
506 |
rm -rf %{temp_root}/lib/firmware |
507 |
|
508 |
# Save devel tree |
509 |
%if %build_devel |
510 |
mkdir -p %{temp_devel} |
511 |
for i in $(find . -name 'Makefile*'); do cp -R --parents $i %{temp_devel};done |
512 |
for i in $(find . -name 'Kconfig*' -o -name 'Kbuild*' -o -name config.mk); do cp -R --parents $i %{temp_devel};done |
513 |
cp -fR Documentation/DocBook/media/*.b64 %{temp_devel}/Documentation/DocBook/media/ |
514 |
cp -fR include %{temp_devel} |
515 |
cp -fR scripts %{temp_devel} |
516 |
cp -fR tools/include %{temp_devel}/tools/ |
517 |
%ifarch %{arm} |
518 |
cp -fR arch/%{target_arch}/tools %{temp_devel}/arch/%{target_arch}/ |
519 |
%endif |
520 |
%ifarch %{ix86} x86_64 |
521 |
cp -fR arch/x86/boot/{ctype.h,string.{c,h}} %{temp_devel}/arch/x86/boot/ |
522 |
cp -fR arch/x86/kernel/asm-offsets.{c,s} %{temp_devel}/arch/x86/kernel/ |
523 |
cp -fR arch/x86/kernel/asm-offsets_{32,64}.c %{temp_devel}/arch/x86/kernel/ |
524 |
cp -fR arch/x86/purgatory/* %{temp_devel}/arch/x86/purgatory/ |
525 |
cp -fR arch/x86/syscalls/syscall* %{temp_devel}/arch/x86/syscalls/ |
526 |
cp -fR arch/x86/include %{temp_devel}/arch/x86/ |
527 |
cp -fR arch/x86/tools %{temp_devel}/arch/x86/ |
528 |
%else |
529 |
cp -fR arch/%{target_arch}/kernel/asm-offsets.{c,s} %{temp_devel}/arch/%{target_arch}/kernel/ |
530 |
for f in $(find arch/%{target_arch} -name include); do cp -fR --parents $f %{temp_devel}; done |
531 |
%endif |
532 |
|
533 |
# Needed for generation of kernel/bounds.s |
534 |
cp -fR kernel/bounds.c %{temp_devel}/kernel/ |
535 |
|
536 |
# Needed for lguest |
537 |
cp -fR drivers/lguest/lg.h %{temp_devel}/drivers/lguest/ |
538 |
|
539 |
cp -fR .config Module.symvers %{temp_devel} |
540 |
|
541 |
# Needed for truecrypt build (Danny) |
542 |
cp -fR drivers/md/dm.h %{temp_devel}/drivers/md/ |
543 |
|
544 |
# Needed for external dvb tree (#41418) |
545 |
cp -fR drivers/media/dvb-core/*.h %{temp_devel}/drivers/media/dvb-core/ |
546 |
cp -fR drivers/media/dvb-frontends/lgdt330x.h %{temp_devel}/drivers/media/dvb-frontends/ |
547 |
|
548 |
# add acpica header files, needed for fglrx build |
549 |
cp -fR drivers/acpi/acpica/*.h %{temp_devel}/drivers/acpi/acpica/ |
550 |
|
551 |
# Check and clean the -devel tree |
552 |
pushd %{temp_devel} >/dev/null |
553 |
%smake -s prepare scripts clean |
554 |
rm -f .config.old |
555 |
popd >/dev/null |
556 |
|
557 |
# Disable mrproper and other targets |
558 |
patch -p1 -d %{temp_devel} -i %{SOURCE2} |
559 |
|
560 |
# Fix permissions |
561 |
chmod -R a+rX %{temp_devel} |
562 |
%endif # build_devel |
563 |
|
564 |
#make sure we are in the directory |
565 |
cd %src_dir |
566 |
|
567 |
# kernel-source is shipped as an unprepared tree |
568 |
%smake -s mrproper |
569 |
|
570 |
|
571 |
### |
572 |
### Install |
573 |
### |
574 |
%install |
575 |
install -m 644 %{SOURCE4} . |
576 |
|
577 |
cd %src_dir |
578 |
# Directories definition needed for installing |
579 |
%define target_source %{buildroot}/%{_kerneldir} |
580 |
%define target_boot %{buildroot}%{_bootdir} |
581 |
%define target_modules %{buildroot}%{_modulesdir} |
582 |
%define target_devel %{buildroot}%{_develdir} |
583 |
|
584 |
# We want to be able to test several times the install part |
585 |
rm -rf %{buildroot} |
586 |
cp -a %{temp_root} %{buildroot} |
587 |
|
588 |
# Create directories infastructure |
589 |
%if %build_source |
590 |
install -d %{target_source} |
591 |
|
592 |
tar cf - . | tar xf - -C %{target_source} |
593 |
chmod -R a+rX %{target_source} |
594 |
|
595 |
# we remove all the source files that we don't ship |
596 |
|
597 |
# first architecture files |
598 |
for i in alpha arc avr32 blackfin c6x cris frv hexagon h8300 ia64 m32r mips \ |
599 |
microblaze m68k m68knommu metag mn10300 nios2 openrisc parisc powerpc ppc \ |
600 |
s390 score sh sh64 sparc tile unicore32 v850 xtensa; do |
601 |
rm -rf %{target_source}/arch/$i |
602 |
|
603 |
%if %build_devel |
604 |
rm -rf %{target_devel}/arch/$i |
605 |
%endif |
606 |
done |
607 |
%ifnarch %{arm} |
608 |
rm -rf %{target_source}/include/kvm/arm* |
609 |
%endif |
610 |
|
611 |
# remove arch files based on target arch in -devel rpms |
612 |
%if %build_devel |
613 |
%ifnarch %{ix86} x86_64 |
614 |
rm -rf %{target_devel}/arch/x86 |
615 |
%endif |
616 |
%ifnarch %{arm} |
617 |
rm -rf %{target_devel}/arch/arm |
618 |
rm -rf %{target_devel}/arch/arm64 |
619 |
rm -rf %{target_devel}/include/kvm/arm* |
620 |
rm -rf %{target_devel}/include/soc/tegra |
621 |
%endif |
622 |
%endif |
623 |
|
624 |
|
625 |
# other misc files |
626 |
rm -f %{target_source}/{.config.old,.config.cmd,.tmp_gas_check,.mailmap,.missing-syscalls.d,arch/.gitignore} |
627 |
rm -rf %{target_source}/.tmp_depmod/ |
628 |
|
629 |
#endif %build_source |
630 |
%endif |
631 |
|
632 |
|
633 |
# compressing modules |
634 |
find %{target_modules} -name "*.ko" | %kxargs xz -6e |
635 |
|
636 |
|
637 |
# We used to have a copy of PrepareKernel here |
638 |
# Now, we make sure that the thing in the linux dir is what we want it to be |
639 |
|
640 |
for i in %{target_modules}/*; do |
641 |
rm -f $i/build $i/source |
642 |
done |
643 |
|
644 |
|
645 |
# sniff, if we gzipped all the modules, we change the stamp :( |
646 |
# we really need the depmod -ae here |
647 |
pushd %{target_modules} |
648 |
for i in *; do |
649 |
/sbin/depmod -ae -b %{buildroot} -F %{target_boot}/System.map-$i $i |
650 |
echo $? |
651 |
done |
652 |
|
653 |
for i in *; do |
654 |
pushd $i |
655 |
echo "Creating module.description for $i" |
656 |
modules=`find . -name "*.ko.xz"` |
657 |
echo $modules | %kxargs /sbin/modinfo \ |
658 |
| perl -lne 'print "$name\t$1" if $name && /^description:\s*(.*)/; $name = $1 if m!^filename:\s*(.*)\.k?o!; $name =~ s!.*/!!' > modules.description |
659 |
popd |
660 |
done |
661 |
popd |
662 |
|
663 |
|
664 |
### |
665 |
### Clean |
666 |
### |
667 |
|
668 |
%clean |
669 |
rm -rf %{buildroot} |
670 |
# We don't want to remove this, the whole reason of its existence is to be |
671 |
# able to do several rpm --short-circuit -bi for testing install |
672 |
# phase without repeating compilation phase |
673 |
#rm -rf %{temp_root} |
674 |
|
675 |
|
676 |
### |
677 |
### Scripts |
678 |
### |
679 |
|
680 |
### kernel |
681 |
%if %build_kernel |
682 |
%preun -n %{kname}-%{buildrel} |
683 |
/sbin/installkernel -R %{buildrel} |
684 |
if [ -L /lib/modules/%{buildrel}/build ]; then |
685 |
rm -f /lib/modules/%{buildrel}/build |
686 |
fi |
687 |
if [ -L /lib/modules/%{buildrel}/source ]; then |
688 |
rm -f /lib/modules/%{buildrel}/source |
689 |
fi |
690 |
pushd /boot > /dev/null |
691 |
if [ -L vmlinuz-linus ]; then |
692 |
if [ "$(readlink vmlinuz-linus)" = "vmlinuz-%{buildrel}" ]; then |
693 |
rm -f vmlinuz-linus |
694 |
fi |
695 |
fi |
696 |
if [ -L initrd-linus.img ]; then |
697 |
if [ "$(readlink initrd-linus.img)" = "initrd-%{buildrel}.img" ]; then |
698 |
rm -f initrd-linus.img |
699 |
fi |
700 |
fi |
701 |
popd > /dev/null |
702 |
exit 0 |
703 |
|
704 |
%post -n %{kname}-%{buildrel} |
705 |
/sbin/installkernel -L %{buildrel} |
706 |
if [ -d /usr/src/%{kname}-devel-%{buildrel} ]; then |
707 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build |
708 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source |
709 |
fi |
710 |
pushd /boot > /dev/null |
711 |
if [ -L vmlinuz-linus ]; then |
712 |
rm -f vmlinuz-linus |
713 |
fi |
714 |
ln -sf vmlinuz-%{buildrel} vmlinuz-linus |
715 |
if [ -L initrd-linus.img ]; then |
716 |
rm -f initrd-linus.img |
717 |
fi |
718 |
ln -sf initrd-%{buildrel}.img initrd-linus.img |
719 |
popd > /dev/null |
720 |
|
721 |
%posttrans -n %{kname}-%{buildrel} |
722 |
if [ -x /usr/sbin/dkms_autoinstaller -a -d /usr/src/%{kname}-devel-%{buildrel} ]; then |
723 |
/usr/sbin/dkms_autoinstaller start %{buildrel} |
724 |
fi |
725 |
|
726 |
%postun -n %{kname}-%{buildrel} |
727 |
/sbin/kernel_remove_initrd %{buildrel} |
728 |
rm -rf /lib/modules/%{buildrel} > /dev/null |
729 |
%endif # build_kernel |
730 |
|
731 |
|
732 |
### kernel-devel |
733 |
%if %build_devel |
734 |
%post -n %{kname}-devel-%{buildrel} |
735 |
# place /build and /source symlinks in place. |
736 |
if [ -d /lib/modules/%{buildrel} ]; then |
737 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build |
738 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source |
739 |
fi |
740 |
|
741 |
%preun -n %{kname}-devel-%{buildrel} |
742 |
# we need to delete <modules>/{build,source} at uninstall |
743 |
if [ -L /lib/modules/%{buildrel}/build ]; then |
744 |
rm -f /lib/modules/%{buildrel}/build |
745 |
fi |
746 |
if [ -L /lib/modules/%{buildrel}/source ]; then |
747 |
rm -f /lib/modules/%{buildrel}/source |
748 |
fi |
749 |
exit 0 |
750 |
%endif #build_devel |
751 |
|
752 |
|
753 |
### |
754 |
### file lists |
755 |
### |
756 |
|
757 |
# kernel |
758 |
%if %build_kernel |
759 |
%files -n %{kname}-%{buildrel} |
760 |
%{_bootdir}/config-%{buildrel} |
761 |
%ifarch %{arm} |
762 |
%{_bootdir}/uImage-%{buildrel} |
763 |
%else |
764 |
%{_bootdir}/vmlinuz-%{buildrel} |
765 |
%endif |
766 |
%{_bootdir}/System.map-%{buildrel} |
767 |
%dir %{_modulesdir}/%{buildrel}/ |
768 |
%{_modulesdir}/%{buildrel}/kernel |
769 |
%{_modulesdir}/%{buildrel}/modules.* |
770 |
%doc README.kernel-sources |
771 |
%endif # build_kernel |
772 |
|
773 |
# kernel-source |
774 |
%if %build_source |
775 |
%files -n %{kname}-source-%{buildrel} |
776 |
%dir %{_kerneldir} |
777 |
%dir %{_kerneldir}/arch |
778 |
%dir %{_kerneldir}/include |
779 |
%{_kerneldir}/.gitignore |
780 |
%{_kerneldir}/COPYING |
781 |
%{_kerneldir}/CREDITS |
782 |
%{_kerneldir}/Documentation |
783 |
%{_kerneldir}/Kbuild |
784 |
%{_kerneldir}/Kconfig |
785 |
%{_kerneldir}/MAINTAINERS |
786 |
%{_kerneldir}/Makefile |
787 |
%{_kerneldir}/README |
788 |
%{_kerneldir}/REPORTING-BUGS |
789 |
%{_kerneldir}/arch/Kconfig |
790 |
%{_kerneldir}/arch/arm |
791 |
%{_kerneldir}/arch/arm64 |
792 |
%{_kerneldir}/arch/x86 |
793 |
%{_kerneldir}/arch/um |
794 |
%{_kerneldir}/block |
795 |
%{_kerneldir}/crypto |
796 |
%{_kerneldir}/drivers |
797 |
%{_kerneldir}/firmware |
798 |
%{_kerneldir}/fs |
799 |
%{_kerneldir}/include/Kbuild |
800 |
%{_kerneldir}/include/acpi |
801 |
%{_kerneldir}/include/asm-generic |
802 |
%{_kerneldir}/include/clocksource |
803 |
%{_kerneldir}/include/crypto |
804 |
%{_kerneldir}/include/drm |
805 |
%{_kerneldir}/include/dt-bindings |
806 |
%{_kerneldir}/include/kvm |
807 |
%{_kerneldir}/include/linux |
808 |
%{_kerneldir}/include/math-emu |
809 |
%{_kerneldir}/include/memory |
810 |
%{_kerneldir}/include/net |
811 |
%{_kerneldir}/include/pcmcia |
812 |
%{_kerneldir}/include/ras |
813 |
%{_kerneldir}/include/scsi |
814 |
%{_kerneldir}/include/soc |
815 |
%{_kerneldir}/include/sound |
816 |
%{_kerneldir}/include/target |
817 |
%{_kerneldir}/include/trace |
818 |
%{_kerneldir}/include/uapi |
819 |
%{_kerneldir}/include/video |
820 |
%{_kerneldir}/include/media |
821 |
%{_kerneldir}/include/misc |
822 |
%{_kerneldir}/include/rxrpc |
823 |
%{_kerneldir}/include/keys |
824 |
%{_kerneldir}/include/rdma |
825 |
%{_kerneldir}/include/xen |
826 |
%{_kerneldir}/init |
827 |
%{_kerneldir}/ipc |
828 |
%{_kerneldir}/kernel |
829 |
%{_kerneldir}/lib |
830 |
%{_kerneldir}/mm |
831 |
%{_kerneldir}/net |
832 |
%{_kerneldir}/samples |
833 |
%{_kerneldir}/scripts |
834 |
%{_kerneldir}/security |
835 |
%{_kerneldir}/sound |
836 |
%{_kerneldir}/tools |
837 |
%{_kerneldir}/usr |
838 |
%{_kerneldir}/virt |
839 |
%doc README.kernel-sources |
840 |
%endif # build_source |
841 |
|
842 |
# kernel-devel |
843 |
%if %build_devel |
844 |
%files -n %{kname}-devel-%{buildrel} |
845 |
%dir %{_develdir} |
846 |
%dir %{_develdir}/arch |
847 |
%dir %{_develdir}/include |
848 |
%{_develdir}/.config |
849 |
%{_develdir}/Documentation |
850 |
%{_develdir}/Kbuild |
851 |
%{_develdir}/Kconfig |
852 |
%{_develdir}/Makefile |
853 |
%{_develdir}/Module.symvers |
854 |
%{_develdir}/arch/Kconfig |
855 |
%ifarch %{arm} |
856 |
%{_develdir}/arch/arm |
857 |
%{_develdir}/arch/arm64 |
858 |
%endif |
859 |
%ifarch %{ix86} x86_64 |
860 |
%{_develdir}/arch/x86 |
861 |
%endif |
862 |
%{_develdir}/arch/um |
863 |
%{_develdir}/block |
864 |
%{_develdir}/crypto |
865 |
%{_develdir}/drivers |
866 |
%{_develdir}/firmware |
867 |
%{_develdir}/fs |
868 |
%{_develdir}/include/Kbuild |
869 |
%{_develdir}/include/acpi |
870 |
%{_develdir}/include/asm-generic |
871 |
%{_develdir}/include/clocksource |
872 |
%{_develdir}/include/config |
873 |
%{_develdir}/include/crypto |
874 |
%{_develdir}/include/drm |
875 |
%{_develdir}/include/dt-bindings |
876 |
%{_develdir}/include/generated |
877 |
%{_develdir}/include/keys |
878 |
%{_develdir}/include/kvm |
879 |
%{_develdir}/include/linux |
880 |
%{_develdir}/include/math-emu |
881 |
%{_develdir}/include/memory |
882 |
%{_develdir}/include/misc |
883 |
%{_develdir}/include/net |
884 |
%{_develdir}/include/pcmcia |
885 |
%{_develdir}/include/ras |
886 |
%{_develdir}/include/rdma |
887 |
%{_develdir}/include/scsi |
888 |
%{_develdir}/include/soc |
889 |
%{_develdir}/include/sound |
890 |
%{_develdir}/include/target |
891 |
%{_develdir}/include/trace |
892 |
%{_develdir}/include/uapi |
893 |
%{_develdir}/include/video |
894 |
%{_develdir}/include/media |
895 |
%{_develdir}/include/rxrpc |
896 |
%{_develdir}/include/xen |
897 |
%{_develdir}/init |
898 |
%{_develdir}/ipc |
899 |
%{_develdir}/kernel |
900 |
%{_develdir}/lib |
901 |
%{_develdir}/mm |
902 |
%{_develdir}/net |
903 |
%{_develdir}/samples |
904 |
%{_develdir}/scripts |
905 |
%{_develdir}/security |
906 |
%{_develdir}/sound |
907 |
%{_develdir}/tools |
908 |
%{_develdir}/usr |
909 |
%{_develdir}/virt |
910 |
%doc README.kernel-sources |
911 |
%endif # build_devel |
912 |
|
913 |
|
914 |
%if %build_doc |
915 |
%files -n %{kname}-doc |
916 |
%doc linux-%{tar_ver}/Documentation/* |
917 |
%endif # build_doc |
918 |
|
919 |
%if %build_kernel |
920 |
%files -n %{kname}-latest |
921 |
%endif # build_kernel |
922 |
|
923 |
%if %build_source |
924 |
%files -n %{kname}-source-latest |
925 |
%endif # build_source |
926 |
|
927 |
%if %build_devel |
928 |
%files -n %{kname}-devel-latest |
929 |
%endif # build_devel |