mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
Reworked qla2x00t patch generation process:
- Moved qla2x00t patch generation code from qla2x00t/Makefile to qla2x00t/extract-qla2xxx-orig and qla2x00t/generate-in-tree-patches. Restored qla2x00t/Makefile to r1104. - scripts/run-regression-tests now passes the full kernel version (including patch level) to scripts/generate-kernel-patch. - scripts/generate-kernel-patch can now generate patches for the files in drivers/scsi/qla2xxx for any kernel version instead of only 2.6.26.8. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1198 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -3,89 +3,11 @@ qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \
|
||||
|
||||
obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx.o
|
||||
|
||||
# The qla2xxx-orig/% targets are not built correctly when parallel building
|
||||
# (make -j...) is enabled, so disable parallel builds.
|
||||
.NOTPARALLEL:
|
||||
|
||||
clean:
|
||||
rm -f *.o *.ko .*.cmd *.mod.c .*.d .depend *~ Modules.symvers \
|
||||
Module.symvers Module.markers modules.order
|
||||
rm -f in-tree-patches/*.patch
|
||||
rm -rf qla2xxx-orig
|
||||
rm -rf .tmp_versions
|
||||
|
||||
extraclean: clean
|
||||
|
||||
DOWNLOAD_DIR=$(HOME)/software/downloads
|
||||
|
||||
QLA2XXX_ORIG = \
|
||||
Kconfig \
|
||||
Makefile \
|
||||
qla_attr.c \
|
||||
qla_dbg.c \
|
||||
qla_dbg.h \
|
||||
qla_def.h \
|
||||
qla_devtbl.h \
|
||||
qla_dfs.c \
|
||||
qla_fw.h \
|
||||
qla_gbl.h \
|
||||
qla_gs.c \
|
||||
qla_init.c \
|
||||
qla_inline.h \
|
||||
qla_iocb.c \
|
||||
qla_isr.c \
|
||||
qla_mbx.c \
|
||||
qla_mid.c \
|
||||
qla_os.c \
|
||||
qla_settings.h \
|
||||
qla_sup.c \
|
||||
qla_version.h
|
||||
|
||||
GENERATED_PATCHES = \
|
||||
in-tree-patches/qla2xxx-Kconfig-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_def.h-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_gs.c-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_mbx.c-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_version.h-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-Makefile-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_devtbl.h-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_init.c-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_mid.c-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_attr.c-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_dfs.c-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_inline.h-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_os.c-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_dbg.c-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_fw.h-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_iocb.c-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_settings.h-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_dbg.h-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_gbl.h-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_isr.c-2.6.26.patch \
|
||||
in-tree-patches/qla2xxx-qla_sup.c-2.6.26.patch
|
||||
|
||||
$(DOWNLOAD_DIR)/linux-%:
|
||||
cd $(DOWNLOAD_DIR) \
|
||||
&& wget -q -nc ftp://ftp.eu.kernel.org/pub/linux/kernel/v2.6/$(@F)
|
||||
|
||||
$(DOWNLOAD_DIR)/patch-%:
|
||||
cd $(DOWNLOAD_DIR) \
|
||||
&& wget -q -nc ftp://ftp.eu.kernel.org/pub/linux/kernel/v2.6/$(@F)
|
||||
|
||||
qla2xxx-orig/%: $(DOWNLOAD_DIR)/linux-2.6.26.tar.bz2 \
|
||||
$(DOWNLOAD_DIR)/patch-2.6.26.8.bz2
|
||||
rm -rf linux-2.6.26
|
||||
tar -xjf $(DOWNLOAD_DIR)/linux-2.6.26.tar.bz2
|
||||
cd linux-2.6.26 \
|
||||
&& bzip2 -cd < $(DOWNLOAD_DIR)/patch-2.6.26.8.bz2 | patch -p1 -f -s
|
||||
touch linux-2.6.26/drivers/scsi/qla2xxx/*
|
||||
mkdir -p qla2xxx-orig
|
||||
mv linux-2.6.26/drivers/scsi/qla2xxx/* qla2xxx-orig
|
||||
rm -rf linux-2.6.26
|
||||
|
||||
in-tree-patches/qla2xxx-%-2.6.26.patch: % qla2xxx-orig/%
|
||||
f="$$(echo "$@" | sed -e 's:^in-tree-patches/qla2xxx-::' -e 's:-2.6.26.patch$$::')"; diff -up "qla2xxx-orig/$$f" "$$f" >"$@"; true
|
||||
|
||||
patches: $(GENERATED_PATCHES)
|
||||
|
||||
.PHONY: clean extraclean patches
|
||||
.PHONY: clean extraclean
|
||||
|
||||
97
qla2x00t/extract-qla2xxx-orig
Executable file
97
qla2x00t/extract-qla2xxx-orig
Executable file
@@ -0,0 +1,97 @@
|
||||
#!/bin/bash
|
||||
|
||||
########################
|
||||
# Function definitions #
|
||||
########################
|
||||
|
||||
# First three components of the kernel version number.
|
||||
function kernel_version {
|
||||
echo "$1" | sed -n 's/^\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/p'
|
||||
}
|
||||
|
||||
# Last component of the kernel version, or the empty string if $1 has only
|
||||
# three components.
|
||||
function patchlevel {
|
||||
echo "$1" | sed -n 's/^\([0-9]*\.[0-9]*\.[0-9]*\)[.-]\(.*\)$/\2/p'
|
||||
}
|
||||
|
||||
# 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 $?
|
||||
tar xjf "${kernel_sources}/linux-${kver}.tar.bz2" || return $?
|
||||
cd "linux-${kver}" || return $?
|
||||
if [ "${plevel}" != "" ]; then
|
||||
bzip2 -cd "${kernel_sources}/patch-$1.bz2" \
|
||||
| patch -p1 -f -s || return $?
|
||||
fi
|
||||
cd ..
|
||||
mv "linux-${kver}" "../linux-$1" || return $?
|
||||
)
|
||||
rmdir "${tmpdir}"
|
||||
}
|
||||
|
||||
# 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
|
||||
echo "Downloading $1 ..."
|
||||
fi
|
||||
if ! wget -q -nc "$1"; then
|
||||
echo "Downloading $1 failed."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# 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)"
|
||||
|
||||
mkdir -p "${kernel_sources}" || return $?
|
||||
test -w "${kernel_sources}" || return $?
|
||||
(
|
||||
cd "${kernel_sources}" || return $?
|
||||
download_file "${kernel_mirror}/linux-$(kernel_version $1).tar.bz2" \
|
||||
|| return $?
|
||||
if [ "${plevel}" != "" ]; then
|
||||
download_file "${kernel_mirror}/patch-$1.bz2" || return $?
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
#########################
|
||||
# Argument verification #
|
||||
#########################
|
||||
|
||||
# Where to store persistenly downloaded kernel tarballs and kernel patches.
|
||||
kernel_sources="$HOME/software/downloads"
|
||||
# URL for downloading kernel tarballs and kernel patches.
|
||||
kernel_mirror="ftp://ftp.eu.kernel.org/pub/linux/kernel/v2.6"
|
||||
|
||||
kernel_version="$1"
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
echo "Error: missing kernel version argument."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p qla2xxx-orig
|
||||
cd qla2xxx-orig || exit $?
|
||||
extract_kernel_tree "${kernel_version}"
|
||||
touch linux-*/drivers/scsi/qla2xxx/*
|
||||
rm -rf "${kernel_version}"
|
||||
mkdir -p "${kernel_version}"
|
||||
mv linux-*/drivers/scsi/qla2xxx/* "${kernel_version}"
|
||||
rm -rf linux-*
|
||||
cd ..
|
||||
21
qla2x00t/generate-in-tree-patches
Executable file
21
qla2x00t/generate-in-tree-patches
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
kernel_version="$1"
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
echo "Error: missing kernel version argument."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p in-tree-patches/"${kernel_version}"
|
||||
|
||||
for f in qla2xxx-orig/"${kernel_version}"/*
|
||||
do
|
||||
g="${f#qla2xxx-orig/${kernel_version}/}"
|
||||
f1="$f"
|
||||
f2="$g"
|
||||
f3="in-tree-patches/${kernel_version}/$g.patch"
|
||||
if [ "$f1" -nt "$f3" -o "$f2" -nt "$f3" ]; then
|
||||
diff -up "$f1" "$f2" > "$f3"
|
||||
fi
|
||||
done
|
||||
@@ -191,6 +191,7 @@ fi
|
||||
# Strip patch level from the kernel version number.
|
||||
if [ "${1#[0-9]*.[0-9]*.[0-9]*.[0-9]*}" != "$1" ]; then
|
||||
kernel_version="${1%.[0-9]*}"
|
||||
patch_level="${1%${kernel_version}}"
|
||||
else
|
||||
kernel_version="$1"
|
||||
fi
|
||||
@@ -339,27 +340,30 @@ add_file "iscsi-scst/README_in-tree" "Documentation/scst/README.iscsi" \
|
||||
|
||||
if [ "${qla2x00t}" = "true" ]; then
|
||||
|
||||
make -C qla2x00t -s patches
|
||||
if [ ! -e qla2x00t/qla2xxx-orig/$1 ]; then
|
||||
( cd qla2x00t && ./extract-qla2xxx-orig 2.6.26.8 )
|
||||
fi
|
||||
( cd qla2x00t && ./generate-in-tree-patches "$1" )
|
||||
|
||||
for f in $(ls qla2x00t/in-tree-patches/qla2xxx-*-${kernel_version}.patch 2>/dev/null)
|
||||
for f in $(ls qla2x00t/in-tree-patches/"$1"/*.patch 2>/dev/null)
|
||||
do
|
||||
g="${f#qla2x00t/in-tree-patches/qla2xxx-}"
|
||||
g="${g%-${kernel_version}.patch}"
|
||||
g="${f#qla2x00t/in-tree-patches/$1/}"
|
||||
g="${g%.patch}"
|
||||
add_patch "${f}" "drivers/scsi/qla2xxx/${g}"
|
||||
done
|
||||
|
||||
add_file "qla2x00t/qla2x00-target/Makefile_in-tree" \
|
||||
"drivers/scst/qla2xxx-target/Makefile"
|
||||
|
||||
add_file "qla2x00t/qla2x00-target/Kconfig" \
|
||||
"drivers/scst/qla2xxx-target/Kconfig"
|
||||
|
||||
add_file "qla2x00t/qla2x_tgt.h" \
|
||||
"drivers/scsi/qla2xxx/qla2x_tgt.h"
|
||||
|
||||
add_file "qla2x00t/qla2x_tgt_def.h" \
|
||||
"drivers/scsi/qla2xxx/qla2x_tgt_def.h"
|
||||
|
||||
add_file "qla2x00t/qla2x00-target/Makefile_in-tree" \
|
||||
"drivers/scst/qla2xxx-target/Makefile"
|
||||
|
||||
add_file "qla2x00t/qla2x00-target/Kconfig" \
|
||||
"drivers/scst/qla2xxx-target/Kconfig"
|
||||
|
||||
for f in $(ls qla2x00t/qla2x00-target/*.[ch] 2>/dev/null)
|
||||
do
|
||||
add_file "${f}" "drivers/scst/qla2xxx-target/${f#qla2x00t/qla2x00-target/}"
|
||||
|
||||
@@ -292,7 +292,7 @@ function generate_kernel_patch {
|
||||
$([ "${scst_local}" = "true" ] && echo -- "-l") \
|
||||
$([ "${mpt_scst}" = "true" ] && echo -- "-m") \
|
||||
$([ "${qla2x00t}" = "true" ] && echo -- "-q") \
|
||||
${kver} > "${patchfile}"
|
||||
${1} > "${patchfile}"
|
||||
|
||||
SIGNED_OFF_BY="..." \
|
||||
scripts/generate-kernel-patch \
|
||||
@@ -300,7 +300,7 @@ function generate_kernel_patch {
|
||||
$([ "${scst_local}" = "true" ] && echo -- "-l") \
|
||||
$([ "${mpt_scst}" = "true" ] && echo -- "-m") \
|
||||
$([ "${qla2x00t}" = "true" ] && echo -- "-q") \
|
||||
${kver} > "${patchfile_m}"
|
||||
${1} > "${patchfile_m}"
|
||||
}
|
||||
|
||||
# Generate a kernel patch through scripts/generate-kernel-patch and test
|
||||
|
||||
Reference in New Issue
Block a user