diff options
-rw-r--r-- | .SRCINFO | 31 | ||||
-rw-r--r-- | 0000a-advman.systemd.patch | 224 | ||||
-rw-r--r-- | 0000b-advman.systemd.patch | 220 | ||||
-rw-r--r-- | 0000c-advman.systemd.patch | 203 | ||||
-rw-r--r-- | 0003a-gcc-10-duplicate-variables-vc_mon-stk_mon.patch | 77 | ||||
-rw-r--r-- | 0004a-adv_main-proc_create_data-kernel-5.6.patch | 32 | ||||
-rw-r--r-- | 0005-kernel-5.17-change-PDE_DATA.patch | 17 | ||||
-rw-r--r-- | 0006-kernel-6.0-set_termios-const-ktermios.patch | 19 | ||||
-rw-r--r-- | PKGBUILD | 129 |
9 files changed, 916 insertions, 36 deletions
@@ -1,13 +1,12 @@ pkgbase = advantech-vcom pkgdesc = tty driver for Advantech Adam EKI serial console terminal servers - pkgver = 2.2.1 - pkgrel = 4 + pkgver = 2.3.0 + pkgrel = 1 url = http://www.advantech.com/intelligent-connectivity/ install = advantech-vcom-install.sh arch = i686 arch = x86_64 license = GPL - makedepends = unrar depends = glibc depends = gawk depends = psmisc @@ -16,26 +15,42 @@ pkgbase = advantech-vcom depends = linux depends = dkms depends = linux-headers - noextract = vcom_linux_2.2.1.rar backup = etc/advttyd.conf - source = vcom_linux_2.2.1.rar::http://advdownload.advantech.com/productfile/Downloadfile5/1-1NOKMCV/vcom_linux_2.2.1.tar.bz2 + source = vcom_linux_2.3.0.tar.bz2::https://advdownload.advantech.com/productfile/Downloadfile3/1-250ZNM3/vcom_linux_2.3.0.tar.bz2 source = 0000-advman.systemd.patch + source = 0000a-advman.systemd.patch + source = 0000b-advman.systemd.patch + source = 0000c-advman.systemd.patch source = 0001-adv_main-access_ok_kernel-5-0.patch source = 0002-adv_mmap-vm_fault_t-5-1.patch source = 0003-gcc-10-duplicate-variables-vc_mon-stk_mon.patch + source = 0003a-gcc-10-duplicate-variables-vc_mon-stk_mon.patch source = 0004-adv_main-proc_create_data-kernel-5.6.patch - md5sums = 6a32b5ceb5a4dccc919462a61b7c228c + source = 0005-kernel-5.17-change-PDE_DATA.patch + source = 0006-kernel-6.0-set_termios-const-ktermios.patch + md5sums = a3f195545fa67310e754e682bf2414de md5sums = 65bb3f58bf90650cd629b94057c80da5 + md5sums = e8e05eebaa36ccf7bfe456ab59b75386 + md5sums = cf730b084619fac9c20106e8e6359ccc + md5sums = 8e10c250ba777d270285e0bf79d44a1d md5sums = 6b07ea60f898b5586ad8f23a28c32ab7 md5sums = b30212f45f0dcebc9b88b17e4355d298 md5sums = 0aa930803ed243f4e45f0d31bde581c8 + md5sums = 2cf8ab9c5541c38eba5fb9687142d94d md5sums = 446602b4feef554ade9a137303883432 - sha256sums = 98e670d7ab0b67c5ca1d7c61ffffdbf812e2bcc2680d408b749ae4f36f1c46d7 + md5sums = 32f3a081b5926d6ea7f1cd2a22655d95 + md5sums = b005fdd5de28f835b7b37ecd74453785 + sha256sums = 47d49391ad6863face08ec3129b65fa10e53c9849c10a45a7f0abb394f7ddafc sha256sums = 02f504a23fbef07f666aaa595faba0513d9ffec5e99ebca7b7fe2299a0179e32 + sha256sums = 17fa883aeaea5821e00ead10777f54f4ad6b96f3a2f07097e3d9a77755f21c10 + sha256sums = 85785f80c7be4452e5b620b5d405646f0e9bacdbec2aecea68a059b6245519aa + sha256sums = 1959411a50b800def13849672196295db3acb4aabd1db9fbc5cc52ebf390993c sha256sums = 9335cfe8addfdf80224d21529fe0a70a6b750fa0823cfe806f5c94ae50a06cad sha256sums = 77edc7a806085fc738fa4536e91fce98fb8e103f8207ec0d395f340107e83d0c sha256sums = 61c4b0c92488cce93e6b9ffca4f13eb7aa7fd8b267eb1438094ce41d96aaef53 + sha256sums = de3477551219d9fc5b1924775a4456155ef5beb5bd702fbc114ca0c956607953 sha256sums = aa71ede3478a5b482cd085ed2406a1ccd6be3b3ef76ab1fc0b45f4133d3c5a59 + sha256sums = b65adbcbb83a21cf0a1c17b9bc2a039ad5c633021ecd90d88d5d978a03a59c23 + sha256sums = 99b7b7a2c84d8b82a3e79b2a7abe99d1696a7ff3df350560d96ce7f049e8cb27 pkgname = advantech-vcom - diff --git a/0000a-advman.systemd.patch b/0000a-advman.systemd.patch new file mode 100644 index 000000000000..1adb7d424705 --- /dev/null +++ b/0000a-advman.systemd.patch @@ -0,0 +1,224 @@ +diff -pNaru10 a/script/advman b/script/advman +--- a/script/advman 2023-01-04 01:50:39.287161354 -0500 ++++ b/script/advman 2023-01-04 01:51:33.067094078 -0500 +@@ -1,147 +1,35 @@ + #!/bin/bash + + set -u + if [ "${EUID}" -ne 0 ]; then + echo "Must be root" + exit 1 + fi + +-COMMAND=0 +-SCRIPT=$0 +-INSTALLPATH=/usr/share/advtty +-DEAMON=advttyd +-SERVICE=vcomd +-DRIVER=advvcom +-SSLPROXY=advsslvcom +-CONFIGFILE=/etc/advttyd.conf +-DEAMONFILE=$INSTALLPATH/$DEAMON +-#DKMSFILE=/lib/modules/`uname -r`/updates/dkms/$DRIVER.ko +-#KERNEL=`uname -r|cut -c1-3` +-if false # [ $KERNEL = "2.4" ] +-then +-DRIVERFILE=$INSTALLPATH/$DRIVER.o +-else +-DRIVERFILE=$DRIVER +-fi +- +-RETURN= + OBJECTIVE= + +-hasdriver() +-{ +- COUNT=`lsmod | grep $DRIVER -c` +- if [ $COUNT -gt 0 ] +- then +- echo "kernel moduel $DRIVER.ko detected..." +- RETURN=1 +- else +- echo "kernel moduel $DRIVER.ko not installed... try objective \"insert\" first" +- RETURN=0 +- fi +-} +- +-insdriver() +-{ +- if false # [ $KERNEL = "2.4" ] +- then +- echo "inserting kernel moduel $DRIVER.o..." +- modprobe $DRIVERFILE +- elif false # [ -e $DKMSFILE ] +- then +- echo "inserting DKMS module $DRIVER.ko..." +- modprobe $DKMSFILE +- else +- echo "inserting kernel moduel $DRIVER.ko..." +- modprobe $DRIVERFILE +- fi +-} +- +-rmdriver() +-{ +- if false # [ $KERNEL = "2.4" ] +- then +- echo "removing kernel moduel $DRIVER..." +- rmmod $DRIVER +- else +- echo "removing kernel moduel $DRIVER.ko..." +- rmmod $DRIVER.ko +- fi +-} +- +-stopService() +-{ +- echo "stoping all local services..." +- killall -s 9 $SERVICE +-} +- +-startDeamon() +-{ +- # for 2.4.x kernel, we should make node by myself +- if false # [ $KERNEL = "2.4" ] +- then +- i=1 +- while [[ $i -le 256 ]] +- do +- if [ -z $(awk '$2=="vttyAP"{print $1}' /proc/devices) ] +- then +- mknod /dev/vttyAP$i c $(awk '$2=="vttyap/%d"{print $1}' /proc/devices) $i +- else +- mknod /dev/vttyAP$i c $(awk '$2=="vttyAP"{print $1}' /proc/devices) $i +- fi +- ((i = i + 1)) +- done +- fi +- echo "invoking local deamon..." +- install -m 700 -oroot -groot -d /tmp/advmon +- #`$DEAMONFILE` +- $DEAMONFILE +- +-} +- +-stopDeamon() +-{ +-# COUNT=`ps -A|grep $DEAMON -c` +-# while [ $COUNT -gt 0 ] +-# do +-# PID=`ps -A|grep $DEAMON |sed -r s/^[[:space:]]*//g|sed -r s/"[[:space:]]+.+[[:space:]]+[[:digit:]]+:[[:digit:]]+:[[:digit:]]+[[:space:]]+$DEAMON"/""/g | sed '/^[ \t]*$/d'|head -n 1` +-# +-# echo "killing $DEAMON $PID" +-# +-# kill -9 $PID +-# COUNT=`ps -A|grep $DEAMON -c` +-# done +- killall -s 9 $DEAMON +- if false # [ $KERNEL = "2.4" ] +- then +- rm -rf /dev/vttyAP* +- fi +- +- killall -s 9 $SSLPROXY +-} +- +- + usage() + { + cat << EOF + usage: $0 options + + This script lists helps you manage local advtty service. + + OPTIONS: + -h Show this message + -o Execute objective: + start - start advtty local service + stop - stop advtty local service + restart - restart advtty local service +- insert - insert $DRIVER.ko module +- remove - remove $DRIVER.ko module ++ insert - insert module ++ remove - remove module + + Example: + $0 -o start + $0 -o restart + $0 -o stop + + EOF + } + + while getopts 'ho:' OPTION +@@ -156,61 +44,43 @@ do + ;; + ?) + usage + exit + ;; + esac + done + + case $OBJECTIVE in + start) +- hasdriver +- if [ $RETURN -eq 1 ] +- then +- echo "starting service...." +- startDeamon +- else +- echo "installing driver & start service..." +- insdriver +- startDeamon +- fi ++ systemctl start 'advtty-vcom.service' + # systemd-notify --ready + exit 0 + ;; + restart) +- hasdriver +- if [ $RETURN -eq 1 ] +- then +- echo "starting service...." +- startDeamon +- else +- echo "can not start service..." +- insdriver +- startDeamon +- fi ++ systemctl reload 'advtty-vcom.service' + # systemd-notify --ready + exit 0 + + ;; + stop) +- echo stop +- stopService +- stopDeamon ++ systemctl stop 'advtty-vcom.service' + # systemd-notify --ready + exit 0 + ;; + insert) +- insdriver ++ modprobe 'advvcom' + # systemd-notify --ready + exit 0 + ;; + remove) +- stopService +- stopDeamon +- rmdriver ++ systemctl stop 'advtty-vcom.service' + # systemd-notify --ready + exit 0 + ;; ++ *) ++ usage ++ exit 1 ++ ;; + esac + usage + + diff --git a/0000b-advman.systemd.patch b/0000b-advman.systemd.patch new file mode 100644 index 000000000000..4fef9e0431a2 --- /dev/null +++ b/0000b-advman.systemd.patch @@ -0,0 +1,220 @@ +diff -pNaru10 a/script/advman b/script/advman +--- a/script/advman 2023-01-04 01:54:06.896867183 -0500 ++++ b/script/advman 2023-01-04 01:55:04.966770369 -0500 +@@ -1,148 +1,35 @@ + #!/bin/bash + + set -u + if [ "${EUID}" -ne 0 ]; then + echo "Must be root" + exit 1 + fi + +-COMMAND=0 +-SCRIPT=$0 +-INSTALLPATH=/usr/share/advtty +-DEAMON=advttyd +-SERVICE=vcomd +-DRIVER=advvcom +-SSLPROXY=advsslvcom +-CONFIGFILE=/etc/advttyd.conf +-DEAMONFILE=$INSTALLPATH/$DEAMON +-#DKMSFILE=/lib/modules/`uname -r`/updates/dkms/$DRIVER.ko +-#KERNEL=`uname -r|cut -c1-3` +-if false # [ $KERNEL = "2.4" ] +-then +-DRIVERFILE=$INSTALLPATH/$DRIVER.o +-else +-DRIVERFILE=$DRIVER +-fi +- +-RETURN= + OBJECTIVE= + +-hasdriver() +-{ +- COUNT=`lsmod | grep $DRIVER -c` +- if [ $COUNT -gt 0 ] +- then +- echo "kernel moduel $DRIVER.ko detected..." +- RETURN=1 +- else +- echo "kernel moduel $DRIVER.ko not installed... try objective \"insert\" first" +- RETURN=0 +- fi +-} +- +-insdriver() +-{ +- if false # [ $KERNEL = "2.4" ] +- then +- echo "inserting kernel moduel $DRIVER.o ..." +- modprobe $DRIVERFILE +- elif [ -e $DRIVERFILE ] +- then +- echo "inserting kernel module $DRIVER.ko ..." +- modprobe $DRIVERFILE +- else +- echo "inserting DKMS moduel $DRIVER ..." +- modprobe $DRIVER +- fi +-} +- +-rmdriver() +-{ +- if false # [ $KERNEL = "2.4" ] +- then +- echo "removing kernel moduel $DRIVER..." +- rmmod $DRIVER +- else +- echo "removing kernel moduel $DRIVER.ko..." +- rmmod $DRIVER.ko +- fi +-} +- +-stopService() +-{ +- echo "stoping all local services..." +- killall -s 9 $SERVICE +-} +- +-startDeamon() +-{ +- # for 2.4.x kernel, we should make node by myself +- if false # [ $KERNEL = "2.4" ] +- then +- i=1 +- while [[ $i -le 256 ]] +- do +- if [ -z $(awk '$2=="vttyAP"{print $1}' /proc/devices) ] +- then +- mknod /dev/vttyAP$i c $(awk '$2=="vttyap/%d"{print $1}' /proc/devices) $i +- else +- mknod /dev/vttyAP$i c $(awk '$2=="vttyAP"{print $1}' /proc/devices) $i +- fi +- ((i = i + 1)) +- done +- fi +- echo "invoking local deamon..." +- install -m 700 -oroot -groot -d /tmp/advmon +- install -m 777 -d /tmp/advsslmsg +- #`$DEAMONFILE` +- $DEAMONFILE +- +-} +- +-stopDeamon() +-{ +-# COUNT=`ps -A|grep $DEAMON -c` +-# while [ $COUNT -gt 0 ] +-# do +-# PID=`ps -A|grep $DEAMON |sed -r s/^[[:space:]]*//g|sed -r s/"[[:space:]]+.+[[:space:]]+[[:digit:]]+:[[:digit:]]+:[[:digit:]]+[[:space:]]+$DEAMON"/""/g | sed '/^[ \t]*$/d'|head -n 1` +-# +-# echo "killing $DEAMON $PID" +-# +-# kill -9 $PID +-# COUNT=`ps -A|grep $DEAMON -c` +-# done +- killall -s 9 $DEAMON +- if false # [ $KERNEL = "2.4" ] +- then +- rm -rf /dev/vttyAP* +- fi +- +- killall -s 9 $SSLPROXY +-} +- +- + usage() + { + cat << EOF + usage: $0 options + + This script lists helps you manage local advtty service. + + OPTIONS: + -h Show this message + -o Execute objective: + start - start advtty local service + stop - stop advtty local service + restart - restart advtty local service +- insert - insert $DRIVER.ko module +- remove - remove $DRIVER.ko module ++ insert - insert module ++ remove - remove module + + Example: + $0 -o start + $0 -o restart + $0 -o stop + + EOF + } + + while getopts 'ho:' OPTION +@@ -157,56 +44,38 @@ do + ;; + ?) + usage + exit + ;; + esac + done + + case $OBJECTIVE in + start) +- hasdriver +- if [ $RETURN -eq 1 ] +- then +- echo "starting service...." +- startDeamon +- else +- echo "installing driver & start service..." +- insdriver +- startDeamon +- fi ++ systemctl start 'advtty-vcom.service' + exit 0 + ;; + restart) +- hasdriver +- if [ $RETURN -eq 1 ] +- then +- echo "starting service...." +- startDeamon +- else +- echo "can not start service..." +- insdriver +- startDeamon +- fi ++ systemctl reload 'advtty-vcom.service' + exit 0 + + ;; + stop) +- echo stop +- stopService +- stopDeamon ++ systemctl stop 'advtty-vcom.service' + exit 0 + ;; + insert) +- insdriver ++ modprobe 'advvcom' + exit 0 + ;; + remove) +- stopService +- stopDeamon +- rmdriver ++ systemctl stop 'advtty-vcom.service' + exit 0 + ;; ++ *) ++ usage ++ exit 1 ++ ;; + esac + usage + + diff --git a/0000c-advman.systemd.patch b/0000c-advman.systemd.patch new file mode 100644 index 000000000000..4b0fd62363cd --- /dev/null +++ b/0000c-advman.systemd.patch @@ -0,0 +1,203 @@ +diff -pNaru10 a/script/advman b/script/advman +--- a/script/advman 2023-01-04 00:01:44.519381965 -0500 ++++ b/script/advman 2023-01-04 00:05:51.579295372 -0500 +@@ -1,134 +1,35 @@ + #!/bin/bash + + set -u + if [ "${EUID}" -ne 0 ]; then + echo "Must be root" + exit 1 + fi + +-COMMAND=0 +-SCRIPT=$0 +-INSTALLPATH=/usr/share/advtty +-DEAMON=advttyd +-SERVICE=vcomd +-DRIVER=advvcom +-CONFIGFILE=/etc/advttyd.conf +-DEAMONFILE=$INSTALLPATH/$DEAMON +-#DKMSFILE=/lib/modules/$(uname -r)/updates/dkms/$DRIVER.ko +-#KERNEL=$(uname -r|cut -c1-3) +-if false # [ $KERNEL = "2.4" ] +-then +-DRIVERFILE=$INSTALLPATH/$DRIVER.o +-else +-DRIVERFILE=$DRIVER +-fi +- +-RETURN= + OBJECTIVE= + +-hasdriver() +-{ +- COUNT=$(lsmod | grep $DRIVER -c) +- if [ $COUNT -gt 0 ] +- then +- echo "kernel moduel $DRIVER.ko detected..." +- RETURN=1 +- else +- echo "kernel moduel $DRIVER.ko not installed... try objective \"insert\" first" +- RETURN=0 +- fi +-} +- +-insdriver() +-{ +- if false # [ $KERNEL = "2.4" ] +- then +- echo "inserting kernel moduel $DRIVER.o ..." +- modprobe $DRIVERFILE +- elif [ -e $DRIVERFILE ] +- then +- echo "inserting kernel module $DRIVER.ko ..." +- modprobe $DRIVERFILE +- else +- echo "inserting DKMS moduel $DRIVER ..." +- modprobe $DRIVER +- fi +-} +- +-rmdriver() +-{ +- if false # [ $KERNEL = "2.4" ] +- then +- echo "removing kernel moduel $DRIVER..." +- rmmod $DRIVER +- else +- echo "removing kernel moduel $DRIVER.ko..." +- rmmod $DRIVER.ko +- fi +-} +- +-stopService() +-{ +- echo "stoping all local services..." +- killall -s 9 $SERVICE +-} +- +-startDeamon() +-{ +- # for 2.4.x kernel, we should make node by myself +- if false # [ $KERNEL = "2.4" ] +- then +- i=1 +- while [[ $i -le 256 ]] +- do +- if [ -z $(awk '$2=="vttyAP"{print $1}' /proc/devices) ] +- then +- mknod /dev/vttyAP$i c $(awk '$2=="vttyap/%d"{print $1}' /proc/devices) $i +- else +- mknod /dev/vttyAP$i c $(awk '$2=="vttyAP"{print $1}' /proc/devices) $i +- fi +- ((i = i + 1)) +- done +- fi +- echo "invoking local deamon..." +- install -m 700 -oroot -groot -d /tmp/advmon +- $DEAMONFILE -d -w ${INSTALLPATH} +- +-} +- +-stopDeamon() +-{ +-# killall -s 9 $DEAMON +- if false # [ $KERNEL = "2.4" ] +- then +- rm -rf /dev/vttyAP* +- fi +- +-} +- +- + usage() + { + cat << EOF + usage: $0 options + + This script lists helps you manage local advtty service. + + OPTIONS: + -h Show this message + -o Execute objective: + start - start advtty local service + stop - stop advtty local service + restart - restart advtty local service +- insert - insert $DRIVER.ko module +- remove - remove $DRIVER.ko module ++ insert - insert module ++ remove - remove module + + Example: + $0 -o start + $0 -o restart + $0 -o stop + + EOF + } + + while getopts 'ho:' OPTION +@@ -143,57 +44,34 @@ do + ;; + ?) + usage + exit + ;; + esac + done + + case $OBJECTIVE in + start) +- hasdriver +- if [ $RETURN -eq 1 ] +- then +- echo "starting service...." +- startDeamon +- else +- echo "installing driver & start service..." +- insdriver +- startDeamon +- fi ++ systemctl start 'advtty-vcom.service' + exit 0 + ;; + restart) +- hasdriver +- if [ $RETURN -eq 1 ] +- then +- stopService +- echo "starting service...." +- startDeamon +- else +- echo "can not start service..." +- insdriver +- startDeamon +- fi ++ systemctl reload 'advtty-vcom.service' + exit 0 + + ;; + stop) +- echo stop +- stopService +- stopDeamon ++ systemctl stop 'advtty-vcom.service' + exit 0 + ;; + insert) +- insdriver ++ modprobe 'advvcom' + exit 0 + ;; + remove) +- stopService +- stopDeamon +- rmdriver ++ systemctl stop 'advtty-vcom.service' + exit 0 + ;; + esac + usage + + diff --git a/0003a-gcc-10-duplicate-variables-vc_mon-stk_mon.patch b/0003a-gcc-10-duplicate-variables-vc_mon-stk_mon.patch new file mode 100644 index 000000000000..6c557dc6d30f --- /dev/null +++ b/0003a-gcc-10-duplicate-variables-vc_mon-stk_mon.patch @@ -0,0 +1,77 @@ +diff -pNarZu5 a/daemon/vcom_client.c b/daemon/vcom_client.c +--- a/daemon/vcom_client.c 2021-09-10 02:47:19.000000000 -0400 ++++ b/daemon/vcom_client.c 2023-01-03 23:58:24.161930421 -0500 +@@ -46,11 +46,12 @@ static vc_ssl_cfg m_sslcfg; + #endif + //#include "vcom_debug.h" + + #define RBUF_SIZE 4096 + +-extern void * stk_mon; ++/*extern*/ void * stk_mon; ++struct vc_monitor vc_mon; + + static int recv_second_chance(int sock, char * buf, int buflen) + { + int ret; + struct timeval tv; +diff -pNarZu5 a/daemon/vcom.h b/daemon/vcom.h +--- a/daemon/vcom.h 2021-09-10 02:47:19.000000000 -0400 ++++ b/daemon/vcom.h 2023-01-03 23:58:09.428532325 -0500 +@@ -126,10 +126,11 @@ static inline struct vc_ops * stk_curnt( + #define INO_PUSH_SWITCH 0 + #define INO_POP_SWITCH 0 + #define INO_RPLS_SWITCH 0 + #define INO_RESTART_SWITCH 0 + ++extern + void * stk_mon; + + + static inline int _stk_log(struct stk_vc *stk, char * __form, ...) + { +diff -pNarZu5 a/daemon/vcom_monitor_dbg.h b/daemon/vcom_monitor_dbg.h +--- a/daemon/vcom_monitor_dbg.h 2021-09-10 02:47:19.000000000 -0400 ++++ b/daemon/vcom_monitor_dbg.h 2023-01-03 23:58:09.428532325 -0500 +@@ -31,10 +31,11 @@ struct vc_monitor{ + int pid; + int max_statl; + int dbg_first; + char fname[FNAME_LEN]; + }; ++extern + struct vc_monitor vc_mon; + + static inline int mon_init(char * fname) + { + vc_mon.fd = -1; +diff -pNarZu5 a/daemon/vcom_monitor.h b/daemon/vcom_monitor.h +--- a/daemon/vcom_monitor.h 2021-09-10 02:47:19.000000000 -0400 ++++ b/daemon/vcom_monitor.h 2023-01-03 23:58:09.428532325 -0500 +@@ -28,10 +28,11 @@ struct vc_monitor{ + int fd; + int pid; + int msgl; + char fname[FNAME_LEN]; + }; ++extern + struct vc_monitor vc_mon; + + static inline int mon_init(char * fname) + { + vc_mon.fd = -1; +diff -pNarZu5 a/daemon/vcom_monitor_pre_stat.h b/daemon/vcom_monitor_pre_stat.h +--- a/daemon/vcom_monitor_pre_stat.h 2021-09-10 02:47:19.000000000 -0400 ++++ b/daemon/vcom_monitor_pre_stat.h 2023-01-03 23:58:09.428532325 -0500 +@@ -28,10 +28,11 @@ struct vc_monitor{ + int pid; + int msgl; + char pre_stat[16]; + char fname[FNAME_LEN]; + }; ++extern + struct vc_monitor vc_mon; + + static inline int mon_init(char * fname) + { + vc_mon.fd = -1; diff --git a/0004a-adv_main-proc_create_data-kernel-5.6.patch b/0004a-adv_main-proc_create_data-kernel-5.6.patch new file mode 100644 index 000000000000..66894950c3e0 --- /dev/null +++ b/0004a-adv_main-proc_create_data-kernel-5.6.patch @@ -0,0 +1,32 @@ +diff -pNarZu5 a/driver/adv_main.c b/driver/adv_main.c +--- a/driver/adv_main.c 2020-08-13 23:29:32.000000000 -0400 ++++ b/driver/adv_main.c 2023-01-04 01:41:43.090626566 -0500 +@@ -259,18 +259,28 @@ unsigned int adv_proc_poll(struct file * + return mask; + } + + extern int adv_proc_mmap(struct file *filp, struct vm_area_struct *vma); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) ++static const struct proc_ops adv_proc_fops = { ++ .proc_open = adv_proc_open, ++ .proc_release = adv_proc_release, ++ .proc_mmap = adv_proc_mmap, ++ .proc_ioctl = adv_proc_ioctl, ++ .proc_poll = adv_proc_poll, ++}; ++#else + static const struct file_operations adv_proc_fops = { + .owner = THIS_MODULE, + .open = adv_proc_open, + .release = adv_proc_release, + .mmap = adv_proc_mmap, + .unlocked_ioctl = adv_proc_ioctl, + .poll = adv_proc_poll, + }; ++#endif + + + void adv_main_interrupt(struct adv_vcom * data, int mask) + { + if(mask & ADV_INT_RX){ diff --git a/0005-kernel-5.17-change-PDE_DATA.patch b/0005-kernel-5.17-change-PDE_DATA.patch new file mode 100644 index 000000000000..77ded76a4ae1 --- /dev/null +++ b/0005-kernel-5.17-change-PDE_DATA.patch @@ -0,0 +1,17 @@ +diff -pNarZu5 a/driver/adv_main.c b/driver/adv_main.c +--- a/driver/adv_main.c 2023-01-04 00:57:59.078747397 -0500 ++++ b/driver/adv_main.c 2023-01-04 00:58:20.872024158 -0500 +@@ -193,10 +193,13 @@ long adv_proc_ioctl(struct file *filp, u + + int adv_proc_open(struct inode *inode, struct file *filp) + { + struct adv_vcom * data; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) ++#define PDE_DATA pde_data ++#endif + data = PDE_DATA(inode); + filp->private_data = data; + + return 0; + } diff --git a/0006-kernel-6.0-set_termios-const-ktermios.patch b/0006-kernel-6.0-set_termios-const-ktermios.patch new file mode 100644 index 000000000000..3ce73ccdf5a5 --- /dev/null +++ b/0006-kernel-6.0-set_termios-const-ktermios.patch @@ -0,0 +1,19 @@ +diff -pNarZu2 a/driver/adv_uart.c b/driver/adv_uart.c +--- a/driver/adv_uart.c 2018-11-14 11:29:12.000000000 -0500 ++++ b/driver/adv_uart.c 2023-01-04 01:06:59.669401278 -0500 +@@ -397,4 +397,7 @@ int adv_uart_startup(struct uart_port *p + } + ++#ifndef LINUX_VERSION_CODE ++#include <linux/version.h> ++#endif + static void adv_uart_shutdown(struct uart_port *port) + { +@@ -415,4 +418,7 @@ static void adv_uart_shutdown(struct uar + static void + adv_uart_set_termios(struct uart_port *port, struct ktermios *termios, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0) ++const ++#endif + struct ktermios *old) + { @@ -51,6 +51,8 @@ _opt_MAXINSTPORTS=16 # Maximum install ports. # Uninstall cleanup: sudo rm -f /etc/advttyd.conf* /var/log/advttyd.log +_opt_RAR=0 + set -u # Earlier versions of Advantech TTY were called ICOM # http://advdownload.advantech.com/productfile/Downloadfile1/1-NZ17GY/ICOM_LINUX_PSEUDO_TTY_DRIVER_V1.4.1.ZIP @@ -58,8 +60,11 @@ pkgname='advantech-vcom' #pkgver='2.0.0'; _dl='4/1-X92NP4' #pkgver='2.1.0'; _dl='4/1-15OSOW4' #pkgver='2.2.0'; _dl='4/1-1LPJPGD' -pkgver='2.2.1'; _dl='5/1-1NOKMCV' # not compatible with Linux 3.16 -pkgrel='4' +#pkgver='2.2.1'; _dl='5/1-1NOKMCV'; _opt_RAR=1 # not compatible with Linux 3.16, a RAR file +#pkgver='2.2.3'; _dl='5/1-1Y9Q0Z6' # bugs from new SSL code +#pkgver='2.2.5'; _dl='4/1-23X5L51' # bugs and hangs +pkgver='2.3.0'; _dl='3/1-250ZNM3' # non functional +pkgrel='1' pkgdesc='tty driver for Advantech Adam EKI serial console terminal servers' _pkgdescshort="Advantech ${pkgname} TTY driver" arch=('i686' 'x86_64') @@ -70,32 +75,53 @@ backup=('etc/advttyd.conf') install="${pkgname}-install.sh" _srcdir="VCOM_LINUX_${pkgver}.TAR.BZ2" _srcdir="${_srcdir,,}" -_srcrar="${_srcdir//.tar.bz2/.rar}" -source=("${_srcrar}::http://advdownload.advantech.com/productfile/Downloadfile${_dl}/${_srcdir}") # a .RAR file now +source=("${_srcdir}::https://advdownload.advantech.com/productfile/Downloadfile${_dl}/${_srcdir}") +if [ "${_opt_RAR}" -ne 0 ]; then + _srcrar="${_srcdir//.tar.bz2/.rar}" + noextract=("${_srcrar}") # the RAR crashes bsdtar. Parsing filters is unsupported. + makedepends+=('unrar') + source[0]="${_srcrar}::${source[0]##*::}" +fi #source=("${_srcdir,,}::http://downloadt.advantech.com/download/downloadsr.aspx?File_Id=${_dl}") # redirect works sooner but can be changed arbitrairly _srcdir="${_srcdir%\.tar*}" #source=("http://advdownload.advantech.com/productfile/Downloadfile4/${_dl}/${_srcdir}.rar") source+=( '0000-advman.systemd.patch' + '0000a-advman.systemd.patch' + '0000b-advman.systemd.patch' + '0000c-advman.systemd.patch' '0001-adv_main-access_ok_kernel-5-0.patch' '0002-adv_mmap-vm_fault_t-5-1.patch' '0003-gcc-10-duplicate-variables-vc_mon-stk_mon.patch' + '0003a-gcc-10-duplicate-variables-vc_mon-stk_mon.patch' '0004-adv_main-proc_create_data-kernel-5.6.patch' + '0005-kernel-5.17-change-PDE_DATA.patch' + '0006-kernel-6.0-set_termios-const-ktermios.patch' ) -noextract=("${_srcrar}") # the RAR crashes bsdtar. Parsing filters is unsupported. -md5sums=('6a32b5ceb5a4dccc919462a61b7c228c' +md5sums=('a3f195545fa67310e754e682bf2414de' '65bb3f58bf90650cd629b94057c80da5' + 'e8e05eebaa36ccf7bfe456ab59b75386' + 'cf730b084619fac9c20106e8e6359ccc' + '8e10c250ba777d270285e0bf79d44a1d' '6b07ea60f898b5586ad8f23a28c32ab7' 'b30212f45f0dcebc9b88b17e4355d298' '0aa930803ed243f4e45f0d31bde581c8' - '446602b4feef554ade9a137303883432') -sha256sums=('98e670d7ab0b67c5ca1d7c61ffffdbf812e2bcc2680d408b749ae4f36f1c46d7' + '2cf8ab9c5541c38eba5fb9687142d94d' + '446602b4feef554ade9a137303883432' + '32f3a081b5926d6ea7f1cd2a22655d95' + 'b005fdd5de28f835b7b37ecd74453785') +sha256sums=('47d49391ad6863face08ec3129b65fa10e53c9849c10a45a7f0abb394f7ddafc' '02f504a23fbef07f666aaa595faba0513d9ffec5e99ebca7b7fe2299a0179e32' + '17fa883aeaea5821e00ead10777f54f4ad6b96f3a2f07097e3d9a77755f21c10' + '85785f80c7be4452e5b620b5d405646f0e9bacdbec2aecea68a059b6245519aa' + '1959411a50b800def13849672196295db3acb4aabd1db9fbc5cc52ebf390993c' '9335cfe8addfdf80224d21529fe0a70a6b750fa0823cfe806f5c94ae50a06cad' '77edc7a806085fc738fa4536e91fce98fb8e103f8207ec0d395f340107e83d0c' '61c4b0c92488cce93e6b9ffca4f13eb7aa7fd8b267eb1438094ce41d96aaef53' - 'aa71ede3478a5b482cd085ed2406a1ccd6be3b3ef76ab1fc0b45f4133d3c5a59') -makedepends+=('unrar') + 'de3477551219d9fc5b1924775a4456155ef5beb5bd702fbc114ca0c956607953' + 'aa71ede3478a5b482cd085ed2406a1ccd6be3b3ef76ab1fc0b45f4133d3c5a59' + 'b65adbcbb83a21cf0a1c17b9bc2a039ad5c633021ecd90d88d5d978a03a59c23' + '99b7b7a2c84d8b82a3e79b2a7abe99d1696a7ff3df350560d96ce7f049e8cb27') if [ "${_opt_DKMS}" -ne 0 ]; then depends+=('linux' 'dkms' 'linux-headers') @@ -105,24 +131,50 @@ fi prepare() { set -u - unrar x "${_srcrar}" + if [ "${_opt_RAR}" -ne 0 ]; then + unrar x "${_srcrar}" + fi + if :; then + rm -r "${_srcdir}/driver" + mv 'vcom_linux_2.2.5/driver' "${_srcdir}" + fi + cd "${_srcdir}" - #cp -p driver/adv_main.c{,.orig}; false - #diff -pNau5 driver/adv_main.c{.orig,} > '../0001-adv_main-access_ok_kernel-5-0.patch' - patch -Nbup0 -i "${srcdir}/0001-adv_main-access_ok_kernel-5-0.patch" + if [ "$(vercmp "${pkgver}" "2.2.1")" -le 0 ]; then + #cp -p driver/adv_main.c{,.orig}; false + #diff -pNau5 driver/adv_main.c{.orig,} > '../0001-adv_main-access_ok_kernel-5-0.patch' + patch -Nup0 -i "${srcdir}/0001-adv_main-access_ok_kernel-5-0.patch" + + #cp -p driver/adv_mmap.c{,.orig}; false + #diff -pNau5 driver/adv_mmap.c{.orig,} > '../0002-adv_mmap-vm_fault_t-5-1.patch' + patch -Nup0 -i "${srcdir}/0002-adv_mmap-vm_fault_t-5-1.patch" - #cp -p driver/adv_mmap.c{,.orig}; false - #diff -pNau5 driver/adv_mmap.c{.orig,} > '../0002-adv_mmap-vm_fault_t-5-1.patch' - patch -Nbup0 -i "${srcdir}/0002-adv_mmap-vm_fault_t-5-1.patch" + fi + if [ "$(vercmp "${pkgver}" "2.2.5")" -le 0 ]; then + #cp -pr daemon{,.orig}; false + #diff -pNarZu5 daemon{.orig,} > '../0003-gcc-10-duplicate-variables-vc_mon-stk_mon.patch' + patch -Nup0 -i "${srcdir}/0003-gcc-10-duplicate-variables-vc_mon-stk_mon.patch" + else + #cd '..'; cp -pr "${_srcdir}" 'a'; ln -s "${_srcdir}" 'b'; false + #diff -pNarZu5 'a' 'b' > '0003a-gcc-10-duplicate-variables-vc_mon-stk_mon.patch' + patch -Nup1 -i "${srcdir}/0003a-gcc-10-duplicate-variables-vc_mon-stk_mon.patch" + fi + if [ "$(vercmp "${pkgver}" "2.2.3")" -le 0 ]; then + #cp -p driver/adv_main.c{,.orig}; false + #diff -pNau5 driver/adv_main.c{.orig,} > '../0004-adv_main-proc_create_data-kernel-5.6.patch' + patch -Nup0 -i "${srcdir}/0004-adv_main-proc_create_data-kernel-5.6.patch" + fi - #cp -pr daemon{,.orig}; false - #diff -pNarZu5 daemon{.orig,} > '../0003-gcc-10-duplicate-variables-vc_mon-stk_mon.patch' - patch -Nbup0 -i "${srcdir}/0003-gcc-10-duplicate-variables-vc_mon-stk_mon.patch" + if :; then + #cd '..'; cp -pr "${_srcdir}" 'a'; ln -s "${_srcdir}" 'b'; false + #diff -pNarZu5 'a' 'b' > '0005-kernel-5.17-change-PDE_DATA.patch' + patch -Nup1 -i "${srcdir}/0005-kernel-5.17-change-PDE_DATA.patch" - #cp -p driver/adv_main.c{,.orig}; false - #diff -pNau5 driver/adv_main.c{.orig,} > '../0004-adv_main-proc_create_data-kernel-5.6.patch' - patch -Nbup0 -i "${srcdir}/0004-adv_main-proc_create_data-kernel-5.6.patch" + #cd '..'; cp -pr "${_srcdir}" 'a'; ln -s "${_srcdir}" 'b'; false + #diff -pNarZu2 'a' 'b' > '0006-kernel-6.0-set_termios-const-ktermios.patch' + patch -Nup1 -i "${srcdir}/0006-kernel-6.0-set_termios-const-ktermios.patch" + fi # Cosmetic correction of CRLF for Linux sed -e 's:\r$::g' -i 'readme.txt' @@ -230,10 +282,24 @@ fi # Make a less noisy start/stop to not clog up the systemd logs sed -e 's@^\(\s*\)echo@\1: # echo@g' 'script/advman' > 'script/advman.quiet' - # Change original advman to systemd - #cp -p script/advman{,.orig}; false - #diff -pNau10 script/advman{.orig,} > '../0000-advman.systemd.patch' - patch -Nbup0 -i "${srcdir}/0000-advman.systemd.patch" || : + if [ "$(vercmp "${pkgver}" "2.2.1")" -le 0 ]; then + # Change original advman to systemd + #cp -p script/advman{,.orig}; false + #diff -pNau10 script/advman{.orig,} > '../0000-advman.systemd.patch' + patch -Nup0 -i "${srcdir}/0000-advman.systemd.patch" + elif [ "$(vercmp "${pkgver}" "2.2.3")" -le 0 ]; then + #cd '..'; cp -pr "${_srcdir}" 'a'; ln -s "${_srcdir}" 'b'; false + #diff -pNaru10 'a' 'b' > '0000a-advman.systemd.patch' + patch -Nup1 -i "${srcdir}/0000a-advman.systemd.patch" + elif [ "$(vercmp "${pkgver}" "2.2.5")" -le 0 ]; then + #cd '..'; cp -pr "${_srcdir}" 'a'; ln -s "${_srcdir}" 'b'; false + #diff -pNaru10 'a' 'b' > '0000b-advman.systemd.patch' + patch -Nup1 -i "${srcdir}/0000b-advman.systemd.patch" + elif [ "$(vercmp "${pkgver}" "2.3.0")" -le 0 ]; then + #cd '..'; cp -pr "${_srcdir}" 'a'; ln -s "${_srcdir}" 'b'; false + #diff -pNaru10 'a' 'b' > '0000c-advman.systemd.patch' + patch -Nup1 -i "${srcdir}/0000c-advman.systemd.patch" + fi # Tame the port count sed -e 's:^\(#define VCOM_PORTS\)\s.*$:'"\1 ${_opt_MAXINSTPORTS}:g" -i 'driver/advconf.h' @@ -243,6 +309,12 @@ fi # The compiled files should not have been included 'ma'ke -s -j1 clean # keep git-aurcheck quiet + + find -type 'f' -name '*.orig' -delete + + if [ "${pkgver}" = '2.2.3' ] || [ "${pkgver}" = '2.2.5' ]; then + sed -e 's:-Werror::g' -i $(grep --include='Makefile' -rle '-Werror' .) + fi set +u } @@ -328,7 +400,8 @@ DEST_MODULE_LOCATION[0]="/kernel/drivers/misc" EOF ) "${_dkms}/dkms.conf" - install -Dm644 driver/* -t "${_dkms}/driver/" + install -d "${_dkms}/driver/" + cp -pr driver/* "${_dkms}/driver/" make -C "${_dkms}/driver/" clean rm "${_dkms}/driver/dkms.conf" sed -e '# No DKMS instructions say to do this but it works and keeps the MAKE line real simple' \ |