Hello community,

here is the log from the commit of package kernel-source.5227 for 
openSUSE:13.2:Update checked in at 2016-08-24 11:48:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.2:Update/kernel-source.5227 (Old)
 and      /work/SRC/openSUSE:13.2:Update/.kernel-source.5227.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kernel-source.5227"

Changes:
--------
New Changes file:

--- /dev/null   2016-07-07 10:01:34.856033756 +0200
+++ /work/SRC/openSUSE:13.2:Update/.kernel-source.5227.new/kernel-debug.changes 
2016-08-24 11:48:30.000000000 +0200
@@ -0,0 +1,38136 @@
+-------------------------------------------------------------------
+Tue Jun 28 13:34:19 CEST 2016 - ti...@suse.de
+
+- ALSA: compress: fix an integer overflow check
+  (CVE-2014-9904,bsc#986811).
+- commit d2f1ca8
+
+-------------------------------------------------------------------
+Mon Jun 27 15:34:11 CEST 2016 - jkos...@suse.cz
+
+- HID: hiddev: validate num_values for HIDIOCGUSAGES,
+  HIDIOCSUSAGES commands (bsc#986572 CVE-2016-5829).
+- commit a10f096
+
+-------------------------------------------------------------------
+Mon Jun 27 11:47:17 CEST 2016 - mkube...@suse.cz
+
+- netfilter: x_tables: don't reject valid target size on some
+  architectures (CVE-2016-4997 bsc#986362).
+- commit e02780f
+
+-------------------------------------------------------------------
+Mon Jun 27 09:06:51 CEST 2016 - mkube...@suse.cz
+
+- netfilter: x_tables: do compat validation via translate_table
+  (CVE-2016-4997 bsc#986362).
+- kabi: revert xt_compat_match_from_user signature change
+  (CVE-2016-4997 bsc#986362).
+- netfilter: x_tables: xt_compat_match_from_user doesn't need
+  a retval (CVE-2016-4997 bsc#986362).
+- netfilter: arp_tables: simplify translate_compat_table args
+  (CVE-2016-4997 bsc#986362).
+- netfilter: ip6_tables: simplify translate_compat_table args
+  (CVE-2016-4997 bsc#986362).
+- netfilter: ip_tables: simplify translate_compat_table args
+  (CVE-2016-4997 bsc#986362).
+- netfilter: x_tables: validate all offsets and sizes in a rule
+  (CVE-2016-4997 bsc#986362).
+- netfilter: x_tables: check for bogus target offset
+  (CVE-2016-4997 bsc#986362).
+- netfilter: x_tables: check standard target size too
+  (CVE-2016-4997 bsc#986362).
+- netfilter: x_tables: add compat version of
+  xt_check_entry_offsets (CVE-2016-4997 bsc#986362).
+- netfilter: x_tables: assert minimum target size (CVE-2016-4997
+  bsc#986362).
+- netfilter: x_tables: kill check_entry helper (CVE-2016-4997
+  bsc#986362).
+- netfilter: x_tables: add and use xt_check_entry_offsets
+  (CVE-2016-4997 bsc#986362).
+- netfilter: x_tables: validate targets of jumps (CVE-2016-4997
+  bsc#986362).
+- netfilter: x_tables: don't move to non-existent next rule
+  (CVE-2016-4997 bsc#986362).
+- commit 5f8bb12
+
+-------------------------------------------------------------------
+Thu Jun 23 09:02:06 CEST 2016 - jbeul...@suse.com
+
+- Refresh patches.xen/xen-netback-coalesce: Restore copying of
+  SKBs with head exceeding page size (bsc#978469).
+- commit a90e80d
+
+-------------------------------------------------------------------
+Thu Jun 23 09:00:42 CEST 2016 - jbeul...@suse.com
+
+- Refresh patches.xen/xen3-patch-3.14: Suppress atomic file
+  position updates on /proc/xen/xenbus (bsc#970275).
+- commit 9873c47
+
+-------------------------------------------------------------------
+Thu Jun 23 08:58:25 CEST 2016 - jbeul...@suse.com
+
+- Refresh patches.xen/xen3-patch-2.6.39: Fix ia32_compat
+  inheritance.
+- Refresh
+  patches.xen/xen3-01-x86-ldt-make-modify_ldt-synchronous.patch.
+- commit 19ee144
+
+-------------------------------------------------------------------
+Thu Jun 23 08:56:57 CEST 2016 - jbeul...@suse.com
+
+- Refresh patches.xen/xen3-patch-2.6.26: Fix PAT initialization.
+- commit d73e34d
+
+-------------------------------------------------------------------
+Tue Jun 21 11:24:46 CEST 2016 - mkube...@suse.cz
+
+- ppp: take reference on channels netns (CVE-2016-4805
+  bsc#980371).
+- commit 05ea398
+
+-------------------------------------------------------------------
+Tue Jun 21 08:20:31 CEST 2016 - j...@suse.com
+
+- KEYS: potential uninitialized variable (bsc#984755,
+  CVE-2016-4470).
+- commit 8e5cd70
+
+-------------------------------------------------------------------
+Wed Jun 15 16:12:39 CEST 2016 - d...@suse.de
+
+- powerpc/perf: Cap 64bit userspace backtraces to
+  PERF_MAX_STACK_DEPTH (bsc#942702 / CVE-2015-6526).
+- commit 0e5222b
+
+-------------------------------------------------------------------
+Tue Jun 14 09:13:23 CEST 2016 - mkube...@suse.cz
+
+- ipvs: count pre-established TCP states as active (bsc#970114).
+- commit 4bb5316
+
+-------------------------------------------------------------------
+Mon Jun 13 16:08:18 CEST 2016 - oneu...@suse.com
+
+- usb: quirk to stop runtime PM for Intel 7260 (bnc#984464).
+- commit 9898bdc
+
+-------------------------------------------------------------------
+Fri Jun 10 16:42:20 CEST 2016 - b...@suse.de
+
+- rds: fix an infoleak in rds_inc_info_copy (bsc#983213
+  CVE-2016-5244).
+- commit 7890cce
+
+-------------------------------------------------------------------
+Thu Jun  9 16:22:02 CEST 2016 - je...@suse.com
+
+- ecryptfs: don't allow mmap when the lower file system doesn't
+  allow it (bsc#983143 CVE-2016-1583).
+- commit 5f448f7
+
+-------------------------------------------------------------------
+Thu Jun  9 15:43:24 CEST 2016 - jkos...@suse.cz
+
+- Refresh
+   patches.drivers/pstore_disable_efi_backend_by_default.patch.
+  pstore_register() error handling is wrong -- it tries to release
+  lock before it's acquired, causing spinlock / preemption imbalance.
+- commit a51e4df
+
+-------------------------------------------------------------------
+Tue Jun  7 15:44:21 CEST 2016 - je...@suse.com
+
+- get_rock_ridge_filename(): handle malformed NM entries
+  (bsc#980725 CVE-2016-4913).
+- commit 720eee3
+
+-------------------------------------------------------------------
+Mon Jun  6 10:48:24 CEST 2016 - mkube...@suse.cz
+
+- ipv4/fib: don't warn when primary address is missing if in_dev
+  is dead (bsc#971360).
+- commit ed1949c
+
+-------------------------------------------------------------------
+Mon Jun  6 10:33:58 CEST 2016 - mkube...@suse.cz
+
+- enic: set netdev->vlan_features (bsc#966245).
+- commit 4428f6e
+
+-------------------------------------------------------------------
+Thu Jun  2 11:21:30 CEST 2016 - oneu...@suse.com
+
+- Subject:    [PATCH] USB: xhci: Add broken streams quirk for
+  Frescologic device id 1009  (bnc#982706).
+- commit ee246d0
+
+-------------------------------------------------------------------
+Tue May 31 11:42:04 CEST 2016 - ti...@suse.de
+
+- net: fix a kernel infoleak in x25 module
+  (CVE-2016-4580,bsc#981267).
+- commit 898ac99
+
+-------------------------------------------------------------------
+Fri May 27 11:17:15 CEST 2016 - j...@suse.com
+
+- KEYS: Fix ASN.1 indefinite length object parsing (bsc#979867,
+  CVE-2016-0758).
+- ASN.1: Fix non-match detection failure on data overrun
+  (bsc#963762, CVE-2016-2053).
+- commit 7c2db96
+
+-------------------------------------------------------------------
+Tue May 24 16:29:03 CEST 2016 - oneu...@suse.com
+
+- [media] usbvision: fix crash on detecting device with invalid
+  configuration (bnc#950998, CVE-2015-7833).
+- commit ab9ac4b
+
+-------------------------------------------------------------------
+Thu May 19 13:32:24 CEST 2016 - oneu...@suse.com
+
+- Input: gtco - fix crash on detecting device without endpoints
+  (bnc#971944, CVE-2016-2187).
+- Input: gtco - use sign_extend32() for sign extension
++++ 37939 more lines (skipped)
++++ between /dev/null
++++ and 
/work/SRC/openSUSE:13.2:Update/.kernel-source.5227.new/kernel-debug.changes
New Changes file:

kernel-default.changes: same change
New Changes file:

kernel-desktop.changes: same change
New Changes file:

kernel-docs.changes: same change
New Changes file:

kernel-ec2.changes: same change
New Changes file:

kernel-lpae.changes: same change
New Changes file:

kernel-obs-build.changes: same change
New Changes file:

kernel-obs-qa-xen.changes: same change
New Changes file:

kernel-obs-qa.changes: same change
New Changes file:

kernel-pae.changes: same change
New Changes file:

kernel-source.changes: same change
New Changes file:

kernel-syms.changes: same change
New Changes file:

kernel-vanilla.changes: same change
New Changes file:

kernel-xen.changes: same change

New:
----
  README.KSYMS
  README.PATCH-POLICY.SUSE
  README.SUSE
  _constraints
  apply-patches
  arch-symbols
  check-for-config-changes
  compress-vmlinux.sh
  compute-PATCHVERSION.sh
  config-options.changes.txt
  config.addon.tar.bz2
  config.conf
  config.sh
  config.tar.bz2
  configtool.pl
  constraints.in
  devel-post.sh
  devel-pre.sh
  find-provides
  group-source-files.pl
  guards
  host-memcpy-hack.h
  kabi.pl
  kabi.tar.bz2
  kernel-binary.spec.in
  kernel-cert-subpackage
  kernel-debug.changes
  kernel-debug.spec
  kernel-default.changes
  kernel-default.spec
  kernel-desktop.changes
  kernel-desktop.spec
  kernel-docs.changes
  kernel-docs.spec
  kernel-docs.spec.in
  kernel-ec2.changes
  kernel-ec2.spec
  kernel-lpae.changes
  kernel-lpae.spec
  kernel-module-subpackage
  kernel-obs-build.changes
  kernel-obs-build.spec
  kernel-obs-build.spec.in
  kernel-obs-qa-xen.changes
  kernel-obs-qa-xen.spec
  kernel-obs-qa.changes
  kernel-obs-qa.spec
  kernel-obs-qa.spec.in
  kernel-pae.changes
  kernel-pae.spec
  kernel-source.changes
  kernel-source.rpmlintrc
  kernel-source.spec
  kernel-source.spec.in
  kernel-spec-macros
  kernel-syms.changes
  kernel-syms.spec
  kernel-syms.spec.in
  kernel-vanilla.changes
  kernel-vanilla.spec
  kernel-xen.changes
  kernel-xen.spec
  linux-3.16.tar.xz
  log.sh
  macros.kernel-source
  mkspec
  modversions
  old-flavors
  package-descriptions
  patches.addon.tar.bz2
  patches.apparmor.tar.bz2
  patches.arch.tar.bz2
  patches.drivers.tar.bz2
  patches.fixes.tar.bz2
  patches.kabi.tar.bz2
  patches.kernel.org.tar.bz2
  patches.rpmify.tar.bz2
  patches.rt.tar.bz2
  patches.suse.tar.bz2
  patches.trace.tar.bz2
  patches.xen.tar.bz2
  post.sh
  postun.sh
  pre.sh
  preun.sh
  series.conf
  source-post.sh
  source-timestamp
  split-modules
  supported.conf
  sysctl.tar.bz2
  try-disable-staging-driver

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kernel-debug.spec ++++++
++++ 1095 lines (skipped)

kernel-default.spec: same change
kernel-desktop.spec: same change
++++++ kernel-docs.spec ++++++
#
# spec file for package kernel-docs
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define patchversion 3.16.7
%define variant %{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-docs
Summary:        Kernel Documentation
License:        GPL-2.0
Group:          Documentation/Man
Version:        3.16.7
Release:        0
%if 0%{?is_kotd}
%else
%endif
BuildRequires:  kernel-source%variant
BuildRequires:  xmlto
Url:            http://www.kernel.org/
Provides:       %name = %version-%source_rel
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source:         kernel-spec-macros

%description
These are the man pages (section 9) built from the current kernel sources.

%source_timestamp
%prep
%setup -T -c

%build
export LANG=en_US
make -C /usr/src/linux%variant O=$PWD mandocs %{?jobs:-j%jobs}

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/%{_mandir}/man9
# filter out obscure device drivers - they clutter up the rpm and don't add any 
real value
find Documentation/DocBook/ -name '*.9.gz' | 
egrep -v 
'man/(sis[69]|rio|fsl|struct_rio|RIO|mpc85|set_rx_mode|mdio_(read|write)|mii_ioctl|mca_|z8530|nand|sppp|piix|(read|write)_zs)'
 |  
while read i ; do
        cp $i $RPM_BUILD_ROOT/%{_mandir}/man9
done
if [ -d Documentation/kdb ] ; then
    for i in Documentation/kdb/*.m* ; do
        k=`basename $i`
        k=${k/man/9}
        k=${k/mm/9}
        cp $i $RPM_BUILD_ROOT/%{_mandir}/man9/$k
    done
fi

ln -s /usr/share/man/man9/request_threaded_irq.9.gz 
$RPM_BUILD_ROOT/usr/share/man/man9/request_irq.9.gz

cp -a 
/usr/src/linux%variant/{COPYING,CREDITS,MAINTAINERS,README,REPORTING-BUGS} .

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc COPYING CREDITS MAINTAINERS README REPORTING-BUGS
%{_mandir}/man9/*

%changelog
++++++ kernel-ec2.spec ++++++
++++ 1085 lines (skipped)

kernel-lpae.spec: same change
++++++ kernel-obs-build.spec ++++++
#
# spec file for package kernel-obs-build
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# needsrootforbuild


#!BuildIgnore: post-build-checks

%define patchversion 3.16.7
%define variant %{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-obs-build
BuildRequires:  coreutils
BuildRequires:  device-mapper
BuildRequires:  util-linux

BuildRequires:  kernel-default
%ifarch %ix86 x86_64
BuildRequires:  kernel-xen
%endif
ExclusiveArch:  aarch64 armv6hl armv7hl %ix86 ppc64 ppc64le s390x x86_64
%if 0%{?suse_version} < 1315
# For SLE 11 
BuildRequires:  mkinitrd
BuildRequires:  perl-Bootloader
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%else
BuildRequires:  dracut
%endif
Summary:        package kernel and initrd for OBS VM builds
License:        GPL-2.0
Group:          SLES
Version:        3.16.7
Release:        0
%if 0%{?is_kotd}
%else
%endif

%description
This package is repackaging already compiled kernels to make them usable
inside of Open Build Service (OBS) VM builds. An initrd with some basic
kernel modules is generated as well, but further kernel modules can be 
loaded during build when installing the kernel package.

%prep

%build
mkdir -p /usr/lib/dracut/modules.d/80obs
cat > /usr/lib/dracut/modules.d/80obs/module-setup.sh <<EOF
#!/bin/bash

# called by dracut
check() {
    return 0
}

# called by dracut
installkernel() {
    hostonly='' instmods obs
}

# called by dracut
install() {
    inst_hook pre-udev 10 "\$moddir"/setup_obs.sh
}
EOF
chmod a+rx /usr/lib/dracut/modules.d/80obs/module-setup.sh
cat > /usr/lib/dracut/modules.d/80obs/setup_obs.sh <<EOF
#!/bin/sh
info "Loading kernel modules for OBS"
info "  Loop..."
modprobe loop max_loop=64 lbs=0 || modprobe loop max_loop=64
info "  binfmt misc..."
modprobe binfmt_misc
EOF
chmod a+rx /usr/lib/dracut/modules.d/80obs/setup_obs.sh

# a longer list to have them also available for qemu cross builds where x86_64 
kernel runs in eg. arm env.
# this list of modules where available on build workers of build.opensuse.org, 
so we stay compatible.
export KERNEL_MODULES="loop dm-mod dm-snapshot binfmt-misc fuse kqemu squashfs 
ext2 ext3 ext4 reiserfs btrfs nf_conntrack_ipv6 binfmt_misc virtio_pci 
virtio_mmio virtio_blk virtio_rng fat vfat nls_cp437 nls_iso8859-1 ibmvscsi 
ibmvscsic"

# manually load all modules to make sure they're available
for i in $KERNEL_MODULES; do
(
  echo "info '  $i'"
  echo "modprobe $i"
) >> /usr/lib/dracut/modules.d/80obs/setup_obs.sh
done

ROOT=""
[ -e "/dev/vda" ] && ROOT="-d /dev/vda"
[ -e /dev/hda1 ] && ROOT="-d /dev/hda1" # for xen builds
%define kernel_name vmlinu?
%ifarch s390 s390x
%define kernel_name image
%endif
%ifarch %arm
%define kernel_name zImage
%endif
%ifarch aarch64
%define kernel_name Image
%endif

%if 0%{?suse_version} < 1315
# For SLE 11 
/sbin/mkinitrd $ROOT \
               -m "$KERNEL_MODULES" \
               -k /boot/%{kernel_name}-*-default -M /boot/System.map-*-default 
-i /tmp/initrd.kvm -B
%ifarch %ix86 x86_64
/sbin/mkinitrd $ROOT \
               -m "$KERNEL_MODULES" \
               -k /boot/vmlinuz-xen -M /boot/System.map-*-xen -i /tmp/initrd.xen
%endif
%else
dracut --host-only --drivers="$KERNEL_MODULES" --force /tmp/initrd.kvm `echo 
/boot/%{kernel_name}-*-default | sed -n -e 's,[^-]*-\(.*-default\),\1,p'`
%ifarch %ix86 x86_64
dracut --host-only --drivers="$KERNEL_MODULES xenblk" --force /tmp/initrd.xen 
`echo /boot/%{kernel_name}-*-xen | sed -n -e 's,[^-]*-\(.*-xen\),\1,p'`
%endif
%endif

#cleanup
rm -rf /usr/lib/dracut/modules.d/80obs

%install
install -d -m 0755 $RPM_BUILD_ROOT
cp -v /boot/%{kernel_name}-*-default $RPM_BUILD_ROOT/.build.kernel.kvm
cp -v /tmp/initrd.kvm $RPM_BUILD_ROOT/.build.initrd.kvm
%ifarch %ix86 x86_64
cp -v /boot/%{kernel_name}-*-xen $RPM_BUILD_ROOT/.build.kernel.xen
cp -v /tmp/initrd.xen $RPM_BUILD_ROOT/.build.initrd.xen
%endif

#inform worker about arch
#see obs-build commit e47399d738e51
uname -m > $RPM_BUILD_ROOT/.build.hostarch.kvm

%files
%defattr(-,root,root)
/.build.kernel.*
/.build.initrd.*
/.build.hostarch.*

%changelog
++++++ kernel-obs-qa-xen.spec ++++++
#
# spec file for package kernel-obs-qa-xen
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# needsrootforbuild


%define patchversion 3.16.7
%define variant %{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-obs-qa-xen
BuildRequires:  kernel-xen
# kernel-obs-build must be also configured as VMinstall, but is required
# here as well to avoid that qa and build package build parallel
BuildRequires:  kernel-obs-build
BuildRequires:  modutils
ExclusiveArch:  %ix86 x86_64
%if 0%{?suse_version} < 1200
# for SLE 11
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%endif
Summary:        Basic QA tests for the kernel
License:        GPL-2.0
Group:          SLES
Version:        3.16.7
Release:        0
%if 0%{?is_kotd}
%else
%endif

%description
This package is using the kernel compiled within Open Build Service(OBS)
projects and runs basic tests.

%prep

%build

%check
# More tests are comming, currently the main test is the existens of
# this spec file. It does trigger a build within OBS VM which is using
# the kernel of the same project.

# test suites should be packaged in other packages, but build required
# and called here.

krel=$(uname -r)
if test ! -d "/lib/modules/$krel/kernel"; then
        echo "Kernel package for $krel not installed; exiting"
        exit 0
fi
/sbin/modprobe loop

%install
mkdir -p %{buildroot}/usr/share/%name
touch %{buildroot}/usr/share/%name/logfile

%files
%defattr(-,root,root)
/usr/share/%name

%changelog
++++++ kernel-obs-qa.spec ++++++
#
# spec file for package kernel-obs-qa
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# needsrootforbuild


%define patchversion 3.16.7
%define variant %{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-obs-qa
BuildRequires:  kernel-default
# kernel-obs-build must be also configured as VMinstall, but is required
# here as well to avoid that qa and build package build parallel
BuildRequires:  kernel-obs-build
BuildRequires:  modutils
ExclusiveArch:  aarch64 armv6hl armv7hl %ix86 ppc64 ppc64le s390x x86_64
%if 0%{?suse_version} < 1200
# for SLE 11
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%endif
Summary:        Basic QA tests for the kernel
License:        GPL-2.0
Group:          SLES
Version:        3.16.7
Release:        0
%if 0%{?is_kotd}
%else
%endif

%description
This package is using the kernel compiled within Open Build Service(OBS)
projects and runs basic tests.

%prep

%build

%check
# More tests are comming, currently the main test is the existens of
# this spec file. It does trigger a build within OBS VM which is using
# the kernel of the same project.

# test suites should be packaged in other packages, but build required
# and called here.

krel=$(uname -r)
if test ! -d "/lib/modules/$krel/kernel"; then
        echo "Kernel package for $krel not installed; exiting"
        exit 0
fi
/sbin/modprobe loop

%install
mkdir -p %{buildroot}/usr/share/%name
touch %{buildroot}/usr/share/%name/logfile

%files
%defattr(-,root,root)
/usr/share/%name

%changelog
++++++ kernel-pae.spec ++++++
++++ 1115 lines (skipped)

++++++ kernel-source.spec ++++++
#
# spec file for package kernel-source
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# icecream 0


%define srcversion 3.16
%define patchversion 3.16.7
%define variant %{nil}
%define vanilla_only 0

%include %_sourcedir/kernel-spec-macros

%define src_install_dir usr/src/linux-%kernelrelease%variant

Name:           kernel-source
Summary:        The Linux Kernel Sources
License:        GPL-2.0
Group:          Development/Sources
Version:        3.16.7
Release:        0
%if 0%{?is_kotd}
%else
%endif
Url:            http://www.kernel.org/
AutoReqProv:    off
BuildRequires:  coreutils
BuildRequires:  fdupes
BuildRequires:  sed
Requires(post): coreutils sed
Provides:       %name = %version-%source_rel
Provides:       linux
Provides:       multiversion(kernel)
Source0:        
http://www.kernel.org/pub/linux/kernel/v3.x/linux-%srcversion.tar.xz
Source2:        source-post.sh
Source3:        kernel-source.rpmlintrc
Source8:        devel-pre.sh
Source9:        devel-post.sh
Source10:       preun.sh
Source11:       postun.sh
Source12:       pre.sh
Source13:       post.sh
Source14:       series.conf
Source16:       guards
Source17:       apply-patches
Source21:       config.conf
Source23:       supported.conf
Source33:       check-for-config-changes
Source35:       group-source-files.pl
Source36:       README.PATCH-POLICY.SUSE
Source37:       README.SUSE
Source38:       README.KSYMS
Source39:       config-options.changes.txt
Source40:       source-timestamp
Source44:       find-provides
Source45:       split-modules
Source46:       modversions
Source48:       macros.kernel-source
Source49:       kernel-module-subpackage
Source50:       kabi.pl
Source51:       mkspec
Source52:       kernel-source%variant.changes
Source53:       kernel-source.spec.in
Source54:       kernel-binary.spec.in
Source55:       kernel-syms.spec.in
Source56:       kernel-docs.spec.in
Source57:       kernel-cert-subpackage
Source58:       constraints.in
Source60:       config.sh
Source61:       compute-PATCHVERSION.sh
Source62:       old-flavors
Source63:       arch-symbols
Source64:       package-descriptions
Source65:       kernel-spec-macros
Source66:       configtool.pl
Source67:       log.sh
Source68:       host-memcpy-hack.h
Source69:       try-disable-staging-driver
Source70:       kernel-obs-build.spec.in
Source71:       kernel-obs-qa.spec.in
Source72:       compress-vmlinux.sh
Source100:      config.tar.bz2
Source101:      config.addon.tar.bz2
Source102:      patches.arch.tar.bz2
Source103:      patches.drivers.tar.bz2
Source104:      patches.fixes.tar.bz2
Source105:      patches.rpmify.tar.bz2
Source106:      patches.suse.tar.bz2
Source107:      patches.xen.tar.bz2
Source108:      patches.addon.tar.bz2
Source109:      patches.kernel.org.tar.bz2
Source110:      patches.apparmor.tar.bz2
Source111:      patches.rt.tar.bz2
Source112:      patches.trace.tar.bz2
Source113:      patches.kabi.tar.bz2
Source120:      kabi.tar.bz2
Source121:      sysctl.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Prefix:         /usr/src
# Source is only complete with devel files.
Requires:       kernel-devel%variant = %version-%release

%(chmod +x 
%_sourcedir/{guards,apply-patches,check-for-config-changes,group-source-files.pl,find-provides,split-modules,modversions,kabi.pl,mkspec,compute-PATCHVERSION.sh,arch-symbols,configtool.pl,log.sh,try-disable-staging-driver,compress-vmlinux.sh})

%define symbols %(set -- $([ -e %_sourcedir/extra-symbols ] && cat 
%_sourcedir/extra-symbols) ; echo $*)
%define variant_symbols %(case %name in (*-rt) echo "RT" ;; esac)

%define do_vanilla "%variant" == ""

%description
Linux kernel sources with many fixes and improvements.


%source_timestamp
%package -n kernel-devel%variant
Summary:        Development files needed for building kernel modules
Group:          Development/Sources
AutoReqProv:    off
Provides:       kernel-devel%variant = %version-%source_rel
Provides:       multiversion(kernel)
Requires:       kernel-macros

%description -n kernel-devel%variant
Kernel-level headers and Makefiles required for development of
external kernel modules.

%source_timestamp

%package -n kernel-macros
Summary:        RPM macros for building Kernel Module Packages
Group:          Development/Sources
# Note: This does not provide multiversion(kernel) nor is its name decorated
# with the variant (-rt)

%description -n kernel-macros
This package provides the rpm macros and templates for Kernel Module Pakcages

%source_timestamp

%package vanilla
Summary:        Vanilla Linux kernel sources with minor build fixes.
Group:          Development/Sources
AutoReqProv:    off
Provides:       %name-vanilla = %version-%source_rel
Provides:       multiversion(kernel)

%description vanilla
Vanilla Linux kernel sources with minor build fixes.


%source_timestamp

%prep

echo "Symbol(s): %symbols"

# Unpack all sources and patches
%setup -q -c -T -a 100 -a 101 -a 102 -a 103 -a 104 -a 105 -a 106 -a 107 -a 108 
-a 109 -a 110 -a 111 -a 112 -a 113 -a 120 -a 121

%build
mkdir -p $RPM_BUILD_ROOT/usr/src
cd $RPM_BUILD_ROOT/usr/src

# Unpack the vanilla kernel sources
tar -xf %{S:0}
if test "%srcversion" != "%kernelrelease%variant"; then
        mv linux-%srcversion linux-%kernelrelease%variant
fi

%if %do_vanilla
%if %vanilla_only
        mv \
%else
        cp -al \
%endif
        linux-%kernelrelease%variant linux-%kernelrelease-vanilla
cd linux-%kernelrelease-vanilla
%_sourcedir/apply-patches --vanilla %_sourcedir/series.conf %my_builddir 
%symbols
rm -f $(find . -name ".gitignore")
cd ..
%endif

%if ! %vanilla_only
ln -sf linux%variant linux%variant  # dummy symlink

cd linux-%kernelrelease%variant
%_sourcedir/apply-patches %_sourcedir/series.conf %my_builddir %symbols
rm -f $(find . -name ".gitignore")

if [ -f %_sourcedir/localversion ] ; then
    cat %_sourcedir/localversion > localversion
fi
%endif

# Hardlink duplicate files automatically (from package fdupes).
%fdupes $RPM_BUILD_ROOT

%install
%if ! %vanilla_only
# Install the documentation and example Kernel Module Package.
DOC=/usr/share/doc/packages/%name-%kernelrelease
mkdir -p %buildroot/$DOC
cp %_sourcedir/README.SUSE %_sourcedir/config-options.changes.txt 
%buildroot/$DOC
ln -s $DOC/README.SUSE %buildroot/%src_install_dir/

%if "%variant" == ""
install -m 755 -d $RPM_BUILD_ROOT/etc/rpm
install -m 644 %_sourcedir/macros.kernel-source $RPM_BUILD_ROOT/etc/rpm/
install -m 755 -d $RPM_BUILD_ROOT/usr/lib/rpm
install -m 644 %_sourcedir/kernel-{module,cert}-subpackage \
    $RPM_BUILD_ROOT/usr/lib/rpm/
%endif

for script in post; do
    sed -e "s:@KERNELRELEASE@:%kernelrelease:g" \
        -e "s:@SRCVARIANT@:%variant:g" \
        %_sourcedir/source-$script.sh > %name-$script.sh
done

pushd "%buildroot"
perl "%_sourcedir/group-source-files.pl" \
        -D "$OLDPWD/devel.files" -N "$OLDPWD/nondevel.files" \
        -L "%src_install_dir"
popd

# kernel-source and kernel-$flavor-devel are built independently, but the
# shipped sources (/usr/src/linux/) need to be older than generated files
# (/usr/src/linux-obj). We rely on the git commit timestamp to not point into
# the future and be thus lower than the timestamps of files built from the
# source (bnc#669669).
ts="$(head -n1 %_sourcedir/source-timestamp)"
find %buildroot/usr/src/linux* ! -type l | xargs touch -d "$ts"

%post -f %name-post.sh

%post -n kernel-devel%variant -f %name-post.sh

%files -f nondevel.files
%defattr(-, root, root)

%files -n kernel-devel%variant -f devel.files
%defattr(-,root,root)
%ghost /usr/src/linux%variant
%doc /usr/share/doc/packages/*

%if "%variant" == ""
%files -n kernel-macros
%defattr(-,root,root)
/etc/rpm/macros.kernel-source
/usr/lib/rpm/kernel-*-subpackage
%endif

%endif

%if %do_vanilla

%files vanilla
%defattr(-, root, root)
/usr/src/linux-%kernelrelease-vanilla
%endif

%changelog
++++++ kernel-syms.spec ++++++
#
# spec file for package kernel-syms
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define variant %{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-syms
Summary:        Kernel Symbol Versions (modversions)
License:        GPL-2.0
Group:          Development/Sources
Version:        3.16.7
Release:        0
%if %using_buildservice
%if 0%{?is_kotd}
%else
%endif
%else
%define kernel_source_release %(LC_ALL=C rpm -q kernel-devel%variant-%version 
--qf "%{RELEASE}" | grep -v 'not installed' || echo 0)
%endif
Url:            http://www.kernel.org/
AutoReqProv:    off
BuildRequires:  coreutils
%ifarch aarch64 armv6hl armv7hl %ix86 ppc ppc64 ppc64le s390x x86_64
Requires:       kernel-default-devel = %version-%source_rel
%endif
%ifarch %ix86 x86_64
Requires:       kernel-desktop-devel = %version-%source_rel
%endif
%ifarch armv7hl
Requires:       kernel-lpae-devel = %version-%source_rel
%endif
%ifarch %ix86
Requires:       kernel-pae-devel = %version-%source_rel
%endif
%ifarch %ix86 x86_64
Requires:       kernel-xen-devel = %version-%source_rel
%endif
Requires:       pesign-obs-integration
Provides:       %name = %version-%source_rel
Provides:       multiversion(kernel)
Source:         README.KSYMS
Requires:       kernel-devel%variant = %version-%source_rel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %ix86 aarch64 armv6hl armv7hl ppc ppc64 ppc64le s390x x86_64
Prefix:         /usr/src

%description
Kernel symbols, such as functions and variables, have version
information attached to them. This package contains the symbol versions
for the standard kernels.

This package is needed for compiling kernel module packages with proper
package dependencies.


%source_timestamp
%prep

%install
install -m 644 -D %{SOURCE0} %buildroot/%_docdir/%name/README.SUSE

%files
%defattr(-, root, root)
%dir %_docdir/%name
%_docdir/%name/README.SUSE

%changelog
++++++ kernel-vanilla.spec ++++++
++++ 1076 lines (skipped)

kernel-xen.spec: same change
++++++ README.KSYMS ++++++
This file is a place holder for the kernel-syms{,-rt} package. It is used
to group build dependencies for all kernel flavors.

The KMP build process will build KMPs against all installed kernel flavors
automatically. If you don't need to build against other flavors than the
ones you've already installed - it is safe to uninstall this package.
++++++ README.PATCH-POLICY.SUSE ++++++
SUSE Linux Enterprise Patch Policy
----------------------------------

Summary
-------

The SUSE Linux Enterprise (SLE) patch policy mirrors the mainline Linux
community's policy for accepting changes.  Each commit must contain a
small and "obvious" change that can be reviewed individually and, once
applied, be able to be used as a bisection point.  The kernel should be
able to build (and boot) between each applied patch.  Since the SLE
kernel is based on an official upstream kernel release and is followed by
a hardening process, we expect that nearly all of the patches applied to the
base release will be from subsequent official upstream releases indended to
address specific issues or to allow for hardware/feature enablement.


Background
----------

Before covering the policy itself, we'll discuss a bit of background on
how the source code tree is organized.  If you've used the SLE kernel source
(kernel-source.git[1]) tree before, you've probably noticed that, unlike
the mainline Linux kernel, we don't use a source-level git repository as
our "base."  Instead, we use an official kernel.org Linux tar archive as
the base and add a series of patches on top of it.  This carries with it
several benefits.  The biggest is that we add metadata "tags" to our
patches that allow us to easily associate patches with particular feature
requests, bug reports, and/or the pedigree of the patch.  Due to the nature
of some of our feature requests, we also must occasionally carry patches
that, for one reason or another, haven't been accepted into the mainline
kernel repository yet.  With a full (published[2]) git repository, it would
be difficult to associate the initial commit for a particular feature with
any subsequent changes to it.  Another benefit is more superficial: with the
use of separate patches, we (and our users) are able to tell, at a glance,
which patches are in any given kernel release simply by looking at
the source package.  Patches are grouped into subsystems (including
architecture, "core" vm/scheduler, VFS, individual file systems, driver
core, networking core, block layer, and leaf drivers) so finding patches
that affect a particular part of the kernel can be easily found.  Patches
are placed in directories such as patches.fixes, patches.suse, etc.  When
submitting patches for inclusion, it's not necessary to choose a directory.
We'll put them in the appropriate place.

Historically, this approach has worked well but has limited options for
typical debugging techniques such as bisection.  The application of the
patch series results in our fully operational SLE kernel but stopping
the patch series midway can result in an unbuildable source tree.  
Beginning with the SLE11 SP2 development cycle, we've published a fully
expanded git repository (kernel.git[2]) that exactly represents the code
as if it were originally used as a standard source code tree repository.
This allows us to work with the individual patches *and* have the ability
to bisect the tree as the changes are applied.  It also makes it easier for
partners unfamiliar with how our source tree works to make the transition.


Format
------
The SLE patch format follows very closely what you would see on any
mailing list associated with Linux kernel development.  A SLE patch is
formatted like an RFC822 mbox-style mail message, with a few extensions.
If the patch is coming from the mainline Linux repository or a subsystem
maintainer repository, SUSE has tools published here[3] that can make
adding these tags nearly painless.

Each patch should contain the "From" and "Subject" headers found in any
email message.  The From should contain the name and email address of the
patch author.  The Subject should contain a short description of the
patch, prefixed with the subsystem affected.

e.g.
From: Jeff Mahoney <je...@suse.com>
Subject: init: print hello world at boot time

Beyond that, we require several more headers, the full description of
the patch, the certification tags used in the mainline kernel, and the patch
contents.

The headers we require are as follows:

Git-commit: [a-f0-9]{40}
- Contains the SHA-1 git commit ID of the patch in either the mainline
  kernel repository[4] or an official maintainer repository.

Git-repo: URL-to-git-repo (starting with git://)
- The URL to the git repository containing the commit.  This tag can be
  omitted if the commit is from the mainline kernel repository.

Patch-mainline: vMajor.Minor.Patch{-optional-rc}
- The official kernel release that contains this patch.  In the case of a
  patch accepted into a maintainer branch, "Queued in subsystem
  maintainer repo" can be used.  If the patch has been submitted to a
  subsystem mailing list for review and is nearly certain to be accepted,
  "Submitted <date> <l...@site.org>" can be used.  Otherwise, if the
  patch will never be in the upstream kernel, e.g. in the case of
  vendor-specific
  version numbers, etc, then "No" followed by the reason why it will
  not be accepted (or submitted).  Please note that the reason must be
  compelling for it to be allowed into our kernel repository.

References: list of references
- There must be a reason for each patch to be included into the kernel
  repository.  It can be a fix in response to a bug report or a patch
  submitted as part of the feature development cycle for a release.  We
  use a shorthand to indicate why a particular patch will be included
  and it's possible to use more than one.

  For Feature requests, the feature will have to have gone through our
  feature tracking tool, FATE.  Each feature request will have an ID
  associated with it and it can be added to the References tag using
  FATE#number, e.g. FATE#12345.

  For fixes for bug reports (or patches for feature requests submitted
  via Bugzilla, the shorthand is bnc#number.  bnc is shorthand for
  bugzilla.novell.com.  There are others such as bko, for
  bugzilla.kernel.org.

Next is the full description of the patch, which should explain why the
patch is needed and an overview of what it does. 

The last "header" portion of the patch contains the certification tags, which
consist of "Signed-off-by" and "Acked-by." We, and the upstream Linux
community depend on patch submitters to "own" their submission and certify
they have the right to submit code to the kernel repository.  For patches
coming from the mainline Linux kernel repository, the certification tags
are already in place and we only need the submitter's tag added (if not
already part of the original patch).  Likewise, the SUSE engineer who
includes the submission in our kernel tree, will add their own "Acked-by"
tag.

There may be an optional diffstat -p1 output added before the patch content.

The patch content itself should be in "-ab" format where the patch header
itself only contains the filename without any timestamps.

Here's an example of a complete patch:

-------->8--------
From: Upstream Committer <co...@somesite.com>
Subject: init: print hello world on boot
Patch-mainline: v3.8-rc1
Git-commit: deadbeefc0ffeeb1a4b1a4b1a4b1a4b1a4b1a4b1a4
References: FATE#12134 bnc#23123

The kernel started off like every other project.  Let's add the hello
world message in honor of its roots.

Signed-off-by: Upstream Committer <co...@somesite.com>
Tested-by: Bill User <bill.u...@example.com>
Acked-by: Jeff Mahoney <je...@suse.com>
---
 init/main.c |    1 +
 1 file changed, 1 insertion(+)

--- a/init/main.c
+++ b/init/main.c
@@ -807,6 +807,7 @@ static noinline int init_post(void)
        system_state = SYSTEM_RUNNING;
        numa_default_policy();

+       printk("Hello world!\n");

        current->signal->flags |= SIGNAL_UNKILLABLE;

--------8<--------


Patch Inclusion Rules
---------------------

As mentioned in the summary, we expect that most patches to the SLE kernel
will come from subsequent official upstream kernel releases or from subsystem
maintainer repositories (which imply that the patch will ultimately be
a part of an official upstream Linux release).  The SLE kernel contains
hardware enablement driver enhancement/backports for a wide range of devices
offered by many vendors.  In many cases, the drivers are self-contained
but many others have shared dependencies on common infrastructure.

The shared dependencies on common infrastructure combined with the need
to be able to bisect the resulting kernel means that we must require
all partners to submit patch series consisting of individual patches that
match upstream commits.  In the case where a commit affects multiple drivers,
it is acceptable to only contain the portions that effect a particular
driver as long as it is annotated by appending "(partial)" to the Git-commit
line and documenting what is included or dropped.  An example using the
patch tools is included below.


Tools
-----
We understand that there are a bunch of rules to follow and that implementing
them all can be tedious.  We have a set of tools, published here[3], to make
working with the patches a lot easier.

There are two tools: fixpatch and exportpatch.  Fixpatch will add missing
headers and formatting to existing patches, assuming there's at least a
Git-commit tag present.  Exportpatch, given a list of commit IDs on the
commandline, will search for each commit in the configured repositories
and export the patches.

There are several command line options that are useful.

-w|--write -- will write out each commit into a separate file.  The filenames
              are based on the subject of the header and the filenames will
              be output on stdout for use directly in a series file.

-d DIR|--dir=DIR -- will write out each commit into a designated directory.
                    The default is to write into the current directory.
-f|--force -- By default exportpatch will not export commits that are local
              to the repository on disk.  It will also refuse to overwrite
              existing patch files.  This option overrides these checks.
-F REF|--reference=REFERENCE -- Adds References automatically and can be
                                specified multiple times.
-x EXTRACT | --extract EXTRACT -- It it sometimes desirable to split out
                                  chunks of patches that affect only a
                                  particular section of the code.  This option
                                  accepts pathnames to extract.  Anything
                                  not specified will be skipped.  Paths ending
                                  with / designate everything under that
                                  hierarchy.  This also adds a (partial)
                                  notation to the Git-commit tag and adds
                                  a Patch-filtered: tag indicating which
                                  paths were used to extract.

There are also two other features that are used automatically.  The first is
that 3-way merge diffs are handled automatically such that a new, exact
two-way diff is generated.  Note that both the -x option and the automatic
handling of merge commits can generate empty patches -- empty patches are
skipped entirely and no files are generated.

A quick example for generating the patches necessary for a backport of the
ixgbe driver against the 3.0 kernel.  Please note that it (obviously) skips
any infrastructure changes required for the patches to build.  The Acked-by
tags will automatically be added unless you were involved in the original
upstream commit process.

exportpatch -w -d ixgbe -x drivers/net/ixgbe/ \
            -x drivers/net/ethernet/intel/ixgbe/ \
            -F "FATE#12345" -F "bnc#12354" \
            $(git log v3.0.. --pretty=oneline -- drivers/net/ixgbe \
              drivers/net/ethernet/intel/ixgbe |cut -b 1-40) > ixgbe/series

The first patch in that series looks like this:
--------8<--------
>From 6403eab143205a45a5493166ff8bf7e3646f4a77 Mon Sep 17 00:00:00 2001
From: Joe Perches <j...@perches.com>
Date: Fri, 3 Jun 2011 11:51:20 +0000
Subject: drivers/net: Remove unnecessary semicolons
Git-commit: 6403eab143205a45a5493166ff8bf7e3646f4a77 (partial)
Patch-mainline: v3.1-rc1
References: FATE#12345 bnc#12354
Patch-filtered: drivers/net/ixgbe/ drivers/net/ethernet/intel/ixgbe/

Semicolons are not necessary after switch/while/for/if braces
so remove them.

Signed-off-by: Joe Perches <j...@perches.com>
Signed-off-by: David S. Miller <da...@davemloft.net>
Acked-by: Jeff Mahoney <je...@suse.com>
---

 drivers/net/ixgbe/ixgbe_82599.c  |    4 ++--
 drivers/net/ixgbe/ixgbe_common.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -1157,7 +1157,7 @@ s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, 
u32 pballoc)
        default:
                /* bad value */
                return IXGBE_ERR_CONFIG;
-       };
+       }
 
        /* Move the flexible bytes to use the ethertype - shift 6 words */
        fdirctrl |= (0x6 << IXGBE_FDIRCTRL_FLEX_SHIFT);
@@ -1245,7 +1245,7 @@ s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, 
u32 pballoc)
        default:
                /* bad value */
                return IXGBE_ERR_CONFIG;
-       };
+       }
 
        /* Turn perfect match filtering on */
        fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH;

--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -1292,7 +1292,7 @@ static s32 ixgbe_ready_eeprom(struct ixgbe_hw *hw)
 
                udelay(5);
                ixgbe_standby_eeprom(hw);
-       };
+       }
 
        /*
         * On some parts, SPI write time could vary from 0-20mSec on 3.3V
@@ -1374,7 +1374,7 @@ static void ixgbe_shift_out_eeprom_bits(struct ixgbe_hw 
*hw, u16 data,
                 * EEPROM
                 */
                mask = mask >> 1;
-       };
+       }
 
        /* We leave the "DI" bit set to "0" when we leave this routine. */
        eec &= ~IXGBE_EEC_DI;

-------->8--------

Links:
[1]: http://kernel.suse.com/cgit/kernel-source/log/?h=SLE12
[2]: http://kernel.suse.com/cgit/kernel/log/?h=SLE12
[3]: http://download.opensuse.org/repositories/Kernel:/tools/
[4]: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
++++++ README.SUSE ++++++
WORKING WITH THE SUSE 2.6.x and 3.x KERNEL SOURCES

Andreas Gruenbacher <agr...@suse.de>, SUSE Labs, 2003, 2004, 2005, 2006
Michal Marek <mma...@suse.de>, SUSE Labs, 2010


This document gives an overview of how SUSE Linux kernels are
created, and describes tasks like building individual kernels
and creating external kernel modules.

A companion HOWTO that describes how to build driver update disks (among
other things) is available at:

    
http://developer.novell.com/wiki/index.php/Creating_a_Driver_Update_Disk_%28DUD%29


TABLE OF CONTENTS

  Overview
  Compiling your own kernel
  Building additional (external) modules
  Supported vs. unsupported modules
  Patch selection mechanism
  Where to find configuration files
  How to configure the kernel sources
  Module load paths


OVERVIEW

The kernels for SUSE are generated from the vanilla Linux kernel sources
found at http://ftp.kernel.org, on top of which a number of patches are
applied. The resulting kernel source tree is configured and built,
resulting in a binary kernel.

The add-on patches and configuration files are maintained in
a GIT repository at

    http://gitorious.org/opensuse/kernel-source
    
A script (scripts/tar-up.sh) packs up the files in the repository in a
form suitable for rpmbuild. When building the RPM packages, the
following binary packages get created:

  *  kernel-source

     The kernel source tree, generated by unpacking the vanilla kernel
     sources and applying the patches. The kernel sources are used by
     a number of other packages. They can also be used for compiling
     additional kernel modules.

  *  kernel-devel

     A subset of the kernel-source package that is needed to build
     external modules.

  *  kernel-$FLAVOR

     A number of binary kernels (for example, kernel-default for
     uniprocessor machines, kernel-smp for smp machines, etc.). These
     packages are all generated from the same kernel sources, and
     differ in the kernel configurations used.

  *  kernel-$FLAVOR-base

     A subset of kernel-$FLAVOR, for use in paravirtualized quests that
     only require a few device and filesystem drivers.

  *  kernel-$FLAVOR-devel

     The files used for generating kernel module packages for use with
     kernel-$FLAVOR.

  *  kernel-syms

     A meta package that pulls in the relevant kernel-$FLAVOR-devel
     packages for a given architecture.


The repository contains the configuration files (.config) for all SUSE
kernel flavors. All configuration files are included in the dependencies
of the kernel-syms package (see WHERE TO FIND CONFIGURATION FILES below).


In the installed system, the kernel-source package installs files in the
following directories:


  *  /usr/src/linux-$VERSION-$RELEASE/

     The kernel sources.

  *  /usr/src/linux

     A symbolic link to /usr/src/linux-$VERSION-$RELEASE.

  *  /usr/share/doc/packages/kernel-source/

     This document.


The kernel-$FLAVOR-devel packages install the following files:

  *  /usr/src/linux-$VERSION-$RELEASE-obj/$ARCH/$FLAVOR/

     Kernel build object files for one kernel flavor. These
     files are used for compiling additional kernel modules.

  *  /usr/src/linux-obj/$ARCH/$FLAVOR

     A symbolic link to /usr/src/linux-$VERSION-$RELEASE-obj/$ARCH/$FLAVOR.


COMPILING YOUR OWN KERNEL

The kernel sources are found in the kernel-source package. The
recommended way to produce a binary kernel is:

  (1)  Install kernel-source. Change to the /usr/src/linux directory.

  (2)  Create a build directory for use in configuring and building
       the kernel. Using /usr/src/linux directly requires root priviledges
       and will cause problems if you need to build kernel modules for
       other installed kernels.

  (3)  Configure the kernel (for example, ``make -C /usr/src/linux
       O=$(pwd) oldconfig'' or ``make -C /usr/src/linux O=$(pwd) cloneconfig'',
       see HOW TO CONFIGURE THE KERNEL SOURCES).

  (4)  Build the kernel and all its modules (``make'').

  (5)  Make sure that /etc/modprobe.d/unsupported-modules contains

           allow_unsupported_modules 1

       otherwise modprobe will refuse to load any modules.

  (6)  Install the kernel and the modules (``make modules_install'',
       followed by ``make install''). This will automatically create
       an initrd for the new kernel as well (see ``mkinitrd -h'').

  (7)  Add the kernel to the boot manager. When using lilo, run ``lilo''
       to update the boot map.

Instead of building binary kernels by hand, you can also build
one of the kernel-$FLAVOR packages using RPM.


BUILDING ADDITIONAL (EXTERNAL) MODULES

A single binary kernel module generally only works for a specific
version of the kernel source tree, for a specific architecture and
configuration. This means that for each binary kernel that SUSE ships, a
custom module must be built. This requirement is to some extent relaxed
by the modversion mechanism: modversions attach a checksum to each
symbol (function or variable) exported to modules by the kernel. This
allows to use kernel modules that have been built for a kernel with a
different version or release number in many cases, as long as none of
the symbols the module uses have changed between the two kernel
versions.

When releasing maintenance or security update kernels for a specific
product, we carefully try to keep the kernel ABI stable.  Despite this,
we sometimes have no choice but to break binary compatibility. In this
case, those kernel modules must be rebuilt.

Additional kernel modules for one of the SUSE kernel flavors can be
built in three different ways:

  (1) by configuring the kernel sources in a separate build directory
      (see HOW TO CONFIGURE THE KERNEL SOURCES), or

  (2) by using one of the standard configurations in
      /usr/src/linux-obj/$ARCH/$FLAVOR, or

  (3) by creating a Kernel Module Package (KMP) as described in the
      Kernel Module Packages Manual, http://www.suse.de/~agruen/KMPM/.


The first method involves the following steps:

  (1)  Install the kernel-source package.

  (2)  Configure the kernel, see HOW TO CONFIGURE THE KERNEL SOURCES.

  (3)  Create files required for compiling external modules:
       ``make scripts'' and ``make prepare''.

  (4)  Compile the module(s) by changing into the module source directory
       and typing ``make -C $(your_build_dir) M=$(pwd)''.

  (5)  Install the module(s) by typing
       ``make -C $(your_build_dir) M=$(pwd) modules_install''.


The second method involves the following steps:

  (1)  Install the kernel-devel package.

  (2)  Install the kernel-$FLAVOR-devel package. This is necessary for
       symbol version information (CONFIG_MODVERSIONS).

  (3)  Compile the module(s) by changing into the module source directory
       and typing ``make -C /usr/src/linux-obj/$ARCH/$FLAVOR M=$(pwd)''.
       Substitute $ARCH and $FLAVOR with the architecture and flavor
       for which to build the module(s).

       If the installed kernel sources match the running kernel, you
       can build modules for the running kernel by using the path
       /lib/modules/$(uname -r)/build as the -C option in the above
       command. (build is a symlink to /usr/src/linux-obj/$ARCH/$FLAVOR).

  (4)  Install the module(s) with
       ``make -C /usr/src/linux-obj/$ARCH/$FLAVOR M=$(pwd) modules_install''.


Whenever building modules, please use the kernel build infrastructure as
much as possible, and do not try to circumvent it. The
Documentation/kbuild directory in the kernel sources documents kbuild
makefiles.


SUPPORTED VS. UNSUPPORTED MODULES

As an extension to the mainline kernel, modules can be tagged as
supported (directly by SUSE, or indirectly by a third party) or
unsupported. Modules which are known to be flakey or for which SUSE does
not have the necessary expertise are marked as unsupported.  Modules for
which SUSE has third-party support agreements are marked as externally
supported. Modules for which SUSE provides direct support are marked as
supported.

The support status of a module can be queried with the modinfo tool.
Modinfo will report one of the following:

  - direct support by SUSE: "supported: yes"
  - third-party support: "supported: external"
  - unsupported modules: no supported tag.

At runtime, the setting of the" unsupported" kernel command line
parameter and /proc/sys/kernel/unsupported determines whether
unsupported modules can be loaded or not, and whether or not loading an
unsupported module causes a warning in the system log:

  0 = only allow supported modules,
  1 = warn when loading unsupported modules,
  2 = don't warn.

Irrespective of this setting, loading an externally supported or unsupported
module both set a kernel taint flag. The taint flags are included in
Oopses. The taint status of the kernel can be inspected in
/proc/sys/kernel/tainted: Bits 0 to 4 have the following meanings:

  bit  0 = a module with a GPL-incompatible license was loaded (tainted & 1),
  bit  1 = module load was enforced (tainted & 2),
  bit  2 = an SMP-unsafe module was loaded (tainted & 4),
  bit  3 = (reserved),
  bit  4 = an unsupported module was loaded (tainted & 16),
  bit  5 = a module with third-party support was loaded (tainted & 32).
  bit 10 = a machine check exception has occurred (taint & 1024; x86_64 only
           so far).

The corresponding codes for the taint flags in Oopses are (x = unknown):

  - "Pxxx" if bit 0 set or else
    "Gxxx" if bit 0 unset,
  
  - "xFxx" if bit 1 set or else
    "x xx" if bit 1 unset,
  
  - "xxSx" if set or else
    "xx x" if bit 2 unset,
  
  - "xxxU" if bit 4 set or else
    "xxxX" if bit 5 set or else
    "xxx ".

By default, out-of-tree modules will not have the supported flag (that
is, they will be marked as unsupported). For building externally
supported modules, please get in touch with Solid Driver Program team,
led by Scott Bahling, at <soliddri...@suse.com>.


PATCH SELECTION MECHANISM

The SUSE kernels consist of the vanilla kernel sources on top of which a
number of patches is applied. The file series.conf determines which
patches are applied and which are excluded. A script named "guards"
converts series.conf into a plain list of patch files to be applied.
Guards decides which patches to include and exclude based on a list of
symbols. From the kernel-source.src.rpm package, a fully patched
kernel source tree can be generated from vanilla sources + patches like
this:

    # Install the package:

      $ rpm -i kernel-source.src.rpm

    # Unpack the patches and the kernel sources:
    
      $ cd /usr/src/packages/SOURCES
      $ for f in patches.*.tar.bz2; do          \
          tar -xjf "$f" || break;               \
        done
      $ tar -xjf linux-2.6.5.tar.bz2

    # Apply the patches

      $ for p in $(./guards < series.conf); do
          patch -d linux-2.6.5 -p1 < $p || break
        done

The configuration script config.conf which is similar to series.conf is
used for configuration file selection. See the section WHERE TO FIND
CONFIGURATION FILES.

The file format of series.conf and config.conf should be obvious from
the comments in series.conf, and from the guards(1) manual page. (The
guards(1) manual page can be generated by running pod2man on the guards
script.)


WHERE TO FIND CONFIGURATION FILES

Kernel configuration files are stored in the kernel GIT repository. When
packing up the repository, they end up in config.tar.bz2.

The kernel-$FLAVOR packages are based on config/$ARCH/$FLAVOR.
(kernel-default is based on config/$ARCH/default, for example). The
kernel-$FLAVOR packages install their configuration files as
/boot/config-$VER_STR (for example, /boot/config-2.6.5-99-default). The
config is also packaged in the kernel-$FLAVOR-devel package as
/usr/src/linux-obj/$ARCH/$FLAVOR/.config.

In addition, the running kernel exposes a gzip compressed version of its
configuration file as /proc/config.gz. The kernel sources can be
configured based on /proc/config.gz with ``make cloneconfig''.


HOW TO CONFIGURE THE KERNEL SOURCES

Before a binary kernel is built or an additional loadable module
for an existing kernel is created, the kernel must be configured.

In order for a loadable module to work with an existing kernel, it must
be created with a configuration that is identical to the kernel's
configuration, or at least very close to that. Each configuration is
contained in a single file. The kernel-syms package installs
configurations for all standard SUSE kernel variants, so for building
only external kernel modules it is not necessary to configure the kernel
sources.

Configuring the kernel sources for a specific configuration is
straightfoward:

  - Locate the configuration file you want to use. (See WHERE TO FIND
    CONFIGURATION FILES above).

  - Copy the configuration to the file .config in your build directory.

  - Run the following commands in sequence to apply the configuration,
    generate version information files, etc.:

        make -C /usr/src/linux O=$PWD clean
        make -C /usr/src/linux O=$PWD oldconfig

    Alternatively to ``make oldconfig'', you can also use ``make
    menuconfig'' for a text menu oriented user interface. If the kernel
    sources do not match the configuration file exactly, ``make
    oldconfig'' will prompt for settings that are undefined. Once this
    step is completed, a Makefile will have been created that eliminates
    the need to specify the locations of the kernel source and the build
    directory.

    For configuring the kernel to match the running kernel, there is a
    shortcut ``make cloneconfig'' that expands the file /proc/config.gz
    into .config, and then runs ``make oldconfig''.

HOW TO ADD CUSTOM PATCHES

Typically patches are added to the appropriate patches.* directory (e.g.
patches.fixes) and to series.conf. When the kernel-source package is
exported from the git repository, the patch will be automatically added
to the appropriate patch tarball.

If your goal is to create a kernel with only a few additional patches
and you don't want to be bothered with using the git repository, there
is an easier way.

The kernel-source SRPM ships with two empty archives that can be be
filled and automatically expanded when building the kernel. You can use
these to add your own patches and config options without disturbing the
rest of the kernel package. This is useful if you are using the openSUSE
Build Service and link to the main kernel-source project instead of
creating your own branch. The advantage to this is that your project
will automatically receive all the changes that go into the main project
without any further effort.

To add a patch using this mechanism, just add it to the
patches.addon.tar.bz2 archive and add an entry to the series.conf file.
The archive will be expanded automatically with the other kernel patches
when the source tree is constructed.

Some patches may add new Kconfig options. The config.addon.tar.bz2
archive contains the same hierarchy as config.tar.bz2, but is under
config.addon. You can add your new config options to files named after
their config/ counterparts.

For example, the file used to configure the i386 default kernel is named
config/i386/default. To add config options to that kernel, you would
create a new file called config.addon/i386/default with the options as
formatted in a normal Linux kernel .config file. This is important
because the kernel build is non-interactive and will fail if it
encounters new config options without entries in the config file.

MODULE LOAD PATHS

Modules that belong to a specific kernel release are installed in
/lib/modules/2.6.5-99-smp and similar. Note that this path contains the
kernel package release number. Modules from KMPs must be installed
below /lib/modules/2.6.5-99-smp/updates/ and similar: modules below
updates/ have priority over other modules.

When KMPs contain modules that are compatible between multiple installed
kernels, symlinks are used to make those modules available to those
compatible kernels like this:

  /lib/modules/2.6.16-100-smp/weak-updates/foo.ko ->
      /lib/modules/2.6.16-99-smp/updates/foo.ko

Modules in the weak-updates directory have lower priority than modules
in /lib/modules/2.6.16-100-smp/updates/, and higher priority than other
modules in /lib/modules/2.6.16-100-smp.


REFERENCES

General

  Documentation in the kernel source tree.

  Linux Documentation Project, http://www.tldp.org/

  Linux Weekly News, http://lwn.net

  Rusty's Remarkably Unreliable Guides (Kernel Hacking
    and Kernel Locking guides),
    http://www.netfilter.org/unreliable-guides/

  Kernel newbies, http://www.kernelnewbies.org/


Loadable Kernel Modules

  Peter Jay Salzman and Ori Pomerantz: Linux Kernel Module
    Programming Guide, Version 2.4, April 2003,
    http://www.tldp.org/guides.html


Kernel Module Packages

    Andreas Gruenbacher: Kernel Module Packages Manual.
    Versions for CODE9 (SLES9, SUSE LINUX 10.0) and CODE10
    (SUSE Linux 10.1, SLES10),
    http://www.suse.de/~agruen/KMPM/
++++++ _constraints ++++++
<constraints>
  <hardware>
    <disk>
      <size unit="G">7</size>
    </disk>
  </hardware>

  <overwrite>
    <conditions>
      <arch>i586</arch>
      <arch>x86_64</arch>
<package>kernel-debug</package>
<package>kernel-default</package>
<package>kernel-desktop</package>
<package>kernel-ec2</package>
<package>kernel-lpae</package>
<package>kernel-pae</package>
<package>kernel-vanilla</package>
<package>kernel-xen</package>
    </conditions>
    <hardware>
      <processors>8</processors>
      <disk>
        <size unit="G">14</size>
      </disk>
    </hardware>
  </overwrite>

  <overwrite>
    <conditions>
      <arch>ppc</arch>
      <arch>ppc64</arch>
      <arch>ppc64le</arch>
<package>kernel-debug</package>
<package>kernel-default</package>
<package>kernel-desktop</package>
<package>kernel-ec2</package>
<package>kernel-lpae</package>
<package>kernel-pae</package>
<package>kernel-vanilla</package>
<package>kernel-xen</package>
    </conditions>
    <hardware>
      <processors>4</processors>
      <disk>
        <size unit="G">10</size>
      </disk>
    </hardware>
  </overwrite>

  <overwrite>
    <conditions>
      <arch>i586</arch>
      <arch>x86_64</arch>
      <package>kernel-obs-qa</package>
    </conditions>
    <sandbox>kvm</sandbox>
  </overwrite>

  <overwrite>
    <conditions>
      <arch>i586</arch>
      <arch>x86_64</arch>
      <package>kernel-obs-qa-xen</package>
    </conditions>
    <sandbox>xen</sandbox>
  </overwrite>
</constraints>

++++++ apply-patches ++++++
#!/bin/sh
#
# Given a series.conf file and a directory with patches, applies them to the
# current directory.
# Used by kernel-source.spec.in and kernel-binary.spec.in

USAGE="$0 [--vanilla] <series.conf> <patchdir> [symbol ...]"

set -e
set -o pipefail
vanilla=false
if test "$1" == "--vanilla"; then
        vanilla=true
        shift
fi
if test $# -lt 2; then
        echo "$USAGE" >&2
        exit 1
fi
DIR="${0%/*}"
SERIES_CONF=$1
PATCH_DIR=$2
shift 2

trap 'rm -f "$series"' EXIT
series=$(mktemp)
# support for patches in patches.addon/series
cp "$SERIES_CONF" "$series"
if ! $vanilla && test -e "$PATCH_DIR/patches.addon/series"; then
        # make it user-friendly and automatically prepend "patches.addon/"
        # if there is no "/"
        sed -r 's|^([[:space:]]*)([^#[:space:]][^/]*)$|\1patches.addon/\2|' \
                "$PATCH_DIR/patches.addon/series" >>"$series"
fi

(
        echo "trap 'echo \"*** patch \$_ failed ***\"' ERR"
        echo "set -ex"
        "$DIR"/guards "$@" <"$series" | \
        if $vanilla; then
                egrep '^patches\.(kernel\.org|rpmify)/'
        else
                cat
        fi |\
        sed "s|^|patch -s -F0 -E -p1 --no-backup-if-mismatch -i $PATCH_DIR/|"
) | sh

++++++ arch-symbols ++++++
#!/bin/sh

#############################################################################
# Copyright (c) 2003-2005,2009 Novell, Inc.
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact Novell, Inc.
#
# To contact Novell about this file by physical or electronic mail,
# you may find current contact information at www.novell.com
#############################################################################

# With --list, list all known architectures, otherwise print the generic
# name for this architecture (or the one specified on command line).

if [ "$1" = "--list" ]; then
    # List all known architectures
    echo i386 mips{,64} sparc{,64} ppc{,64,64le} s390{,x} ia64 x86_64 alpha 
parisc armv6hl armv7hl arm64
    exit 0
fi

if [ -n "$1" ]; then
    ARCH="$1"
else
    ARCH="`arch`"
fi
case "$ARCH" in
    # from rpm --eval '%ix86'
    i?86 | pentium3 | pentium4 | athlon | geode)
        echo i386
        ;;
    aarch64)
        echo arm64
        ;;
    *)
        echo "$ARCH"
        ;;
esac
++++++ check-for-config-changes ++++++
#! /bin/bash

# lines 4 contains a timestamp...
differences="$(
    diff -bU0 <(sed -e '/^# .* is not set$/p' -e '/^$\|^#/d' "$1" | sort) \
              <(sed -e '/^# .* is not set$/p' -e '/^$\|^#/d' "$2" | sort) \
    | grep '^[-+][^-+]'
)" || true
if [ -n "$differences" ]; then
    echo
    echo "Changes after running \`make oldconfig':"
    echo "$differences"
    echo
    if echo "$differences" | grep -q '^+' ; then
        exit 1
    fi
fi
++++++ compress-vmlinux.sh ++++++
#!/bin/bash

set -x

# Once the brp script is reasonably widespread, we will remove the specfile
# hack and this script
if test -x /usr/lib/rpm/brp-suse.d/brp-99-compress-vmlinux; then
        exit 0
fi
vmlinux=$1
if test -e "$vmlinux" -a -e "$vmlinux.gz"; then
        # Deliberately not using gzip -n; the vmlinux image has a predictable
        # timestamp (bnc#880848#c20)
        gzip -k -9 -f "$vmlinux"
fi
++++++ compute-PATCHVERSION.sh ++++++
#! /bin/bash

export LANG=POSIX

path=(.)
while test $# -gt 0; do
        case "$1" in
        --patches)
                path[${#path[@]}]=$2
                shift 2
                ;;
        *)
                echo "Usage $0 [--patches <dir>]" >&2
                exit 1
        esac
done
if test "${path[*]}" = "."; then
        path=(. ..)
fi


source $(dirname $0)/config.sh
parse_srcversion()
{
        local IFS=.
        set -- ${SRCVERSION%%-*}
        VERSION=$1
        PATCHLEVEL=${2:-0}
        SUBLEVEL=${3:-0}
        EXTRAVERSION=${SRCVERSION#${SRCVERSION%%-*}}
}
parse_srcversion

EXTRA_SYMBOLS=$(set -- $([ -e $(dirname $0)/extra-symbols ] && cat $(dirname 
$0)/extra-symbols) ; echo $*)

series=$(mktemp)
tmp_files="$series"
trap 'rm -rf $tmp_files' EXIT
warned=false
while read patch; do
        dir=${patch%/*}
        for p in "${path[@]}"; do
                if test -d "$p/$dir"; then
                        echo "$p/$patch"
                        continue 2
                fi
        done
        for p in "${path[@]}"; do
                if test -e "$p/$dir.tar.bz2"; then
                        echo "unpacking $p/$dir.tar.bz2" >&2
                        if ! $warned; then
                                echo "pass --patches <directory with unpacked 
tarballs> to avoid this" >&2
                                warned=true
                        fi
                        tmp_files="$tmp_files $dir"
                        tar -xjf "$p/$dir.tar.bz2"
                        echo "$patch"
                        continue 2
                fi
        done
        echo "Can't find $patch" >&2
        exit 1
done >"$series" < <($(dirname $0)/guards $EXTRA_SYMBOLS <series.conf)

# Parse all the changes to KERNELRELEASE out of all patches and
# convert them to shell code that can be evaluated. Evaluate it.
eval "$(
    <"$series" xargs awk '
    /^--- |^\+\+\+ / \
        { M = match($2, /^[^\/]+\/Makefile( \t|$)/) }
    M && /^+(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)/ \
        { print }
    ' \
    | sed -e 's,^+,,' -e 's, *= *\(.*\),="\1",'
)"

echo "$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
++++++ config-options.changes.txt ++++++
++++ 1587 lines (skipped)

++++++ config.conf ++++++
# Kernel configuration file selection.
# See the arch-symbols script for a list of symbols defined.
# -syms excludes a flavor from the kernel-syms package (vanilla is excluded
# automatically).

#
# IMPORTANT: the subdirectory names map to cpuarch
#            kernel-binary and kernel-source rely on this
#

+i386           i386/default
+i386           i386/desktop
+i386           i386/pae
+i386 -syms     i386/debug
+i386           i386/xen
+i386 -syms     i386/ec2
+i386           i386/vanilla

+x86_64         x86_64/default
+x86_64         x86_64/desktop
+x86_64         x86_64/xen
+x86_64 -syms   x86_64/ec2
+x86_64 -syms   x86_64/debug
+x86_64         x86_64/vanilla

+ppc            ppc/default
+ppc            ppc/vanilla
+ppc64          ppc64/default
+ppc64 -syms    ppc64/debug
+ppc64          ppc64/vanilla

+ppc64le        ppc64le/default
+ppc64le -syms  ppc64le/debug
+ppc64le        ppc64le/vanilla

# ARM architectures
+armv6hl        armv6hl/default
+armv7hl        armv7hl/default
+armv7hl        armv7hl/lpae
+arm64          arm64/default

+s390x          s390x/default
+s390x          s390x/vanilla
++++++ config.sh ++++++
# The version of the main tarball to use
SRCVERSION=3.16
# variant of the kernel-source package, either empty or "-rt"
VARIANT=
# buildservice projects to build the kernel against
OBS_PROJECT=openSUSE:13.2:Update
++++++ configtool.pl ++++++
#!/usr/bin/perl
#
# Merge two kernel configs, eliminating duplicated assignments.
# TODO:
#   support for #include-style directives in config files, to make the
#   kernel configs more maintainable

use strict;
use warnings;

# ( { source => <file> name => ... value => ...}, { comment => ...}, ... )
my @lines;
# references into the @lines array
my %variables;

sub store_var {
        my ($file, $line, $name, $value) = @_;

        if (exists($variables{$name})) {
                if ($variables{$name}->{source} eq $file) {
                        print STDERR "$file:$line: warning: $name redefined\n";
                }
        } else {
                my $new = {};
                push(@lines, $new);
                $variables{$name} = $new;
        }
        $variables{$name}->{source} = $file;
        $variables{$name}->{name} = $name;
        $variables{$name}->{value} = $value;
}

sub store_comment {
        my ($comment) = @_;

        push(@lines, { comment => $comment });
}

while (<>) {
        chomp;
        if (/^CONFIG_(\w+)=(.*)/) {
                store_var($ARGV, $., $1, $2);
        } elsif (/^# CONFIG_(\w+) is not set/) {
                store_var($ARGV, $., $1, 'n');
        } elsif (/^$|^#/) {
                store_comment($_);
        } else {
                print STDERR "$ARGV:$.: warning: ignoring unknown line\n";
        }
}

for my $line (@lines) {
        if (exists($line->{comment})) {
                print "$line->{comment}\n";
        } elsif ($line->{value} eq 'n') {
                print "# CONFIG_$line->{name} is not set\n";
        } else {
                print "CONFIG_$line->{name}=$line->{value}\n";
        }
}
++++++ constraints.in ++++++
<constraints>
  <hardware>
    <disk>
      <size unit="G">7</size>
    </disk>
  </hardware>

  <overwrite>
    <conditions>
      <arch>i586</arch>
      <arch>x86_64</arch>
@BINARY_PACKAGES_XML@
    </conditions>
    <hardware>
      <processors>8</processors>
      <disk>
        <size unit="G">14</size>
      </disk>
    </hardware>
  </overwrite>

  <overwrite>
    <conditions>
      <arch>ppc</arch>
      <arch>ppc64</arch>
      <arch>ppc64le</arch>
@BINARY_PACKAGES_XML@
    </conditions>
    <hardware>
      <processors>4</processors>
      <disk>
        <size unit="G">10</size>
      </disk>
    </hardware>
  </overwrite>

  <overwrite>
    <conditions>
      <arch>i586</arch>
      <arch>x86_64</arch>
      <package>kernel-obs-qa</package>
    </conditions>
    <sandbox>kvm</sandbox>
  </overwrite>

  <overwrite>
    <conditions>
      <arch>i586</arch>
      <arch>x86_64</arch>
      <package>kernel-obs-qa-xen</package>
    </conditions>
    <sandbox>xen</sandbox>
  </overwrite>
</constraints>

++++++ devel-post.sh ++++++
relink() {
    if [ -h "$2" ]; then
        local old=$(readlink "$2")
        [ "$old" = "$1" ] && return 0
        echo "Changing symlink $2 from $old to $1"
    elif [ -e "$2" ]; then
        echo "Replacing file $2 with symlink to $1"
    fi
    rm -f "$2" \
    && ln -s "$1" "$2"
}

release="@KERNELRELEASE@@SRCVARIANT@-obj"
arch_flavor="@CPU_ARCH_FLAVOR@"

relink ../../linux-$release/"$arch_flavor" /usr/src/linux-obj/"$arch_flavor"
++++++ devel-pre.sh ++++++
# handle update from an older kernel-source with linux-obj as symlink
if [ -h /usr/src/linux-obj ]; then
    rm -vf /usr/src/linux-obj
fi
++++++ find-provides ++++++
#! /bin/bash

trap 'rm -f "$filelist"' EXIT
filelist=$(mktemp -t ${0##*/}.XXXXXXXXXX)
grep -v '/kernel/drivers/staging/.*\.ko$' >"$filelist"
shopt -s nullglob

# pretend that /boot/vmlinux-* is in the -base package and not in -devel
if grep -q '/boot/System\.map\>' "$filelist"; then
        prefix=$(sed -rn 's:(.*)/boot/System\.map\>.*:\1:p; T; q' "$filelist")
        for f in "$prefix"/boot/vmlinux*; do
                echo "$f" >>"$filelist"
        done
else
        perl -ni -e 'next if /\/boot\/vmlinux/ && !/\.debug$/; print' 
"$filelist"
fi

/usr/lib/rpm/find-provides "$@" <"$filelist"
++++++ group-source-files.pl ++++++
#!/usr/bin/perl

use Getopt::Long;
use strict;

&main();
sub main
{
        my($dev_output, $ndev_output, $loc) = ("-", "-", ".");
        &Getopt::Long::Configure(qw(bundling));
        &GetOptions(
                "D=s" => \$dev_output,
                "N=s" => \$ndev_output,
                "L=s" => \$loc,
        );

        my($dev, $ndev) = &scan($loc);
        &output($dev, $ndev, $dev_output, $ndev_output);
}

sub scan
{
        my $loc = shift @_;
        my(@dev, @ndev);

        foreach $_ (`find "$loc"`)
        {
                chomp $_;
                if (-d $_ && !-l $_) {
                        # Generate directory list later.
                        next;
                }
                my $is_devel =
                        m{^\Q$loc\E.*/Kconfig} ||
                        m{^\Q$loc\E.*/Kbuild} ||
                        m{^\Q$loc\E.*/Makefile} ||
                        m{^\Q$loc\E/arch/[^/]+/boot/dts/include/dt-bindings\b} 
||
                        m{^\Q$loc\E/arch/[^/]+/include\b} ||
                        m{^\Q$loc\E/arch/arm/[^/]+/include/mach\b} ||
                        m{^\Q$loc\E/arch/arm/[^/]+/include/plat\b} ||
                        m{^\Q$loc\E/include/[^/]+\b} ||
                        m{^\Q$loc\E/scripts\b};
                if (substr($_, 0, 1) ne "/") {
                        # We cannot use an absolute path during find,
                        # but rpm wants one later.
                        $_ = "/$_";
                }
                $is_devel ? push(@dev, $_) : push(@ndev, $_);
        }

        push(@dev, &calc_dirs("/$loc", \@dev));
        push(@ndev, &calc_dirs("/$loc", \@ndev));
        return (\@dev, \@ndev);
}

sub calc_dirs
{
        my($base, $files) = @_;
        my %dirs;

        foreach my $file (@$files) {
                my $path = $file;
                do {
                        $path =~ s{/[^/]+$}{};
                        $dirs{$path} = 1;
                } while ($path ne $base);
                # This loop also makes sure that $base itself is included.
        }

        return map { "\%dir $_" } keys %dirs;
}

sub output
{
        my($dev, $ndev, $dev_out, $ndev_out) = @_;
        local *FH;

        open(FH, "> $dev_out") || warn "Error writing to $dev_out: $!";
        print FH join("\n", @$dev), "\n";
        close FH;

        open(FH, "> $ndev_out") || warn "Error writing to $ndev_out: $!";
        print FH join("\n", @$ndev), "\n";
        close FH;
}
++++++ guards ++++++
#!/usr/bin/perl -w
#############################################################################
# Copyright (c) 2003-2007,2009 Novell, Inc.
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact Novell, Inc.
#
# To contact Novell about this file by physical or electronic mail,
# you may find current contact information at www.novell.com
#############################################################################
#
# Guards:
#
# +xxx   include if xxx is defined
# -xxx   exclude if xxx is defined
# +!xxx  include if xxx is not defined
# -!xxx  exclude if xxx is not defined
#

use FileHandle;
use Getopt::Long;
use strict;

# Prototypes
sub files_in($$);
sub parse($$);
sub help();

sub slashme($) {
    my ($dir) = @_;
    $dir =~ s#([^/])$#$&/#; # append a slash if necessary
    if ($dir eq './') {
        return '';
    } else {
        return $dir;
    }
}

# Generate a list of files in a directory
#
sub files_in($$) {
    my ($dir, $path) = @_;
    my $dh = new FileHandle;
    my (@files, $file);

    # @<file> syntax
    if ($path =~ s/^@//) {
        my $fh;
        open($fh, '<', $path) or die "$path: $!\n";
        @files = <$fh>;
        close($fh);
        chomp(@files);
        s:^$dir:: for @files;
        return @files;
    }

    $path = slashme($path);
    opendir $dh, length("$dir$path") ? "$dir$path" : '.'
        or die "$dir$path: $!\n";
    while ($file = readdir($dh)) {
        next if $file =~ /^(\.|\.\.|\.#.*|CVS|.*~)$/;
        if (-d "$dir$path$file") {
                @files = (@files, files_in($dir, "$path$file/"));
        } else {
                #print "[$path$file]\n";
                push @files, "$path$file";
        }
    }
    closedir $dh;
    return @files;
}

# Parse a configuration file
# Callback called with ($patch, @guards) arguments
#
sub parse($$) {
    my ($fh, $callback) = @_;

    my $line = "";

    while (<$fh>) {
        chomp;
        s/(^|\s+)#.*//;
        if (s/\\$/ /) {
                $line .= $_;
                next;
        }
        $line .= $_;
        my @guards = ();
        foreach my $token (split /[\s\t\n]+/, $line) {
            next if $token eq "";
            if ($token =~ /^[-+]/) {
                push @guards, $token;
            } else {
                #print "[" . join(",", @guards) . "] $token\n";
                &$callback($token, @guards);
            }
        }
        $line = "";
    }
}

# Command line options
#
my ($dir, $config, $default, $check, $list, $invert_match, $with_guards) =
   (  '',     '-',        1,      0,     0,             0,            0);
my @path;

# Help text
#
sub help() {
    print "$0 - select from a list of files guarded by conditions\n";
    print "SYNOPSIS: $0 [--prefix=dir] [--path=dir1:dir2:...]\n" .
        "       [--default=0|1] [--check|--list] [--invert-match]\n" .
        "       [--with-guards] [--config=file] symbol ...\n\n" .
        "       Defaults: --default=$default\n" .
        "       Use --path=\@<file> to read the list of entries from <file>\n";
    exit 0;
}

# Parse command line options
#
Getopt::Long::Configure ("bundling");
eval {
    unless (GetOptions (
        'd|prefix=s' => \$dir,
        'c|config=s' => \$config,
        'C|check' => \$check,
        'l|list' => \$list,
        'w|with-guards' => \$with_guards,
        'p|path=s' => \@path,
        'D|default=i' => \$default,
        'v|invert-match' => \$invert_match,
        'h|help' => sub { help(); exit 0; })) {
        help();
        exit 1;
    }
};
if ($@) {
    print "$@";
    help();
    exit 1;
}

@path = ('.')
    unless (@path);
@path = split(/:/, join(':', @path));

my $fh = ($config eq '-') ? \*STDIN : new FileHandle($config)
    or die "$config: $!\n";

$dir = slashme($dir);

if ($check) {
    # Check for duplicate files, or for files that are not referenced by
    # the specification.

    my $problems = 0;
    my @files;

    foreach (@path) {
        @files = (@files, files_in($dir, $_));
    }
    my %files = map { $_ => 0 } @files;

    parse($fh, sub {
        my ($patch, @guards) = @_;
        if (exists $files{$patch}) {
            $files{$patch}++;
        } else {
            if ($config eq '-') {
                print "Not found: $dir$patch\n";
            } else {
                print "In $config but not found: $dir$patch\n";
            }
            $problems++;
        }});

    $fh->close();

    my ($file, $ref);
    while (($file, $ref) = each %files) {
        next if $ref == 1;

        if ($ref == 0) {
            if ($config eq '-') {
                print "Unused: $file\n";
            } else {
                print "Not in $config: $file\n";
            }
            $problems++;
        }
        if ($ref > 1) {
            print "Warning: multiple uses";
            print " in $config" if $config ne '-';
            print ": $file\n";
            # This is not an error if the entries are mutually exclusive...
        }
    }
    exit $problems ? 1 : 0;

} elsif ($list) {
    parse($fh, sub {
        my ($patch, @guards) = @_;
        print join(' ', @guards), ' '
                if (@guards && $with_guards);
        print "$dir$patch\n";
        });
} else {
    # Generate a list of patches to apply.

    my %symbols = map { $_ => 1 } @ARGV;

    parse($fh, sub {
        my ($patch, @guards) = @_;

        my $selected;
        if (@guards) {
            # If the first guard is -xxx, the patch is included by default;
            # if it is +xxx, the patch is excluded by default.
            $selected = ($guards[0] =~ /^-/);

            foreach (@guards) {
                /^([-+])(!?)(.*)?/
                    or die "Bad guard '$_'\n";

                # Check if the guard matches
                if (($2 eq '!' && !exists $symbols{$3}) ||
                    ($2 eq ''  && ( $3 eq '' || exists $symbols{$3}))) {
                    # Include or exclude
                    $selected = ($1 eq '+');
                }
            }
        } else {
            # If there are no guards, use the specified default result.
            $selected = $default;
        }

        print "$dir$patch\n"
            if $selected ^ $invert_match;
        });

    $fh->close();

    exit 0;
}

__END__

=head1 NAME

guards - select from a list of files guarded by conditions

=head1 SYNOPSIS

F<guards> [--prefix=F<dir>] [--path=F<dir1:dir2:...>] [--default=<0|1>]
[--check|--list] [--invert-match] [--with-guards] [--config=<file>]
I<symbol> ...

=head1 DESCRIPTION

The script reads a configuration file that may contain so-called guards, file
names, and comments, and writes those file names that satisfy all guards to
standard output. The script takes a list of symbols as its arguments. Each line
in the configuration file is processed separately. Lines may start with a
number of guards. The following guards are defined:

=over

+I<xxx> Include the file(s) on this line if the symbol I<xxx> is defined.

-I<xxx> Exclude the file(s) on this line if the symbol I<xxx> is defined.

+!I<xxx> Include the file(s) on this line if the symbol I<xxx> is not defined.

-!I<xxx> Exclude the file(s) on this line if the symbol I<xxx> is not defined.

- Exclude this file. Used to avoid spurious I<--check> messages.

=back

The guards are processed left to right. The last guard that matches determines
if the file is included. If no guard is specified, the I<--default>
setting determines if the file is included.

If no configuration file is specified, the script reads from standard input.

The I<--check> option is used to compare the specification file against the
file system. If files are referenced in the specification that do not exist, or
if files are not enlisted in the specification file warnings are printed. The
I<--path> option can be used to specify which directory or directories to scan.
Multiple directories are separated by a colon (C<:>) character. The
I<--prefix> option specifies the location of the files. Alternatively, the
I<--path=@E<lt>fileE<gt>> syntax can be used to specify a file from which the
file names will be read.

Use I<--list> to list all files independent of any rules. Use I<--invert-match>
to list only the excluded patches. Use I<--with-guards> to also include all
inclusion and exclusion rules.

=head1 AUTHOR

Andreas Gruenbacher <agr...@suse.de>, SUSE Labs
++++++ host-memcpy-hack.h ++++++
#ifdef __x86_64__
/* 
 * Force the linker to use the older memcpy variant, so that the user programs
 * work on older systems
 */
__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
#endif
++++++ kabi.pl ++++++
#!/usr/bin/perl
use strict;
use warnings;

use Getopt::Long;
use Data::Dumper;

# ( { sym => regexp, mod => regexp, fail => 0/1 }, ... )
my @rules;
my ($opt_verbose, $opt_rules);

sub load_rules {
        my $file = shift;
        my $errors = 0;

        xopen(my $fh, '<', $file);
        while (<$fh>) {
                chomp;
                s/#.*//;
                next if /^\s*$/;
                my ($pattern, $verdict) = split(/\s+/);
                my $new = {};
                if (uc($verdict) eq "PASS") {
                        $new->{fail} = 0;
                } elsif (uc($verdict) eq "FAIL") {
                        $new->{fail} = 1;
                } else {
                        print STDERR "$file:$.: invalid verdict \"$verdict\", 
must be either PASS or FAIL.\n";
                        $errors++;
                        next;
                }
                # simple glob -> regexp conversion
                $pattern =~ s/\*/.*/g;
                $pattern =~ s/\?/./g;
                $pattern =~ s/.*/^$&\$/;
                if ($pattern =~ /\/|^vmlinux$/) {
                        $new->{mod} = $pattern;
                } else {
                        $new->{sym} = $pattern;
                }
                push(@rules, $new);
        }
        if ($errors && !@rules) {
                print STDERR "error: only garbage found in $file.\n";
                exit 1;
        }
        close($fh);
}

sub load_symvers {
        my $file = shift;
        my %res;
        my $errors = 0;

        xopen(my $fh, '<', $file);
        while (<$fh>) {
                my @l = split(/\s+/);
                if (@l < 3) {
                        print STDERR "$file:$.: unknown line\n";
                        $errors++;
                        next;
                }
                my $new = { crc => $l[0], mod => $l[2] };
                $res{$l[1]} = $new;
        }
        if (!%res) {
                print STDERR "error: no symvers found in $file.\n";
                exit 1;
        }
        close($fh);
        return %res;
}

my $kabi_errors = 0;
sub kabi_change {
        my ($sym, $mod, $oldcrc, $newcrc) = @_;
        my $fail = 1;

        for my $rule (@rules) {
                if ($rule->{mod} && $mod =~ $rule->{mod} ||
                    $rule->{sym} && $sym =~ $rule->{sym}) {
                        $fail = $rule->{fail};
                        last;
                }
        }
        return unless $fail or $opt_verbose;
        print STDERR "KABI: symbol $sym($mod) ";
        if ($newcrc) {
                print STDERR "changed crc from $oldcrc to $newcrc"
        } else {
                print STDERR "lost";
        }
        if ($fail) {
                $kabi_errors++;
                print STDERR "\n";
        } else {
                print STDERR " (tolerated)\n";
        }
}

sub xopen {
        open($_[0], $_[1], @_[2..$#_]) or die "$_[2]: $!\n";
}

my $res = GetOptions(
        'verbose|v' => \$opt_verbose,
        'rules|r=s' => \$opt_rules,
);
if (!$res || @ARGV != 2) {
        print STDERR "Usage: $0 [--rules <rules file>] Module.symvers.old 
Module.symvers\n";
        exit 1;
}
if (defined($opt_rules)) {
        load_rules($opt_rules);
}
my %old = load_symvers($ARGV[0]);
my %new = load_symvers($ARGV[1]);

for my $sym (sort keys(%old)) {
        if (!$new{$sym}) {
                kabi_change($sym, $old{$sym}->{mod}, $old{$sym}->{crc}, 0);
        } elsif ($old{$sym}->{crc} ne $new{$sym}->{crc}) {
                kabi_change($sym, $new{$sym}->{mod}, $old{$sym}->{crc},
                        $new{$sym}->{crc});
        }
}
if ($kabi_errors) {
        print STDERR "KABI: aborting due to kabi changes.\n";
        exit 1;
}
exit 0;
++++++ kernel-binary.spec.in ++++++
++++ 952 lines (skipped)

++++++ kernel-cert-subpackage ++++++
%package -n %{-n*}-ueficert
Summary: UEFI Secure Boot Certificate For Package %{-n*}-kmp
Group: System/Kernel
%description -n %{-n*}-ueficert
This package contains the UEFI Secure Boot certificate used to sign
modules in the %{-n*}-kmp packages.

# The scriptlets are reused in kernel-binary.spec.in by a sed script that
# stops at the next line that starts with a percent sign
%post -n %{-n*}-ueficert
if ! command -v mokutil >/dev/null; then
        exit 0
fi
# XXX: Only call mokutil if UEFI and shim are used
for cert in @CERTS@; do
        if ! mokutil --import "$cert" --root-pw; then
                echo "Failed to import $cert"
        fi
done
exit 0

%preun -n %{-n*}-ueficert
if ! command -v mokutil >/dev/null; then
        exit 0
fi
for cert in @CERTS@; do
        ln "$cert" "$cert.delete"
done
exit 0

%postun -n %{-n*}-ueficert
if ! command -v mokutil >/dev/null; then
        exit 0
fi
for cert in @CERTS@; do
        if ! test -e "$cert"; then
                if ! mokutil --delete "$cert.delete" --root-pw; then
                        echo "Failed to delete $cert"
                fi
        fi
        rm "$cert.delete"
done
exit 0

%files -n %{-n*}-ueficert
%defattr(-, root, root)
%dir /etc/uefi
/etc/uefi/certs
++++++ kernel-docs.spec.in ++++++
#
# spec file for package kernel-docs@VARIANT@
#
# Copyright (c) @YEAR@ SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define patchversion @PATCHVERSION@
%define variant @VARIANT@%{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-docs@VARIANT@
Summary:        Kernel Documentation
License:        GPL-2.0
Group:          Documentation/Man
Version:        @RPMVERSION@
%if 0%{?is_kotd}
Release:        <RELEASE>.g@COMMIT@
%else
Release:        @RELEASE@
%endif
BuildRequires:  kernel-source%variant
BuildRequires:  xmlto
Url:            http://www.kernel.org/
Provides:       %name = %version-%source_rel
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source:         kernel-spec-macros

%description
These are the man pages (section 9) built from the current kernel sources.

%source_timestamp
%prep
%setup -T -c

%build
export LANG=en_US
make -C /usr/src/linux%variant O=$PWD mandocs %{?jobs:-j%jobs}

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/%{_mandir}/man9
# filter out obscure device drivers - they clutter up the rpm and don't add any 
real value
find Documentation/DocBook/ -name '*.9.gz' | 
egrep -v 
'man/(sis[69]|rio|fsl|struct_rio|RIO|mpc85|set_rx_mode|mdio_(read|write)|mii_ioctl|mca_|z8530|nand|sppp|piix|(read|write)_zs)'
 |  
while read i ; do
        cp $i $RPM_BUILD_ROOT/%{_mandir}/man9
done
if [ -d Documentation/kdb ] ; then
    for i in Documentation/kdb/*.m* ; do
        k=`basename $i`
        k=${k/man/9}
        k=${k/mm/9}
        cp $i $RPM_BUILD_ROOT/%{_mandir}/man9/$k
    done
fi

ln -s /usr/share/man/man9/request_threaded_irq.9.gz 
$RPM_BUILD_ROOT/usr/share/man/man9/request_irq.9.gz

cp -a 
/usr/src/linux%variant/{COPYING,CREDITS,MAINTAINERS,README,REPORTING-BUGS} .

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc COPYING CREDITS MAINTAINERS README REPORTING-BUGS
%{_mandir}/man9/*

%changelog
++++++ kernel-module-subpackage ++++++
%package -n %{-n*}-kmp-%1
%define _this_kmp_version %{-v*}_k%(echo %2 | sed -r 'y/-/_/; 
s/^(2\.6\.[0-9]+)_/\\1.0_/; # use 2.6.x.0 for mainline kernels')
Version: %_this_kmp_version
Release: %{-r*}
%(
for spec in {%_sourcedir,%_specdir}/%name.spec /dev/null; do
    [ -e $spec ] && break
done
awk '
BEGIN           { tags["summary"] = "Summary: %summary"
                  tags["group"] = "Group: %group" }
/^%%/           { in_pkg_header = \
                  ($0 ~ /^%%package[ \t]+KMP[ \t]*$/ ||
                   $0 ~ /^%%package[ \t]+-n[ \t]*%name-KMP[ \t]*$/)
                  next }
in_pkg_header && /^(Summary|Group):[ \t]*/ \
                { tag = tolower($1) ; sub(/:$/, "", tag)
                  tags[tag] = $0 }
END             { print tags["summary"]
                  print tags["group"] }
' $spec
)
Provides: %{-n*}-kmp = %_this_kmp_version
Provides: %{-n*}-kmp = %{-v*}
Provides: multiversion(kernel)
Requires: coreutils grep
%{-c:Requires: %{-n*}-ueficert}
Enhances: kernel-%1
%if %1 == "default"
Obsoletes: %{-n*}-trace
%ifarch %ix86
Obsoletes: %{-n*}-vmi
%endif
%endif
AutoReqProv: on
%{-p:%{expand:%(cd %_sourcedir; cat %{-p*})}}
%description -n %{-n*}-kmp-%1
%(
for spec in {%_sourcedir,%_specdir}/%name.spec /dev/null; do
    [ -e $spec ] && break
done
awk '
/^%%/           { in_desc = \
                  ($0 ~ /^%%description[ \t]+KMP[ \t]*$/ ||
                   $0 ~ /^%%description[ \t]+-n[ \t]*%name-KMP[ \t]*$/)
                  next }
in_desc         { print; good = 1 }
END             { exit(! good) }
' $spec || \
awk '
/^%%/           { in_desc = \
                  ($0 ~ /^%%description[ \t]*$/ ||
                   $0 ~ /^%%description[ \t]+-n[ \t]*%name[ \t]*$/)
                  next }
in_desc         { print; good = 1 }
END             { exit(! good) }
' $spec
)
%post -n %{-n*}-kmp-%1
nvr=%{-n*}-kmp-%1-%_this_kmp_version-%{-r*}
wm2=/usr/lib/module-init-tools/weak-modules2
if [ -x $wm2 ]; then
    %{-b:KMP_NEEDS_MKINITRD=1} INITRD_IN_POSTTRANS=1 /bin/bash -${-/e/} $wm2 
--add-kmp $nvr
fi
%posttrans -n %{-n*}-kmp-%1
%{?regenerate_initrd_posttrans}
%preun -n %{-n*}-kmp-%1
nvr=%{-n*}-kmp-%1-%_this_kmp_version-%{-r*}
rpm -ql $nvr | sed -n '/\.ko$/p' > /var/run/rpm-$nvr-modules
%postun -n %{-n*}-kmp-%1
nvr=%{-n*}-kmp-%1-%_this_kmp_version-%{-r*}
modules=( $(cat /var/run/rpm-$nvr-modules) )
rm -f /var/run/rpm-$nvr-modules
if [ ${#modules[*]} = 0 ]; then
    echo "WARNING: $nvr does not contain any kernel modules" >&2
    exit 0
fi
wm2=/usr/lib/module-init-tools/weak-modules2
if [ -x $wm2 ]; then
    printf '%s\n' "${modules[@]}" | /bin/bash -${-/e/} $wm2 --remove-kmp $nvr
fi
%files -n %{-n*}-kmp-%1
%{-f:%{expand:%(cd %_sourcedir; cat %{-f*})}}
%{!-f:%defattr (-,root,root)}
%{!-f:/lib/modules/%2-%1}
++++++ kernel-obs-build.spec.in ++++++
#
# spec file for package kernel-obs-build
#
# Copyright (c) @YEAR@ SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# needsrootforbuild


#!BuildIgnore: post-build-checks

%define patchversion @PATCHVERSION@
%define variant @VARIANT@%{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-obs-build
BuildRequires:  coreutils
BuildRequires:  device-mapper
BuildRequires:  util-linux

BuildRequires:  kernel-default
%ifarch %ix86 x86_64
BuildRequires:  kernel-xen
%endif
ExclusiveArch:  @ARCHS@
%if 0%{?suse_version} < 1315
# For SLE 11 
BuildRequires:  mkinitrd
BuildRequires:  perl-Bootloader
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%else
BuildRequires:  dracut
%endif
Summary:        package kernel and initrd for OBS VM builds
License:        GPL-2.0
Group:          SLES
Version:        @RPMVERSION@
%if 0%{?is_kotd}
Release:        <RELEASE>.g@COMMIT@
%else
Release:        @RELEASE@
%endif

%description
This package is repackaging already compiled kernels to make them usable
inside of Open Build Service (OBS) VM builds. An initrd with some basic
kernel modules is generated as well, but further kernel modules can be 
loaded during build when installing the kernel package.

%prep

%build
mkdir -p /usr/lib/dracut/modules.d/80obs
cat > /usr/lib/dracut/modules.d/80obs/module-setup.sh <<EOF
#!/bin/bash

# called by dracut
check() {
    return 0
}

# called by dracut
installkernel() {
    hostonly='' instmods obs
}

# called by dracut
install() {
    inst_hook pre-udev 10 "\$moddir"/setup_obs.sh
}
EOF
chmod a+rx /usr/lib/dracut/modules.d/80obs/module-setup.sh
cat > /usr/lib/dracut/modules.d/80obs/setup_obs.sh <<EOF
#!/bin/sh
info "Loading kernel modules for OBS"
info "  Loop..."
modprobe loop max_loop=64 lbs=0 || modprobe loop max_loop=64
info "  binfmt misc..."
modprobe binfmt_misc
EOF
chmod a+rx /usr/lib/dracut/modules.d/80obs/setup_obs.sh

# a longer list to have them also available for qemu cross builds where x86_64 
kernel runs in eg. arm env.
# this list of modules where available on build workers of build.opensuse.org, 
so we stay compatible.
export KERNEL_MODULES="loop dm-mod dm-snapshot binfmt-misc fuse kqemu squashfs 
ext2 ext3 ext4 reiserfs btrfs nf_conntrack_ipv6 binfmt_misc virtio_pci 
virtio_mmio virtio_blk virtio_rng fat vfat nls_cp437 nls_iso8859-1 ibmvscsi 
ibmvscsic"

# manually load all modules to make sure they're available
for i in $KERNEL_MODULES; do
(
  echo "info '  $i'"
  echo "modprobe $i"
) >> /usr/lib/dracut/modules.d/80obs/setup_obs.sh
done

ROOT=""
[ -e "/dev/vda" ] && ROOT="-d /dev/vda"
[ -e /dev/hda1 ] && ROOT="-d /dev/hda1" # for xen builds
%define kernel_name vmlinu?
%ifarch s390 s390x
%define kernel_name image
%endif
%ifarch %arm
%define kernel_name zImage
%endif
%ifarch aarch64
%define kernel_name Image
%endif

%if 0%{?suse_version} < 1315
# For SLE 11 
/sbin/mkinitrd $ROOT \
               -m "$KERNEL_MODULES" \
               -k /boot/%{kernel_name}-*-default -M /boot/System.map-*-default 
-i /tmp/initrd.kvm -B
%ifarch %ix86 x86_64
/sbin/mkinitrd $ROOT \
               -m "$KERNEL_MODULES" \
               -k /boot/vmlinuz-xen -M /boot/System.map-*-xen -i /tmp/initrd.xen
%endif
%else
dracut --host-only --drivers="$KERNEL_MODULES" --force /tmp/initrd.kvm `echo 
/boot/%{kernel_name}-*-default | sed -n -e 's,[^-]*-\(.*-default\),\1,p'`
%ifarch %ix86 x86_64
dracut --host-only --drivers="$KERNEL_MODULES xenblk" --force /tmp/initrd.xen 
`echo /boot/%{kernel_name}-*-xen | sed -n -e 's,[^-]*-\(.*-xen\),\1,p'`
%endif
%endif


#cleanup
rm -rf /usr/lib/dracut/modules.d/80obs

%install
install -d -m 0755 $RPM_BUILD_ROOT
cp -v /boot/%{kernel_name}-*-default $RPM_BUILD_ROOT/.build.kernel.kvm
cp -v /tmp/initrd.kvm $RPM_BUILD_ROOT/.build.initrd.kvm
%ifarch %ix86 x86_64
cp -v /boot/%{kernel_name}-*-xen $RPM_BUILD_ROOT/.build.kernel.xen
cp -v /tmp/initrd.xen $RPM_BUILD_ROOT/.build.initrd.xen
%endif

#inform worker about arch
#see obs-build commit e47399d738e51
uname -m > $RPM_BUILD_ROOT/.build.hostarch.kvm

%files
%defattr(-,root,root)
/.build.kernel.*
/.build.initrd.*
/.build.hostarch.*

%changelog
++++++ kernel-obs-qa.spec.in ++++++
#
# spec file for package kernel-obs-qa
#
# Copyright (c) @YEAR@ SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# needsrootforbuild


%define patchversion @PATCHVERSION@
%define variant @VARIANT@%{nil}

%include %_sourcedir/kernel-spec-macros

Name:           @NAME@
BuildRequires:  kernel-@FLAVOR@
# kernel-obs-build must be also configured as VMinstall, but is required
# here as well to avoid that qa and build package build parallel
BuildRequires:  kernel-obs-build
BuildRequires:  modutils
ExclusiveArch:  @ARCHS@
%if 0%{?suse_version} < 1200
# for SLE 11
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%endif
Summary:        Basic QA tests for the kernel
License:        GPL-2.0
Group:          SLES
Version:        @RPMVERSION@
%if 0%{?is_kotd}
Release:        <RELEASE>.g@COMMIT@
%else
Release:        @RELEASE@
%endif

%description
This package is using the kernel compiled within Open Build Service(OBS)
projects and runs basic tests.

%prep

%build

%check
# More tests are comming, currently the main test is the existens of
# this spec file. It does trigger a build within OBS VM which is using
# the kernel of the same project.

# test suites should be packaged in other packages, but build required
# and called here.

krel=$(uname -r)
if test ! -d "/lib/modules/$krel/kernel"; then
        echo "Kernel package for $krel not installed; exiting"
        exit 0
fi
/sbin/modprobe loop

%install
mkdir -p %{buildroot}/usr/share/%name
touch %{buildroot}/usr/share/%name/logfile

%files
%defattr(-,root,root)
/usr/share/%name

%changelog
++++++ kernel-source.rpmlintrc ++++++
# These zero-length files are correct:
addFilter("zero-length /usr/src/linux-3\..*obj/.*include/config.*h")
# vdsos are special
addFilter("shared-lib-without-dependency-information 
/lib/modules/3\..*/vdso/.*")
addFilter("missing-PT_GNU_STACK-section /lib/modules/3\..*/vdso/")
# This is a stale symlink until the kernel-source package is installed:
addFilter("dangling-symlink /lib/modules/3\..*/source")
# These hidden files are fine:
addFilter ("hidden-file-or-dir /usr/src/linux-3\..*-obj/.*/.config")
addFilter ("hidden-file-or-dir 
/usr/src/linux-3\..*-obj/.*/.kernel-binary.spec.buildenv")
++++++ kernel-source.spec.in ++++++
#
# spec file for package kernel-source@VARIANT@
#
# Copyright (c) @YEAR@ SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# icecream 0


%define srcversion @SRCVERSION@
%define patchversion @PATCHVERSION@
%define variant @VARIANT@%{nil}
%define vanilla_only @VANILLA_ONLY@

%include %_sourcedir/kernel-spec-macros

%define src_install_dir usr/src/linux-%kernelrelease%variant

Name:           kernel-source@VARIANT@
Summary:        The Linux Kernel Sources
License:        GPL-2.0
Group:          Development/Sources
Version:        @RPMVERSION@
%if 0%{?is_kotd}
Release:        <RELEASE>.g@COMMIT@
%else
Release:        @RELEASE@
%endif
Url:            http://www.kernel.org/
AutoReqProv:    off
BuildRequires:  coreutils
BuildRequires:  fdupes
BuildRequires:  sed
Requires(post): coreutils sed
Provides:       %name = %version-%source_rel
Provides:       linux
Provides:       multiversion(kernel)
Source0:        @TARBALL_URL@linux-%srcversion.tar.xz
Source2:        source-post.sh
Source3:        kernel-source.rpmlintrc
Source8:        devel-pre.sh
Source9:        devel-post.sh
Source10:       preun.sh
Source11:       postun.sh
Source12:       pre.sh
Source13:       post.sh
Source14:       series.conf
Source16:       guards
Source17:       apply-patches
Source21:       config.conf
Source23:       supported.conf
Source33:       check-for-config-changes
Source35:       group-source-files.pl
Source36:       README.PATCH-POLICY.SUSE
Source37:       README.SUSE
Source38:       README.KSYMS
Source39:       config-options.changes.txt
Source40:       source-timestamp
Source44:       find-provides
Source45:       split-modules
Source46:       modversions
Source48:       macros.kernel-source
Source49:       kernel-module-subpackage
Source50:       kabi.pl
Source51:       mkspec
Source52:       kernel-source%variant.changes
Source53:       kernel-source.spec.in
Source54:       kernel-binary.spec.in
Source55:       kernel-syms.spec.in
Source56:       kernel-docs.spec.in
Source57:       kernel-cert-subpackage
Source58:       constraints.in
Source60:       config.sh
Source61:       compute-PATCHVERSION.sh
Source62:       old-flavors
Source63:       arch-symbols
Source64:       package-descriptions
Source65:       kernel-spec-macros
Source66:       configtool.pl
Source67:       log.sh
Source68:       host-memcpy-hack.h
Source69:       try-disable-staging-driver
Source70:       kernel-obs-build.spec.in
Source71:       kernel-obs-qa.spec.in
Source72:       compress-vmlinux.sh
Source100:      config.tar.bz2
Source101:      config.addon.tar.bz2
Source102:      patches.arch.tar.bz2
Source103:      patches.drivers.tar.bz2
Source104:      patches.fixes.tar.bz2
Source105:      patches.rpmify.tar.bz2
Source106:      patches.suse.tar.bz2
Source107:      patches.xen.tar.bz2
Source108:      patches.addon.tar.bz2
Source109:      patches.kernel.org.tar.bz2
Source110:      patches.apparmor.tar.bz2
Source111:      patches.rt.tar.bz2
Source112:      patches.trace.tar.bz2
Source113:      patches.kabi.tar.bz2
Source120:      kabi.tar.bz2
Source121:      sysctl.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Prefix:         /usr/src
# Source is only complete with devel files.
Requires:       kernel-devel%variant = %version-%release

%(chmod +x %_sourcedir/{@SCRIPTS@})

%define symbols %(set -- $([ -e %_sourcedir/extra-symbols ] && cat 
%_sourcedir/extra-symbols) ; echo $*)
%define variant_symbols %(case %name in (*-rt) echo "RT" ;; esac)

%define do_vanilla "%variant" == ""

%description
Linux kernel sources with many fixes and improvements.


%source_timestamp
%package -n kernel-devel%variant
Summary:        Development files needed for building kernel modules
Group:          Development/Sources
AutoReqProv:    off
Provides:       kernel-devel%variant = %version-%source_rel
Provides:       multiversion(kernel)
Requires:       kernel-macros

%description -n kernel-devel%variant
Kernel-level headers and Makefiles required for development of
external kernel modules.

%source_timestamp

%package -n kernel-macros
Summary:        RPM macros for building Kernel Module Packages
Group:          Development/Sources
# Note: This does not provide multiversion(kernel) nor is its name decorated
# with the variant (-rt)

%description -n kernel-macros
This package provides the rpm macros and templates for Kernel Module Pakcages

%source_timestamp

%package vanilla
Summary:        Vanilla Linux kernel sources with minor build fixes.
Group:          Development/Sources
AutoReqProv:    off
Provides:       %name-vanilla = %version-%source_rel
Provides:       multiversion(kernel)

%description vanilla
Vanilla Linux kernel sources with minor build fixes.


%source_timestamp

%prep

echo "Symbol(s): %symbols"

# Unpack all sources and patches
%setup -q -c -T @UNPACK_PATCHES@

%build
mkdir -p $RPM_BUILD_ROOT/usr/src
cd $RPM_BUILD_ROOT/usr/src

# Unpack the vanilla kernel sources
tar -xf %{S:0}
if test "%srcversion" != "%kernelrelease%variant"; then
        mv linux-%srcversion linux-%kernelrelease%variant
fi

%if %do_vanilla
%if %vanilla_only
        mv \
%else
        cp -al \
%endif
        linux-%kernelrelease%variant linux-%kernelrelease-vanilla
cd linux-%kernelrelease-vanilla
%_sourcedir/apply-patches --vanilla %_sourcedir/series.conf %my_builddir 
%symbols
rm -f $(find . -name ".gitignore")
cd ..
%endif

%if ! %vanilla_only
ln -sf linux%variant linux%variant  # dummy symlink

cd linux-%kernelrelease%variant
%_sourcedir/apply-patches %_sourcedir/series.conf %my_builddir %symbols
rm -f $(find . -name ".gitignore")

if [ -f %_sourcedir/localversion ] ; then
    cat %_sourcedir/localversion > localversion
fi
%endif

# Hardlink duplicate files automatically (from package fdupes).
%fdupes $RPM_BUILD_ROOT

%install
%if ! %vanilla_only
# Install the documentation and example Kernel Module Package.
DOC=/usr/share/doc/packages/%name-%kernelrelease
mkdir -p %buildroot/$DOC
cp %_sourcedir/README.SUSE %_sourcedir/config-options.changes.txt 
%buildroot/$DOC
ln -s $DOC/README.SUSE %buildroot/%src_install_dir/

%if "%variant" == ""
install -m 755 -d $RPM_BUILD_ROOT/etc/rpm
install -m 644 %_sourcedir/macros.kernel-source $RPM_BUILD_ROOT/etc/rpm/
install -m 755 -d $RPM_BUILD_ROOT/usr/lib/rpm
install -m 644 %_sourcedir/kernel-{module,cert}-subpackage \
    $RPM_BUILD_ROOT/usr/lib/rpm/
%endif

for script in post; do
    sed -e "s:@KERNELRELEASE@:%kernelrelease:g" \
        -e "s:@SRCVARIANT@:%variant:g" \
        %_sourcedir/source-$script.sh > %name-$script.sh
done

pushd "%buildroot"
perl "%_sourcedir/group-source-files.pl" \
        -D "$OLDPWD/devel.files" -N "$OLDPWD/nondevel.files" \
        -L "%src_install_dir"
popd

# kernel-source and kernel-$flavor-devel are built independently, but the
# shipped sources (/usr/src/linux/) need to be older than generated files
# (/usr/src/linux-obj). We rely on the git commit timestamp to not point into
# the future and be thus lower than the timestamps of files built from the
# source (bnc#669669).
ts="$(head -n1 %_sourcedir/source-timestamp)"
find %buildroot/usr/src/linux* ! -type l | xargs touch -d "$ts"

%post -f %name-post.sh

%post -n kernel-devel%variant -f %name-post.sh

%files -f nondevel.files
%defattr(-, root, root)

%files -n kernel-devel%variant -f devel.files
%defattr(-,root,root)
%ghost /usr/src/linux%variant
%doc /usr/share/doc/packages/*

%if "%variant" == ""
%files -n kernel-macros
%defattr(-,root,root)
/etc/rpm/macros.kernel-source
/usr/lib/rpm/kernel-*-subpackage
%endif

%endif

%if %do_vanilla

%files vanilla
%defattr(-, root, root)
/usr/src/linux-%kernelrelease-vanilla
%endif

%changelog
++++++ kernel-spec-macros ++++++
# This file is included by all the kernel-*.spec files

# Build with bash instead of sh as the shell: this turns on bash
# extensions like <(...).
%define _buildshell /bin/bash

%define using_buildservice      0%{?opensuse_bs}

# source_rel is the package release string, without the rebuild counter
# generated by the build service. If the release string has a non-digit
# suffix, we keep that suffix and strip the rightmost digit component.
# This is used in KOTD builds: 2.1.g1234567 -> 2.g1234567
%define source_rel %release
%define obsolete_rebuilds() %nil
%if %using_buildservice
%define source_rel %(echo %release | sed -r 
's/\\.[0-9]+($|\\.[^.]*[^.0-9][^.]*$)/\\1/')
# If the rebuild counter is > 1, obsolete all previous rebuilds (boo#867595)
%define obsolete_rebuilds() %( %{verbose:set -x} \
        set -- $(echo %release | sed -rn 
's/(.*\\.)([0-9]+)($|\\.[^.]*[^.0-9][^.]*$)/\\1 \\2 \\3/p') \
        seq 1 $(($2-1)) | sed "s/.*/Obsoletes: %1 = %version-$1&$3/" \
)
%endif

# how the kernel release string (uname -r) should look like
%define kernelrelease %patchversion-%source_rel

%define my_builddir %_builddir/%{name}-%{version}

# macro to add the source timestamp to package descriptions
%define source_timestamp %(sed '1s/^/Source Timestamp: /' 
%_sourcedir/source-timestamp || :)

# vim: ft=spec
++++++ kernel-syms.spec.in ++++++
#
# spec file for package kernel-syms@VARIANT@
#
# Copyright (c) @YEAR@ SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define variant @VARIANT@%{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-syms@VARIANT@
Summary:        Kernel Symbol Versions (modversions)
License:        GPL-2.0
Group:          Development/Sources
Version:        @RPMVERSION@
%if %using_buildservice
%if 0%{?is_kotd}
Release:        <RELEASE>.g@COMMIT@
%else
Release:        @RELEASE@
%endif
%else
%define kernel_source_release %(LC_ALL=C rpm -q kernel-devel%variant-%version 
--qf "%{RELEASE}" | grep -v 'not installed' || echo 0)
Release:        %kernel_source_release
%endif
Url:            http://www.kernel.org/
AutoReqProv:    off
BuildRequires:  coreutils
@REQUIRES@
Requires:       pesign-obs-integration
Provides:       %name = %version-%source_rel
Provides:       multiversion(kernel)
Source:         README.KSYMS
Requires:       kernel-devel%variant = %version-%source_rel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  @ARCHS@
Prefix:         /usr/src

%description
Kernel symbols, such as functions and variables, have version
information attached to them. This package contains the symbol versions
for the standard kernels.

This package is needed for compiling kernel module packages with proper
package dependencies.


%source_timestamp
%prep

%install
install -m 644 -D %{SOURCE0} %buildroot/%_docdir/%name/README.SUSE

%files
%defattr(-, root, root)
%dir %_docdir/%name
%_docdir/%name/README.SUSE

%changelog
++++++ log.sh ++++++
#! /bin/bash

# log.sh - Automate insertion of patches into a kernel rpm tree managed
# with series.conf
#
# Usage example:
#
# osc branch openSUSE:11.3/kernel-source
# osc co home:philipsb:branches:openSUSE:11.3:Update:Test/kernel-source
# mv ~/linux-2.6/driver-fix-for-something.patch .
# echo -e "\tpatches.drivers/driver-fix-for-something.patch" >> series.conf
# ./log.sh
# osc commit

#############################################################################
# Copyright (c) 2004-2006,2008-2010 Novell, Inc.
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact Novell, Inc.
#
# To contact Novell about this file by physical or electronic mail,
# you may find current contact information at www.novell.com
#############################################################################

# Construct a changes entry and commit log from a patch.

CHANGES=kernel-source.changes

trap 'rm -rf "$tmpdir"' EXIT
tmpdir=$(mktemp -d /tmp/${0##*/}.XXXXXX)
message=$tmpdir/message

log_entry() {
    local entry=$1

    echo "$entry" \
    | fmt --width 65 \
    | sed -e '1s/^/- /' -e '2,$s/^/  /' \
    >> $message
}


patch_meta() {
    local patch=$1

    subject=$(formail -c -x Subject < "$patch" \
             | sed -e 's, *\[[#/ A-Za-z0-9-]*\],,')
    subject=${subject## }
    subject=${subject%.}

    set -- $(formail -c -x References -x Reference < "$patch")
    references="$*"
}

patch_log_entry() {
    local patch=$1 subject references old_subj old_ref old_patch="$tmpdir/old"

    git show "HEAD:$patch" >"$old_patch" 2>/dev/null
    patch_meta "$old_patch"
    old_subj="$subject"
    old_ref="$references"

    patch_meta "$patch"

    local msg
    if test -z "$subject" -o "$subject" != "$old_subj"; then
        msg="$subject${references:+ ($references)}" 
    elif test "$references" != "$old_ref"; then
        if test -n "$references"; then
            msg="Update references ($references)"
        fi
    else
        msg="Refresh"
    fi

    log_entry "$patch: $msg${msg:+.}"
}

find_patches() {
       osc diff series.conf \
       | sed -n "s/^+\s*\(patches.*\)/\1/p"
}

for file in  "$@" $(find_patches); do
    dirname=$(dirname $file)
    basename=$(basename $file)
    archive=$dirname.tar.bz2

    if [ ! -f $basename ]; then
        echo "ERROR: $basename added to series.conf but doesn't exist in $PWD"
        exit 1
    fi

    if [ ! -d $dirname ]; then
        tar xvf $archive
    fi
    
    mv $basename $dirname
    rm $archive
    tar cfj $archive $dirname

    files[${#files[@]}]=$file
done 

if [ ${#files[@]} -eq 0 ]; then
    echo "No modified files" >&2
    exit 1
fi

for file in "${files[@]}"; do
    if [ "${file:0:1}" = - ]; then
        log_entry "${file:1}: Delete."
    else
        case "$file" in
            config/*)
                if [ -z "$configs_updated" ]; then
                    log_entry "Update config files."
                    configs_updated=1
                fi
                ;;
                
            patches.*)
                patch_log_entry "$file"
                ;;

            kabi/*/symvers-* | kabi/*/symtypes-* | kabi/*/symsets-* )
                if [ -z "$symvers_updated" ]; then
                    log_entry "Update reference module symbol versions."
                    symvers_updated=1
                fi
                ;;

            series.conf)
                # don't log changes in there
                ;;

            *)
                log_entry "$file: "
                ;;
        esac
    fi
done

if [ ! -s $message ]; then
    echo "- " >> $message
fi

if osc vc $CHANGES $message; then
    entry=$(sed -ne '1,2d' -e '/^--*$/!p' -e '/^--*$/q' $CHANGES)
    entry=${entry##$'\n'}
    entry=${entry%%$'\n'}
fi

for c in *.changes; do
    [ $c = $CHANGES ] && continue
    cp $CHANGES $c
done
++++++ macros.kernel-source ++++++
# A few cross-distro definitions:
%kernel_module_package_release 1
%kernel_module_package_buildreqs modutils kernel-syms

# Defines %flavors_to_build and %kernel_source() as a side effect.
%_kernel_module_package(n:v:r:t:f:Xp:bc:) \
%{expand:%( \
        subpkg=%{-t*}%{!-t:/usr/lib/rpm/kernel-module-subpackage} \
        echo "%%define _suse_kernel_module_subpackage(n:v:r:f:p:bc) 
%%{expand:%%(cd %_sourcedir; cat $subpkg; echo %%%%nil)}" \
        flavors_to_build= \
        flavors="%*" \
        for flavor in $(ls /usr/src/linux-obj/%_target_cpu 2>/dev/null); do \
            case " $flavors " in \
            (*" $flavor "*) \
                [ -n "%{-X}" ] && continue ;; \
            (*) \
                [ -z "%{-X}" -a -n "$flavors" ] && continue ;; \
            esac \
            krel=$(make -s -C /usr/src/linux-obj/%_target_cpu/$flavor 
kernelrelease) \
            kver=${krel%%-*} \
            flavors_to_build="$flavors_to_build $flavor" \
            echo "%%_suse_kernel_module_subpackage -n %{-n*}%{!-n:%name} -v 
%{-v*}%{!-v:%version} -r %{-r*}%{!-r:%release} %{-p} %{-b} %{-c:-c} $flavor 
$kver" \
        done \
        echo "%%global flavors_to_build${flavors_to_build:-%%nil}" \
        echo "%%{expand:%%(test -z '%flavors_to_build' && echo 
%%%%internal_kmp_error)}" \
        echo "%%global kernel_source() /usr/src/linux-obj/%_target_cpu/%%%%{1}" 
\
        echo "%%global kernel_module_package_moddir() updates" \
        \
        echo "%package -n %{-n*}%{!-n:%name}-kmp-_dummy_" \
        echo "Version: %version" \
        echo "Summary: %summary" \
        echo "Group: %group" \
        echo "%description -n %{-n*}%{!-n:%name}-kmp-_dummy_" \
        %{-c:
                for fmt in DER PEM; do h=$(openssl x509 -inform $fmt 
-fingerprint -noout -in %{-c*}); if test -n "$h"; then break; fi; done \
                cert=/etc/uefi/certs/$(echo "$h" | sed -rn 's/^SHA1 
Fingerprint=//; T; s/://g; s/(.{8}).*/\\1/p').crt
                : The -n expanstion in kernel-cert-subpackage only works if
                : -n is actually passed to the macro. Fix this here, so that
                : we do not have to modify the modsign-repackage script
                sed "s|@CERTS@|$cert|g; s|%%{-n.}|%{-n*}%{!-n:%name}|g" 
/usr/lib/rpm/kernel-cert-subpackage \
                echo "%%global __spec_build_pre %%__spec_build_pre mkdir -p 
%%buildroot/etc/uefi/certs; openssl x509 -in %{-c*} -inform $fmt -out 
%%buildroot/$cert -outform DER" } \
        )}

# kernel_module_package: simply pass on all options and arguments.
%kernel_module_package(n:v:r:t:f:xp:bc:) \
        %{expand:%%_kernel_module_package %{-x:-X} %{-n} %{-v} %{-r} %{-t} 
%{-f} %{-p} %*}

# suse_kernel_module_package: invert the meaning of the -x flag. (You are not
# supposed to understand why a simple %{-x:}%{!-x:-x} won't work.)
%suse_kernel_module_package(n:v:r:s:f:xp:bc:) \
        %{expand:%%_kernel_module_package %{-x: }%{!-x:-X} %{-n} %{-v} %{-r} 
%{-s:-t %{-s*}} %{-f} %{-p} %*}
++++++ mkspec ++++++
#!/usr/bin/perl

use strict;
use warnings;

use File::Copy;
use Getopt::Long;

my $dir = ".";
my $rpmrelease = 0;
my $patches="";

GetOptions(
        "patches=s" => \$patches,
        "release=s" => \$rpmrelease
) or die "Usage: $0 [--release <release>] [--patches <dir>]\n";

# flavor -> [supported archs]
my %flavor_archs = parse_config_conf();
# subset to include in kernel-syms
my %syms_flavor_archs = parse_config_conf("syms");

# template name -> template body
my %templates = read_spec_templates();

# config.sh variables
my %vars = parse_config_sh();
my ($srcversion, $variant, $vanilla_only) =
        ($vars{'SRCVERSION'}, $vars{'VARIANT'}, $vars{'VANILLA_ONLY'});
$vanilla_only ||= "0";

# package name -> [summary, description]
my %binary_descriptions = parse_descriptions();

# arch -> flavor -> [obsoleted packages]
my %obsolete_packages = parse_old_flavors();

$patches="--patches $patches" if $patches;
my $patchversion = `$dir/compute-PATCHVERSION.sh $patches`;
chomp $patchversion;
my $rpmversion = $patchversion;
# stuff the -rcX tag into the rpm version if possible;
$rpmversion =~ s/\.0-rc/.rc/;
$rpmversion =~ s/-rc\d+//;
$rpmversion =~ s/-/./g;

$rpmrelease =~ s/-/./g;

my $sources = join("\n", $templates{source} =~ /^Source\d+:[^\n]*/msg);
# Find all SourceN: foo.tar.(bz2|xz) lines and generate the NoSource:
# lines and the %setup line
my @tarballs = ($sources =~ /^Source(\d+):[^\n]*\.tar\.(?:bz2|xz)/msg);
my $nosource = $sources;
$nosource =~ s/^Source(\d+):.*?$/NoSource:       $1/mg;

# Source0 (the linux tarball) is unpacked manually
@tarballs = grep { $_ > 0 } @tarballs;
my $unpack_patches = join(" ", map { "-a $_" } @tarballs);
# List of scripts to automatically chmod +x before build
my $scripts = join(",", grep { is_script($_) }
                        ($sources =~ /\nSource\d+:\s*([^\s]*)/mg));

my $tarball_url;
if ($srcversion =~ /^(\d+)(?:\.\d+)*(-rc\d+)?$/) {
        $tarball_url = "http://www.kernel.org/pub/linux/kernel/v$1.x/";;
        $tarball_url .= "testing/" if $2;
} else {
        # kernel.org has no tarballs for  linux-next or vanilla snapshots
        $tarball_url = "";
}

my $commit = get_commit();

my %macros = (
        VARIANT => $variant,
        VANILLA_ONLY => $vanilla_only,
        SRCVERSION => $srcversion,
        PATCHVERSION => $patchversion,
        RPMVERSION => $rpmversion,
        TARBALL_URL => $tarball_url,
        RELEASE => $rpmrelease,
        COMMIT => $commit,
        SOURCES => $sources,
        NOSOURCE => $nosource,
        UNPACK_PATCHES => $unpack_patches,
        SCRIPTS => $scripts,
        YEAR => (localtime time)[5] + 1900,
);

# binary spec files
for my $flavor (sort keys(%flavor_archs)) {
        my ($summary, $description);
        if (!exists($binary_descriptions{"kernel-$flavor"})) {
                print STDERR "warning: no description for kernel-$flavor 
found\n";
                $summary = "The Linux Kernel";
                $description = "The Linux Kernel.";
        } else {
                $summary = $binary_descriptions{"kernel-$flavor"}->[0];
                $description = $binary_descriptions{"kernel-$flavor"}->[1];
        }

        my %obsolete_macros;
        for my $subpac ("", "-base", "-extra", "-devel", "-hmac") {
                (my $macro = "PROVIDES_OBSOLETES" . uc($subpac)) =~ s/-/_/;
                $obsolete_macros{$macro} =
                        provides_obsoletes($flavor, $subpac, 
@{$flavor_archs{$flavor}});
        }

        do_spec('binary', "kernel-$flavor.spec", %macros,
                FLAVOR => $flavor,
                SUMMARY => $summary,
                DESCRIPTION => $description,
                ARCHS => join(" ", arch2rpm(@{$flavor_archs{$flavor}})),
                %obsolete_macros
        );
}
# kernel-source.spec
do_spec('source', "kernel-source$variant.spec", %macros);

# kernel-docs.spec
do_spec('docs', "kernel-docs$variant.spec", %macros);

# kernel-syms.spec
{
        my $requires = "";
        my %all_archs;
        my $all_archs;
        for my $flavor (sort keys(%syms_flavor_archs)) {
                next if $flavor eq "vanilla";
                my @archs = arch2rpm(@{$syms_flavor_archs{$flavor}});
                $all_archs{$_} = 1 for @archs;
                $requires .= "%ifarch @archs\n";
                $requires .= "Requires:       kernel-$flavor-devel = 
\%version-\%source_rel\n";
                $requires .= "%endif\n";
        }
        chomp $requires;
        $all_archs = join(" ", sort(keys(%all_archs)));
        if (keys(%all_archs)) {
                do_spec('syms', "kernel-syms$variant.spec", %macros,
                        REQUIRES => $requires,
                        ARCHS => $all_archs);
        }
}

# kernel-obs-*.spec
{
        my @default_archs = arch2rpm(@{$flavor_archs{default}});
        # No kernel-obs-* for 32bit ppc
        @default_archs = grep { $_ ne "ppc" } @default_archs;
        my $default_archs = join(" ", @default_archs);
        my $xen_archs = join(" ", arch2rpm(@{$flavor_archs{xen} || []}));
        if (!$variant) {
                do_spec('obs-build', "kernel-obs-build.spec", %macros,
                        ARCHS => $default_archs);
                do_spec('obs-qa', "kernel-obs-qa.spec", %macros,
                        ARCHS => $default_archs,
                        NAME => "kernel-obs-qa",
                        FLAVOR => "default");
        }
        if ($xen_archs) {
                do_spec('obs-qa', "kernel-obs-qa-xen.spec", %macros,
                        ARCHS => $xen_archs,
                        NAME => "kernel-obs-qa-xen",
                        FLAVOR => "xen");
        }
}

copy_changes();

# _constraints
{
        my @packages = map { "<package>kernel-$_</package>" } sort 
keys(%flavor_archs);
        my $packages = join("\n", @packages);
        do_spec('constraints', "_constraints",
                BINARY_PACKAGES_XML => $packages);
}

exit 0;



sub parse_config_conf {
        my @symbols = @_;
        my $symbols = join(' ', @symbols);
        my %res;

        for my $arch (split(/\s+/, `$dir/arch-symbols --list`)) {
                my @flavors = `$dir/guards $arch $symbols < $dir/config.conf`;
                next if @flavors == 0;
                chomp @flavors;
                @flavors = map { s/.*\///; $_ } @flavors;
                for my $flavor (@flavors) {
                        $res{$flavor} ||= [];
                        push(@{$res{$flavor}}, $arch);
                }
        }
        for my $flavor (keys(%res)) {
                $res{$flavor} = [sort @{$res{$flavor}}];
        }
        return %res;
}

sub read_spec_templates {
        my %res;

        for my $template (qw(binary source syms docs obs-build obs-qa)) {
                xopen(my $fh, '<', "$dir/kernel-$template.spec.in");
                local $/ = undef;
                $res{$template} = <$fh>;
                close($fh);
        }
        {
                xopen(my $fh, '<', "$dir/constraints.in");
                local $/ = undef;
                $res{constraints} = <$fh>;
                close($fh);
        }
        return %res;
}

# return a hash of config.sh variables
sub parse_config_sh {
        my %res;

        xopen(my $fh, '<', "$dir/config.sh");
        while (<$fh>) {
                chomp;
                if (/^\s*([A-Z_]+)=(.*)/) {
                        $res{$1} = $2;
                }
        }
        close($fh);
        return %res;
}

sub parse_descriptions {
        my %res;
        my $current;
        my $blank = "";
        # 0 - expect summary, 1 - eating blank lines, 2 - reading description
        my $state = 0;

        xopen(my $fh, '<', "$dir/package-descriptions");
        while (<$fh>) {
                next if /^\s*#/;

                if (/^==+\s+([^\s]+)\s+==+\s*$/) {
                        my $package = $1;
                        if ($current) {
                                chomp $current->[1];
                        }
                        $current = ["", ""];
                        $res{$package} = $current;
                        $state = 0;
                        next;
                }
                if (/^$/) {
                        if ($state == 2) {
                                $blank .= $_;
                        }
                        next;
                }
                # non-blank line and not === package ===
                if ($state == 0) {
                        chomp;
                        $current->[0] = $_;
                        $state = 1;
                } elsif ($state == 1) {
                        $current->[1] = $_;
                        $blank = "";
                        $state = 2;
                } else {
                        $current->[1] .= $blank;
                        $blank = "";
                        $current->[1] .= $_;
                }
        }
        if ($current) {
                chomp $current->[1];
        }
        close($fh);
        return %res;
}

sub parse_old_flavors{
        my %res;


        xopen(my $fh, '<', "$dir/old-flavors");
        while (<$fh>) {
                chomp;
                next if /^\s*(#|$)/;
                if (!m:^\s*(\w+)/([\w-]+)\s+([\w-]+)\s+([\w.-]+)\s*$:) {
                        print STDERR "$dir/old-flavors:$.: expected arch/flavor 
<old flavor> <old version>\n";
                        next;
                }
                my ($arch, $flavor, $old_flavor, $old_version) = ($1, $2, $3, 
$4);
                $res{$arch} ||= {};
                $res{$arch}{$flavor} ||= [];
                push(@{$res{$arch}{$flavor}},
                        ["kernel-$old_flavor", $old_version]);
        }
        close($fh);
        return %res;
}

sub is_script {
        my $script = shift;

        return undef if $script =~ /\.(tar\.(gz|bz2)|in|conf)$/;
        return undef if $script =~ /^README/;
        return 1 if $script =~ /\.pl$/;
        open(my $fh, '<', $script) or return undef;
        sysread($fh, my $shebang, 2);
        close($fh);
        return 1 if $shebang eq "#!";
        return undef;
}

sub arch2rpm {
        if (wantarray) {
                return map { _arch2rpm($_) } @_;
        }
        return _arch2rpm($_[0]);
}
sub _arch2rpm {
        my $arch = shift;
        return "\%ix86" if $arch eq "i386";
        return "aarch64" if $arch eq "arm64";
        return $arch;
}

sub provides_obsoletes {
        my $flavor = shift;
        my $subpac = shift;
        my @archs = @_;
        my $res = "";

        for my $arch (@archs) {
                my @packs = @{$obsolete_packages{$arch}{$flavor} || []};
                my $printed;

                next if (!@packs);
                my $rpmarch = arch2rpm($arch);
                chomp $rpmarch;
                for my $pack (@packs) {
                        my $name = $pack->[0] . $subpac;
                        my $version = $pack->[1];
                        if ($subpac) {
                                # The -base and -extra split has been
                                # introduced in SLE11 (2.6.27)
                                my ($v1, $v2, $v3) = split(/\./, $version);
                                next if ($v1 <= 2 && $v2 <= 6 && $v3 < 27);
                        }
                        if (!$printed) {
                                $res .= "\%ifarch $rpmarch\n";
                                $printed = 1;
                        }
                        $res .= "Provides:       $name = $version\n";
                        $res .= "Obsoletes:      $name <= $version\n";
                }
                $res .= "\%endif\n" if $printed;
        }
        chomp $res;
        return $res;
}

sub get_commit {
        my ($commit, $fh);

        if (!open($fh, '<', "source-timestamp")) {
                print STDERR "warning: source-timestamp: $!\n";
                print STDERR "warning: Cannot determine commit id\n";
                return "0000000";
        }
        while (<$fh>) {
                if (/^GIT Revision: ([0-9a-f]{7})/) {
                        $commit = $1;
                }
        }
        close($fh);
        if (!$commit) {
                print STDERR "warning: Commit id missing in source-timestamp 
file\n";
                return "0000000";
        }
        return $commit;
}

sub do_spec {
        my $template = shift;
        my $specfile = shift;
        my %macros = @_;

        my $text = $templates{$template};
        my $prev_text;
        do {
                $prev_text = $text;
                for my $m (keys %macros) {
                        $text =~ s/\@$m\@/$macros{$m}/g;
                }
        } while ($prev_text ne $text);
        print "$specfile\n";
        xopen(my $fh, '>', "$dir/$specfile");
        print $fh $text;
        close($fh);
}

sub copy_changes {

        opendir(my $dh, $dir) or die "$dir: $!\n";

        while (my $name = readdir $dh) {
                next unless $name =~ /\.spec$/;
                next if $name eq "kernel-source$variant.spec";

                $name =~ s/\.spec$/.changes/;
                copy("$dir/kernel-source$variant.changes", "$dir/$name");
        }
        closedir($dh);
}

sub xopen {
        open($_[0], $_[1], $_[2]) or die "$_[2]: $!\n";
}

++++++ modversions ++++++
#! /usr/bin/perl -w

use File::Basename;
use File::Path;
use File::Find;
use Getopt::Long;
use strict;

my %symbol_type_name = (
    n => 'normal', t => 'typedef', e => 'enum', s => 'struct', u => 'union',
    E => 'enum constant'
);

my %definitions;
my %override;
my %override_locally;
my %locally_unknown;
my %locally_defined;

sub expand_types($);
sub expand_types($) {
    my ($definition) = @_;
    local ($_, $1, $2);

    my @defn = split ' ', $definition;
    for (@defn[1..$#defn]) {
        if (/^(.)#(.*)/) {
            #print "<<$defn[0] : $_>>\n";
            next if exists $locally_defined{$_};
            $locally_defined{$_} = 1;

            if ($locally_unknown{$_}) {
                print "override " if $override_locally{$_};
                print "$_ $symbol_type_name{$1} $2 { UNKNOWN } \n";
            } else {
                if (!exists $definitions{$_}) {
                    die "Missing definition of $symbol_type_name{$1} $2\n";
                }
                expand_types("$_ $definitions{$_}");
            }
        }
    }
    print "override " if $override_locally{$defn[0]};
    print "$definition\n";
}

sub pack_dump($$) {
    my ($dir, $ext) = @_;
    my @files;

    $ext = ".symtypes" unless defined $ext;
    $dir =~ s/\/+$//;

    find(sub ($) { /\Q$ext\E$/ && push @files, $File::Find::name}, $dir);
    map { s/^\Q$dir\E\/(.*)\Q$ext\E$/$1/ } @files;

    foreach my $file (sort @files) {
        print "/* $file.o */\n";

        local *FD;
        open FD, "< $dir/$file$ext"
            or die "$dir/$file$ext: $!\n";
        while (<FD>) {
            chomp;

            my $override = "";
            if (s/^override //) {
                $override = $&;
            }

            if (/^(\S)#(\S+)\s*(.*)/) {
                my $sym = "$1#$2";
                my $definition = $3;

                if (/^$sym\s+$symbol_type_name{$1}\s+$2\s+{\s+UNKNOWN\s+}\s*$/) 
{
                    $_ = $override . substr($sym, 0, 1) . "##" . substr($sym, 
2);
                } else {
                    if (exists $definitions{$sym} && $definitions{$sym} eq 
$definition) {
                        if (($override ne "") == (exists $override{$sym})) {
                            next;
                        }
                        $_ = "$override$sym";
                    } else {
                        $definitions{$sym} = $definition;
                        if ($override eq "") {
                            delete $override{$sym};
                        } else {
                            $override{$sym} = 1;
                            $_ = "$override$_";
                        }
                    }
                }
            } elsif ($override) {
                    $_ = "$override$_";
            }
            print "$_\n";
        }
        close FD;
        print "\n";
    }
}

sub unpack_dump($$) {
    my ($dir, $ext) = @_;

    $ext = ".symref" unless defined $ext;

    while (<STDIN>) {
        next if /^$/;
        chomp;

        if (/^\/\* (.*)\.o \*\//) {
            close STDOUT;
            mkpath(dirname("$dir/$1$ext"));
            open STDOUT, "> $dir/$1$ext"
                or die "$dir/$1$ext: $!\n";
            %locally_defined = ();
            %locally_unknown = ();
            %override_locally = %override;
            next;
        }

        my $override = /^override\s/;
        s/^override\s//;

        if (/^([^ ])#(#?)([^ ]+) *(.*)$/) {
            my $sym = "$1#$3";

            if ($4 ne "") {
                if (/\s+{\s+UNKNOWN\s+}\s*$/) {
                    $locally_unknown{$sym} = 1;
                    $override_locally{$sym} = $override;
                } else {
                    $definitions{$sym} = $4;
                    $locally_unknown{$sym} = 0;
                    $override{$sym} = $override;
                    $override_locally{$sym} = $override;
                }
            } else {
                $locally_unknown{$sym} = ($2 ne "");
                $override_locally{$sym} = $override;
            }
            next;
        } elsif (/^([^# ]*)/) {
                $override_locally{$1} = $override;
        }
        expand_types($_);
    }
}

my ($pack, $unpack, $ext);
GetOptions("pack" => \$pack, "unpack" => \$unpack, "ext:s" => \$ext)
    && ($pack || $unpack) && @ARGV == 1
    or die "USAGE:\t$0 [--ext extension] --pack {dir} > file\n" .
                 "\t$0 [--ext extension] --unpack {dir} < file\n";

pack_dump($ARGV[0], $ext) if $pack;
unpack_dump($ARGV[0], $ext) if $unpack;
++++++ old-flavors ++++++
# List of obsolete kernel flavors
# <arch>/<new flavor>   <old flavor>    <upper bound of shipped versions>

# SLES 9
ia64/default    sn2             2.6.6

ppc/ppc64       pmac64          2.6.6
ppc/ppc64       pseries64       2.6.6

# SLES 10
i386/default    smp             2.6.17
i386/pae        bigsmp          2.6.17
i386/xen        xenpae          2.6.17

x86_64/default  smp             2.6.17

ppc/ppc64       iseries64       2.6.17
ppc/ppc64       kdump           2.6.17

# SLES 11 GA only
# FIXME: more architectures had kdump in SLES 10
ppc64/debug     kdump           2.6.28
ppc64/default   kdump           2.6.28
ppc64/ppc64     kdump           2.6.28
ppc64/trace     kdump           2.6.28

# SLES 11 GA only / 11.4
i386/pae        vmi             2.6.38

# SLES 11 SP3 / openSUSE 13.1
i386/default            trace           3.13

x86_64/default          trace           3.13

s390x/default           trace           3.13
++++++ package-descriptions ++++++
# Descriptions of the binary kernel packages. The format is
#
# === <package name> ===
# Summary (single line)
#
# Long description (multiple
# lines)
#
# Descriptions of the -base and -extra subpackages are derived from the
# main descriptions.

=== kernel-debug ===
A Debug Version of the Kernel

This kernel has several debug facilities enabled that hurt performance.
Only use this kernel when investigating problems.

=== kernel-default ===
The Standard Kernel

The standard kernel for both uniprocessor and multiprocessor systems.

=== kernel-desktop ===
Kernel optimized for the desktop

This kernel is optimized for the desktop. It is configured for lower latency
and has many of the features that aren't usually used on desktop machines
disabled.

%ifarch %ix86
This kernel supports up to 64GB of main memory. It requires Physical
Addressing Extensions (PAE), which were introduced with the Pentium Pro
processor.

PAE is not only more physical address space but also important for the
"no execute" feature which disables execution of code that is marked as
non-executable. Therefore, the PAE kernel should be used on any systems
that support it, regardless of the amount of main memory.
%endif

=== kernel-pae ===
Kernel with PAE Support

This kernel supports up to 64GB of main memory. It requires Physical
Addressing Extensions (PAE), which were introduced with the Pentium Pro
processor.

PAE is not only more physical address space but also important for the
"no execute" feature which disables execution of code that is marked as
non-executable. Therefore, the PAE kernel should be used on any systems
that support it, regardless of the amount of main memory.

=== kernel-vanilla ===
The Standard Kernel - without any SUSE patches

The standard kernel - without any SUSE patches

=== kernel-xen ===
The Xen Kernel

The Linux kernel for Xen paravirtualization.

This kernel can be used both as the domain0 ("xen0") and as an
unprivileged ("xenU") kernel.

=== kernel-ec2 ===
The Amazon EC2 Xen Kernel

The Linux kernel for Xen paravirtualization.

This kernel can only be used both as an unprivileged ("xenU")
kernel (for Amazon EC2).

=== kernel-lpae ===
Kernel for LPAE enabled systems

The kernel for all 32-bit ARM platforms that support LPAE. This includes all
Cortex A15 based SoCs, like the Exynos5, OMAP5 or Calxeda ECX-2000.

=== kernel-cubox ===
Kernel for SolidRun Cubox

The standard kernel for Marvell Dove SoC, as found in
the SolidRun Cubox.

=== kernel-exynos ===
Kernel for Samsung's Exynos SoC

The standard kernel for Samsung's Exynos 4 & 5 SoC, as found in the Origen 
board.

=== kernel-versatile ===
Kernel for Versatile SoC

The standard kernel for Versatile SoC, or for emulation with QEMU.
++++++ post.sh ++++++
# Flag to trigger /etc/init.d/purge-kernels on next reboot (fate#312018)
touch /boot/do_purge_kernels

suffix=
case @FLAVOR@ in
    xen*|ec2|vanilla)
        suffix=-@FLAVOR@
        ;;
esac
for x in /boot/@IMAGE@ /boot/initrd; do
    rm -f $x$suffix
    ln -s ${x##*/}-@KERNELRELEASE@-@FLAVOR@ $x$suffix
done

# Add symlinks of compatible modules to /lib/modules/$krel/weak-updates/, 
# run depmod and mkinitrd
wm2=/usr/lib/module-init-tools/weak-modules2
if [ -x $wm2 ]; then
    if [ @BASE_PACKAGE@ = 1 ]; then
        /bin/bash -${-/e/} $wm2 --add-kernel @KERNELRELEASE@-@FLAVOR@
    else
        nvr=@SUBPACKAGE@-@RPM_VERSION_RELEASE@
        rpm -ql $nvr | /bin/bash -${-/e/} $wm2 --add-kernel-modules 
@KERNELRELEASE@-@FLAVOR@
    fi
else
    echo "$wm does not exist, please run depmod and mkinitrd manually" >&2
fi

message_install_bl () {
        echo "You may need to setup and install the boot loader using the"
        echo "available bootloader for your platform (e.g. grub, lilo, zipl, 
...)."
}

run_bootloader () {
    if [ -f /etc/sysconfig/bootloader ] &&
            [ -f /boot/grub/menu.lst -o \
              -f /etc/lilo.conf      -o \
              -f /etc/elilo.conf     -o \
              -f /etc/zipl.conf      -o \
              -f /etc/default/grub    ]
    then
        return 0
    else
        return 1
    fi
}

if [ -f /etc/fstab -a ! -e /.buildenv ] ; then
    # only run the bootloader if the usual bootloader configuration
    # files are there -- this is different on every architecture
    initrd=initrd-@KERNELRELEASE@-@FLAVOR@
    if [ @FLAVOR@ = rt ]; then
            default=force-default
    fi
    if [ -e /boot/$initrd -o ! -e /lib/modules/@KERNELRELEASE@-@FLAVOR@ ] && \
       run_bootloader ; then
       [ -e /boot/$initrd ] || initrd=
        if [ -x /usr/lib/bootloader/bootloader_entry ]; then
            /usr/lib/bootloader/bootloader_entry \
                add \
                @FLAVOR@ \
                @KERNELRELEASE@-@FLAVOR@ \
                @IMAGE@-@KERNELRELEASE@-@FLAVOR@ \
                $initrd \
                $default
        else
            message_install_bl
        fi
    fi
else
    message_install_bl
fi

# vim: set sts=4 sw=4 ts=8 noet:
++++++ postun.sh ++++++
# If a kernel package is removed before the next reboot, we assume that the
# multiversion variable in /etc/zypp/zypp.conf is not configured and we delete
# the flag again (fate#312018)
rm -f /boot/do_purge_kernels

wm2=/usr/lib/module-init-tools/weak-modules2
nvr=@SUBPACKAGE@-@RPM_VERSION_RELEASE@

if [ -e /boot/System.map-@KERNELRELEASE@-@FLAVOR@ ]; then
    # the same package was reinstalled or just rebuilt, otherwise the files
    # would have been deleted by now
    # do not remove anything in this case (bnc#533766)
    rm -f /var/run/rpm-$nvr-modules
    exit 0
fi

if [ @BASE_PACKAGE@ = 0 ]; then
    if [ -x $wm2 ]; then
        /bin/bash -${-/e/} $wm2 --remove-kernel-modules 
@KERNELRELEASE@-@FLAVOR@ < /var/run/rpm-$nvr-modules
    fi
    rm -f /var/run/rpm-$nvr-modules
    exit 0
fi
# Remove symlinks from /lib/modules/$krel/weak-updates/.
if [ -x $wm2 ]; then
    /bin/bash -${-/e/} $wm2 --remove-kernel @KERNELRELEASE@-@FLAVOR@
fi

# remove fstab check once perl-Bootloader can cope with it
if [ -f /etc/fstab ]; then
        if [ -x /usr/lib/bootloader/bootloader_entry ]; then
            /usr/lib/bootloader/bootloader_entry \
                remove \
                @FLAVOR@ \
                @KERNELRELEASE@-@FLAVOR@ \
                @IMAGE@-@KERNELRELEASE@-@FLAVOR@ \
                initrd-@KERNELRELEASE@-@FLAVOR@
        fi
fi
++++++ pre.sh ++++++
# see bug #259303
# this script runs when the kernel gets updated with YaST
# YaST calls rpm always with -U
# -U replaces all packages with the new one
# rpm removes the files from the old packages after the postinstall script ran
# this will double the required space below /boot
# remove the files from the old packages to make room for the new initrd
# rpm may complain about low disk space if /boot/vmlinux does not fit
if [ @BASE_PACKAGE@ = 1 -a "$YAST_IS_RUNNING" != "" ]; then
        mydf="$( POSIXLY_CORRECT=1 df -P /boot/ | awk '/^(\/|-[[:blank:]])/{ 
print $4}' )"
        if test "$mydf" != "" ; then
                echo "Free diskspace below /boot: $mydf blocks"
                # echo "512 byte blocks: $(( 2 * 1024 * 20 ))"
                if test "$mydf" -lt  "40960" ; then
                        echo "make room for new kernel '@FLAVOR@' because there 
are less than 20MB available."
                        # disabled because it breaks patch rpms
                        #rm -fv /boot/@IMAGE@-*-@FLAVOR@
                        rm -fv /boot/initrd-*-@FLAVOR@
                fi
        fi
fi
++++++ preun.sh ++++++
if [ @BASE_PACKAGE@ = 0 ]; then
    nvr=@SUBPACKAGE@-@RPM_VERSION_RELEASE@
    rpm -ql $nvr | grep '\.ko$' > /var/run/rpm-$nvr-modules
fi
++++++ series.conf ++++++
++++ 1421 lines (skipped)

++++++ source-post.sh ++++++
relink() {
    if [ -h "$2" ]; then
        local old=$(readlink "$2")
        [ "$old" = "$1" ] && return 0
        echo "Changing symlink $2 from $old to $1"
    elif [ -e "$2" ]; then
        echo "Replacing file $2 with symlink to $1"
    fi
    rm -f "$2" \
    && ln -s "$1" "$2"
}

relink linux-@KERNELRELEASE@@SRCVARIANT@ /usr/src/linux@SRCVARIANT@
++++++ source-timestamp ++++++
2016-06-28 14:20:57 +0200
GIT Revision: 35ab7317791362a7b2dc4db65af3492a228bd186
GIT Branch: openSUSE-13.2
++++++ split-modules ++++++
#!/bin/bash
# 
# given a Module.base and modules.dep, generate list
# of base / supported / unsupported modules

set -e
export LC_COLLATE=C

usage()
{
        echo "Usage: ${0##*/} -b Module.base [-d dir] [-i] [-e] [-o outdir]"
        echo "  -i    Ignore supported.conf errors"
        echo "  -e    Create the -extra filelist (otherwise, treat all modules 
as supported)"
}

options=$(getopt -o b:d:o:ie -- "$@")
if test $? -ne 0; then
        usage >&2
        exit 1
fi
eval set -- "$options"
opt_base=
opt_out=.
opt_dir=.
opt_ignore_errors=false
opt_extra=false
while test $# -gt 0; do
        opt=$1
        shift
        case "$opt" in
        -b | -d | -o)
                arg=$1
                shift
        esac
        case "$opt" in
        -b)
                opt_base=$arg ;;
        -d)
                opt_dir=$arg ;;
        -o)
                opt_out=$arg ;;
        -i)
                opt_ignore_errors=true ;;
        -e)
                opt_extra=true ;;
        --)
                break ;;
        *)
                echo "Unknown option $opt" >&2
                exit 1
        esac
done
if test -z "$opt_base"; then
        usage >&2
        exit 1
fi

trap 'rm -rf "$tmp"' EXIT
tmp=$(mktemp -d)
mkdir "$tmp/empty"

find "$opt_dir" -type f -name '*.ko' -printf '/%P\n' | \
        awk -F/ '{ n=$NF; gsub(/-/, "_", n); sub(/\.ko$/, "", n); print n " " 
$0; }' | \
        sort >"$tmp/all"

err=false
while read mod path; do
        if $opt_extra; then
                support=$(/sbin/modinfo -F supported "$opt_dir/$path")
        else
                support=yes
        fi
        case "$support" in
        yes | external)
                echo "$mod"
                ;;
        no)
                ;;
        "")
                echo "warning: ${path#/lib/modules/*/kernel/} not listed in 
supported.conf" >&2
                ;;
        *)
                echo "error: invalid support flag for $mod: $support" >&2
                err=true
                ;;
        esac
done <"$tmp/all" | sort -u >"$tmp/supp"
if $err; then
        exit 1
fi

modules_dep=$(find "$opt_dir" -type f -name modules.dep)
if test -z "$modules_dep"; then
        echo "Cannot find modules.dep in $opt_dir" >&2
        exit 1
fi
(
        echo '%:
        @echo $@
ifdef EXPLAIN
        @for dep in $^; do echo "$$dep needed by $@"; done >> $(EXPLAIN)
endif
'
        sed -r 's:[^ ]*/([^/]*)\.ko\>:\1:g; y/-/_/' "$modules_dep"
) >"$tmp/dep"

add_dependent_modules()
{
        xargs -r make EXPLAIN=$1 -rRs -C "$tmp/empty" -f "$tmp/dep" | sort -u
}

# base
sed 'y/-/_/' <"$opt_base" | add_dependent_modules >"$tmp/base"
join -j 1 -o 2.2 "$tmp/base" "$tmp/all" >"$opt_out/base-modules"

# main
add_dependent_modules "$tmp/supp-explain" <"$tmp/supp" >"$tmp/supp-all"
if ! cmp -s "$tmp/supp" "$tmp/supp-all"; then
        echo "The following unsupported modules are used by supported modules:" 
>&2
        join -j1 -a2 <(sort "$tmp/supp-explain") \
                 <(join -v2 "$tmp/supp" "$tmp/supp-all") >&2
        echo "Please fix supported.conf." >&2
        if ! $opt_ignore_errors; then
                exit 1
        fi
fi
join -j 1 -o 2.2 "$tmp/supp-all" "$tmp/all" >"$opt_out/main-modules"

# unsupported
join -j 1 -v 2 -o 2.2 "$tmp/supp-all" "$tmp/all" >"$opt_out/unsupported-modules"

exit 0


++++++ supported.conf ++++++
++++ 2492 lines (skipped)

++++++ try-disable-staging-driver ++++++
#!/bin/bash

#############################################################################
# Copyright (c) 2011 Novell, Inc.
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact Novell, Inc.
#
# To contact Novell about this file by physical or electronic mail,
# you may find current contact information at www.novell.com
#############################################################################


# If make fails, check if it happened due to a staging driver and disable it.
# That way, staging does not spoil automatic package building and we also
# do not need to worry about forgetting to reenable manually disabled drivers.

if test -L source; then
        source="source"
else
        source="."
fi
makefile="$source/drivers/staging/Makefile"
skipped_options=staging-skipped-options
logfile=$1

if test -z "$logfile"; then
        echo "Usage: $0 logfile" >&2
        exit 1
fi
if ! test -f "$logfile"; then
        echo "$logfile not found" >&2
        exit 1
fi

# safety precaution
if test "0$(wc -l "$skipped_options" 2>/dev/null)" -gt 20; then
        echo "Possible loop detected in $0, exiting after 20 attempts" >&2
        exit 1
fi

# find out if the error happened in drivers/staging
dir=$(sed -rn 's@.*/drivers/staging/([^/]*)/.*: error: .*@\1@p; T; q' 
"$logfile")
if test -z "$dir"; then
        exit 1
else
        echo "Build failed due to drivers/staging/$dir"
fi

option=$(sed -n 's/obj-\$(\(.*\))[[:space:]]*+=[[:space:]]*'"$dir"'\//\1/p' 
"$makefile")
if test -z "$option"; then
        echo "Cannot determine config option to skip drivers/staging/$dir" >&2
        exit 1
fi
# we need to be carefull not to loop endlessly
if grep -qsFx "$option" "$skipped_options"; then
        echo "$option has already been disabled, but drivers/staging/$dir is 
still failing" >&2
        exit 1
fi

echo "Trying to disable $option"
"$source/scripts/config" --disable "$option"
if ! make silentoldconfig $MAKE_ARGS || grep "^$option" .config; then
        echo "Could not disable $option" >&2
        exit 1
fi
echo "$option" >>"$skipped_options"

exit 0

Reply via email to