Cross-compiling kinect_upload_fw for Windows under Linux
========================================================

Adapted from http://www.tinc-vpn.org/examples/cross-compiling-windows-binary/

Installing the prerequisites for cross-compilation
--------------------------------------------------

  sudo apt-get install mingw32 wine git-core

Setting up the build directory and getting the dependencies:

  mkdir $HOME/mingw
  cd $HOME/mingw
  wget http://kinect.dashhacks.com/sites/kinect-hacks.com/files/libusb-win32-bin-1.2.2.0.zip
  unzip libusb-win32-bin-1.2.2.0.zip
  git clone git://github.com/OpenKinect/libfreenect.git --branch unstable


Compiling kinect_upload_fw
--------------------------

  cd $HOME/mingw
  git clone git://git.ao2.it/kinect-audio-setup.git

  cd kinect-audio-setup/kinect_upload_fw
  CC=i586-mingw32msvc-gcc make endian LDFLAGS=
  wine ./endian > endian.h
  i586-mingw32msvc-g++ kinect_upload_fw.c -o kinect_upload_fw.exe \
    $HOME/mingw/libfreenect/platform/windows/libusb10emu/libusb-1.0/failguard.cpp \
    $HOME/mingw/libfreenect/platform/windows/libusb10emu/libusb-1.0/libusbemu.cpp \
    -I$HOME/mingw/libfreenect/platform/windows/libusb10emu/libusb-1.0 \
    -I$HOME/mingw/libfreenect/platform/windows/libusb10emu \
    -I$HOME/mingw/libusb-win32-bin-1.2.2.0/include \
    -I$HOME/mingw/libfreenect/include \
    -I$HOME/mingw/libfreenect/src \
    $HOME/mingw/libusb-win32-bin-1.2.2.0/lib/gcc/libusb.a


Using kinect_upload_fw.exe on Windows
-------------------------------------

First of all, make sure the drivers from ''libfreenect'' are installed, they are 
under ''platform/windows/inf''.

Download the MSR Kinect SDK from:
http://download.microsoft.com/download/8/4/C/84C9EF40-EE49-42C2-AE26-C6E30921182F/KinectSDK32.msi

Explore ''KinectSDK32.msi'' using 7-zip from http://www.7-zip.org, extract the 
''media1.cab'' file in it and extract the firmware file from ''media1.cab'', the 
firmware file is named ''UACFirmware.*''.

Put ''kinect_upload_fw.exe'', the firmware file and ''kinect_upload_fw.bat'' 
file in the same directory and double_click on the ''kinect_upload_fw.bat'' 
file.
