LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 05-12-2014, 01:39 AM   #1
cpemmaraju
LQ Newbie
 
Registered: May 2014
Posts: 2

Rep: Reputation: Disabled
insmod inserts the module. but lsmod does not list it. using Plx load module utility.


Hi,

I bought a PLX 9054 bridge based PCI card for some serial communication, (MESA 5i21). I downloaded the Linux PLX SDK, built the drivers for the PLX chip.

PLX has given a module load utility plx_load (attached).

When I try to load the module, the insmod returns a success. But the same module is not listed by lsmod. The Plx_load utility verifies the insertion of the module. The output of the Plx_load is also attached.

I have not encountered such a problem before.

by the way I am using the RHEL 6.4 kernel version 2.6.32.358

The Plx_load is below...
Code:
######################################################
#-----------------------------------------------------------------------------
#
#      File         :  Plx_load
#      Abstract     :  Loads a PLX module
#
#-----------------------------------------------------------------------------


# Remove comment to display script commands as it runs
#set -x


#=============================================================================
# Modify the "export" statement below to set 'PLX_SDK_DIR' to the location
# of the PLX Linux installation path.  Some examples are:
#
#      export PLX_SDK_DIR=/usr/src/PlxSdk
#      export PLX_SDK_DIR=$HOME/PlxSdk
#=============================================================================
if [ "${PLX_SDK_DIR}1" = "1" ]; then

    # Attempt to auto-find PLX directory
    PLX_DIR=PlxSdk
    CWD=`pwd`

    while [ `pwd` != "/" ]; do
        if [ -d $PLX_DIR ]; then
            export PLX_SDK_DIR=`pwd`/$PLX_DIR
            break
        fi
        cd ..
    done

    # Return to original directory
    cd $CWD

    if [ "${PLX_SDK_DIR}1" = "1" ]; then
        # Add environment variable
        export PLX_SDK_DIR=$HOME/PLX_DIR

        echo
        echo "  Note:"
        echo
        echo "      The required environment variable, PLX_SDK_DIR, is not defined"
        echo "      in the environment.  The default value (\"$PLX_SDK_DIR\")"
        echo "      will be used instead.  Please update your environment to override"
        echo "      the default, or modify this script accordingly.  To set an"
        echo "      environment variable, use the \"export\" command as follows:"
        echo
        echo "         export PLX_SDK_DIR=<root of PLX installation>"
        echo
    fi
else
    # Make sure the variable is in the environment, not just a shell variable
    export PLX_SDK_DIR=${PLX_SDK_DIR}
fi


# Verify insmod is found
if [ -f /sbin/insmod ]; then
    InsMod=/sbin/insmod
fi
if [ -f /usr/sbin/insmod ]; then
    InsMod=/usr/sbin/insmod
fi
if [ "$InsMod" = "" ]; then
    echo "ERROR: 'insmod' not found in /sbin or /usr/sbin"
    echo
    exit
fi


# Set directory
PLX_DIR=${PLX_SDK_DIR}

# Set default driver name
plx_drv_name=$1

# Default to non-service driver
bServiceDriver=0

# Store parameters
Param2=$2

# Check for debug version
if [ "$2" = "d" ]; then
    debug=_dbg
    Param2=
fi


# Verify command-line
case "$1" in
    8000n) plx_drv_name=8000_NT  ;;
    8000d) plx_drv_name=8000_DMA ;;
    6000n) plx_drv_name=6000_NT  ;;
    9050)  ;;
    9030)  ;;
    9080)  ;;
    9054)  ;;
    9056)  ;;
    9656)  ;;
    8311)  ;;
    Svc)   bServiceDriver=1 ;;

    *)
    echo
    echo "PLX Linux module load script"
    echo
    echo "  Usage: Plx_load {Driver} [DebugOption]"
    echo
    echo "     Driver      = 8000n      : PLX 8000 NT-mode driver"
    echo "                   8000d      : PLX 8000 DMA Controller driver"
    echo "                   9050       : PLX 9050/9052 driver"
    echo "                   9030       : PLX 9030 driver"
    echo "                   9080       : PLX 9080 driver"
    echo "                   9054       : PLX 9054 driver"
    echo "                   9056       : PLX 9056 driver"
    echo "                   9656       : PLX 9656 driver"
    echo "                   8311       : PLX 8311 driver"
    echo "                   6000n      : PLX 6254/6540/6466 NT-mode driver"
    echo "                   Svc        : PLX PCI/PCIe Service driver"
    echo
    echo "     DebugOption = <none>     : Load Release build of module"
    echo "                   'd'        : Load Debug build of module"
    echo
    echo "  E.g.: Plx_load 9054 d   - Load 9054 module debug version"
    echo "        Plx_load 8000n    - Load 8000 NT module release version"
    echo
    exit
    ;;
esac


# Verify superuser access
if [ `id -u` != 0 ]; then
    echo
    echo "   ***************************************************"
    echo "   * NOTE: You must be superuser, logged in as root, *"
    echo "   *       or have sufficient rights to install      *"
    echo "   *       modules or this script will not work.     *"
    echo "   ***************************************************"
    echo
    echo "    ---- ERROR: Admin rights not detected, halting ----"
    echo
    exit
fi


# Path to the driver nodes
path=/dev/plx

# Registered name of driver
name=Plx$plx_drv_name

# Name of module
module=$name$debug

# Probe for a loaded conflicting driver
drv_Name=`lsmod | awk "\\$1==\"$name\" {print \\$1}"`
if [ "$drv_Name" = "" ]; then
    drv_Name=`lsmod | awk "\\$1==\"${name}_dbg\" {print \\$1}"`
fi


# Install the module
# echo
# echo "   *****************************************************************"
# echo "   *  NOTE: A warning regarding 'kernel tainting' is normal. This  *"
# echo "   *  is because the PLX driver is marked with a 'Proprietary'     *"
# echo "   *  license tag & not GPL.  For more information, refer to:      *"
# echo "   *        http://www.tux.org/lkml/#export-tainted                *"
# echo "   *****************************************************************"
echo
echo Install: $module

echo -n "  Load module......... "
# Check if conflicting driver already loaded
if [ "$drv_Name" != "" ]; then
    echo "ERROR: '$drv_Name' conflicts & already loaded"
    echo
    exit
fi

# Verify driver file exists
if [ ! -f $PLX_DIR/Driver/$name/$module.ko ]; then
    echo "ERROR: Driver not built or invalid path"
    echo "         \-- File: $PLX_DIR/Driver/$name/$module.ko"
    echo
    exit
fi

# Load module
if $InsMod $PLX_DIR/Driver/$name/$module.ko $Param2 $3 $4 $5 $6 $7 2>/dev/null; then
    echo "Ok ($module.ko)"
else
    echo ERROR: Load error or no supported devices found
    if [ "$1" = "8000n" ]; then
        echo "   -- NOTE: 8000_NT driver is only for PLX switch Non-Transparent(NT) ports --"
    fi
    echo
    exit
fi

# Verify driver loaded
echo -n "  Verify load......... "
drv_Name=`lsmod | awk "\\$1==\"$module\" {print \\$1}"`
if [ "$drv_Name" = "" ]; then
    echo ERROR: \'$module\' not detected
    echo
    exit
fi
echo Ok

# Get the major number
echo -n "  Get major number.... "
major=`cat /proc/devices | awk "\\$2==\"$name\" {print \\$1}"`

# Check if valid
if [ "$major" = "" ]; then
    echo ERROR: Module major number not detected
    echo
    exit
fi

# Display Major ID
echo "Ok (MajorID = $major)"

# Create the device node path
echo -n "  Create node path.... "
if [ -d $path ]; then
    echo "Ok ($path already exists)"
else
    mkdir $path
    chmod 0777 $path
    echo "Ok ($path)"
fi

# Create the device nodes
echo -n "  Create nodes........ "
rm -f $path/$name*
mknod $path/$name c $major 255

# Create additional nodes for non-service driver
if [ "$bServiceDriver" = "0" ]; then
    mknod ${path}/$name-0  c $major 0
    mknod ${path}/$name-1  c $major 1
    mknod ${path}/$name-2  c $major 2
    mknod ${path}/$name-3  c $major 3
    mknod ${path}/$name-4  c $major 4
    mknod ${path}/$name-5  c $major 5
    mknod ${path}/$name-6  c $major 6
    mknod ${path}/$name-7  c $major 7
    mknod ${path}/$name-8  c $major 8
    mknod ${path}/$name-9  c $major 9
    mknod ${path}/$name-10 c $major 10
    mknod ${path}/$name-11 c $major 11
    mknod ${path}/$name-12 c $major 12
    mknod ${path}/$name-13 c $major 13
    mknod ${path}/$name-14 c $major 14
    mknod ${path}/$name-15 c $major 15
    mknod ${path}/$name-16 c $major 16
fi

chmod 777 $path/*
echo "Ok ($path/$name)"
echo
#####################################################
THE ERRONEOUS OUTPUT I AM GETTING
#####################################################
[root@localhost ~]# Plx_load 9054 d
++ '[' /usr/src/PlxSdk1 = 1 ']'
++ export PLX_SDK_DIR=/usr/src/PlxSdk
++ PLX_SDK_DIR=/usr/src/PlxSdk
++ '[' -f /sbin/insmod ']'
++ InsMod=/sbin/insmod
++ '[' -f /usr/sbin/insmod ']'
++ '[' /sbin/insmod = '' ']'
++ PLX_DIR=/usr/src/PlxSdk
++ plx_drv_name=9054
++ bServiceDriver=0
++ Param2=d
++ '[' d = d ']'
++ debug=_dbg
++ Param2=
++ case "$1" in
+++ id -u
++ '[' 0 '!=' 0 ']'
++ path=/dev/plx
++ name=Plx9054
++ module=Plx9054_dbg
+++ lsmod
+++ awk '$1=="Plx9054" {print $1}'
++ drv_Name=
++ '[' '' = '' ']'
+++ lsmod
+++ awk '$1=="Plx9054_dbg" {print $1}'
++ drv_Name=
++ echo

++ echo Install: Plx9054_dbg
Install: Plx9054_dbg
++ echo -n ' Load module......... '
Load module......... ++ '[' '' '!=' '' ']'
++ '[' '!' -f /usr/src/PlxSdk/Driver/Plx9054/Plx9054_dbg.ko ']'
++ /sbin/insmod /usr/src/PlxSdk/Driver/Plx9054/Plx9054_dbg.ko
++ echo 'Ok (Plx9054_dbg.ko)'
Ok (Plx9054_dbg.ko)
++ echo -n ' Verify load......... '
Verify load......... +++ lsmod
+++ awk '$1=="Plx9054_dbg" {print $1}'
++ drv_Name=
++ '[' '' = '' ']'
++ echo ERROR: ''\''Plx9054_dbg'\''' not detected
ERROR: 'Plx9054_dbg' not detected

++ echo

++ exit

######################################################

Please reply.
 
Old 05-13-2014, 10:01 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,138

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
What messages are in the log?
 
Old 05-14-2014, 11:58 PM   #3
cpemmaraju
LQ Newbie
 
Registered: May 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
Hi,

lsmod showed only two modules windrvr and usb-driver (I use Xilinx ISE). but /proc/modules shows a lot more. So I thought there was some problem with the way the software were installed (i have Xilinx ISE, Quartus and ModelSim).

What I did was to uninstall all of them and try the PLX communication which worked. I absolutely dont know why. now the system is working. I will try to recreate the problem on a VM and try to check all the steps to find out what went wrong.

As of now need to finish my task at hand.

Thanks for replying.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Invalid module format when insmod the kernel module georgewhr Linux - Software 1 10-20-2013 11:41 AM
Compile and load kernel module automatically after boot? (Intel NIC module) touser Linux - Newbie 3 08-29-2009 08:45 PM
rtl8187 driver module load error (Invalid module format) j_75080 Linux - Networking 3 07-06-2009 09:37 PM
error: -1 Invalid module format when using insmod with module cross-compiled for arm AndrewShanks Linux - Embedded & Single-board computer 4 10-15-2007 03:50 AM
insmod: error inserting 'module.o': -1 Invalid module format ksrinivas Linux - Newbie 5 10-11-2006 07:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 07:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration