Sophie

Sophie

distrib > Mandriva > 10.0 > i586 > by-pkgid > 276c4c69ed5efcebe43ee6121194cf59 > files > 84

kernel22-2.2.20-9mdk.src.rpm

# -*- Mode: rpm-spec -*-
# 	$Id$	

%define srcversion 2.2.20
%define sublevel 20
%define kversion 2.2.20
%define krelease 9mdk
%define KVERREL %{kversion}-%{krelease}

%define boot 0
%define reiserfs 1

%define pcmciaver 3.1.24
%define ksymoopsver 2.3.5
%define alsaver 0.5.11
%define reiserfsver 3.5.29

%define ipsecver 1.8
%define ibcsver 2.1-981105
%define ipvsver 1.0.6

%define build_boot 0

%ifarch %{ix86} ppc
%define build_pcmcia 1
%else
%define build_pcmcia 0
%endif

%ifarch %{ix86} ppc
%define build_alsa 1
%else
%define build_alsa 0
%endif

%ifarch %{ix86} ppc
%define build_ipsec 1
%else
%define build_ipsec 0
%endif

%ifarch ppc
%define kgcc gcc
%else
%define kgcc kgcc
%endif

Summary: The Linux kernel (the core of the Linux operating system).
Name: kernel22
Version: %{kversion}
Release: %{krelease}
License: GPL
URL:	 http://www.kernel.org/pub/linux/kernel/v2.2/
Group: System/Kernel and hardware
ExclusiveArch: %{ix86} alpha sparc sparc64 ppc
ExclusiveOS: Linux

####################################################################
#
# Sources
#
Source0: ftp://ftp.kernel.org/pub/linux/kernel/v2.2/linux-%{srcversion}.tar.bz2
Source1: /anonymous@projects.sourceforge.net:/pub/pcmcia-cs/pcmcia-cs-%{pcmciaver}.tar.bz2
Source4: README.kernel-sources
Source5: /anonymous@ftp.kernel.org:/pub/linux/utils/kernel/ksymoops/v2.3/ksymoops-%{ksymoopsver}.tar.bz2
Source7: ftp://ftp.alsa-project.org/pub/driver/alsa-driver-%{alsaver}.tar.bz2
Source8: ftp://ftp.xs4all.nl/pub/crypto/freeswan/freeswan-%{ipsecver}.tar.bz2
Source9: ftp://tsx-11.mit.edu/pub/linux/BETA/ibcs2/ibcs-%{ibcsver}.tar.bz2

Source10: pcmcia-cs-2.8.8-network.script
Source13: rhkmvtag.c
Source14: kernel-2.2-BuildASM.sh
Source15: linux-rhconfig-22.h
Source16: linux-merge-config.awk
Source17: linux-merge-modules.awk
Source18: kernel-2.2-modulerename.script

Source20: kernel-%{kversion}-i586.config
Source21: kernel-%{kversion}-alpha.config
Source22: kernel-%{kversion}-ppc.config
Source23: linux-2.2.19-supermount-tramp.S.tar.bz2
Source24: kernel-%{kversion}-i686.config

Source26: kernel-%{kversion}-i586-BOOT.config

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

# Official patches
Patch0: ftp://ftp.kernel.org/pub/linux/kernel/people/alan/2.2/pre-patch-2.2.20-9.bz2

#### Andrea Kernels with his comment

Patch11: 00_4_min_percent-1
Patch12: 00_IO-wait-3
Patch13: 00_K7_P4-cachelines-5
Patch14: 00_P4-local-APIC-1
Patch15: 00_PIII-11.bz2
Patch16: 00_SIGIO-reason-2.bz2
Patch17: 00_SMP-scheduler-2.2.18pre21-H.bz2
Patch18: 00_VM-locked-1
Patch19: 00_VM_RESERVED-1
Patch20: 00_alpha-fp-disabled-1
Patch21: 00_alpha-illop-1
Patch22: 00_alpha-mips-rtc-1
Patch23: 00_alpha-pci-compile-1
Patch24: 00_alpha-smp_tune_scheduling-1
Patch25: 00_buf-run_task_queue.gz
Patch26: 00_delack-timer-5.gz
Patch27: 00_elv-merging-1
Patch28: 00_ide-probe-compile-1
Patch29: 00_inode-boot-dynamic-3
Patch30: 00_ipv6-source-routing-1
Patch31: 00_java-proc.gz
Patch32: 00_kupdate-interval-no-policy-in-kernel-1
Patch33: 00_kupdate-sigstop-2.2.11-1.gz
Patch34: 00_loop-merging-instead-of-async-1
Patch35: 00_mremap-waste-virtual-stack-space-1.gz
Patch36: 00_nanosleep-4.gz
Patch37: 00_notify-change-2g-ext2-1
Patch38: 00_overcommit-1.gz
Patch39: 00_parent-timeslice-loss-fix-5
Patch40: 00_poll-nfds-2
Patch41: 00_readahead-unplug-2
Patch42: 00_show-regs-x86-1
Patch43: 00_silent-stack-overflow-5.gz
Patch44: 00_tcp-syn-during-established-1
Patch45: 00_tsc-calibration-non-compile-time-1.gz
Patch46: 00_version
Patch47: 04_wake-one-4
Patch48: 05_string-io-ops-doug-1
Patch49: 10_bigmem-2.2.20pre10aa1-22.bz2
Patch50: 13_rawio-2.2.19aa2-9.bz2
Patch51: 15_lvm-0.9.1_beta4-2.2.19pre13aa1-6.bz2
Patch52: 17_lvm-consisten-snapshot-API-1
Patch53: 18_lvm-0.9.1_beta4-fix-hardsectsize-2
Patch54: 19_rawio-helper-array-1
Patch55: 30_rtclight-2.2.15pre13aa1-1.gz
Patch56: 40_lfs-2.2.20pre10aa1-28.bz2
Patch57: 47_nfsd-no_dup_disconnected_dentries-Chip-1
Patch58: 50_robust-initrd-3
Patch59: 70_cond-sched-1
Patch60: 71_copy-user-reschedule-3
Patch61: 72_copy-user-unlock-1
Patch62: 73_cksum-user-unlock-2
Patch63: 74_copy-user-unlock-alpha-2
Patch64: 75_unlock-ppc-sparc-sparc64-1
Patch65: 80_smp-locking-1
Patch66: 90_NMI-watchdog-dynamic-1
Patch67: 93_raid-2.2.18-A2_2.2.20pre2aa1-8.bz2
Patch68: 94_raidrebalance-2.2.18-A2_2.2.19pre3aa1-Mika-Kuoppala-1.bz2
Patch69: 95_GFS-00_bufcache.patch-1
Patch70: 95_GFS-01_cdb16.patch-1
Patch71: 95_GFS-02_exportscsi.patch-1
Patch72: 95_GFS-03_flock.patch-1
Patch73: 95_GFS-04_ksyms.patch-1
Patch74: 95_GFS-05_pool_name.patch-1
Patch75: 95_GFS-06_sparc64_ioctl.patch-1
Patch76: 95_GFS-07_stomith_x10_cm11a.patch-1
Patch77: 95_GFS-08_task.patch-1
Patch78: 95_GFS-09_generic_map.patch-4
Patch79: 95_GFS-10_pipe-fix-and-gfs-soft-inode-1
Patch80: 95_GFS-11_hard_panic.patch-1.bz2
Patch81: 95_GFS-12_opaque-inode-2.bz2

#### Vendor patches
# Reiserfs: http://namesys.com/
#Patch100: linux-2.2.19-reiserfs-%{reiserfsver}.patch.bz2
Patch100: linux-2.2.18-reiserfs-%{reiserfsver}.patch.bz2

# Fix reiserfs with lfs.
#Patch101: linux-2.2.19-reiserfs-lfs-fixes.patch.bz2
Patch101: linux-2.2.18-reiserfs-lfs-fixes.patch.bz2

# reiserfs has a slightly longer tq_scheduler function to do the slow
# part of the end_io handler. Some kernel subsystems enter the
# scheduler inside __cli() and it does no good to execute the reiserfs
# task queue function with interrupts off (causing the stuck on TLB
# IPI wait messages)
Patch102: linux-2.2.19-reiserfs-sti.patch.bz2

# When we are in --force don't ask questions.
Patch103: linux-2.2.19-reiserfs-force.patch.bz2

# Reformat the television show.
Patch104: linux-2.2.19-reiserfs-format-banner.patch.bz2

# IPSEC: add config generated with make patches from the freeswan sources
Patch105: linux-2.2.19-ipsec-config-1.8.patch.bz2

# s|DEBUG_IPSEC|CONFIG_DEBUG_IPSEC|; to be in the Configure
Patch106: linux-2.2.19-ipsec-config-debug.patch.bz2

# Fix include with the symlinks mess
Patch107: linux-2.2.19-fix-ipsec-include.patch.bz2

# Upgrade ide subsystem: ftp.kernel.org/pub/linux/kernel/people/hedrick/
#Patch110: linux-2.2.19-ide.patch.bz2
Patch110: linux-2.2.19-ide-new-ac9.patch.bz2

# Add Adapter RAID controller support (from: http://domsch.com/linux/)
Patch111: linux-2.2.19-aacraid-1.0.3.patch.bz2

# Upgrade to version 1.0.4 of aacraid driver
Patch112: linux-2.2.19-aacraid-1.0.4.patch.bz2

# Upgrade to version 1.0.5 of aacraid driver
Patch113: linux-2.2.19-aacraid-1.0.5.patch.bz2

# Upgrade to version 1.0.6 of aacraid driver
Patch114: linux-2.2.19-aacraid-1.0.6.patch.bz2

# Upgrade to version 1.0.6 of aacraid driver
Patch116: linux-2.2.19-aacraid-1.0.7.patch.bz2

# Fixes includes path of AACRAID driver
Patch115: linux-2.2.19-aacraid-1.0.6-path.patch.bz2

# Patch for Final Relase
Patch117: linux-2.2.19-aacraid-1.0.7.PERCID.patch.bz2

# IBCS config to build it
Patch120: linux-2.2.19-ibcs-config.patch.bz2

# Add locking to ibcs 
Patch121: linux-2.2.19-ibcs-locking.patch.bz2

# Make IBCS lfs compatible: from andrea ftp://ftp.kernel.org/pub/linux/kernel/people/andrea/patches/v2.2/2.2.17pre20aa1/
Patch122: linux-2.2.19-ibcs-2.1-981105-LFS.patch.bz2

# IPVS: http://www.linuxvirtualserver.org
Patch123: linux-2.2.19-ipvs-%{ipvsver}.patch.bz2

# Allow VPN with Masquerading: http://www.impsec.org/linux/masquerade/ip_masq_vpn.html
#Patch124: linux-2.2.19-ip_masq_vpn.patch.bz2

# CIPE - encrypted IP over UDP tunneling
Patch130: linux-2.2.19-cipe.patch.bz2

# Add sysrq on serial
Patch131: linux-2.2.19-serial-sysrq.patch.bz2

# Add support for EtherExpressPro/1000 support
Patch132: linux-2.2.19-e1000.patch.bz2

# Add 8280 eepro100 familly support
Patch154: linux-2.2.19-eepro100-add-82820-card.patch.bz2

# Make eepro100 use io
Patch133: linux-2.2.19-eepro-useio.patch.bz2

# Intel driver of EtherExpressPro/100 support.
Patch134: linux-2.2.19-e100.patch.bz2

# Fix compile of e100 with 2.2.19.
Patch142: linux-2.2.19-ee100-fixcompile.patch.bz2

# Add support for Qlogic QLA 1280/12160 SCSI support
Patch135: linux-2.2.19-qlc.patch.bz2

# Add UDF file system support: http://linux-udf.sourceforge.net/
Patch136: linux-2.2.19-udf-0.9.3.patch.bz2

# Make udf compile with lfs.
Patch143: linux-2.2.19-udf-lfs.patch.bz2

# Make the Mandrake Logo as default logo - new version
#Patch137: linux-2.2.19-linux-mandrake-logo.patch.bz2
Patch137: linux-2.2.20-linux-mandrake-logo.patch.bz2

# Increase the maximu NR_FILE to 8192
Patch138: linux-2.2.19-increase-NR_FILE-limit.patch.bz2

# Add the -a option to the mdk installkernel
Patch139: linux-2.2.19-mdk-installkernel-a.patch.bz2

# Add IRDA updates: http://irda.sourceforge.net/
Patch140: linux-2.2.19-irda-update.patch.bz2

# Make the symbol with having a _ prefix
Patch141: linux-2.2.19-ksym-version.patch.bz2

# Maximise the default max loop to 16
Patch144: linux-2.2.19-max-loop-to-16.patch.bz2

# Make the maximum array for scsci defined to 40 for every scsi adapter
Patch145: linux-2.2.19-extradevs.patch.bz2

# Allow to send a SIGTERM to the nfs lockd server
Patch146: linux-2.2.19-allow-sigterm-for-nfs.patch.bz2

# Add i815 support
Patch147: linux-2.2.19-i815-support.patch.bz2

# The Linux kernel does only allow for 128 AppleTalk sockets as per some
# old spec that the low port numbers should be reserved. The only well
# known ports that are used in AppleTalk without name binding are up to
# port number 6, the zone information socket. The attached patch changes
# the algorithm to allocate AppleTalk ports from the high maximum port
# number to the lower numbers, changing the reserved to 7 instead of 128.
# This allows the use of more sockets if really needed while still not
# using the low port numbers until 128 ports have been allocated.
Patch148: linux-2.2.19-atalkports.patch.bz2

# Increase multilun to 64 (max)
Patch149: linux-2.2.19-multilun.patch.bz2

# Make higher the default options for server
Patch150: linux-2.2.19-server-tunning.patch.bz2

# Install the manpages of ksymoops as fhs want
Patch151: linux-2.2.19-ksymoops-fhs.patch.bz2

# Supermount support: http://www.geocities.com/alexismikhailov/
# NB: Modifed the patch to make it lfs compatible.
Patch152: linux-2.2.19-supermount-0.1.5-lfs.patch.bz2

# Supermount fixes: Make some printk go to log, allow eject from the
# eject command even if the cdrom is mounted.
Patch153: linux-2.2.19-supermount-0.1.5-fixes.patch.bz2

# ATP updates: http://www.scyld.com/network/atp.html
Patch160: linux-2.2.19-atp-update.patch.bz2

# PCI-Scan support from ftp://ftp.scyld.com/pub/network/
# Needed for new network drivers.
Patch161: linux-2.2.19-pci-scan.patch.bz2

# Tulip Update: http://www.scyld.com/network/tulip.html
#Patch162: linux-2.2.19-tulip-update.patch.bz2
Patch162: linux-2.2.20pre-tulip-update.patch.bz2
Patch163: linux-2.2.19-tulip-compile.patch.bz2

# Via-Rhine Update: http://www.scyld.com/network/ethercard.html
# it is up-to-date in the kernel now
#Patch164: linux-2.2.19-via-rhine-update.patch.bz2
#Patch165: linux-2.2.19-via-rhine-compile.patch.bz2

# RTL8139 Update:
Patch166: linux-2.2.19-rtl8139-update.patch.bz2
Patch167: linux-2.2.19-rtl8139-compile.patch.bz2

#Add driver of 3c90x (alternate to 3c59x): http://support.3com.com/infodeli/tools/nic/linuxdownload.htm
Patch168: linux-2.2.19-3c90x.patch.bz2

# Add i2c from: http://www2.lm-sensors.nu/~lm78/
#Patch170: linux-2.2.19-i2c-2.5.4.patch.bz2
Patch170: linux-2.2.20pre-i2c-2.5.4.patch.bz2

# Add lm_sensors: http://www2.lm-sensors.nu/~lm78/
Patch171: linux-2.2.19-lm_sensors-2.5.4.patch.bz2

# BTTV updates: http://www.strusel007.de/linux/bttv/
#Patch172: linux-2.2.19-bttv-0.7.50.patch.bz2
Patch172: linux-2.2.19-bttv-0.7.60.patch.bz2

# Firewire devices support: http://download.sourceforge.net/linux1394/
#Patch180: linux-2.2.19-ieee1394-update-20001223.patch.bz2
Patch180: linux-2.2.19-ieee1394-update-20010228.patch.bz2

# Add maestro3 driver: http://www.zabbo.net/maestro3/
#Patch183: linux-2.2.19-maestro3-0.51.patch.bz2
# Updtae maestro driver: http://www.zabbo.net/maestro/
#Patch184: linux-2.2.19-maestro-mega1.patch.bz2
# Historically that was the only way of preventing the .modinfo section
# from being included in modules when they were loaded into the kernel.
Patch185: linux-2.2.19-modinfo-warning-fix.patch.bz2

# Upgrade of the dpt drivers: ftp://ftp.dpt.com/pub/techsup/SRVI/software/linux/
Patch190: linux-2.2.19-dpt1.14.patch.bz2

#Patch200 - secure/openwall removed

# Don't compile ieee1394 stuff with pcmcia.
Patch201: linux-2.2.19-noieee1394-with-pcmcia.patch.bz2

Patch205: linux-2.2.19-i60uscsi.patch.bz2

#correct the vg extend bug for LVM
#Patch210: linux-2.2.19-lvm-vg-extend.patch.bz2

#fixe for IDE tape drive (Exabyte Eagle TR-4)
# from Chip Salzenberg <chip@valinux.com>
Patch211: linux-2.2.19-ide-tape-exabyte-eagle-tr4.patch.bz2

#last aic7xxx drivers 
# from http://people.freebsd.org/~gibbs/linux/
#included in 2.2..19
#Patch215: linux-2.2.19-aic7xxx-6.1.5.patch.bz2
Patch216: linux-2.2.19-aic7xx-pcmcia.patch.bz2

#Fix #include issue in toshiba.c
Patch220: linux-2.2.19-toshiba-fix.patch.bz2

#Fix filldir call with DT_UNKOWN in capifs.c
Patch221: linux-2.2.19-capifs-fix.patch.bz2

#The I/O APIC code for 2.2 contains a little trick which sets the destination
#to 0 to disable an I/O APIC entry. This apparently trips up the I/O APIC
#on AMD-760MP systems causing a lockup during boot.
#from Johannes Erdfelt <jerdfelt@valinux.com>
Patch222: linux-2.2.19-amd760-ioapic.patch.bz2

#New version of the wacom drivers
Patch225: linux-2.2.19-wacom-usb.patch.bz2
Patch226: linux-2.2.19-wacom-usb-22.patch.bz2

#add support for oltiec isdn gazel modem
Patch227: linux-2.2.19-isdn-olitec-modem.patch.bz2

#fix reiserfs last version compile issue 
Patch231: linux-2.2.19-reiserfs-compile-fix.patch.bz2

#doesn't build on PPC after IDE patch 110
Patch232: linux-2.2.19-ide-ppc.patch.bz2

#patch ieee1394 for PPC
Patch233: linux-2.2.19-ieee1394-ppc.patch.bz2

#PPC patch for supermount
Patch234: linux-2.2.19-supermount-ppc.patch.bz2

#PPC patch to fix boot logo
Patch235: linux-2.2.19-bootlogo-ppc.patch.bz2

#PPC patch to omit airo.o, ario_cs.o from PCMCIA
Patch236: pcmcia-cs-3.1.2x-no-aero-ppc.patch.bz2

#rename daemonize in btaudio to remove module deps to 8139too and usbcore
Patch237: linux-2.2.19-rename-btaudio-daemonize.patch.bz2

#back off ioport.h, lincfg.c patches from 20pre
#seems to break bttv and eicon ISDN
Patch238: linux-2.2.20pre-undo-ioport.h-lincfg.c-2.4-compat.patch.bz2

#reverse icn.c, icn.h patches from 20pre - unresolved symbols
Patch239: linux-2.2.20pre-reverse-icn.patch.bz2

#reverse drm changes - breaks drm at least with voodoo3
Patch240: linux-2.2.20pre-revert-drm-patch.bz2

#patch alsa on PPC for ibook2 support
Patch241: alsa-0.5.11-ibook2-ppc.patch.bz2

#patch for symlink DoS and ptrace bug
#http://www.securityfocus.com/cgi-bin/archive.pl?id=1&mid=221337&start=2001-10-15&end=2001-10-21
Patch242: linux-2.2.20pre-deep-symlinks-ptrace-security.patch.bz2

#yet another security patch - syncookies
Patch243: linux-2.2.19-synq-security.patch.bz2

# sysrq broken on PPC
Patch244: linux-2.2.20-fix-sysrq-ppc.patch.bz2

# fix some alpha build breakage
Patch245: linux-2.2.20-alpha-fixes.patch.bz2

# zlib zfree fixes
Patch246: linux-2.2.20-zlib-zfree.patch.bz2


#END PATCHES
#########################################################

BuildRoot: %{_tmppath}/%{name}-%{kversion}-build
Provides: module-info
%if %{build_alsa}
Provides: alsa
%endif
Autoreqprov: no
%ifarch %{ix86}
Prereq: initscripts >= 6.40.2-5mdk, /usr/sbin/rdev
%else
Prereq: initscripts >= 6.40.2-5mdk
%endif
Requires: modutils >= 2.4.2-3mdk
%if %{build_alsa}
Obsoletes: alsa
%endif
BuildRequires: libbinutils2-devel
%ifnarch ppc
BuildRequires: egcs
%endif
%ifarch %{ix86}
BuildRequires: dev86
%endif

%description
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.

#
# kernel-smp: Symmetric MultiProcessing kernel
#

%package smp
Summary: The Linux Kernel compiled for SMP machines.
Group: System/Kernel and hardware
%ifarch %{ix86}
Prereq: /sbin/installkernel, /usr/sbin/rdev
%else
Prereq: /sbin/installkernel
%endif
Requires: modutils >= 2.4.2-3mdk

%description smp
This package includes a SMP version of the Linux %{kversion} kernel. It is
required only on machines with two or more CPUs, although it should work
fine on single-CPU boxes.

#
# kernel-boot: BOOT Kernel
#

%package BOOT
Summary: The Linux Kernel compiled with options for Boot kernel
Group: System/Kernel and hardware

%description BOOT
This package includes a kernel that has appropriate configuration options
enabled for the DrakX install.

%package source
Requires: glibc-devel, ncurses-devel, make, gcc
%ifarch %{ix86}
Requires: dev86
%endif
Summary: The source code for the Linux kernel.
Group: Development/Kernel
%if %{build_alsa}
Obsoletes: alsa-source
Provides: alsa-source
%endif

%description source
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
%ifarch %{ix86}
%setup -q -n linux -a 1 -a 5 -a7 -a8 -a9
%else
%ifarch ppc
%setup -q -n linux -a 1 -a 5 -a7 -a8 -a9 -a23
%else
%setup -q -n linux -a 1 -a 5
%endif
%endif

# For patches...
%if %{build_alsa}
ln -sf alsa-driver-%{alsaver} alsa
%endif
%if %{build_pcmcia}
ln -sf pcmcia-cs-%{pcmciaver} pcmcia
%endif

####Patches

# Add our updated ksymoops to the standard tree.
rm -rf scripts/ksymoops
mv ksymoops-%{ksymoopsver} scripts/ksymoops

#no AC patches yet
#%patch0 -p1

# Andrea - updated for 2.2.20pre
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
#omit version
#%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch55 -p1
%patch56 -p1
%patch57 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
%patch66 -p1
%patch67 -p1
%patch68 -p1
%patch69 -p1
%patch70 -p1
%patch71 -p1
%patch72 -p1
%patch73 -p1
%patch74 -p1
%patch75 -p1
%patch76 -p1
%patch77 -p1
%patch78 -p1
%patch79 -p1
%patch80 -p1
%patch81 -p1

# Reiserfs
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
#reiserfs format banner removed
#%patch104 -p1

#IPSEC
%if %{build_ipsec}
ln -s freeswan-%{ipsecver} freeswan
ln -s ../freeswan-%{ipsecver}/klips/net/ipsec net/
ln -s ../../../lib net/ipsec/libfreeswan
ln -s ../../../zlib net/ipsec/
ln -s ../../../libdes net/ipsec/
ln -sf Makefile.kernel net/ipsec/libfreeswan/Makefile

%patch105 -p1
%patch106 -p1
%patch107 -p1
%endif

# IDE
%patch110 -p1

# Aacraid
%patch111 -p1
%patch112 -p1
%patch113 -p1
%patch114 -p1
%patch116 -p1
%patch115 -p1
%patch117 -p1

# IBCS
%ifarch %{ix86}
%patch120 -p1
%patch121 -p1
%patch122 -p1
%endif
#net.h modified wait for new patches against 2.2.19
# IPVS
%patch123 -p1

# VPN-IP-MASQ
#%patch124 -p1

#CIPE
%patch130 -p1

#serial-sysrq
%patch131 -p1

%patch132 -p1
%patch133 -p1
%patch134 -p1
%patch135 -p1
%patch142 -p1
%patch154 -p1

# UDF
%patch136 -p1
%patch143 -p1

#mdklogo
%patch137 -p1 -b .oldlogo

#nr_file_limit
%patch138 -p1

#installkernel -a
%patch139 -p1

#IRDA
%patch140 -p1

%patch141 -p1
%patch144 -p1
%patch145 -p1
%patch146 -p1
#already applied
#%patch147 -p1
%patch148 -p1
%patch149 -p1
%patch150 -p1
%patch151 -p1

#supermount
%patch152 -p1
%patch153 -p1

#atp
%patch160 -p1
#pci-scan
%patch161 -p1
#Tulip-update
%patch162 -p1
#Tulip-compile
%patch163 -p1
#Via-rhine-update
#%patch164 -p1
#Via-rhine compile
#%patch165 -p1
#RTL8139 update
%patch166 -p1
#RTL8139 compile
%patch167 -p1
#3C90X
%patch168 -p1

#i2c 
%patch170 -p1

#lm_sensors
%patch171 -p1

#bttv
%ifnarch ppc
%patch172 -p1
%endif

#firewire
%patch180 -p1

# Maestro3: http://www.zabbo.net/maestro3/
#included in 2.2.19
#%patch183 -p1
# Maestro3: http://www.zabbo.net/maestro/
#%patch184 -p1

#modinfo warning fix
%patch185 -p1

#dpt
%patch190 -p1

%if %{build_pcmcia}
%ifarch %{ix86}
%patch201 -p1
%endif
%endif

#i60uscsi
%patch205 -p1

#LVM vg extend bug
#%patch210 -p1

#fix for IDE tape drive (Exabyte Eagle TR-4)
%patch211 -p1

#last aic7xxx drivers 
#%patch215 -p1 

#Fix pcmcia for aic7xxx
%if %{build_pcmcia}
%patch216 -p1
%endif

#Fix Toshiba compile issue - not needed with pre20-ac9
#%patch220 -p1
#Fix Capifs compile issue
%patch221 -p1
#Fix Amd760 apic issue - not needed with pre20-ac9
#%patch222 -p1

#wacom drivers
%patch225 -p1
%patch226 -p1
%patch227 -p1
#reiserfs compile patch removed
#%patch231 -p1

#misc PPC patches
%ifarch ppc
%patch232 -p1
%patch233 -p1
%patch234 -p1
#not needed with last logo change
#%patch235 -p1
%patch236 -p1
%patch244 -p1
%endif

#module namespace conflict - btaudio
%ifnarch ppc
%patch237 -p1
%endif

#ioport.h, lincfg.c, icn.c, icn.h - undo 20pre
%patch238 -p1
%patch239 -p1 

#reverse DRI mods in 20pre
%patch240 -p1

#patch alsa for ibook2 sound - PPC
%ifarch ppc
%patch241 -p1
%endif

#symlink DoS and ptrace fix + syncookies
#not needed anymore with 2.2.20
#%patch242 -p1
#%patch243 -p1

# fix alpha build breakage
%patch245 -p1

# zlib zfree 
%patch246 -p1

# fix read-only permissions which break build
%if %{build_pcmcia}
chmod -R +w pcmcia/
%endif

# fix some permissions for rpmlint
chmod 0644 Documentation/kernel-docs.txt
chmod 0644 Documentation/proc.txt
%if %{build_ipsec}
chmod 0644 freeswan-1.8/libdes/asm/perlasm/*
%endif

# Bring the Kernel Module Version Tag program
install -m644 %{SOURCE13} .

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

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

rm -f pcmcia alsa freeswan

###
### build
###

%build

# Directories definition needed for building
%define temp_root %{_tmppath}/%{name}-%{kversion}-temp

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

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

EnableorDisbale () {
    feature=$1
    type=$2
    file=$3

    grep -q $feature $file || { echo no $feature feature && return 1 ;}
    
    cp -f $file config.tmp
    if [ $type = "disable" ];then
	echo "Disabling option $feature"
	OPT="$feature" perl -e 'my $a = $ENV{'OPT'}; while (<>) {if (/^$a/) {print "# $a is not defined\n"; next;} print;}' \
	    < config.tmp > $file
    elif [ $type = "enable" ];then
	echo "Enabling option $feature"
	OPT="$feature" perl -e 'my $a = $ENV{'OPT'}; while (<>) {if (/^#\s+$a/ || /^$a=m/) {print "$a=y\n"; next;} print;}' \
	    < config.tmp > $file
    elif [ $type = "module" ];then
	echo "Moduralize option $feature"
	OPT="$feature" perl -e 'my $a = $ENV{'OPT'}; while (<>) {if (/^#\s+$a/ || /^$a=y/) {print "$a=m\n"; next;} print;}' \
	    < config.tmp > $file
    fi
    rm -f config.tmp
}

DependKernel() {
    # is this a special kernel we want to build?
    if [ -n "$2" ] ; then
	KernelVer=%{kversion}-%{krelease}$2
	echo MAKE DEPEND FOR $2 $1 KERNEL...
    else
	KernelVer=%{kversion}-%{krelease}
	echo MAKE DEPEND FOR up $1 KERNEL...
	cp -f %{_sourcedir}/kernel-%{kversion}-$1.config configs/kernel-%{kversion}-$1-up.config
    fi
		
    if [ "$2" = "BOOT" ];then
	install -m644 %{_sourcedir}/kernel-%{kversion}-$1-BOOT.config arch/%{_arch}/defconfig
    else
    	install -m644 %{_sourcedir}/kernel-%{kversion}-$1.config arch/%{_arch}/defconfig
    fi
    rm -f .config
	mkdir -p configs/
    if [ "$2" = "smp" ];then
	EnableorDisbale CONFIG_SMP enable arch/%{_arch}/defconfig
	cp -f arch/%{_arch}/defconfig configs/kernel-%{kversion}-$1-smp.config
    fi

    # make sure EXTRAVERSION says what we want it to say
    perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}$2/" Makefile
    make mrproper
    make oldconfig
    make dep
    make include/linux/version.h 
}

BuildKernel() {
    if [ -n "$1" ];then
	Config=%{_target_cpu}-$1
	KernelVer=%{kversion}-%{krelease}$1
	DependKernel %{_target_cpu} $1
	echo BUILD A KERNEL FOR $1
    else
	Config=%{_target_cpu}
	KernelVer=%{kversion}-%{krelease}
	DependKernel %{_target_cpu}
	echo BUILDING THE NORMAL KERNEL...
    fi

    %ifarch alpha
    make boot
    %endif    

    %ifarch ppc
    make vmlinux
    %endif

    %ifarch %{ix86}
    %make bzImage
    %endif


    %make modules
#ugly hack because I'm too tired
	rm -f modules/bttv-if.o

    # 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 arch/%{_arch}/defconfig %{temp_boot}/config-$KernelVer
        
    %ifarch alpha
    cp -f arch/alpha/boot/vmlinux.gz %{temp_boot}//vmlinuz-$KernelVer
    %endif
    %ifarch ppc
    cp -f vmlinux %{temp_boot}/vmlinuz-$KernelVer
    %endif
    %ifarch %{ix86}
    cp -f arch/i386/boot/bzImage %{temp_boot}/vmlinuz-$KernelVer
    %endif
        
    # modules
    install -d %{temp_modules}/$KernelVer
    make INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=$KernelVer modules_install
        
    #Identify the modules directory with the Module Version Tag
    cc $RPM_OPT_FLAGS -o rhkmvtag rhkmvtag.c init/version.o
    ./rhkmvtag > %{temp_modules}/$KernelVer/.rhkmvtag
     rm -f rhkmvtag

}

BuildPCMCIA() {
    if [ -z "$1" ] ; then
	echo "BUILDING FOR NORMAL KERNEL..."
    else
	echo "BUILDING FOR $1..."
    fi
    make -C pcmcia-cs-%{pcmciaver} clean
    ( cd pcmcia-cs-%{pcmciaver}; ./Configure -n --kernel=$RPM_BUILD_DIR/linux \
	--cc=%{kgcc} \
	--target=%{temp_root} --trust --cardbus --nopnp --srctree \
	--moddir=/lib/modules/%{KVERREL}$1 --sysv --rcdir=/etc/rc.d )
    perl -pi -e 's|/usr/man|%{_mandir}|' pcmcia-cs-%{pcmciaver}/man/Makefile

    %make -C pcmcia-cs-%{pcmciaver} all

    mkdir -p %{temp_root}/lib/modules/%{KVERREL}$1/pcmcia
    make -C pcmcia-cs-%{pcmciaver} install
}

SaveHeaders() {
    echo "SAVING HEADERS for $1 $2"
    # deal with the kernel headers that are version specific
    mkdir -p  %{temp_root}/usr/src/linux-%{kversion}/savedheaders/$2/$1
    install -m 644 include/linux/autoconf.h \
	 %{temp_root}/usr/src/linux-%{kversion}/savedheaders/$2/$1/autoconf.h
    install -m 644 include/linux/version.h \
	 %{temp_root}/usr/src/linux-%{kversion}/savedheaders/$2/$1/version.h
    mv include/linux/modules \
	 %{temp_root}/usr/src/linux-%{kversion}/savedheaders/$2/$1/
    echo $2 $1 ../../savedheaders/$2/$1/ >>  %{temp_root}/usr/src/linux-%{kversion}/savedheaders/list
}

BuildAlsa() {
	c=$1
	echo "Building for $c"

   	pushd alsa-driver-%{alsaver}  && {

	    [ -e Makefile.conf ] && make mrproper

	    CC=%{kgcc} CFLAGS=$FLAGS ./configure --with-kernel=$RPM_BUILD_DIR/linux \
		--with-moddir=%{temp_root}/lib/modules/%{KVERREL}$c/alsa/ \
		--with-processor=%{_target_cpu} --with-smp=auto --without-isapnp --with-sequencer=yes \
		--with-oss=yes
	    
	    %make
	    
	    mkdir -p  %{temp_root}/lib/modules/%{KVERREL}$c/alsa/
		install -m644 modules/*.o  %{temp_root}/lib/modules/%{KVERREL}$c/alsa/
	} && popd
}

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

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

%if %build_boot
BuildKernel BOOT
# single %if generates an error - %% seems to work (sb)
%%if %{build_pcmcia}
BuildPCMCIA BOOT
%%endif
exit 0
%endif

BuildKernel smp
%if %{build_pcmcia}
BuildPCMCIA smp
%endif
%if %{build_alsa}
BuildAlsa smp
%endif
SaveHeaders smp %{_target_cpu}

# NORMAL KERNEL
BuildKernel
%if %{build_pcmcia}
BuildPCMCIA
%endif
%if %{build_alsa}
BuildAlsa ""
%endif
SaveHeaders up %{_target_cpu}

make -C scripts/ksymoops/

%ifnarch ppc
make -C fs/reiserfs/utils/
%endif

find  %{temp_root}/lib/modules/ -name \*.o -exec gzip {} \;

###
### install
###

%install

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

%if %build_boot   
exit 0
%endif

%ifarch  %{ix86}
mkdir -p %{buildroot}/{sbin,%{_mandir}/man8}
make  -C fs/reiserfs/utils SBIN=%{buildroot}/sbin install MANDIR=%{buildroot}/%{_mandir}/man8/ 
(cd  %{buildroot}/sbin; ln -s ../bin/true  %{buildroot}/sbin/fsck.reiserfs)
%endif

mkdir -p  %{buildroot}/usr/include
ln -sf ../src/linux/include/linux  %{buildroot}/usr/include/linux

mkdir -p  %{buildroot}/usr/src/linux-%{kversion} 

%if %{build_pcmcia}
mkdir -p  %{buildroot}/etc/pcmcia
mkdir -p  %{buildroot}/etc/sysconfig
# Install our own network up/down script
install -m755 %{_sourcedir}/pcmcia-cs-2.8.8-network.script \
         %{buildroot}/etc/pcmcia/network

# We need our own default /etc/sysconfig/pcmcia
cat >  %{buildroot}/etc/sysconfig/pcmcia <<EOF
PCMCIA=no
PCIC=
PCIC_OPTS=do_scan=0
CORE_OPTS=
CARDMGR_OPTS=-f
EOF

# Finally strip some binaries
%ifnarch ppc
for file in cardmgr cardctl probe scsi_info ftl_format ftl_check ; do
    strip -R .comment  %{buildroot}/sbin/$file
done
%else
for file in cardmgr cardctl scsi_info ftl_format ftl_check ; do
    strip -R .comment  %{buildroot}/sbin/$file
done
%endif
%endif

mkdir -p  %{buildroot}/usr/src/linux-%{kversion}
tar cf - . | tar xf - -C  %{buildroot}/usr/src/linux-%{kversion}
ln -sf linux-%{kversion}  %{buildroot}/usr/src/linux
install -m 644 %{SOURCE4}   %{buildroot}/usr/src/linux-%{kversion}

%ifarch sparc
ln -s ../src/linux/include/asm-sparc  %{buildroot}/usr/include/asm-sparc
ln -s ../src/linux/include/asm-sparc64  %{buildroot}/usr/include/asm-sparc64
mkdir  %{buildroot}/usr/include/asm
cp -a %{_sourcedir}/kernel-2.4-BuildASM.sh  %{buildroot}/usr/src/linux/include/asm-sparc/BuildASM 
%{buildroot}/usr/include/asm-sparc/BuildASM  %{buildroot}/usr/include
%else
ln -sf ../src/linux/include/asm %{buildroot}/usr/include/asm
%endif

#clean up the destination
%if %{build_alsa}
make -C  %{buildroot}/usr/src/linux-%{kversion}/alsa-driver-%{alsaver} mrproper
for i in ainstr_gf1.h  ainstr_iw.h  ainstr_simple.h  asequencer.h  asound.h  asoundid.h;do 
		cp -f  %{buildroot}/usr/src/linux-%{kversion}/alsa-driver-%{alsaver}/include/$i \
				 %{buildroot}/usr/src/linux/include/linux/
done
rm -f %buildroot/usr/src/linux-%{kversion}/alsa-driver-%{alsaver}/include/config.h
%endif
%if %{build_pcmcia}
make clean -C  %{buildroot}/usr/src/linux-%{kversion}/pcmcia-cs-%{pcmciaver}
rm -f %buildroot/usr/src/linux-%{kversion}/pcmcia-cs-%{pcmciaver}/config.out
rm -f %buildroot/usr/src/linux-%{kversion}/pcmcia-cs-%{pcmciaver}/include/linux/config.h
rm -f %buildroot/usr/src/linux-%{kversion}/pcmcia-cs-%{pcmciaver}/include/linux/compile.h
rm -f %buildroot/usr/src/linux-%{kversion}/pcmcia-cs-%{pcmciaver}/include/linux/version.h
%endif

make mrproper -C  %{buildroot}/usr/src/linux-%{kversion}
make oldconfig -C  %{buildroot}/usr/src/linux-%{kversion}
make symlinks -C  %{buildroot}/usr/src/linux-%{kversion}
make include/linux/version.h -C  %{buildroot}/usr/src/linux-%{kversion}

#this generates modversions info which we want to include and we may as
#well include the depends stuff as well, after we fix the paths
make depend -C  %{buildroot}/usr/src/linux-%{kversion}
find  %{buildroot}/usr/src/linux-%{kversion} -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 files in place
pushd  %{buildroot}/usr/src/linux-%{kversion}/include/linux ; {
rm -rf modules modversions.h autoconf.h version.h
cat > modversions.h <<EOF
#ifndef _LINUX_MODVERSIONS_H
#define _LINUX_MODVERSIONS_H
#include <linux/rhconfig.h>
#include <linux/modsetver.h>
EOF
echo '#include <linux/rhconfig.h>' > autoconf.h
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
    #(sb) Nov 6 2001 - took this out - rpmlint complains about 0 byte files
    #touch -r modules/$l modules/`basename $l .ver`.stamp
    echo '#include <linux/modules/'$l'>' >> modversions.h
done
echo '#endif' >> modversions.h
sed 's,$,autoconf.h,' ../../savedheaders/list | awk -f %{SOURCE16} >> autoconf.h
install -m 644 %{SOURCE15} rhconfig.h
echo "#include <linux/rhconfig.h>" >> version.h
keyword=if
for i in smp up; do
    if [ -f ../../savedheaders/%{_target_cpu}/$i/version.h ]; then
	if [ "$i" = up ]; then
	    echo "#else" >> version.h
	else
	    echo "#$keyword defined(__module__$i)" >> version.h
	    keyword=elif
	fi
	grep UTS_RELEASE ../../savedheaders/%{_target_cpu}/$i/version.h >> version.h
    fi
done
echo "#endif" >> version.h
grep -v UTS_RELEASE ../../savedheaders/%{_target_cpu}/up/version.h >> version.h
rm -rf ../../savedheaders
} ; popd
>  %{buildroot}/boot/kernel.h-%{kversion}

# other tools
mkdir -p %buildroot/%{_mandir}/man8/
make install -C scripts/ksymoops INSTALL_PREFIX=%{buildroot}/%{_prefix} INSTALL_MANDIR=%{buildroot}/%{_mandir}/man8

make clean -C %{buildroot}/usr/src/linux-%{kversion}/scripts/ksymoops

rm -f %{buildroot}/usr/include/linux
mkdir -p %{buildroot}/usr/include/linux
cp -a %{buildroot}/usr/src/linux/include/linux/*  %{buildroot}/usr/include/linux/
rm -rf %{buildroot}/usr/include/linux/modules
echo "#error Modules should never use kernel-headers system headers," > %{buildroot}/usr/include/linux/modversions.h
echo "#error but headers from an appropriate kernel-source" >> %{buildroot}/usr/include/linux/modversions.h

%ifarch sparc
rm -f %{buildroot}/usr/include/asm-sparc
mkdir -p %{buildroot}/usr/include/asm-sparc
cp -a %{buildroot}/usr/src/linux/include/asm-sparc/* %{buildroot}/usr/include/asm-sparc/
rm -f %{buildroot}/usr/include/asm-sparc64
mkdir -p %{buildroot}/usr/include/asm-sparc64
cp -a %{buildroot}/usr/src/linux/include/asm-sparc64/* %{buildroot}/usr/include/asm-sparc64/
%else
rm -f %{buildroot}/usr/include/asm
mkdir -p %{buildroot}/usr/include/asm
cp -a %{buildroot}/usr/src/linux/include/asm/* %{buildroot}/usr/include/asm/
%endif

# rerun mrproper before shipping.
rm -f %buildroot/usr/src/linux-%{kversion}/.hdepend
# we want to have the headers to compile with this kernel
#make mrproper -C  %{buildroot}/usr/src/linux-%{kversion}
#x86 specific cleanup when we'll do ports.
ln -s asm-%{_arch} %buildroot/usr/src/linux/include/asm
cp %{SOURCE20} %buildroot/usr/src/linux/arch/%{_arch}/defconfig

for i in  %{buildroot}/lib/modules/*; do
  rm -f $i/build $i/modules.dep $i/modules.pcimap
  ln -sf /usr/src/linux-%{kversion} $i/build
done

# more cleanup for rpmlint - 0 byte .dep files
find %{buildroot}/usr/src/linux-%{kversion} -size 0 |xargs rm -f

###
### clean
###

%clean
rm -rf %{buildroot}

###
### scripts
###

# do this for upgrades...in case the old modules get removed we have
# loopback in the kernel so that mkinitrd will work.
%preun
/sbin/modprobe loop 2> /dev/null > /dev/null
rm -f %{_modulesdir}/%{KVERREL}/modules.*

REMOVE=
if [ -f /etc/sysconfig/system ];then
                source /etc/sysconfig/system
                [[ "$CLASS" = "beginner" ]] && REMOVE=yes
fi
if [ -f /etc/sysconfig/installkernel ];then
                source /etc/sysconfig/installkernel
                [[ "$AUTOREMOVE" = [Yy][Ee][Ss] ]] && REMOVE=yes
                [[ "$AUTOREMOVE" = [Nn][Oo] ]] && REMOVE=
fi

[[ -n $REMOVE ]] && /sbin/installkernel -a -R -c %{KVERREL}

exit 0

%preun smp
/sbin/modprobe loop 2> /dev/null > /dev/null
rm -f %{_modulesdir}/%{KVERREL}smp/modules.*

REMOVE=
if [ -f /etc/sysconfig/system ];then
                source /etc/sysconfig/system
                [[ "$CLASS" = "beginner" ]] && REMOVE=yes
fi
if [ -f /etc/sysconfig/installkernel ];then
                source /etc/sysconfig/installkernel
                [[ "$AUTOREMOVE" = [Yy][Ee][Ss] ]] && REMOVE=yes
                [[ "$AUTOREMOVE" = [Nn][Oo] ]] && REMOVE=
fi

[[ -n $REMOVE ]] && /sbin/installkernel -a -R -c %{KVERREL}smp

exit 0

%post
cd %{_bootdir}
if [ -x /sbin/installkernel ];then
              /sbin/installkernel -a -c %{KVERREL}
fi
depmod -a -F %{_bootdir}/System.map-%{KVERREL} %{KVERREL}

%postun
cd %{_bootdir}
if [ -f initrd-%{KVERREL}.img ];then
                rm -f initrd-%{KVERREL}.img
fi

%post smp
cd %{_bootdir}
if [ -x /sbin/installkernel ];then
              /sbin/installkernel -a -c %{KVERREL}smp
fi
depmod -a -F %{_bootdir}/System.map-%{KVERREL}smp %{KVERREL}smp

%postun smp
cd %{_bootdir}
if [ -f initrd-%{KVERREL}smp.img ];then
                rm -f initrd-%{KVERREL}smp.img
fi

%post source
ln -snf linux-%{kversion} /usr/src/linux22

%postun source
if [ -L /usr/src/linux22 ]; then 
    if [ `ls -l /usr/src/linux22 | awk '{ print $11 }'` = "linux-%{kversion}" ]; then
	[ $1 = 0 ] && rm -f /usr/src/linux22
    fi
fi
exit 0

###
### file lists
###

%if %build_boot 

%files BOOT
%defattr(-,root,root)
%{_bootdir}/vmlinuz-%{KVERREL}BOOT
%{_bootdir}/System.map-%{KVERREL}BOOT
%{_modulesdir}/%{KVERREL}BOOT

#not build_boot - normal build
%else

%files
%defattr(-,root,root)
%doc README
%{_bootdir}/vmlinuz-%{KVERREL}
%{_bootdir}/System.map-%{KVERREL}
%dir %{_modulesdir}/%{KVERREL}
%{_modulesdir}/%{KVERREL}/build
%{_modulesdir}/%{KVERREL}/block  
%ifnarch alpha
%{_modulesdir}/%{KVERREL}/cdrom  
%{_modulesdir}/%{KVERREL}/ieee1394  
%endif
%{_modulesdir}/%{KVERREL}/fs  
%{_modulesdir}/%{KVERREL}/ipv4  
%ifnarch ppc
%{_modulesdir}/%{KVERREL}/ipv6  
%endif
%{_modulesdir}/%{KVERREL}/misc  
%{_modulesdir}/%{KVERREL}/net
%{_modulesdir}/%{KVERREL}/scsi  
%{_modulesdir}/%{KVERREL}/usb  
%ifnarch ppc
%{_modulesdir}/%{KVERREL}/video
%endif
%if %{build_pcmcia}
%{_modulesdir}/%{KVERREL}/pcmcia
%endif
%if %{build_alsa}
%{_modulesdir}/%{KVERREL}/alsa
%endif

%files smp
%defattr(-,root,root)
%{_bootdir}/vmlinuz-%{KVERREL}smp
%{_bootdir}/System.map-%{KVERREL}smp
%dir %{_modulesdir}/%{KVERREL}smp
%{_modulesdir}/%{KVERREL}smp/build
%{_modulesdir}/%{KVERREL}smp/block  
%ifnarch alpha
%{_modulesdir}/%{KVERREL}smp/cdrom  
%{_modulesdir}/%{KVERREL}smp/ieee1394  
%endif
%{_modulesdir}/%{KVERREL}smp/fs  
%{_modulesdir}/%{KVERREL}smp/ipv4  
%ifnarch ppc
%{_modulesdir}/%{KVERREL}smp/ipv6  
%endif
%{_modulesdir}/%{KVERREL}smp/misc  
%{_modulesdir}/%{KVERREL}smp/net
%{_modulesdir}/%{KVERREL}smp/scsi  
%{_modulesdir}/%{KVERREL}smp/usb  
%ifnarch ppc
%{_modulesdir}/%{KVERREL}smp/video
%endif
%if %{build_pcmcia}
%{_modulesdir}/%{KVERREL}smp/pcmcia
%endif
%if %{build_alsa}
%{_modulesdir}/%{KVERREL}smp/alsa
%endif

%files source
%defattr(-,root,root)
%dir %{_kerneldir}
%{_kerneldir}/COPYING
%{_kerneldir}/CREDITS
%{_kerneldir}/Documentation
%{_kerneldir}/MAINTAINERS
%{_kerneldir}/Makefile
%{_kerneldir}/README
%{_kerneldir}/REPORTING-BUGS
%{_kerneldir}/Rules.make
%{_kerneldir}/arch/%{_arch}
%{_kerneldir}/drivers
%{_kerneldir}/fs
%{_kerneldir}/kernel
%{_kerneldir}/init
%{_kerneldir}/ipc
%{_kerneldir}/lib
%{_kerneldir}/mm
%{_kerneldir}/net
%{_kerneldir}/scripts
%if %{build_ipsec}
%{_kerneldir}/freeswan-%{ipsecver}
%endif
%if %{build_pcmcia}
%{_kerneldir}/pcmcia-cs-%{pcmciaver}
%endif
%if %{build_alsa}
%{_kerneldir}/alsa-driver-%{alsaver}
%endif
%{_kerneldir}/configs
%{_kerneldir}/include/asm-%{_arch}
%{_kerneldir}/include/asm
%ifarch ppc
%{_kerneldir}/include/asm-m68k
%endif
%{_kerneldir}/include/asm-generic
%{_kerneldir}/include/linux
%{_kerneldir}/include/net
%{_kerneldir}/include/scsi
%{_kerneldir}/include/video

#end if build_boot
%endif

%changelog
* Fri Feb 22 2002 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.20-9mdk
- spec update

* Thu Feb 14 2002 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.20-8mdk
- new boot logo

* Sat Feb  9 2002 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.20-7mdk
- remove secure kernel (picked up in 2.4)

* Fri Dec 28 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.20-6mdk
- replace hard calls for kgcc with variable - PPC was using a mixture

* Wed Dec 26 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.20-5mdk
- rework %%post, %%postun, %%pre, %%preun to mirror 2.4 kernel method

* Tue Dec 11 2001 Jeff Garzik <jgarzik@mandrakesoft.com> 2.2.20-4mdk
- update i586 (no changes, just re-ran make oldconfig)
- add i686 config

* Wed Dec  5 2001 Jeff Garzik <jgarzik@mandrakesoft.com> 2.2.20-3mdk
- do not reference /lib/modules/.../cdrom and .../ieee1394 on alpha

* Mon Dec  3 2001 Jeff Garzik <jgarzik@mandrakesoft.com> 2.2.20-2mdk
- Patch245: fix alpha build
- update alpha config

* Thu Nov  8 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.20-1mdk
- 2.2.20, drop security patches 242, 243 (not needed), no 20pre-ac9
- rework openwall patch, add USB_HOTPLUG option to configs
- patch MAGIC_SYSRQ PPC (patch 244)

* Wed Nov  7 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.19-24mdk
- syncookies security bug fix, rpmlint issues 

* Fri Oct 19 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.19-23mdk
- symlinks DoS and ptrace bug fix

* Thu Oct 18 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.19-22mdk
- revert 2.2.20pre drm changes, breaks DRI with voodoo3 (thx Guillaume)
- update alsa to 0.5.11, patch for PPC ibook2 sound

* Sat Oct  6 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.19-21mdk
- s/Linux Mandrake/Mandrake Linux/, rpmlint fixes

* Fri Sep 28 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.19-20mdk
- 2.2.20pre-ac9, new Andrea patches, new tulip, no btaudio patch PPC

* Wed Sep 12 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.19-19mdk
- rename btaudio "daemonize" to overcome module namespace conflict

* Thu Aug 30 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.19-18mdk
- add BuildRequires dev86, and Requires dev86 for kernel-source (ix86)

* Sun Aug 26 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.19-17mdk
- update %post depmod syntax - thx Chmouel

* Wed Aug 15 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.19-16mdk
- add %%build_boot macro

* Wed May 23 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.19-15mdk
- one missing vmlinux -> vmlinuz (PPC)

* Mon May 21 2001 Jeff Garzik <jgarzik@mandrakesoft.com> 2.2.19-14mdk
- create build_pcmcia, build_alsa, build_ipsec macros for ports
- clean ifarch/ifnarch stuff broken by PPC port
- remove PPC use of vmlinux
- remove PPC avoidance of /sbin/installkernel

* Mon May 21 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.19-13mdk
- PPC support for PCMCIA, remove rdev requires on PPC

* Tue May 15 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.19-12mdk
- add asm-m68k source tree for PPC

* Tue Apr 17 2001 Stew Benedict <sbenedict@mandrakesoft.com> 2.2.19-11mdk
- spec mod, patches for PPC build

* Fri Apr 13 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.19-10mdk
- update logo

* Thu Apr 12 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.19-9mdk
- Change the rhconfig.h to work with secure kernels

* Thu Apr 12 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.19-8mdk
- Fix install to ship the sources 
- add the build link in the modules

* Wed Apr 11 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.19-7mdk
- Fix deps issue when using depmod with -F
- add -L on installkernel

* Fri Apr  6 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.19-6mdk
- Fix emu10k1 issue

* Wed Apr  4 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.19-5mdk
- change to reiserfs 3.5.29 temporarly to avoid bugs with latest version of this patch

* Mon Apr  2 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.19-4mdk
- add support for olitec isdn gazel modem
- fixed spec file 

* Mon Apr  2 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.19-3mdk
- change the CONFIG_BLK_DEV_OFFBOARD to yes in .config
- update to reiserfs 3.5.32

* Wed Mar 28 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.19-2mdk
- update bttv

* Wed Mar 28 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.19-1mdk
- update to 2.2.19
- update openwall, tulip, ipvs, ide, wacom

* Fri Mar  9 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.18-18mdk
- update ieee1394 modules

* Wed Mar  7 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.18-17mdk
- fix the version number for modutils
- update aacraid 
- update aic7xxx
- update ide-tape

* Tue Mar  6 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.18-16mdk
- Compress modules
- fix Vg extend bug with lvm

* Mon Mar  5 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.18-15mdk
- update reiserfs to 3.5.31

* Thu Feb 22 2001 Matthias Badaire <mbadaire@mandrakesoft.com> 2.2.18-14mdk
- include the fix for i60uscsi from Chmouel

* Tue Feb 13 2001 Chmouel Boudjnah <chmouel@mandrakesoft.com> 2.2.18-13mdk
- Update to version 4 of openwall patches.

* Mon Feb 12 2001 Chmouel Boudjnah <chmouel@mandrakesoft.com> 2.2.18-12mdk
- Don't compile firewire-pcmcia stuff with 2.2.x.
- Upgrade firewire patchs.
- pcmcia-3.1.24.
- Upgrade to aacraid 1.0.7.

* Sun Feb 11 2001 Jeff Garzik <jgarzik@mandrakesoft.com> 2.2.18-11mdk
- update alpha config

* Wed Jan 24 2001 Chmouel Boudjnah <chmouel@mandrakesoft.com> 2.2.18-10mdk
- alsa-0.5.10b.

* Mon Jan 22 2001 Chmouel Boudjnah <chmouel@mandrakesoft.com> 2.2.18-9mdk
- rm -f all modules.* stuff in %pref
- Upgrade vpn-masquerade patch.
- UDF 0.9.3.
- Reiserfs 3.5.29.
- Ipvs 1.0.3.

* Tue Jan 16 2001 Chmouel Boudjnah <chmouel@mandrakesoft.com> 2.2.18-8mdk
- Make HSM into the kernel not as module.

* Mon Jan 15 2001 Chmouel Boudjnah <chmouel@mandrakesoft.com> 2.2.18-7mdk
- Copy also the up config file to configs/ of kernel-source.
- Upgrade the andrea patches (bring RAID soft).

* Thu Jan 11 2001 Chmouel Boudjnah <chmouel@mandrakesoft.com> 2.2.18-6mdk
- Add maestro3 drivers.

* Tue Jan  9 2001 Chmouel Boudjnah <chmouel@mandrakesoft.com> 2.2.18-5mdk
- Add 3c90x drivers.

* Thu Jan  4 2001 Chmouel Boudjnah <chmouel@mandrakesoft.com> 2.2.18-4mdk
- Correct .config files.
- Add missing source.

* Tue Dec 26 2000 Chmouel Boudjnah <chmouel@mandrakesoft.com> 2.2.18-3mdk
- Add upgrade of the dpt driver.

* Sun Dec 24 2000 Chmouel Boudjnah <chmouel@mandrakesoft.com> 2.2.18-2mdk
- Add some missing source (freeswan/openwall).

* Fri Dec 15 2000 Chmouel Boudjnah <chmouel@mandrakesoft.com> 2.2.18-1mdk
- Rewrite completely the spec files (and comment it).
- 2.2.18.
- Add freeswan.