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