/[packages]/updates/2/kernel-rt/current/SPECS/kernel-rt.spec
ViewVC logotype

Contents of /updates/2/kernel-rt/current/SPECS/kernel-rt.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 338988 - (show annotations) (download)
Sat Jan 5 03:13:56 2013 UTC (11 years, 9 months ago) by tmb
File size: 25373 byte(s)
- fix xfs module failing to init/load properly (P253, P254, #7375)
- fix kernel stack disclosure in binfmt_script load_script() (P254)
  (CVE-2012-4530)


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

  ViewVC Help
Powered by ViewVC 1.1.30