Cross compiling OpenNI for ARM¶
First, install the binutils-arm-linux-gnueabi package. Make sure that something named sort of like arm-linux-gnueabi-g++ is in your path, and find where its libraries/headers are located (for me, /usr/arm-linux-gnueabi).
Next, you will need to cross-compile libusb. Download the source from git://git.libusb.org/libusb.git, then run the following script in its main directory (though you may have to change some of the paths):
TOOLCHAIN=/usr/arm-linux-gnueabi if [ $(id -u) -ne 0 ]; then echo "Remember to run as root!" exit 1 fi export CC=arm-linux-gnueabi-gcc export CROSS_COMPILE=arm-linux-gnueabi- ./autogen.sh --host arm-linux make cd libusb mkdir -p $TOOLCHAIN/include/libusb-1.0 cp libusb.h $TOOLCHAIN/include/libusb-1.0 cp .libs/libusb-1.0.so $TOOLCHAIN/lib/libusb-1.0.so.0 ln -sf $TOOLCHAIN/lib/libusb-1.0.so.0 $TOOLCHAIN/lib/libusb-1.0.so
Now you're ready for OpenNI! I installed OpenNI (https://github.com/OpenNI/OpenNI), Sensor (https://github.com/PrimeSense/Sensor), and SensorKinect (https://github.com/avin2/SensorKinect), though I would imagine that only the first and third are necessary. If you want to install Sensor just to be safe, clone all three into the same folder, which should create OpenNI/, Sensor/, and SensorKinect/, then run the following script:
SCRIPT_DIR=`pwd` export ARM_CXX=arm-linux-gnueabi-g++ export ARM_STAGING=$SCRIPT_DIR/Staging mkdir -p $ARM_STAGING/usr/lib mkdir -p $ARM_STAGING/usr/bin mkdir -p $ARM_STAGING/usr/etc/primesense mkdir -p $ARM_STAGING/etc/udev/rules.d mkdir -p $ARM_STAGING/var/log/primesense mkdir -p Final # build OpenNI cd OpenNI/Platform/Linux/CreateRedist chmod +x RedistMaker ./RedistMaker Arm cp Final/* $SCRIPT_DIR/Final # install libs for Sensor and SensorKinect to use cd ../Redist/OpenNI-Bin-Dev-Linux-Arm-v22.214.171.124 chmod +x install.sh ./install.sh -c $ARM_STAGING # build Sensor cd $SCRIPT_DIR/Sensor/Platform/Linux/CreateRedist chmod +x RedistMaker ./RedistMaker Arm cp Final/* $SCRIPT_DIR/Final # build SensorKinect cd $SCRIPT_DIR/SensorKinect/Platform/Linux/CreateRedist chmod +x RedistMaker ./RedistMaker Arm cp Final/* $SCRIPT_DIR/Final
Three redistributable tar files should be in Final/.
After installing it on ARM, you'll need to tweak a few files. In /etc/udev/rules.d/55-primesense-usb.rules, make all of the four digit hex strings lowercase. In /usr/etc/primesense/GlobalDefaultsKinect.ini, find the line that defines UsbInterface. Uncomment it, and change the number to 1 (for ISO endpoints). There is still an issue when openni_launch is launched, but it publishes an rgb image anyway, so it's okay for now.