Skip to content
Snippets Groups Projects
Commit eeeb7d7b authored by Ezekiel Dohmen's avatar Ezekiel Dohmen
Browse files

Making it so find_module_symvers can find multiple symvers when they are...

Making it so find_module_symvers can find multiple symvers when they are present, cleaning up cdsrfmswitch make a bit
parent c1462d71
No related branches found
No related tags found
2 merge requests!439RCG 5.0 release fro deb 10,!404Get cdsrfm building in bullseye/5.0
......@@ -6,6 +6,21 @@ import subprocess
import argparse
def print_symvers_in_dir_and_exit(modsymDir):
#Support dkms installations with multiple .symvers files
symversFiles = []
for (dirpath, dirnames, filenames) in os.walk(modsymDir):
for filename in filenames:
if filename.endswith(".symvers"):
symversFiles.append(dirpath + "/" + filename)
if len(symversFiles) > 0:
for fileName in symversFiles:
print(fileName)
exit()
parser = argparse.ArgumentParser(description='A utility to search for symvers files for dkms kernel modules')
parser.add_argument('modname', help='Name of the module to search for a symvers file for.')
parser.add_argument('-q', '--quiet', default=False, action='store_true', help='Request no output on errors')
......@@ -25,23 +40,22 @@ if modstat.returncode == 0 and modstat.stdout:
modvers = modstat[1]
mkvers = modstat[2]
march = modstat[3]
modsym = os.path.join(
modsymDir = os.path.join(
'/var/lib/dkms',
modname,
modvers,
mkvers,
march,
'Module.symvers',
march
)
if os.path.exists(modsym):
print(modsym)
exit()
print_symvers_in_dir_and_exit(modsymDir)
#If the above code did not exit the module was not found in a dkms installation
#search the manual install location
modsymDir = os.path.join('/var/cache', modname)
print_symvers_in_dir_and_exit(modsymDir)
modsym = os.path.join('/var/cache', modname, 'Module.symvers')
if os.path.exists(modsym):
print(modsym)
exit()
#We only get here if we did not find the symvers above
if quiet_err:
exit(1)
exit("Module '{}' symvers file could not be found.".format(modname))
*.cmd
*.mod
*.mod.c
*.symvers
*.d
#ifndef MBUF_SYM
#MBUF_SYM = $(shell ../../epics/util/find_module_symvers -q mbuf)
#endif
#ifndef GPSTIME_SYM
#GPSTIME_SYM = $(shell ../../epics/util/find_module_symvers -q gpstime)
#endif
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(dir $(mkfile_path))
ifndef GPSTIME_SYM
GPSTIME_SYM := $(shell $(mkfile_dir)/../../epics/util/find_module_symvers -q gpstime)
endif
ifndef RTS_CPU_ISOLATOR_SYM
#RTS_CPU_ISOLATOR_SYM = $(shell ../../epics/util/find_module_symvers -q rts-cpu-isolator)
RTS_CPU_ISOLATOR_SYM = /var/lib/dkms/rts-cpu-isolator/5.0.0~dev5+deb11/5.10.0-13-amd64/x86_64/Module.symvers
RTS_CPU_ISOLATOR_SYM := $(shell $(mkfile_dir)/../../epics/util/find_module_symvers -q rts-cpu-isolator)
endif
ifndef DOLPHIN_SYM
DOLPHIN_SYM := $(shell $(mkfile_dir)/../../epics/util/find_module_symvers -q ligo-dolphin-ix)
endif
#KBUILD_EXTRA_SYMBOLS = $MBUF_SYM
#KBUILD_EXTRA_SYMBOLS += $GPSTIME_SYM
DOLPHIN_SYM := /opt/DIS/dolphin.symvers
KBUILD_EXTRA_SYMBOLS += $(RTS_CPU_ISOLATOR_SYM)
KBUILD_EXTRA_SYMBOLS += $(DOLPHIN_SYM)
KBUILD_EXTRA_SYMBOLS += $(GPSTIME_SYM)
EXTRA_CFLAGS += -O3
#Dolphin include directories and compilation flags
DISDIR = /opt/srcdis
#KBUILD_EXTRA_SYMBOLS += $(DISDIR)/src/SCI_SOCKET/ksocket/LINUX/Module.symvers
EXTRA_CFLAGS += -DOS_IS_LINUX=1 -D_DIS_KERNEL_=1 -I$(DISDIR)/src/IRM_GX/drv/src -I$(DISDIR)/src/IRM_GX/drv/src/LINUX -I$(DISDIR)/src/include -I$(DISDIR)/src/include/dis -I$(DISDIR)/src/COMMON/osif/kernel/include -I$(DISDIR)/src/COMMON/osif/kernel/include/LINUX -I$M/../../drv/ -DDOLPHIN_TEST=1 -DDIS_BROADCAST=0x80000000
# Set the path to the Kernel build utils.
KBUILD=/lib/modules/$(shell uname -r)/build/
obj-m += cdsrfmswitch.o
all:
cat /opt/DIS/lib/modules/$(shell uname -r)/*.symvers > /opt/DIS/dolphin.symvers
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
default:
$(MAKE) -C $(KBUILD) M=$(mkfile_dir) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
$(MAKE) -C $(KBUILD) M=$(PWD) clean
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