diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch index aad5c07c2..30d10a4da 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/generate-kernel-patch @@ -214,6 +214,13 @@ else kernel_version="$1" fi +for f in fcst/linux-patches/series-${kernel_version}* +do + if [ -e "$f" ]; then + fcst_patch_series="$f" + fi +done + # Hack: make sure that for kernel 2.6.33 and later the line # "#define CONFIG_SCST_PROC" is removed from scst/include/scst.h. # This is done because of the following change in r1609: @@ -292,9 +299,28 @@ add_patch "scst/kernel/in-tree/Makefile.drivers.Linux-${kernel_version}.patch"\ # Directory drivers/scst/ ( -add_file "scst/kernel/in-tree/Kconfig.scst" "drivers/scst/Kconfig" +tmpdir="/tmp/scst-$$" +mkdir -p "${tmpdir}" -add_file "scst/kernel/in-tree/Makefile.scst-${kernel_version}" "drivers/scst/Makefile" +tmp_Kconfig="${tmpdir}/Kconfig.scst-${kernel_version}" +cat "scst/kernel/in-tree/Kconfig.scst" | \ +if [ -e "${fcst_patch_series}" ]; then + cat +else + grep -v '^source "drivers/scst/fcst/Kconfig"$' +fi >"${tmp_Kconfig}" +add_file "${tmp_Kconfig}" "drivers/scst/Kconfig" + +tmp_Makefile="${tmpdir}/Makefile.scst-${kernel_version}" +cat "scst/kernel/in-tree/Makefile.scst-${kernel_version}" | \ +if [ -e "${fcst_patch_series}" ]; then + cat +else + sed -e 's: fcst/* : :' +fi >"$tmp_Makefile" +add_file "$tmp_Makefile" "drivers/scst/Makefile" + +rm -rf "${tmpdir}" for f in $(ls scst/src/*.[ch] 2>/dev/null) do @@ -355,7 +381,7 @@ done # Directory drivers/scst/fcst/ { - for f in $(grep -v '^#' fcst/linux-patches/series-${kernel_version}*) + for f in $(grep -v '^#' "${fcst_patch_series}") do cat "fcst/linux-patches/${f}" done