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

Annotation of /cauldron/kernel-tmb/current/SPECS/kernel-tmb.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 61100 - (hide annotations) (download)
Sun Feb 27 01:06:05 2011 UTC (10 years, 4 months ago) by tmb
File size: 33145 byte(s)
imported package kernel-tmb
1 tmb 61100 #
2     # *tmb* series kernels now use kernel.org versioning
3     #
4     %define kernelversion 2
5     %define patchlevel 6
6     %define sublevel 37
7    
8     # kernel Makefile extraversion is substituted by
9     # kpatch/kgit/kstable wich are either 0 (empty), rc (kpatch),
10     # git (kgit, only the number after "git"), or stable release (kstable)
11     %define kpatch 0
12     %define kgit 0
13     %define kstable 2
14    
15     # this is the releaseversion
16     %define kbuild 1
17    
18     %define ktag tmb
19     %define kname kernel-%{ktag}
20    
21     %define rpmtag %distsuffix
22     %if %kpatch
23     %if %kgit
24     %define rpmrel %mkrel 0.%{kpatch}.%{kgit}.%{kbuild}
25     %else
26     %define rpmrel %mkrel 0.%{kpatch}.%{kbuild}
27     %endif
28     %else
29     %define rpmrel %mkrel %{kbuild}
30     %endif
31    
32     # theese two never change, they are used to fool rpm/urpmi/smart
33     %define fakever 1
34     %define fakerel %mkrel 1
35    
36     # When we are using a pre/rc patch, the tarball is a sublevel -1
37     %if %kpatch
38     %define kversion %{kernelversion}.%{patchlevel}.%{sublevel}
39     %define tar_ver %{kernelversion}.%{patchlevel}.%(expr %{sublevel} - 1)
40     %define patch_ver %{kversion}-%{kpatch}-%{ktag}%{kbuild}
41     %else
42     %if %kstable
43     %define kversion %{kernelversion}.%{patchlevel}.%{sublevel}.%{kstable}
44     %define tar_ver %{kernelversion}.%{patchlevel}.%{sublevel}
45     %else
46     %define kversion %{kernelversion}.%{patchlevel}.%{sublevel}
47     %define tar_ver %{kversion}
48     %endif
49     %define patch_ver %{kversion}-%{ktag}%{kbuild}
50     %endif
51     %define kverrel %{kversion}-%{rpmrel}
52    
53     # used for not making too long names for rpms or search paths
54     %if %kpatch
55     %if %kgit
56     %define buildrpmrel 0.%{kpatch}.%{kgit}.%{kbuild}%{rpmtag}
57     %else
58     %define buildrpmrel 0.%{kpatch}.%{kbuild}%{rpmtag}
59     %endif
60     %else
61     %define buildrpmrel %{kbuild}%{rpmtag}
62     %endif
63     %define buildrel %{kversion}-%{buildrpmrel}
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 0
77     %define build_source 1
78     %define build_devel 1
79     %define build_debug 0
80    
81     # Build desktop i586 / 4GB
82     %ifarch %{ix86}
83     %define build_desktop586 1
84     %endif
85    
86     # Build mm (i686 / 4GB) / x86_64
87     %define build_desktop 1
88    
89     # Build laptop (i686 / 4GB)/ x86_64
90     %ifarch %{ix86} x86_64
91     %define build_laptop 1
92     %endif
93    
94     # Build realtime (i686 / 4GB)/x86_64
95     %define build_realtime 0
96    
97     # Build server (i686 / 64GB)/x86_64
98     %define build_server 1
99    
100     # End of user definitions
101     %{?_without_desktop586: %global build_desktop586 0}
102     %{?_without_desktop: %global build_desktop 0}
103     %{?_without_laptop: %global build_laptop 0}
104     %{?_without_realtime: %global build_realtime 0}
105     %{?_without_server: %global build_server 0}
106     %{?_without_doc: %global build_doc 0}
107     %{?_without_source: %global build_source 0}
108     %{?_without_devel: %global build_devel 0}
109     %{?_without_debug: %global build_debug 0}
110    
111     %{?_with_desktop586: %global build_desktop586 1}
112     %{?_with_desktop: %global build_desktop 1}
113     %{?_with_laptop: %global build_laptop 1}
114     %{?_with_realtime: %global build_realtime 1}
115     %{?_with_server: %global build_server 1}
116     %{?_with_doc: %global build_doc 1}
117     %{?_with_source: %global build_source 1}
118     %{?_with_devel: %global build_devel 1}
119     %{?_with_debug: %global build_debug 1}
120    
121     # For the .nosrc.rpm
122     %define build_nosrc 0
123     %{?_with_nosrc: %global build_nosrc 1}
124    
125     %define kmake %make
126     # there are places where parallel make don't work
127     %define smake make
128    
129     # Parallelize xargs invocations on smp machines
130     %define kxargs xargs %([ -z "$RPM_BUILD_NCPUS" ] \\\
131     && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
132     [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-P $RPM_BUILD_NCPUS")
133    
134     #
135     # SRC RPM description
136     #
137     Summary: Linux kernel built for Mandriva with modifications by %{ktag}
138     Name: %{kname}
139     Version: %{kversion}
140     Release: %{rpmrel}
141     License: GPLv2
142     Group: System/Kernel and hardware
143     ExclusiveArch: %{ix86} x86_64
144     ExclusiveOS: Linux
145     URL: http://wiki.mandriva.com/en/Docs/Howto/Mandriva_Kernels#kernel-tmb
146    
147     ####################################################################
148     #
149     # Sources
150     #
151     ### This is for full SRC RPM
152     Source0: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/linux-%{tar_ver}.tar.bz2
153     Source1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/linux-%{tar_ver}.tar.bz2.sign
154     ### This is for stripped SRC RPM
155     %if %build_nosrc
156     NoSource: 0
157     %endif
158     # This is for disabling mrproper in -devel rpms
159     Source2: disable-mrproper-prepare-scripts-configs-in-devel-rpms.patch
160    
161     Source4: README.kernel-%{ktag}-sources
162     Source5: README.Mandriva_Linux_%{ktag}
163    
164     Source100: linux-%{patch_ver}.tar.xz
165     Source101: linux-%{patch_ver}.tar.xz.asc
166     Source102: %{kname}.patchlist
167    
168     ####################################################################
169     #
170     # Patches
171    
172     #
173     # Patch0 to Patch100 are for core kernel upgrades.
174     #
175    
176     # Pre linus patch: ftp://ftp.kernel.org/pub/linux/kernel/v2.6/testing
177    
178     %if %kpatch
179     Patch1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/testing/patch-%{kernelversion}.%{patchlevel}.%{sublevel}-%{kpatch}.bz2
180     Source10: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/testing/patch-%{kernelversion}.%{patchlevel}.%{sublevel}-%{kpatch}.bz2.sign
181     %endif
182     %if %kgit
183     Patch2: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/snapshots/patch-%{kernelversion}.%{patchlevel}.%{sublevel}-%{kpatch}-git%{kgit}.bz2
184     Source11: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/snapshots/patch-%{kernelversion}.%{patchlevel}.%{sublevel}-%{kpatch}-git%{kgit}.bz2.sign
185     %endif
186     %if %kstable
187     Patch1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/patch-%{kversion}.bz2
188     Source10: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/patch-%{kversion}.bz2.sign
189     %endif
190    
191     #END
192     ####################################################################
193    
194     # Defines for the things that are needed for all the kernels
195     #
196     %define common_description_kernel The kernel package contains the Linux kernel (vmlinuz), the core of your \
197     Mandriva Linux operating system. The kernel handles the basic functions \
198     of the operating system: memory allocation, process allocation, device \
199     input and output, etc.
200    
201     %define common_description_info For instructions for update, see: \
202     http://www.mandriva.com/en/security/kernelupdate \
203     \
204     The %{ktag} kernels is an experimental kernel based on the kernel.org \
205     kernels with added patches. Some of them may/will never end up in \
206     the main kernels due to their experimental nature. Some refer to \
207     this kernel as a 'hackkernel' ... \
208     Use these kernels at your own risk !!
209    
210     ### Global Requires/Provides
211     %define requires1 mkinitrd >= 6.0.92-12
212     %define requires2 bootloader-utils >= 1.12-1
213     %define requires3 sysfsutils >= 1.3.0-1 module-init-tools >= 3.6-10
214     %define requires4 kernel-firmware >= 20100217-1
215    
216     %define kprovides %{kname} = %{kverrel}, kernel = %{tar_ver}, drbd-api = 88
217    
218     BuildRoot: %{_tmppath}/%{kname}-%{kversion}-%{_arch}-build
219     %define buildroot %{_tmppath}/%{kname}-%{kversion}-%{_arch}-build
220     Autoreqprov: no
221     BuildRequires: gcc >= 4.0.1-5 module-init-tools >= 3.2-0.pre8.2
222    
223     %description
224     %common_description_kernel
225    
226     %common_description_info
227    
228    
229     # mkflavour() name flavour processor
230     # name: the flavour name in the package name
231     # flavour: first parameter of CreateKernel()
232     %define mkflavour() \
233     %package -n %{kname}-%{1}-%{buildrel} \
234     Version: %{fakever} \
235     Release: %{fakerel} \
236     Provides: %kprovides \
237     Provides: should-restart = system \
238     Requires(pre): %requires1 %requires2 %requires3 %requires4 \
239     %ifarch %{ix86} \
240     Conflicts: arch(x86_64) \
241     %endif \
242     Summary: %{expand:%{summary_%(echo %{1})}} \
243     Group: System/Kernel and hardware \
244     %description -n %{kname}-%{1}-%{buildrel} \
245     %common_description_kernel %{expand:%{info_%(echo %{1})}} \
246     \
247     %common_description_info \
248     \
249     %if %build_devel \
250     %package -n %{kname}-%{1}-devel-%{buildrel} \
251     Version: %{fakever} \
252     Release: %{fakerel} \
253     Requires: glibc-devel ncurses-devel make gcc perl \
254     %ifarch %{ix86} \
255     Conflicts: arch(x86_64) \
256     %endif \
257     Summary: The kernel-devel files for %{kname}-%{1}-%{buildrel} \
258     Group: Development/Kernel \
259     Provides: kernel-devel = %{kverrel} \
260     %description -n %{kname}-%{1}-devel-%{buildrel} \
261     This package contains the kernel-devel files that should be enough to build \
262     3rdparty drivers against for use with %{kname}-%{1}-%{buildrel}. \
263     \
264     If you want to build your own kernel, you need to install the full \
265     %{kname}-source-%{buildrel} rpm. \
266     \
267     %common_description_info \
268     %endif \
269     \
270     %package -n %{kname}-%{1}-latest \
271     Version: %{kversion} \
272     Release: %{rpmrel} \
273     Summary: Virtual rpm for latest %{kname}-%{1} \
274     Group: System/Kernel and hardware \
275     Requires: %{kname}-%{1}-%{buildrel} \
276     Obsoletes: %{kname}-%{1}-smp-latest <= 2.6.22-0.rc5.%{expand:%mkrel 1} \
277     %ifarch %{ix86} \
278     Conflicts: arch(x86_64) \
279     %endif \
280     %description -n %{kname}-%{1}-latest \
281     This package is a virtual rpm that aims to make sure you always have the \
282     latest %{kname}-%{1} installed... \
283     \
284     %common_description_info \
285     \
286     %if %build_devel \
287     %package -n %{kname}-%{1}-devel-latest \
288     Version: %{kversion} \
289     Release: %{rpmrel} \
290     Summary: Virtual rpm for latest %{kname}-%{1}-devel \
291     Group: Development/Kernel \
292     Requires: %{kname}-%{1}-devel-%{buildrel} \
293     Obsoletes: %{kname}-%{1}-smp-devel-latest <= 2.6.22-0.rc5.%{expand:%mkrel 1} \
294     %ifarch %{ix86} \
295     Conflicts: arch(x86_64) \
296     %endif \
297     %description -n %{kname}-%{1}-devel-latest \
298     This package is a virtual rpm that aims to make sure you always have the \
299     latest %{kname}-%{1}-devel installed... \
300     \
301     %common_description_info \
302     %endif \
303     \
304     %post -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-post \
305     %preun -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-preun \
306     %postun -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-postun \
307     \
308     %if %build_devel \
309     %post -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1}-post \
310     %preun -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1}-preun \
311     %endif \
312     \
313     %files -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1} \
314     %files -n %{kname}-%{1}-latest \
315     %defattr(-,root,root) \
316     \
317     %if %build_devel \
318     %files -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1} \
319     %files -n %{kname}-%{1}-devel-latest \
320     %defattr(-,root,root) \
321     %endif
322    
323    
324     #
325     # kernel-desktop586: i586, smp-alternatives, 4GB
326     #
327     %ifarch %{ix86}
328     %if %build_desktop586
329     %define summary_desktop586 Linux kernel for desktop use with i586 & 4GB RAM
330     %define info_desktop586 This kernel is compiled for desktop use, single or \
331     multiple i586 processor(s)/core(s) and less than 4GB RAM, using full \
332     preempt, BFS cpu scheduler and cfq i/o scheduler. \
333     This kernel relies on in-kernel smp alternatives to switch between up & smp \
334     mode depending on detected hardware. To force the kernel to boot in single \
335     processor mode, use the "nosmp" boot parameter.
336     %mkflavour desktop586
337     %endif
338     %endif
339    
340     #
341     # kernel-desktop: i686, smp-alternatives, 4 GB / x86_64
342     #
343     %if %build_desktop
344     %ifarch %{ix86}
345     %define summary_desktop Linux Kernel for desktop use with i686 & 4GB RAM
346     %define info_desktop This kernel is compiled for desktop use, single or \
347     multiple i686 processor(s)/core(s) and less than 4GB RAM, using full \
348     preempt, BFS cpu scheduler and cfq i/o scheduler. \
349     This kernel relies on in-kernel smp alternatives to switch between up & smp \
350     mode depending on detected hardware. To force the kernel to boot in single \
351     processor mode, use the "nosmp" boot parameter.
352     %else
353     %define summary_desktop Linux Kernel for desktop use with %{_arch}
354     %define info_desktop This kernel is compiled for desktop use, single or \
355     multiple %{_arch} processor(s)/core(s), using full preempt, BFS cpu \
356     scheduler and cfq i/o scheduler. \
357     This kernel relies on in-kernel smp alternatives to switch between up & smp \
358     mode depending on detected hardware. To force the kernel to boot in single \
359     processor mode, use the "nosmp" boot parameter.
360     %endif
361     %mkflavour desktop
362     %endif
363    
364     #
365     # kernel-laptop: i686, smp-alternatives, 4GB / x86_64
366     #
367     %if %build_laptop
368     %ifarch %{ix86}
369     %define summary_laptop Linux kernel for laptop use with i686-up/smp-4GB
370     %define info_laptop This kernel is compiled for laptop use, single or \
371     multiple i686 processor(s)/core(s) and less than 4GB RAM, using HZ_250 \
372     to save battery, voluntary preempt, BFS cpu scheduler, cfq i/o scheduler \
373     and some other laptop-specific optimizations. If you want to sacrifice \
374     battery life for performance, you better use the %{kname}-desktop. \
375     This kernel relies on in-kernel smp alternatives to switch between up & smp \
376     mode depending on detected hardware. To force the kernel to boot in single \
377     processor mode, use the "nosmp" boot parameter. \
378     NOTE! This kernel also uses TuxOnIce by default.
379     %else
380     %define summary_laptop Linux kernel for laptop use with %{_arch}
381     %define info_laptop This kernel is compiled for laptop use, single or \
382     multiple %{_arch} processor(s)/core(s), using HZ_250 to save battery, \
383     voluntary preempt, BFS cpu scheduler, cfq i/o scheduler and some other \
384     laptop-specific optimizations. If you want to sacrifice battery life for \
385     performance, you better use the %{kname}-desktop. \
386     This kernel relies on in-kernel smp alternatives to switch between up & smp \
387     mode depending on detected hardware. To force the kernel to boot in single \
388     processor mode, use the "nosmp" boot parameter. \
389     NOTE! This kernel also uses TuxOnIce by default.
390     %endif
391     %mkflavour laptop
392     %endif
393    
394     %if %build_realtime
395     %ifarch %{ix86}
396     %define summary_realtime Linux Kernel for desktop use with i686 & 4GB RAM
397     %define info_realtime This kernel is compiled for desktop use, single or \
398     multiple i686 processor(s)/core(s) and less than 4GB RAM, using full \
399     preempt and realtime, BFS cpu scheduler and cfq i/o scheduler. \
400     This kernel relies on in-kernel smp alternatives to switch between up & smp \
401     mode depending on detected hardware. To force the kernel to boot in single \
402     processor mode, use the "nosmp" boot parameter.
403     %else
404     %define summary_realtime Linux Kernel for desktop use with %{_arch}
405     %define info_realtime This kernel is compiled for desktop use, single or \
406     multiple %{_arch} processor(s)/core(s), using full preempt and realtime, \
407     BFS cpu scheduler and cfq i/o scheduler. \
408     This kernel relies on in-kernel smp alternatives to switch between up & smp \
409     mode depending on detected hardware. To force the kernel to boot in single \
410     processor mode, use the "nosmp" boot parameter.
411     %endif
412     %mkflavour realtime
413     %endif
414    
415     #
416     # kernel-server: i686, smp-alternatives, 64 GB /x86_64
417     #
418     %if %build_server
419     %ifarch %{ix86}
420     %define summary_server Linux Kernel for server use with i686 & 64GB RAM
421     %define info_server This kernel is compiled for server use, single or \
422     multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using \
423     no preempt, BFS cpu scheduler and cfq i/o scheduler. \
424     This kernel relies on in-kernel smp alternatives to switch between up & smp \
425     mode depending on detected hardware. To force the kernel to boot in single \
426     processor mode, use the "nosmp" boot parameter.
427     %else
428     %define summary_server Linux Kernel for server use with %{_arch}
429     %define info_server This kernel is compiled for server use, single or \
430     multiple %{_arch} processor(s)/core(s), using no preempt, BFS cpu scheduler \
431     and cfq i/o scheduler. \
432     This kernel relies on in-kernel smp alternatives to switch between up & smp \
433     mode depending on detected hardware. To force the kernel to boot in single \
434     processor mode, use the "nosmp" boot parameter.
435     %endif
436     %mkflavour server
437     %endif
438    
439     #
440     # kernel-source
441     #
442     %if %build_source
443     %package -n %{kname}-source-%{buildrel}
444     Version: %{fakever}
445     Release: %{fakerel}
446     Requires: glibc-devel, ncurses-devel, make, gcc, perl, diffutils
447     Summary: The Linux source code for %{kname}-%{buildrel}
448     Group: Development/Kernel
449     Autoreqprov: no
450     Provides: kernel-source = %{kverrel}, kernel-devel = %{kverrel}
451     %ifarch %{ix86}
452     Conflicts: arch(x86_64)
453     %endif
454    
455     %description -n %{kname}-source-%{buildrel}
456     The %{kname}-source package contains the source code files for the %{ktag}
457     series Linux kernel. Theese source files are only needed if you want to
458     build your own custom kernel that is better tuned to your particular hardware.
459    
460     If you only want the files needed to build 3rdparty (nVidia, Ati, dkms-*,...)
461     drivers against, install the *-devel-* rpm that is matching your kernel.
462    
463     %common_description_info
464    
465     %post -n %{kname}-source-%{buildrel}
466     for i in /lib/modules/%{kversion}-%{ktag}-*-%{buildrpmrel}; do
467     if [ -d $i ]; then
468     if [ ! -L $i/build -a ! -L $i/source ]; then
469     ln -sf /usr/src/%{kversion}-%{ktag}-%{buildrpmrel} $i/build
470     ln -sf /usr/src/%{kversion}-%{ktag}-%{buildrpmrel} $i/source
471     fi
472     fi
473     done
474    
475     %preun -n %{kname}-source-%{buildrel}
476     for i in /lib/modules/%{kversion}-%{ktag}-*-%{buildrpmrel}/{build,source}; do
477     if [ -L $i ]; then
478     if [ "$(readlink $i)" = "/usr/src/%{kversion}-%{ktag}-%{buildrpmrel}" ]; then
479     rm -f $i
480     fi
481     fi
482     done
483     exit 0
484    
485     #
486     # kernel-source-latest: virtual rpm
487     #
488     %package -n %{kname}-source-latest
489     Version: %{kversion}
490     Release: %{rpmrel}
491     Summary: Virtual rpm for latest %{kname}-source
492     Group: Development/Kernel
493     Requires: %{kname}-source-%{buildrel}
494     %ifarch %{ix86}
495     Conflicts: arch(x86_64)
496     %endif
497    
498     %description -n %{kname}-source-latest
499     This package is a virtual rpm that aims to make sure you always have the
500     latest %{kname}-source installed...
501    
502     %common_description_info
503     %endif
504    
505     #
506     # kernel-doc: documentation for the Linux kernel
507     #
508     %if %build_doc
509     %package -n %{kname}-doc
510     Version: %{kversion}
511     Release: %{rpmrel}
512     Summary: Various documentation bits found in the %{kname} source
513     Group: Books/Computer books
514     Buildarch: noarch
515    
516     %description -n %{kname}-doc
517     This package contains documentation files from the %{kname} source.
518     Various bits of information about the Linux kernel and the device drivers
519     shipped with it are documented in these files. You also might want install
520     this package if you need a reference to the options that can be passed to
521     Linux kernel modules at load time.
522    
523     %common_description_info
524     %endif
525    
526     #
527     # End packages - here begins build stage
528     #
529     %prep
530     %setup -q -n %top_dir_name -c
531    
532     %setup -q -n %top_dir_name -D -T -a100
533    
534     %define patches_dir ../%{patch_ver}/
535    
536     cd %src_dir
537     %if %kpatch
538     %patch1 -p1
539     %endif
540     %if %kgit
541     %patch2 -p1
542     %endif
543     %if %kstable
544     %patch1 -p1
545     %endif
546    
547     %{patches_dir}/scripts/apply_patches
548    
549    
550     # PATCH END
551    
552     #
553     # Setup Begin
554     #
555    
556     # Prepare all the variables for calling create_configs
557     %if %build_debug
558     %define debug --debug
559     %else
560     %define debug --no-debug
561     %endif
562    
563     %{patches_dir}/scripts/create_configs %debug --user_cpu="%{_arch}"
564    
565     # make sure the kernel has the sublevel we know it has...
566     LC_ALL=C perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" Makefile
567    
568     # get rid of unwanted files
569     find . -name '*~' -o -name '*.orig' -o -name '*.append' |%kxargs rm -f
570    
571    
572     %build
573     # Common target directories
574     %define _kerneldir /usr/src/%{kversion}-%{ktag}-%{buildrpmrel}
575     %define _bootdir /boot
576     %define _modulesdir /lib/modules
577    
578     # Directories definition needed for building
579     %define temp_root %{build_dir}/temp-root
580     %define temp_source %{temp_root}%{_kerneldir}
581     %define temp_boot %{temp_root}%{_bootdir}
582     %define temp_modules %{temp_root}%{_modulesdir}
583    
584    
585     PrepareKernel() {
586     name=$1
587     extension=$2
588     echo "Make dep for kernel $extension"
589     %smake -s mrproper
590    
591     if [ -z "$name" ]; then
592     cp arch/x86/configs/%{_arch}_defconfig-desktop .config
593     else
594     cp arch/x86/configs/%{_arch}_defconfig-$name .config
595     fi
596    
597     # make sure EXTRAVERSION says what we want it to say
598     %if %kstable
599     LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = .%{kstable}-$extension/" Makefile
600     %else
601     LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -$extension/" Makefile
602     %endif
603    
604     %smake oldconfig
605     }
606    
607    
608     BuildKernel() {
609     KernelVer=$1
610     echo "Building kernel $KernelVer"
611    
612     %kmake all
613    
614     # Start installing stuff
615     install -d %{temp_boot}
616     install -m 644 System.map %{temp_boot}/System.map-$KernelVer
617     install -m 644 .config %{temp_boot}/config-$KernelVer
618    
619     cp -f arch/%{_arch}/boot/bzImage %{temp_boot}/vmlinuz-$KernelVer
620    
621     # modules
622     install -d %{temp_modules}/$KernelVer
623     %smake INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=$KernelVer modules_install
624    
625     # remove /lib/firmware, we use a separate kernel-firmware
626     rm -rf %{temp_root}/lib/firmware
627     }
628    
629    
630     SaveDevel() {
631     devel_flavour=$1
632    
633     DevelRoot=/usr/src/%{kversion}-%{ktag}-$devel_flavour-%{buildrpmrel}
634     TempDevelRoot=%{temp_root}$DevelRoot
635    
636     mkdir -p $TempDevelRoot
637     for i in $(find . -name 'Makefile*'); do cp -R --parents $i $TempDevelRoot;done
638     for i in $(find . -name 'Kconfig*' -o -name 'Kbuild*' -o -name config.mk); do cp -R --parents $i $TempDevelRoot;done
639     cp -fR include $TempDevelRoot
640     cp -fR scripts $TempDevelRoot
641     %ifarch %{ix86} x86_64
642     cp -fR arch/x86/kernel/asm-offsets.{c,s} $TempDevelRoot/arch/x86/kernel/
643     cp -fR arch/x86/kernel/asm-offsets_{32,64}.c $TempDevelRoot/arch/x86/kernel/
644     cp -fR arch/x86/include $TempDevelRoot/arch/x86/
645     %else
646     cp -fR arch/%{_arch}/kernel/asm-offsets.{c,s} $TempDevelRoot/arch/%{_arch}/kernel/
647     cp -fR arch/%{_arch}/include $TempDevelRoot/arch/%{_arch}/
648     %endif
649     cp -fR kernel/bounds.c $TempDevelRoot/kernel/
650     cp -fR .config Module.symvers $TempDevelRoot
651     cp -fR 3rdparty/mkbuild.pl $TempDevelRoot/3rdparty/
652    
653     # Needed for truecrypt build (Danny)
654     cp -fR drivers/md/dm.h $TempDevelRoot/drivers/md/
655    
656     # Needed for lguest
657     cp -fR drivers/lguest/lg.h $TempDevelRoot/drivers/lguest/
658    
659     # Needed for lirc_gpio (Anssi Hannula, #39004, #54907)
660     cp -fR drivers/media/video/bt8xx/bttv{,p}.h $TempDevelRoot/drivers/media/video/bt8xx/
661     cp -fR drivers/media/video/bt8xx/bt848.h $TempDevelRoot/drivers/media/video/bt8xx/
662     cp -fR drivers/media/video/btcx-risc.h $TempDevelRoot/drivers/media/video/
663    
664     # Needed for external dvb tree (#41418)
665     cp -fR drivers/media/dvb/dvb-core/*.h $TempDevelRoot/drivers/media/dvb/dvb-core/
666     cp -fR drivers/media/dvb/frontends/lgdt330x.h $TempDevelRoot/drivers/media/dvb/frontends/
667    
668     # add acpica header files, needed for fglrx build
669     cp -fR drivers/acpi/acpica/*.h $TempDevelRoot/drivers/acpi/acpica/
670    
671     for i in alpha arm arm26 avr32 blackfin cris frv h8300 ia64 microblaze mips m32r m68k \
672     m68knommu mn10300 parisc powerpc ppc s390 sh sh64 score sparc tile v850 xtensa; do
673     rm -rf $TempDevelRoot/arch/$i
674     done
675    
676     %ifnarch %{ix86} x86_64
677     rm -rf $TempDevelRoot/arch/x86
678     %endif
679    
680     # Clean the scripts tree, and make sure everything is ok (sanity check)
681     # running prepare+scripts (tree was already "prepared" in build)
682     pushd $TempDevelRoot >/dev/null
683     %smake -s prepare scripts clean
684     popd >/dev/null
685    
686     rm -f $TempDevelRoot/.config.old
687    
688     # fix permissions
689     chmod -R a+rX $TempDevelRoot
690    
691     # disable mrproper in -devel rpms
692     patch -p1 -d $TempDevelRoot -i %{SOURCE2}
693    
694     kernel_devel_files=../kernel_devel_files.$devel_flavour
695    
696    
697     ### Create the kernel_devel_files.*
698     cat > $kernel_devel_files <<EOF
699     %defattr(-,root,root)
700     %dir $DevelRoot
701     %dir $DevelRoot/arch
702     %dir $DevelRoot/include
703     $DevelRoot/3rdparty
704     $DevelRoot/Documentation
705     $DevelRoot/arch/Kconfig
706     $DevelRoot/arch/um
707     %ifarch %{ix86} x86_64
708     $DevelRoot/arch/x86
709     %endif
710     $DevelRoot/block
711     $DevelRoot/crypto
712     $DevelRoot/drivers
713     $DevelRoot/firmware
714     $DevelRoot/fs
715     $DevelRoot/include/Kbuild
716     $DevelRoot/include/acpi
717     $DevelRoot/include/asm-generic
718     $DevelRoot/include/config
719     $DevelRoot/include/crypto
720     $DevelRoot/include/drm
721     $DevelRoot/include/generated
722     $DevelRoot/include/keys
723     $DevelRoot/include/linux
724     $DevelRoot/include/math-emu
725     $DevelRoot/include/media
726     $DevelRoot/include/mtd
727     $DevelRoot/include/net
728     $DevelRoot/include/pcmcia
729     $DevelRoot/include/rdma
730     $DevelRoot/include/rxrpc
731     $DevelRoot/include/scsi
732     $DevelRoot/include/sound
733     $DevelRoot/include/trace
734     $DevelRoot/include/video
735     $DevelRoot/include/xen
736     $DevelRoot/init
737     $DevelRoot/ipc
738     $DevelRoot/kernel
739     $DevelRoot/lib
740     $DevelRoot/mm
741     $DevelRoot/net
742     $DevelRoot/samples
743     $DevelRoot/scripts
744     $DevelRoot/security
745     $DevelRoot/sound
746     $DevelRoot/tools
747     $DevelRoot/usr
748     $DevelRoot/virt
749     $DevelRoot/.config
750     $DevelRoot/Kbuild
751     $DevelRoot/Kconfig
752     $DevelRoot/Makefile
753     $DevelRoot/Module.symvers
754     %doc README.Mandriva_Linux_%{ktag}
755     %doc README.kernel-%{ktag}-sources
756     EOF
757    
758    
759     ### Create -devel Post script on the fly
760     cat > $kernel_devel_files-post <<EOF
761     if [ -d /lib/modules/%{kversion}-%{ktag}-$devel_flavour-%{buildrpmrel} ]; then
762     rm -f /lib/modules/%{kversion}-%{ktag}-$devel_flavour-%{buildrpmrel}/{build,source}
763     ln -sf $DevelRoot /lib/modules/%{kversion}-%{ktag}-$devel_flavour-%{buildrpmrel}/build
764     ln -sf $DevelRoot /lib/modules/%{kversion}-%{ktag}-$devel_flavour-%{buildrpmrel}/source
765     fi
766     EOF
767    
768    
769     ### Create -devel Preun script on the fly
770     cat > $kernel_devel_files-preun <<EOF
771     if [ -L /lib/modules/%{kversion}-%{ktag}-$devel_flavour-%{buildrpmrel}/build ]; then
772     rm -f /lib/modules/%{kversion}-%{ktag}-$devel_flavour-%{buildrpmrel}/build
773     fi
774     if [ -L /lib/modules/%{kversion}-%{ktag}-$devel_flavour-%{buildrpmrel}$devel_cpu/source ]; then
775     rm -f /lib/modules/%{kversion}-%{ktag}-$devel_flavour-%{buildrpmrel}/source
776     fi
777     exit 0
778     EOF
779     }
780    
781    
782     CreateFiles() {
783     kernel_flavour=$1
784    
785     kernel_files=../kernel_files.$kernel_flavour
786    
787    
788     ### Create the kernel_files.*
789     cat > $kernel_files <<EOF
790     %defattr(-,root,root)
791     %{_bootdir}/System.map-%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}
792     %{_bootdir}/config-%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}
793     %{_bootdir}/vmlinuz-%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}
794     %dir %{_modulesdir}/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}/
795     %{_modulesdir}/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}/kernel
796     %{_modulesdir}/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}/modules.*
797     %doc README.Mandriva_Linux_%{ktag}
798     %doc README.kernel-%{ktag}-sources
799     EOF
800    
801    
802     ### Create kernel Post script
803     cat > $kernel_files-post <<EOF
804     /sbin/installkernel -L %{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}
805     pushd /boot > /dev/null
806     if [ -L vmlinuz-%{ktag}-$kernel_flavour ]; then
807     rm -f vmlinuz-%{ktag}-$kernel_flavour
808     fi
809     ln -sf vmlinuz-%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel} vmlinuz-%{ktag}-$kernel_flavour
810     if [ -L initrd-%{ktag}-$kernel_flavour.img ]; then
811     rm -f initrd-%{ktag}-$kernel_flavour.img
812     fi
813     ln -sf initrd-%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}.img initrd-%{ktag}-$kernel_flavour.img
814     popd > /dev/null
815     %if %build_devel
816     # create kernel-devel symlinks if matching -devel- rpm is installed
817     if [ -d /usr/src/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel} ]; then
818     rm -f /lib/modules/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}/{build,source}
819     ln -sf /usr/src/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel} /lib/modules/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}/build
820     ln -sf /usr/src/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel} /lib/modules/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}/source
821     fi
822     %endif
823     %if %build_source
824     # create kernel-source symlinks only if matching -devel- rpm is not installed
825     if [ -d /usr/src/%{kversion}-%{ktag}-%{buildrpmrel} -a ! -d /usr/src/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel} ]; then
826     rm -f /lib/modules/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}/{build,source}
827     ln -sf /usr/src/%{kversion}-%{ktag}-%{buildrpmrel} /lib/modules/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}/build
828     ln -sf /usr/src/%{kversion}-%{ktag}-%{buildrpmrel} /lib/modules/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}/source
829     fi
830     %endif
831     EOF
832    
833    
834     ### Create kernel Preun script on the fly
835     cat > $kernel_files-preun <<EOF
836     /sbin/installkernel -R %{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}
837     pushd /boot > /dev/null
838     if [ -L vmlinuz-%{ktag}-$kernel_flavour ]; then
839     if [ "$(readlink vmlinuz-%{ktag}-$kernel_flavour)" = "vmlinuz-%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}" ]; then
840     rm -f vmlinuz-%{ktag}-$kernel_flavour
841     fi
842     fi
843     if [ -L initrd-%{ktag}-$kernel_flavour.img ]; then
844     if [ "$(readlink initrd-%{ktag}-$kernel_flavour.img)" = "initrd-%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}.img" ]; then
845     rm -f initrd-%{ktag}-$kernel_flavour.img
846     fi
847     fi
848     popd > /dev/null
849     %if %build_devel
850     if [ -L /lib/modules/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}/build ]; then
851     rm -f /lib/modules/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}/build
852     fi
853     if [ -L /lib/modules/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}/source ]; then
854     rm -f /lib/modules/%{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}/source
855     fi
856     %endif
857     exit 0
858     EOF
859    
860    
861     ### Create kernel Postun script on the fly
862     cat > $kernel_files-postun <<EOF
863     /sbin/kernel_remove_initrd %{kversion}-%{ktag}-$kernel_flavour-%{buildrpmrel}
864     EOF
865     }
866    
867    
868     CreateKernel() {
869     flavour=$1
870    
871     PrepareKernel $flavour %{ktag}-$flavour-%{buildrpmrel}
872    
873     BuildKernel %{kversion}-%{ktag}-$flavour-%{buildrpmrel}
874     %if %build_devel
875     SaveDevel $flavour
876     %endif
877     CreateFiles $flavour
878     }
879    
880    
881     ###
882     # DO it...
883     ###
884    
885    
886     # Create a simulacro of buildroot
887     rm -rf %{temp_root}
888     install -d %{temp_root}
889    
890    
891     #make sure we are in the directory
892     cd %src_dir
893    
894     %ifarch %{ix86}
895     %if %build_desktop586
896     CreateKernel desktop586
897     %endif
898     %endif
899    
900     %if %build_desktop
901     CreateKernel desktop
902     %endif
903    
904     %if %build_laptop
905     CreateKernel laptop
906     %endif
907    
908     %if %build_realtime
909     CreateKernel realtime
910     %endif
911    
912     %if %build_server
913     CreateKernel server
914     %endif
915    
916    
917     # kernel-source is shipped as a clean source tree, with no preparation
918     %if %build_source
919     PrepareKernel "" %{buildrpmrel}%{ktag}custom
920     %smake -s mrproper
921     %endif
922    
923    
924     ###
925     ### install
926     ###
927     %install
928     install -m 644 %{SOURCE4} .
929     install -m 644 %{SOURCE5} .
930    
931     cd %src_dir
932    
933     # Directories definition needed for installing
934     %define target_source %{buildroot}%{_kerneldir}
935     %define target_boot %{buildroot}%{_bootdir}
936     %define target_modules %{buildroot}%{_modulesdir}
937    
938     # We want to be able to test several times the install part
939     rm -rf %{buildroot}
940     cp -a %{temp_root} %{buildroot}
941    
942     # Create directories infastructure
943     %if %build_source
944     install -d %{target_source}
945    
946     tar cf - . | tar xf - -C %{target_source}
947     chmod -R a+rX %{target_source}
948    
949     # we remove all the source files that we don't ship
950     # first architecture files
951     for i in alpha arm arm26 avr32 blackfin cris frv h8300 ia64 microblaze mips m32r m68k \
952     m68knommu mn10300 parisc powerpc ppc s390 sh sh64 score sparc tile v850 xtensa; do
953     rm -rf %{target_source}/arch/$i
954     done
955    
956     %ifnarch %{ix86} x86_64
957     rm -rf %{target_source}/arch/x86
958     %endif
959    
960     # other misc files
961     rm -f %{target_source}/{.config.old,.config.cmd,.mailmap,.missing-syscalls.d,arch/.gitignore}
962    
963     #endif %build_source
964     %endif
965    
966     # We used to have a copy of PrepareKernel here
967     # Now, we make sure that the thing in the linux dir is what we want it to be
968     for i in %{target_modules}/*; do
969     rm -f $i/build $i/source
970     done
971    
972     # Create modules.description
973     pushd %{target_modules}
974     for i in *; do
975     pushd $i
976     echo "Creating modules.description for $i"
977     modules=`find . -name "*.ko.gz"`
978     echo $modules | %kxargs /sbin/modinfo \
979     | perl -lne 'print "$name\t$1" if $name && /^description:\s*(.*)/; $name = $1 if m!^filename:\s*(.*)\.k?o!; $name =~ s!.*/!!' > modules.description
980     popd
981     done
982     popd
983    
984    
985     ###
986     ### clean
987     ###
988     %clean
989     rm -rf %{buildroot}
990    
991    
992     # We don't want to remove this, the whole reason of its existence is to be
993     # able to do several rpm --short-circuit -bi for testing install
994     # phase without repeating compilation phase
995     #rm -rf %{temp_root}
996    
997     ###
998     ### source and doc file lists
999     ###
1000     %if %build_source
1001     %files -n %{kname}-source-%{buildrel}
1002     %defattr(-,root,root)
1003     %dir %{_kerneldir}
1004     %dir %{_kerneldir}/arch
1005     %dir %{_kerneldir}/include
1006     %{_kerneldir}/3rdparty
1007     %{_kerneldir}/Documentation
1008     %{_kerneldir}/arch/Kconfig
1009     %{_kerneldir}/arch/um
1010     %ifarch %{ix86} x86_64
1011     %{_kerneldir}/arch/x86
1012     %endif
1013     %{_kerneldir}/block
1014     %{_kerneldir}/crypto
1015     %{_kerneldir}/drivers
1016     %{_kerneldir}/firmware
1017     %{_kerneldir}/fs
1018     %{_kerneldir}/include/Kbuild
1019     %{_kerneldir}/include/acpi
1020     %{_kerneldir}/include/asm-generic
1021     %{_kerneldir}/include/crypto
1022     %{_kerneldir}/include/drm
1023     %{_kerneldir}/include/keys
1024     %{_kerneldir}/include/linux
1025     %{_kerneldir}/include/math-emu
1026     %{_kerneldir}/include/media
1027     %{_kerneldir}/include/mtd
1028     %{_kerneldir}/include/net
1029     %{_kerneldir}/include/pcmcia
1030     %{_kerneldir}/include/rdma
1031     %{_kerneldir}/include/rxrpc
1032     %{_kerneldir}/include/scsi
1033     %{_kerneldir}/include/sound
1034     %{_kerneldir}/include/trace
1035     %{_kerneldir}/include/video
1036     %{_kerneldir}/include/xen
1037     %{_kerneldir}/init
1038     %{_kerneldir}/ipc
1039     %{_kerneldir}/kernel
1040     %{_kerneldir}/lib
1041     %{_kerneldir}/mm
1042     %{_kerneldir}/net
1043     %{_kerneldir}/samples
1044     %{_kerneldir}/scripts
1045     %{_kerneldir}/security
1046     %{_kerneldir}/sound
1047     %{_kerneldir}/tools
1048     %{_kerneldir}/usr
1049     %{_kerneldir}/virt
1050     %{_kerneldir}/.gitignore
1051     %{_kerneldir}/COPYING
1052     %{_kerneldir}/CREDITS
1053     %{_kerneldir}/Kbuild
1054     %{_kerneldir}/Kconfig
1055     %{_kerneldir}/MAINTAINERS
1056     %{_kerneldir}/Makefile
1057     %{_kerneldir}/README
1058     %{_kerneldir}/REPORTING-BUGS
1059     %doc README.Mandriva_Linux_%{ktag}
1060     %doc README.kernel-%{ktag}-sources
1061    
1062     %files -n %{kname}-source-latest
1063     %defattr(-,root,root)
1064     %endif
1065    
1066     %if %build_doc
1067     %files -n %{kname}-doc
1068     %defattr(-,root,root)
1069     %doc linux-%{tar_ver}/Documentation/*
1070     %endif
1071    

  ViewVC Help
Powered by ViewVC 1.1.28