Skip to content

Commit 626dfc5

Browse files
authored
Merge branch 'master' into master
2 parents 620a888 + f4322b5 commit 626dfc5

15 files changed

+152
-91
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
modules.order
44
Module.symvers
55
Mkfile.old
6-
dkms.conf
76
core.*
87
#*
98
.#*

README.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ etherlabmaster
33
Configuration Environment for EtherLab EtherCAT Master at https://sourceforge.net/projects/etherlabmaster/
44

55
## Role
6-
In order to download, install, setup all relevant components (system library, kernel module, ethercat configuration, and systemd service), one should do many steps manually. This repository was designed for the easy-to-reproducible enviornment for EtherLab EtherCAT Master. With the following steps, one can run the EtherCAT Master on one dedicated ethernet port within CentOS and Debian OSs.
6+
In order to download, install, setup all relevant components (system library, kernel module, ethercat configuration, and systemd service), one should do many steps manually. This repository was designed for the easy-to-reproducible environment for EtherLab EtherCAT Master. With the following steps, one can run the EtherCAT Master on one dedicated Ethernet port within CentOS and Debian OSs.
77

88

99

@@ -16,15 +16,21 @@ etherlabmaster (master)$ echo "ETHERCAT_MASTER0=eth0" > ethercatmaster.local
1616
```
1717
The local file will be used to override the ETHERCAT_MASTER0 variable defined in scripts/ethercatmaster.conf.
1818

19-
You are ready to do the following commands in the specific order:
19+
Be ready to do the following commands in the specific order:
2020

2121
```
2222
etherlabmaster (master)$ make init
2323
etherlabmaster (master)$ make patch
2424
etherlabmaster (master)$ make build
2525
etherlabmaster (master)$ make install
26-
etherlabmaster (master)$ make modules
27-
etherlabmaster (master)$ make modules_install
26+
```
27+
28+
Kernel modules are built via dkms
29+
30+
```
31+
etherlabmaster (master)$ make dkms_add
32+
etherlabmaster (master)$ make dkms_build
33+
etherlabmaster (master)$ make dkms_install
2834
etherlabmaster (master)$ make setup
2935
```
3036

@@ -50,23 +56,28 @@ Fixed scheduler settings in dc_user example; use CLOCK_MONOTONIC.
5056
```
5157
### make patch
5258
* We would like to keep ethercat.conf file within $PREFIX/etc path
53-
* [See the patch file](./patch/Site/use_prefix_for_ethercat_conf_path.p0.patch)
59+
* [See the patch file 1](./patch/Site/use_prefix_for_ethercat_conf_path.p0.patch)
60+
* [See the patch file 2](./patch/Site/after_dkms_service_patch.p0.patch)
5461

5562
### make build
5663
* Ethercat program compilation
5764

5865
### make install
5966
* Ethercat program (configuration, lib, and others) installation
6067

61-
### make modules build
62-
* Kernel modules compiliation
68+
### make dkms_add
69+
* dkms add
70+
71+
### make dkms_build
72+
* dkms build via dkms
6373

64-
### make modules install
65-
* Kernel modules installation
74+
### make dkms_install
75+
* Kernel modules installation via dkms
6676

6777
### make setup
6878

6979
* Activate the EtherCAT master Network Port
80+
* Setup the dkms systemd service
7081
* Setup the ethercat systemd service
7182
* Put the UDEV rule to allow an user to access the ethercat master port
7283
* Create the symbolic link for the ethercat executable command

configure/CONFIG

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
VARS_EXCLUDES := $(.VARIABLES)
22

3-
#include $(TOP)/configure/RELEASE
4-
53
include $(TOP)/configure/CONFIG_MODULE
64

75

86
## It is not necessary to modify the following files in most case.
97
## Order is matter
108

11-
#include $(TOP)/configure/E3/CONFIG_REQUIRE
12-
#include $(TOP)/configure/E3/CONFIG_E3_PATH
139
include $(TOP)/configure/E3/CONFIG_E3_MAKEFILE
1410
include $(TOP)/configure/E3/CONFIG_SUDO
1511
include $(TOP)/configure/E3/CONFIG_EXPORT

configure/E3/CONFIG_E3_MAKEFILE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
E3_REQUIRE_MAKEFILE_INPUT_OPTIONS := -C $(E3_MODULE_SRC_PATH)
44
E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += -f $(E3_MODULE_MAKEFILE)
55
E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += E3_ETHERLAB_INSTALL_LOCATION="$(E3_ETHERLAB_INSTALL_LOCATION)"
6-
# E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += LIBVERSION="$(E3_MODULE_VERSION)"
7-
# E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += PROJECT="$(E3_MODULE_NAME)"
6+
E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += E3_MODULE_VERSION="$(E3_MODULE_VERSION)"
7+
E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += E3_MODULE_NAME="$(E3_MODULE_NAME)"
88
# E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += EPICS_MODULES="$(E3_MODULES_PATH)"
99
# E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += EPICS_LOCATION="$(EPICS_BASE)"
1010
# E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += BUILDCLASSES="Linux"

configure/E3/CONFIG_E3_PATH

Lines changed: 0 additions & 43 deletions
This file was deleted.

configure/E3/CONFIG_REQUIRE

Lines changed: 0 additions & 9 deletions
This file was deleted.

configure/E3/RULES_ETHERLAB

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,44 @@ distclean: clean
5151
rm -rf $(E3_MODULE_SRC_PATH)
5252

5353
## modules : EtherCAT Master Kernel Modules Compiliation
54-
modules:
54+
modules: conf
5555
$(QUIET) $(E3_MODULE_MAKE_CMDS) modules
5656

57-
5857
# always sudo is needed
5958
## modules_install : EtherCAT Master Kernel Modules Installation
6059
modules_install:
6160
$(QUIET) sudo -E bash -c '$(E3_MODULE_MAKE_CMDS) modules_install'
6261

62+
modules_uninstall:
63+
$(QUIET) sudo -E bash -c '$(E3_MODULE_MAKE_CMDS) modules_uninstall'
6364

6465
autoconf: conf
6566
$(QUIET) $(E3_MODULE_MAKE_CMDS) autoconf
6667

6768

6869
conf:
6970
$(QUIET) install -m 644 $(TOP)/$(E3_MODULE_MAKEFILE) $(E3_MODULE_SRC_PATH)/
71+
$(QUIET) install -m 644 $(TOP)/dkms/dkms.conf $(E3_MODULE_SRC_PATH)/
72+
73+
74+
.PHONY: dkms_add dkms_remove dkms_build dkms_install dkms_uninstall
75+
76+
dkms_add: conf
77+
sudo -E bash -c 'ln -sf $(TOP)/$(E3_MODULE_SRC_PATH) /usr/src/$(E3_MODULE_NAME)-$(E3_MODULE_VERSION)'
78+
$(QUIET) sudo -E bash -c '$(E3_MODULE_MAKE_CMDS) dkms_add'
79+
80+
dkms_remove: conf
81+
$(QUIET) sudo -E bash -c '$(E3_MODULE_MAKE_CMDS) dkms_remove'
82+
83+
dkms_build:
84+
$(QUIET) sudo -E bash -c '$(E3_MODULE_MAKE_CMDS) dkms_build'
85+
86+
dkms_install:
87+
$(QUIET) sudo -E bash -c '$(E3_MODULE_MAKE_CMDS) dkms_install'
88+
89+
dkms_uninstall:
90+
$(QUIET) sudo -E bash -c '$(E3_MODULE_MAKE_CMDS) dkms_uninstall'
91+
7092

7193

7294
.PHONY: setup

configure/RELEASE

Lines changed: 0 additions & 8 deletions
This file was deleted.

dkms/dkms.conf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
PACKAGE_NAME="etherlabmaster"
2+
PACKAGE_VERSION="1.5.2"
3+
4+
5+
BUILT_MODULE_NAME[0]="master/ec_master"
6+
DEST_MODULE_NAME[0]="ec_master"
7+
DEST_MODULE_LOCATION[0]="/updates/dkms"
8+
9+
AUTOINSTALL=yes
10+
11+
MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build modules"
12+
CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"
13+
14+
15+
BUILT_MODULE_NAME[1]="devices/ec_generic"
16+
DEST_MODULE_NAME[1]="ec_generic"
17+
DEST_MODULE_LOCATION[1]="/updates/dkms"
18+
19+
BUILT_MODULE_NAME[2]="examples/mini/ec_mini"
20+
DEST_MODULE_NAME[2]="ec_mini"
21+
DEST_MODULE_LOCATION[2]="/updates/dkms"
22+
23+
REMAKE_INITRD=yes

etherlabmaster.Makefile

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@
1515
# this program. If not, see https://www.gnu.org/licenses/gpl-2.0.txt
1616
#
1717
#
18-
# Author : jhlee
19-
# email : jhlee@esss.se
20-
# Date : generated by 2018May22-1613-30CEST
21-
# version : 0.0.0
18+
# Author : Jeong Han Lee
19+
# email : jeonghan.lee@gmail.com
20+
# Date : Wednesday, July 25 23:31:31 CEST 2018
21+
# version : 0.0.1
2222
#
23-
# template file is generated by ./create_e3_modules.bash with 31f0fe0
24-
# Please look at many other _module_.Makefile in e3-* repository
25-
#
2623

24+
DKMS:=/usr/sbin/dkms
2725

2826

2927
autoconf:
@@ -45,6 +43,7 @@ uninstall:
4543
make uninstall
4644

4745

46+
4847
modules:
4948
make modules
5049

@@ -53,10 +52,27 @@ modules_install:
5352
make modules_install
5453
depmod --quick
5554

55+
dkms_build:
56+
$(DKMS) build -m $(E3_MODULE_NAME) -v $(E3_MODULE_VERSION)
57+
58+
dkms_add:
59+
$(DKMS) add -m $(E3_MODULE_NAME) -v $(E3_MODULE_VERSION)
60+
61+
dkms_remove:
62+
$(DKMS) remove -m $(E3_MODULE_NAME) -v $(E3_MODULE_VERSION) --all
63+
64+
65+
dkms_install:
66+
$(DKMS) install -m $(E3_MODULE_NAME) -v $(E3_MODULE_VERSION)
67+
depmod
68+
69+
dkms_uninstall:
70+
$(DKMS) uninstall -m $(E3_MODULE_NAME) -v $(E3_MODULE_VERSION)
71+
depmod
5672

5773
clean:
5874
make clean
5975

6076

61-
.PHONY: autoconf build install uninstall modules modules_install clean
77+
.PHONY: autoconf build install uninstall modules modules_install modules_uninstall clean
6278

patch/Site/HISTORY.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,12 @@ This patch allows us to use the installed etherlab master configuration in a loc
55

66
* created by Jeong Han Lee, han.lee@esss.se
77
* Thursday, May 24 11:51:52 CEST 2018
8+
9+
10+
# after_dkms_service_patch.p0.patch
11+
12+
The dkms.service demon should be run before the ethercat.service will be started.
13+
14+
```
15+
etherlabmaster-code (master)$ hg diff script/ethercat.service.in > ../patch/Site/after_dkms_service_patch.p0.patch
16+
```

patch/Site/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ $hg diff script/ethercatctl.in > ../use_prefix_for_ethercat_conf_path.p0.patch
2222
```
2323
And remove a/b in user_prefix_for_ethercat_conf_path.p0.patch manually.
2424

25+
26+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff -r 9e65f782e8a1 script/ethercat.service.in
2+
--- script/ethercat.service.in Tue Feb 13 17:16:01 2018 +0100
3+
+++ script/ethercat.service.in Fri Jul 27 00:04:00 2018 +0200
4+
@@ -9,8 +9,10 @@
5+
# Uncomment this, if the generic Ethernet driver is used. It assures, that the
6+
# network interfaces are configured, before the master starts.
7+
#
8+
-#Requires=network.service # Stop master, if network is stopped
9+
-#After=network.service # Start master, after network is ready
10+
+# Stop ethercat.service, if dkms.service is stopped
11+
+Requires=dkms.service
12+
+# Start ethercat.service, after dkms.service is ready
13+
+After=dkms.service
14+
15+
#
16+
# Uncomment this, if a native Ethernet driver is used. It assures, that the

scripts/dkms.service

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=Builds and install new kernel modules through DKMS
3+
Documentation=man:dkms(8)
4+
5+
[Service]
6+
Type=oneshot
7+
RemainAfterExit=true
8+
ExecStart=/bin/sh -c 'dkms autoinstall --verbose --kernelver $(uname -r)'
9+
10+
[Install]
11+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)