Files
scst/scripts/kernel-functions
Yan Burman b990f13496 Merged revisions 5564-5565,5580,5591,5599,5604,5623,5632-5638,5645-5646,5652-5653 via svnmerge from
svn+ssh://yanb123@svn.code.sf.net/p/scst/svn/branches/3.0.x

................
  r5564 | vlnb | 2014-06-04 06:10:31 +0300 (Wed, 04 Jun 2014) | 3 lines
  
  Initialize merging from the trunk
................
  r5565 | vlnb | 2014-06-04 06:12:05 +0300 (Wed, 04 Jun 2014) | 13 lines
  
  Merged revisions 5543,5545 via svnmerge from 
  svn+ssh://vlnb@svn.code.sf.net/p/scst/svn/trunk
  
  ........
    r5543 | bvassche | 2014-05-23 00:33:53 -0700 (Fri, 23 May 2014) | 1 line
    
    RHEL 7 build fixes
  ........
    r5545 | bvassche | 2014-05-23 01:36:36 -0700 (Fri, 23 May 2014) | 1 line
    
    scripts/rebuild-rhel-kernel-rpm: Add RHEL 7 RC support
  ........
................
  r5580 | bvassche | 2014-06-11 17:33:30 +0300 (Wed, 11 Jun 2014) | 1 line
  
  ib_srpt: Merge build and login fixes from trunk
................
  r5591 | vlnb | 2014-06-12 02:52:43 +0300 (Thu, 12 Jun 2014) | 14 lines
  
  Merged revisions 5584 via svnmerge from 
  svn+ssh://vlnb@svn.code.sf.net/p/scst/svn/trunk
  
  ........
    r5584 | vlnb | 2014-06-11 12:33:18 -0700 (Wed, 11 Jun 2014) | 8 lines
    
    scst: RHEL 5 build fix
    
    Avoid that building the scst kernel module fails on RHEL 5 due to
    a missing kvasprintf() implementation.
    
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
  ........
................
  r5599 | bvassche | 2014-06-13 09:59:13 +0300 (Fri, 13 Jun 2014) | 1 line
  
  ib_srpt: Merge from trunk
................
  r5604 | vlnb | 2014-06-14 03:31:55 +0300 (Sat, 14 Jun 2014) | 14 lines
  
  Merged revisions 5602 via svnmerge from 
  svn+ssh://vlnb@svn.code.sf.net/p/scst/svn/trunk
  
  ........
    r5602 | vlnb | 2014-06-13 16:57:26 -0700 (Fri, 13 Jun 2014) | 8 lines
    
    scst_pr_read_reservation(): Initialize returned buffer
    
    Avoid that this function returns an uninitialized buffer to the
    initiator if buffer_size < 8. Detected by Coverity.
    
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
  ........
................
  r5623 | vlnb | 2014-06-25 07:00:14 +0300 (Wed, 25 Jun 2014) | 9 lines
  
  Merged revisions 5610 via svnmerge from 
  svn+ssh://vlnb@svn.code.sf.net/p/scst/svn/trunk
  
  ........
    r5610 | vlnb | 2014-06-18 20:51:48 -0700 (Wed, 18 Jun 2014) | 3 lines
    
    Update for 3.15 kernels
  ........
................
  r5632 | bvassche | 2014-06-29 08:18:01 +0300 (Sun, 29 Jun 2014) | 1 line
  
  scst_vdisk: 32-bit build fix (merge r5629 from trunk)
................
  r5633 | bvassche | 2014-06-29 08:20:31 +0300 (Sun, 29 Jun 2014) | 1 line
  
  ib_srpt: Remove existing ib_srpt.ko kernel modules before installation (merge r5621, r5628 and r5630 from trunk)
................
  r5634 | bvassche | 2014-06-29 08:22:58 +0300 (Sun, 29 Jun 2014) | 1 line
  
  Skip "depmod" while building an RPM (merge r5612 from trunk)
................
  r5635 | bvassche | 2014-06-29 08:24:11 +0300 (Sun, 29 Jun 2014) | 1 line
  
  ib_srpt: Set SCSI residual fields in SRP_CMD reply (merge r5622 from trunk)
................
  r5636 | bvassche | 2014-06-29 08:25:55 +0300 (Sun, 29 Jun 2014) | 1 line
  
  nightly build: Add kernel 3.15 build infrastructure (merge r5611 from trunk)
................
  r5637 | bvassche | 2014-06-29 08:27:14 +0300 (Sun, 29 Jun 2014) | 1 line
  
  regression tests: Sort hash keys before comparing (merge r5582 from trunk)
................
  r5638 | bvassche | 2014-06-29 08:28:45 +0300 (Sun, 29 Jun 2014) | 1 line
  
  regression tests: Sync with a recent sysfs change (merge r5581 from trunk)
................
  r5645 | bvassche | 2014-06-29 09:00:05 +0300 (Sun, 29 Jun 2014) | 1 line
  
  nightly build, scripts: Merge from trunk (r5533:r5642)
................
  r5646 | bvassche | 2014-06-29 09:10:22 +0300 (Sun, 29 Jun 2014) | 2 lines
  
  scst: Switch from the cpu_*() to the cpumask_*() API (merge r5596 from trunk)
................
  r5652 | bvassche | 2014-06-30 13:23:11 +0300 (Mon, 30 Jun 2014) | 1 line
  
  nightly build: Merge r5642:r5651 from trunk
................
  r5653 | bvassche | 2014-06-30 13:25:24 +0300 (Mon, 30 Jun 2014) | 1 line
  
  scst: Build fixes for kernel versions <= 2.6.34 (merge r5647 and r5648 from trunk)
................


git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.0.x-iser@5665 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-07-07 10:28:33 +00:00

222 lines
7.3 KiB
Bash

# -*- mode: shell-script -*-
# Shell functions for parsing the Linux kernel version and for downloading
# from kernel.org.
kernel_mirror="http://ftp.kernel.org/pub/linux/kernel"
kernel_longterm="http://www.kernel.org/pub/linux/kernel"
kernel_sources="$HOME/software/downloads"
# Kernel version number.
function kernel_version {
if [ "${1#2.}" != "$1" ]; then
echo "$1" | sed -n 's/^\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/p'
else
echo "$1" | sed -n 's/^\([0-9]*\.[0-9]*\).*$/\1/p'
fi
}
# Last component of the kernel version, or the empty string if $1 does
# not contain a patchlevel.
function patchlevel {
if [ "${1#2.}" != "$1" ]; then
echo "$1" | sed -n 's/^\([0-9]*\.[0-9]*\.[0-9]*\)[.-]\(.*\)$/\2/p'
else
echo "$1" | sed -n 's/^\([0-9]*\.[0-9]*\)[.-]\(.*\)$/\2/p'
fi
}
# Download the file from URL $1 and save it in the current directory.
function download_file {
if [ ! -e "$(basename "$1")" ]; then
if [ "${quiet_download}" = "false" ]; then
{ wget -q -nc -O- "$1" 2>/dev/null | grep -q .; } \
&& echo "Downloading $1 ..."
fi
wget -q -nc "$1"
fi
[ -e "$(basename "$1")" ]
}
# Make sure the kernel tarball and patch file are present in directory
# ${kernel_sources}. Download any missing files from ${kernel_mirror}.
function download_kernel {
local kver="$(kernel_version $1)"
local plevel="$(patchlevel $1)"
local series="$1"
if [ "${series:0:2}" = "3." ]; then
series="3.x"
else
series="${series:0:3}"
fi
mkdir -p "${kernel_sources}" || return $?
test -w "${kernel_sources}" || return $?
(
cd "${kernel_sources}" || return $?
if [ "$plevel" = "" ] \
|| download_file "${kernel_mirror}/v$series/patch-$1.xz" \
|| download_file "${kernel_mirror}/v$series/longterm/v${kver}/patch-$1.xz"
then
download_file "${kernel_mirror}/v$series/linux-${kver}.tar.xz" \
|| download_file "${kernel_mirror}/v$series/longterm/v${kver}/linux-${kver}.tar.xz" \
|| return $?
else
download_file "${kernel_mirror}/v$series/linux-$1.tar.xz" \
|| download_file "${kernel_mirror}/v$series/longterm/v${kver}/linux-$1.tar.xz" \
|| return $?
fi
)
}
function extract_kernel_archive {
if [ -e "${kernel_sources}/linux-$1.tar.xz" ]; then
xz -cd "${kernel_sources}/linux-$1.tar.xz" | tar xf -
else
tar xjf "${kernel_sources}/linux-$1.tar.bz2"
fi
}
# Create a linux-$1 tree in the current directory, where $1 is a kernel
# version number with either three or four components.
function extract_kernel_tree {
local kver="$(kernel_version $1)"
local plevel="$(patchlevel $1)"
local tmpdir=kernel-tree-tmp-$$
rm -rf "linux-$1" "${tmpdir}"
mkdir "${tmpdir}" || return $?
(
cd "${tmpdir}" || return $?
if [ "$plevel" != "" -a -e "${kernel_sources}/patch-$1.xz" ]; then
extract_kernel_archive $kver || return $?
mv linux-$kver linux-$1
( cd linux-$1 && xz -cd "${kernel_sources}/patch-$1.xz" \
| patch -p1 -f -s; ) \
|| return $?
else
extract_kernel_archive $1 || return $?
fi
mv "linux-$1" ".." || return $?
cd "../linux-$1" || return $?
if [ "$1" = "2.6.29" -o "$1" = "2.6.29.1" -o "$1" = "2.6.29.2" -o "$1" = "2.6.29.3" ]
then
patch -f -s -p1 <<'EOF'
Make sure that branch profiling does not trigger sparse warnings.
See also http://bugzilla.kernel.org/show_bug.cgi?id=12925
---
See also http://lkml.org/lkml/2009/4/5/120
--- orig/linux-2.6.29/include/linux/compiler.h 2009-03-23 19:12:14.000000000 -0400
+++ linux-2.6.29/include/linux/compiler.h 2009-03-24 08:46:46.000000000 -0400
@@ -75,7 +75,8 @@ struct ftrace_branch_data {
* Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
* to disable branch tracing on a per file basis.
*/
-#if defined(CONFIG_TRACE_BRANCH_PROFILING) && !defined(DISABLE_BRANCH_PROFILING)
+#if defined(CONFIG_TRACE_BRANCH_PROFILING) \
+ && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__)
void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
#define likely_notrace(x) __builtin_expect(!!(x), 1)
EOF
fi
if [ "${1#2.6.31}" != "$1" ]
then
patch -f -s -p1 <<'EOF'
Checking a 2.6.31.1 kernel configured with allyesconfig/allmodconfig
with sparse (make C=2) triggers a sparse warning on code that uses the
kmemcheck_annotate_bitfield() macro. An example of such a warning:
include/net/inet_sock.h:208:17: warning: do-while statement is not a compound statement
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Vegard Nossum <vegardno@ifi.uio.no>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
See also http://lkml.org/lkml/2009/9/26/51
--- linux-2.6.31.1/include/linux/kmemcheck-orig.h 2009-09-26 13:53:44.000000000 +0200
+++ linux-2.6.31.1/include/linux/kmemcheck.h 2009-09-26 13:53:56.000000000 +0200
@@ -137,13 +137,13 @@ static inline void kmemcheck_mark_initia
int name##_end[0];
#define kmemcheck_annotate_bitfield(ptr, name) \
- do if (ptr) { \
+ do { if (ptr) { \
int _n = (long) &((ptr)->name##_end) \
- (long) &((ptr)->name##_begin); \
BUILD_BUG_ON(_n < 0); \
\
kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
- } while (0)
+ } } while (0)
#define kmemcheck_annotate_variable(var) \
do { \
EOF
fi
if [ "${1#2.6.32}" != "$1" -o "${1#2.6.33}" != "$1" ]
then
patch -f -s -p1 <<'EOF'
Get rid of sparse errors on sk_buff.protocol.
--- linux/include/linux/skbuff-orig.h 2010-12-07 13:40:51.000000000 -0500
+++ linux/include/linux/skbuff.h 2010-12-07 13:41:05.000000000 -0500
@@ -349,8 +349,8 @@ struct sk_buff {
ipvs_property:1,
peeked:1,
nf_trace:1;
- __be16 protocol:16;
kmemcheck_bitfield_end(flags1);
+ __be16 protocol;
void (*destructor)(struct sk_buff *skb);
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
EOF
fi
if [ "${1#3.13}" != "$1" ]; then
if [ "$1" = "3.13" ] || [ "${1#3.13.}" -lt 6 ]; then
patch -f -s -p1 <<'EOF'
From 7b4ec8dd7d4ac467e9eee4d49f2c9574d773efbb Mon Sep 17 00:00:00 2001
From: Johannes Berg <johannes.berg@intel.com>
Date: Thu, 16 Jan 2014 10:18:48 +1030
Subject: [PATCH] export: declare ksymtab symbols
sparse complains about any __ksymtab symbols with the following:
warning: symbol '__ksymtab_...' was not declared. Should it be static?
due to Andi's patch making it non-static.
Mollify sparse by declaring the symbol extern, otherwise we get
drowned in sparse warnings for anything that uses EXPORT_SYMBOL
in the sources, making it easy to miss real warnings.
Fixes: e0f244c63fc9 ("asmlinkage, module: Make ksymtab [...] __visible")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
include/linux/export.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/export.h b/include/linux/export.h
index 3f2793d..96e45ea 100644
--- a/include/linux/export.h
+++ b/include/linux/export.h
@@ -59,6 +59,7 @@ extern struct module __this_module;
static const char __kstrtab_##sym[] \
__attribute__((section("__ksymtab_strings"), aligned(1))) \
= VMLINUX_SYMBOL_STR(sym); \
+ extern const struct kernel_symbol __ksymtab_##sym; \
__visible const struct kernel_symbol __ksymtab_##sym \
__used \
__attribute__((section("___ksymtab" sec "+" #sym), unused)) \
EOF
fi
fi
)
rmdir "${tmpdir}"
}