1 Summary: The Linux kernel (the core of the Linux operating system)
3 # Versions of various parts
6 # Polite request for people who spin their own kernel rpms:
7 # please modify the "release" field in a way that identifies
8 # that the kernel isn't the stock RHL kernel, for example by
9 # adding some text to the end of the version number.
11 %define kversion @KERNEL_VERSION@
12 %define kextraver @KERNEL_EXTRA_VERSION@
13 %define kextraverdelim @KERNEL_EXTRA_VERSION_DELIMITER@
14 %define flavordelim "@KERNEL_TARGET_DELIMITER@"
15 %define release @KERNEL_RELEASE@
16 # /usr/src/%{kslnk} -> /usr/src/linux-%{KVERREL}
17 %define kslnk linux-2.4
18 %define kprovides %(bash -c "echo %{kversion}%{kextraverdelim}%{kextraver} | sed -e 's/-[^0-9]*smp$//'")
20 # groups of related archs
21 %define all_x86 i386 i686 i586 athlon
22 #define all_x86 i686 i386 i586 athlon
24 %define nptlarchs %{all_x86}
25 #define nptlarchs noarch
26 %define rhbuild @RHBUILD@
27 %define susebuild @SUSEBUILD@
28 %define linux26 @LINUX26@
29 %define lmakeopts @LMAKEOPTS@
31 # disable build root strip policy
32 %define __spec_install_post /usr/lib/rpm/brp-compress || :
35 %define _missing_doc_files_terminate_build 0
36 %define _unpackaged_files_terminate_build 0
37 %define debug_package %{nil}
39 # Enable this to build a board-specific kernel configuration
40 # some architectures have LOTS of different setups and this
41 # is a way to deal with that cleanly.
43 #define targetboard assabet
44 %define dashtargetboard %{?targetboard:-%{targetboard}}
45 %define withtargetboard 0
46 %{?targetboard: %{expand: %%define withtargetboard 1}}
48 # Override generic defaults with per-arch defaults (which can
49 # themselves be overridden with --with/--without). These must
50 # ONLY be "0", never "1"
58 %define buildpseries64 0
66 %ifarch @BIGMEM_ARCHS@
74 %ifarch @JENSEN_ARCHS@
82 %ifarch @BIGSMP_ARCHS@
86 %ifarch @PSERIES64_ARCHS@
87 %define buildpseries64 1
94 # For board-specific kernels, build only the normal kernel (which may actually be smp, not up).
95 %if %{withtargetboard}
100 %define buildpseries64 0
101 %define buildjensen 0
105 Second, per-architecture exclusions (ifarch)
114 # we can't test values inline, only whether a macro exists
115 %{expand: %%define buildup_%{buildup} yadda}
116 %{expand: %%define buildsmp_%{buildsmp} yadda}
117 %{expand: %%define buildbigsmp_%{buildbigsmp} yadda}
118 %{expand: %%define buildpseries64_%{buildpseries64} yadda}
119 %{expand: %%define buildBOOT_%{buildBOOT} yadda}
120 %{expand: %%define buildbigmem_%{buildbigmem} yadda}
121 %{expand: %%define buildjensen_%{buildjensen} yadda}
122 %{expand: %%define ikd_%{ikd} yadda}
123 %{expand: %%define ibcs_%{ibcs} yadda}
124 %{expand: %%define debuglevel_%{debugging} yadda}
126 %{expand: %%define kernel_conflicts ppp <= 2.3.15, pcmcia-cs <= 3.1.20, isdn4k-utils <= 3.0, mount < 2.10r-5, nfs-utils < 0.3.1, cipe < 1.4.5, tux < 2.1.0, kudzu <= 0.92, e2fsprogs < 1.22, initscripts < 5.84, dev < 3.2-7, iptables < 1.2.5-3, bcm5820 < 1.81, nvidia-rh72 <= 1.0, oprofile < 0.4}
129 %define BOOT_kernel_prereq fileutils, modutils >= 2.4.18
130 %define kernel_prereq %{BOOT_kernel_prereq}, initscripts >= 5.83, mkinitrd >= 3.2.6
134 %define initrd_dir /boot/efi/redhat
136 %define initrd_dir /boot
139 %ifarch %{all_x86} x86_64
140 %define kernel_glob vmlinu?-%{KVERREL}
143 # <sigh>, no GLOB_BRACE for filelists, efi needs to be done separately
144 %define kernel_glob vmlinuz-%{KVERREL}
147 %define kernel_glob vmlinu?-%{KVERREL}
150 %define kernel_glob vmlinu?-%{KVERREL}
155 Release: %{release}%{?targetboard:%{targetboard}}%{?debuglevel_1:.dbg}
156 %define KVERREL %{PACKAGE_VERSION}%{kextraverdelim}%{kextraver}%{?targetboard:%{targetboard}}%{?debuglevel_1:.dbg}
158 Group: System Environment/Kernel
159 ExclusiveArch: %{all_x86} x86_64 ia64 ppc ppc64
161 Obsoletes: kernel-modules, kernel-sparc
162 Provides: kernel = %{kprovides}
163 BuildConflicts: rhbuildsys(DiscFree) < 500Mb
164 %ifarch %{all_x86} ia64 x86_64
165 Provides: kernel-drm = 4.1.0, kernel-drm = 4.2.0, kernel-drm = 4.3.0, kernel-drm = 4.2.99.3
169 Prereq: %{kernel_prereq}
170 Conflicts: %{kernel_conflicts}
172 BuildPreReq: patch >= 2.5.4, bash >= 2.03, sh-utils, gnupg, tar
173 BuildPreReq: bzip2, findutils, dev, gzip, m4
176 Vendor: Sun Microsystems, Inc.
177 URL: http://www.kernel.org/
178 Buildroot: %{_tmppath}/%{name}-%{version}-root
180 Source0: @LUSTRE_SOURCE@
181 Source1: @KERNEL_SOURCE@
182 Source2: external-patches.tar.gz
184 Source15: linux-rhconfig.h
185 Source16: linux-merge-config.awk
186 Source17: linux-merge-modules.awk
188 Source25: suse-functions.sh
189 Source26: suse-post.sh
190 Source27: suse-postun.sh
191 Source28: suse-trigger-script.sh.in
192 Source29: sles8-post.sh
193 Source30: sles8-postun.sh
194 Source31: sles8-pre.sh
195 Source32: sles8-update_INITRD_MODULES.sh
196 Source33: sles8-update_rcfile_setting.sh
199 Summary: The source code for the Linux kernel.
200 Group: Development/System
203 Requires: gcc >= 2.96-98
207 Summary: Various documentation bits found in the kernel source.
211 The kernel package contains the Linux kernel (vmlinuz), the core of a
212 Linux operating system. The kernel handles the basic functions of the
213 operating system: memory allocation, process allocation, device input
217 The kernel-source package contains the source code files for the Linux
218 kernel. These source files are needed to build custom/third party device
219 drivers. The source files can also be used to build a custom kernel that is
220 better tuned to your particular hardware, if you are so inclined (and you
221 know what you're doing).
224 This package contains documentation files form the kernel
225 source. Various bits of information about the Linux kernel and the
226 device drivers shipped with it are documented in these files.
228 You'll want to install this package if you need a reference to the
229 options that can be passed to Linux kernel modules at load time.
232 Summary: The Linux kernel compiled for SMP machines.
233 Group: System Environment/Kernel
234 Provides: module-info, kernel = %{kprovides}
235 %ifarch %{all_x86} ia64 x86_64
236 Provides: kernel-drm = 4.1.0, kernel-drm = 4.2.0, kernel-drm = 4.3.0, kernel-drm = 4.2.99.3
239 Prereq: %{kernel_prereq}
240 Conflicts: %{kernel_conflicts}
244 This package includes a SMP version of the Linux kernel. It is
245 required only on machines with two or more CPUs, although it should
246 work fine on single-CPU boxes.
248 Install the kernel-smp package if your machine uses two or more CPUs.
251 Summary: The Linux kernel compiled for SMP machines.
253 Provides: module-info, kernel = %{kprovides}, k_smp4G
255 %ifarch %{all_x86} ia64 x86_64
256 Provides: kernel-drm = 4.1.0, kernel-drm = 4.2.0, kernel-drm = 4.3.0, kernel-drm = 4.2.99.3
259 Prereq: %{kernel_prereq}
260 Conflicts: %{kernel_conflicts}
264 This package includes a SMP version of the Linux kernel. It is
265 required only on machines with two or more CPUs, although it should
266 work fine on single-CPU boxes.
268 Install the kernel-bigsmp package if your machine uses two or more CPUs.
271 Summary: Standard Kernel for 64-bit Power based SMP and LPAR Machines
273 Provides: module-info, kernel = %{kprovides}, k_smp4G
274 %ifarch %{all_x86} ia64 x86_64
275 Provides: kernel-drm = 4.1.0, kernel-drm = 4.2.0, kernel-drm = 4.3.0, kernel-drm = 4.2.99.3
278 Prereq: %{kernel_prereq}
279 Conflicts: %{kernel_conflicts}
282 %description pseries64
283 The standard kernel for Power3, Power4 and PowerPC 970 64-bit SMP
286 This kernel can be used for all 64bit RS/6000, pSeries and JS20
290 Summary: The Linux Kernel for machines with more than 4 Gigabyte of memory.
291 Group: System Environment/Kernel
292 Provides: module-info, kernel = %{kprovides}
293 %ifarch %{all_x86} ia64 x86_64
294 Provides: kernel-drm = 4.1.0, kernel-drm = 4.2.0, kernel-drm = 4.3.0, kernel-drm = 4.2.99.3
297 Prereq: %{kernel_prereq}
298 Conflicts: %{kernel_conflicts}
299 Obsoletes: kernel-enterprise <= 2.4.10
303 This package includes a kernel that has appropriate configuration options
304 enabled for Pentium III machines with 4 Gigabyte of memory or more.
307 Summary: The version of the Linux kernel used on installation boot disks.
308 Group: System Environment/Kernel
309 Provides: kernel = %{kprovides}
311 Prereq: %{BOOT_kernel_prereq}
312 Conflicts: %{kernel_conflicts}
316 This package includes a trimmed down version of the Linux kernel.
317 This kernel is used on the installation boot disks only and should not
318 be used for an installed system, as many features in this kernel are
319 turned off because of the size constraints.
322 Summary: The Linux kernel used on installation boot disks for SMP machines.
323 Group: System Environment/Kernel
324 Provides: kernel = %{kprovides}
326 Prereq: %{BOOT_kernel_prereq}
327 Conflicts: %{kernel_conflicts}
331 This package includes a trimmed down version of the Linux kernel. This
332 kernel is used on the installation boot disks only and should not be used
333 for an installed system, as many features in this kernel are turned off
334 because of the size constraints. This kernel is used when booting SMP
335 machines that have trouble coming up to life with the uniprocessor kernel.
338 Summary: The Linux Kernel compiled for the Alpha Jensen platform.
339 Group: System Environment/Kernel
340 Provides: kernel = %{kprovides}
342 Prereq: %{kernel_prereq}
343 Conflicts: %{kernel_conflicts}
347 This package includes a kernel that has appropriate configuration
348 options enabled for use on the Alpha Jensen platform. The Jensen
349 platform is not supported in the normal generic alpha kernel support.
351 %package -n lustre-lite-utils
352 Summary: Lustre utils for Linux
353 Group: Applications/System
355 %description -n lustre-lite-utils
356 The Lustre Lite file system utilities. This includes the tools needed
357 to configure, mount, and administer a Lustre filesystem. This package
358 is necessary if you want to access a Lustre filesystem.
360 # the lustre-doc files are just included as %doc with
363 #%package -n lustre-doc
364 #Summary: Sample Lustre configurations and documentation
365 #Group: Documentation
367 #%description -n lustre-doc
368 #The Lustre book, sample configurations, and other documentation for
371 # This is required in rpm >= 4.4.? and _should_ be set by the %setup macro
372 # but isn't, at least for 4.4.2. Yay RPM.
373 %define buildsubdir lustre-kernel-%{version}
374 %define _buildsubdir lustre-kernel-%{version}
377 %setup -n lustre-kernel-%{version} -q -c
378 if [ ! -d lustre ] ; then
379 ln -sf lustre* lustre
381 pushd lustre >/dev/null
382 if [ -s "%{SOURCE2}" ] ; then
383 tar zxf "%{SOURCE2}" -C lustre/kernel_patches
385 bash -x ./build/lmake \
387 --target @LUSTRE_TARGET@ \
388 --target-arch %{_target_cpu} \
389 --kerneldir $RPM_SOURCE_DIR %{lmakeopts}
392 # handle both SuSE and Red Hat's new-kernel-pkg bits
393 for flavor in "" smp bigmem bigsmp pseries64 BOOT jensen ; do
394 [ -n "$flavor" ] && delim_flavor="%{flavordelim}$flavor"
395 for when in pre preun post postun ; do
396 script="${when}${flavor}.sh"
397 cat %{SOURCE25} %{SOURCE32} %{SOURCE33} > ${script}
398 echo "if [ -d /etc/susehelp.d ] ; then" >> ${script}
399 sed -e "s/@when@/$when/g" -e "s^%ver_str^%{KVERREL}${delim_flavor}^g" %{SOURCE28} >> ${script}
402 echo "if [ ! -f /etc/modprobe.conf ] ; then" >> ${script}
403 cat %{SOURCE31} >> ${script}
404 echo "fi" >> ${script}
407 # /sbin/update-modules.dep compares when the modules were built, rather
408 # than installed, so force modules.dep to be recreated
409 echo "rm -f /lib/modules/%{KVERREL}${delim_flavor}/modules.dep" >> ${script}
410 echo "if [ -f /etc/modprobe.conf ] ; then" >> ${script}
411 sed -e "s^%ver_str^%{KVERREL}${delim_flavor}^g" -e "s^%flavor^${flavor}^" %{SOURCE26} >> ${script}
413 echo "else" >> ${script}
414 sed -e "s^%ver_str^%{KVERREL}${delim_flavor}^g" -e "s^%%{cfg_name}^${delim_flavor}^g" %{SOURCE29} >> ${script}
415 echo "fi" >> ${script}
418 echo "if [ -f /etc/modprobe.conf ] ; then" >> ${script}
419 sed -e "s^%ver_str^%{KVERREL}${delim_flavor}^g" %{SOURCE27} >> ${script}
421 echo "else" >> ${script}
422 sed -e "s^%ver_str^%{KVERREL}${delim_flavor}^g" %{SOURCE30} >> ${script}
423 echo "fi" >> ${script}
426 echo "exit 0; fi" >> ${script}
429 if [ -z "${flavor}" ] ; then
430 cat >> ${script} <<EOF
433 ln -sf vmlinuz-%{KVERREL} vmlinuz
435 ln -sf System.map-%{KVERREL} System.map
436 ln -sf module-info-%{KVERREL} module-info
439 cat >> ${script} <<EOF
440 [ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade
441 [ -x /sbin/mkkerneldoth ] && /sbin/mkkerneldoth
442 if [ -x /sbin/new-kernel-pkg ] ; then
443 if /sbin/new-kernel-pkg 2>&1 | grep package >/dev/null ; then
444 PACKAGE_ARG="--package kernel-${flavor}"
446 /sbin/new-kernel-pkg $PACKAGE_ARG --mkinitrd --depmod \
447 --install %{KVERREL}${delim_flavor}
454 cat >> ${script} <<EOF
455 /sbin/modprobe loop 2>/dev/null >/dev/null || :
460 cat >> ${script} <<EOF
461 /sbin/modprobe loop 2> /dev/null > /dev/null || :
462 rm -f /lib/modules/%{KVERREL}${delim_flavor}/modules.*
463 if [ -x /sbin/new-kernel-pkg ] ; then
464 /sbin/new-kernel-pkg --rminitrd --rmmoddep --remove %{KVERREL}${delim_flavor}
471 cat > "kernel$flavor.files" <<EOF
472 %%defattr(-, root, root)
473 /boot/%{kernel_glob}${delim_flavor}
474 /boot/System.map-%{KVERREL}${delim_flavor}
475 /boot/config-%{KVERREL}${delim_flavor}
478 /lib/modules/%{KVERREL}${delim_flavor}
480 /boot/efi/redhat/%{kernel_glob}${delim_flavor}
484 /boot/Kerntypes-%{KVERREL}${delim_flavor}
486 /boot/symvers-%{KVERREL}-%{_target_cpu}${delim_flavor}.gz
492 cat > kernel-source.files <<EOF
493 %%defattr(-,root,root)
494 %%dir /usr/src/linux-%{KVERREL}
495 /usr/src/linux-%{KVERREL}/*
497 %%dir /usr/src/linux-%{KVERREL}-obj
498 /usr/src/linux-%{KVERREL}-obj/*
503 # if RPM_BUILD_NCPUS unset, set it
504 if [ -z "$RPM_BUILD_NCPUS" ] ; then
505 RPM_BUILD_NCPUS=$(egrep -c "^cpu[0-9]+" /proc/stat || :)
506 if [ $RPM_BUILD_NCPUS -eq 0 ] ; then
509 if [ $RPM_BUILD_NCPUS -gt 8 ] ; then
514 rm -rf $RPM_BUILD_ROOT
515 mkdir -p $RPM_BUILD_ROOT
519 target_config=${1:+--target-config $1}
520 bash -x ./build/lmake \
522 --target @LUSTRE_TARGET@ \
523 --target-arch %{_target_cpu} \
525 --extraversion %{kextraver} \
526 -j $RPM_BUILD_NCPUS %{lmakeopts}
531 target_config=${1:+--target-config $1}
532 bash -x ./build/lmake \
533 --build-kernel --build-lustre \
536 --target @LUSTRE_TARGET@ \
537 --target-arch %{_target_cpu} \
539 --extraversion %{kextraver} \
540 --kerneldir $RPM_SOURCE_DIR \
541 -j $RPM_BUILD_NCPUS \
542 --destdir $RPM_BUILD_ROOT %{lmakeopts} \
549 target_config=${1:+--target-config $1}
550 bash -x ./build/lmake \
553 --target @LUSTRE_TARGET@ \
554 --target-arch %{_target_cpu} \
556 --extraversion %{kextraver} \
557 --kerneldir $RPM_SOURCE_DIR \
558 -j $RPM_BUILD_NCPUS \
559 --destdir $RPM_BUILD_ROOT %{lmakeopts} \
561 --disable-doc --disable-tests \
562 --disable-modules --disable-liblustre \
563 --sysconfdir=%{_sysconfdir} \
564 --mandir=%{_mandir} \
570 bash -x ./build/lmake \
572 --target @LUSTRE_TARGET@ \
573 --target-arch %{_target_cpu} \
574 --extraversion %{kextraver} \
575 --destdir $RPM_BUILD_ROOT %{lmakeopts}
578 pushd lustre >/dev/null
600 %if %{buildpseries64}
601 BuildKernel pseries64
615 pushd lustre >/dev/null
616 # it's already installed, so just clean up some things that are rpm
618 for i in $RPM_BUILD_ROOT/lib/modules/* ; do
621 # remove legacy pcmcia symlink that's no longer useful
626 # mark the vmlinux* non-executable to fool strip-to-file
627 chmod a-x $RPM_BUILD_ROOT/boot/vmlinux*
632 if [ $flavor = "up" ] ; then
636 flavext="%{flavordelim}$flavor"
639 perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = %{kextraverdelim}%{kextraver}${flavext}/" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/Makefile
640 c="$RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}"
641 o="${c}-obj/%{_target_cpu}/$flavor"
643 # use the one we just built
644 #cp ../lustre/kernel_patches/kernel_configs/kernel-%{kversion}-@LUSTRE_TARGET@-%{_target_cpu}%{dashtargetboard}${flavext}.config \
645 cp .config $o/.config
646 for oc in oldconfig_nonint silentoldconfig oldconfig ; do
647 if grep -q "$oc" Makefile ; then
652 MAKE="make -s O=$o -C ${c}"
656 $MAKE "$MAKE_CC" $OLDCONFIG
658 rm -rf $o/.config.old $o/include/config
659 # Replace the Makefile in the object directory with a version
660 # that has relative path names. This is done by fixing the Makefile
661 # after the fact to work with 2.6.17 and newer mkmakefile.
662 read VERSION PATCHLEVEL SUBLEVEL <<-EOF
663 $(set -- 2.6.5 ; echo ${*//./ })
666 ARCH=%{_target_cpu} /bin/bash scripts/mkmakefile ../../../linux-%{KVERREL} $o \
667 $VERSION $PATCHLEVEL > $o/Makefile.in
668 if [ -f $o/Makefile ] ; then
669 # will exist only for 2.6.17 and newer because mkmakefile
670 # now writes the makefile to $o instead of stdout
671 mv -f $o/Makefile $o/Makefile.in
673 sed -e "s^$o^../linux-%{KVERREL}-obj/%{_target_cpu}/$flavor^" \
674 $o/Makefile.in > $o/Makefile
675 zcat "$RPM_BUILD_ROOT/boot/symvers-%{KVERREL}-%{_target_cpu}${flavext}.gz" \
680 ## do -source package cleanup/install
682 if [ "%{buildbase}" -ne 0 ] ; then
683 pushd linux >/dev/null
684 mkdir -p $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
685 rm -f drivers/net/hamradio/soundmodem/gentbl scripts/mkdep
686 tar cf - . | tar xf - -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
687 ln -sf linux-%{KVERREL} $RPM_BUILD_ROOT/usr/src/linux
688 # install -m 644 %{SOURCE10} $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
690 #clean up the destination
691 make -s mrproper -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
692 rm -rf $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/configs
693 mkdir -p $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/configs
694 cp ../lustre/kernel_patches/kernel_configs/kernel-%{kversion}-@LUSTRE_TARGET@*.config $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/configs
695 if [ "%{linux26}" -ne 0 ] ; then
696 # this only works because Sun only builds one kernel per target/arch per kernel-source rpm
697 objdir=$RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}-obj
699 if [ "%{buildbigmem}" -ne 0 ] ; then
702 if [ "%{buildBOOT}" -ne 0 ] ; then
705 if [ "%{buildjensen}" -ne 0 ] ; then
708 if [ "%{buildsmp}" -ne 0 ] ; then
711 if [ "%{buildbigsmp}" -ne 0 ] ; then
714 if [ "%{buildpseries64}" -ne 0 ] ; then
717 if [ "%{buildup}" -ne 0 ] ; then
720 perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = %{kextraverdelim}%{kextraver}%{flavordelim}custom/" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/Makefile
721 # Remove $RPM_BUILD_ROOT prefix from symlinks.
722 for link in $(find $objdir -type l); do
723 target=$(readlink $link)
725 ln -s ${target/$RPM_BUILD_ROOT/} $link
728 perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = %{kextraverdelim}%{kextraver}%{flavordelim}custom/" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/Makefile
729 # get the one from the build we just completed as it might have picked
731 #cp ../lustre/kernel_patches/kernel_configs/kernel-%{kversion}-@LUSTRE_TARGET@-%{_target_cpu}%{dashtargetboard}.config $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/.config
732 cp .config $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/.config
733 for oc in oldconfig_nonint silentoldconfig oldconfig ; do
734 if grep -q "$oc" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/Makefile ; then
742 make "$MAKE_CC" -s $OLDCONFIG -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
743 make "$MAKE_CC" -s symlinks -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
744 make "$MAKE_CC" -s include/linux/version.h -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
746 #this generates modversions info which we want to include and we may as
747 #well include the depends stuff as well, after we fix the paths
748 make -s depend -C $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}
749 find $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL} -name ".*depend" | \
752 sed -e "s|[^ ]*\(/usr/src/linux\)|\1|g" < $file.old > $file
756 # Try to put some smarter autoconf.h and version.h files in place
757 pushd $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/include/linux ; {
758 rm -rf modules modversions.h autoconf.h version.h
759 cat > modversions.h <<EOF
760 #ifndef _LINUX_MODVERSIONS_H
761 #define _LINUX_MODVERSIONS_H
762 #include <linux/rhconfig.h>
763 #include <linux/modsetver.h>
765 echo '#include <linux/rhconfig.h>' > autoconf.h
766 list=`find ../../savedheaders/* -name '*.ver' -exec basename '{}' \; | sort`
769 sed 's,$,modules/'$l, ../../savedheaders/list | awk -f %{SOURCE17} > modules/$l
770 touch -r modules/$l modules/`basename $l .ver`.stamp
771 echo '#include <linux/modules/'$l'>' >> modversions.h
773 echo '#endif' >> modversions.h
774 sed 's,$,autoconf.h,' ../../savedheaders/list | awk -f %{SOURCE16} >> autoconf.h
775 install -m 644 %{SOURCE15} rhconfig.h
776 echo "#include <linux/rhconfig.h>" >> version.h
778 for i in smp BOOT BOOTsmp bigmem bigsmp pseries64 up ; do
779 # When we build in an i386, we don't have an bigmem header directory
780 # in savedheaders/i386/bigmem. We also don't have a BOOT directory
781 # anywhere except in savedheaders/i386. So, we need to use this method
782 # of determining if a kernel version string needs to be included in the
784 verh=`echo ../../savedheaders/*/$i/version.h | awk ' { print $1 } '`
785 if [ -n "$verh" -a -f "$verh" ]; then
786 if [ "$i" = up ]; then
787 if [ "$keyword" = if ]; then
788 echo "#if 0" >> version.h
790 echo "#else" >> version.h
792 echo "#$keyword defined(__module__$i)" >> version.h
795 grep UTS_RELEASE $verh >> version.h
798 echo "#endif" >> version.h
799 if [ -f ../../savedheaders/%{_target_cpu}/up/version.h ] ; then
800 # keep to a standard normally
801 HEADER_FILE=../../savedheaders/%{_target_cpu}/up/version.h
803 # test build not including uniprocessor, must get info from somewhere
804 HEADER_FILE=$(ls ../../savedheaders/*/*/version.h | head -n 1)
806 grep -v UTS_RELEASE $HEADER_FILE >> version.h
807 rm -rf ../../savedheaders
809 touch $RPM_BUILD_ROOT/boot/kernel.h-%{kversion}
811 # rm -f $RPM_BUILD_ROOT/usr/include/linux
813 rm -rf $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/savedheaders
815 if [ "%{rhbuild}" -ne 0 ] ; then
816 # fix up the tmp_include_depends file wrt the buildroot
817 perl -p -i -e "s|$RPM_BUILD_ROOT||g" $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL}/tmp_include_depends
826 rm -rf $RPM_BUILD_ROOT
832 # do this for upgrades...in case the old modules get removed we have
833 # loopback in the kernel so that mkinitrd will work.
836 %pre smp -f presmp.sh
838 %pre bigsmp -f prebigsmp.sh
840 %pre pseries64 -f prepseries64.sh
842 %pre bigmem -f prebigmem.sh
846 %post pseries64 -f postpseries64.sh
848 %post smp -f postsmp.sh
850 %post bigsmp -f postbigsmp.sh
852 %post bigmem -f postbigmem.sh
854 %post jensen -f postjensen.sh
857 %post BOOT -f postBOOT.sh
861 %post -n lustre-lite-utils
862 if [ -f /etc/init.d/lustre ] ; then
863 /sbin/chkconfig --add lustre
864 /sbin/chkconfig --add lustrefs
867 # Allow clean removal of modules directory
870 %preun pseries64 -f preunpseries64.sh
872 %preun smp -f preunsmp.sh
874 %preun bigsmp -f preunbigsmp.sh
876 %preun bigmem -f preunbigmem.sh
878 %preun BOOT -f preunBOOT.sh
880 %preun jensen -f preunjensen.sh
882 # suse needs these i guess
885 %postun pseries64 -f postunpseries64.sh
887 %postun smp -f postunsmp.sh
889 %postun bigsmp -f postunbigsmp.sh
891 %postun bigmem -f postunbigmem.sh
893 %postun BOOT -f postunBOOT.sh
895 %postun jensen -f postunjensen.sh
897 # We need this here because we don't prereq kudzu; it could be
898 # installed after the kernel
900 [ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || :
902 %triggerin smp -- kudzu
903 [ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || :
905 %triggerin bigsmp -- kudzu
906 [ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || :
908 %triggerin pseries64 -- kudzu
909 [ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || :
911 %triggerin bigmem -- kudzu
912 [ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || :
914 %triggerin BOOT -- kudzu
915 [ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || :
917 %triggerin jensen -- kudzu
918 [ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade || :
921 # Old kernel-headers packages owned include symlinks; new
922 # ones just make them so that we can have multiple kernel-headers
923 # packages installed.
925 %triggerpostun source -- kernel-headers < 2.2.16
928 ln -snf linux-%{KVERREL} %{kslnk}
934 ln -snf linux-%{KVERREL} %{kslnk}
937 if [ -L /usr/src/%{kslnk} ]; then
938 if [ -L /usr/src/%{kslnk} -a `ls -ld /usr/src/%{kslnk} 2>/dev/null| awk '{ print $11 }'` = "linux-%{KVERREL}" ]; then
939 [ $1 = 0 ] && rm -f /usr/src/%{kslnk}
944 %preun -n lustre-lite-utils
945 if [ $1 = 0 -a -f /etc/init.d/lustre ]; then
946 /sbin/chkconfig --del lustre
947 /sbin/chkconfig --del lustrefs
955 %files -f kernel.files
959 %files smp -f kernelsmp.files
963 %files bigsmp -f kernelbigsmp.files
966 %if %{buildpseries64}
967 %files pseries64 -f kernelpseries64.files
971 %files bigmem -f kernelbigmem.files
975 %files BOOT -f kernelBOOT.files
979 %files source -f kernel-source.files