aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGil Pitney <gil.pitney@linaro.org>2014-10-28 18:00:42 -0700
committerGil Pitney <gil.pitney@linaro.org>2014-10-28 18:00:42 -0700
commit61b2c94d9e64758e55730be6a3fc9006c171db85 (patch)
treef564f09ebf93ba293dfa225bd374df6f1f37aa01 /scripts
Initial Commit: Based on TI OpenCL v0.8, originally based on clover.shamrock_v0.8
This is a continuation of the clover OpenCL project: http://people.freedesktop.org/~steckdenis/clover based on the contributions from Texas Instruments for Keystone II DSP device: git.ti.com/opencl and adding contributions from Linaro for ARM CPU-only support. See README.txt for more info, and build instructions. Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/20-c6678.rules6
-rw-r--r--scripts/c6678_udev.sh12
-rwxr-xr-xscripts/install.sh77
-rwxr-xr-xscripts/uninstall.sh43
4 files changed, 138 insertions, 0 deletions
diff --git a/scripts/20-c6678.rules b/scripts/20-c6678.rules
new file mode 100644
index 0000000..39f0e69
--- /dev/null
+++ b/scripts/20-c6678.rules
@@ -0,0 +1,6 @@
+ACTION=="remove", GOTO="c6678_end"
+
+SUBSYSTEM=="pci", RUN+="/bin/sh /etc/udev/rules.d/c6678_udev.sh /sys/$env{DEVPATH}"
+SUBSYSTEM=="cmem", RUN+="/bin/chmod ugo+rw /dev/cmem"
+
+LABEL="c6678_end"
diff --git a/scripts/c6678_udev.sh b/scripts/c6678_udev.sh
new file mode 100644
index 0000000..e0d49a7
--- /dev/null
+++ b/scripts/c6678_udev.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+read vendor_value < $1/vendor
+read device_value < $1/device
+if [ "$vendor_value" = "0x104c" -a "$device_value" = "0xb005" ]
+then
+read switch_vendor_value < $1/../vendor
+read switch_device_value < $1/../device
+/usr/bin/find $1 -maxdepth 1 -name "resource*" -exec /bin/chmod ugo+rw {} +
+
+/bin/date >> /var/log/c6678_udev.log
+/bin/echo $1 : vendor:$vendor_value device:$device_value switch_vendor:$switch_vendor_value switch_device:$switch_device_value >>/var/log/c6678_udev.log
+fi
diff --git a/scripts/install.sh b/scripts/install.sh
new file mode 100755
index 0000000..3681ef0
--- /dev/null
+++ b/scripts/install.sh
@@ -0,0 +1,77 @@
+#!/bin/sh
+sudo -v
+
+#---------------------------------------------------------------------
+# Set variable to the installation path of the product
+#---------------------------------------------------------------------
+cd ..
+ocl_path=$(pwd)
+cd -
+
+#-----------------------------------------------------------------------------
+# Remember that this installation was first to install cmem, thus uninstall
+# will remove it
+#----------------------------------------------------------------------------*/
+rm -f $ocl_path/.install_log
+touch $ocl_path/.install_log
+sudo chmod ugo+rw $ocl_path/.install_log
+
+#---------------------------------------------------------------------
+# Load driver if not already installed
+#---------------------------------------------------------------------
+if [ ! -e /dev/cmem ]
+then
+sudo insmod $ocl_path/cmem/cmem_dev.ko
+echo "INSMOD $ocl_path/cmem/cmem_dev.ko" >> $ocl_path/.install_log
+fi
+
+#---------------------------------------------------------------------
+# Set permissions
+#---------------------------------------------------------------------
+sudo chmod ugo+rw /dev/cmem
+
+#---------------------------------------------------------------------
+# Copy cmem driver to kernel driver directory
+#---------------------------------------------------------------------
+kernel_name=$(uname -r)
+if [ ! -e /lib/modules/$kernel_name/kernel/drivers/cmem ]
+then
+sudo mkdir /lib/modules/$kernel_name/kernel/drivers/cmem
+echo "MKDIR /lib/modules/$kernel_name/kernel/drivers/cmem" >> $ocl_path/.install_log
+fi
+
+if [ ! -e /lib/modules/$kernel_name/kernel/drivers/cmem/cmem_dev.ko ]
+then
+sudo cp $ocl_path/cmem/cmem_dev.ko /lib/modules/$kernel_name/kernel/drivers/cmem
+echo "CP $ocl_path/cmem/cmem_dev.ko /lib/modules/$kernel_name/kernel/drivers/cmem" >> $ocl_path/.install_log
+fi
+
+cmem_hits=$(sudo grep -c "cmem_dev" /etc/modules)
+if [ $cmem_hits -eq 0 ]
+then
+sudo sed -i '$ a cmem_dev' /etc/modules
+echo "MODULE ADD cmem_dev to /etc/modules" >> $ocl_path/.install_log
+fi
+
+#---------------------------------------------------------------------
+#---------------------------------------------------------------------
+sudo depmod -a
+
+#---------------------------------------------------------------------
+# Set pcie window permissions
+#---------------------------------------------------------------------
+$ocl_path/bin/init_global_shared_mem
+
+#---------------------------------------------------------------------
+#copy files to udev area
+#---------------------------------------------------------------------
+if [ ! -e /etc/udev/rules.d/c6678_udev.sh ]
+then
+ echo "UDEV files copied to /etc/udev/rules.d" >> $ocl_path/.install_log
+ sudo cp $ocl_path/scripts/c6678_udev.sh /etc/udev/rules.d/.
+ sudo cp $ocl_path/scripts/20-c6678.rules /etc/udev/rules.d/.
+ sudo touch /var/log/c6678_udev.log
+ sudo chmod ugo+rw /etc/udev/rules.d/20-c6678.rules
+ sudo chmod ugo+x /etc/udev/rules.d/c6678_udev.sh
+ sudo chmod ugo+rw /var/log/c6678_udev.log
+fi
diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh
new file mode 100755
index 0000000..863e9c3
--- /dev/null
+++ b/scripts/uninstall.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+sudo -v
+
+cd ..
+ocl_path=$(pwd)
+cd -
+
+initial_path=$(pwd)
+kernel_name=$(uname -r)
+
+if [ ! -e $ocl_path/.install_log ]
+then
+ echo "Install log not found"
+ exit
+fi
+
+INSMOD=$(sudo grep -c "INSMOD" $ocl_path/.install_log)
+if [ $INSMOD -ne 0 ]
+then
+ sudo rmmod cmem_dev
+fi
+
+MKDIR=$(sudo grep -c "MKDIR /lib/modules" $ocl_path/.install_log)
+if [ $MKDIR -ne 0 ]
+then
+ sudo rm -rf /lib/modules/$kernel_name/kernel/drivers/cmem
+fi
+
+MODULES_ADD=$(sudo grep -c "MODULE ADD" $ocl_path/.install_log)
+if [ $MODULES_ADD -ne 0 ]
+then
+ sudo sed -i '/cmem_dev/d' /etc/modules
+fi
+
+UDEV=$(sudo grep -c "UDEV" $ocl_path/.install_log)
+if [ $UDEV -ne 0 ]
+then
+ sudo rm /etc/udev/rules.d/20-c6678.rules
+ sudo rm /etc/udev/rules.d/c6678_udev.sh
+fi
+
+cd $initial_path
+rm $ocl_path/.install_log