Skip to content
Snippets Groups Projects
Commit 62701b21 authored by Rolf Bork's avatar Rolf Bork
Browse files

Merge branch 'fix-find-modsym' into 'master'

rcg: fix module symvers discovery

Closes #33

See merge request cds/advligorts!45
parents 7b010ba0 bb564993
No related branches found
No related tags found
1 merge request!45rcg: fix module symvers discovery
#! /bin/sh
# Use this script to initiate RCG builds
# Auther: Keith Thorne
aclocal
autoconf
configure 0 → 100755
This diff is collapsed.
#dnl Process this file with autoconf to produce a configure script.
AC_INIT(NEWS)
# find mbuf symvers file
foundmbuf=
mbufsym=
mbufdkms=
AC_MSG_CHECKING([for mbuf Module.symvers])
if test -x /sbin/dkms
then
mbufstat=`/sbin/dkms status -m mbuf`
if test x"${mbufstat}" = "x"
then
mbufdkms="no"
else
mbufdkms="yes"
mmodvers=`echo ${mbufstat} | awk '{print $2}' | sed 's/.$//'`
mkvers=`echo ${mbufstat} | awk '{print $3}' | sed 's/.$//'`
march=`echo ${mbufstat} | awk '{print $4}' | sed 's/.$//'`
mtestpath="/var/lib/dkms/mbuf/${mmodvers}/${mkvers}/${march}/Module.symvers"
if test -f $mtestpath
then
mbufsym=$mtestpath
foundmbuf="yes"
fi
fi
else
mbufdkms="no"
fi
if test x$foundmbuf = "x"
then
mtestpath="/var/cache/mbuf/Module.symvers"
if test -f $mtestpath
then
mbufsym=$mtestpath
foundmbuf="yes"
else
foundmbuf="no"
fi
fi
if test x$foundmbuf = "xyes"
then
AC_MSG_RESULT([${mbufsym}])
else
AC_MSG_RESULT([no])
fi
# look for gpstime symvers
foundgpstime=
gpstimesym=
gpstimedkms=
AC_MSG_CHECKING([for gpstime Module.symvers])
if test -x /sbin/dkms
then
gbufstat=`/sbin/dkms status -m gpstime `
if test x"${gbufstat}" = "x"
then
gpstimedkms="no"
else
gpstimedkms="yes"
gmodvers=`echo ${gbufstat} | awk '{print $2}' | sed 's/.$//'`
gkvers=`echo ${gbufstat} | awk '{print $3}' | sed 's/.$//'`
garch=`echo ${gbufstat} | awk '{print $4}' | sed 's/.$//'`
gtestpath="/var/lib/dkms/gpstime/$gmodvers/$gkvers/$garch/Module.symvers"
if test -f $gtestpath
then
gpstimesym=$gtestpath
foundgpstime="yes"
fi
fi
else
gpstimedkms="no"
fi
if test x$foundgpstime = "x"
then
gtestpath="/var/cache/gpstime/Module.symvers"
if test -f $gtestpath
then
gpstimesym=$gtestpath
foundgpstime="yes"
else
foundgpstime="no"
fi
fi
if test x$foundgpstime = "xyes"
then
AC_MSG_RESULT([${gpstimesym}])
else
AC_MSG_RESULT([no])
fi
# set paths if they are found
MBUFSYMBOLPATH=
if test "$foundmbuf" = "yes"; then
MBUFSYMBOLPATH="$mbufsym"
fi
GPSSYMBOLPATH=
if test "$foundgpstime" = "yes"; then
GPSSYMBOLPATH="$gpstimesym"
fi
AC_SUBST([MBUFSYMBOLPATH])
AC_SUBST([GPSSYMBOLPATH])
AC_OUTPUT( Makefile )
AC_OUTPUT( src/epics/util/Makefile )
AC_OUTPUT( doc/doxygen.cfg )
AC_OUTPUT( doc/doxScript )
dnl Process this file with autoconf to produce a configure script.
AC_INIT(NEWS)
dnl Check for configuration options
dnl ==========================
AC_OUTPUT( Makefile )
AC_OUTPUT( src/epics/util/Makefile )
AC_OUTPUT( doc/doxygen.cfg )
AC_OUTPUT( doc/doxScript )
......@@ -23,10 +23,10 @@ PERFORMANCEFLAGS=-DNDEBUG -g -O5
RELEASEFLAGS=-DNDEBUG -DNPROBE -g -O5
#DEBUGFLAGS=-DNDEBUG -O5 -unroll=16
DEVFLAGS=@DEVFLAGS@
mbuf_sym_file=@MBUFSYMBOLPATH@
gps_sym_file=@GPSSYMBOLPATH@
MBUFSYM := $(shell $(srcdir)/find_module_symvers mbuf)
GPSSYM := $(shell $(srcdir)/find_module_symvers gpstime)
%:
env RCG_SRC_DIR=$(top_srcdir) PERL5LIB=$(srcdir) MBUFSYM=$(mbuf_sym_file) GPSSYM=$(gps_sym_file) $(srcdir)/feCodeGen.pl $@.mdl $@
env RCG_SRC_DIR=$(top_srcdir) PERL5LIB=$(srcdir) MBUFSYM=$(MBUFSYM) GPSSYM=$(GPSSYM) $(srcdir)/feCodeGen.pl $@.mdl $@
all:
#!/usr/bin/env python3
import os
import sys
import subprocess
try:
modname = sys.argv[1]
except IndexError:
exit("usage: {} <modname>".format(sys.argv[0]))
uname = os.uname()
modstat = subprocess.run(
['dkms', '-k', uname.release, 'status', modname],
capture_output=True, text=True,
)
if modstat.returncode == 0 and modstat.stdout:
modstat = modstat.stdout.split(':')[0].split(', ')
if len(modstat) >= 4:
modvers = modstat[1]
mkvers = modstat[2]
march = modstat[3]
modsym = os.path.join(
'/var/lib/dkms',
modname,
modvers,
mkvers,
march,
'Module.symvers',
)
if os.path.exists(modsym):
print(modsym)
exit()
modsym = os.path.join('/var/cache', modname, 'Module.symvers')
if os.path.exists(modsym):
print(modsym)
exit()
exit("Module '{}' symvers file could not be found.".format(modname))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment