--- kernel-2.6.spec.orig	2010-09-13 15:02:45.000000000 +0200
+++ kernel-2.6.spec	2010-09-13 15:06:59.000000000 +0200
@@ -17,6 +17,8 @@
 %define with_pae       %{?_without_pae:       0} %{?!_without_pae:       1}
 # kernel-xen (only valid for i686, x86_64 and ia64)
 %define with_xen       %{?_without_xen:       0} %{?!_without_xen:       1}
+# kernel-SoC (only valid for i686, x86_64 and ia64)
+%define with_soc     %{?_without_soc:         0} %{?!_without_soc:       1}
 # kernel-kdump (only valid for ppc64)
 %define with_kdump     %{?_without_kdump:     0} %{?!_without_kdump:     1}
 # kernel-debug
@@ -102,6 +104,7 @@
 %define with_smp 0
 %define with_pae 0
 %define with_xen 0
+%define with_soc 0
 %define with_kdump 0
 %define with_debug 0
 %endif
@@ -111,6 +114,7 @@
 %define with_up 0
 %define with_pae 0
 %define with_xen 0
+%define with_soc 0
 %define with_kdump 0
 %define with_debug 0
 %endif
@@ -284,6 +288,7 @@
 %define with_smp 0
 %define with_pae 0
 %define with_xen 0
+%define with_soc 0
 %define with_kdump 0
 %define with_debug 0
 %define with_debuginfo 0
@@ -419,6 +424,8 @@
 Source83: config-olpc-generic
 Source84: config-rhel-x86_64-generic
 
+Source90: kernel-%{kversion}-i686-SoC.config
+
 Source100: kabi_whitelist_i686
 Source101: kabi_whitelist_i686PAE
 Source102: kabi_whitelist_i686xen
@@ -444,6 +451,7 @@
 Source129: Module.kabi_x86_64xen
 
 Source130: check-kabi
+Source140: linux-perfctr-4.0.3.tar.bz2
 
 #
 # Patches 0 through 100 are meant for core subsystem upgrades
@@ -5122,6 +5130,10 @@
 Patch25156: linux-2.6-mm-fix-up-some-user-visible-effects-of-stack-guard-page.patch
 Patch25157: linux-2.6-mm-pass-correct-mm-when-growing-stack.patch
 Patch25158: linux-2.6-mm-accept-an-abutting-stack-segment.patch
+Patch30000: linux-2.6-ocfs2-endian-redefinition.patch
+# adds support for PAPI/perfctr
+Patch30001: linux-2.6.18-194-perfctr-4.0.3.patch
+
 # adds rhel version info to version.h
 Patch99990: linux-2.6-rhel-version-h.patch
 # empty final patch file to facilitate testing of kernel patches
@@ -5227,6 +5239,40 @@
 This package provides kernel headers and makefiles sufficient to build modules
 against the PAE kernel package.
 
+%package SoC
+Summary: The Linux kernel compiled for LIP6/SoC machines.
+
+Group: System Environment/Kernel
+Provides: kernel = %{version}
+Provides: kernel-drm = 4.3.0
+Provides: kernel-%{_target_cpu} = %{rpmversion}-%{release}SoC
+Prereq: %{kernel_prereq}
+Conflicts: %{kernel_dot_org_conflicts}
+Conflicts: %{package_conflicts}
+Obsoletes: kernel-smp < 2.6.17
+# We can't let RPM do the dependencies automatic because it'll then pick up
+# a correct but undesirable perl dependency from the module headers which
+# isn't required for the kernel proper to function
+AutoReq: no
+AutoProv: yes
+
+%description SoC
+This package includes a version of the Linux kernel tailored for LIP6/SoC
+machines.
+
+%package SoC-devel
+Summary: Development package for building kernel modules to match the SoC kernel.
+Group: System Environment/Kernel
+Provides: kernel-SoC-devel-%{_target_cpu} = %{rpmversion}-%{release}
+Provides: kernel-devel-%{_target_cpu} = %{rpmversion}-%{release}SoC
+Provides: kernel-devel = %{rpmversion}-%{release}SoC
+AutoReqProv: no
+Prereq: /usr/bin/find
+
+%description SoC-devel
+This package provides kernel headers and makefiles sufficient to build modules
+against the SoC kernel package.
+
 %package smp
 Summary: The Linux kernel compiled for SMP machines.
 
@@ -10038,6 +10084,8 @@
 %patch25156 -p1
 %patch25157 -p1
 %patch25158 -p1
+%patch30000 -p1
+%patch30001 -p1
 # correction of SUBLEVEL/EXTRAVERSION in top-level source tree Makefile
 # patch the Makefile to include rhel version info
 %patch99990 -p1
@@ -10046,6 +10094,9 @@
 perl -p -i -e "s/^RHEL_MAJOR.*/RHEL_MAJOR = %{rh_release_major}/" Makefile
 perl -p -i -e "s/^RHEL_MINOR.*/RHEL_MINOR = %{rh_release_minor}/" Makefile
 
+# adding perfctr sources.
+tar jxvf %{SOURCE140}
+
 # conditionally applied test patch for debugging convenience
 %if %([ -s %{PATCH99999} ] && echo 1 || echo 0)
 %patch99999 -p1
@@ -10065,6 +10116,7 @@
 %if 0%{?rhel}
   for i in %{all_arch_configs}
   do
+    echo $i | grep 'i686-SoC' && continue
     mv $i $i.tmp
     $RPM_SOURCE_DIR/merge.pl $RPM_SOURCE_DIR/config-rhel-generic $i.tmp > $i
     rm $i.tmp
@@ -10091,6 +10143,7 @@
 %if 0%{?olpc}
   for i in %{all_arch_configs}
   do
+    echo $i | grep 'i686-SoC' && continue
     mv $i $i.tmp
     $RPM_SOURCE_DIR/merge.pl $RPM_SOURCE_DIR/config-olpc-generic $i.tmp > $i
     rm $i.tmp
@@ -10108,6 +10161,7 @@
 %if 0%{?olpc}
 # don't need these for OLPC
 rm -f kernel-%{kversion}-*PAE*.config
+rm -f kernel-%{kversion}-*SoC*.config
 rm -f kernel-%{kversion}-*xen*.config
 rm -f kernel-%{kversion}-*kdump*.config
 %endif
@@ -10367,6 +10421,8 @@
 # end of necessary hypervisor patches
 %endif
 
+cp %{SOURCE100} %{SOURCE100}SoC
+
 
 ###
 ### build
@@ -10659,6 +10715,10 @@
 BuildKernel %make_target %kernel_image PAE
 %endif
 
+%if %{with_soc}
+BuildKernel %make_target %kernel_image SoC
+%endif
+
 %if %{with_smp}
 BuildKernel %make_target %kernel_image smp
 %endif
@@ -10899,6 +10959,27 @@
   popd > /dev/null
 fi
 
+%post SoC
+if [ -f /etc/sysconfig/kernel ]; then
+    /bin/sed -i -e 's/^DEFAULTKERNEL=kernel-smp$/DEFAULTKERNEL=kernel-SoC/' /etc/sysconfig/kernel
+fi
+/sbin/new-kernel-pkg --package kernel-SoC --mkinitrd --depmod --install %{KVERREL}SoC || exit $?
+if [ -x /sbin/weak-modules ]
+then
+    /sbin/weak-modules --add-kernel %{KVERREL}SoC || exit $?
+fi
+
+%post SoC-devel
+if [ -f /etc/sysconfig/kernel ]
+then
+    . /etc/sysconfig/kernel || exit $?
+fi
+if [ "$HARDLINK" != "no" -a -x /usr/sbin/hardlink ] ; then
+  pushd /usr/src/kernels/%{KVERREL}-SoC-%{_target_cpu} > /dev/null
+  /usr/bin/find . -type f | while read f; do hardlink -c /usr/src/kernels/*FC*/$f $f ; done
+  popd > /dev/null
+fi
+
 %post kdump
 %ifarch s390x
     ln -sf /boot/vmlinuz-%{KVERREL}kdump /boot/zfcpdump
@@ -10942,6 +11023,13 @@
     /sbin/weak-modules --remove-kernel %{KVERREL}PAE || exit $?
 fi
 
+%preun SoC
+/sbin/new-kernel-pkg --rminitrd --rmmoddep --remove %{KVERREL}SoC || exit $?
+if [ -x /sbin/weak-modules ]
+then
+    /sbin/weak-modules --remove-kernel %{KVERREL}SoC || exit $?
+fi
+
 %preun kdump
 %ifnarch s390x
     /sbin/new-kernel-pkg --rminitrd --rmmoddep --remove %{KVERREL}kdump || exit $?
@@ -11228,6 +11316,52 @@
 
 %endif
 
+%if %{with_soc}
+%if "%{_enable_debug_packages}" == "1"
+%ifnarch noarch
+%package SoC-debuginfo
+Summary: Debug information for package %{name}-SoC
+Group: Development/Debug
+Requires: %{name}-debuginfo-common-%{_target_cpu} = %{KVERREL}
+Provides: %{name}-%SoC-debuginfo-%{_target_cpu} = %{KVERREL}
+%description SoC-debuginfo
+This package provides debug information for package %{name}-SoC
+This is required to use SystemTap with %{name}-SoC-%{KVERREL}.
+%files SoC-debuginfo
+%defattr(-,root,root)
+%if "%{elf_image_install_path}" != ""
+/usr/lib/debug/%{elf_image_install_path}/*-%{KVERREL}SoC.debug
+%endif
+/usr/lib/debug/lib/modules/%{KVERREL}SoC
+/usr/lib/debug/usr/src/kernels/%{KVERREL}-SoC-%{_target_cpu}
+%endif
+%endif
+
+%files SoC
+%defattr(-,root,root)
+/%{image_install_path}/vmlinuz-%{KVERREL}SoC
+%if %{with_fips}
+/%{image_install_path}/.vmlinuz-%{KVERREL}SoC.hmac
+%endif
+/boot/System.map-%{KVERREL}SoC
+/boot/symvers-%{KVERREL}SoC.gz
+/boot/config-%{KVERREL}SoC
+%dir /lib/modules/%{KVERREL}SoC
+/lib/modules/%{KVERREL}SoC/kernel
+/lib/modules/%{KVERREL}SoC/build
+/lib/modules/%{KVERREL}SoC/source
+/lib/modules/%{KVERREL}SoC/extra
+/lib/modules/%{KVERREL}SoC/updates
+/lib/modules/%{KVERREL}SoC/weak-updates
+%ghost /boot/initrd-%{KVERREL}SoC.img
+%config(noreplace) /etc/modprobe.d/blacklist-firewire
+
+%files SoC-devel
+%defattr(-,root,root)
+%verify(not mtime) /usr/src/kernels/%{KVERREL}-SoC-%{_target_cpu}
+/usr/src/kernels/%{KVERREL}SoC-%{_target_cpu}
+%endif
+
 %if %{with_kdump}
 %if %{with_debuginfo}
 %ifnarch noarch
