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