scripts: Rework the approach for building older kernels with a recent gcc

Instead of setting KCFLAGS, modify include/linux/compiler-gcc.h.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9003 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2020-06-06 17:09:44 +00:00
parent c51cf132e1
commit 3b4ba67d8b
2 changed files with 25 additions and 9 deletions

View File

@@ -127,6 +127,31 @@ function extract_kernel_tree {
# Patch a kernel tree where $1 is the kernel version.
function patch_kernel {
case "$k" in
*^*)
# RHEL / CentOS.
;;
2.*|3.*)
# Tell the kernel that we are using gcc 4.6 since older kernel
# versions do not support recent gcc versions.
KCFLAGS="-U__GNUC__ -U__GNUC_MINOR__ -D__GNUC__=4 -D__GNUC_MINOR__=6"
patch -p1 <<'EOF'
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 02ae99e8e6d3..47e12c19c965 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -103,7 +103,7 @@
#define __gcc_header(x) #x
#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
#define gcc_header(x) _gcc_header(x)
-#include gcc_header(__GNUC__)
+#include "linux/compiler-gcc4.h"
#if !defined(__noclone)
#define __noclone /* not needed */
EOF
esac
if [ "$1" = "2.6.29" ] || [ "$1" = "2.6.29.1" ] || [ "$1" = "2.6.29.2" ] ||
[ "$1" = "2.6.29.3" ]; then
patch -f -s -p1 <<'EOF'

View File

@@ -695,15 +695,6 @@ do
run_checkpatch "$k"
fi
patch_and_configure_kernel "$k" || continue
case "$k" in
*^*)
# CentOS.
;;
2.*|3.*)
# Tell the kernel that we are using gcc 4.6 since older kernel
# versions do not suppor recent gcc versions.
KCFLAGS="-U__GNUC__ -U__GNUC_MINOR__ -D__GNUC__=4 -D__GNUC_MINOR__=6"
esac
case "$k" in
3.10.0-*)
# Make the CentOS 7.x build less noisy.