move mcoverlayfs kernel version check from mcexec.c to configure

While we are here:
 - fix uname -r (single quote?!)
 - add compat for rhel8 (el kernel and version is 4.18)
 - also remove linux version check in mcreboot.sh, trust configure check

Change-Id: I14726d4374b0dfd941640096044ea1d5d88bfcb8
This commit is contained in:
Dominique Martinet
2018-11-19 17:23:53 +09:00
committed by Balazs Gerofi
parent 98aa633856
commit c585a37440
5 changed files with 89 additions and 95 deletions

43
configure vendored
View File

@ -631,6 +631,7 @@ IHK_VERSION
WITH_SYSCALL_INTERCEPT
ENABLE_QLMPI
ENABLE_RUSAGE
MCOVERLAYFS_MODULE
ENABLE_MCOVERLAYFS
LDFLAGS_SYSCALL_INTERCEPT
CPPFLAGS_SYSCALL_INTERCEPT
@ -3804,7 +3805,7 @@ fi
case "X$WITH_UNAME_R" in
Xyes | Xno | X)
WITH_UNAME_R='`uname -r`'
WITH_UNAME_R="`uname -r`"
;;
esac
@ -4750,9 +4751,44 @@ $as_echo "#define ENABLE_MCOVERLAYFS 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: mcoverlayfs is enabled" >&5
$as_echo "$as_me: mcoverlayfs is enabled" >&6;}
IFS=. read LINUX_VERSION_MAJOR LINUX_VERSION_MINOR LINUX_VERSION_PATCH _ <<EOF
${UNAME_R%%-*}
EOF
LINUX_VERSION_CODE=$(( LINUX_VERSION_MAJOR * 65536 + LINUX_VERSION_MINOR * 256 + LINUX_VERSION_PATCH ))
# rhel
if test x"${UNAME_R}" != x"${UNAME_R//.el[0-9]}" ; then
RHEL_RELEASE="${UNAME_R#*-}"
RHEL_RELEASE="${RHEL_RELEASE%%.*}"
case "$LINUX_VERSION_CODE" in
199168) # 3.10.0
MCOVERLAYFS_MODULE=linux-3.10.0-327.36.1.el7;;
262144) # 4.0.0
MCOVERLAYFS_MODULE=linux-4.0.9;;
266752) # 4.18.0
MCOVERLAYFS_MODULE=linux-4.18.14;;
*)
as_fn_error $? "Your RHEL/centos version has no known mcoverlayfs module" "$LINENO" 5;;
esac
else
case "1" in
# 4.0.0-4.1.0
$((LINUX_VERSION_CODE >= 262144 && LINUX_VERSION_CODE < 262400)))
MCOVERLAYFS_MODULE=linux-4.0.9;;
# 4.6.0-4.7.0
$((LINUX_VERSION_CODE >= 263680 && LINUX_VERSION_CODE < 263936)))
MCOVERLAYFS_MODULE=linux-4.6.7;;
# 4.18.0-4.20.0
$((LINUX_VERSION_CODE >= 266752 && LINUX_VERSION_CODE < 267264)))
MCOVERLAYFS_MODULE=linux-4.18.14;;
*)
as_fn_error $? "Your kernel version has no known mcoverlayfs module" "$LINENO" 5;;
esac
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: mcoverlayfs is disabled" >&5
$as_echo "$as_me: mcoverlayfs is disabled" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: mcoverlayfs is disabled. You will not be able to run anything." >&5
$as_echo "$as_me: WARNING: mcoverlayfs is disabled. You will not be able to run anything." >&2;}
fi
if test "x$ENABLE_QLMPI" = "xyes" ; then
@ -4892,6 +4928,7 @@ fi
ac_config_headers="$ac_config_headers config.h"