OpenCores
URL https://opencores.org/ocsvn/pcie_ds_dma/pcie_ds_dma/trunk

Subversion Repositories pcie_ds_dma

[/] [pcie_ds_dma/] [trunk/] [soft/] [linux/] [driver/] [pexdrv/] [insert] - Rev 6

Go to most recent revision | Compare with Previous | Blame | View Log

#!/bin/sh 

# 
# This script is loading modules in the kernel. 
# 

status ()
{
   if [ $1 -eq 0 ] ; then
       echo "[SUCCESS]"
   else
       echo "[FAILED]"

       if [ $2 -eq 1 ] ; then
           echo "... loading aborted."
           exit 1
       fi
   fi
}

echo

kernel=`uname -r | grep 2.4`

if [ $kernel ]
    then
        module=pexdrv.o
        mname=${module%.o}
    else
        module=`find *.ko`
        mname=${module%.ko}
fi

device=pexdrv
mode="666"

chmod 777 /dev/shm

if [ ${module} ]
    then
        echo -n " Find ${module} module      : "
        status $? 0
    else
        echo -n " Kernel module not found    : "
        status 1 0
        exit
fi

was_loaded=`/sbin/lsmod | cut -c 1-6 | grep $device`

if [ ${was_loaded} ]
    then
        echo -n " Remove loaded module       : "
        /sbin/rmmod $device
        status $? 0
    else
        echo Loading module: ${module}
fi

echo -n " Loading pexdrv module      : "
insmod ./${module}

until [ -e /dev/pexdrv0 ]
do
    sleep 1.5
done

chmod 666 /dev/pexdrv*

status $? 0

echo

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.