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

Contents of /cauldron/kernel-rt/current/SPECS/kernel-rt.spec

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.28