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