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] - Blame information for rev 41

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

Line No. Rev Author Line
1 2 dsmv
#!/bin/sh
2
 
3
#
4
# This script is loading modules in the kernel.
5
#
6
 
7 6 v.karak
status ()
8
{
9
   if [ $1 -eq 0 ] ; then
10
       echo "[SUCCESS]"
11
   else
12
       echo "[FAILED]"
13 2 dsmv
 
14 6 v.karak
       if [ $2 -eq 1 ] ; then
15
           echo "... loading aborted."
16
           exit 1
17
       fi
18
   fi
19
}
20
 
21
echo
22
 
23
kernel=`uname -r | grep 2.4`
24
 
25
if [ $kernel ]
26 2 dsmv
    then
27 6 v.karak
        module=pexdrv.o
28 2 dsmv
        mname=${module%.o}
29
    else
30
        module=`find *.ko`
31
        mname=${module%.ko}
32
fi
33
 
34 6 v.karak
device=pexdrv
35
mode="666"
36
 
37
chmod 777 /dev/shm
38
 
39
if [ ${module} ]
40 2 dsmv
    then
41 6 v.karak
        echo -n " Find ${module} module      : "
42
        status $? 0
43 2 dsmv
    else
44 6 v.karak
        echo -n " Kernel module not found    : "
45
        status 1 0
46
        exit
47 2 dsmv
fi
48
 
49 6 v.karak
was_loaded=`/sbin/lsmod | cut -c 1-6 | grep $device`
50 2 dsmv
 
51 6 v.karak
if [ ${was_loaded} ]
52
    then
53
        echo -n " Remove loaded module       : "
54
        /sbin/rmmod $device
55
        status $? 0
56
    else
57 7 v.karak
        echo -n " Loading pexdrv module      : "
58 6 v.karak
fi
59 2 dsmv
 
60 6 v.karak
insmod ./${module}
61 2 dsmv
 
62 6 v.karak
until [ -e /dev/pexdrv0 ]
63
do
64
    sleep 1.5
65
done
66 2 dsmv
 
67 6 v.karak
chmod 666 /dev/pexdrv*
68
 
69
status $? 0
70
 
71
echo

powered by: WebSVN 2.1.0

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