Saghir A. Khatri
Saghir A. Khatri

Reputation: 3128

Unable to run OpenCV code from beaglebone

I am trying to run a program using OpenCV in beaglebone black as described at the end of the link https://solarianprogrammer.com/2014/04/21/opencv-beaglebone-black-ubuntu/

I had some compilation issues which I resolved using

g++ `pkg-config --cflags --libs opencv` test_2.cpp -o test_2

It successfully compiles, but when I try to run using

./test_2

I get the error:

CMEM Error: init: Failed to open /dev/cmem: 'No such file or directory'

The cmemk kernel module does not appear to be installed.

Commands such as the following run as root would install cmemk and allow OpenCL to proceed properly.

For available CMEM DDR block size: ~512MB: modprobe cmemk phys_start=0xa0000000 phys_end=0xc0000000 pools=1x536870912 allowOverlap=1

I am not sure why I am getting this, and I've been unable to resolve it for a few days already. Please guide me into right direction.

Regards

Upvotes: 1

Views: 340

Answers (1)

Rachel L
Rachel L

Reputation: 327

So, I had the same problem (running from the latest Debian release on the beaglebone site - 8.5).

I found this link here - which suggested I do these things:

For older images do this:

sudo apt-get update
sudo apt-get upgrade

sudo apt-get remove dkms --purge  #get rid of dkms/etc..

cd /opt/scripts/tools/
git pull
sudo ./update_kernel.sh
sudo reboot

cd /usr/share/ti/examples/opencl/float_compute/
sudo make
sudo modprobe cmemk
sudo ./float_compute

Now, the update_kernel.sh didn't actually fully work (grep breaks on the last update-initramfs), so I tried installing initramfs-tools, but it still didn't work... so then I just commented it out. After rebooting, I tried to find the opencvl/float_compute folder... but that didn't exist so I just ran my code and hoped for the best and it actually worked.

So, my suggestion is to do:

sudo apt-get update
sudo apt-get upgrade

sudo apt-get remove dkms --purge  #get rid of dkms/etc..

cd /opt/scripts/tools/
git pull
sudo apt-get install initramfs-tools

Then edit update_kernel by commenting out the update-initramfs -uk ${latest_kernel} line in the third_party_final() method (just add as # in front of the line). Then do:

sudo ./update_kernel.sh
sudo reboot

Installing the initramfs-tools might not be necessary, but I'm not sure. I have a feeling the actual solution is just the remove dkms or the update of the kernel, but again, not sure. All I can say it doing all of that worked for me.

Upvotes: 1

Related Questions