]> TLD Linux GIT Repositories - packages/kernel.git/commitdiff
- switched to new build method, release down to 0.1 for now
authorMarcin Krol <hawk@tld-linux.org>
Tue, 10 Jun 2014 13:02:59 +0000 (13:02 +0000)
committerMarcin Krol <hawk@tld-linux.org>
Tue, 10 Jun 2014 13:02:59 +0000 (13:02 +0000)
kernel-module-build.pl [new file with mode: 0644]
kernel-vanilla-autoconf.h [deleted file]
kernel-vanilla-config.h [deleted file]
kernel-vanilla-module-build.pl [deleted file]
kernel-vanilla-small_fixes.patch [deleted file]
kernel-vanilla.spec
kernel.make [new file with mode: 0644]

diff --git a/kernel-module-build.pl b/kernel-module-build.pl
new file mode 100644 (file)
index 0000000..1195bea
--- /dev/null
@@ -0,0 +1,88 @@
+#!/usr/bin/perl
+#
+use strict;
+use warnings;
+use File::Find qw(find);
+
+my $rpmdir = shift @ARGV or die;
+my $fileoutdir = shift @ARGV or die;
+
+# files which match: */include/*/Kbuild
+my @modulebuild_in_include;
+# files which match: */Kbuild */Kconfig except include
+my @modulebuild;
+# parent dirs of Kconfig files which match */include*
+my @dirs_in_include;
+# parent dirs of Kconfig files except include
+my @dirs;
+
+sub push_dirs
+{
+       my $list = shift;
+       my $dir = shift;
+       my $subdir = "";
+       foreach my $sub ( split( '/', $dir )) {
+               $subdir .= "/" . $sub;
+               push @$list, "\%dir $rpmdir$subdir\n";
+       }
+}
+
+sub wanted
+{
+       return unless -f;
+       return unless /^Kconfig/ or /^Makefile/ or /^Kbuild/;
+       #return if /\.orig$/;
+       return if $File::Find::name =~ /Documentation/;
+       (my $file = $File::Find::name) =~ s#^\./##;
+       $file =~ m#^(.*)/#;
+       my $dir = $1 || "";
+       if ( $dir =~ m{^(.*/)?include(/.*?)?$} ) {
+               push @modulebuild_in_include, "$rpmdir/$file\n";
+               push_dirs( \@dirs_in_include, $dir );
+       } else {
+               push @modulebuild, "$rpmdir/$file\n";
+               push_dirs( \@dirs, $dir );
+       }
+}
+
+find(\&wanted, ".");
+
+sub uniq
+{
+       my %hash = map { $_, 1 } @_;
+       return sort keys %hash;
+}
+
+sub remove
+{
+       my $from = shift;
+       my $what = shift;
+       my %hash = map { $_, 1 } @$from;
+       foreach ( @$what ) {
+               delete $hash{ $_ };
+       }
+       return sort keys %hash;
+}
+
+# to module-build add all Kconfig, Makefile and Kbuild files
+# also add all their parent dirs if they aren't parents of some include directory
+open F_OUT, "> $fileoutdir/files.mb_include_modulebuild_and_dirs"
+       or die "Can't create files.mb_include_modulebuild_and_dirs: $!\n";
+print F_OUT remove( \@dirs, \@dirs_in_include );
+print F_OUT uniq( @modulebuild_in_include, @modulebuild );
+close F_OUT and print "files.mb_include_modulebuild_and_dirs created\n";
+
+# from source remove all files Kconfig, Makefile and Kbuild files
+# also remove all their parent dirs
+open F_OUT, "> $fileoutdir/files.source_exclude_modulebuild_and_dirs"
+       or die "Can't create files.source_exclude_modulebuild_and_dirs: $!\n";
+print F_OUT map {"\%exclude $_"} uniq( @modulebuild_in_include, @modulebuild,
+       @dirs_in_include, @dirs );
+close F_OUT and print "files.source_exclude_modulebuild_and_dirs created\n";
+
+# from headers remove all Kconfig, Makefile and Kbuild files that are
+# part of include directory
+open F_OUT, "> $fileoutdir/files.headers_exclude_kbuild"
+       or die "Can't create files.headers_exclude_kbuild: $!\n";
+print F_OUT map {"\%exclude $_"} uniq( @modulebuild_in_include );
+close F_OUT and print "files.headers_exclude_kbuild created\n";
diff --git a/kernel-vanilla-autoconf.h b/kernel-vanilla-autoconf.h
deleted file mode 100644 (file)
index 2f68be0..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#error Runtime kernel config detection not available.
-#error Please use the autoconf-dist.h instead.
diff --git a/kernel-vanilla-config.h b/kernel-vanilla-config.h
deleted file mode 100644 (file)
index 9d1c14f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _LINUX_CONFIG_H
-#define _LINUX_CONFIG_H
-
-#include <linux/autoconf.h>
-
-#endif
diff --git a/kernel-vanilla-module-build.pl b/kernel-vanilla-module-build.pl
deleted file mode 100644 (file)
index 39975f3..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/perl
-#
-use strict;
-use warnings;
-use File::Find qw(find);
-
-my $rpmdir = shift @ARGV or die;
-my $fileoutdir = shift @ARGV or die;
-my @tosort;
-
-find(\&wanted, ".");
-
-sub wanted {
-       return unless -f;
-       return unless /^Kconfig/ or /^Makefile/;
-       #return if /\.orig$/;
-       return if $File::Find::name =~ /(Documentation|scripts)/;
-       (my $file = $File::Find::name) =~ s#^\./##;
-       $file =~ m#^(.*)/#;
-       my $dir = $1 || "";
-       my $subdir = "";
-       foreach my $sub ( split( '/', $dir )) {
-               $subdir .= "/" . $sub;
-               push @tosort, "\%dir $rpmdir$subdir\n";
-       }
-       push @tosort, "$rpmdir/$file\n";
-}
-
-my $last = "";
-my @toprint = grep {if ($_ ne $last) { $last = $_; 1} else {0}} sort @tosort;
-
-open F_OUT, "> $fileoutdir/aux_files" or die "Can't create aux_files: $!\n";
-print F_OUT @toprint;
-close F_OUT and print "aux_files created\n";
-
-open F_OUT, "> $fileoutdir/aux_files_exc" or die "Can't create aux_files_exc: $!\n";
-print F_OUT map {"\%exclude $_"} @toprint;
-close F_OUT and print "aux_files_exc created\n";
diff --git a/kernel-vanilla-small_fixes.patch b/kernel-vanilla-small_fixes.patch
deleted file mode 100644 (file)
index 5f9b9eb..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- linux-2.6.36/scripts/mod/modpost.c.orig    2010-10-20 22:30:22.000000000 +0200
-+++ linux-2.6.36/scripts/mod/modpost.c 2010-10-25 12:22:49.053556168 +0200
-@@ -16,7 +16,8 @@
- #include <ctype.h>
- #include <string.h>
- #include "modpost.h"
--#include "../../include/generated/autoconf.h"
-+// TLD architectures don't use CONFIG_SYMBOL_PREFIX
-+//#include "../../include/generated/autoconf.h"
- #include "../../include/linux/license.h"
- /* Some toolchains use a `_' prefix for all user symbols. */
index ea72d0078cae9c9a8862ac7c8e8caf5c4ae59cd6..a7f98923d06acd29187b45b5d5143974ae3b9eb5 100644 (file)
@@ -1,71 +1,79 @@
 # Conditional build:
-%bcond_without source          # don't build kernel-vanilla-source package
+%bcond_without source          # don't build kernel-source package
+%bcond_without doc             # don't build kernel-doc package
 %bcond_with    verbose         # verbose build (V=1)
 
-%{?debug:%define with_verbose 1}
-
-%define                _basever                3.2
-%define                _postver                .60
-%define                _rel                    1
-
-%define                _enable_debug_packages                  0
+%define                basever         3.2
+%define                postver         60
+%define                rel             0.1
 
 %define                alt_kernel      3.2-vanilla
 
 # kernel release (used in filesystem and eventually in uname -r)
 # modules will be looked from /lib/modules/%{kernel_release}
-# _localversion is just that without version for "> localversion"
-%define                _localversion %{_rel}
-%define                kernel_release %{version}-%{alt_kernel}-%{_localversion}
+# localversion is just that without version for "> localversion"
+%define                localversion    %{rel}
+%define                kernel_release  %{version}%{?alt_kernel:-%{alt_kernel}}-%{localversion}
 
 Summary:       The Linux kernel (the core of the Linux operating system)
 Summary(de.UTF-8):     Der Linux-Kernel (Kern des Linux-Betriebssystems)
 Summary(et.UTF-8):     Linuxi kernel (ehk operatsioonisüsteemi tuum)
 Summary(fr.UTF-8):     Le Kernel-Linux (La partie centrale du systeme)
 Summary(pl.UTF-8):     Jądro Linuksa
-Name:          kernel-%{alt_kernel}
-Version:       %{_basever}%{_postver}
-Release:       %{_rel}
+Name:          kernel%{_alt_kernel}
+Version:       %{basever}.%{postver}
+Release:       %{rel}
 Epoch:         3
 License:       GPL v2
 Group:         Base/Kernel
-Source0:       http://www.kernel.org/pub/linux/kernel/v3.x/linux-%{_basever}.tar.xz
+Source0:       http://www.kernel.org/pub/linux/kernel/v3.x/linux-%{basever}.tar.xz
 # Source0-md5: 364066fa18767ec0ae5f4e4abcf9dc51
-%if "%{_postver}" != "%{nil}"
+%if "%{postver}" != "0"
 Source1:       http://www.kernel.org/pub/linux/kernel/v3.x/patch-%{version}.xz
 # Source1-md5: 6281490378a62e987e5466514e893c9d
 %endif
 
-Source2:       kernel-vanilla-autoconf.h
-Source3:       kernel-vanilla-config.h
-Source4:       kernel-vanilla-module-build.pl
-Source5:       kernel.sysconfig
+Source2:       kernel.sysconfig
+Source3:       kernel-module-build.pl
+Source4:       kernel.make
 
 Source10:      kernel-vanilla-x86.config
 Source11:      kernel-vanilla-x86_64.config
 
-Patch0:                kernel-vanilla-small_fixes.patch
-
 URL:           http://www.kernel.org/
 BuildRequires: binutils >= 3:2.18
 BuildRequires: /sbin/depmod
 BuildRequires: gcc >= 5:3.2
-# for hostname command
-BuildRequires: net-tools
+BuildRequires: xz >= 1:4.999.7
+AutoReqProv:   no
+BuildRequires: hostname
+BuildRequires: kmod
 BuildRequires: perl-base
 BuildRequires: rpm >= 4.5-74
 BuildRequires: rpmbuild(macros) >= 1.652
-BuildRequires: xz >= 1:4.999.7
-Autoreqprov:   no
 Requires(post):        coreutils
 Requires(post):        geninitrd >= 12639-1
-Requires(post):        virtual(module-tools)
+Requires(post):        kmod >= 12-2
 Requires:      /sbin/depmod
 Requires:      coreutils
 Requires:      geninitrd >= 12639-1
-Requires:      virtual(module-tools)
-Obsoletes:     kernel%{_alt_kernel}-firmware
+Requires:      kmod >= 12-2
+%ifarch i686
+Requires:      cpuinfo(pae)
+%endif
+Suggests:      crda
+Suggests:      dracut
+Suggests:      keyutils
+Suggests:      linux-firmware
+Provides:      %{name}(netfilter) = 20070806
+Provides:      %{name}(vermagic) = %{kernel_release}
+Obsoletes:     kernel%{_alt_kernel}-char-lirc-ene0100
+Obsoletes:     kernel%{_alt_kernel}-char-lirc-it87
+Obsoletes:     kernel%{_alt_kernel}-char-lirc-ite8709
+Obsoletes:     kernel%{_alt_kernel}-char-lirc-mceusb
+Obsoletes:     kernel%{_alt_kernel}-char-lirc-streamzap
 Obsoletes:     kernel%{_alt_kernel}-isdn-mISDN
+Obsoletes:     kernel-firmware
 Obsoletes:     kernel-misc-acer_acpi
 Obsoletes:     kernel-misc-fuse
 Obsoletes:     kernel-misc-uvc
@@ -74,10 +82,13 @@ Obsoletes:  kernel-net-ar81
 Obsoletes:     kernel-net-hostap
 Obsoletes:     kernel-net-ieee80211
 Obsoletes:     kernel-net-ipp2p
+Obsoletes:     kernel-net-rt61
 Obsoletes:     kernel-smp
 Conflicts:     e2fsprogs < 1.29
 Conflicts:     isdn4k-utils < 3.1pre1
 Conflicts:     jfsutils < 1.1.3
+Conflicts:     linux-firmware < 20120720
+Conflicts:     lvm2 < 2.02.40
 Conflicts:     module-init-tools < 3.16
 Conflicts:     nfs-utils < 1.0.5
 Conflicts:     oprofile < 0.9
@@ -85,7 +96,8 @@ Conflicts:    ppp < 1:2.4.0
 Conflicts:     procps < 3.2.0
 Conflicts:     quota-tools < 3.09
 Conflicts:     reiserfsprogs < 3.6.3
-Conflicts:     udev < 1:071
+Conflicts:     rpm < 4.4.2-0.2
+Conflicts:     udev < 1:081
 Conflicts:     util-linux < 2.10o
 Conflicts:     xfsprogs < 2.6.0
 ExclusiveArch: i686 x86_64
@@ -98,27 +110,27 @@ BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 %define                target_arch_dir         %{_target_base_arch}
 %endif
 
-%ifarch i686
-%define                kernel_config           x86
-%else
-%define                kernel_config           %{_target_base_arch}
-%endif
-
 %define                defconfig       arch/%{target_arch_dir}/defconfig
 
 # No ELF objects there to strip (skips processing 27k files)
-%define                _noautostrip    .*%{_kernelsrcdir}/.*
+%define                _noautostrip    \\(.*%{_kernelsrcdir}/.*\\|.*/vmlinux.*\\)
 %define                _noautochrpath  .*%{_kernelsrcdir}/.*
+%define                _enable_debug_packages  0
 
 %define                initrd_dir      /boot
 
-%define                _kernelsrcdir   /usr/src/linux-%{version}-%{alt_kernel}
+%define                topdir          %{_builddir}/%{name}-%{version}
+%define                srcdir          %{topdir}/linux-%{basever}
+%define                objdir          %{topdir}/%{targetobj}
+%define                targetobj       %{_target_base_arch}-gcc-%(%{kgcc} -dumpversion)
 
-%if "%{_target_base_arch}" != "%{_arch}"
+%define                _kernelsrcdir   /usr/src/linux%{_alt_kernel}-%{version}
+
+%if "%{_target_base_arch}" != "%{_host_base_arch}"
        %define CrossOpts ARCH=%{_target_base_arch} CROSS_COMPILE=%{_target_cpu}-tld-linux-
        %define DepMod /bin/true
 
-       %if "%{_arch}" == "x86_64" && "%{_target_base_arch}" == "i386"
+       %if "%{_host_base_arch}" == "x86_64" && "%{_target_base_arch}" == "i386"
        %define CrossOpts ARCH=%{_target_base_arch} CC="%{__cc}"
        %define DepMod /sbin/depmod
        %endif
@@ -127,6 +139,7 @@ BuildRoot:  %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
        %define CrossOpts ARCH=%{_target_base_arch} CC="%{__cc}"
        %define DepMod /sbin/depmod
 %endif
+%define MakeOpts %{CrossOpts} HOSTCC="%{__cc}"
 
 %description
 This package contains the Linux kernel that is used to boot and run
@@ -174,7 +187,7 @@ Group:              Base/Kernel
 Requires(postun):      %{name} = %{epoch}:%{version}-%{release}
 Requires:      %{name} = %{epoch}:%{version}-%{release}
 Obsoletes:     kernel-smp-drm
-Autoreqprov:   no
+AutoReqProv:   no
 
 %description drm
 DRM kernel modules.
@@ -195,7 +208,7 @@ Requires:   %{name} = %{epoch}:%{version}-%{release}
 Obsoletes:     kernel-smp-pcmcia
 Conflicts:     pcmcia-cs < 3.1.21
 Conflicts:     pcmciautils < 004
-Autoreqprov:   no
+AutoReqProv:   no
 
 %description pcmcia
 PCMCIA modules.
@@ -214,7 +227,7 @@ Group:              Base/Kernel
 Requires(postun):      %{name} = %{epoch}:%{version}-%{release}
 Requires:      %{name} = %{epoch}:%{version}-%{release}
 Obsoletes:     kernel-smp-sound-alsa
-Autoreqprov:   no
+AutoReqProv:   no
 
 %description sound-alsa
 ALSA (Advanced Linux Sound Architecture) sound drivers.
@@ -233,7 +246,7 @@ Group:              Base/Kernel
 Requires(postun):      %{name} = %{epoch}:%{version}-%{release}
 Requires:      %{name} = %{epoch}:%{version}-%{release}
 Obsoletes:     kernel-smp-sound-oss
-Autoreqprov:   no
+AutoReqProv:   no
 
 %description sound-oss
 OSS (Open Sound System) drivers.
@@ -249,7 +262,8 @@ Summary:    Header files for the Linux kernel
 Summary(de.UTF-8):     Header Dateien für den Linux-Kernel
 Summary(pl.UTF-8):     Pliki nagłówkowe jądra Linuksa
 Group:         Development/Building
-Autoreqprov:   no
+Provides:      %{name}-headers(netfilter) = 20070806
+AutoReqProv:   no
 
 %description headers
 These are the C header files for the Linux kernel, which define
@@ -271,8 +285,8 @@ Summary(de.UTF-8):  Development Dateien die beim Kernel Modul kompilationen gebra
 Summary(pl.UTF-8):     Pliki służące do budowania modułów jądra
 Group:         Development/Building
 Requires:      %{name}-headers = %{epoch}:%{version}-%{release}
-Conflicts:     rpmbuild(macros) < 1.321
-Autoreqprov:   no
+Conflicts:     rpmbuild(macros) < 1.652
+AutoReqProv:   no
 
 %description module-build
 Development files from kernel source tree needed to build Linux kernel
@@ -292,7 +306,7 @@ Summary(de.UTF-8):  Der Kernel Quelltext
 Summary(pl.UTF-8):     Kod źródłowy jądra Linuksa
 Group:         Development/Building
 Requires:      %{name}-module-build = %{epoch}:%{version}-%{release}
-Autoreqprov:   no
+AutoReqProv:   no
 
 %description source
 This is the source code for the Linux kernel. You can build a custom
@@ -322,7 +336,7 @@ Summary:    Kernel documentation
 Summary(de.UTF-8):     Kernel Dokumentation
 Summary(pl.UTF-8):     Dokumentacja do jądra Linuksa
 Group:         Documentation
-Autoreqprov:   no
+AutoReqProv:   no
 
 %description doc
 This is the documentation for the Linux kernel, as found in
@@ -337,169 +351,163 @@ Pakiet zawiera dokumentację do jądra Linuksa pochodzącą z katalogu
 /usr/src/linux/Documentation.
 
 %prep
-%setup -q -n linux-%{_basever}
+%setup -qc
+ln -s %{SOURCE3} kernel-module-build.pl
+ln -s %{SOURCE4} Makefile
+cd linux-%{basever}
 
-%if "%{_postver}" != "%{nil}"
+%if "%{postver}" != "0"
 %{__xz} -dc %{SOURCE1} | patch -p1 -s
 %endif
 
-%patch0 -p1
-
 # Fix EXTRAVERSION in main Makefile
-sed -i 's#EXTRAVERSION =.*#EXTRAVERSION = -%{alt_kernel}#g' Makefile
+sed -i 's#EXTRAVERSION =.*#EXTRAVERSION = %{?alt_kernel:-%{alt_kernel}}#g' Makefile
 
 # cleanup backups after patching
 find '(' -name '*~' -o -name '*.orig' -o -name '.gitignore' ')' -print0 | xargs -0 -r -l512 rm -f
 
 %build
-BuildConfig() {
-       %{?debug:set -x}
-       # is this a special kernel we want to build?
-       Config="%{kernel_config}"
-       KernelVer=%{kernel_release}
-       echo "Building config file using $Config.conf..."
-       cat $RPM_SOURCE_DIR/kernel-vanilla-$Config.config > %{defconfig}
-
-%{?debug:sed -i "s:# CONFIG_DEBUG_SLAB is not set:CONFIG_DEBUG_SLAB=y:" %{defconfig}}
-%{?debug:sed -i "s:# CONFIG_DEBUG_PREEMPT is not set:CONFIG_DEBUG_PREEMPT=y:" %{defconfig}}
-%{?debug:sed -i "s:# CONFIG_RT_DEADLOCK_DETECT is not set:CONFIG_RT_DEADLOCK_DETECT=y:" %{defconfig}}
-
-}
-
-BuildKernel() {
-       %{?debug:set -x}
-       echo "Building kernel $1 ..."
-       %{__make} %CrossOpts mrproper \
-               RCS_FIND_IGNORE='-name build-done -prune -o'
-       ln -sf %{defconfig} .config
-
-       %{__make} %CrossOpts clean \
-               RCS_FIND_IGNORE='-name build-done -prune -o'
-       %{__make} %CrossOpts include/linux/version.h \
-               %{?with_verbose:V=1}
-
-       %{__make} %CrossOpts scripts/mkcompile_h \
-               %{?with_verbose:V=1}
-
-       %{__make} %CrossOpts \
-               %{?with_verbose:V=1}
-}
-
-PreInstallKernel() {
-       Config="%{kernel_config}"
-       KernelVer=%{kernel_release}
-
-       mkdir -p $KERNEL_INSTALL_DIR/boot
-       install System.map $KERNEL_INSTALL_DIR/boot/System.map-$KernelVer
-       install arch/x86/boot/bzImage $KERNEL_INSTALL_DIR/boot/vmlinuz-$KernelVer
-       install vmlinux $KERNEL_INSTALL_DIR/boot/vmlinux-$KernelVer
-
-       %{__make} %CrossOpts modules_install firmware_install \
-               %{?with_verbose:V=1} \
-               DEPMOD=%DepMod \
-               INSTALL_MOD_PATH=$KERNEL_INSTALL_DIR \
-               INSTALL_FW_PATH=$KERNEL_INSTALL_DIR/lib/firmware/$KernelVer \
-               KERNELRELEASE=$KernelVer
-
-       # You'd probabelly want to make it somewhat different
-       install -d $KERNEL_INSTALL_DIR%{_kernelsrcdir}
-       install Module.symvers $KERNEL_INSTALL_DIR%{_kernelsrcdir}/Module.symvers-dist
-
-       echo "CHECKING DEPENDENCIES FOR KERNEL MODULES"
-       if [ %DepMod = /sbin/depmod ]; then
-               /sbin/depmod --basedir $KERNEL_INSTALL_DIR -ae -F $KERNEL_INSTALL_DIR/boot/System.map-$KernelVer -r $KernelVer || :
-       fi
-       touch $KERNEL_INSTALL_DIR/lib/modules/$KernelVer/modules.dep
-       echo "KERNEL RELEASE $KernelVer DONE"
-}
-
-KERNEL_BUILD_DIR=`pwd`
-echo "-%{_localversion}" > localversion
+install -d %{objdir}
+cat > %{targetobj}.mk <<'EOF'
+# generated by %{name}.spec
+KERNELSRC              := %{srcdir}
+KERNELOUTPUT   := %{objdir}
+
+SRCARCH                := %{target_arch_dir}
+ARCH           := %{_target_base_arch}
+Q              := %{!?with_verbose:@}
+MAKE_OPTS      := %{MakeOpts}
+DEFCONFIG   := %{defconfig}
+EOF
+
+cd %{objdir}
+install -d arch/%{target_arch_dir}
+%ifarch i686
+       cat %{SOURCE10} > %{defconfig}
+%endif
+%ifarch x86_64
+       cat %{SOURCE11} > %{defconfig}
+%endif
+sed -i "s:CONFIG_LOCALVERSION=\"\":CONFIG_LOCALVERSION=\"-%{localversion}\":" %{defconfig}
 
-KERNEL_INSTALL_DIR="$KERNEL_BUILD_DIR/build-done/kernel"
-rm -rf $KERNEL_INSTALL_DIR
-BuildConfig
 ln -sf %{defconfig} .config
-BuildKernel
-install -d $KERNEL_INSTALL_DIR%{_kernelsrcdir}/include/generated
-install -d $KERNEL_INSTALL_DIR%{_kernelsrcdir}/include/linux
-install include/generated/autoconf.h \
-       $KERNEL_INSTALL_DIR%{_kernelsrcdir}/include/generated/autoconf-dist.h
-install include/generated/utsrelease.h \
-       $KERNEL_INSTALL_DIR%{_kernelsrcdir}/include/generated/
-install include/linux/version.h \
-       $KERNEL_INSTALL_DIR%{_kernelsrcdir}/include/linux/
-install .config \
-       $KERNEL_INSTALL_DIR%{_kernelsrcdir}/config-dist
-PreInstallKernel
-
-cp scripts/mkcompile_h{,.save}
+cd -
+
+%{__make} \
+       TARGETOBJ=%{targetobj} \
+       %{?with_verbose:V=1} \
+       oldconfig
+
+# build kernel
+%{__make} \
+       TARGETOBJ=%{targetobj} \
+       %{?with_verbose:V=1} \
+       all
 
 %install
 rm -rf $RPM_BUILD_ROOT
-umask 022
+%{__make} %{MakeOpts} -j1 %{!?with_verbose:-s} modules_install firmware_install \
+       -C %{objdir} \
+       %{?with_verbose:V=1} \
+       DEPMOD=%{DepMod} \
+       INSTALL_MOD_PATH=$RPM_BUILD_ROOT \
+       INSTALL_FW_PATH=$RPM_BUILD_ROOT/lib/firmware/%{kernel_release} \
+       KERNELRELEASE=%{kernel_release}
 
-export DEPMOD=%DepMod
+install -d $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/misc
 
-install -d $RPM_BUILD_ROOT%{_kernelsrcdir}
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/%{kernel_release}
-
-# test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
-if cp -al COPYING $RPM_BUILD_ROOT/COPYING 2>/dev/null; then
-       l=l
-       rm -f $RPM_BUILD_ROOT/COPYING
-fi
+# create directories which may be missing, to simplyfy %files
+install -d $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/kernel/{arch,sound,mm}
 
-KERNEL_BUILD_DIR=`pwd`
+# rpm obeys filelinkto checks for ghosted symlinks, convert to files
+rm -f $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/{build,source}
+touch $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/{build,source}
 
-cp -a$l $KERNEL_BUILD_DIR/build-done/kernel/* $RPM_BUILD_ROOT
+# no point embed content for %ghost files. empty them
+for a in \
+       dep{,.bin} \
+       alias{,.bin} \
+       devname \
+       softdep \
+       symbols{,.bin} \
+; do
+       test -f $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/modules.$a
+       > $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/modules.$a
+done
+
+# /boot
+install -d $RPM_BUILD_ROOT/boot
+cp -a %{objdir}/System.map $RPM_BUILD_ROOT/boot/System.map-%{kernel_release}
+cp -aL %{objdir}/.config $RPM_BUILD_ROOT/boot/config-%{kernel_release}
+cp -a %{objdir}/arch/%{target_arch_dir}/boot/bzImage $RPM_BUILD_ROOT/boot/vmlinuz-%{kernel_release}
+install -p %{objdir}/vmlinux $RPM_BUILD_ROOT/boot/vmlinux-%{kernel_release}
 
-if [ -e  $RPM_BUILD_ROOT/lib/modules/%{kernel_release} ] ; then
-       rm -f $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/build
-       ln -sf %{_kernelsrcdir} $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/build
-       install -d $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/{cluster,misc}
-fi
+# ghosted initrd
+touch $RPM_BUILD_ROOT%{initrd_dir}/initrd-%{kernel_release}.img
+touch $RPM_BUILD_ROOT%{initrd_dir}/initramfs-%{kernel_release}.img
 
-find . -maxdepth 1 ! -name "build-done" ! -name "." -exec cp -a$l "{}" "$RPM_BUILD_ROOT%{_kernelsrcdir}/" ";"
+%if "%{_target_base_arch}" != "%{_host_base_arch}"
+touch $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/modules.dep
+%endif
 
-cd $RPM_BUILD_ROOT%{_kernelsrcdir}
+# /etc/modrobe.d
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/%{kernel_release}
 
-%{__make} %CrossOpts mrproper archclean \
-       RCS_FIND_IGNORE='-name build-done -prune -o'
-
-cp -Rdp$l $KERNEL_BUILD_DIR/include/linux/* \
-       $RPM_BUILD_ROOT%{_kernelsrcdir}/include/linux
-
-%{__make} %CrossOpts mrproper
-install -d $RPM_BUILD_ROOT%{_kernelsrcdir}/include/generated
-install -d $RPM_BUILD_ROOT%{_kernelsrcdir}/include/linux
-install $KERNEL_BUILD_DIR/build-done/kernel%{_kernelsrcdir}/include/linux/version.h \
-       $RPM_BUILD_ROOT%{_kernelsrcdir}/include/linux
-install $KERNEL_BUILD_DIR/build-done/kernel%{_kernelsrcdir}/include/generated/autoconf-dist.h \
-       $RPM_BUILD_ROOT%{_kernelsrcdir}/include/generated
-install $KERNEL_BUILD_DIR/build-done/kernel%{_kernelsrcdir}/include/generated/utsrelease.h \
-       $RPM_BUILD_ROOT%{_kernelsrcdir}/include/generated
-install        $KERNEL_BUILD_DIR/build-done/kernel%{_kernelsrcdir}/config-dist \
-       $RPM_BUILD_ROOT%{_kernelsrcdir}
-install %{SOURCE2} $RPM_BUILD_ROOT%{_kernelsrcdir}/include/generated/autoconf.h
-install %{SOURCE3} $RPM_BUILD_ROOT%{_kernelsrcdir}/include/linux/config.h
+install -d $RPM_BUILD_ROOT/etc/sysconfig
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/kernel
 
-# collect module-build files and directories
-perl %{SOURCE4} %{_kernelsrcdir} $KERNEL_BUILD_DIR
+# /usr/src/linux
+install -d $RPM_BUILD_ROOT%{_kernelsrcdir}
 
-# ghosted initrd
-touch $RPM_BUILD_ROOT%{initrd_dir}/initrd-%{kernel_release}.img
-touch $RPM_BUILD_ROOT%{initrd_dir}/initramfs-%{kernel_release}.img
+# test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
+if cp -al %{srcdir}/COPYING $RPM_BUILD_ROOT/COPYING 2>/dev/null; then
+       l=l
+       rm -f $RPM_BUILD_ROOT/COPYING
+fi
 
-# rpm obeys filelinkto checks for ghosted symlinks, convert to files
-rm -f $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/{build,source}
-touch $RPM_BUILD_ROOT/lib/modules/%{kernel_release}/{build,source}
+cp -a$l %{srcdir}/* $RPM_BUILD_ROOT%{_kernelsrcdir}
+cp -a %{objdir}/Module.symvers $RPM_BUILD_ROOT%{_kernelsrcdir}
+cp -aL %{objdir}/.config $RPM_BUILD_ROOT%{_kernelsrcdir}
+cp -a %{objdir}/include $RPM_BUILD_ROOT%{_kernelsrcdir}
+# copy arch/x86/include/generated
+for dir in $(cd %{objdir} && find arch -name generated -type d); do
+       cp -a %{objdir}/$dir $RPM_BUILD_ROOT%{_kernelsrcdir}/$dir
+       find $RPM_BUILD_ROOT%{_kernelsrcdir}/$dir -name '.*.cmd' -exec rm "{}" ";"
+done
 
-# remove unnecessary dir with dead symlink
-rm -rf $RPM_BUILD_ROOT/arch/i386
+# disable this here, causes a lot of build-time problems and our rpm-build disables it anyway
+%{__sed} -i -e 's|\(CONSTIFY_PLUGIN.*:=.*\)|# \1|' $RPM_BUILD_ROOT%{_kernelsrcdir}/Makefile
 
-install -d $RPM_BUILD_ROOT/etc/sysconfig
-install %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/kernel
+# collect module-build files and directories
+# Usage: kernel-module-build.pl $rpmdir $fileoutdir
+fileoutdir=$(pwd)
+cd $RPM_BUILD_ROOT%{_kernelsrcdir}
+%{__perl} %{topdir}/kernel-module-build.pl %{_kernelsrcdir} $fileoutdir
+cd -
+
+for f in `find %{objdir}/scripts -type f -print | grep -v "/\.\|\.o$"` ; do
+       ff=${f##%{objdir}/}
+       if [ -x "$f" ]; then
+               echo "%attr(755,root,root) %{_kernelsrcdir}/$ff" >>files.mb_include_modulebuild_and_dirs
+       else
+               echo "%{_kernelsrcdir}/$ff" >>files.mb_include_modulebuild_and_dirs
+       fi
+       echo "%exclude %{_kernelsrcdir}/$ff" >>files.source_exclude_modulebuild_and_dirs
+       cp -a "$f" "$RPM_BUILD_ROOT%{_kernelsrcdir}/$ff"
+done
+
+%if %{with doc}
+# move to %{_docdir} so we wouldn't depend on any kernel package for dirs
+install -d $RPM_BUILD_ROOT%{_docdir}
+mv $RPM_BUILD_ROOT{%{_kernelsrcdir}/Documentation,%{_docdir}/%{name}-%{version}}
+
+%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/dontdiff
+%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/Makefile
+%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/*/Makefile
+%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/*/*/Makefile
+%else
+%{__rm} -r $RPM_BUILD_ROOT%{_kernelsrcdir}/Documentation
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -516,7 +524,7 @@ fi
 [ -f /etc/sysconfig/kernel ] && . /etc/sysconfig/kernel
 # generate simple initramfs/initrd image
 if [[ "$USE_GENINITRD" != [Nn][Oo] ]]; then
-       /sbin/geninitrd -f %{initrd_dir}/initrd-%{kernel_release}.img %{kernel_release}
+       /sbin/geninitrd -f --initrdfs=initramfs %{initrd_dir}/initrd-%{kernel_release}.img %{kernel_release}
 fi
 
 # if dracut is present then generate full-featured initramfs
@@ -524,16 +532,15 @@ if [[ "$USE_DRACUT" != [Nn][Oo] ]] && [ -x /sbin/dracut ]; then
        /sbin/dracut --force --quiet /boot/initramfs-%{kernel_release}.img %{kernel_release}
 fi
 
-# update boot loader
+# update boot loaders
 if [ -x /sbin/update-grub -a -f /etc/sysconfig/grub ]; then
        if [ "$(. /etc/sysconfig/grub; echo ${UPDATE_GRUB:-yes})" = "yes" ]; then
                /sbin/update-grub >/dev/null
        fi
 fi
 if [ -x /sbin/new-kernel-pkg ]; then
-       /sbin/new-kernel-pkg --initrdfile=%{initrd_dir}/initrd-%{kernel_release}.img --install %{kernel_release} --banner "TLD Linux %{alt_kernel}"
+       /sbin/new-kernel-pkg --initrdfile=%{initrd_dir}/initrd-%{kernel_release}.img --install %{kernel_release} --banner "TLD Linux%{?alt_kernel: %{alt_kernel}}"
 fi
-
 if [ -x /sbin/rc-boot ]; then
        /sbin/rc-boot 1>&2 || :
 fi
@@ -563,13 +570,13 @@ fi
 %depmod %{kernel_release}
 
 %post headers
-ln -snf %{basename:%{_kernelsrcdir}} %{_prefix}/src/linux-%{alt_kernel}
+ln -snf %{basename:%{_kernelsrcdir}} %{_prefix}/src/linux%{_alt_kernel}
 
 %postun headers
 if [ "$1" = "0" ]; then
-       if [ -L %{_prefix}/src/linux-%{alt_kernel} ]; then
-               if [ "$(readlink %{_prefix}/src/linux-%{alt_kernel})" = "linux-%{version}-%{alt_kernel}" ]; then
-                       rm -f %{_prefix}/src/linux-%{alt_kernel}
+       if [ -L %{_prefix}/src/linux%{_alt_kernel} ]; then
+               if [ "$(readlink %{_prefix}/src/linux%{_alt_kernel})" = "linux%{_alt_kernel}-%{version}" ]; then
+                       rm -f %{_prefix}/src/linux%{_alt_kernel}
                fi
        fi
 fi
@@ -588,45 +595,33 @@ fi
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/kernel
 /boot/vmlinuz-%{kernel_release}
 /boot/System.map-%{kernel_release}
+/boot/config-%{kernel_release}
 %ghost %{initrd_dir}/initrd-%{kernel_release}.img
 %ghost %{initrd_dir}/initramfs-%{kernel_release}.img
 /lib/firmware/%{kernel_release}
+
 %dir /lib/modules/%{kernel_release}
 %dir /lib/modules/%{kernel_release}/kernel
 /lib/modules/%{kernel_release}/kernel/arch
 /lib/modules/%{kernel_release}/kernel/crypto
 /lib/modules/%{kernel_release}/kernel/drivers
-
-%exclude /lib/modules/%{kernel_release}/kernel/drivers/gpu/drm
-
+%exclude /lib/modules/%{kernel_release}/kernel/drivers/gpu
 /lib/modules/%{kernel_release}/kernel/fs
 /lib/modules/%{kernel_release}/kernel/kernel
 /lib/modules/%{kernel_release}/kernel/lib
-
-%ifarch x86_64
-/lib/modules/%{kernel_release}/kernel/mm
-%endif
-
 /lib/modules/%{kernel_release}/kernel/net
-
+/lib/modules/%{kernel_release}/kernel/mm
 %dir /lib/modules/%{kernel_release}/kernel/sound
 /lib/modules/%{kernel_release}/kernel/sound/ac97_bus.ko*
 /lib/modules/%{kernel_release}/kernel/sound/sound*.ko*
-%exclude /lib/modules/%{kernel_release}/kernel/drivers/media/video/cx88/cx88-alsa.ko*
-%exclude /lib/modules/%{kernel_release}/kernel/drivers/media/video/em28xx/em28xx-alsa.ko*
-%exclude /lib/modules/%{kernel_release}/kernel/drivers/media/video/saa7134/saa7134-alsa.ko*
-
 %dir /lib/modules/%{kernel_release}/misc
-
-%dir /lib/modules/%{kernel_release}/kernel/drivers/pcmcia
-/lib/modules/%{kernel_release}/kernel/drivers/pcmcia/pcmcia*ko*
 %exclude /lib/modules/%{kernel_release}/kernel/drivers/pcmcia/[!p]*
 %exclude /lib/modules/%{kernel_release}/kernel/drivers/pcmcia/pd6729.ko*
 %exclude /lib/modules/%{kernel_release}/kernel/drivers/*/pcmcia
 %exclude /lib/modules/%{kernel_release}/kernel/drivers/ata/pata_pcmcia.ko*
 %exclude /lib/modules/%{kernel_release}/kernel/drivers/bluetooth/*_cs.ko*
 %exclude /lib/modules/%{kernel_release}/kernel/drivers/isdn/hardware/avm/avm_cs.ko*
-%exclude /lib/modules/%{kernel_release}/kernel/drivers/telephony/ixj_pcmcia.ko*
+%exclude /lib/modules/%{kernel_release}/kernel/drivers/isdn/hardware/avm/b1pcmcia.ko*
 %exclude /lib/modules/%{kernel_release}/kernel/drivers/usb/gadget/g_midi.ko*
 %exclude /lib/modules/%{kernel_release}/kernel/drivers/ide/ide-cs.ko*
 %exclude /lib/modules/%{kernel_release}/kernel/drivers/net/wireless/*_cs.ko*
@@ -635,14 +630,27 @@ fi
 %exclude /lib/modules/%{kernel_release}/kernel/drivers/net/wireless/libertas/*_cs.ko*
 %exclude /lib/modules/%{kernel_release}/kernel/drivers/parport/parport_cs.ko*
 %exclude /lib/modules/%{kernel_release}/kernel/drivers/usb/host/sl811_cs.ko*
-
 /lib/modules/%{kernel_release}/kernel/security
 
-%ghost /lib/modules/%{kernel_release}/modules.*
+%dir %{_sysconfdir}/modprobe.d/%{kernel_release}
+
+# provided by build
+/lib/modules/%{kernel_release}/modules.order
+/lib/modules/%{kernel_release}/modules.builtin*
+
+# rest modules.* are ghost (regenerated by post depmod -a invocation)
+%ghost /lib/modules/%{kernel_release}/modules.alias
+%ghost /lib/modules/%{kernel_release}/modules.alias.bin
+%ghost /lib/modules/%{kernel_release}/modules.dep
+%ghost /lib/modules/%{kernel_release}/modules.dep.bin
+%ghost /lib/modules/%{kernel_release}/modules.devname
+%ghost /lib/modules/%{kernel_release}/modules.softdep
+%ghost /lib/modules/%{kernel_release}/modules.symbols
+%ghost /lib/modules/%{kernel_release}/modules.symbols.bin
+
 # symlinks pointing to kernelsrcdir
 %ghost /lib/modules/%{kernel_release}/build
 %ghost /lib/modules/%{kernel_release}/source
-%dir %{_sysconfdir}/modprobe.d/%{kernel_release}
 
 %files vmlinux
 %defattr(644,root,root,755)
@@ -650,16 +658,16 @@ fi
 
 %files drm
 %defattr(644,root,root,755)
-/lib/modules/%{kernel_release}/kernel/drivers/gpu/drm
+/lib/modules/%{kernel_release}/kernel/drivers/gpu
 
 %files pcmcia
 %defattr(644,root,root,755)
-%exclude /lib/modules/%{kernel_release}/kernel/drivers/pcmcia/pcmcia*ko*
 /lib/modules/%{kernel_release}/kernel/drivers/pcmcia/*ko*
 /lib/modules/%{kernel_release}/kernel/drivers/*/pcmcia
+%exclude /lib/modules/%{kernel_release}/kernel/drivers/pcmcia/pcmcia*ko*
 /lib/modules/%{kernel_release}/kernel/drivers/bluetooth/*_cs.ko*
 /lib/modules/%{kernel_release}/kernel/drivers/isdn/hardware/avm/avm_cs.ko*
-/lib/modules/%{kernel_release}/kernel/drivers/telephony/ixj_pcmcia.ko*
+/lib/modules/%{kernel_release}/kernel/drivers/isdn/hardware/avm/b1pcmcia.ko*
 /lib/modules/%{kernel_release}/kernel/drivers/ata/pata_pcmcia.ko*
 /lib/modules/%{kernel_release}/kernel/drivers/ide/ide-cs.ko*
 /lib/modules/%{kernel_release}/kernel/drivers/net/wireless/*_cs.ko*
@@ -677,15 +685,12 @@ fi
 %exclude /lib/modules/%{kernel_release}/kernel/sound/sound*.ko*
 %exclude /lib/modules/%{kernel_release}/kernel/sound/oss
 /lib/modules/%{kernel_release}/kernel/drivers/usb/gadget/g_midi.ko*
-/lib/modules/%{kernel_release}/kernel/drivers/media/video/cx88/cx88-alsa.ko*
-/lib/modules/%{kernel_release}/kernel/drivers/media/video/em28xx/em28xx-alsa.ko*
-/lib/modules/%{kernel_release}/kernel/drivers/media/video/saa7134/saa7134-alsa.ko*
 
 %files sound-oss
 %defattr(644,root,root,755)
 /lib/modules/%{kernel_release}/kernel/sound/oss
 
-%files headers
+%files headers -f files.headers_exclude_kbuild
 %defattr(644,root,root,755)
 %dir %{_kernelsrcdir}
 %{_kernelsrcdir}/include
@@ -695,53 +700,70 @@ fi
 %dir %{_kernelsrcdir}/security
 %dir %{_kernelsrcdir}/security/selinux
 %{_kernelsrcdir}/security/selinux/include
-%{_kernelsrcdir}/config-dist
-%{_kernelsrcdir}/Module.symvers-dist
+%{_kernelsrcdir}/.config
+%{_kernelsrcdir}/Module.symvers
 
-%files module-build -f aux_files
+%files module-build -f files.mb_include_modulebuild_and_dirs
 %defattr(644,root,root,755)
-# symlinks pointint to kernelsrcdir
-%dir /lib/modules/%{kernel_release}
-/lib/modules/%{kernel_release}/build
-%{_kernelsrcdir}/Kbuild
-%{_kernelsrcdir}/localversion
+%exclude %dir %{_kernelsrcdir}/arch/um
 %{_kernelsrcdir}/arch/*/kernel/asm-offsets*
 %{_kernelsrcdir}/arch/*/kernel/sigframe*.h
-%{_kernelsrcdir}/arch/x86/tools/relocs.c
 %{_kernelsrcdir}/drivers/lguest/lg.h
 %{_kernelsrcdir}/kernel/bounds.c
-%dir %{_kernelsrcdir}/scripts
-%dir %{_kernelsrcdir}/scripts/kconfig
-%{_kernelsrcdir}/scripts/Kbuild.include
-%{_kernelsrcdir}/scripts/Makefile*
-%{_kernelsrcdir}/scripts/basic
+%{_kernelsrcdir}/scripts/basic/*.c
+%attr(755,root,root) %{_kernelsrcdir}/scripts/kconfig/*.sh
+%{_kernelsrcdir}/scripts/kconfig/*.in
+%{_kernelsrcdir}/scripts/kconfig/*_shipped
+%{_kernelsrcdir}/scripts/kconfig/*.pl
+%{_kernelsrcdir}/scripts/kconfig/*.glade
+%{_kernelsrcdir}/scripts/kconfig/*.gperf
+%{_kernelsrcdir}/scripts/kconfig/*.cc
+%{_kernelsrcdir}/scripts/kconfig/*.y
+%{_kernelsrcdir}/scripts/kconfig/*.l
+%{_kernelsrcdir}/scripts/kconfig/[c-k]*.c
+%{_kernelsrcdir}/scripts/kconfig/[c-k]*.h
+%{_kernelsrcdir}/scripts/kconfig/l*.h
+%{_kernelsrcdir}/scripts/kconfig/[m-u]*.c
+%{_kernelsrcdir}/scripts/kconfig/[m-u]*.h
+%{_kernelsrcdir}/scripts/kconfig/lxdialog
+%{_kernelsrcdir}/scripts/mod/*.c
+%{_kernelsrcdir}/scripts/mod/[^e]*.h
+%attr(755,root,root) %{_kernelsrcdir}/scripts/mkcompile_h
 %{_kernelsrcdir}/scripts/mkmakefile
-%{_kernelsrcdir}/scripts/mod
 %{_kernelsrcdir}/scripts/module-common.lds
-%{_kernelsrcdir}/scripts/setlocalversion
+%attr(755,root,root) %{_kernelsrcdir}/scripts/setlocalversion
 %{_kernelsrcdir}/scripts/*.c
-%{_kernelsrcdir}/scripts/*.sh
-%{_kernelsrcdir}/scripts/kconfig/*
-%{_kernelsrcdir}/scripts/mkcompile_h
-%dir %{_kernelsrcdir}/scripts/selinux
-%{_kernelsrcdir}/scripts/selinux/Makefile
-%dir %{_kernelsrcdir}/scripts/selinux/mdp
-%dir %{_kernelsrcdir}/scripts/selinux/genheaders
-%{_kernelsrcdir}/scripts/selinux/mdp/Makefile
-%{_kernelsrcdir}/scripts/selinux/mdp/*.c
-%{_kernelsrcdir}/scripts/selinux/genheaders/Makefile
+%attr(755,root,root) %{_kernelsrcdir}/scripts/*.sh
 %{_kernelsrcdir}/scripts/selinux/genheaders/*.c
+%{_kernelsrcdir}/scripts/selinux/mdp/*.c
+%exclude %dir %{_kernelsrcdir}/security
+%exclude %dir %{_kernelsrcdir}/security/selinux
 
+%if %{with doc}
 %files doc
 %defattr(644,root,root,755)
-%dir %{_kernelsrcdir}
-%{_kernelsrcdir}/Documentation
+%dir %{_docdir}/%{name}-%{version}
+
+%{_docdir}/%{name}-%{version}/[!jkz]*
+%{_docdir}/%{name}-%{version}/[jkz]*.txt
+%{_docdir}/%{name}-%{version}/kbuild
+%{_docdir}/%{name}-%{version}/kdump
+%lang(ja) %{_docdir}/%{name}-%{version}/ja_JP
+%lang(ko) %{_docdir}/%{name}-%{version}/ko_KR
+%lang(zh_CN) %{_docdir}/%{name}-%{version}/zh_CN
+%endif
 
 %if %{with source}
-%files source -f aux_files_exc
+%files source -f files.source_exclude_modulebuild_and_dirs
 %defattr(644,root,root,755)
-%{_kernelsrcdir}/arch/*/[!Mk]*
+%{_kernelsrcdir}/arch/*/[!Mik]*
 %{_kernelsrcdir}/arch/*/kernel/[!M]*
+%{_kernelsrcdir}/arch/ia64/install.sh
+%{_kernelsrcdir}/arch/m68k/ifpsp060/[!M]*
+%{_kernelsrcdir}/arch/m68k/ifpsp060/MISC
+%{_kernelsrcdir}/arch/m68k/install.sh
+%{_kernelsrcdir}/arch/parisc/install.sh
+%{_kernelsrcdir}/arch/x86/ia32/[!M]*
 %{_kernelsrcdir}/arch/ia64/kvm
 %{_kernelsrcdir}/arch/powerpc/kvm
 %{_kernelsrcdir}/arch/s390/kvm
@@ -761,26 +783,36 @@ fi
 %{_kernelsrcdir}/lib
 %{_kernelsrcdir}/mm
 %{_kernelsrcdir}/net
+%{_kernelsrcdir}/virt
 %{_kernelsrcdir}/samples
 %{_kernelsrcdir}/scripts/*
 %exclude %{_kernelsrcdir}/scripts/Kbuild.include
 %exclude %{_kernelsrcdir}/scripts/Makefile*
 %exclude %{_kernelsrcdir}/scripts/basic
 %exclude %{_kernelsrcdir}/scripts/kconfig
+%exclude %{_kernelsrcdir}/scripts/mkcompile_h
 %exclude %{_kernelsrcdir}/scripts/mkmakefile
 %exclude %{_kernelsrcdir}/scripts/mod
+%exclude %{_kernelsrcdir}/scripts/module-common.lds
 %exclude %{_kernelsrcdir}/scripts/setlocalversion
 %exclude %{_kernelsrcdir}/scripts/*.c
 %exclude %{_kernelsrcdir}/scripts/*.sh
+%exclude %dir %{_kernelsrcdir}/scripts/selinux
+%exclude %{_kernelsrcdir}/scripts/selinux/Makefile
+%exclude %dir %{_kernelsrcdir}/scripts/selinux/genheaders
+%exclude %{_kernelsrcdir}/scripts/selinux/genheaders/Makefile
+%exclude %{_kernelsrcdir}/scripts/selinux/genheaders/*.c
+%exclude %dir %{_kernelsrcdir}/scripts/selinux/mdp
+%exclude %{_kernelsrcdir}/scripts/selinux/mdp/Makefile
+%exclude %{_kernelsrcdir}/scripts/selinux/mdp/*.c
 %{_kernelsrcdir}/sound
 %{_kernelsrcdir}/security
-%{_kernelsrcdir}/tools
+%exclude %{_kernelsrcdir}/security/selinux/include
+%{_kernelsrcdir}/tools/*
 %{_kernelsrcdir}/usr
-%{_kernelsrcdir}/virt
 %{_kernelsrcdir}/COPYING
 %{_kernelsrcdir}/CREDITS
 %{_kernelsrcdir}/MAINTAINERS
 %{_kernelsrcdir}/README
 %{_kernelsrcdir}/REPORTING-BUGS
-%{_kernelsrcdir}/.mailmap
 %endif
diff --git a/kernel.make b/kernel.make
new file mode 100644 (file)
index 0000000..0e04986
--- /dev/null
@@ -0,0 +1,10 @@
+MAKE_OPTS :=
+
+include $(TARGETOBJ).mk
+
+all := $(filter-out all Makefile,$(MAKECMDGOALS))
+
+all $(all):
+       $(MAKE) -C $(KERNELSRC) O=$(KERNELOUTPUT) $(MAKE_OPTS) $(all)
+
+# vim:ft=make