Sophie

Sophie

distrib > Mandriva > 10.0-com > i586 > by-pkgid > 97aeb04ea84f0abf9964485b9490642d > files > 10

kernel-multimedia-2.4.22.21mm.2mdk-1-1mdk.src.rpm

# -*- Mode: rpm-spec -*-
# 	$Id: kernel-2.4.spec,v 1.1 2001/09/25 08:55:44 chmou Exp chmou $

# First: Get versions names right is complicated (tm)
# Second: kernel allways have the version & release number in the name
#         this is done to preserving a working kernel when you install 
#         a new one
# Stored in %rpmrversion & %rpmrelease
#
# We want to reflect in the kernel naming:
#   - vanilla kernel in with is based (ex. 2.4.21) 
#     this version is stored in %realversion
#   - Number of Mandrake kernel based on this vanilla kernel (ex. 2mdk).
#     stored in %mdkrelease.
#    
# That gives us a nice name: 2.4.21.2mdk
# 
# As version and release are allways fixed, name of the package is 
# going to be:
#        kernel-2.4.21.2mdk-1-1mdk
#
# Confused already?
#
# Now there arrive pre/rc kernels.  This kernels have the particularity
# that they have the name of the new kernel, but they are based in the
# tar file of the old kernel, i.e. names are basically:
#  - vanilla kernel: 2.4.21
#  - patch name: 2.4.22-pre3
#    stored in %use_patch
#  - Number of Mandrake kernel based in this pre kernel 2mdk
#
# That gives us a nice name again: 2.4.22.pre3.2mdk
# Problems now are:
#   - sublevel of vanilla kernel 21 (needed for tar file)
#   - sublevel of kernel is 22 (needed for prepatch and naming 
#     the package).
# This explains the need of %tar_version, because this will be different
# of %real_version if there is a pre/rc patch.
# 
# Still with me?
# 
# There are still a problem, when real 2.4.22 cames out, it will have
# a mane like: 
#              2.4.22.1mdk
# this name is (for rpm ordering of versions) smaller than:
#              2.4.22.pre3.2mdk
# to fix that we add a 0 to the name (and appear the need of realrelease)
# in the pre/rc
# 	       2.4.22.0.pre3.2mdk
#
# Take one aspirine.  Relax.
#
# Problem now is that names are just really ugly, and specially
# lilo/grub names are very difficult to read/type.
# Notice that the extra .0 is there only to make visual comparations 
# easy, but it is an annoyance.
#
# Lilo name for this kernel will be:
#       2422-0.pre3.2mdk
# And as everybody knows, putting dot's in lilo names is not nice.
# Then we change the kernel name (for loaders, and directory names only)
# to a more userfriendly:
# 		2.4.22pre3-2mdk
# That way, smp, enterprise versions continue to have the well known names
# in the loader of:
#		2422pre3-2smp
#
# For a non pre/rc kernel define (real examples in brakets)
#     2.4.X.Ymdk [2.4.22.2mdk]
# where
#	%sublvel = X 	[22]
#   	%mdkrelease = Y [2]
#	%use_patch 0	[0]
#
# For a pre/rc kernel do:
#	2.4.X.0.Y.Zmdk [2.4.22.0.pre3.2mdk]
# where
#	%sublvel = X 	[22]
#   	%mdkrelease = Z [2]
#	%use_patch Y	[pre3]
#
# I hope this is all clear now. If you have any doubt, please mail me at:
#
# Juan Quintela <quintela@mandrakesoft.com>
#
####
# Basically the multimedia kernel follows the same naming scheme. In addition,
# before the mdkrelease version an extra multimedia version number is appended
#
# Danny Tholen <obiwan@mailmij.org>
###

%define sublevel 22
%define mdkrelease 21
%define use_patch 0
%define mmver 2

# You shouldn't have to change any kernel/patch/version number
# for 2.4 kernels

# When we are using a pre/rc patch, the tarboll is a sublevel -1
%if %use_patch
%define tar_version 2.4.%(expr %sublevel - 1)
%define patchversion %{use_patch}q%{mdkrelease}
%define realrelease %{mdkrelease}mm.0.%{mmver}mdk
%else
%define tar_version 2.4.%sublevel
%define patchversion q%{mdkrelease}.tmb2
%define realrelease %{mdkrelease}mm.%{mmver}mdk
%endif

# never touch the folowing two fields
%define rpmversion 1
%define rpmrelease 1mdk
%define realversion 2.4.%{sublevel}
%define mdkversion %{realversion}.%{realrelease}
%define patches_ver 2.4.%{sublevel}-%{patchversion}

#The name
%define mm_name kernel-multimedia

# having different top level names for packges means
# that you have to remove them by hard :(
%define top_dir_name %{mm_name}-2.4

%define build_dir ${RPM_BUILD_DIR}/%top_dir_name

%define src_dir %{build_dir}/linux-%tar_version
%define KVERREL %{realversion}-%{realrelease}

#dt: up is for testing only (it disables preempt+lowlat), rhconfig 
#is patched to substitute up with preempt and smp with preempt
#smp, so module building with up will have problems!!!
%define build_up 0
%define build_smp 1
%define build_preempt 1
# this is the config that contains all the drivers for the hardware/
# things that I use (Juan Quintela).
%define build_minimal 0
%define build_acpi 1

%define build_kheaders 0
%define build_debug 0
%define build_source 1
#dt: special docs needed?
%define build_doc 0

%define build_92 %(if [ `awk '{print $4}' /etc/mandrake-release` = 9.2];then echo 1; else echo 0; fi)
%define build_91 %(if [ `awk '{print $4}' /etc/mandrake-release` = 9.1];then echo 1; else echo 0; fi)

%{?_without_up: %global build_up 0}
%{?_without_smp: %global build_smp 0}
%{?_without_preempt: %global build_preempt 0}
%{?_without_minimal: %global build_minimal 0}
%{?_without_debug: %global build_debug 0}
%{?_without_doc: %global build_doc 0}
%{?_without_source: %global build_source 0}

%{?_with_up: %global build_up 1}
%{?_with_smp: %global build_smp 1}
%{?_with_preempt: %global build_preempt 1}
%{?_with_minimal: %global build_minimal 1}
%{?_with_debug: %global build_debug 1}
%{?_with_doc: %global build_doc 1}
%{?_with_source: %global build_source 1}

%{?_with_91: %global build_91 1}
%{?_with_92: %global build_92 1}

%define build_modules_description 1

%define kmake %make
# there are places where parallel make don't work
%define smake make

# Aliases for amd64 builds (better make source links?)
%define target_cpu	%(echo %{_target_cpu} | sed -e "s/amd64/x86_64/")
%define target_arch	%(echo %{_arch} | sed -e "s/amd64/x86_64/")

#
# kernel-multimedia: the preempt/lowlat/setpcap kernel
#
Summary: A preemptible Linux kernel, which reduces the latency of the kernel.
Name: %{mm_name}-%{mdkversion}
Version: %{rpmversion}
Release: %{rpmrelease}
License: GPL
Group: System/Kernel and hardware

#someday I should make a ppc version
ExclusiveArch: %{ix86}  
ExclusiveOS: Linux
URL: http://www.kernel.org/

####################################################################
#
# Sources
#
Source0: ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-%{tar_version}.tar.bz2
Source4: README.kernel-sources
Source5: README.Mandrake

Source15: linux-multimedia-mdkconfig.h
Source16: linux-merge-config.awk
Source17: linux-merge-modules.awk


Source100: linux-%{patches_ver}.tar.bz2

####################################################################
#
# Patches

#
# Patch0 to Patch100 are for core kernel upgrades.
#

# Pre linus patch: ftp://ftp.kernel.org/pub/linux/kernel/v2.4/testing

%if %use_patch
Patch1: patch-%realversion-%use_patch.bz2
%endif

#kernel-mm patches:
#reverse minill:
Patch99: 2.4.22.12mdk-reverse_mini_lowlat.patch.bz2

#Partly based on Con Kolivas patches:
Patch100: 2.4.22.21mdk-O1-lowlat-preempt.patch.bz2

Patch101: 2.4.21-0.pre4.1mdk.cap_setpcap.patch.bz2
#based on ck: patch-1020_RL2_   
Patch102: 2.4.22.3mdk-readlat2.patch.bz2
Patch103: 2.4.22.9mdk-O1-lowlat-preempt-0309132043.patch.bz2
Patch104: 2.4.22.9mdk-readlat2-DT.patch.bz2

Patch109: 2.4.22-config-multimedia.patch.bz2

#extra patches:
 
#END
####################################################################

# Defines for the things that are needed for all the kernels
%define requires1 modutils >= 2.4.15-1mdk
%define requires2 mkinitrd >= 3.1.6-24mdk
%define requires3 bootloader-utils >= 1.4

%define conflicts kernel-pcmcia-cs <= 2.4.8-26mdk, iptables <= 1.2.4-1mdk, ksympoops < 2.4.9

%define kprovides kernel = %{realversion}, kernel-multimedia = %{realversion}, alsa

BuildRoot: %{_tmppath}/%{name}-%{realversion}-build
Provides: %kprovides, module-info
Autoreqprov: no
Requires: %requires1
Requires: %requires2
Requires: %requires3
BuildRequires: gcc

Conflicts: %conflicts
Obsoletes: alsa, hackkernel, adiusbadsl_kernel
Provides: alsa, hackkernel, adiusbadsl_kernel
BuildRequires: bison, perl
BuildRequires: flex zlib-devel

%description
This kernel includes patches useful for multmedia purposes like:
preemption, low-latency and the ability for processes to transfer their
capabilities. In addition the O(1) scheduler from Ingo Molnar is included.
The preemtion patches allow a task to be preempted anywhere within the kernel,
using spinlocks as markers for non-preemptibility regions. The resulting
system response is greatly increased, with measured average latencies under
1ms. Andrew Morton's low-latency patches fix the remaining points in the kernel 
that cause latency. The setpcap patch allows processes with root rights to 
transfer capabilities to non-root processes, and so making it possible for 
user processes to run with realtime priority.

#
# kernel-smp: Symmetric MultiProcessing kernel
#

%package -n %{mm_name}-smp-%{mdkversion}
Summary: A multiprocessor version of a preemptive, low-latency kernel
Group: System/Kernel and hardware
Provides: %kprovides
Requires: %requires1
Requires: %requires2
Requires: %requires3

%description -n %{mm_name}-smp-%{mdkversion}
This package includes a SMP version of the multimedia-kernel. It is
required only on machines with two or more CPUs, although it should work
fine on single-CPU boxes.
This kernel includes patches useful for multmedia purposes like:
preemption, low-latency, an O(1) scheduler and the ability for processes
with root rights to transfer capabilities to non-root processes.

#
# kernel-up:  a kernel without preempt/lowlat. For testing.
#

%package -n %{mm_name}-up-%{mdkversion}
Summary: The Linux kernel (the core of the Linux operating system).
Group: System/Kernel and hardware
Provides: %kprovides
Requires: %requires1
Requires: %requires2
Requires: %requires3

%description -n %{mm_name}-up-%{mdkversion}
The kernel package contains the Linux kernel (vmlinuz), the core of your
Mandrake Linux operating system.  The kernel handles the basic functions
of the operating system:  memory allocation, process allocation, device
input and output, etc.
non-root processess.
This kernel includes the setpcap patch and the O(1) scheduler.

%package -n %{mm_name}-source
Version: %{realversion}
Release: %{realrelease}
Requires: glibc-devel, ncurses-devel, make, gcc
Summary: The source code for the Linux kernel.
Group: Development/Kernel
Obsoletes: alsa-source
Provides: alsa-source kernel-source

%description -n %{mm_name}-source
This kernel sources package is specifically for use with the multimedia
kernel, which includes O(1)-scheduler, preemption and low-latency patches.

The kernel-source package contains the source code files for the Linux
kernel. These source files are needed to build most C programs, since
they depend on the constants defined in the source code. The source
files can also be used to build a custom kernel that is better tuned to
your particular hardware, if you are so inclined (and you know what you're
doing).


#
# End packages - here begins build stage
#
%prep
%setup -q -n %top_dir_name -c

%setup -q -n %top_dir_name -D -T -a100

%define patches_dir ../%{patches_ver}/

cd %src_dir
%if %use_patch
%patch1 -p1
%endif


%{patches_dir}/scripts/apply_patches


#dt: I keep my patches seperate
#reverse mini-ll:
%patch99 -p1 
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1

#careful, if this patch fails, building will continue!
(cd %{patches_dir}
%patch109 -p1
)

#other patches


# PATCH END
#
# Setup Begin
#

# Prepare all the variables for calling create configs

%if %build_debug
%define debug --debug
%else
%define debug --no-debug
%endif

%if %build_acpi
%define acpi --acpi
%else
%define acpi --no-acpi
%endif

%if %build_minimal
%define minimal --minimal
%else
%define minimal --no-minimal
%endif


%{patches_dir}/scripts/create_configs %debug %acpi %minimal --user_cpu="%{target_cpu}"

# make sure the kernel has the sublevel we know it has...
LC_ALL=C perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" Makefile

# get rid of unwanted files
find . -name '*~' -o -name '*.orig' -o -name '*.append' |xargs rm -f

%if %build_kheaders

kheaders_dirs=`echo $PWD/include/{asm-*,linux,sound}`

pushd %build_dir
install -d kernel-headers/
cp -a $kheaders_dirs kernel-headers/
tar cf kernel-headers-%mdkversion.tar kernel-headers/
bzip2 -9f kernel-headers-%mdkversion.tar
rm -rf kernel-headers/
# build_kheaders
%endif


%build
# Common target directories
%define _kerneldir /usr/src/linux-%{KVERREL}
%define _bootdir /boot
%define _modulesdir /lib/modules
%define _savedheaders ../../savedheaders/

# Directories definition needed for building
%define temp_root %{build_dir}/temp-root
%define temp_source %{temp_root}%{_kerneldir}
%define temp_boot %{temp_root}%{_bootdir}
%define temp_modules %{temp_root}%{_modulesdir}

DependKernel() {
	name=$1
	extension=$2
	echo "Make dep for kernel $extension"
	%smake -s mrproper

	# We can't use only defconfig anyore because we have the autoconf patch,
	if [ -z "$name" ]; then
		config_name="defconfig"
	else
		config_name="defconfig-$name"
	fi
		cp arch/%{target_arch}/$config_name .config

	# make sure EXTRAVERSION says what we want it to say
	# -%{realrelease}$ex
	LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -$extension/" Makefile

	%smake oldconfig
	%smake dep
}

BuildKernel() {
	KernelVer=$1
	echo "Building kernel $KernelVer"

	%ifarch ppc
	%kmake zImage
	%endif

	%ifarch %{ix86} x86_64
	%kmake bzImage
	%endif

	%kmake modules

	# first make sure we are not loosing any .ver files to make mrporper's
	# removal of zero sized files.
	find include/linux/modules -size 0 | while read file ; do \
		echo > $file
	done

	## Start installing stuff
	install -d %{temp_boot}
	install -m 644 System.map %{temp_boot}/System.map-$KernelVer
	install -m 644 .config %{temp_boot}/config-$KernelVer

	%ifarch ppc
	cp -f vmlinux %{temp_boot}/vmlinuz-$KernelVer
	cp -f arch/ppc/boot/images/zImage.chrp-rs6k %{temp_boot}/vmlinuz-rs6k-$KernelVer

	%endif
	%ifarch %{ix86}
	cp -f arch/i386/boot/bzImage %{temp_boot}/vmlinuz-$KernelVer
	%endif
	%ifarch x86_64
	cp -f arch/x86_64/boot/bzImage %{temp_boot}/vmlinuz-$KernelVer
	%endif

	# modules
	install -d %{temp_modules}/$KernelVer
	%smake INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=$KernelVer modules_install 
}

SaveHeaders() {
	flavour=$1
%if %build_source
	HeadersRoot=%{temp_source}/savedheaders
	HeadersArch=$HeadersRoot/%{target_cpu}/$flavour
	echo "Saving hearders for $flavour %{target_cpu}"

	# deal with the kernel headers that are version specific
	install -d $HeadersArch
	install -m 644 include/linux/autoconf.h $HeadersArch/autoconf.h
	install -m 644 include/linux/version.h $HeadersArch/version.h
	mv include/linux/modules $HeadersArch
    	echo "%{target_cpu} $flavour %{_savedheaders}%{target_cpu}/$flavour/" >> $HeadersRoot/list
%endif
}

CreateFiles() {
	kversion=$1
	output=../kernel_files.$kversion

	echo "%defattr(-,root,root)" > $output
	echo "%{_bootdir}/config-${kversion}" >> $output
	echo "%{_bootdir}/vmlinuz-${kversion}" >> $output
%ifarch ppc
	echo "%{_bootdir}/vmlinuz-rs6k-${kversion}" >> $output
%endif
	echo "%{_bootdir}/System.map-${kversion}" >> $output
	echo "%dir %{_modulesdir}/${kversion}/" >> $output
	echo "%{_modulesdir}/${kversion}/kernel" >> $output
	echo "%{_modulesdir}/${kversion}/modules.*" >> $output
	echo "%doc README.kernel-sources" >> $output
	echo "%doc README.Mandrake" >> $output
}


CreateKernel() {
	flavour=$1
	case $flavour in
	preempt)
		KernelVer=%{KVERREL}
		DependKernel $flavour %{realrelease}
		;;
	preemptsmp)
		KernelVer=%{KVERREL}smp
		DependKernel $flavour %{realrelease}smp
		;;
	*)
		KernelVer=%{KVERREL}$flavour
		DependKernel $flavour %{realrelease}$flavour
		;;
	esac

	BuildKernel $KernelVer
	if [[ "$flavour" != BOOT ]];then	
		SaveHeaders $flavour
	fi
	CreateFiles $KernelVer
}

CreateKernelNoName() {
	arch=$1
	nprocs=$2
	memory=$3

	name=$arch-$nprocs-$memory
	extension="%realrelease-$name"

	KernelVer="%{KVERREL}-$arch-$nprocs-$memory"
	DependKernel $name $extension
	BuildKernel $KernelVer
	SaveHeaders $name
	CreateFiles $KernelVer
}


###
# DO it...
###

# Create a simulacro of %buildroot
rm -rf %{temp_root}
install -d %{temp_root}

#make sure we are in the directory
cd %src_dir

%if %build_smp
CreateKernel preemptsmp
%endif

%if %build_preempt
CreateKernel preempt
%endif

#up is currently for testing only,it disables preempt+lowlat 
%if %build_up
CreateKernel up
%endif

# We don't make to repeat the depend code at the install phase
%if %build_source
DependKernel "" %{realrelease}custom
%endif

###
### install
###
%install
install -m 644 %{SOURCE4}  .
install -m 644 %{SOURCE5}  .

cd %src_dir
# Directories definition needed for installing
%define target_source %{buildroot}/%{_kerneldir}
%define target_boot %{buildroot}%{_bootdir}
%define target_modules %{buildroot}%{_modulesdir}

# We want to be able to test several times the install part
rm -rf %{buildroot}
cp -a %{temp_root} %{buildroot}

# Create directories infastructure
%if %build_source
install -d %{target_source} 

tar cf - . | tar xf - -C %{target_source}
ln -sf linux-%{KVERREL} %{buildroot}/usr/src/linux

# we remove all the source files that we don't ship

# first architecture files
for i in arm cris mips mips64 parisc ppc64 s390 s390x sh sh64 sparc sparc64; do
	rm -rf %{target_source}/arch/$i
	rm -rf %{target_source}/include/asm-$i
done
# ppc needs m68k headers
rm -rf %{target_source}/arch/m68k

# my patches dir, this should go in other dir
rm -rf %{target_source}/%{patches_ver}

# other misc files
rm -f %{target_source}/{.config.old,.depend,.hdepend}

# We need this to prevent someone doing a make *config without mrproper
touch %{target_source}/.need_mrproper

# We used to have a copy of DependKernel here
# Now, we make sure that the thing in the linux dir is what we want it to be

# We need to fix the patchs in .*depend files  after we fix the paths
find %{target_source} -name ".*depend" | \
while read file ; do
    mv $file $file.old
    sed -e "s|[^ ]*\(/usr/src/linux\)|\1|g" < $file.old > $file
    rm -f $file.old
done

# Try to put some smarter autoconf.h and version.h and modversions.h files in place
pushd %{target_source}/include/linux ; {
install -m 644 %{SOURCE15} rhconfig.h
rm -rf modules modversions.h autoconf.h version.h
# create modversions.h
cat > modversions.h <<EOF
#ifndef _LINUX_MODVERSIONS_H
#define _LINUX_MODVERSIONS_H
#include <linux/rhconfig.h>
#include <linux/modsetver.h>
EOF
list=`find %{_savedheaders}*/*/modules/*.ver -exec basename '{}' \; | sort -u`
mkdir modules
for l in $list; do
    sed 's,$,modules/'$l, %{_savedheaders}list | awk -f %{SOURCE17} > modules/$l
    touch -r modules/$l modules/`basename $l .ver`.stamp
    echo '#include <linux/modules/'$l'>' >> modversions.h
done
echo '#endif /* _LINUX_MODVERSIONS_H */' >> modversions.h
# Create autoconf.h file
echo '#include <linux/rhconfig.h>' > autoconf.h
sed 's,$,autoconf.h,' %{_savedheaders}list | awk -f %{SOURCE16} >> autoconf.h
# Create version.h
echo "#include <linux/rhconfig.h>" >> version.h
loop_cnt=0
#would be better to get rid of preempt here....:
for i in preemptsmp preempt up ; do
	if [ -d %{_savedheaders}%{target_cpu}/$i -a \
	     -f %{_savedheaders}%{target_cpu}/$i/version.h ]; then
		if [ $loop_cnt = 0 ]; then
      			buf="#if defined(__module__$i)"
      			previous_i="$i"
      			loop_cnt=1
    		else
      			echo "$buf" >> version.h
      			grep UTS_RELEASE %{_savedheaders}%{target_cpu}/${previous_i}/version.h >> version.h
 	     		buf="#elif defined(__module__$i)"
      			previous_i="$i"
      			loop_cnt=`expr $loop_cnt + 1`
    		fi
    fi
done
#write last lines
if [ $loop_cnt -eq 0 ]; then
	echo "You need to build at least one kernel"
	exit 1;
fi

if [ $loop_cnt -gt 1 ]; then
	echo "#else" >> version.h
fi

grep UTS_RELEASE %{_savedheaders}%{target_cpu}/${previous_i}/version.h >> version.h

if [ $loop_cnt -gt 1 ]; then
	echo "#endif" >> version.h
fi

# Any of the version.h are ok, as they only differ in the first line
ls %{_savedheaders}%{target_cpu}/*/version.h | head -n 1 | xargs grep -v UTS_RELEASE >> version.h
rm -rf %{_savedheaders}
} ; popd
#endif build_source
%endif
# Gzip module and relink the link to a .gz module
find %{target_modules} -type f -name '*.o'|xargs gzip -9f
for i in $(find %{target_modules} -type l -name '*.o');do
    link=$(LC_ALL=C perl -e 'print readlink shift, "\n"' $i)
    ln -s $link.gz $i.gz
    rm -f $i
done

for i in %{target_modules}/*; do
  rm -f $i/build $i/modules.*
done

# sniff, if we gzipped all the modules, we change the stamp :(
# we really need the depmod -ae here

pushd %{target_modules}
for i in *; do
	/sbin/depmod -u -ae -b %{buildroot} -r -F %{target_boot}/System.map-$i $i
	echo $?
done

for i in *; do
	pushd $i
	echo "Creating module.description for $i"
	modules=`find . -name "*.o" -o -name "*.o.gz"`
	/sbin/modinfo -f '%{filename} %{description}\n' $modules \
	| perl -lne 'print "$1\t$3" if m|([^/]*)\.o(\.gz)? "(.*)"|'  > modules.description
	popd
done

popd

export EXCLUDE_FROM_STRIP="vmlinuz-rs6k-%{KVERREL} vmlinuz-rs6k-%{KVERREL}smp vmlinuz-rs6k-%{KVERREL}enterprise vmlinuz-rs6k-%{KVERREL}BOOT"

###
### clean
###

%clean
rm -rf %{buildroot}
# We don't want to remove this, the whole reason of its existence is to be 
# able to do several rpm --short-circuit -bi for testing install 
# phase without repeating compilation phase
#rm -rf %{temp_root} 

###
### scripts
###

%preun
/sbin/installkernel -a -R -S -c %{KVERREL}
exit 0

%post
#do not link!!:
/sbin/installkernel -a -L -s -c %{KVERREL}

%postun
/sbin/kernel_remove_initrd %{KVERREL}
exit 0

%preun -n %{mm_name}-smp-%{mdkversion}
/sbin/installkernel -a -R -S -c %{KVERREL}smp
exit 0

%post -n %{mm_name}-smp-%{mdkversion}
#do not link!!:
/sbin/installkernel -a -L -s -c %{KVERREL}smp
exit 0

%postun -n %{mm_name}-smp-%{mdkversion}
/sbin/kernel_remove_initrd %{KVERREL}smp

%preun -n %{mm_name}-up-%{mdkversion}
/sbin/installkernel -a -R -S -c %{KVERREL}up
exit 0

%post -n %{mm_name}-up-%{mdkversion}
#do not link!!:
/sbin/installkernel -a -L -s -c %{KVERREL}up
exit 0

%postun -n %{mm_name}-up-%{mdkversion}
/sbin/kernel_remove_initrd %{KVERREL}up

%post -n %{mm_name}-source
cd /usr/src
rm -f linux
ln -snf linux-%{KVERREL} linux
/sbin/service kheader start 2>/dev/null >/dev/null || :
# we need to create /build only when there is a source tree.

for i in /lib/modules/${KVERREL}*; do
	if [ -d $i ]; then
		ln -sf /usr/src/linux-%{KVERREL} $i/build
	fi
done

%postun -n %{mm_name}-source
if [ -L /usr/src/linux ]; then 
	if [ -L /usr/src/linux -a `ls -l /usr/src/linux 2>/dev/null| awk '{ print $11 }'` = "linux-%{KVERREL}" ]; then
	[ $1 = 0 ] && rm -f /usr/src/linux
	fi
fi
# we need to delete <modules>/build at unsinstall
for i in /lib/modules/${KVERREL}*/build; do
	if [ -L $i ]; then
		rm -f $i
	fi
done
exit 0

###
### file lists
###

%if %build_up
%files -n kernel-up-%{mdkversion} -f kernel_files.%{KVERREL}up
%endif

%if %build_smp
%files -n %{mm_name}-smp-%{mdkversion} -f kernel_files.%{KVERREL}smp
%endif

%if %build_preempt
%files -n %{mm_name}-%{mdkversion} -f kernel_files.%{KVERREL}
%endif

%if %build_source
%files -n %{mm_name}-source
%defattr(-,root,root)
%dir %{_kerneldir}
%dir %{_kerneldir}/arch
%dir %{_kerneldir}/include
%{_kerneldir}/.config
%{_kerneldir}/.need_mrproper
%{_kerneldir}/COPYING
%{_kerneldir}/CREDITS
%{_kerneldir}/Documentation
%{_kerneldir}/MAINTAINERS
%{_kerneldir}/Makefile
%{_kerneldir}/README
%{_kerneldir}/REPORTING-BUGS
%{_kerneldir}/Rules.make
%{_kerneldir}/arch/alpha
%{_kerneldir}/arch/i386
%{_kerneldir}/arch/ia64
%{_kerneldir}/arch/ppc
%{_kerneldir}/arch/x86_64
%{_kerneldir}/crypto
%{_kerneldir}/drivers
%{_kerneldir}/fs
%{_kerneldir}/init
%{_kerneldir}/ipc
%{_kerneldir}/kdb
%{_kerneldir}/kernel
%{_kerneldir}/lib
%{_kerneldir}/mm
%{_kerneldir}/net
%{_kerneldir}/scripts
%{_kerneldir}/sound
%{_kerneldir}/3rdparty
%{_kerneldir}/grsecurity
%{_kerneldir}/include/acpi
%{_kerneldir}/include/asm-alpha
%{_kerneldir}/include/asm-generic
%{_kerneldir}/include/asm-i386
%{_kerneldir}/include/asm-ia64
# That is needed by ppc
%{_kerneldir}/include/asm-m68k
%{_kerneldir}/include/asm-ppc
%{_kerneldir}/include/asm-x86_64
%{_kerneldir}/include/asm
%{_kerneldir}/include/linux
%{_kerneldir}/include/math-emu
%{_kerneldir}/include/net
%{_kerneldir}/include/pcmcia
%{_kerneldir}/include/scsi
%{_kerneldir}/include/sound
%{_kerneldir}/include/video
%doc README.kernel-sources
%doc README.Mandrake
#endif %build_source
%endif

#%files -n kernel-doc
#%defattr(-,root,root)
#%doc linux-%{tar_version}/Documentation/*

%changelog
* Fri Oct 31 2003 Danny Tholen <obiwan@mailmij.org> 2.4.22.21.2mm-mdk
- sync with 21.2tmb 
- remove dc2xx patch (in tmb now)
 
* Tue Oct 28 2003 Danny Tholen <obiwan@mailmij.org> 2.4.22.21.1mm-mdk
- sync with 21.1tmb (fix LG cdroms)

* Mon Sep 29 2003 Danny Tholen <obiwan@mailmij.org> 2.4.22.12.1mm-mdk
- fix some descriptions
- fix changelog again
- sync with 12.1tmb

* Mon Sep 28 2003 Danny Tholen <obiwan@mailmij.org> 2.4.22.10.2mm-mdk
- sync with 10.4tmb
- uncorrect changelog (don't ask)
- 10.1mm-mdk:
  = correct changelog versioning
  = provide kernel-source
  = really fix lowlat (Duane)

* Tue Sep 15 2003 Danny Tholen <obiwan@mailmij.org> 2.4.22.9.1mm-mdk
- sync with latest kernel
- update interactivity to latest from Con
- add desktop tuning for reatlat2 (ck)
- fix for alsa usb m-audio (tmb)

* Wed Sep 10 2003 Danny Tholen <obiwan@mailmij.org> 2.4.22.6.1mm-mdk
- sync with latest main kernel 
- redo ll_o1_pre patch based on ck 083003
- redo readlatency2 patch (ck093003)
- redo config patch because of main kernel change (I hate perl)
- smp/highmem version is i686 now (should i call it enterprise?)
- disable small part of lowlat due to panic on boot (Duane Voth)
- change versioning scheme

* Wed Aug 08 2003 Danny Tholen <obiwan@mailmij.org> 2.4.21.6.1mm-mdk
- sync with tmb kernel
- include O(1) scheduler (mainly from Con Kolivas patches)
- include readlatency2 (CK)
- merge O1, lowlat and preempt into one patch
- use extra number for naming

* Wed Apr 30 2003 Danny Tholen <obiwan@mailmij.org> 2.4.21.0.19mdk
- smp kernel now has highmem support
- bugfixes for via-rhine and firewire  (Thomas Backlund)
- ide-corruption fix (lkml)
- ide-scsi fix (lkml)
- supermount 1.2.4 (Andrey Borzenkov)

* Sun Apr 06 2003 Danny Tholen <obiwan@mailmij.org> 2.4.21.0.18mdk
- sync with 14mdk (audigy2/dmiscan patch removed)
- supermount 1.2.1 (Andrey Borzenkov)
- fix ppa cable warnings and ldm_validate_partition (Andrey)
- fix broken orinoco (Thomas Backlund)
- update pci.ids (Thomas)
- add vesafb vram option (Thomas)
- set PDC202XX to y

* Wed Mar 26 2003 Danny Tholen <obiwan@mailmij.org> 2.4.21.0.17mdk
- supermount fixes
- resync again with 2nd official 13mdk
- also rebuild for 9.0

* Thu Mar 13 2003 Danny Tholen <obiwan@mailmij.org> 2.4.21.0.16mdk
- supermount 1.1.1 (a great job, by Andrey Borzenkov)
- small snd-emu10k1 patch
- dmi_scan fixes (Thomas Backlund)
- custom config should now have patches enabled

* Fri Mar 8 2003 Danny Tholen <obiwan@mailmij.org> 2.4.21.0.15mdk
- update audigy code
- sync with main kernel 2.4.21.0.13mdk

* Thu Mar 6 2003 Danny Tholen <obiwan@mailmij.org> 2.4.21.0.14mdk
- I screwed up. preempt/lowlat/setpcap should now be active again.
- sync with main kernel 2.4.21.0.12mdk

* Tue Mar 04 2003 Danny Tholen <obiwan@mailmij.org> 2.4.21.0.13mdk
- drop preempt tag, it only gave problems, we are now called mm-mdk!
- change descriptions.
- small change to source15 (__module_preempt)
- fix ntfs+drakfont issue

* Sun Mar 02 2003 Danny Tholen <obiwan@mailmij.org> 2.4.21.0.12mdk
- spec and patch fixes for preemptsmp
- supermount patch from andrey
- add provides
- rediff config patch

* Fri Feb 28 2003 Danny Tholen <obiwan@mailmij.org> 2.4.21.0.11mdk
- merged with latest kernel in main
- build smp version

* Mon Feb 17 2003 Danny Tholen <obiwan@mailmij.org> 2.4.21-0.pre4.6mdk
- Changed all names to kernel-multimedia (better name welcome)
- remove things from spec I do not see usefull in future
- remove old kernel changelog

* Mon Feb 17 2003 Danny Tholen <obiwan@mailmij.org> 1-1mdk
- Add lowlatency patch (modified from chmouels one)
- Add preempt patch
- Capabilities patch
- updated configs patch