From b01faea3a288fbfb8b0b47782f0f261de6ead0da Mon Sep 17 00:00:00 2001 From: Jerzy Jamroz Date: Thu, 14 Dec 2023 16:38:21 +0100 Subject: [PATCH 01/10] refactor: Kernel driver control files updated. --- mrmShared/linux/VERSION | 4 +++- mrmShared/linux/dkms/50-mrf.rules.in | 2 +- mrmShared/linux/dkms/CONFIG | 2 +- mrmShared/linux/dkms/Makefile | 3 ++- mrmShared/linux/dkms/mrf.spec.in | 16 +++++++++++++--- mrmShared/linux/uio_mrf.c | 1 - 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/mrmShared/linux/VERSION b/mrmShared/linux/VERSION index 6fbffa44..80d6d5b1 100644 --- a/mrmShared/linux/VERSION +++ b/mrmShared/linux/VERSION @@ -1,3 +1,5 @@ # Version definition for driver -DRV_VERSION = 1 +# 20240124 Release +DRV_VERSION = 2 +DRV_RELEASE = 1 diff --git a/mrmShared/linux/dkms/50-mrf.rules.in b/mrmShared/linux/dkms/50-mrf.rules.in index 0ea1dd33..892e47a6 100644 --- a/mrmShared/linux/dkms/50-mrf.rules.in +++ b/mrmShared/linux/dkms/50-mrf.rules.in @@ -1,2 +1,2 @@ # UDEV rule to give general access to MRF device -SUBSYSTEM=="uio", ATTR{name}=="mrf-pci", GROUP="@@MRF_USER@@", MODE="0660" +SUBSYSTEM=="uio", ATTR{name}=="mrf-pci", GROUP="@@MRF_USER@@", MODE="0660", RUN+="/bin/chmod g+rw %S%p/resource0" diff --git a/mrmShared/linux/dkms/CONFIG b/mrmShared/linux/dkms/CONFIG index de1e28e3..150ea7c0 100644 --- a/mrmShared/linux/dkms/CONFIG +++ b/mrmShared/linux/dkms/CONFIG @@ -1,3 +1,3 @@ # Specify the group for the MRF driver user here -MRF_USER = dcs +MRF_USER = mrf diff --git a/mrmShared/linux/dkms/Makefile b/mrmShared/linux/dkms/Makefile index e842f89d..06eb1af9 100644 --- a/mrmShared/linux/dkms/Makefile +++ b/mrmShared/linux/dkms/Makefile @@ -15,7 +15,7 @@ include CONFIG RPM_VERSION = $(DRV_VERSION) -RPM_FILE = $(DRV_NAME)-$(RPM_VERSION)-1dkms.noarch.rpm +RPM_FILE = $(DRV_NAME)-dkms-$(RPM_VERSION)-1.noarch.rpm driver-rpm: $(RPM_FILE) .PHONY: driver-rpm @@ -31,6 +31,7 @@ SED_SUBSTS += s/@@DRV_VERSION@@/$(DRV_VERSION)/g; SED_SUBSTS += s/@@DRV_NAME@@/$(DRV_NAME)/g; SED_SUBSTS += s/@@RPM_VERSION@@/$(RPM_VERSION)/g; SED_SUBSTS += s/@@MRF_USER@@/$(MRF_USER)/g; +SED_SUBSTS += s/@@DRV_RELEASE@@/$(DRV_RELEASE)/g; %: %.in CONFIG $(SRCDIR)/VERSION sed '$(SED_SUBSTS)' $< >$@ diff --git a/mrmShared/linux/dkms/mrf.spec.in b/mrmShared/linux/dkms/mrf.spec.in index d93eddfd..68b5d046 100644 --- a/mrmShared/linux/dkms/mrf.spec.in +++ b/mrmShared/linux/dkms/mrf.spec.in @@ -1,10 +1,14 @@ -Summary: Kernel driver for MRF Event Receiver -Name: @@DRV_NAME@@ +Summary: DKMS kernel module - mrfioc2 driver + +Name: @@DRV_NAME@@-dkms Version: @@RPM_VERSION@@ -Release: 1dkms +Release: @@DRV_RELEASE@@ + +Vendor: EPICS Community License: GPL Group: System Environment/Kernel BuildRoot: %{_tmppath}/%{name}-%{version}-root +BuildRequires: autoconf libtool gcc gcc-c++ BuildArch: noarch Requires: dkms Requires: udev @@ -50,3 +54,9 @@ dkms remove --all -m %{name} -v %{version} --rpm_safe_upgrade %postun rmdir /usr/src/%{name}-%{version} + +%changelog +* Wed Jan 24 2024 Jerzy Jamroz - 2-1 +- Build adjustments. +- Group rw access for the pci resource0. +- AER handling functions. diff --git a/mrmShared/linux/uio_mrf.c b/mrmShared/linux/uio_mrf.c index 26995de0..9114552a 100644 --- a/mrmShared/linux/uio_mrf.c +++ b/mrmShared/linux/uio_mrf.c @@ -932,4 +932,3 @@ static void mrf_exit_module(void) pci_unregister_driver(&mrf_driver); } module_exit(mrf_exit_module); - From f21c64003c354f35a719422959641789f80597c6 Mon Sep 17 00:00:00 2001 From: Jerzy Jamroz Date: Thu, 25 Jan 2024 17:05:37 +0100 Subject: [PATCH 02/10] refactor: DRV_RELEASE variable contains dkms. --- mrmShared/linux/VERSION | 2 +- mrmShared/linux/dkms/Makefile | 2 +- mrmShared/linux/dkms/mrf.spec.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mrmShared/linux/VERSION b/mrmShared/linux/VERSION index 80d6d5b1..56f77fd0 100644 --- a/mrmShared/linux/VERSION +++ b/mrmShared/linux/VERSION @@ -2,4 +2,4 @@ # 20240124 Release DRV_VERSION = 2 -DRV_RELEASE = 1 +DRV_RELEASE = 1dkms diff --git a/mrmShared/linux/dkms/Makefile b/mrmShared/linux/dkms/Makefile index 06eb1af9..33c96450 100644 --- a/mrmShared/linux/dkms/Makefile +++ b/mrmShared/linux/dkms/Makefile @@ -15,7 +15,7 @@ include CONFIG RPM_VERSION = $(DRV_VERSION) -RPM_FILE = $(DRV_NAME)-dkms-$(RPM_VERSION)-1.noarch.rpm +RPM_FILE = $(DRV_NAME)-$(RPM_VERSION)-$(DRV_RELEASE).noarch.rpm driver-rpm: $(RPM_FILE) .PHONY: driver-rpm diff --git a/mrmShared/linux/dkms/mrf.spec.in b/mrmShared/linux/dkms/mrf.spec.in index 68b5d046..46722dd1 100644 --- a/mrmShared/linux/dkms/mrf.spec.in +++ b/mrmShared/linux/dkms/mrf.spec.in @@ -1,6 +1,6 @@ Summary: DKMS kernel module - mrfioc2 driver -Name: @@DRV_NAME@@-dkms +Name: @@DRV_NAME@@ Version: @@RPM_VERSION@@ Release: @@DRV_RELEASE@@ From 24ad0636943bba5712b15243061983936b8b0942 Mon Sep 17 00:00:00 2001 From: Jerzy Jamroz Date: Fri, 26 Jan 2024 11:58:27 +0100 Subject: [PATCH 03/10] refactor: Rpm package naming to module_name-dkms change. --- mrmShared/linux/VERSION | 2 +- mrmShared/linux/dkms/Makefile | 7 +++++-- mrmShared/linux/dkms/mrf.spec.in | 26 ++++++++++++++------------ 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/mrmShared/linux/VERSION b/mrmShared/linux/VERSION index 56f77fd0..80d6d5b1 100644 --- a/mrmShared/linux/VERSION +++ b/mrmShared/linux/VERSION @@ -2,4 +2,4 @@ # 20240124 Release DRV_VERSION = 2 -DRV_RELEASE = 1dkms +DRV_RELEASE = 1 diff --git a/mrmShared/linux/dkms/Makefile b/mrmShared/linux/dkms/Makefile index 33c96450..892aa01c 100644 --- a/mrmShared/linux/dkms/Makefile +++ b/mrmShared/linux/dkms/Makefile @@ -14,8 +14,10 @@ include CONFIG # for information on RPM versioning. We'll want to obey these rules if we can. RPM_VERSION = $(DRV_VERSION) +# Determine the architecture of the machine +ARCH := $(shell uname -m) -RPM_FILE = $(DRV_NAME)-$(RPM_VERSION)-$(DRV_RELEASE).noarch.rpm +RPM_FILE = $(DRV_NAME)-dkms-$(RPM_VERSION)-$(DRV_RELEASE).$(ARCH).rpm driver-rpm: $(RPM_FILE) .PHONY: driver-rpm @@ -32,6 +34,7 @@ SED_SUBSTS += s/@@DRV_NAME@@/$(DRV_NAME)/g; SED_SUBSTS += s/@@RPM_VERSION@@/$(RPM_VERSION)/g; SED_SUBSTS += s/@@MRF_USER@@/$(MRF_USER)/g; SED_SUBSTS += s/@@DRV_RELEASE@@/$(DRV_RELEASE)/g; +SED_SUBSTS += s/@@ARCH@@/$(ARCH)/g; %: %.in CONFIG $(SRCDIR)/VERSION sed '$(SED_SUBSTS)' $< >$@ @@ -47,4 +50,4 @@ $(RPM_FILE): $(SED_FILES) $(wildcard $(SRCDIR)/*) --define '_sourcedir $(SRCDIR)' \ --define '_tmppath %{_topdir}/BUILD' \ $(DRV_NAME).spec - ln -sf rpmbuild/RPMS/noarch/$(RPM_FILE) . + ln -sf rpmbuild/RPMS/$(ARCH)/$(RPM_FILE) . diff --git a/mrmShared/linux/dkms/mrf.spec.in b/mrmShared/linux/dkms/mrf.spec.in index 46722dd1..80c9db10 100644 --- a/mrmShared/linux/dkms/mrf.spec.in +++ b/mrmShared/linux/dkms/mrf.spec.in @@ -1,21 +1,23 @@ +%define module_name @@DRV_NAME@@ + Summary: DKMS kernel module - mrfioc2 driver -Name: @@DRV_NAME@@ +Name: %{module_name}-dkms Version: @@RPM_VERSION@@ Release: @@DRV_RELEASE@@ Vendor: EPICS Community -License: GPL +License: EPICS Open License Group: System Environment/Kernel -BuildRoot: %{_tmppath}/%{name}-%{version}-root +BuildRoot: %{_tmppath}/%{module_name}-%{version}-root BuildRequires: autoconf libtool gcc gcc-c++ -BuildArch: noarch +BuildArch: @@ARCH@@ Requires: dkms Requires: udev Packager: Michael Abbott # The two target directories -%define dkmsdir /usr/src/%{name}-%{version} +%define dkmsdir /usr/src/%{module_name}-%{version} %define udevdir /etc/udev/rules.d %description @@ -43,17 +45,17 @@ install -m 0644 %{_curdir}/50-mrf.rules %{buildroot}%{udevdir} %{udevdir}/50-mrf.rules %post -dkms add -m %{name} -v %{version} --rpm_safe_upgrade -dkms build -m %{name} -v %{version} -dkms install -m %{name} -v %{version} -modprobe %{name} +dkms add -m %{module_name} -v %{version} --rpm_safe_upgrade +dkms build -m %{module_name} -v %{version} +dkms install -m %{module_name} -v %{version} +modprobe %{module_name} %preun -modprobe -r %{name} -dkms remove --all -m %{name} -v %{version} --rpm_safe_upgrade +modprobe -r %{module_name} +dkms remove --all -m %{module_name} -v %{version} --rpm_safe_upgrade %postun -rmdir /usr/src/%{name}-%{version} +rmdir /usr/src/%{module_name}-%{version} %changelog * Wed Jan 24 2024 Jerzy Jamroz - 2-1 From f51d2ce5e01c30daf5980d2b52408ee11b13ed5d Mon Sep 17 00:00:00 2001 From: Jerzy Jamroz Date: Fri, 26 Jan 2024 14:11:19 +0100 Subject: [PATCH 04/10] feat: RPM_NAME variable added to the RPM makefile. --- mrmShared/linux/dkms/Makefile | 4 +++- mrmShared/linux/dkms/mrf.spec.in | 23 ++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/mrmShared/linux/dkms/Makefile b/mrmShared/linux/dkms/Makefile index 892aa01c..a13132b6 100644 --- a/mrmShared/linux/dkms/Makefile +++ b/mrmShared/linux/dkms/Makefile @@ -6,6 +6,7 @@ DRV_NAME = mrf include $(SRCDIR)/VERSION include CONFIG +RPM_NAME = mrfioc2-dkms # The RPM_VERSION string takes the dotted version name (without extra version # info) and follows the Red Hat versioning rules: only letters, digits, and @@ -17,7 +18,7 @@ RPM_VERSION = $(DRV_VERSION) # Determine the architecture of the machine ARCH := $(shell uname -m) -RPM_FILE = $(DRV_NAME)-dkms-$(RPM_VERSION)-$(DRV_RELEASE).$(ARCH).rpm +RPM_FILE = $(RPM_NAME)-$(RPM_VERSION)-$(DRV_RELEASE).$(ARCH).rpm driver-rpm: $(RPM_FILE) .PHONY: driver-rpm @@ -35,6 +36,7 @@ SED_SUBSTS += s/@@RPM_VERSION@@/$(RPM_VERSION)/g; SED_SUBSTS += s/@@MRF_USER@@/$(MRF_USER)/g; SED_SUBSTS += s/@@DRV_RELEASE@@/$(DRV_RELEASE)/g; SED_SUBSTS += s/@@ARCH@@/$(ARCH)/g; +SED_SUBSTS += s/@@RPM_NAME@@/$(RPM_NAME)/g; %: %.in CONFIG $(SRCDIR)/VERSION sed '$(SED_SUBSTS)' $< >$@ diff --git a/mrmShared/linux/dkms/mrf.spec.in b/mrmShared/linux/dkms/mrf.spec.in index 80c9db10..2564b064 100644 --- a/mrmShared/linux/dkms/mrf.spec.in +++ b/mrmShared/linux/dkms/mrf.spec.in @@ -1,23 +1,24 @@ -%define module_name @@DRV_NAME@@ +%define kmod_name @@DRV_NAME@@ Summary: DKMS kernel module - mrfioc2 driver -Name: %{module_name}-dkms +Name: @@RPM_NAME@@ Version: @@RPM_VERSION@@ Release: @@DRV_RELEASE@@ Vendor: EPICS Community License: EPICS Open License Group: System Environment/Kernel -BuildRoot: %{_tmppath}/%{module_name}-%{version}-root +URL: https://github.com/epics-modules/mrfioc2 BuildRequires: autoconf libtool gcc gcc-c++ BuildArch: @@ARCH@@ Requires: dkms Requires: udev Packager: Michael Abbott +BuildRoot: %{_tmppath}/%{kmod_name}-%{version}-root # The two target directories -%define dkmsdir /usr/src/%{module_name}-%{version} +%define dkmsdir /usr/src/%{kmod_name}-%{version} %define udevdir /etc/udev/rules.d %description @@ -45,17 +46,17 @@ install -m 0644 %{_curdir}/50-mrf.rules %{buildroot}%{udevdir} %{udevdir}/50-mrf.rules %post -dkms add -m %{module_name} -v %{version} --rpm_safe_upgrade -dkms build -m %{module_name} -v %{version} -dkms install -m %{module_name} -v %{version} -modprobe %{module_name} +dkms add -m %{kmod_name} -v %{version} --rpm_safe_upgrade +dkms build -m %{kmod_name} -v %{version} +dkms install -m %{kmod_name} -v %{version} +modprobe %{kmod_name} %preun -modprobe -r %{module_name} -dkms remove --all -m %{module_name} -v %{version} --rpm_safe_upgrade +modprobe -r %{kmod_name} +dkms remove --all -m %{kmod_name} -v %{version} --rpm_safe_upgrade %postun -rmdir /usr/src/%{module_name}-%{version} +rmdir /usr/src/%{kmod_name}-%{version} %changelog * Wed Jan 24 2024 Jerzy Jamroz - 2-1 From 514176bf02fea25e58dbe1489c1406b118e21b0a Mon Sep 17 00:00:00 2001 From: Jerzy Jamroz Date: Fri, 26 Jan 2024 14:56:29 +0100 Subject: [PATCH 05/10] refactor: dkms to dkms-rpm dir adjustment. --- mrmShared/linux/VERSION | 2 +- mrmShared/linux/{dkms => dkms-rpm}/.gitignore | 0 mrmShared/linux/{dkms => dkms-rpm}/50-mrf.rules.in | 0 mrmShared/linux/{dkms => dkms-rpm}/CONFIG | 0 mrmShared/linux/{dkms => dkms-rpm}/Makefile | 0 mrmShared/linux/{dkms => dkms-rpm}/Makefile.dkms | 0 mrmShared/linux/{dkms => dkms-rpm}/dkms.conf.in | 0 mrmShared/linux/{dkms => dkms-rpm}/mrf.spec.in | 0 8 files changed, 1 insertion(+), 1 deletion(-) rename mrmShared/linux/{dkms => dkms-rpm}/.gitignore (100%) rename mrmShared/linux/{dkms => dkms-rpm}/50-mrf.rules.in (100%) rename mrmShared/linux/{dkms => dkms-rpm}/CONFIG (100%) rename mrmShared/linux/{dkms => dkms-rpm}/Makefile (100%) rename mrmShared/linux/{dkms => dkms-rpm}/Makefile.dkms (100%) rename mrmShared/linux/{dkms => dkms-rpm}/dkms.conf.in (100%) rename mrmShared/linux/{dkms => dkms-rpm}/mrf.spec.in (100%) diff --git a/mrmShared/linux/VERSION b/mrmShared/linux/VERSION index 80d6d5b1..1befb06b 100644 --- a/mrmShared/linux/VERSION +++ b/mrmShared/linux/VERSION @@ -1,5 +1,5 @@ # Version definition for driver # 20240124 Release -DRV_VERSION = 2 +DRV_VERSION = 3 DRV_RELEASE = 1 diff --git a/mrmShared/linux/dkms/.gitignore b/mrmShared/linux/dkms-rpm/.gitignore similarity index 100% rename from mrmShared/linux/dkms/.gitignore rename to mrmShared/linux/dkms-rpm/.gitignore diff --git a/mrmShared/linux/dkms/50-mrf.rules.in b/mrmShared/linux/dkms-rpm/50-mrf.rules.in similarity index 100% rename from mrmShared/linux/dkms/50-mrf.rules.in rename to mrmShared/linux/dkms-rpm/50-mrf.rules.in diff --git a/mrmShared/linux/dkms/CONFIG b/mrmShared/linux/dkms-rpm/CONFIG similarity index 100% rename from mrmShared/linux/dkms/CONFIG rename to mrmShared/linux/dkms-rpm/CONFIG diff --git a/mrmShared/linux/dkms/Makefile b/mrmShared/linux/dkms-rpm/Makefile similarity index 100% rename from mrmShared/linux/dkms/Makefile rename to mrmShared/linux/dkms-rpm/Makefile diff --git a/mrmShared/linux/dkms/Makefile.dkms b/mrmShared/linux/dkms-rpm/Makefile.dkms similarity index 100% rename from mrmShared/linux/dkms/Makefile.dkms rename to mrmShared/linux/dkms-rpm/Makefile.dkms diff --git a/mrmShared/linux/dkms/dkms.conf.in b/mrmShared/linux/dkms-rpm/dkms.conf.in similarity index 100% rename from mrmShared/linux/dkms/dkms.conf.in rename to mrmShared/linux/dkms-rpm/dkms.conf.in diff --git a/mrmShared/linux/dkms/mrf.spec.in b/mrmShared/linux/dkms-rpm/mrf.spec.in similarity index 100% rename from mrmShared/linux/dkms/mrf.spec.in rename to mrmShared/linux/dkms-rpm/mrf.spec.in From 864626901f79bc610faf5e502a354be861d88300 Mon Sep 17 00:00:00 2001 From: Jerzy Jamroz Date: Fri, 26 Jan 2024 16:40:15 +0100 Subject: [PATCH 06/10] fix: Versioning and build performance. --- mrmShared/linux/VERSION | 1 - mrmShared/linux/dkms-rpm/50-mrf.rules.in | 4 +-- mrmShared/linux/dkms-rpm/CONFIG | 3 ++- mrmShared/linux/dkms-rpm/Makefile | 13 +++++---- mrmShared/linux/dkms-rpm/dkms.conf.in | 4 ++- mrmShared/linux/dkms-rpm/mrf.spec.in | 34 +++++++++++++++++++----- 6 files changed, 40 insertions(+), 19 deletions(-) diff --git a/mrmShared/linux/VERSION b/mrmShared/linux/VERSION index 1befb06b..7af53390 100644 --- a/mrmShared/linux/VERSION +++ b/mrmShared/linux/VERSION @@ -2,4 +2,3 @@ # 20240124 Release DRV_VERSION = 3 -DRV_RELEASE = 1 diff --git a/mrmShared/linux/dkms-rpm/50-mrf.rules.in b/mrmShared/linux/dkms-rpm/50-mrf.rules.in index 892e47a6..a0903e23 100644 --- a/mrmShared/linux/dkms-rpm/50-mrf.rules.in +++ b/mrmShared/linux/dkms-rpm/50-mrf.rules.in @@ -1,2 +1,2 @@ -# UDEV rule to give general access to MRF device -SUBSYSTEM=="uio", ATTR{name}=="mrf-pci", GROUP="@@MRF_USER@@", MODE="0660", RUN+="/bin/chmod g+rw %S%p/resource0" +# UDEV rule giving access to MRF device +KERNEL=="uio*", ATTR{name}=="mrf-pci", GROUP="@@MRF_GROUP@@", MODE="0660", RUN+="/bin/chmod g+rw %S%p/resource0 && /bin/echo UDEV rule giving access to MRF device %S%p" diff --git a/mrmShared/linux/dkms-rpm/CONFIG b/mrmShared/linux/dkms-rpm/CONFIG index 150ea7c0..64e80716 100644 --- a/mrmShared/linux/dkms-rpm/CONFIG +++ b/mrmShared/linux/dkms-rpm/CONFIG @@ -1,3 +1,4 @@ # Specify the group for the MRF driver user here -MRF_USER = mrf +MRF_GROUP = mrf +RPM_RELEASE = 1 diff --git a/mrmShared/linux/dkms-rpm/Makefile b/mrmShared/linux/dkms-rpm/Makefile index a13132b6..0023cd79 100644 --- a/mrmShared/linux/dkms-rpm/Makefile +++ b/mrmShared/linux/dkms-rpm/Makefile @@ -2,11 +2,13 @@ SRCDIR = $(CURDIR)/.. -DRV_NAME = mrf include $(SRCDIR)/VERSION include CONFIG +DRV_NAME = mrf RPM_NAME = mrfioc2-dkms +# Determine the architecture of the machine +ARCH := $(shell uname -m) # The RPM_VERSION string takes the dotted version name (without extra version # info) and follows the Red Hat versioning rules: only letters, digits, and @@ -15,10 +17,7 @@ RPM_NAME = mrfioc2-dkms # for information on RPM versioning. We'll want to obey these rules if we can. RPM_VERSION = $(DRV_VERSION) -# Determine the architecture of the machine -ARCH := $(shell uname -m) - -RPM_FILE = $(RPM_NAME)-$(RPM_VERSION)-$(DRV_RELEASE).$(ARCH).rpm +RPM_FILE = $(RPM_NAME)-$(RPM_VERSION)-$(RPM_RELEASE).$(ARCH).rpm driver-rpm: $(RPM_FILE) .PHONY: driver-rpm @@ -33,8 +32,8 @@ SED_SUBSTS = SED_SUBSTS += s/@@DRV_VERSION@@/$(DRV_VERSION)/g; SED_SUBSTS += s/@@DRV_NAME@@/$(DRV_NAME)/g; SED_SUBSTS += s/@@RPM_VERSION@@/$(RPM_VERSION)/g; -SED_SUBSTS += s/@@MRF_USER@@/$(MRF_USER)/g; -SED_SUBSTS += s/@@DRV_RELEASE@@/$(DRV_RELEASE)/g; +SED_SUBSTS += s/@@MRF_GROUP@@/$(MRF_GROUP)/g; +SED_SUBSTS += s/@@RPM_RELEASE@@/$(RPM_RELEASE)/g; SED_SUBSTS += s/@@ARCH@@/$(ARCH)/g; SED_SUBSTS += s/@@RPM_NAME@@/$(RPM_NAME)/g; diff --git a/mrmShared/linux/dkms-rpm/dkms.conf.in b/mrmShared/linux/dkms-rpm/dkms.conf.in index 26620856..2b65b3e2 100644 --- a/mrmShared/linux/dkms-rpm/dkms.conf.in +++ b/mrmShared/linux/dkms-rpm/dkms.conf.in @@ -1,6 +1,8 @@ +DESCRIPTION="DKMS mrfioc2 kernel module." PACKAGE_NAME="@@DRV_NAME@@" PACKAGE_VERSION="@@RPM_VERSION@@" BUILT_MODULE_NAME[0]="@@DRV_NAME@@" DEST_MODULE_LOCATION[0]="/extra" -MAKE[0]="make -j1 KERNEL_DIR=$kernel_source_dir VERSION=@@DRV_VERSION@@" +MAKE[0]="make -j1 KERNEL_DIR=$kernel_source_dir VERSION=@@DRV_VERSION@@ DRV_VERSION=@@DRV_VERSION@@" AUTOINSTALL=YES +REMAKE_INITRD=NO diff --git a/mrmShared/linux/dkms-rpm/mrf.spec.in b/mrmShared/linux/dkms-rpm/mrf.spec.in index 2564b064..4bdee026 100644 --- a/mrmShared/linux/dkms-rpm/mrf.spec.in +++ b/mrmShared/linux/dkms-rpm/mrf.spec.in @@ -1,10 +1,13 @@ %define kmod_name @@DRV_NAME@@ +%define udev_rules_update \ + /sbin/udevadm control --reload-rules && \ + /sbin/udevadm trigger -Summary: DKMS kernel module - mrfioc2 driver +Summary: DKMS mrfioc2 kernel module Name: @@RPM_NAME@@ Version: @@RPM_VERSION@@ -Release: @@DRV_RELEASE@@ +Release: @@RPM_RELEASE@@%{?dist} Vendor: EPICS Community License: EPICS Open License @@ -14,7 +17,6 @@ BuildRequires: autoconf libtool gcc gcc-c++ BuildArch: @@ARCH@@ Requires: dkms Requires: udev -Packager: Michael Abbott BuildRoot: %{_tmppath}/%{kmod_name}-%{version}-root # The two target directories @@ -22,8 +24,11 @@ BuildRoot: %{_tmppath}/%{kmod_name}-%{version}-root %define udevdir /etc/udev/rules.d %description -Installs the kernel driver for interfacing to the MRF Event Receiver over -PCI express. The driver is installed using dkms. +Installs the kernel driver for interfacing to the MRF timing cards over +PCI express. The driver is installed using dkms. + +%clean +rm -rf %{buildroot} %install rm -rf %{buildroot} @@ -46,20 +51,35 @@ install -m 0644 %{_curdir}/50-mrf.rules %{buildroot}%{udevdir} %{udevdir}/50-mrf.rules %post +groupadd -r @@MRF_GROUP@@ 2>&1 || : dkms add -m %{kmod_name} -v %{version} --rpm_safe_upgrade dkms build -m %{kmod_name} -v %{version} dkms install -m %{kmod_name} -v %{version} modprobe %{kmod_name} +%udev_rules_update %preun modprobe -r %{kmod_name} -dkms remove --all -m %{kmod_name} -v %{version} --rpm_safe_upgrade +dkms remove --all -m %{kmod_name} -v %{version} --rpm_safe_upgrade --all ||: +groupdel @@MRF_GROUP@@ 2>&1 || : +%udev_rules_update %postun rmdir /usr/src/%{kmod_name}-%{version} %changelog -* Wed Jan 24 2024 Jerzy Jamroz - 2-1 + +* Wed Jan 24 2024 Jerzy Jamroz - 3-1 - Build adjustments. +- Correction of the driver version handling. - Group rw access for the pci resource0. - AER handling functions. +- Device access group added. +- Tested on CentOS7. + +* Mon Jan 22 2024 Jerzy Jamroz - 2-1 +- Version 2 skipped due to usage as version 1. +- Tested on CentOS7. + +* Mon Dec 14 2020 Michael Abbott - 1-1 +- Initial release. From 10f550d0138557a368f872f265959268afe2c239 Mon Sep 17 00:00:00 2001 From: Jerzy Jamroz Date: Sun, 28 Jan 2024 13:26:27 +0100 Subject: [PATCH 07/10] ci: The latest linux kernel build changed. The latest kmod build with the latest kernel removed from the standard verification as it was generating the error state. --- .github/workflows/linux-build-latest.yml | 49 +++++++++++ .github/workflows/linux-build.yml | 100 +++++++++++------------ mrmShared/linux/{README => README.md} | 8 +- mrmShared/linux/dkms-rpm/CONFIG | 3 + mrmShared/linux/dkms-rpm/Makefile | 4 +- 5 files changed, 105 insertions(+), 59 deletions(-) create mode 100644 .github/workflows/linux-build-latest.yml rename mrmShared/linux/{README => README.md} (93%) diff --git a/.github/workflows/linux-build-latest.yml b/.github/workflows/linux-build-latest.yml new file mode 100644 index 00000000..7df40716 --- /dev/null +++ b/.github/workflows/linux-build-latest.yml @@ -0,0 +1,49 @@ +name: Linux latest kernel module test + +on: + workflow_dispatch: + +jobs: + specific: + name: With ${{ matrix.version }} + runs-on: ${{ matrix.os }} + env: + KSER: ${{ matrix.series }} + KVER: ${{ matrix.version }} + CC: ${{ matrix.cc }} + strategy: + fail-fast: false + matrix: + include: + - name: Ubuntu Latest - Series Latest + os: ubuntu-latest + series: latest + version: latest + + steps: + - uses: actions/checkout@v2 + - name: Info + run: | + gcc --version + - name: Deps + run: | + sudo apt-get update + # linux-headers-* only to pull in kbuild deps + sudo apt-get -y install linux-headers-`uname -r` kmod libelf-dev + [ "${{ matrix.cc }}" != "gcc-4.8" ] || sudo apt-get -y install gcc-4.8 + - name: Setup Linux + run: | + install -d kernel + if [ "$KSER" == "latest" ]; then + KSER=$(curl -s https://cdn.kernel.org/pub/linux/kernel/ | grep -o 'v[0-9]\+\.[0-9a-zA-Z]\+/' | sed 's/\/\s*//' | sort -t. -k2,2V -k3,3V -k4,4V | tail -n 1 | sed 's/v//') + fi + if [ "$KVER" == "latest" ]; then + KVER=$(curl -s https://cdn.kernel.org/pub/linux/kernel/v$KSER/ | grep -o 'linux-[0-9]\+\.[0-9]\+\.[0-9]\+\.tar\.xz' | sort -t- -k2,2n -k3,3n -k4,4n | tail -n 1 | sed 's/linux-\(.*\)\.tar\.xz/\1/') + fi + echo "https://cdn.kernel.org/pub/linux/kernel/v$KSER/linux-$KVER.tar.xz" + curl -s https://cdn.kernel.org/pub/linux/kernel/v$KSER/linux-$KVER.tar.xz | tar -C kernel --strip-components=1 -xJ + make -C kernel CC=${CC:=gcc} defconfig + make -C kernel CC=${CC:=gcc} modules_prepare + - name: Build + run: | + make -C mrmShared/linux CC=${CC:=gcc} KERNELDIR="$PWD/kernel" diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 1e3d369a..76ab468f 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -3,10 +3,10 @@ name: Linux kernel module on: push: paths: - - 'mrmShared/linux/**' + - "mrmShared/linux/**" pull_request: paths: - - 'mrmShared/linux/**' + - "mrmShared/linux/**" workflow_dispatch: jobs: @@ -21,64 +21,62 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-20.04 + - name: Ubuntu 20.04 - Series 4.x + os: ubuntu-20.04 series: 4.x version: 4.9.1 - - os: ubuntu-20.04 + - name: Ubuntu 20.04 - Series 5.x + os: ubuntu-20.04 series: 5.x version: 5.9.6 - - os: ubuntu-latest - series: latest - version: latest - steps: - - uses: actions/checkout@v2 - - name: Info - run: | - gcc --version - - name: Deps - run: | - sudo apt-get update - # linux-headers-* only to pull in kbuild deps - sudo apt-get -y install linux-headers-`uname -r` kmod libelf-dev - [ "${{ matrix.cc }}" != "gcc-4.8" ] || sudo apt-get -y install gcc-4.8 - - name: Setup Linux - run: | - install -d kernel - if [ "$KSER" == "latest" ]; then - KSER=$(curl -s https://cdn.kernel.org/pub/linux/kernel/ | grep -o 'v[0-9]\+\.[0-9a-zA-Z]\+/' | sed 's/\/\s*//' | sort -t. -k2,2V -k3,3V -k4,4V | tail -n 1 | sed 's/v//') - fi - if [ "$KVER" == "latest" ]; then - KVER=$(curl -s https://cdn.kernel.org/pub/linux/kernel/v$KSER/ | grep -o 'linux-[0-9]\+\.[0-9]\+\.[0-9]\+\.tar\.xz' | sort -t- -k2,2n -k3,3n -k4,4n | tail -n 1 | sed 's/linux-\(.*\)\.tar\.xz/\1/') - fi - echo "https://cdn.kernel.org/pub/linux/kernel/v$KSER/linux-$KVER.tar.xz" - curl -s https://cdn.kernel.org/pub/linux/kernel/v$KSER/linux-$KVER.tar.xz | tar -C kernel --strip-components=1 -xJ - make -C kernel CC=${CC:=gcc} defconfig - make -C kernel CC=${CC:=gcc} modules_prepare - - name: Build - run: | - make -C mrmShared/linux CC=${CC:=gcc} KERNELDIR="$PWD/kernel" + - uses: actions/checkout@v2 + - name: Info + run: | + gcc --version + - name: Deps + run: | + sudo apt-get update + # linux-headers-* only to pull in kbuild deps + sudo apt-get -y install linux-headers-`uname -r` kmod libelf-dev + [ "${{ matrix.cc }}" != "gcc-4.8" ] || sudo apt-get -y install gcc-4.8 + - name: Setup Linux + run: | + install -d kernel + if [ "$KSER" == "latest" ]; then + KSER=$(curl -s https://cdn.kernel.org/pub/linux/kernel/ | grep -o 'v[0-9]\+\.[0-9a-zA-Z]\+/' | sed 's/\/\s*//' | sort -t. -k2,2V -k3,3V -k4,4V | tail -n 1 | sed 's/v//') + fi + if [ "$KVER" == "latest" ]; then + KVER=$(curl -s https://cdn.kernel.org/pub/linux/kernel/v$KSER/ | grep -o 'linux-[0-9]\+\.[0-9]\+\.[0-9]\+\.tar\.xz' | sort -t- -k2,2n -k3,3n -k4,4n | tail -n 1 | sed 's/linux-\(.*\)\.tar\.xz/\1/') + fi + echo "https://cdn.kernel.org/pub/linux/kernel/v$KSER/linux-$KVER.tar.xz" + curl -s https://cdn.kernel.org/pub/linux/kernel/v$KSER/linux-$KVER.tar.xz | tar -C kernel --strip-components=1 -xJ + make -C kernel CC=${CC:=gcc} defconfig + make -C kernel CC=${CC:=gcc} modules_prepare + - name: Build + run: | + make -C mrmShared/linux CC=${CC:=gcc} KERNELDIR="$PWD/kernel" host: name: With VM host runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Info - run: | - uname -a - gcc --version - - name: Deps - run: | - sudo apt-get update - sudo apt-get -y install linux-headers-`uname -r` - - name: Build - run: make -C mrmShared/linux - - name: Install/Load - run: | - sudo make -C mrmShared/linux modules_install - sudo depmod -a - sudo modprobe mrf - sudo dmesg | tail -n 100 + - uses: actions/checkout@v2 + - name: Info + run: | + uname -a + gcc --version + - name: Deps + run: | + sudo apt-get update + sudo apt-get -y install linux-headers-`uname -r` + - name: Build + run: make -C mrmShared/linux + - name: Install/Load + run: | + sudo make -C mrmShared/linux modules_install + sudo depmod -a + sudo modprobe mrf + sudo dmesg | tail -n 100 diff --git a/mrmShared/linux/README b/mrmShared/linux/README.md similarity index 93% rename from mrmShared/linux/README rename to mrmShared/linux/README.md index 1ad510af..1e6c2c98 100644 --- a/mrmShared/linux/README +++ b/mrmShared/linux/README.md @@ -1,10 +1,9 @@ -== cross compiling == +# Cross compiling make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- KERNELDIR=/path/to/headers - -== udev == +# udev udev rules to automatically set permissions for approprieate /dev/uio* @@ -15,8 +14,7 @@ cat << EOF > /etc/udev/rules.d/99-mrfioc2.rules KERNEL=="uio*", ATTR{name}=="mrf-pci", GROUP="softioc", MODE="0660" EOF - -== dkms == +# dkms-rpm To create an installable dksm package for this kernel module do the following: diff --git a/mrmShared/linux/dkms-rpm/CONFIG b/mrmShared/linux/dkms-rpm/CONFIG index 64e80716..60d5f638 100644 --- a/mrmShared/linux/dkms-rpm/CONFIG +++ b/mrmShared/linux/dkms-rpm/CONFIG @@ -2,3 +2,6 @@ MRF_GROUP = mrf RPM_RELEASE = 1 +DRV_NAME = mrf +RPM_NAME = mrfioc2-dkms +DIST ?= el7 diff --git a/mrmShared/linux/dkms-rpm/Makefile b/mrmShared/linux/dkms-rpm/Makefile index 0023cd79..d4fbc121 100644 --- a/mrmShared/linux/dkms-rpm/Makefile +++ b/mrmShared/linux/dkms-rpm/Makefile @@ -5,8 +5,6 @@ SRCDIR = $(CURDIR)/.. include $(SRCDIR)/VERSION include CONFIG -DRV_NAME = mrf -RPM_NAME = mrfioc2-dkms # Determine the architecture of the machine ARCH := $(shell uname -m) @@ -17,7 +15,7 @@ ARCH := $(shell uname -m) # for information on RPM versioning. We'll want to obey these rules if we can. RPM_VERSION = $(DRV_VERSION) -RPM_FILE = $(RPM_NAME)-$(RPM_VERSION)-$(RPM_RELEASE).$(ARCH).rpm +RPM_FILE = $(RPM_NAME)-$(RPM_VERSION)-$(RPM_RELEASE).$(DIST).$(ARCH).rpm driver-rpm: $(RPM_FILE) .PHONY: driver-rpm From 73885dfe1ff49e1dd24d4f1c49a437f618f62633 Mon Sep 17 00:00:00 2001 From: Jerzy Jamroz Date: Mon, 29 Jan 2024 13:05:05 +0100 Subject: [PATCH 08/10] refactor: pci_channel_io_perm_failure info to the log. --- mrmShared/linux/dkms-rpm/50-mrf.rules.in | 2 +- mrmShared/linux/dkms-rpm/mrf.spec.in | 5 +++-- mrmShared/linux/uio_mrf.c | 17 +++++++++-------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/mrmShared/linux/dkms-rpm/50-mrf.rules.in b/mrmShared/linux/dkms-rpm/50-mrf.rules.in index a0903e23..6b7de2f2 100644 --- a/mrmShared/linux/dkms-rpm/50-mrf.rules.in +++ b/mrmShared/linux/dkms-rpm/50-mrf.rules.in @@ -1,2 +1,2 @@ # UDEV rule giving access to MRF device -KERNEL=="uio*", ATTR{name}=="mrf-pci", GROUP="@@MRF_GROUP@@", MODE="0660", RUN+="/bin/chmod g+rw %S%p/resource0 && /bin/echo UDEV rule giving access to MRF device %S%p" +KERNEL=="uio*", ATTR{name}=="mrf-pci", GROUP="@@MRF_GROUP@@", MODE="0660", RUN+="/bin/chmod g+rw %S%p/resource0 && /bin/logger UDEV rule giving access to MRF device %S%p" diff --git a/mrmShared/linux/dkms-rpm/mrf.spec.in b/mrmShared/linux/dkms-rpm/mrf.spec.in index 4bdee026..833e898d 100644 --- a/mrmShared/linux/dkms-rpm/mrf.spec.in +++ b/mrmShared/linux/dkms-rpm/mrf.spec.in @@ -61,8 +61,8 @@ modprobe %{kmod_name} %preun modprobe -r %{kmod_name} dkms remove --all -m %{kmod_name} -v %{version} --rpm_safe_upgrade --all ||: -groupdel @@MRF_GROUP@@ 2>&1 || : %udev_rules_update +groupdel @@MRF_GROUP@@ 2>&1 || : %postun rmdir /usr/src/%{kmod_name}-%{version} @@ -70,7 +70,8 @@ rmdir /usr/src/%{kmod_name}-%{version} %changelog * Wed Jan 24 2024 Jerzy Jamroz - 3-1 -- Build adjustments. +- Build adjustments exposing the control variables. +- Pkg name changed to mrfioc2-dkms. - Correction of the driver version handling. - Group rw access for the pci resource0. - AER handling functions. diff --git a/mrmShared/linux/uio_mrf.c b/mrmShared/linux/uio_mrf.c index 9114552a..dff76526 100644 --- a/mrmShared/linux/uio_mrf.c +++ b/mrmShared/linux/uio_mrf.c @@ -398,7 +398,7 @@ int mrf_irqcontrol(struct uio_info *info, s32 onoff) default: // there are no distict registers for this bridge. // 'plx' holds the base address of FPGA registers - + // Check endianism end = mrf_detect_endian(priv, plx); @@ -644,7 +644,7 @@ mrf_probe(struct pci_dev *dev, /* clear everything for GPIO 0-3 (aka first 12 bits). * Preserve current settings for GPIO 4-7. * This will setup these as inputs (which float high) - * + * * Each GPIO bit has 3 register bits (function, direction, and value) */ val &= 0xfffff000; @@ -832,23 +832,24 @@ mrf_error_detected(struct pci_dev *dev, pci_channel_state_t state) { struct uio_info *info = pci_get_drvdata(dev); struct mrf_priv *priv = container_of(info, struct mrf_priv, uio); - + if (state == pci_channel_io_normal) { /* FIXME: Anything else to do here? */ return PCI_ERS_RESULT_CAN_RECOVER; } else if (state == pci_channel_io_frozen) { dev_warn(&dev->dev, "Unregistering UIO device\n"); uio_unregister_device(info); - + if (priv->msienabled) { pci_disable_msi(dev); } - + pci_disable_device(dev); - + /* FIXME: Anything else to do here? */ return PCI_ERS_RESULT_NEED_RESET; } else if (state == pci_channel_io_perm_failure) { + printk(KERN_ERR "PCI card is dead.\n"); return PCI_ERS_RESULT_DISCONNECT; } @@ -878,13 +879,13 @@ mrf_slot_reset(struct pci_dev *dev) dev_dbg(&dev->dev, "Error enabling MSI %d\n", err); } } - + ret = uio_register_device(&dev->dev, info); if (ret) { dev_err(&dev->dev, "Failed to register UIO device %d\n", ret); } dev_warn(&dev->dev, "Registered UIO device\n"); - + pci_restore_state(dev); pci_save_state(dev); From c7248d45c88c1983b47addd8022805861bae2ca7 Mon Sep 17 00:00:00 2001 From: Jerzy Jamroz Date: Tue, 30 Jan 2024 10:40:49 +0100 Subject: [PATCH 09/10] refactor: MRF_GROUP changed DRV_GROUP==root. --- mrmShared/linux/dkms-rpm/50-mrf.rules.in | 2 +- mrmShared/linux/dkms-rpm/CONFIG | 3 ++- mrmShared/linux/dkms-rpm/Makefile | 2 +- mrmShared/linux/dkms-rpm/mrf.spec.in | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mrmShared/linux/dkms-rpm/50-mrf.rules.in b/mrmShared/linux/dkms-rpm/50-mrf.rules.in index 6b7de2f2..b02e231f 100644 --- a/mrmShared/linux/dkms-rpm/50-mrf.rules.in +++ b/mrmShared/linux/dkms-rpm/50-mrf.rules.in @@ -1,2 +1,2 @@ # UDEV rule giving access to MRF device -KERNEL=="uio*", ATTR{name}=="mrf-pci", GROUP="@@MRF_GROUP@@", MODE="0660", RUN+="/bin/chmod g+rw %S%p/resource0 && /bin/logger UDEV rule giving access to MRF device %S%p" +KERNEL=="uio*", ATTR{name}=="mrf-pci", GROUP="@@DRV_GROUP@@", MODE="0660", RUN+="/bin/chmod g+rw %S%p/resource0 && /bin/logger UDEV rule giving access to MRF device %S%p" diff --git a/mrmShared/linux/dkms-rpm/CONFIG b/mrmShared/linux/dkms-rpm/CONFIG index 60d5f638..7882eb7b 100644 --- a/mrmShared/linux/dkms-rpm/CONFIG +++ b/mrmShared/linux/dkms-rpm/CONFIG @@ -1,6 +1,7 @@ # Specify the group for the MRF driver user here -MRF_GROUP = mrf +# NOTE: group root can be adjusted by the configuration tool +DRV_GROUP = root RPM_RELEASE = 1 DRV_NAME = mrf RPM_NAME = mrfioc2-dkms diff --git a/mrmShared/linux/dkms-rpm/Makefile b/mrmShared/linux/dkms-rpm/Makefile index d4fbc121..55b5faa0 100644 --- a/mrmShared/linux/dkms-rpm/Makefile +++ b/mrmShared/linux/dkms-rpm/Makefile @@ -30,7 +30,7 @@ SED_SUBSTS = SED_SUBSTS += s/@@DRV_VERSION@@/$(DRV_VERSION)/g; SED_SUBSTS += s/@@DRV_NAME@@/$(DRV_NAME)/g; SED_SUBSTS += s/@@RPM_VERSION@@/$(RPM_VERSION)/g; -SED_SUBSTS += s/@@MRF_GROUP@@/$(MRF_GROUP)/g; +SED_SUBSTS += s/@@DRV_GROUP@@/$(DRV_GROUP)/g; SED_SUBSTS += s/@@RPM_RELEASE@@/$(RPM_RELEASE)/g; SED_SUBSTS += s/@@ARCH@@/$(ARCH)/g; SED_SUBSTS += s/@@RPM_NAME@@/$(RPM_NAME)/g; diff --git a/mrmShared/linux/dkms-rpm/mrf.spec.in b/mrmShared/linux/dkms-rpm/mrf.spec.in index 833e898d..a1f3aed7 100644 --- a/mrmShared/linux/dkms-rpm/mrf.spec.in +++ b/mrmShared/linux/dkms-rpm/mrf.spec.in @@ -51,7 +51,7 @@ install -m 0644 %{_curdir}/50-mrf.rules %{buildroot}%{udevdir} %{udevdir}/50-mrf.rules %post -groupadd -r @@MRF_GROUP@@ 2>&1 || : +# NOTE: group root groupadd -r @@DRV_GROUP@@ 2>&1 || : dkms add -m %{kmod_name} -v %{version} --rpm_safe_upgrade dkms build -m %{kmod_name} -v %{version} dkms install -m %{kmod_name} -v %{version} @@ -62,7 +62,7 @@ modprobe %{kmod_name} modprobe -r %{kmod_name} dkms remove --all -m %{kmod_name} -v %{version} --rpm_safe_upgrade --all ||: %udev_rules_update -groupdel @@MRF_GROUP@@ 2>&1 || : +# NOTE: group root groupdel @@DRV_GROUP@@ 2>&1 || : %postun rmdir /usr/src/%{kmod_name}-%{version} From 80a900dc79ab977da3b6310016e8890686eec6f4 Mon Sep 17 00:00:00 2001 From: Jerzy Jamroz Date: Tue, 30 Jan 2024 11:12:21 +0100 Subject: [PATCH 10/10] refactor: Making the build more generic. * VERSION changed to CONFIG as it contains more vars now. * PKG_NAME introduced. * RPM_RELEASE generic for any rpm based distro. --- mrmShared/linux/CONFIG | 8 ++++++++ mrmShared/linux/Makefile | 2 +- mrmShared/linux/VERSION | 4 ---- mrmShared/linux/dkms-rpm/CONFIG | 9 ++------- mrmShared/linux/dkms-rpm/Makefile | 8 ++++---- mrmShared/linux/dkms-rpm/mrf.spec.in | 8 ++++---- 6 files changed, 19 insertions(+), 20 deletions(-) create mode 100644 mrmShared/linux/CONFIG delete mode 100644 mrmShared/linux/VERSION diff --git a/mrmShared/linux/CONFIG b/mrmShared/linux/CONFIG new file mode 100644 index 00000000..8ab10627 --- /dev/null +++ b/mrmShared/linux/CONFIG @@ -0,0 +1,8 @@ +# Version definition for driver +# 20240124 Release +DRV_VERSION := 3 + +# Package control vars +PKG_NAME := mrfioc2-dkms +DRV_NAME := mrf +DRV_GROUP := mrf diff --git a/mrmShared/linux/Makefile b/mrmShared/linux/Makefile index 0ade7ea0..11ad20cc 100644 --- a/mrmShared/linux/Makefile +++ b/mrmShared/linux/Makefile @@ -1,6 +1,6 @@ KERNELDIR ?= /lib/modules/$(shell uname -r)/build -include VERSION +include CONFIG all: modules diff --git a/mrmShared/linux/VERSION b/mrmShared/linux/VERSION deleted file mode 100644 index 7af53390..00000000 --- a/mrmShared/linux/VERSION +++ /dev/null @@ -1,4 +0,0 @@ -# Version definition for driver - -# 20240124 Release -DRV_VERSION = 3 diff --git a/mrmShared/linux/dkms-rpm/CONFIG b/mrmShared/linux/dkms-rpm/CONFIG index 7882eb7b..d73c728a 100644 --- a/mrmShared/linux/dkms-rpm/CONFIG +++ b/mrmShared/linux/dkms-rpm/CONFIG @@ -1,8 +1,3 @@ -# Specify the group for the MRF driver user here -# NOTE: group root can be adjusted by the configuration tool -DRV_GROUP = root -RPM_RELEASE = 1 -DRV_NAME = mrf -RPM_NAME = mrfioc2-dkms -DIST ?= el7 +RPM_RELEASE := 1 +# NOTE: Not necessary DIST ?= el7 diff --git a/mrmShared/linux/dkms-rpm/Makefile b/mrmShared/linux/dkms-rpm/Makefile index 55b5faa0..69e9435e 100644 --- a/mrmShared/linux/dkms-rpm/Makefile +++ b/mrmShared/linux/dkms-rpm/Makefile @@ -2,7 +2,7 @@ SRCDIR = $(CURDIR)/.. -include $(SRCDIR)/VERSION +include $(SRCDIR)/CONFIG include CONFIG # Determine the architecture of the machine @@ -15,7 +15,7 @@ ARCH := $(shell uname -m) # for information on RPM versioning. We'll want to obey these rules if we can. RPM_VERSION = $(DRV_VERSION) -RPM_FILE = $(RPM_NAME)-$(RPM_VERSION)-$(RPM_RELEASE).$(DIST).$(ARCH).rpm +RPM_FILE = $(PKG_NAME)-$(RPM_VERSION)-$(RPM_RELEASE).$(ARCH).rpm driver-rpm: $(RPM_FILE) .PHONY: driver-rpm @@ -33,9 +33,9 @@ SED_SUBSTS += s/@@RPM_VERSION@@/$(RPM_VERSION)/g; SED_SUBSTS += s/@@DRV_GROUP@@/$(DRV_GROUP)/g; SED_SUBSTS += s/@@RPM_RELEASE@@/$(RPM_RELEASE)/g; SED_SUBSTS += s/@@ARCH@@/$(ARCH)/g; -SED_SUBSTS += s/@@RPM_NAME@@/$(RPM_NAME)/g; +SED_SUBSTS += s/@@PKG_NAME@@/$(PKG_NAME)/g; -%: %.in CONFIG $(SRCDIR)/VERSION +%: %.in CONFIG $(SRCDIR)/CONFIG sed '$(SED_SUBSTS)' $< >$@ SED_FILES = dkms.conf $(DRV_NAME).spec 50-mrf.rules diff --git a/mrmShared/linux/dkms-rpm/mrf.spec.in b/mrmShared/linux/dkms-rpm/mrf.spec.in index a1f3aed7..f698a31b 100644 --- a/mrmShared/linux/dkms-rpm/mrf.spec.in +++ b/mrmShared/linux/dkms-rpm/mrf.spec.in @@ -5,9 +5,9 @@ Summary: DKMS mrfioc2 kernel module -Name: @@RPM_NAME@@ +Name: @@PKG_NAME@@ Version: @@RPM_VERSION@@ -Release: @@RPM_RELEASE@@%{?dist} +Release: @@RPM_RELEASE@@ Vendor: EPICS Community License: EPICS Open License @@ -51,7 +51,7 @@ install -m 0644 %{_curdir}/50-mrf.rules %{buildroot}%{udevdir} %{udevdir}/50-mrf.rules %post -# NOTE: group root groupadd -r @@DRV_GROUP@@ 2>&1 || : +# PRP: groupadd -r @@DRV_GROUP@@ 2>&1 || : dkms add -m %{kmod_name} -v %{version} --rpm_safe_upgrade dkms build -m %{kmod_name} -v %{version} dkms install -m %{kmod_name} -v %{version} @@ -62,7 +62,7 @@ modprobe %{kmod_name} modprobe -r %{kmod_name} dkms remove --all -m %{kmod_name} -v %{version} --rpm_safe_upgrade --all ||: %udev_rules_update -# NOTE: group root groupdel @@DRV_GROUP@@ 2>&1 || : +# PRP: group root groupdel @@DRV_GROUP@@ 2>&1 || : %postun rmdir /usr/src/%{kmod_name}-%{version}