From d901cea1d5692f33b4bde140ed16ec468d675ac8 Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Sat, 21 Jan 2017 16:37:41 +0100 Subject: [PATCH] pcmciautils: import from oldpackages -import from oldpackages -add PKG_LICENSE, PKG_LICENSE_FILES, PKG_MAINTAINER -add two build fix patches Signed-off-by: Tomasz Maciej Nowak --- utils/pcmciautils/Makefile | 57 +++++++++++++++++++ .../files/etc/hotplug.d/pcmcia/pcmcia.agent | 28 +++++++++ .../pcmcia_socket/pcmcia_socket.agent | 18 ++++++ utils/pcmciautils/files/etc/init.d/pcmcia | 25 ++++++++ .../files/etc/init.d/pcmcia_socket | 19 +++++++ .../patches/001-switch_unsigned.patch | 11 ++++ .../patches/002-disable_yywrap.patch | 27 +++++++++ 7 files changed, 185 insertions(+) create mode 100644 utils/pcmciautils/Makefile create mode 100644 utils/pcmciautils/files/etc/hotplug.d/pcmcia/pcmcia.agent create mode 100644 utils/pcmciautils/files/etc/hotplug.d/pcmcia_socket/pcmcia_socket.agent create mode 100755 utils/pcmciautils/files/etc/init.d/pcmcia create mode 100755 utils/pcmciautils/files/etc/init.d/pcmcia_socket create mode 100644 utils/pcmciautils/patches/001-switch_unsigned.patch create mode 100644 utils/pcmciautils/patches/002-disable_yywrap.patch diff --git a/utils/pcmciautils/Makefile b/utils/pcmciautils/Makefile new file mode 100644 index 000000000..00adca620 --- /dev/null +++ b/utils/pcmciautils/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2008-2017 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=pcmciautils +PKG_VERSION:=018 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@KERNEL/linux/utils/kernel/pcmcia +PKG_MD5SUM:=5d85669b3440baa4532363da6caaf1b4 + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING +PKG_MAINATINER:=Tomasz Maciej Nowak + +include $(INCLUDE_DIR)/package.mk + +define Package/pcmciautils + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libsysfs @PCMCIA_SUPPORT + TITLE:=PCMCIA Utilities + URL:=http://www.kernel.org/pub/linux/utils/kernel/pcmcia/pcmcia.html +endef + +define Build/Compile + $(call Build/Compile/Default, \ + LD="$(TARGET_CC)" UDEV=false \ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) \ + -DPCMCIAUTILS_VERSION=\\\"$(PKG_VERSION)\\\"" \ + prefix=/usr all \ + ) +endef + +define Package/pcmciautils/install + $(INSTALL_DIR) $(1)/usr/sbin/ + $(CP) $(PKG_BUILD_DIR)/pccardctl $(1)/usr/sbin/ + $(CP) $(PKG_BUILD_DIR)/pcmcia-check-broken-cis $(1)/usr/sbin/ + $(CP) $(PKG_BUILD_DIR)/pcmcia-socket-startup $(1)/usr/sbin/ + rm -f $(1)/usr/sbin/lspcmcia + ln -s pccardctl $(1)/usr/sbin/lspcmcia + $(INSTALL_DIR) $(1)/etc/pcmcia/ + $(CP) $(PKG_BUILD_DIR)/config/config.opts $(1)/etc/pcmcia/ + $(CP) files/* $(1)/ +endef + +define Package/pcmciautils/conffiles +/etc/pcmcia/config.opts +endef + +$(eval $(call BuildPackage,pcmciautils)) diff --git a/utils/pcmciautils/files/etc/hotplug.d/pcmcia/pcmcia.agent b/utils/pcmciautils/files/etc/hotplug.d/pcmcia/pcmcia.agent new file mode 100644 index 000000000..537c50a7c --- /dev/null +++ b/utils/pcmciautils/files/etc/hotplug.d/pcmcia/pcmcia.agent @@ -0,0 +1,28 @@ +#!/bin/sh +# Copyright (C) 2008 OpenWrt.org + +case "$ACTION" in + add) + SYSFS=/sys/bus/pcmcia/devices/ + DEVPATH=$SOCKET_NO.$((0x$DEVICE_NO)) + + # check whether the CIS is completely broken + if [ ! -h $SYSFS$DEVPATH/driver ]; then + CISFILE=$(/usr/sbin/pcmcia-check-broken-cis $SOCKET_NO) + echo PCMCIA: $CISFILE; + if [ ! -z $CISFILE ]; then + if [ -f /lib/firmware/$CISFILE ]; then + cat /lib/firmware/$CISFILE > $SYSFS/class/pcmcia_socket/pcmcia_socket$(SOCKET_NO)/cis + fi; + fi; + fi; + + # allow a match solely based on the "function ID" field + if [ ! -h $SYSFS$DEVPATH/driver ]; then + if [ -w $SYSFS$DEVPATH/allow_func_id_match ]; then + echo PCMCIA: allowing func_id based match for PCMCIA device $SOCKET_NO.$DEVICE_NO + echo -n "42" > $SYSFS$DEVPATH/allow_func_id_match; + fi; + fi; + ;; +esac diff --git a/utils/pcmciautils/files/etc/hotplug.d/pcmcia_socket/pcmcia_socket.agent b/utils/pcmciautils/files/etc/hotplug.d/pcmcia_socket/pcmcia_socket.agent new file mode 100644 index 000000000..79b35244f --- /dev/null +++ b/utils/pcmciautils/files/etc/hotplug.d/pcmcia_socket/pcmcia_socket.agent @@ -0,0 +1,18 @@ +#!/bin/sh +# Copyright (C) 2008 OpenWrt.org + +case "$ACTION" in + add) + echo PCMCIA: socket number: $SOCKET_NO + + sleep 1; + /usr/sbin/pcmcia-socket-startup $SOCKET_NO + DONE_FILE=/sys/class/pcmcia_socket/pcmcia_socket$SOCKET_NO/available_resources_setup_done + if [ -f $DONE_FILE ]; then + if [ -w $DONE_FILE ]; then + echo -n "42" > $DONE_FILE + fi; + fi; + ;; + +esac diff --git a/utils/pcmciautils/files/etc/init.d/pcmcia b/utils/pcmciautils/files/etc/init.d/pcmcia new file mode 100755 index 000000000..16f227636 --- /dev/null +++ b/utils/pcmciautils/files/etc/init.d/pcmcia @@ -0,0 +1,25 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008 OpenWrt.org + +START=42 +start() { + if [ -d /sys/bus/pcmcia/devices/ ]; then + # 2.6 kernels + cd /sys/bus/pcmcia/devices/ + for PCMCIA_DEVICE in *; do + if [ $PCMCIA_DEVICE == \* ]; then + continue; + fi; + MODALIAS=$(cat $PCMCIA_DEVICE/modalias) + echo PCMCIA: $MODALIAS $PCMCIA_DEVICE + if [ -z $MODALIAS ]; then + continue; + fi; + ACTION=add + SOCKET_NO=$(echo $PCMCIA_DEVICE | cut -d. -f1) + DEVICE_NO=$(echo $MODALIAS | sed 's/.*pfn\(..\).*/\1/') + export MODALIAS ACTION SOCKET_NO DEVICE_NO + /sbin/hotplug-call pcmcia + done; + fi; +} diff --git a/utils/pcmciautils/files/etc/init.d/pcmcia_socket b/utils/pcmciautils/files/etc/init.d/pcmcia_socket new file mode 100755 index 000000000..fdd0b8c37 --- /dev/null +++ b/utils/pcmciautils/files/etc/init.d/pcmcia_socket @@ -0,0 +1,19 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008 OpenWrt.org + +START=41 +start() { + if [ -d /sys/class/pcmcia_socket/ ]; then + # 2.6 kernels + cd /sys/class/pcmcia_socket/ + for PCMCIA_SOCKET in *; do + if [ $PCMCIA_SOCKET == \* ]; then + continue; + fi; + SOCKET_NO=$(echo $PCMCIA_SOCKET | cut -b14-) + ACTION=add + export SOCKET_NO ACTION + /sbin/hotplug-call pcmcia_socket + done; + fi; +} diff --git a/utils/pcmciautils/patches/001-switch_unsigned.patch b/utils/pcmciautils/patches/001-switch_unsigned.patch new file mode 100644 index 000000000..8a1559cd9 --- /dev/null +++ b/utils/pcmciautils/patches/001-switch_unsigned.patch @@ -0,0 +1,11 @@ +--- a/src/yacc_config.y ++++ b/src/yacc_config.y +@@ -40,7 +40,7 @@ + + %union { + char *str; +- u_long num; ++ unsigned long num; + struct adjust_list_t *adjust; + } + diff --git a/utils/pcmciautils/patches/002-disable_yywrap.patch b/utils/pcmciautils/patches/002-disable_yywrap.patch new file mode 100644 index 000000000..e30abb0d1 --- /dev/null +++ b/utils/pcmciautils/patches/002-disable_yywrap.patch @@ -0,0 +1,27 @@ +--- pcmciautils-018/src/lex_config.l ++++ pcmciautils-018/src/lex_config.l +@@ -1,8 +1,8 @@ + /* Special state for handling include files */ + %x src +-%option noinput nounput ++%option noinput nounput noyywrap + + %{ + /* + * Startup tool for non statically mapped PCMCIA sockets + * +@@ -75,14 +75,10 @@ module /* skip */ ; + + . return yytext[0]; + + %% + +-#ifndef yywrap +-int yywrap() { return 1; } +-#endif +- + /*====================================================================== + + Stuff to parse basic data types + + ======================================================================*/