1
0
forked from pool/kernel-source
OBS User unknown
2008-07-18 10:15:21 +00:00
committed by Git OBS Bridge
commit 987ad16940
76 changed files with 913140 additions and 0 deletions
+38753
View File
File diff suppressed because it is too large Load Diff
+38753
View File
File diff suppressed because it is too large Load Diff
+38753
View File
File diff suppressed because it is too large Load Diff
+38753
View File
File diff suppressed because it is too large Load Diff
+38753
View File
File diff suppressed because it is too large Load Diff
+38753
View File
File diff suppressed because it is too large Load Diff
+38753
View File
File diff suppressed because it is too large Load Diff
+38753
View File
File diff suppressed because it is too large Load Diff
+38753
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+38753
View File
File diff suppressed because it is too large Load Diff
+38753
View File
File diff suppressed because it is too large Load Diff
+38753
View File
File diff suppressed because it is too large Load Diff
+38753
View File
File diff suppressed because it is too large Load Diff
+38753
View File
File diff suppressed because it is too large Load Diff
+21842
View File
File diff suppressed because it is too large Load Diff
+21860
View File
File diff suppressed because it is too large Load Diff
+21281
View File
File diff suppressed because it is too large Load Diff
+21841
View File
File diff suppressed because it is too large Load Diff
+21839
View File
File diff suppressed because it is too large Load Diff
+21837
View File
File diff suppressed because it is too large Load Diff
+21854
View File
File diff suppressed because it is too large Load Diff
+21840
View File
File diff suppressed because it is too large Load Diff
+21844
View File
File diff suppressed because it is too large Load Diff
+21839
View File
File diff suppressed because it is too large Load Diff
+21835
View File
File diff suppressed because it is too large Load Diff
+21530
View File
File diff suppressed because it is too large Load Diff
+21385
View File
File diff suppressed because it is too large Load Diff
+21852
View File
File diff suppressed because it is too large Load Diff
+21841
View File
File diff suppressed because it is too large Load Diff
+23
View File
@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
+1
View File
@@ -0,0 +1 @@
.osc
+423
View File
@@ -0,0 +1,423 @@
WORKING WITH THE SUSE 2.6.x KERNEL SOURCES
Andreas Gruenbacher <agruen@suse.de>, SUSE Labs, 2003, 2004, 2005, 2006
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 Update Media HOWTO that describes how to build driver update
disks (among other things) is available at:
ftp://ftp.suse.com/pub/people/hvogel/Update-Media-HOWTO.
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.
Internally, the add-on patches and configuration files are maintained in
a CVS repository. A script (scripts/tar-up.sh) packs up the files in the
CVS 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-$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-syms
Kernel symbol version information for compiling external modules:
Functions and data structures that the kernel exports have version
information attached. When loading kernel modules, this version
information is used to make sure that the modules match the running
kernel.
* kernel-dummy
This package is relevant inside the SUSE build system only. We use
it to synchronize release numbers among the kernel packages. When
building packages locally, the kernel-dummy package can safely be
ignored.
The CVS repository contains the configuration files (.config) for all
SUSE kernel flavors. All configuration files are included in the
kernel-source 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/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
A symbolic link to /usr/src/linux-$VERSION-$RELEASE-obj/$ARCH/$FLAVOR.
* /usr/share/doc/packages/kernel-source/
This document and an external kernel module example.
* /etc/init.d/running-kernel
Init script that adapts the kernel sources in /usr/src/linux to
the running kernel.
COMPILING YOUR OWN KERNEL
The kernel sources are found in the kernel-source.$ARCH.rpm package. The
recommended way to produce a binary kernel is:
(1) Install kernel-source.$ARCH.rpm. Change to the /usr/src/linux
directory.
(2) Configure the kernel (for example, ``make oldconfig'' or ``make
cloneconfig'', see HOW TO CONFIGURE THE KERNEL SOURCES).
(3) Build the kernel and all its modules (``make'').
(5) 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'').
(6) 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 /usr/src/linux (or a copy,
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 kernel-source.$ARCH.rpm.
(2) Change to the /usr/src/linux directory. Configure the kernel
(for example, ``make oldconfig'' or ``make cloneconfig'', 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 /usr/src/linux M=$(pwd)''.
(5) Install the module(s) by typing
``make -C /usr/src/linux M=$(pwd) modules_install''.
The second method involves the following steps:
(1) Install kernel-source.$ARCH.rpm.
(2) Install kernel-syms.$ARCH.rpm. This package 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).
Starting with SuSE Linux 9.2 / SLES9 Service Pack 1, the
modversion information for the running kernel is also
contained in the kernel-$FLAVOR packages, and so for building
modules for the running kernel, the kernel-syms package is no
longer required.
(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.
Please take a look at the demo module installed under
/usr/share/doc/packages/kernel-source for a simple example of an Kernel
Module Package (KMP).
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, external modules will not have the supported flag (that is,
they wil be marked as unsupported). For building externally supported
modules, please get in touch with Kurt Garloff <garloff@suse.de>.
PATCH SELECTION MECHANISM
The SUSE kernels consist of the vanilla kernel sources on top of which a
number of patches is applied. Almost all of these patches are applied on
all architectures; a few patches are only used on a subset of
architectures. The file series.conf determines which patches are applied
on which architectures. 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. The symbols
used by default are computed by the helper script "arch-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 xfj $f || break; \
done
$ tar xfj linux-2.6.5.tar.bz2
# Apply the patches
$ for p in $(./guards $(./arch-symbols) < 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 CVS repository. When
packing up the repository, they end up in config.tar.bz. When
kernel-source.$ARCH.rpm is built, the config files are copied from
config/$ARCH/$FLAVOR to arch/$ARCH/defconfig.$FLAVOR in the kernel
source tree (for eaxmple, arch/i386/defconfig.default).
The kernel-$FLAVOR packages are based on arch/$ARCH/defconfig.$FLAVOR
(kernel-default is based on arch/$ARCH/defconfig.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).
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-source package contains
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 the kernel source
tree. The kernel-source package installs its source tree in
/usr/src/linux.
- Run the following commands in sequence to apply the configuration,
generate version information files, etc.:
make clean
make 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.
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''.
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/
+35
View File
@@ -0,0 +1,35 @@
#!/bin/sh
# Generate architecture specific patch selection symbols
if [ "$1" = "--list" ]; then
# List all known architectures
echo i386 mips{,64} sparc{,64} ppc{,64} s390{,x} ia64 x86_64 alpha parisc
exit 0
fi
if [ -z "$SYMBOLS" ]; then
if [ -n "$1" ]; then
ARCH="$1"
elif [ -n "$PATCH_ARCH" ]; then
ARCH="$PATCH_ARCH"
else
ARCH="`arch`"
fi
SYMBOLS="$ARCH"
case "$ARCH" in
(i?86) SYMBOLS="$SYMBOLS IA32" ;;
(mips*) SYMBOLS="$SYMBOLS MIPS" ;;
(sparc*) SYMBOLS="$SYMBOLS SPARC" ;;
(ppc*) SYMBOLS="$SYMBOLS PPC" ;;
(s390*) SYMBOLS="$SYMBOLS S390" ;;
(ia64) ;;
(x86_64) ;;
(alpha) ;;
(parisc) ;;
(*) # not a recognized architeture!
exit
;;
esac
fi
echo $SYMBOLS
+2
View File
@@ -0,0 +1,2 @@
2008-06-28 00:00:07 +0200
CVS Branch: SL110_BRANCH
+32
View File
@@ -0,0 +1,32 @@
#! /bin/bash
# A lot of symbols are exported by the main kernel image. Find out
# more precisely which built-in.o file defines them, and fill in
# that information in Module.symvers. (The built-in.o files are
# linked together from one or more object files in a directory.)
# We use this information to better group symbols by subsystems.
#
# Usage: built-in-where < Module.symvers
unset LANG ${!LC_*}
# Create a table of all symbol export in a built-in.o file, e.g.,
# mtrr_add arch/i386/kernel/cpu/mtrr/built-in
built_in_exports() {
for obj in $(find -name built-in.o -printf '%P\n'); do
nm $obj \
| sed -nre 's:(00000000)?([0-9a-f]+) A __crc_(.*):\3\t'"${obj%.o}:p"
done
}
# Join together the two tables, including all lines from the first
# file that don't have a match in the second. Finally remove the
# duplicate column.
join -t $'\t' -1 2 -2 1 -a 1 \
<(sort -k2) \
<(built_in_exports | sort -k1) \
| awk '
BEGIN { FS = "\t" ; OFS = "\t" }
NF == 3 { print $2, $1, $3 }
NF == 4 { print $2, $1, $4 }
'
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
# Copyright (c) 2005 SUSE Linux Products GmbH, Germany. All rights reserved.
if grep -q "Linux version 2\.[0-5]\." /proc/version; then
echo "FATAL: kernel too old, need kernel >= 2.6 for this package"
exit 1
fi
exit 0
+17
View File
@@ -0,0 +1,17 @@
#! /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
+32
View File
@@ -0,0 +1,32 @@
#! /bin/sh
sourcedir=$1
modpath=$2
# Check for modules not listed in supported.conf: First, for each module
# in the list, set mod_$module=1
for module in $($sourcedir/guards --list < $sourcedir/supported.conf \
| sed -e 's,.*/,,'); do
m=${module##*/}
m=${m%.ko}
eval mod_${m//-/_}=1
done
# Check if any installed module was not listed
status=
cd $modpath
for module in $(find . -name '*.ko'); do
module=${module%.ko}
m=${module##*/}
m=${m//-/_}
m="mod_$m"
if [ -z "${!m}" ]; then
if [ -z "$status" ]; then
echo "Modules not listed in supported.conf:"
status=1
fi
echo ${module#./}
fi
done
exit $status
+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
# Substitute CONFIG_ variables
awk '
function subst(force)
{
if (!done || force) {
if (has_value)
print symbol "=" value
else
print "# " symbol " is not set"
}
done=1
}
BEGIN { symbol = ARGV[1]
if (ARGC == 3) {
has_value=1
value = ARGV[2]
}
split("", ARGV)
}
match($0, "\\<" symbol "\\>") \
{ subst(1) ; next }
{ print }
END { subst(0) }
' "$@"
+42
View File
@@ -0,0 +1,42 @@
# Kernel configuration file selection.
# (See series.conf for a list of symbols defined.)
+IA32 i386/default
+IA32 i386/pae
+IA32 i386/debug
#+IA32 i386/um
+IA32 i386/xen
+IA32 i386/vanilla
+IA32 i386/rt
+IA32 i386/rt_debug
+IA32 i386/lockdep
+ia64 ia64/default
+ia64 ia64/debug
+ia64 ia64/vanilla
+x86_64 x86_64/default
#+x86_64 x86_64/um
+x86_64 x86_64/xen
+x86_64 x86_64/debug
+x86_64 x86_64/lockdep
+x86_64 x86_64/vanilla
+x86_64 x86_64/rt
+x86_64 x86_64/rt_debug
#+alpha alpha/default
#+alpha alpha/vanilla
+PPC powerpc/default
+PPC powerpc/ppc64
+PPC powerpc/kdump
+PPC powerpc/vanilla
#+PPC powerpc/rt
+PPC powerpc/ps3
+s390 s390/s390
+s390x s390/default
+s390x s390/vanilla
#+parisc parisc/default
BIN
View File
Binary file not shown.
+165
View File
@@ -0,0 +1,165 @@
#! /bin/bash
LC_ALL=POSIX
usage() {
cat <<EOF
Usage: ${0##*/} [-i module] [-x module] [-Nv] {module|rpm} ...
-i Include the specified modules (glob expression).
-x Exclude the specified modules (glob expression).
-N Don't try to combine modalias tags that only differ in one character.
-v Verbose: report which modules define which aliases.
EOF
exit $1
}
ARGS=("$@")
options=`getopt -o i:x:vNh -- "$@"`
if [ $? -ne 0 ]
then
usage 2
fi
eval set -- "$options"
opt_combine=1
while :; do
case "$1" in
-i)
include="$include ${2%.ko}"
shift 2
;;
-x)
exclude="$exclude ${2%.ko}"
shift 2
;;
-v)
opt_verbose=1
shift ;;
-N)
opt_combine=
shift ;;
-h)
usage 0
;;
--)
shift
break
;;
esac
done
process_module() {
declare module=$1 base=${1##*/} aliases
if [ -n "$include" ]; then
included=
for x in $include; do
eval "case \"\${base%.ko}\" in (${x%.ko}) included=1;; esac"
done
else
included=1
fi
for x in $exclude; do
eval "case \"\${base%.ko}\" in (${x%.ko}) included=;; esac"
done
[ -n "$included" ] || return
aliases="$(/sbin/modinfo -F alias "$module" \
| sed -nre 's@^.+:.+$@Supplements: modalias(&)@p')"
if [ -n "$aliases" ]; then
eval "processed_module_${base//[^a-zA-Z0-9_]/_}=$base"
echo "$aliases" \
| if [ -n "$opt_verbose" ]; then
sed -e "s@\$@ # $base@"
else
cat
fi
fi
}
print_modaliases() {
declare class=$1 variants=$2 pos=$3
if [ -n "$variants" ]; then
echo "${class:0:pos}[$variants]${class:pos+1}"
else
[ -z "$class" ] || echo "$class"
fi
}
combine_modaliases() {
declare tag class variants pos n
read class
while read tag; do
for ((n=0; n<${#class}; n++)); do
if [ "*" != "${class:n:1}" -a \
"${class:0:n}" = "${tag:0:n}" -a \
"${class:n+1}" = "${tag:n+1}" ] &&
( [ -z "$pos" ] || [ $n = $pos ] ); then
variants="${variants:-${class:n:1}}${tag:n:1}"
pos=$n
break
fi
done
if [ $n -eq ${#class} ]; then
print_modaliases "$class" "$variants" "$pos"
variants=
pos=
class=$tag
fi
done
print_modaliases "$class" "$variants" "$pos"
}
tmp=$(mktemp -t ${0##*/}.XXXXXX)
trap "rm -f $tmp" EXIT
for file in "$@"; do
case "$(file -b "$file")" in
RPM*)
tmpdir=$(mktemp -td ${0##*/}.XXXXXX)
rpm2cpio "$file" | ( cd $tmpdir && cpio -dim --quiet )
for module in $(find $tmpdir -type f -name '*.ko'); do
process_module "$module" >> $tmp
done
rm -rf $tmpdir
;;
ELF*)
process_module "$file" >> $tmp
;;
*)
if [ -e "$file" ]; then
echo "File type of $file not supported" >&2
exit 1
fi
file2=$(/sbin/modinfo -F filename "${file%.ko}")
if ! [ -e "$file2" ]; then
echo "No module $file found" >&2
exit 1
fi
process_module "$file2" >> $tmp
;;
esac
done
if [ -n "${!processed_module_*}" ]; then
echo "# Modules:" $(for m in ${!processed_module_*}; do echo ${!m}; done \
| sort -u)
sort -u $tmp \
| if [ -n "$opt_combine" ]; then
combine_modaliases
else
cat
fi
echo "# Generated with: ${0##*/} ${ARGS[*]}"
fi
# vim:softtabstop=4 shiftwidth=4
+19
View File
@@ -0,0 +1,19 @@
#! /bin/sh
IFS=$'\n'
filelist=($(cat))
printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/find-provides "$@"
for file in "${filelist[@]}"; do
case "$file" in
*/symsets-*.tar.gz)
flavor=${file%.tar.gz}
flavor=${flavor##*-}
for symset in $(tar tfz "$file" | grep -v '/$'); do
class=${symset##*/} ; class=${class%.*}
echo "kernel($flavor:$class) = ${symset##*.}"
done
;;
esac
done
+23
View File
@@ -0,0 +1,23 @@
#! /bin/sh
for f in $(find -name '*.symtypes' | sort); do
f=${f#./}
echo "/* ${f%.symtypes}.o */"
cat $f
echo
done \
| sed -e '\:UNKNOWN:d' \
-e 's:[,;] }:}:g' \
-e 's:\([[({]\) :\1:g' \
-e 's: \([])},;]\):\1:g' \
-e 's: $::' \
$f \
| awk '
/^.#/ { if (defined[$1] == $0) {
print $1
next
}
defined[$1] = $0
}
{ print }
'
+22
View File
@@ -0,0 +1,22 @@
# Readlink is not present on some older distributions: emulate it.
readlink() {
local path=$1 ll
if [ -L "$path" ]; then
ll="$(LC_ALL=C ls -l "$path" 2> /dev/null)" &&
echo "${ll/* -> }"
else
return 1
fi
}
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"
}
+12
View File
@@ -0,0 +1,12 @@
#! /bin/sh
prefix=
suffix=
if [ "$3" = kernel-dummy -o -n "$suffix" ]; then
[ -n "$suffix" ] || suffix=$2
while [ "$suffix" != "${suffix#[^0-9]*.}" ]; do
suffix=${suffix#[^0-9]*.}
done
echo $prefix$suffix
else
echo "pkg:kernel-dummy"
fi
+287
View File
@@ -0,0 +1,287 @@
#!/usr/bin/perl -w
#
# 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 strip_ext($) {
# local ($_) = @_;
# s/\.(diff?|patch)$//;
#}
#sub try_ext($) {
# my ($path) = @_;
# for my $p in (($path, "$path.diff", "$path.dif", "$path.patch")) {
# return $p
# if (-f $p);
# }
# return undef;
#}
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);
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" .
" (Default values: --path='" . join(':', @path) . "', " .
"--default=$default)\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, slashme($_)));
}
my %files = map { $_ => 0 } @files;
parse($fh, sub {
my ($patch, @guards) = @_;
if (exists $files{$patch}) {
$files{$patch}++;
} else {
print "Not found: $dir$patch\n";
$problems++;
}});
$fh->close();
my ($file, $ref);
while (($file, $ref) = each %files) {
next if $ref == 1;
if ($ref == 0) {
print "Unused: $file\n" if $ref == 0;
$problems++;
}
if ($ref > 1) {
print "Warning: multiple uses: $file\n" if $ref > 1;
# 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 eparated by a colon (C<:>) character. The
I<--prefix> option specifies the location of the files.
Use I<--list> to list all files independend 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 <agruen@suse.de>, SUSE Labs
+33
View File
@@ -0,0 +1,33 @@
#! /bin/sh
sourcedir=$1
builddir=$2
release=$3
# Install all config files. (Some of them might not work in the
# kernel sources because of architecture specific patches, but
# we don't care.)
configs="$($sourcedir/guards --list < $sourcedir/config.conf)"
for config in $configs; do
name=$(basename $config)
path=arch/$(dirname $config)/defconfig.$name
mkdir -p $(dirname $path)
cat $builddir/config/$config \
| $sourcedir/config-subst CONFIG_LOCALVERSION '"'-$name'"' \
| $sourcedir/config-subst CONFIG_SUSE_KERNEL y \
> $path
done
echo "-$release" > localversion-rpm-release
# For all architectures included, if there is a defconfig.default,
# make that the defconfig as well. If there is no defconfig.default,
# also remove the defconfig, as it is obviously not a tested, and
# woldn't work, anyway.
for config in $configs; do
arch=${config%/*}
if [ -e arch/$arch/defconfig.default ]; then
cat arch/$arch/defconfig.default > arch/$arch/defconfig
else
rm -f arch/$arch/defconfig
fi
done
+235
View File
@@ -0,0 +1,235 @@
#!/bin/bash
# Tool to do kABI checks.
# (c) Kurt Garloff <garloff@suse.de>, GNU GPL, 11/2005
# $Id$
#
# This tool looks at the generated symvers and compares it to the
# reference file (if existent). It prints warnings for changed symbol
# versions.
#
# Return value:
# 0 -- no changes
# 1 -- usage/input error
# 2 -- internal error
# 4 -- only additions
# >= 8 -- removed or changed symbols (see below)
#
# Severity classification:
# - 8 -- 15: if it's not found in a list (commonsyms or usedsyms)
# The score depends on the source; symbols in vmlinux are more
# likely to be used by anyone.
# - 16 -- 23: symbol is found in the list usedsyms
# - 24 -- 31: symbol is found in the list commonsyms
severities="
# unimportant ---. .--- important
# v v
drivers/base/* 13
drivers/char/ipmi/* 10
drivers/char/tpm/tpm 9
drivers/hwmon/* 10
drivers/i2c/i2c-core 9
drivers/md/* 13
drivers/message/fusion/* 6
drivers/pci/* 12
drivers/pci/hotplug/pci_hotplug 10
drivers/scsi/libata 12
drivers/scsi/scsi* 12
drivers/scsi/*/scsi_transport_* 12
drivers/scsi/libiscsi* 12
drivers/ide/ide-core 11
drivers/usb/core/usbcore 10
drivers/usb/serial/usbserial 9
fs/dmapi/dmapi 11
fs/fat/fat 11
fs/jbd/jbd 11
net/ipv4/netfilter/ip_tables 9
vmlinux 15
"
# Turning off UTF-8 processing provides a major speedup.
export LC_ALL=C
echo "${0##*/} $@"
unset quiet verbose
if [ "$1" = "-q" ]; then
shift
quiet=1
fi
if [ "$1" = "-v" ]; then
shift
verbose=1
fi
if [ $# -lt 2 -o $# -gt 4 ]; then
echo "Usage: ${0##*/} [-q] [-v] reference symvers [commonsyms [usedsyms]]" >&2
exit 1
fi
for file in "$@"; do
[ -r "$file" ] && continue
echo "Cannot read from '$file'" >&2
exit 1
done
declare_symbol_severity() {
declare severity=$1
while [ $# -ge 2 ]; do
if ! eval "severity_of_${2//[^a-zA-Z0-9_]/_}=$severity"; then
echo "Internal error" >&2
exit 2
fi
shift
done
}
consistency_check() {
declare_symbol_severity 16 consistency_check_foo
check_modified_symbols >/dev/null <<-EOF
consistency_check_foo -0x12345678 consistency/check/foo +0x98765432 consistency/check/foo
EOF
if [ $? -ne 31 ]; then
echo "Internal error" >&2
exit 2
fi
}
#set -x
eval '
severity() {
case $2 in
'"$(
( echo "$severities"
echo "consistency/check/* 15" # For the consistency test
) \
| sed -e '/^#/d' -e '/^$/d' \
| while read glob severity; do
echo " ($glob) _rc=$severity ;;"
done
)"'
(*) _rc=8 ;;
esac
# Is a particular severity defined for this symbol?
declare severity=severity_of_$1
if [ -n "${!severity}" ]; then
((_rc += ${!severity}))
fi
return $_rc
}'
#set +x
grab_symvers_from_rpm() {(
# (Run in subshell to make trap work.)
tmpdir=$(mktemp -t -d ${0##*/}.XXXXXX)
trap "cd /; rm -rf $tmpdir" EXIT
cd $tmpdir
rpm2cpio "$file" \
| cpio -dim --quiet './boot/symvers-*.gz'
set -- boot/symvers-*.gz
if ! [ -e "$1" ]; then
echo "Failed to extract symvers-*.gz from $file" >&2
exit 1
fi
zcat "$1"
)}
grab_symvers() {
declare tag=$1 file=$2 pwd tmpdir
case "$(file -b - <"$file")" in
gzip*)
zcat "$file"
;;
RPM*)
grab_symvers_from_rpm "$file"
;;
*)
cat "$file"
;;
esac \
| sed -e "/^#/d" -e "s/^/$tag/" \
| sort -k 2
}
filter_out_identical_symbols() {
# This expression works no matter how many columns the files have.
grep -v -P '^\S+ -(\S+)( \S+)+ \+\1( \S+)+$'
}
check_modified_symbols() {
declare -i RC=0 _rc
declare ignored
while read symbol tail; do
# Split in half no matter how many columns the files have.
set -- $tail ; half=$(($#/2+1))
version1=$1 ; version2=${!half} ; shift
source1=$1 ; source2=${!half} ; shift
case "$version1$version2" in
-\#*)
continue
;;
-*+* | -*)
ignored=
case "$version1" in
*=\>*)
if [ "${version1#*=>}" = "${version2#+}" ]; then
version1="${version1%=>*}"
ignored="; ignored"
fi
;;
esac
severity $symbol $source1 && continue
_rc=$?
if [ -z "$quiet" ]; then
echo -n "Warning: $source1: $symbol(${version1#-}) "
if [ -n "$version2" ]; then
echo -n "changed to $symbol(${version2#+})"
[ "$source1" != "$source2" ] &&
echo -n " and moved to $source2"
else
echo -n "removed"
fi
echo " (badness ${_rc}$ignored)"
fi
[ -n "$ignored" ] && _rc=0
;;
*)
if [ -n "$verbose" ]; then
echo " new symbol $symbol: ${version1#+}"
fi
_rc=4
;;
esac
if [ ${_rc} -gt $RC ]; then RC=${_rc}; fi
done
return $RC
}
sort_by_badness() {
sed -e 's/.*(badness \([0-9]\+\)).*/\1 &/' -e 't' -e 's/^/0 /' \
| sort -n -r \
| sed -e 's/^[0-9]* //'
}
consistency_check
[ -n "$4" ] && declare_symbol_severity 8 $(< $4)
[ -n "$3" ] && declare_symbol_severity 16 $(< $3)
join -j 2 -a 1 -a 2 <(grab_symvers - $1) <(grab_symvers + $2) \
| filter_out_identical_symbols \
| check_modified_symbols \
| sort_by_badness
RC=${PIPESTATUS[2]}
echo "kABI verdict: $RC"
exit $RC
BIN
View File
Binary file not shown.
+121
View File
@@ -0,0 +1,121 @@
%package -n %{-n*}-%1
Version: %(echo %{-v*}-%3 | tr - _)
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*} = %(echo %{-v*}-%3 | tr - _)
Requires: kernel-%1 coreutils grep
AutoReqProv: on
%{-p:%{expand:%(cd %_sourcedir; cat %{-p*})}}
%description -n %{-n*}-%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*}-%1
version=%(echo %{-v*}-%3 | tr - _)
if [ -e /boot/System.map-%2 ]; then
/sbin/depmod -a -F /boot/System.map-%2 %2
fi
modules=( $(rpm -ql %{-n*}-%1-$version-%{-r*} | grep '\.ko$') )
if [ -x /usr/lib/module-init-tools/weak-modules ]; then
printf '%s\n' "${modules[@]}" \
| /usr/lib/module-init-tools/weak-modules --add-modules
fi
if [ -e /etc/sysconfig/kernel -a -e /boot/initrd-%2 ]; then
source /etc/sysconfig/kernel
run_mkinitrd=
set -- "${modules[@]##*/}" ; set -- "${@%.ko}"
for module in $INITRD_MODULES; do
case " $* " in
*" $module "*)
run_mkinitrd=1
break ;;
esac
done
if [ -n "$run_mkinitrd" ]; then
for image in vmlinuz image vmlinux linux bzImage; do
if [ -f /boot/$image-%2 ]; then
/sbin/mkinitrd -k /boot/$image-%2 \
-i /boot/initrd-%2 \
|| exit 1
break
fi
done
fi
fi
%preun -n %{-n*}-%1
version=%(echo %{-v*}-%3 | tr - _)
set -o noclobber
rpm -ql %{-n*}-%1-$version-%{-r*} | grep '\.ko$' \
> /var/run/rpm-%{-n*}-%1-$version-%{-r*}-modules
%postun -n %{-n*}-%1
version=%(echo %{-v*}-%3 | tr - _)
modules=( $(cat /var/run/rpm-%{-n*}-%1-$version-%{-r*}-modules) )
rm -f /var/run/rpm-%{-n*}-%1-$version-%{-r*}-modules
if [ -e /boot/System.map-%2 ]; then
/sbin/depmod -a -F /boot/System.map-%2 %2
fi
if [ -x /usr/lib/module-init-tools/weak-modules ]; then
printf '%s\n' "${modules[@]}" \
| /usr/lib/module-init-tools/weak-modules --remove-modules
fi
if [ -e /etc/sysconfig/kernel -a -e /boot/initrd-%2 ]; then
source /etc/sysconfig/kernel
run_mkinitrd=
set -- "${modules[@]##*/}" ; set -- "${@%.ko}"
for module in $INITRD_MODULES; do
case " $* " in
*" $module "*)
run_mkinitrd=1
break ;;
esac
done
if [ -n "$run_mkinitrd" ]; then
for image in vmlinuz image vmlinux linux bzImage; do
if [ -f /boot/$image-%2 ]; then
/sbin/mkinitrd -k /boot/$image-%2 \
-i /boot/initrd-%2 \
|| exit 1
break
fi
done
fi
fi
%files -n %{-n*}-%1
%{-f:%{expand:%(cd %_sourcedir; cat %{-f*})}}
%{!-f:%defattr (-,root,root)}
%{!-f:/lib/modules/%2}
BIN
View File
Binary file not shown.
+42
View File
@@ -0,0 +1,42 @@
# Defines %flavors_to_build and %kernel_source() as a side effect.
# ps3 has modules disabled, always skip it
%_kernel_module_package(n:v:r:s:f:Xp:) \
BuildRequires: module-init-tools kernel-syms\
%{expand:%( \
subpkg=%{-s*}%{!-s:/usr/lib/rpm/kernel-module-subpackage} \
echo "%%define _suse_kernel_module_subpackage(n:v:r:f:p:) %%{expand:%%(cd %_sourcedir; cat $subpkg; echo %%%%nil)}" \
flavors="%{!-X:%*}%{-X:$(ls /usr/src/linux-obj/%_target_cpu 2>/dev/null)}" \
flavors_to_build= \
kver=$(rpm -q --qf '%{VERSION}-%{RELEASE}' kernel-source) \
for flavor in $flavors; do \
if [ $flavor = "ps3" ]; then continue ; fi \
if [ -n "%{-X}" ]; then \
case " %* " in \
(*" $flavor "*) \
continue ;; \
esac \
fi \
krel=$(make -s -C /usr/src/linux-obj/%_target_cpu/$flavor kernelrelease) \
[ -e /boot/symsets-$krel.tar.gz ] || continue \
flavors_to_build="$flavors_to_build $flavor" \
echo "%%_suse_kernel_module_subpackage -n %{-n*}%{!-n:%name}-kmp -v %{-v*}%{!-v:%version} -r %{-r*}%{!-r:%release} %{-p} $flavor $krel $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 "%package -n %{-n*}%{!-n:%name}-kmp-_dummy_" \
echo "Version: %version" \
echo "Summary: %summary" \
echo "Group: %group" \
echo "%description -n %{-n*}%{!-n:%name}-kmp-_dummy_" \
)}
# kernel_module_package: simply pass on all options and arguments.
%kernel_module_package(n:v:r:s:f:xp:) \
%{expand:%%_kernel_module_package %{-x:-X} %{-n} %{-v} %{-r} %{-s} %{-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:) \
%{expand:%%_kernel_module_package %{-x: }%{!-x:-X} %{-n} %{-v} %{-r} %{-s} %{-f} %{-p} %*}
+111
View File
@@ -0,0 +1,111 @@
#! /bin/bash
unset LANG ${!LC_*}
# Usage: make-symsets symsets.tar.gz [old-symsets.tar.gz]
# < symvers.gz
#
# symsets.tar.gz
# Create this symbol set tarball.
#
# old-symsets.tar.gz
# Reuse all possible symbol sets from this tarball.
tarball=$1
old_tarball=$2
# Classify all the symbols by the directory they live in
unset ${!class_*}
while read class ignore line; do
class=class_${class//[^a-zA-Z0-9_]/_}
eval "$class[\${#$class[@]}]=\"$line\""
if [ $ignore -gt 0 ]; then
eval "ignore_$class=1"
fi
done < <(
awk '
BEGIN { FS="\t" ; OFS="\t" }
{ class=$3
sub(/\/[^/]+$/, "", class)
ignore=sub(/.*=>/, "", $1)
print class, ignore, $0
}
'
)
tmpdir=$(mktemp -t -d ${0##*/}.XXXXXX)
trap "rm -rf $tmpdir" EXIT
basename=$(basename ${tarball:-.} .tar.gz)
# Save all the new sets, computer and output their hashes
newdir=$tmpdir/new/$basename
mkdir -p $newdir
for class in ${!class_*} ; do
class=${class#class_}
eval "printf \"%s\\n\" \"\${class_$class[@]}\"" \
| sort -k2 \
> $newdir/tmp
set -- $(md5sum $newdir/tmp) ; set -- ${1:0:16}
mv $newdir/tmp $newdir/$class.$1
#echo "Provides: kernel($class) = $1"
done
shopt -s nullglob
if [ -n "$old_tarball" ]; then
# Reuse all sets of symbols from the old tarball that are
# still the same.
old_basename=$(basename $old_tarball .tar.gz)
mkdir -p $tmpdir/old
zcat $old_tarball \
| tar xf - -C $tmpdir/old
set -- $tmpdir/old/*
olddir=$1
if [ ! -d $olddir ]; then
echo "$old_tarball does not contain directory $old_basename"
exit 1
fi
for oldset in $olddir/* ; do
[ -e $newdir/${oldset#$olddir/} ] && continue
class=${oldset##*/} ; class=${class%.*}
set -- $newdir/$class.*
[ $# -eq 1 ] || continue
newset=$1
# '*' doesn't occur in either file.
missing="$(join -t '*' -j 1 -v 1 <(sort "$oldset") <(sort "$newset"))"
if [ -z "$missing" ]; then
keep_oldset[${#keep_oldset[@]}]=$oldset
#echo "Provides: kernel($class) = ${oldset##*.} (old)"
else
set -- $(echo "$missing" | awk '{ print $2 "(" $1 ")" }')
ignore=ignore_class_$class
if [ -n "${!ignore}" ]; then
ignore="; ignoring"
else
ignore=
status=1
fi
echo "No longer provided: kernel($class) = ${oldset##*.} (missing/changed: $@$ignore)" >&2
fi
done
if [ ${#keep_oldset[@]} -gt 0 ]; then
mv "${keep_oldset[@]}" $newdir/
fi
else
echo "No longer provided: previous kernel(...) symbols that may still be" \
"compatible" >&2
fi
# Store the generated sets in $tarball
tar cf - -C $tmpdir/new $basename \
| gzip -9 \
> $tarball \
|| exit 1
exit $status
# vim:shiftwidth=4 softtabstop=4
+30
View File
@@ -0,0 +1,30 @@
# Modules that have been renamed (from *-new to *, etc.)
#
# Note: we mostly care about storage drivers in this list; others
# will not usually end up in sysconfig files, and so the appropriate
# modules will get loaded when matchign hardware is detected. For
# convenience, we also include the foo-new drivers from older
# distributions here.
#
# This table has been created based on the results of the
# misc/obsolete-module-aliases script in the SUSE kernel CVS.
## SLES8 => SLES10
alias bcm-new bcm
alias aic79xx-new aic79xx
## SLES9 GA .. SLES9 SP3 => SLES10
alias bcm4400 b44
alias bcm5700 tg3
alias bcm5700-new tg3
alias carmel sx8
alias e1000-new e1000
alias lpfcdd lpfc
alias qla2100 qla2xxx
alias qla2200 qla2xxx
alias qla2300 qla2xxx
alias qla2322 qla2xxx
alias qla2400 qla2xxx
alias qla6312 qla2xxx
alias qla6322 qla2xxx
alias tg3-new tg3
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+122
View File
@@ -0,0 +1,122 @@
# It must be possible to install different kernel.rpm packages in parallel.
# But in this post install script, the /boot/vmlinux symlink is replaced.
# On powerpc, the different kernels are for different board/firmware types
# They are not compatible.
wrong_boardtype() {
echo "This kernel is for $1, it will not boot on your system."
echo "The /boot/vmlinux symlink will not be created or updated."
exit 0
}
if [ -f /proc/cpuinfo ]; then
case "@FLAVOR@" in
ppc64|kdump)
if [ -d /proc/device-tree ]; then
if [ ! -d /proc/ppc64 ]; then
wrong_boardtype "OpenFirmware based 64bit machines or legacy iSeries"
fi
fi
;;
default)
if [ -d /proc/ppc64 -o -d /proc/iSeries ]; then
wrong_boardtype "32bit systems"
fi
;;
*)
;;
esac
fi
echo Setting up /lib/modules/@KERNELRELEASE@
suffix=
case @FLAVOR@ in
kdump|ps3|um|xen*)
suffix=-@FLAVOR@
;;
esac
for x in /boot/@IMAGE@ /boot/initrd; do
rm -f $x$suffix
ln -s ${x##*/}-@KERNELRELEASE@ $x$suffix
done
if [ -x /sbin/module_upgrade ]; then
/sbin/module_upgrade --rename mptscsih="mptspi mptfc mptsas"
fi
# Add symlinks of compatible modules to /lib/modules/$krel/weak-updates/.
if [ -x /usr/lib/module-init-tools/weak-modules ]; then
/usr/lib/module-init-tools/weak-modules --add-kernel @KERNELRELEASE@
fi
/sbin/depmod -a -F /boot/System.map-@KERNELRELEASE@ @KERNELRELEASE@
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 ]
then
return 0
else
return 1
fi
}
if [ -f /etc/fstab -a ! -e /.buildenv -a -x /sbin/mkinitrd ] ; then
if ! /sbin/mkinitrd -k /boot/@IMAGE@-@KERNELRELEASE@ \
-i /boot/initrd-@KERNELRELEASE@; then
echo "/sbin/mkinitrd failed" >&2
exit 1
fi
# only run the bootloader if the usual bootloader configuration
# files are there -- this is different on every architecture
if run_bootloader ; then
# handle 10.2 and SLES10 SP1
if [ -x /usr/lib/bootloader/bootloader_entry ]; then
/usr/lib/bootloader/bootloader_entry \
add \
@FLAVOR@ \
@KERNELRELEASE@ \
@IMAGE@-@KERNELRELEASE@ \
initrd-@KERNELRELEASE@
# handle 10.1 and SLES10 GA
elif [ -x /sbin/update-bootloader ]; then
case @FLAVOR@ in
kdump|um|ps3)
;;
*)
opt_xen_kernel=
case @FLAVOR@ in
xen*)
set -- @FLAVOR@
set -- ${1#xen}
opt_xen_kernel=--xen-kernel=/boot/xen${1:+-$1}.gz
;;
esac
echo "bootloader_entry script unavailable, updating /boot/@IMAGE@"
/sbin/update-bootloader \
--image /boot/@IMAGE@ \
--initrd /boot/initrd \
--add \
--force $opt_xen_kernel
/sbin/update-bootloader --refresh
;;
esac
else
message_install_bl
fi
fi
else
echo "Please run mkinitrd as soon as your system is complete."
message_install_bl
fi
# vim: set sts=4 sw=4 ts=8 noet:
+49
View File
@@ -0,0 +1,49 @@
# Remove symlinks from /lib/modules/$krel/weak-updates/.
if [ -x /usr/lib/module-init-tools/weak-modules ]; then
/usr/lib/module-init-tools/weak-modules --remove-kernel @KERNELRELEASE@
fi
# remove /boot/@IMAGE@.previous entry on a 10.1 and SLES10 GA system
# when going back from 10.2 or SLES10 SP1 kernel to the original kernel
remove_previos_entry=no
suffix=
case @FLAVOR@ in
kdump|ps3|um|xen*)
suffix=-@FLAVOR@
;;
esac
# Created in %post of old kernels
case "$(readlink /boot/@IMAGE@$suffix.previous)" in
@IMAGE@-@KERNELRELEASE@|$(readlink /boot/@IMAGE@$suffix))
remove_previos_entry=yes
rm -f /boot/@IMAGE@$suffix.previous
;;
esac
case "$(readlink /boot/initrd$suffix.previous)" in
initrd-@KERNELRELEASE@|$(readlink /boot/initrd$suffix))
rm -f /boot/initrd$suffix.previous
;;
esac
# remove fstab check once perl-Bootloader can cope with it
if [ -f /etc/fstab ]; then
# handle 10.2 and SLES10 SP1
if [ -x /usr/lib/bootloader/bootloader_entry ]; then
/usr/lib/bootloader/bootloader_entry \
remove \
@FLAVOR@ \
@KERNELRELEASE@ \
@IMAGE@-@KERNELRELEASE@ \
initrd-@KERNELRELEASE@
# handle 10.1 and SLES10 GA
elif [ -x /sbin/update-bootloader ]; then
if [ "$remove_previos_entry" = "yes" ] ; then
/sbin/update-bootloader --image /boot/@IMAGE@$suffix.previous \
--initrd /boot/initrd$suffix.previous \
--remove --force
fi
/sbin/update-bootloader --refresh
fi
fi
+21
View File
@@ -0,0 +1,21 @@
# 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 [ "$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
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
# vim: syntax=sh
#set -x
set -e
test -f /.buildenv || exit 0
this_release=`rpm -q --qf %{RELEASE} kernel-dummy`
echo this_release $this_release
test -n "$this_release" || exit 1
shopt -s nullglob
for i in /usr/src/packages/SOURCES/*.spec; do
sed -i -e '/^BuildRequires:/s@kernel-dummy@@g' \
-e '/^BuildRequires:[ \t]*$/d' \
-e "/^Release:/s@^.*@Release: $this_release@" $i
done
View File
+1636
View File
File diff suppressed because it is too large Load Diff
+20
View File
@@ -0,0 +1,20 @@
relink linux-@KERNELRELEASE@ /usr/src/linux
relink linux-@KERNELRELEASE@-obj /usr/src/linux-obj
if [ -e /.buildenv ]; then
# Autobuild has a modified version of uname that reports a specific
# kernel version if /.kernelversion exists.
arch=$(echo %_target_cpu \
| sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
-e s/arm.*/arm/ -e s/sa110/arm/ \
-e s/s390x/s390/ -e s/parisc64/parisc/ \
-e s/ppc.*/powerpc/)
flavor="$(
cd /usr/src/linux-@KERNELRELEASE@/arch/$arch
set -- defconfig.*
[ -e defconfig.default ] && set -- defconfig.default
echo ${1/defconfig.}
)"
echo @KERNELRELEASE@-$flavor > /.kernelversion
fi
+1875
View File
File diff suppressed because it is too large Load Diff