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://, then run the following script in its main directory (though you may have to change some of the paths):


if [ $(id -u) -ne 0 ]; then
  echo "Remember to run as root!" 
  exit 1

export CC=arm-linux-gnueabi-gcc
export CROSS_COMPILE=arm-linux-gnueabi-
./ --host arm-linux
cd libusb

mkdir -p $TOOLCHAIN/include/libusb-1.0
cp libusb.h $TOOLCHAIN/include/libusb-1.0
cp .libs/ $TOOLCHAIN/lib/
ln -sf $TOOLCHAIN/lib/ $TOOLCHAIN/lib/

Now you're ready for OpenNI! I installed OpenNI (, Sensor (, and 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:

export ARM_CXX=arm-linux-gnueabi-g++

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-v1.5.2.23
chmod +x

# 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.