Fixes to compile pcmcia-cs under Linux 2.5.x

Pavel Roskin proski at gnu.org
Mon Apr 14 20:04:13 BST 2003


Hello!

To compile pcmcia-cs 3.2.4 under Linux 2.5.67-bk5, changes are needed on
both sides of the fence.

Configure from pcmcia-cs shouldn't check the version of insmod if it's not
going to install modules.  The new insmod is so primitive that it doesn't
understand "-V", so MOD_RELEASE and MOD_CODE become empty, which leads to
an error message:

expr: syntax error
./Configure: line 907: [: 131413: unary operator expected

I also added quotes around MOD_CODE just in case.

On the kernel side, ds.h should not be including linux/device.h when
compiling userspace code.  Otherwise following happens:

In file included from /usr/src/linux/include/linux/device.h:29,
                 from /usr/src/linux/include/pcmcia/ds.h:34,
                 from cardmgr.c:57:
/usr/src/linux/include/linux/list.h:416:2: warning: #warning "don't
include kernel headers in userspace"

Patches are attached.

-- 
Regards,
Pavel Roskin-------------- next part --------------
--- include/pcmcia/ds.h
+++ include/pcmcia/ds.h
@@ -31,7 +31,9 @@
 #define _LINUX_DS_H
 
 #include <pcmcia/bulkmem.h>
+#ifdef __KERNEL__
 #include <linux/device.h>
+#endif
 #include <pcmcia/cs_types.h>
 
 typedef struct tuple_parse_t {
-------------- next part --------------
--- Configure
+++ Configure
@@ -884,30 +884,34 @@
 
 # Check out the module stuff
 
-if [ ! -x /sbin/insmod -o ! -x /sbin/rmmod -o ! -x /sbin/lsmod ] ; then
-    echo "Your module utilities (insmod, rmmod) are missing from /sbin!"
-    echo "    To fix, you should build and install the latest set" \
-         "of module tools,"
-    echo "    available from FTP sites listed in the HOWTO."
-    fail
-fi
-
-MOD_RELEASE=`/sbin/insmod -V 2>&1 | \
-    sed -n -e 's/.*[Vv]ersion \([0-9][0-9.]*[0-9]\).*/\1/p'`
-X=`echo $MOD_RELEASE | sed -e 's/\./ /g'`
-MOD_CODE=`version $X`
-if [ $VERSION_CODE -ge `version 2 1 85` ] ; then
-    NEED=`version 2 1 85` ; T=2.1.85
-elif [ $VERSION_CODE -ge `version 2 1 18` ] ; then
-    NEED=`version 2 1 23` ; T=2.1.23
-else
-    NEED=`version 2 0 0` ; T=2.0.0
-fi
+if [ "$CONFIG_PCMCIA" != "y" ] ; then
+
+    if [ ! -x /sbin/insmod -o ! -x /sbin/rmmod -o ! -x /sbin/lsmod ] ; then
+	echo "Your module utilities (insmod, rmmod) are missing from /sbin!"
+	echo "    To fix, you should build and install the latest set" \
+	     "of module tools,"
+	echo "    available from FTP sites listed in the HOWTO."
+	fail
+    fi
+
+    MOD_RELEASE=`/sbin/insmod -V 2>&1 | \
+	sed -n -e 's/.*[Vv]ersion \([0-9][0-9.]*[0-9]\).*/\1/p'`
+    X=`echo $MOD_RELEASE | sed -e 's/\./ /g'`
+    MOD_CODE=`version $X`
+    if [ $VERSION_CODE -ge `version 2 1 85` ] ; then
+	NEED=`version 2 1 85` ; T=2.1.85
+    elif [ $VERSION_CODE -ge `version 2 1 18` ] ; then
+	NEED=`version 2 1 23` ; T=2.1.23
+    else
+	NEED=`version 2 0 0` ; T=2.0.0
+    fi
+
+    if [ "$NEED" -gt "$MOD_CODE" ] ; then
+	echo "Your module utilities are version $MOD_RELEASE.  That is too old"
+	echo "    for this kernel!  To fix, upgrade to at least version $T."
+	fail
+    fi
 
-if [ $NEED -gt $MOD_CODE ] ; then
-    echo "Your module utilities are version $MOD_RELEASE.  That is too old"
-    echo "    for this kernel!  To fix, upgrade to at least version $T."
-    fail
 fi
 
 #=======================================================================


More information about the linux-pcmcia mailing list