/[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 258747 - (show annotations) (download)
Sat Jun 9 15:02:50 2012 UTC (11 years, 10 months ago) by tmb
File size: 24612 byte(s)
BR kmod instead of module-init-tools
1 # kernel version
2 %define kernelversion 3
3 %define patchlevel 4
4 # sublevel is now used for -stable patches
5 %define sublevel 1
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.4.1
19 %define rt_rel rt9
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 kmod >= 7-6
174 %define requires2 dracut >= 017-9
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 kmod >= 7-6
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 cp -fR tools/include %{temp_devel}/tools/
499 %ifarch %{arm}
500 cp -fR arch/%{target_arch}/tools $TempDevelRoot/arch/%{target_arch}/
501 %endif
502 %ifarch %{ix86} x86_64
503 cp -fR arch/x86/kernel/asm-offsets.{c,s} %{temp_devel}/arch/x86/kernel/
504 cp -fR arch/x86/kernel/asm-offsets_{32,64}.c %{temp_devel}/arch/x86/kernel/
505 cp -fR arch/x86/include %{temp_devel}/arch/x86/
506 cp -fR arch/x86/tools/relocs.c %{temp_devel}/arch/x86/tools/
507 %else
508 cp -fR arch/%{target_arch}/kernel/asm-offsets.{c,s} %{temp_devel}/arch/%{target_arch}/kernel/
509 for f in $(find arch/%{target_arch} -name include); do cp -fR --parents $f $TempDevelRoot; done
510 %endif
511
512 # Needed for generation of kernel/bounds.s
513 cp -fR kernel/bounds.c %{temp_devel}/kernel/
514
515 # Needed for lguest
516 cp -fR drivers/lguest/lg.h %{temp_devel}/drivers/lguest/
517
518 cp -fR .config Module.symvers %{temp_devel}
519
520 # Needed for truecrypt build (Danny)
521 cp -fR drivers/md/dm.h %{temp_devel}/drivers/md/
522
523 # Needed for external dvb tree (#41418)
524 cp -fR drivers/media/dvb/dvb-core/*.h %{temp_devel}/drivers/media/dvb/dvb-core/
525 cp -fR drivers/media/dvb/frontends/lgdt330x.h %{temp_devel}/drivers/media/dvb/frontends/
526
527 # add acpica header files, needed for fglrx build
528 cp -fR drivers/acpi/acpica/*.h %{temp_devel}/drivers/acpi/acpica/
529
530 # Check and clean the -devel tree
531 pushd %{temp_devel} >/dev/null
532 %smake -s prepare scripts clean
533 rm -f .config.old
534 popd >/dev/null
535
536 # Disable mrproper and other targets
537 patch -p1 -d %{temp_devel} -i %{SOURCE2}
538
539 # Fix permissions
540 chmod -R a+rX %{temp_devel}
541 %endif # build_devel
542
543 #make sure we are in the directory
544 cd %src_dir
545
546 # kernel-source is shipped as an unprepared tree
547 %smake -s mrproper
548
549
550 ###
551 ### Install
552 ###
553 %install
554 install -m 644 %{SOURCE4} .
555
556 cd %src_dir
557 # Directories definition needed for installing
558 %define target_source %{buildroot}/%{_kerneldir}
559 %define target_boot %{buildroot}%{_bootdir}
560 %define target_modules %{buildroot}%{_modulesdir}
561 %define target_devel %{buildroot}%{_develdir}
562
563 # We want to be able to test several times the install part
564 rm -rf %{buildroot}
565 cp -a %{temp_root} %{buildroot}
566
567 # Create directories infastructure
568 %if %build_source
569 install -d %{target_source}
570
571 tar cf - . | tar xf - -C %{target_source}
572 chmod -R a+rX %{target_source}
573
574 # we remove all the source files that we don't ship
575
576 # first architecture files
577 for i in alpha avr32 blackfin cris frv hexagon h8300 ia64 m32r mips microblaze \
578 m68k m68knommu mn10300 openrisc parisc powerpc ppc s390 score \
579 sh sh64 sparc tile unicore32 v850 xtensa; do
580 rm -rf %{target_source}/arch/$i
581
582 %if %build_devel
583 rm -rf %{target_devel}/arch/$i
584 %endif
585 done
586
587 # remove arch files based on target arch in -devel rpms
588 %if %build_devel
589 %ifnarch %{ix86} x86_64
590 rm -rf %{target_devel}/arch/x86
591 %endif
592 %ifnarch %{arm}
593 rm -rf %{target_devel}/arch/arm
594 %endif
595 %endif
596
597
598 # other misc files
599 rm -f %{target_source}/{.config.old,.config.cmd,.tmp_gas_check,.mailmap,.missing-syscalls.d,arch/.gitignore}
600 rm -rf %{target_source}/.tmp_depmod/
601
602 #endif %build_source
603 %endif
604
605
606 # compressing modules
607 find %{target_modules} -name "*.ko" | %kxargs xz -6e
608
609
610 # We used to have a copy of PrepareKernel here
611 # Now, we make sure that the thing in the linux dir is what we want it to be
612
613 for i in %{target_modules}/*; do
614 rm -f $i/build $i/source
615 done
616
617
618 # sniff, if we compressed all the modules, we change the stamp :(
619 # we really need the depmod -ae here
620 pushd %{target_modules}
621 for i in *; do
622 /sbin/depmod -ae -b %{buildroot} -F %{target_boot}/System.map-$i $i
623 echo $?
624 done
625
626 for i in *; do
627 pushd $i
628 echo "Creating module.description for $i"
629 modules=`find . -name "*.ko.[g,x]z"`
630 echo $modules | %kxargs /sbin/modinfo \
631 | perl -lne 'print "$name\t$1" if $name && /^description:\s*(.*)/; $name = $1 if m!^filename:\s*(.*)\.k?o!; $name =~ s!.*/!!' > modules.description
632 popd
633 done
634 popd
635
636
637 ###
638 ### Clean
639 ###
640
641 %clean
642 rm -rf %{buildroot}
643 # We don't want to remove this, the whole reason of its existence is to be
644 # able to do several rpm --short-circuit -bi for testing install
645 # phase without repeating compilation phase
646 #rm -rf %{temp_root}
647
648
649 ###
650 ### Scripts
651 ###
652
653 ### kernel
654 %if %build_kernel
655 %preun -n %{kname}-%{buildrel}
656 /sbin/installkernel -R %{buildrel}
657 if [ -L /lib/modules/%{buildrel}/build ]; then
658 rm -f /lib/modules/%{buildrel}/build
659 fi
660 if [ -L /lib/modules/%{buildrel}/source ]; then
661 rm -f /lib/modules/%{buildrel}/source
662 fi
663 pushd /boot > /dev/null
664 if [ -L vmlinuz-linus ]; then
665 if [ "$(readlink vmlinuz-linus)" = "vmlinuz-%{buildrel}" ]; then
666 rm -f vmlinuz-linus
667 fi
668 fi
669 if [ -L initrd-linus.img ]; then
670 if [ "$(readlink initrd-linus.img)" = "initrd-%{buildrel}.img" ]; then
671 rm -f initrd-linus.img
672 fi
673 fi
674 popd > /dev/null
675 exit 0
676
677 %post -n %{kname}-%{buildrel}
678 /sbin/installkernel -L %{buildrel}
679 if [ -d /usr/src/%{kname}-devel-%{buildrel} ]; then
680 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build
681 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source
682 fi
683 pushd /boot > /dev/null
684 if [ -L vmlinuz-linus ]; then
685 rm -f vmlinuz-linus
686 fi
687 ln -sf vmlinuz-%{buildrel} vmlinuz-linus
688 if [ -L initrd-linus.img ]; then
689 rm -f initrd-linus.img
690 fi
691 ln -sf initrd-%{buildrel}.img initrd-linus.img
692 popd > /dev/null
693
694 %posttrans -n %{kname}-%{buildrel}
695 if [ -x /usr/sbin/dkms_autoinstaller -a -d /usr/src/%{kname}-devel-%{buildrel} ]; then
696 /usr/sbin/dkms_autoinstaller start %{buildrel}
697 fi
698
699 %postun -n %{kname}-%{buildrel}
700 /sbin/kernel_remove_initrd %{buildrel}
701 rm -rf /lib/modules/%{buildrel} > /dev/null
702 %endif # build_kernel
703
704
705 ### kernel-devel
706 %if %build_devel
707 %post -n %{kname}-devel-%{buildrel}
708 # place /build and /source symlinks in place.
709 if [ -d /lib/modules/%{buildrel} ]; then
710 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build
711 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source
712 fi
713
714 %preun -n %{kname}-devel-%{buildrel}
715 # we need to delete <modules>/{build,source} at uninstall
716 if [ -L /lib/modules/%{buildrel}/build ]; then
717 rm -f /lib/modules/%{buildrel}/build
718 fi
719 if [ -L /lib/modules/%{buildrel}/source ]; then
720 rm -f /lib/modules/%{buildrel}/source
721 fi
722 exit 0
723 %endif #build_devel
724
725
726 ### kernel-source
727 %if %build_source
728 %post -n %{kname}-source-%{buildrel}
729 for i in /lib/modules/%{buildrel}*; do
730 if [ -d $i ]; then
731 if [ ! -L $i/build -a ! -L $i/source ]; then
732 rm -f $i/{build,source}
733 ln -sf /usr/src/%{kname}-%{buildrel} $i/build
734 ln -sf /usr/src/%{kname}-%{buildrel} $i/source
735 fi
736 fi
737 done
738
739 %preun -n %{kname}-source-%{buildrel}
740 for i in /lib/modules/%{buildrel}/{build,source}; do
741 if [ -L $i ]; then
742 if [ "$(readlink $i)" = "/usr/src/%{kname}-%{buildrel}" ]; then
743 rm -f $i
744 fi
745 fi
746 done
747 exit 0
748 %endif # build_source
749
750
751 ###
752 ### file lists
753 ###
754
755 # kernel
756 %if %build_kernel
757 %files -n %{kname}-%{buildrel}
758 %{_bootdir}/config-%{buildrel}
759 %ifarch %{arm}
760 %{_bootdir}/uImage-%{buildrel}
761 %else
762 %{_bootdir}/vmlinuz-%{buildrel}
763 %endif
764 %{_bootdir}/System.map-%{buildrel}
765 %dir %{_modulesdir}/%{buildrel}/
766 %{_modulesdir}/%{buildrel}/kernel
767 %{_modulesdir}/%{buildrel}/modules.*
768 %doc README.kernel-sources
769 %endif # build_kernel
770
771 # kernel-source
772 %if %build_source
773 %files -n %{kname}-source-%{buildrel}
774 %dir %{_kerneldir}
775 %dir %{_kerneldir}/arch
776 %dir %{_kerneldir}/include
777 %{_kerneldir}/.gitignore
778 %{_kerneldir}/COPYING
779 %{_kerneldir}/CREDITS
780 %{_kerneldir}/Documentation
781 %{_kerneldir}/Kbuild
782 %{_kerneldir}/Kconfig
783 %{_kerneldir}/MAINTAINERS
784 %{_kerneldir}/Makefile
785 %{_kerneldir}/README
786 %{_kerneldir}/REPORTING-BUGS
787 %{_kerneldir}/arch/Kconfig
788 %{_kerneldir}/arch/arm
789 %{_kerneldir}/arch/x86
790 %{_kerneldir}/arch/um
791 %{_kerneldir}/block
792 %{_kerneldir}/crypto
793 %{_kerneldir}/drivers
794 %{_kerneldir}/firmware
795 %{_kerneldir}/fs
796 %{_kerneldir}/include/Kbuild
797 %{_kerneldir}/include/acpi
798 %{_kerneldir}/include/asm-generic
799 %{_kerneldir}/include/crypto
800 %{_kerneldir}/include/drm
801 %{_kerneldir}/include/linux
802 %{_kerneldir}/include/math-emu
803 %{_kerneldir}/include/net
804 %{_kerneldir}/include/pcmcia
805 %{_kerneldir}/include/scsi
806 %{_kerneldir}/include/sound
807 %{_kerneldir}/include/target
808 %{_kerneldir}/include/trace
809 %{_kerneldir}/include/video
810 %{_kerneldir}/include/media
811 %{_kerneldir}/include/misc
812 %{_kerneldir}/include/mtd
813 %{_kerneldir}/include/rxrpc
814 %{_kerneldir}/include/keys
815 %{_kerneldir}/include/rdma
816 %{_kerneldir}/include/xen
817 %{_kerneldir}/init
818 %{_kerneldir}/ipc
819 %{_kerneldir}/kernel
820 %{_kerneldir}/lib
821 %{_kerneldir}/mm
822 %{_kerneldir}/net
823 %{_kerneldir}/samples
824 %{_kerneldir}/scripts
825 %{_kerneldir}/security
826 %{_kerneldir}/sound
827 %{_kerneldir}/tools
828 %{_kerneldir}/usr
829 %{_kerneldir}/virt
830 %doc README.kernel-sources
831 %endif # build_source
832
833 # kernel-devel
834 %if %build_devel
835 %files -n %{kname}-devel-%{buildrel}
836 %dir %{_develdir}
837 %dir %{_develdir}/arch
838 %dir %{_develdir}/include
839 %{_develdir}/.config
840 %{_develdir}/Documentation
841 %{_develdir}/Kbuild
842 %{_develdir}/Kconfig
843 %{_develdir}/Makefile
844 %{_develdir}/Module.symvers
845 %{_develdir}/arch/Kconfig
846 %ifarch %{arm}
847 %{_develdir}/arch/arm
848 %endif
849 %ifarch %{ix86} x86_64
850 %{_develdir}/arch/x86
851 %endif
852 %{_develdir}/arch/um
853 %{_develdir}/block
854 %{_develdir}/crypto
855 %{_develdir}/drivers
856 %{_develdir}/firmware
857 %{_develdir}/fs
858 %{_develdir}/include/Kbuild
859 %{_develdir}/include/acpi
860 %{_develdir}/include/asm-generic
861 %{_develdir}/include/config
862 %{_develdir}/include/crypto
863 %{_develdir}/include/drm
864 %{_develdir}/include/generated
865 %{_develdir}/include/keys
866 %{_develdir}/include/linux
867 %{_develdir}/include/math-emu
868 %{_develdir}/include/misc
869 %{_develdir}/include/mtd
870 %{_develdir}/include/net
871 %{_develdir}/include/pcmcia
872 %{_develdir}/include/rdma
873 %{_develdir}/include/scsi
874 %{_develdir}/include/sound
875 %{_develdir}/include/target
876 %{_develdir}/include/trace
877 %{_develdir}/include/video
878 %{_develdir}/include/media
879 %{_develdir}/include/rxrpc
880 %{_develdir}/include/xen
881 %{_develdir}/init
882 %{_develdir}/ipc
883 %{_develdir}/kernel
884 %{_develdir}/lib
885 %{_develdir}/mm
886 %{_develdir}/net
887 %{_develdir}/samples
888 %{_develdir}/scripts
889 %{_develdir}/security
890 %{_develdir}/sound
891 %{_develdir}/tools
892 %{_develdir}/usr
893 %{_develdir}/virt
894 %doc README.kernel-sources
895 %endif # build_devel
896
897
898 %if %build_doc
899 %files -n %{kname}-doc
900 %doc linux-%{tar_ver}/Documentation/*
901 %endif # build_doc
902
903 %if %build_kernel
904 %files -n %{kname}-latest
905 %endif # build_kernel
906
907 %if %build_source
908 %files -n %{kname}-source-latest
909 %endif # build_source
910
911 %if %build_devel
912 %files -n %{kname}-devel-latest
913 %endif # build_devel

  ViewVC Help
Powered by ViewVC 1.1.30