summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Severance2017-07-27 20:32:05 -0400
committerChris Severance2017-07-27 20:32:05 -0400
commitbcb135fa4bfeadb5d15abe62eb2dd873dea3141a (patch)
tree4b8fc2dd99f45f67fb257c4909a0abab886bcc1a
downloadaur-bcb135fa4bfeadb5d15abe62eb2dd873dea3141a.tar.gz
Initial Import
-rw-r--r--.SRCINFO26
-rw-r--r--PKGBUILD319
-rw-r--r--perle-serial-install.sh50
3 files changed, 395 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..dfcc0a8a8a6
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,26 @@
+# Generated by mksrcinfo v8
+# Tue Jul 25 02:10:46 UTC 2017
+pkgbase = perle-serial
+ pkgdesc = kernel module driver for Perle UltraPort SI Express PCI-RAS modem SPEED LE multi I/O serial parallel RS-232 422 485 port
+ pkgver = 3.9.0_14
+ pkgrel = 1
+ url = http://downloads.comtrol.com/html/RPuPCI_drivers.htm
+ install = perle-serial-install.sh
+ arch = i686
+ arch = x86_64
+ license = GPL
+ makedepends = gzip
+ makedepends = findutils
+ makedepends = sed
+ makedepends = diffutils
+ makedepends = patch
+ depends = awk
+ depends = linux
+ depends = dkms
+ depends = linux-headers
+ backup = etc/perle-serial-setultrap.sh
+ source = https://www.perle.com//downloads/drivers/ultraport/linux/perle-serial-3.9.0-14.tgz
+ sha256sums = 7ded341fe93f76fc5d607a3888ac0407e78c9165ad8fb297ec9e375269e72f8b
+
+pkgname = perle-serial
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..2dade02fd96
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,319 @@
+# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com
+
+_opt_DKMS=1 # This can be toggled between installs
+_opt_PARALLEL=0 # 0 for SPEED without parallel port, 1 to enable parallel support
+
+# See /etc/perle-serial-setultrap.sh for persistent port modes
+
+# Perle Ultraport 1 2 4 8 8i 16
+# Perle PCI-RAS 4 8
+# Perle Ultraport 1 2 4 8 16 SI Exar
+# Perle Ultraport Express 1 2 4 8 8i
+# Perle SPEED LE 1 2 4 8 Oxford 95x, not supported by built in kernel drivers
+# Perle SPEED LE1P
+# Perle SPEED LE1P Express
+
+# ls -l /dev/ttyPS*
+# lsmod | grep perle
+# lspci -v | grep -A4 -i perle
+
+# dmesg | grep -A8 -i perle
+#[ 6188.852357] Perle Systems Limited - Parallel Port Driver: version 3.9.0 date: 2013-04-15, time: 19:04:11
+#[ 6188.855676] Perle Serial driver version 3.9.0 (2013-04-11) with SHARE_IRQ SERIAL_PCI enabled
+#[ 6188.856613] ttyPS0 at iomem 0xffffc90003143000 (irq = 18) is a 16C950/2/4
+#[ 6188.856629] ttyPS1 at iomem 0xffffc90003145200 (irq = 18) is a 16C950/2/4
+#[ 6188.856644] ttyPS2 at iomem 0xffffc90003147400 (irq = 18) is a 16C950/2/4
+#[ 6188.856660] ttyPS3 at iomem 0xffffc900032e3600 (irq = 18) is a 16C950/2/4
+
+# A list I found, (-) are not in the source files and are unlikely to be supported by this driver.
+#http://deviceinbox.com/drivers/812-perle-pci-fast-16-fmc-port-adapter.html
+# My SPEED4 LE 04003170 OXPCIe954-FBAG shows as 155f:b032
+# My SPEED2 LE shows as 155f:b022
+# 10B5:9030 PLX Technology, Inc. PCI9030 32-bit 33MHz PCI <-> IOBus Bridge
+# -10B5:9050 PLX Technology, Inc. PCI <-> IOBus Bridge
+# -11CB:9501 Perle SPEED4+ PCI Adapter
+# -11CB:9511 Perle SPEED2+ PCI Adapter Local Bus
+# 13A8:0152 Exar Corp. XR17C/D152 Dual PCI UART
+# 13A8:0154 Exar Corp. XR17C154 Quad UART
+# 13A8:0158 Exar Corp. XR17C158 Octal UART
+# 1415:9501 Oxford Semiconductor Ltd OX16PCI954 (Quad 16950 UART) function 0 (Uart)
+# -1415:9510 Oxford Semiconductor Ltd OX16PCI954 (Quad 16950 UART) function 1 (Disabled)
+# 1415:9505 OXSEMI OXMPCIe95x
+# 1415:9511 OXSEMI 16PCI95N
+# 1415:9513 OXSEMI OXMPCI952P
+# 1415:9521 OXSEMI 16PCI952
+# 155F:0211 Perle UltraPort2 SI Adapter
+# 155F:0221 Perle UltraPort8 SI Adapter
+# 155F:0231 Perle UltraPort4 SI Adapter
+# 155F:0251 Perle UltraPort8i SI Adapter
+# 155F:0261 Perle UltraPort1 SI Adapter
+# 155F:0311 Perle UltraPort2 Express Adapter Local Bus
+# 155F:0321 Perle UltraPort8 Express Adapter Local Bus
+# 155F:0331 Perle UltraPort4 Express Adapter Local Bus
+# 155F:0351 Perle UltraPort8i Express Adapter
+# 155F:0361 Perle UltraPort1 Express Adapter Local Bus
+# 155F:B001 Perle SPEED1 LE Adapter
+# 155F:B002 Perle SPEED2 LE Adapter Local Bus
+# 155F:B004 Perle SPEED4 LE Adapter Local Bus
+# 155F:B008 Perle SPEED8 LE Adapter
+# 155F:B011 Perle SPEED1 LEV2 - Parallel Port Not Supported
+# 155F:B012 Perle SPEED2 LEV2 - Parallel Port Not Supported
+# 155F:B013 Perle SPEED1 LE1P Parallel Port
+# 155F:B014 Perle SPEED2 LE1P Parallel Port
+# 155F:B015 Perle SPEED LE1P Parallel Port
+# 155F:B021 Perle SPEED1 LE Express Adapter
+# 155F:B022 Perle SPEED2 LE Express - Parallel Port Not Supported
+# 155F:B024 Perle SPEED2 LE1P Express Adapter
+# 155F:B025 Perle SPEED LE1P Express Adapter
+# 155F:B026 Perle SPEED1 LE1P Express Parallel Port
+# 155F:B030 Perle UltraPort1 Express Adapter
+# 155F:B031 Perle UltraPort2 Express Adapter
+# 155F:B032 Perle UltraPort4 Express Adapter
+# 155F:B033 Perle UltraPort8 Express Adapter
+# 155F:B034 Perle UltraPort8i Express Adapter
+
+set -u
+pkgname='perle-serial'
+pkgver='3.9.0_14'
+pkgrel='1'
+pkgdesc='kernel module driver for Perle UltraPort SI Express PCI-RAS modem SPEED LE multi I/O serial parallel RS-232 422 485 port'
+arch=('i686' 'x86_64')
+url='http://downloads.comtrol.com/html/RPuPCI_drivers.htm'
+license=('GPL')
+depends=('awk')
+makedepends=('gzip' 'findutils' 'sed' 'diffutils' 'patch')
+backup=('etc/perle-serial-setultrap.sh')
+install="${pkgname}-install.sh"
+_srcdir="${pkgname}-${pkgver%%_*}"
+source=("https://www.perle.com//downloads/drivers/ultraport/linux/perle-serial-${pkgver//_/-}.tgz")
+sha256sums=('7ded341fe93f76fc5d607a3888ac0407e78c9165ad8fb297ec9e375269e72f8b')
+
+_opt_SERIAL=1 # This is for bug testing dkms only. All cards have serial ports so this should always be enabled.
+
+if [ "${_opt_SERIAL}" -ne 0 ]; then
+ _modulenames+=('perle-serial')
+fi
+if [ "${_opt_PARALLEL}" -ne 0 ]; then
+ _modulenames+=('pparport-pc')
+fi
+
+if [ "${_opt_DKMS}" -ne 0 ]; then
+ depends+=('linux' 'dkms' 'linux-headers')
+else
+ makedepends+=('linux-headers')
+fi
+
+# We can't modify .install but we can stop and force the user to fix it.
+_install_check() {
+ local _ckvar
+ local _ckline
+ local _pkgname="${pkgname}"
+ for _ckvar in _pkgname _modulenames; do
+ _ckline="$(declare -p ${_ckvar} 2>/dev/null)"
+ _ckline="${_ckline#* }"
+ _ckline="${_ckline#* }"
+ _ckline="${_ckline//\[[0-9]\]=/}" # unenumerate arrays
+ _ckline="${_ckline//\"/\'}"
+ if ! grep -q "^${_ckline}"'$' "${startdir}/${install}"; then
+ set +u
+ msg "${install} must be fixed"
+ echo "${_ckline}"
+ false
+ fi
+ done
+}
+
+prepare() {
+ if [ "${_opt_PARALLEL}" -eq 0 ] && [ "${_opt_SERIAL}" -eq 0 ]; then
+ msg 'Disabling both PARALLEL and SERIAL does not make sense'
+ false
+ fi
+ set -u
+ _install_check
+ cd "${_srcdir}"
+
+ # Files unpack with bad permissions
+ find -type 'd' -exec chmod 755 '{}' ';'
+ find -type 'f' -exec chmod 644 '{}' '+'
+ find -type 'f' -name '*.sh' -exec chmod 755 '{}' '+'
+ rm 'querydrivers.sh'
+
+ # Fix for reproducible build. The release date seems more useful than the build date.
+ local _dtm
+ _dtm="$(TZ=UTC stat -c '%y' 'pparport26/pparport_pc.c')" # 2013-04-15 19:04:11.862057600 +0000
+ local _dt="${_dtm%% *}"
+ local _tm="${_dtm#* }"
+ _tm="${_tm%%\.*}"
+ sed -e "s|__DATE__|\"${_dt}\"|g" -e "s|__TIME__|\"${_tm}\"|g" -i 'pparport26/pparport_pc.c'
+
+ # Improve install
+ sed -e 's:lib/:usr/lib/:g' \
+ -e '# Forgot to clean a few things' \
+ -e '/\*\.o\.cmd/ s:^.*$:& *.symvers *.order *.mod.c .*.ko.cmd .*.o.d\n\trm -rf .tmp_versions:g' \
+ -i 'pserial/Makefile' 'pparport26/Makefile'
+ set +u
+}
+
+build() {
+ set -u
+ cd "${_srcdir}"
+ if [ "${_opt_PARALLEL}" -ne 0 ]; then
+ make -C 'pparport26' -s -j1
+ fi
+ if [ "${_opt_SERIAL}" -ne 0 ]; then
+ make -C 'pserial' -s -j1 # too small for parallel make
+ fi
+ set +u
+}
+
+package() {
+ set -u
+ cd "${_srcdir}"
+ if [ "${_opt_DKMS}" -eq 0 ]; then
+ # I don't want Linux version info showing on AUR web. After a few months 'linux<0.0.0' makes it look like an out of date package.
+ local _kernelversionsmall="$(uname -r)"
+ _kernelversionsmall="${_kernelversionsmall%%-*}"
+ _kernelversionsmall="${_kernelversionsmall%\.0}" # trim 4.0.0 -> 4.0, 4.1.0 -> 4.1
+ # prevent the mksrcinfo bash emulator from getting these vars!
+ eval 'conf''licts=("linux>${_kernelversionsmall}" "linux<${_kernelversionsmall}")'
+ eval 'dep''ends+=("linux=${_kernelversionsmall}")'
+ fi
+
+ if [ "${_opt_PARALLEL}" -ne 0 ]; then
+ make -C 'pparport26' -s -j1 DESTDIR="${pkgdir}/" PERLE_DIR="${srcdir}/${_srcdir}" rpm_install
+ fi
+ if [ "${_opt_SERIAL}" -ne 0 ]; then
+ make -C 'pserial' -s -j1 DESTDIR="${pkgdir}/" PERLE_DIR="${srcdir}/${_srcdir}" rpm_install
+ # Cat fight!
+ cat <(cat << EOF
+#!/usr/bin/sh
+
+# Automatically generated by ${pkgname} PKGBUILD from Arch Linux AUR
+# https://aur.archlinux.org/
+EOF
+ ) "${pkgdir}/etc/init.d/rc.setultrap" <(cat << EOF
+
+# These must be the last lines. Put all your Perle control lines above this.
+if [ "\${1:-}" = '--systemd' ]; then
+ systemd-notify --ready
+fi
+EOF
+ ) > "${pkgdir}/etc/perle-serial-setultrap.sh"
+ sed -e 's:/bin/:/usr/bin/:g' -e 's:/usr/usr/:/usr/:g' -i "${pkgdir}/etc/perle-serial-setultrap.sh"
+ chmod 744 "${pkgdir}/etc/perle-serial-setultrap.sh"
+ rm -r "${pkgdir}/UNKONWN" "${pkgdir}/etc/init.d"
+ # Install persistent settings service
+ install -Dm644 <(cat << EOF
+# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR
+# https://aur.archlinux.org/
+
+[Unit]
+Description=Perle multi port serial persistent settings
+After=network.target
+
+[Service]
+Type=notify
+ExecStart=/usr/bin/bash /etc/perle-serial-setultrap.sh --systemd
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
+EOF
+ ) "${pkgdir}/usr/lib/systemd/system/perle-serial-settings.service"
+ fi
+
+ # Relocate misc drivers into tree
+ local _ulm="${pkgdir}/usr/lib/modules/$(uname -r)"
+ if [ "${_opt_SERIAL}" -ne 0 ]; then
+ install -d "${_ulm}/kernel/drivers/tty"
+ mv "${_ulm}/misc/perle-serial.ko" "${_ulm}/kernel/drivers/tty/"
+ fi
+ if [ "${_opt_PARALLEL}" -ne 0 ]; then
+ install -d "${_ulm}/kernel/drivers/parport"
+ mv "${_ulm}/misc/pparport-pc.ko" "${_ulm}/kernel/drivers/parport/"
+ fi
+ rmdir "${_ulm}/misc"
+
+ # The module is in the same folder as DKMS. Compress to a different name to prevent conflict.
+ # When future versions of DKMS compress we'll stop doing this.
+ find "${pkgdir}/usr/lib/modules/" -type 'f' -name '*.ko' -exec 'gzip' '-9' '{}' ';'
+
+ if [ "${_opt_DKMS}" -ne 0 ]; then
+ rm -rf "${pkgdir}/usr/lib/modules/"
+ local _dkms="${pkgdir}/usr/src/${pkgname}-${pkgver}"
+ install -Dm644 <(cat << EOF
+# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR
+# https://aur.archlinux.org/
+
+PACKAGE_NAME="${pkgname}"
+PACKAGE_VERSION="${pkgver}"
+AUTOINSTALL="yes"
+# MAKE[0] is expected to make all modules with an umbrella makefile
+MAKE[0]="make -j1"
+EOF
+ ) "${_dkms}/dkms.conf"
+ install -Dm644 <(cat << EOF
+# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR
+# https://aur.archlinux.org/
+
+modules:
+
+# Arch DKMS appears to not use make clean but it's here anyway just in case it does
+clean:
+
+EOF
+ ) "${_dkms}/Makefile"
+ local _modno=0
+ if [ "${_opt_SERIAL}" -ne 0 ]; then
+ cat >> "${_dkms}/dkms.conf" << EOF
+
+BUILT_MODULE_NAME[${_modno}]="${_modulenames[${_modno}]}"
+BUILT_MODULE_LOCATION[${_modno}]="pserial"
+# The install version is .ko.gz. The DKMS version is .ko. No conflicts.
+DEST_MODULE_LOCATION[${_modno}]="/kernel/drivers/tty"
+EOF
+ _modno=$((_modno+1))
+ cp -pr 'pserial/' "${_dkms}/"
+ sed -e '/modules:/ a make -j1 KERNELRELEASE=$(KERNELRELEASE) -C pserial' -i "${_dkms}/Makefile"
+ sed -e '/clean:/ a make -j1 -C pserial clean' -i "${_dkms}/Makefile"
+ fi
+ if [ "${_opt_PARALLEL}" -ne 0 ]; then
+ cat >> "${_dkms}/dkms.conf" << EOF
+
+BUILT_MODULE_NAME[${_modno}]="${_modulenames[${_modno}]}"
+BUILT_MODULE_LOCATION[${_modno}]="pparport26"
+# The install version is .ko.gz. The DKMS version is .ko. No conflicts.
+DEST_MODULE_LOCATION[${_modno}]="/kernel/drivers/parport"
+EOF
+ _modno=$((_modno+1))
+ cp -pr 'pparport26/' "${_dkms}/"
+ sed -e '/modules:/ a make -j1 KERNELRELEASE=$(KERNELRELEASE) -C pparport26' -i "${_dkms}/Makefile"
+ sed -e '/clean:/ a make -j1 -C pparport26 clean' -i "${_dkms}/Makefile"
+ fi
+ # sed 'a' can't add leading tabs so we add them here. It's also handy because this guarantees tabs not spaces.
+ sed -e 's:^make:\t&:g' -i "${_dkms}/Makefile"
+ sed -e '/^KERNEL_/ s:shell uname -r:shell echo "$(KERNELRELEASE)":g' \
+ -e '# No DKMS instructions say to do this but it works and keeps the MAKE line real simple' \
+ -e 's:shell uname -r:KERNELRELEASE:g' \
+ -e '# DKMS sets KERNELRELEASE which accidentally launches phase 2 of this Makefile' \
+ -e '# Fix by changing the detection var.' \
+ -e '# SUBDIRS makes more sense to me because I can see it in the Makefile!' \
+ -e 's:^ifeq (\$(KERNELRELEASE),):ifeq (\$(SUBDIRS),):g' \
+ -e '# Disable stuff only used for make install' \
+ -e '/^base =/,/^$/ d' \
+ -e '# Disable non kernel utilities' \
+ -e 's:^UTILS:# &:g' \
+ -i "${_dkms}"/*/'Makefile'
+ rm "${_dkms}"/*/*.sh "${_dkms}"/*/rc.*
+ if [ "${_opt_SERIAL}" -ne 0 ]; then
+ make -s -C "${_dkms}/pserial" clean KERNELRELEASE="$(uname -r)"
+ rm "${_dkms}/pserial"/{ps_addports,set_io8_rts,swirl.c} "${_dkms}/pserial"/setultrap.* "${_dkms}/pserial"/osultrap.*
+ fi
+ if [ "${_opt_PARALLEL}" -ne 0 ]; then
+ make -s -C "${_dkms}/pparport26" clean KERNELRELEASE="$(uname -r)"
+ fi
+ fi
+ set +u
+}
+
+set +u
diff --git a/perle-serial-install.sh b/perle-serial-install.sh
new file mode 100644
index 00000000000..773e06f8881
--- /dev/null
+++ b/perle-serial-install.sh
@@ -0,0 +1,50 @@
+_pkgname='perle-serial'
+#_modulenames=('perle-serial' 'pparport-pc')
+_modulenames=('perle-serial')
+#_modulenames=('pparport-pc')
+_service='/usr/lib/systemd/system/perle-serial-settings.service'
+
+post_upgrade() {
+ set -u
+ if [ ! -d "/usr/src/${_pkgname}"-*/ ]; then
+ depmod -a
+ local _modulename
+ for _modulename in "${_modulenames[@]}"; do
+ if ! lsmod | cut -d' ' -f1 | grep -q "^${_modulename}"'$'; then
+ #echo 'Reboot or load now with:'
+ #echo " sudo modprobe '${_modulename}'"
+ modprobe "${_modulename}"
+ fi
+ done
+ fi
+ systemctl daemon-reload
+ set +u
+}
+
+post_install() {
+ set -u
+ post_upgrade
+ if [ -s "${_service}" ]; then
+ systemctl enable 'perle-serial-settings.service'
+ systemctl start 'perle-serial-settings.service'
+ fi
+ set +u
+}
+
+pre_remove() {
+ set -u
+ if [ ! -d "/usr/src/${_pkgname}"-*/ ]; then
+ local _modulename
+ for _modulename in "${_modulenames[@]}"; do
+ rmmod "${_modulename}"
+ done
+ fi
+ if [ -s "${_service}" ]; then
+ systemctl disable 'perle-serial-settings.service'
+ fi
+ set +u
+}
+
+post_remove() {
+ systemctl daemon-reload
+}