Add dkms configuration

This commit is contained in:
Richard Hacker
2026-07-24 13:52:31 +02:00
parent c38c4cbc8e
commit 6615bd5789
+78
View File
@@ -0,0 +1,78 @@
#-----------------------------------------------------------------------------
#
# Copyright (C) 2026 Richard Hacker, Ingenieurgemeinschaft IgH
#
# This file is part of the IgH EtherCAT Master.
#
# The IgH EtherCAT Master is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 2, as
# published by the Free Software Foundation.
#
# The IgH EtherCAT Master 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 the IgH EtherCAT Master; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# vi: syntax=sh
#
#-----------------------------------------------------------------------------
PACKAGE_NAME=ethercat_git
PACKAGE_VERSION=master
AUTOINSTALL=yes
BUILT_MODULE_NAME[0]=ec_master
BUILT_MODULE_LOCATION[0]=master
DEST_MODULE_LOCATION[0]=/kernel/ethercat
declare -A configure module path
kmajorminor=$(cut -d . -f 1,2 <<<"$kernelver")
# enable kmodule path-to-search-for
modules=(
"8139too ec_r8139 devices/8139too-$kmajorminor-ethercat.c"
"ccat ec_ccat devices/ccat/module.c"
"dwmac-intel ec_dwmac-intel devices/stmmac/dwmac-intel-${kmajorminor}-ethercat.c"
"e100 ec_e100 devices/e100-${kmajorminor}-ethercat.c"
"e1000 ec_e1000 devices/e1000/e1000_main-${kmajorminor}-ethercat.c"
"e1000e ec_e1000e devices/e1000e/netdev-${kmajorminor}-ethercat.c"
"generic ec_generic devices/generic.c"
"genet ec_genet devices/genet/bcmgenet-${kmajorminor}-ethercat.c"
"igb ec_igb devices/igb/igb_main-${kmajorminor}-ethercat.c"
"igc ec_igc devices/igc/igc_main-${kmajorminor}-ethercat.c"
"r8169 ec_r8169 devices/r8169-${kmajorminor}-ethercat.c"
"r8169 ec_r8169 devices/r8169/r8169_main-${kmajorminor}-ethercat.c"
"stmmac-pci ec_stmmac-pci devices/stmmac/stmmac_pci-${kmajorminor}-ethercat.c"
)
for i in "${modules[@]}"; do
set $i
enable_flag=$1
module_name=$2
test_path=$3
key=$(tr -d -c '[:alnum:]' <<<"$enable_flag")
if [ -r "$source_tree/$PACKAGE_NAME-$PACKAGE_VERSION/$test_path" ]; then
configure[$key]="--enable-$enable_flag"
module[$key]="$module_name"
path[$key]="${test_path%/*}"
elif [ -v ${configure[$key]} ]; then
configure[$key]=" --disable-$1"
fi
done
idx=${#BUILT_MODULE_NAME[@]}
for k in ${!module[@]}; do
BUILT_MODULE_NAME[$idx]=${module[$k]}
BUILT_MODULE_LOCATION[$idx]=${path[$k]}
DEST_MODULE_LOCATION[$idx]=${DEST_MODULE_LOCATION[0]}
idx=$((idx+1))
done
PRE_BUILD="configure --disable-userlib --disable-tool --disable-examples "\
"--disable-rt-syslog --with-linux-dir=${kernel_source_dir} ${configure[@]}"