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