Add check to confirm IHK and McKernel with the same version are used
This commit is contained in:
@ -19,6 +19,7 @@ ETCDIR=@ETCDIR@
|
|||||||
KMODDIR="${prefix}/kmod"
|
KMODDIR="${prefix}/kmod"
|
||||||
KERNDIR="${prefix}/@TARGET@/kernel"
|
KERNDIR="${prefix}/@TARGET@/kernel"
|
||||||
ENABLE_MCOVERLAYFS="@ENABLE_MCOVERLAYFS@"
|
ENABLE_MCOVERLAYFS="@ENABLE_MCOVERLAYFS@"
|
||||||
|
MCK_BUILDID=@BUILDID@
|
||||||
|
|
||||||
mem="512M@0"
|
mem="512M@0"
|
||||||
cpus=""
|
cpus=""
|
||||||
@ -361,6 +362,13 @@ if ! grep mcctrl /proc/modules &>/dev/null; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check that different versions of binaries/scripts are not mixed
|
||||||
|
IHK_BUILDID=`${SBINDIR}/ihkconfig 0 get buildid`
|
||||||
|
if [ "${IHK_BUILDID}" != "${MCK_BUILDID}" ]; then
|
||||||
|
echo "IHK build-id (${IHK_BUILDID}) didn't match McKernel build-id (${MCK_BUILDID})." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Destroy all LWK instances
|
# Destroy all LWK instances
|
||||||
if ls /dev/mcos* 1>/dev/null 2>&1; then
|
if ls /dev/mcos* 1>/dev/null 2>&1; then
|
||||||
for i in /dev/mcos*; do
|
for i in /dev/mcos*; do
|
||||||
|
|||||||
10
config.h.in
10
config.h.in
@ -3,21 +3,25 @@
|
|||||||
/* Path of install directory for binary */
|
/* Path of install directory for binary */
|
||||||
#undef BINDIR
|
#undef BINDIR
|
||||||
|
|
||||||
|
/* Id of IHK.ko maching of which is checked at run-time by reboot script and
|
||||||
|
mcexec */
|
||||||
|
#undef BUILDID
|
||||||
|
|
||||||
/* whether mcoverlayfs is enabled */
|
/* whether mcoverlayfs is enabled */
|
||||||
#undef ENABLE_MCOVERLAYFS
|
#undef ENABLE_MCOVERLAYFS
|
||||||
|
|
||||||
/* whether memdump feature is enabled */
|
/* whether memdump feature is enabled */
|
||||||
#undef ENABLE_MEMDUMP
|
#undef ENABLE_MEMDUMP
|
||||||
|
|
||||||
|
/* whether perf is enabled */
|
||||||
|
#undef ENABLE_PERF
|
||||||
|
|
||||||
/* whether qlmpi is enabled */
|
/* whether qlmpi is enabled */
|
||||||
#undef ENABLE_QLMPI
|
#undef ENABLE_QLMPI
|
||||||
|
|
||||||
/* whether rusage is enabled */
|
/* whether rusage is enabled */
|
||||||
#undef ENABLE_RUSAGE
|
#undef ENABLE_RUSAGE
|
||||||
|
|
||||||
/* whether perf is enabled */
|
|
||||||
#undef ENABLE_PERF
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#undef HAVE_INTTYPES_H
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
|||||||
17
configure
vendored
17
configure
vendored
@ -645,6 +645,7 @@ TARGET
|
|||||||
UNAME_R
|
UNAME_R
|
||||||
KDIR
|
KDIR
|
||||||
ARCH
|
ARCH
|
||||||
|
BUILDID
|
||||||
XCC
|
XCC
|
||||||
FGREP
|
FGREP
|
||||||
EGREP
|
EGREP
|
||||||
@ -5012,6 +5013,22 @@ cat >>confdefs.h <<_ACEOF
|
|||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
ABS_SRCDIR=$( cd $( dirname $0 ); pwd )
|
||||||
|
IHK_ABS_SRCDIR=${ABS_SRCDIR}/../ihk
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: IHK_ABS_SRCDIR=$IHK_ABS_SRCDIR" >&5
|
||||||
|
$as_echo "$as_me: IHK_ABS_SRCDIR=$IHK_ABS_SRCDIR" >&6;}
|
||||||
|
BUILDID=$( cd $IHK_ABS_SRCDIR; git rev-list -1 HEAD | cut -c1-8 )
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: BUILDID=$BUILDID" >&5
|
||||||
|
$as_echo "$as_me: BUILDID=$BUILDID" >&6;}
|
||||||
|
if test "x$BUILDID" != "x" ; then
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define BUILDID "$BUILDID"
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -502,6 +502,15 @@ fi
|
|||||||
AC_DEFINE_UNQUOTED(BINDIR,"$BINDIR",[Path of install directory for binary])
|
AC_DEFINE_UNQUOTED(BINDIR,"$BINDIR",[Path of install directory for binary])
|
||||||
AC_DEFINE_UNQUOTED(SBINDIR,"$SBINDIR",[Path of install directory for system binary])
|
AC_DEFINE_UNQUOTED(SBINDIR,"$SBINDIR",[Path of install directory for system binary])
|
||||||
|
|
||||||
|
ABS_SRCDIR=$( cd $( dirname $0 ); pwd )
|
||||||
|
IHK_ABS_SRCDIR=${ABS_SRCDIR}/../ihk
|
||||||
|
BUILDID=$( cd $IHK_ABS_SRCDIR; git rev-list -1 HEAD | cut -c1-8 )
|
||||||
|
AC_MSG_NOTICE([BUILDID=$BUILDID])
|
||||||
|
if test "x$BUILDID" != "x" ; then
|
||||||
|
AC_DEFINE_UNQUOTED(BUILDID,"$BUILDID",[IHK build-id to confirm IHK and McKernel built at the same time are used])
|
||||||
|
fi
|
||||||
|
AC_SUBST(BUILDID)
|
||||||
|
|
||||||
AC_SUBST(CC)
|
AC_SUBST(CC)
|
||||||
AC_SUBST(XCC)
|
AC_SUBST(XCC)
|
||||||
AC_SUBST(ARCH)
|
AC_SUBST(ARCH)
|
||||||
|
|||||||
@ -11,7 +11,7 @@ MCKERNEL_INCDIR=@MCKERNEL_INCDIR@
|
|||||||
MCKERNEL_LIBDIR=@MCKERNEL_LIBDIR@
|
MCKERNEL_LIBDIR=@MCKERNEL_LIBDIR@
|
||||||
KDIR ?= @KDIR@
|
KDIR ?= @KDIR@
|
||||||
ARCH=@ARCH@
|
ARCH=@ARCH@
|
||||||
CFLAGS=-Wall -O -I. -I$(VPATH)/arch/${ARCH}
|
CFLAGS=-Wall -O -I. -I$(VPATH)/arch/${ARCH} -I${IHKDIR}
|
||||||
LDFLAGS=@LDFLAGS@
|
LDFLAGS=@LDFLAGS@
|
||||||
RPATH=$(shell echo $(LDFLAGS)|awk '{for(i=1;i<=NF;i++){if($$i~/^-L/){w=$$i;sub(/^-L/,"-Wl,-rpath,",w);print w}}}')
|
RPATH=$(shell echo $(LDFLAGS)|awk '{for(i=1;i<=NF;i++){if($$i~/^-L/){w=$$i;sub(/^-L/,"-Wl,-rpath,",w);print w}}}')
|
||||||
VPATH=@abs_srcdir@
|
VPATH=@abs_srcdir@
|
||||||
@ -40,7 +40,7 @@ mcexec: mcexec.c libmcexec.a
|
|||||||
# POSTK_DEBUG_ARCH_DEP_34, eclair arch depend separate.
|
# POSTK_DEBUG_ARCH_DEP_34, eclair arch depend separate.
|
||||||
ifeq ($(ARCH), arm64)
|
ifeq ($(ARCH), arm64)
|
||||||
eclair: eclair.c arch/$(ARCH)/arch-eclair.c
|
eclair: eclair.c arch/$(ARCH)/arch-eclair.c
|
||||||
$(CC) -I.. -I. -I./arch/$(ARCH)/include -I$(VPATH)/.. -I$(VPATH) -I$(VPATH)/arch/$(ARCH)/include -I${IHKDIR} $(CFLAGS) -o $@ $^ $(LIBS)
|
$(CC) -I.. -I. -I./arch/$(ARCH)/include -I$(VPATH)/.. -I$(VPATH) -I$(VPATH)/arch/$(ARCH)/include $(CFLAGS) -o $@ $^ $(LIBS)
|
||||||
else
|
else
|
||||||
eclair: eclair.c
|
eclair: eclair.c
|
||||||
$(CC) $(CFLAGS) -I${IHKDIR} -o $@ $^ $(LIBS)
|
$(CC) $(CFLAGS) -I${IHKDIR} -o $@ $^ $(LIBS)
|
||||||
|
|||||||
@ -76,6 +76,7 @@
|
|||||||
#include <asm/prctl.h>
|
#include <asm/prctl.h>
|
||||||
#endif /* !POSTK_DEBUG_ARCH_DEP_77 */
|
#endif /* !POSTK_DEBUG_ARCH_DEP_77 */
|
||||||
#include "../include/uprotocol.h"
|
#include "../include/uprotocol.h"
|
||||||
|
#include <ihk/ihk_host_user.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include "archdep.h"
|
#include "archdep.h"
|
||||||
#include "arch_args.h"
|
#include "arch_args.h"
|
||||||
@ -1754,6 +1755,8 @@ static int
|
|||||||
opendev()
|
opendev()
|
||||||
{
|
{
|
||||||
int f;
|
int f;
|
||||||
|
char buildid[] = BUILDID;
|
||||||
|
char query_result[sizeof(BUILDID)];
|
||||||
|
|
||||||
sprintf(dev, "/dev/mcos%d", mcosid);
|
sprintf(dev, "/dev/mcos%d", mcosid);
|
||||||
|
|
||||||
@ -1765,6 +1768,18 @@ opendev()
|
|||||||
}
|
}
|
||||||
fd = f;
|
fd = f;
|
||||||
|
|
||||||
|
if (ioctl(fd, IHK_OS_GET_BUILDID, query_result)) {
|
||||||
|
fprintf(stderr, "Error: IHK_OS_GET_BUILDID failed");
|
||||||
|
close(fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strncmp(buildid, query_result, sizeof(buildid))) {
|
||||||
|
fprintf(stderr, "Error: build-id of mcexec (%s) didn't match that of IHK (%s)\n", buildid, query_result);
|
||||||
|
close(fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user