/[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 130085 - (show annotations) (download)
Thu Jul 28 10:21:47 2011 UTC (12 years, 8 months ago) by tmb
File size: 24370 byte(s)
update to 3.0-rt5
1
2 %define kernelversion 3
3 %define patchlevel 0
4 # sublevel is now used for -stable patches
5 %define sublevel 0
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_rel rt5
19
20 # This is only to make life easier for people that creates derivated kernels
21 # a.k.a name it kernel-tmb :)
22 %define kname kernel-rt
23
24 %define rpmtag %{distsuffix}%{mgaver}
25 %if %kpatch
26 %if %kgit
27 %define rpmrel %mkrel 0.%{kpatch}.%{kgit}.%{rt_rel}.%{mgarelease}
28 %else
29 %define rpmrel %mkrel 0.%{kpatch}.%{rt_rel}.%{mgarelease}
30 %endif
31 %else
32 %define rpmrel %mkrel 0.%{rt_rel}.%{mgarelease}
33 %endif
34
35 # theese two never change, they are used to fool rpm/urpmi/smart
36 %define fakever 1
37 %define fakerel %mkrel 1
38
39 # When we are using a pre/rc patch, the tarball is a sublevel -1
40 %if %kpatch
41 %define kversion %{kernelversion}.%{patchlevel}.%{sublevel}
42 %define tar_ver %{kernelversion}.%(expr %{patchlevel} - 1)
43 %else
44 %define kversion %{kernelversion}.%{patchlevel}.%{sublevel}
45 %define tar_ver %{kernelversion}.%{patchlevel}
46 %endif
47 %define kverrel %{kversion}-%{rpmrel}
48
49 # used for not making too long names for rpms or search paths
50 %if %kpatch
51 %if %kgit
52 %define buildrpmrel 0.%{kpatch}.%{kgit}.%{rt_rel}.%{mgarelease}%{rpmtag}
53 %else
54 %define buildrpmrel 0.%{kpatch}.%{rt_rel}.%{mgarelease}%{rpmtag}
55 %endif
56 %else
57 %define buildrpmrel 0.%{rt_rel}.%{mgarelease}%{rpmtag}
58 %endif
59
60 %define buildrel %{kversion}-%{buildrpmrel}
61
62 %define rt_notice NOTE: This kernel has no Mageia patches besides the -rt patch and no third-party drivers.
63
64 # having different top level names for packges means that you have to remove them by hard :(
65 %define top_dir_name %{kname}-%{_arch}
66
67 %define build_dir ${RPM_BUILD_DIR}/%{top_dir_name}
68 %define src_dir %{build_dir}/linux-%{tar_ver}
69
70 # disable useless debug rpms...
71 %define _enable_debug_packages %{nil}
72 %define debug_package %{nil}
73
74 # build defines
75 %define build_doc 1
76 %define build_source 1
77 %define build_devel 1
78
79 %define build_kernel 1
80
81 %define distro_branch %(perl -pe '/(\\d+)\\.(\\d)\\.?(\\d)?/; $_="$1.$2"' /etc/mageia-release)
82
83 # End of user definitions
84 %{?_without_kernel: %global build_kernel 0}
85 %{?_without_doc: %global build_doc 0}
86 %{?_without_source: %global build_source 0}
87 %{?_without_devel: %global build_devel 0}
88
89 %{?_with_kernel: %global build_kernel 1}
90 %{?_with_doc: %global build_doc 1}
91 %{?_with_source: %global build_source 1}
92 %{?_with_devel: %global build_devel 1}
93
94 %if %(if [ -z "$CC" ] ; then echo 0; else echo 1; fi)
95 %define kmake %make CC="$CC"
96 %else
97 %define kmake %make
98 %endif
99 # there are places where parallel make don't work
100 %define smake make
101
102 # Parallelize xargs invocations on smp machines
103 %define kxargs xargs %([ -z "$RPM_BUILD_NCPUS" ] \\\
104 && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
105 [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-P $RPM_BUILD_NCPUS")
106
107 # Aliases for amd64 builds (better make source links?)
108 %define target_cpu %(echo %{_target_cpu} | sed -e "s/amd64/x86_64/")
109 %define target_arch %(echo %{_arch} | sed -e "s/amd64/x86_64/" -e 's/arm.*/arm/')
110
111 # src.rpm description
112 Summary: The Linux kernel (the core of the Linux operating system)
113 Name: %{kname}
114 Version: %{kversion}
115 Release: %{rpmrel}
116 License: GPLv2
117 Group: System/Kernel and hardware
118 ExclusiveArch: %{ix86} x86_64 %{arm}
119 ExclusiveOS: Linux
120 URL: https://rt.wiki.kernel.org/
121
122 ####################################################################
123 #
124 # Sources
125 #
126 ### This is for full SRC RPM
127 Source0: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/linux-%{tar_ver}.tar.bz2
128 Source1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/linux-%{tar_ver}.tar.bz2.sign
129
130 # This is for disabling mrproper and other targets on -devel rpms
131 Source2: disable-mrproper-in-devel-rpms.patch
132
133 Source4: README.kernel-sources
134
135 # Kernel defconfigs
136 Source20: i386_defconfig
137 Source21: x86_64_defconfig
138 Source22: arm_defconfig
139
140 ####################################################################
141 #
142 # Patches
143
144 #
145 # Patch0 to Patch100 are for core kernel upgrades.
146 #
147
148 # Pre linus patch: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/testing
149
150 %if %kpatch
151 Patch1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/testing/patch-%{kernelversion}.%{patchlevel}-%{kpatch}.bz2
152 Source10: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/testing/patch-%{kernelversion}.%{patchlevel}-%{kpatch}.bz2.sign
153 %endif
154 %if %sublevel
155 Patch1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/patch-%{kversion}.bz2
156 Source10: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/patch-%{kversion}.bz2.sign
157 %endif
158 # kernel.org -git
159 %if %kgit
160 Patch2: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/snapshots/patch-%{kernelversion}.%{patchlevel}-%{kpatch}-git%{kgit}.bz2
161 Source11: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/snapshots/patch-%{kernelversion}.%{patchlevel}-%{kpatch}-git%{kgit}.bz2.sign
162 %endif
163
164 # -rt patches
165 Patch101: ftp://ftp.kernel.org/pub/linux/kernel/projects/rt/patch-%{tar_ver}-%{rt_rel}.patch.bz2
166 Source101: ftp://ftp.kernel.org/pub/linux/kernel/projects/rt/patch-%{tar_ver}-%{rt_rel}.patch.bz2.sign
167
168 #END
169 ####################################################################
170
171 # Defines for the things that are needed for all the kernels
172 %define requires1 module-init-tools >= 3.6-10
173 %define requires2 mkinitrd >= 3.4.43-10
174 %define requires3 bootloader-utils >= 1.9
175 %define requires4 sysfsutils
176 %define requires5 kernel-firmware >= 20101024
177
178 %define kprovides kernel = %{tar_ver}, alsa
179
180 BuildRoot: %{_tmppath}/%{name}-%{kversion}-build-%{_arch}
181 Autoreqprov: no
182 BuildRequires: gcc module-init-tools >= 0.9.15
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
431 %build
432 # Common target directories
433 %define _bootdir /boot
434 %define _modulesdir /lib/modules
435 %define _kerneldir /usr/src/%{kname}-%{buildrel}
436 %define _develdir /usr/src/%{kname}-devel-%{buildrel}
437
438
439 # Directories definition needed for building
440 %define temp_root %{build_dir}/temp-root
441 %define temp_boot %{temp_root}%{_bootdir}
442 %define temp_modules %{temp_root}%{_modulesdir}
443 %define temp_source %{temp_root}%{_kerneldir}
444 %define temp_devel %{temp_root}%{_develdir}
445
446
447 # Create a simulacro of buildroot
448 rm -rf %{temp_root}
449 install -d %{temp_root}
450
451
452 # make sure we are in the directory
453 cd %{src_dir}
454
455 # make sure EXTRAVERSION says what we want it to say
456 LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{buildrpmrel}/" Makefile
457
458 # Prepare the kernel
459 %smake -s mrproper
460 %ifarch %{ix86} x86_64 %{arm}
461 cp arch/x86/configs/%{target_arch}_defconfig .config
462 %else
463 cp arch/%{target_arch}/defconfig .config
464 %endif
465 %smake oldconfig
466
467 # Build the kernel
468 %kmake all
469 %ifarch %{arm}
470 %kmake uImage
471 %endif
472 # Install kernel
473 install -d %{temp_boot}
474 install -m 644 System.map %{temp_boot}/System.map-%{buildrel}
475 install -m 644 .config %{temp_boot}/config-%{buildrel}
476 %ifarch %{arm}
477 cp -f arch/%{target_arch}/boot/uImage %{temp_boot}/uImage-$KernelVer
478 %else
479 cp -f arch/%{target_arch}/boot/bzImage %{temp_boot}/vmlinuz-%{buildrel}
480 %endif
481
482 # Install modules
483 install -d %{temp_modules}/%{buildrel}
484 %smake INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=%{buildrel} modules_install
485
486 # remove /lib/firmware, we use a separate kernel-firmware
487 rm -rf %{temp_root}/lib/firmware
488
489 # Save devel tree
490 %if %build_devel
491 mkdir -p %{temp_devel}
492 for i in $(find . -name 'Makefile*'); do cp -R --parents $i %{temp_devel};done
493 for i in $(find . -name 'Kconfig*' -o -name 'Kbuild*' -o -name config.mk); do cp -R --parents $i %{temp_devel};done
494 cp -fR include %{temp_devel}
495 cp -fR scripts %{temp_devel}
496 %ifarch %{arm}
497 cp -fR arch/%{target_arch}/tools $TempDevelRoot/arch/%{target_arch}/
498 %endif
499 %ifarch %{ix86} x86_64
500 cp -fR arch/x86/kernel/asm-offsets.{c,s} %{temp_devel}/arch/x86/kernel/
501 cp -fR arch/x86/kernel/asm-offsets_{32,64}.c %{temp_devel}/arch/x86/kernel/
502 cp -fR arch/x86/include %{temp_devel}/arch/x86/
503 %else
504 cp -fR arch/%{target_arch}/kernel/asm-offsets.{c,s} %{temp_devel}/arch/%{target_arch}/kernel/
505 for f in $(find arch/%{target_arch} -name include); do cp -fR --parents $f $TempDevelRoot; done
506 %endif
507
508 # Needed for generation of kernel/bounds.s
509 cp -fR kernel/bounds.c %{temp_devel}/kernel/
510
511 # Needed for lguest
512 cp -fR drivers/lguest/lg.h %{temp_devel}/drivers/lguest/
513
514 cp -fR .config Module.symvers %{temp_devel}
515
516 # Needed for truecrypt build (Danny)
517 cp -fR drivers/md/dm.h %{temp_devel}/drivers/md/
518
519 # Needed for external dvb tree (#41418)
520 cp -fR drivers/media/dvb/dvb-core/*.h %{temp_devel}/drivers/media/dvb/dvb-core/
521 cp -fR drivers/media/dvb/frontends/lgdt330x.h %{temp_devel}/drivers/media/dvb/frontends/
522
523 # add acpica header files, needed for fglrx build
524 cp -fR drivers/acpi/acpica/*.h %{temp_devel}/drivers/acpi/acpica/
525
526 # Check and clean the -devel tree
527 pushd %{temp_devel} >/dev/null
528 %smake -s prepare scripts clean
529 rm -f .config.old
530 popd >/dev/null
531
532 # Disable mrproper and other targets
533 patch -p1 -d %{temp_devel} -i %{SOURCE2}
534
535 # Fix permissions
536 chmod -R a+rX %{temp_devel}
537 %endif # build_devel
538
539 #make sure we are in the directory
540 cd %src_dir
541
542 # kernel-source is shipped as an unprepared tree
543 %smake -s mrproper
544
545
546 ###
547 ### Install
548 ###
549 %install
550 install -m 644 %{SOURCE4} .
551
552 cd %src_dir
553 # Directories definition needed for installing
554 %define target_source %{buildroot}/%{_kerneldir}
555 %define target_boot %{buildroot}%{_bootdir}
556 %define target_modules %{buildroot}%{_modulesdir}
557 %define target_devel %{buildroot}%{_develdir}
558
559 # We want to be able to test several times the install part
560 rm -rf %{buildroot}
561 cp -a %{temp_root} %{buildroot}
562
563 # Create directories infastructure
564 %if %build_source
565 install -d %{target_source}
566
567 tar cf - . | tar xf - -C %{target_source}
568 chmod -R a+rX %{target_source}
569
570 # we remove all the source files that we don't ship
571
572 # first architecture files
573 for i in alpha avr32 blackfin cris frv h8300 ia64 m32r mips microblaze \
574 m68k m68knommu mn10300 parisc powerpc ppc s390 score sh sh64 sparc \
575 tile unicore32 v850 xtensa; do
576 rm -rf %{target_source}/arch/$i
577
578 %if %build_devel
579 rm -rf %{target_devel}/arch/$i
580 %endif
581 done
582
583 # remove arch files based on target arch in -devel rpms
584 %if %build_devel
585 %ifnarch %{ix86} x86_64
586 rm -rf %{target_devel}/arch/x86
587 %endif
588 %ifnarch %{arm}
589 rm -rf %{target_devel}/arch/arm
590 %endif
591 %endif
592
593
594 # other misc files
595 rm -f %{target_source}/{.config.old,.config.cmd,.tmp_gas_check,.mailmap,.missing-syscalls.d,arch/.gitignore,localversion-rt}
596 rm -rf %{target_source}/.tmp_depmod/
597
598 #endif %build_source
599 %endif
600
601
602 # gzipping modules
603 find %{target_modules} -name "*.ko" | %kxargs gzip -9
604
605
606 # We used to have a copy of PrepareKernel here
607 # Now, we make sure that the thing in the linux dir is what we want it to be
608
609 for i in %{target_modules}/*; do
610 rm -f $i/build $i/source
611 done
612
613
614 # sniff, if we gzipped all the modules, we change the stamp :(
615 # we really need the depmod -ae here
616 pushd %{target_modules}
617 for i in *; do
618 /sbin/depmod -u -ae -b %{buildroot} -r -F %{target_boot}/System.map-$i $i
619 echo $?
620 done
621
622 for i in *; do
623 pushd $i
624 echo "Creating module.description for $i"
625 modules=`find . -name "*.ko.gz"`
626 echo $modules | %kxargs /sbin/modinfo \
627 | perl -lne 'print "$name\t$1" if $name && /^description:\s*(.*)/; $name = $1 if m!^filename:\s*(.*)\.k?o!; $name =~ s!.*/!!' > modules.description
628 popd
629 done
630 popd
631
632
633 ###
634 ### Clean
635 ###
636
637 %clean
638 rm -rf %{buildroot}
639 # We don't want to remove this, the whole reason of its existence is to be
640 # able to do several rpm --short-circuit -bi for testing install
641 # phase without repeating compilation phase
642 #rm -rf %{temp_root}
643
644
645 ###
646 ### Scripts
647 ###
648
649 ### kernel
650 %if %build_kernel
651 %preun -n %{kname}-%{buildrel}
652 /sbin/installkernel -R %{buildrel}
653 if [ -L /lib/modules/%{buildrel}/build ]; then
654 rm -f /lib/modules/%{buildrel}/build
655 fi
656 if [ -L /lib/modules/%{buildrel}/source ]; then
657 rm -f /lib/modules/%{buildrel}/source
658 fi
659 pushd /boot > /dev/null
660 if [ -L vmlinuz-linus ]; then
661 if [ "$(readlink vmlinuz-linus)" = "vmlinuz-%{buildrel}" ]; then
662 rm -f vmlinuz-linus
663 fi
664 fi
665 if [ -L initrd-linus.img ]; then
666 if [ "$(readlink initrd-linus.img)" = "initrd-%{buildrel}.img" ]; then
667 rm -f initrd-linus.img
668 fi
669 fi
670 popd > /dev/null
671 exit 0
672
673 %post -n %{kname}-%{buildrel}
674 /sbin/installkernel -L %{buildrel}
675 if [ -d /usr/src/%{kname}-devel-%{buildrel} ]; then
676 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build
677 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source
678 fi
679 pushd /boot > /dev/null
680 if [ -L vmlinuz-linus ]; then
681 rm -f vmlinuz-linus
682 fi
683 ln -sf vmlinuz-%{buildrel} vmlinuz-linus
684 if [ -L initrd-linus.img ]; then
685 rm -f initrd-linus.img
686 fi
687 ln -sf initrd-%{buildrel}.img initrd-linus.img
688 popd > /dev/null
689
690 %postun -n %{kname}-%{buildrel}
691 /sbin/kernel_remove_initrd %{buildrel}
692 rm -rf /lib/modules/%{buildrel} > /dev/null
693 %endif # build_kernel
694
695
696 ### kernel-devel
697 %if %build_devel
698 %post -n %{kname}-devel-%{buildrel}
699 # place /build and /source symlinks in place.
700 if [ -d /lib/modules/%{buildrel} ]; then
701 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build
702 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source
703 fi
704
705 %preun -n %{kname}-devel-%{buildrel}
706 # we need to delete <modules>/{build,source} at uninstall
707 if [ -L /lib/modules/%{buildrel}/build ]; then
708 rm -f /lib/modules/%{buildrel}/build
709 fi
710 if [ -L /lib/modules/%{buildrel}/source ]; then
711 rm -f /lib/modules/%{buildrel}/source
712 fi
713 exit 0
714 %endif #build_devel
715
716
717 ### kernel-source
718 %if %build_source
719 %post -n %{kname}-source-%{buildrel}
720 for i in /lib/modules/%{buildrel}*; do
721 if [ -d $i ]; then
722 if [ ! -L $i/build -a ! -L $i/source ]; then
723 rm -f $i/{build,source}
724 ln -sf /usr/src/%{kname}-%{buildrel} $i/build
725 ln -sf /usr/src/%{kname}-%{buildrel} $i/source
726 fi
727 fi
728 done
729
730 %preun -n %{kname}-source-%{buildrel}
731 for i in /lib/modules/%{buildrel}/{build,source}; do
732 if [ -L $i ]; then
733 if [ "$(readlink $i)" = "/usr/src/%{kname}-%{buildrel}" ]; then
734 rm -f $i
735 fi
736 fi
737 done
738 exit 0
739 %endif # build_source
740
741
742 ###
743 ### file lists
744 ###
745
746 # kernel
747 %if %build_kernel
748 %files -n %{kname}-%{buildrel}
749 %defattr(-,root,root)
750 %{_bootdir}/config-%{buildrel}
751 %ifarch %{arm}
752 %{_bootdir}/uImage-%{buildrel}
753 %else
754 %{_bootdir}/vmlinuz-%{buildrel}
755 %endif
756 %{_bootdir}/System.map-%{buildrel}
757 %dir %{_modulesdir}/%{buildrel}/
758 %{_modulesdir}/%{buildrel}/kernel
759 %{_modulesdir}/%{buildrel}/modules.*
760 %doc README.kernel-sources
761 %endif # build_kernel
762
763 # kernel-source
764 %if %build_source
765 %files -n %{kname}-source-%{buildrel}
766 %defattr(-,root,root)
767 %dir %{_kerneldir}
768 %dir %{_kerneldir}/arch
769 %dir %{_kerneldir}/include
770 %{_kerneldir}/.gitignore
771 %{_kerneldir}/COPYING
772 %{_kerneldir}/CREDITS
773 %{_kerneldir}/Documentation
774 %{_kerneldir}/Kbuild
775 %{_kerneldir}/Kconfig
776 %{_kerneldir}/MAINTAINERS
777 %{_kerneldir}/Makefile
778 %{_kerneldir}/README
779 %{_kerneldir}/REPORTING-BUGS
780 %{_kerneldir}/arch/Kconfig
781 %{_kerneldir}/arch/arm
782 %{_kerneldir}/arch/x86
783 %{_kerneldir}/arch/um
784 %{_kerneldir}/block
785 %{_kerneldir}/crypto
786 %{_kerneldir}/drivers
787 %{_kerneldir}/firmware
788 %{_kerneldir}/fs
789 %{_kerneldir}/include/Kbuild
790 %{_kerneldir}/include/acpi
791 %{_kerneldir}/include/asm-generic
792 %{_kerneldir}/include/crypto
793 %{_kerneldir}/include/drm
794 %{_kerneldir}/include/linux
795 %{_kerneldir}/include/math-emu
796 %{_kerneldir}/include/net
797 %{_kerneldir}/include/pcmcia
798 %{_kerneldir}/include/scsi
799 %{_kerneldir}/include/sound
800 %{_kerneldir}/include/target
801 %{_kerneldir}/include/trace
802 %{_kerneldir}/include/video
803 %{_kerneldir}/include/media
804 %{_kerneldir}/include/mtd
805 %{_kerneldir}/include/rxrpc
806 %{_kerneldir}/include/keys
807 %{_kerneldir}/include/rdma
808 %{_kerneldir}/include/xen
809 %{_kerneldir}/init
810 %{_kerneldir}/ipc
811 %{_kerneldir}/kernel
812 %{_kerneldir}/lib
813 %{_kerneldir}/mm
814 %{_kerneldir}/net
815 %{_kerneldir}/samples
816 %{_kerneldir}/scripts
817 %{_kerneldir}/security
818 %{_kerneldir}/sound
819 %{_kerneldir}/tools
820 %{_kerneldir}/usr
821 %{_kerneldir}/virt
822 %doc README.kernel-sources
823 %endif # build_source
824
825 # kernel-devel
826 %if %build_devel
827 %files -n %{kname}-devel-%{buildrel}
828 %defattr(-,root,root)
829 %dir %{_develdir}
830 %dir %{_develdir}/arch
831 %dir %{_develdir}/include
832 %{_develdir}/.config
833 %{_develdir}/Documentation
834 %{_develdir}/Kbuild
835 %{_develdir}/Kconfig
836 %{_develdir}/Makefile
837 %{_develdir}/Module.symvers
838 %{_develdir}/arch/Kconfig
839 %ifarch %{arm}
840 %{_develdir}/arch/arm
841 %endif
842 %ifarch %{ix86} x86_64
843 %{_develdir}/arch/x86
844 %endif
845 %{_develdir}/arch/um
846 %{_develdir}/block
847 %{_develdir}/crypto
848 %{_develdir}/drivers
849 %{_develdir}/firmware
850 %{_develdir}/fs
851 %{_develdir}/include/Kbuild
852 %{_develdir}/include/acpi
853 %{_develdir}/include/asm-generic
854 %{_develdir}/include/config
855 %{_develdir}/include/crypto
856 %{_develdir}/include/drm
857 %{_develdir}/include/generated
858 %{_develdir}/include/keys
859 %{_develdir}/include/linux
860 %{_develdir}/include/math-emu
861 %{_develdir}/include/mtd
862 %{_develdir}/include/net
863 %{_develdir}/include/pcmcia
864 %{_develdir}/include/rdma
865 %{_develdir}/include/scsi
866 %{_develdir}/include/sound
867 %{_develdir}/include/target
868 %{_develdir}/include/trace
869 %{_develdir}/include/video
870 %{_develdir}/include/media
871 %{_develdir}/include/rxrpc
872 %{_develdir}/include/xen
873 %{_develdir}/init
874 %{_develdir}/ipc
875 %{_develdir}/kernel
876 %{_develdir}/lib
877 %{_develdir}/mm
878 %{_develdir}/net
879 %{_develdir}/samples
880 %{_develdir}/scripts
881 %{_develdir}/security
882 %{_develdir}/sound
883 %{_develdir}/tools
884 %{_develdir}/usr
885 %{_develdir}/virt
886 %doc README.kernel-sources
887 %endif # build_devel
888
889
890 %if %build_doc
891 %files -n %{kname}-doc
892 %defattr(-,root,root)
893 %doc linux-%{tar_ver}/Documentation/*
894 %endif # build_doc
895
896 %if %build_kernel
897 %files -n %{kname}-latest
898 %defattr(-,root,root)
899 %endif # build_kernel
900
901 %if %build_source
902 %files -n %{kname}-source-latest
903 %defattr(-,root,root)
904 %endif # build_source
905
906 %if %build_devel
907 %files -n %{kname}-devel-latest
908 %defattr(-,root,root)
909 %endif # build_devel

  ViewVC Help
Powered by ViewVC 1.1.30