This repository has been archived by the owner on Aug 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from jeonghanlee/master
add the dkms support in the mrf kernel module
- Loading branch information
Showing
11 changed files
with
207 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
|
||
# Kernel Module Compile Results | ||
*.mod* | ||
.tmp_versions/ | ||
modules.order | ||
Module.symvers | ||
Mkfile.old | ||
dkms.conf | ||
*~ | ||
core.* | ||
#* | ||
.#* | ||
\#* | ||
|
||
mrfioc2-debug | ||
mrfioc2-dev | ||
dkms/dkms.conf | ||
dkms/dkms_with_msi.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
SUDO2:=sudo -E bash -c | ||
DKMS:=/usr/sbin/dkms | ||
DKMS_ARGS:=-m $(E3_MODULE_NAME) -v $(E3_MODULE_VERSION) | ||
KMOD_NAME := mrf | ||
|
||
.PHONY: dkms_add dkms_build dkms_remove dkms_install dkms_uninstall | ||
|
||
dkms_add: conf | ||
$(MSI) -M name="$(E3_MODULE_NAME)" -M version="$(E3_MODULE_VERSION)" -M kmod_name="$(KMOD_NAME)" $(TOP)/dkms/dkms_with_msi.conf.in > $(TOP)/dkms/dkms_with_msi.conf | ||
$(QUIET) cat $(TOP)/dkms/dkms_with_msi.conf $(TOP)/dkms/dkms_without_msi.conf > $(TOP)/dkms/dkms.conf | ||
$(QUIET) install -m 644 $(TOP)/dkms/dkms.conf $(E3_KMOD_SRC_PATH)/ | ||
$(SUDO2) 'ln -sf $(TOP)/$(E3_KMOD_SRC_PATH) /usr/src/$(E3_MODULE_NAME)-$(E3_MODULE_VERSION)' | ||
$(SUDO) $(DKMS) add $(DKMS_ARGS) | ||
|
||
|
||
dkms_build: | ||
$(SUDO) $(DKMS) build $(DKMS_ARGS) | ||
|
||
|
||
dkms_remove: | ||
$(SUDO) $(DKMS) remove $(E3_MODULE_NAME)/$(E3_MODULE_VERSION) --all | ||
|
||
|
||
dkms_install: | ||
$(SUDO) $(DKMS) install $(DKMS_ARGS) | ||
$(QUIET)$(SUDO) depmod | ||
|
||
dkms_uninstall: | ||
$(SUDO) $(DKMS) uninstall $(DKMS_ARGS) | ||
$(QUIET)$(SUDO) depmod | ||
|
||
.PHONY: dkms_add dkms_build dkms_install dkms_remove dkms_uninstall | ||
|
||
|
||
setup: | ||
$(QUIET) $(SUDO2) 'echo KERNEL==\"uio*\", ATTR{name}==\"mrf-pci\", MODE=\"0666\" | tee /etc/udev/rules.d/99-$(KMOD_NAME)ioc2.rules' | ||
$(QUIET) $(SUDO) /bin/udevadm control --reload-rules | ||
$(QUIET) $(SUDO) /bin/udevadm trigger | ||
$(QUIET) $(SUDO2) 'echo $(KMOD_NAME) | tee /etc/modules-load.d/$(KMOD_NAME).conf' | ||
$(QUIET) $(SUDO) depmod --quick | ||
$(QUIET) $(SUDO) modprobe -rv $(KMOD_NAME) | ||
$(QUIET) $(SUDO) modprobe -v $(KMOD_NAME) | ||
$(QUIET) -ls /dev/uio* 2>/dev/null | ||
|
||
|
||
setup_clean: | ||
$(QUIET) $(SUDO) modprobe -rv $(KMOD_NAME) | ||
$(SUDO) rm -f /etc/modules-load.d/$(KMOD_NAME).conf | ||
$(SUDO) rm -f /etc/udev/rules.d/99-$(KMOD_NAME)ioc2.rules | ||
|
||
|
||
.PHONY: setup setup_clean | ||
|
||
|
||
VARS_EXCLUDES+=KMOD_NAME | ||
VARS_EXCLUDES+=DKMS_ARGS | ||
VARS_EXCLUDES+=DKMS | ||
VARS_EXCLUDES+=SUDO2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=Builds and install new kernel modules through DKMS | ||
Documentation=man:dkms(8) | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=true | ||
ExecStart=/bin/sh -c 'dkms autoinstall --verbose --kernelver $(uname -r)' | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2018 Jeong Han Lee | ||
# | ||
# The program is free software: you can redistribute | ||
# it and/or modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation, either version 2 of the | ||
# License, or any newer version. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program. If not, see https://www.gnu.org/licenses/gpl-2.0.txt | ||
# | ||
# Author : Jeong Han Lee | ||
# email : [email protected] | ||
# Date : Sunday, July 29 01:06:29 CEST 2018 | ||
# version : 0.0.1 | ||
|
||
|
||
declare -gr SC_SCRIPT="$(realpath "$0")" | ||
declare -gr SC_SCRIPTNAME=${0##*/} | ||
declare -gr SC_TOP="${SC_SCRIPT%/*}" | ||
|
||
declare -gr SUDO_CMD="sudo"; | ||
|
||
DKMS_SYSTEMD=dkms.service | ||
SD_UNIT_PATH_DEBIAN=/etc/systemd/system | ||
SD_UNIT_PATH_CENTOS=/usr/lib/systemd/system | ||
|
||
|
||
function find_dist | ||
{ | ||
|
||
local dist_id dist_cn dist_rs PRETTY_NAME | ||
|
||
if [[ -f /usr/bin/lsb_release ]] ; then | ||
dist_id=$(lsb_release -is) | ||
dist_cn=$(lsb_release -cs) | ||
dist_rs=$(lsb_release -rs) | ||
echo $dist_id ${dist_cn} ${dist_rs} | ||
else | ||
eval $(cat /etc/os-release | grep -E "^(PRETTY_NAME)=") | ||
echo ${PRETTY_NAME} | ||
fi | ||
|
||
|
||
} | ||
|
||
|
||
function setup_dkms_systemd | ||
{ | ||
printf ">>> Setup the systemd %s in %s\n" "${DKMS_SYSTEMD}" "${SD_UNIT_PATH}" | ||
|
||
${SUDO_CMD} install -m 644 ${SC_TOP}/${DKMS_SYSTEMD} ${SD_UNIT_PATH}/ | ||
${SUDO_CMD} systemctl daemon-reload; | ||
${SUDO_CMD} systemctl enable ${DKMS_SYSTEMD}; | ||
${SUDO_CMD} systemctl start ${DKMS_SYSTEMD}; | ||
printf "\n" | ||
|
||
} | ||
|
||
|
||
|
||
## Determine CentOS or Debian, because systemd path is different | ||
|
||
dist=$(find_dist) | ||
|
||
case "$dist" in | ||
*Debian*) | ||
SD_UNIT_PATH=${SD_UNIT_PATH_DEBIAN} | ||
;; | ||
*CentOS*) | ||
SD_UNIT_PATH=${SD_UNIT_PATH_CENTOS} | ||
;; | ||
*) | ||
printf "\n"; | ||
printf "Doesn't support the detected $dist\n"; | ||
printf "Please contact [email protected]\n"; | ||
printf "\n"; | ||
exit; | ||
;; | ||
esac | ||
|
||
${SUDO_CMD} -v | ||
|
||
# Setup Systemd for the DKMS autoinstall | ||
# dkms.sevice will be started before ethercat.service be started. | ||
setup_dkms_systemd | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PACKAGE_NAME="$(name)" | ||
PACKAGE_VERSION="$(version)" | ||
|
||
BUILT_MODULE_NAME[0]="$(kmod_name)" | ||
DEST_MODULE_NAME[0]="$(kmod_name)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
DEST_MODULE_LOCATION[0]="/updates/dkms" | ||
|
||
AUTOINSTALL=yes | ||
|
||
MAKE[0]="make -C ${kernel_source_dir=${kernel_source}} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build modules" | ||
CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters