*** Part 1, Compiling package dependencies and Install: ***
Make sure your BackTrack distro is up-to-date and you have the linux kernel source installed and ready to compile packages and modules. Follow the BackTrack 4 r2 update guide:
(Upgrading - BackTrack Linux)
Next we're going to install all the tools necessary to compile the various sources.
During this tutorial we'll be using the source package versions in the following link(s). As newer versions are released some of the compilation errors/nuances experienced on BackTrack should be eliminated:Code:root@bt:/usr/src# apt-get install build-essential cmake automake autoconf libtool libgnutls-dev libglib2.0-dev libxml2-dev libreadline5-dev
Sources and Versions:
1. libusb-1.0.8 (git.stuge.se Git - libusb.git/summary)
2. usbmuxd-1.0.6 (git.marcansoft.com Git - usbmuxd.git/summary)
3. libplist-1.3 (http://github.com/JonathanBeck/libplist)
4. libimobiledevice-1.0.3 (libimobiledevice - A protocol library to access an iPhone or iPod Touch in Linux)
5. ipheth 1.0-1 (https://github.com/dgiagio/ipheth)
*Please keep in mind that at each new section we're starting at '/usr/src/'.
Part 1.1, libusb-1.0.8:
Get Source
Compile and InstallCode:root@bt:/usr/src# git clone git://git.libusb.org/libusb.git ...
Part 1.2, usbmuxd-1.0.6:Code:root@bt:/usr/src# cd libusb/ root@bt:/usr/src/libusb# ./autogen.sh ... root@bt:/usr/src/libusb# make ... root@bt:/usr/src/libusb# make install
Get Source
CompileCode:root@bt:/usr/src# git clone git://git.marcansoft.com/usbmuxd.git ...
If you get the following compilation error:Code:root@bt:/usr/src# cd usbmuxd/ root@bt:/usr/src/usbmuxd# mkdir build root@bt:/usr/src/usbmuxd# cd build/ root@bt:/usr/src/usbmuxd/build# cmake .. ...
Make the following changes to '/usr/src/usbmuxd/Modules/FindUSB.cmake'. Adding the '#'s in front of the if/else check for FreeBSD will allow us to compile the code. Don't actually add the "below and above" comment lines they are simply there for reference.Code:... -- libusbmuxd will be built with protocol version 1 support CMake Error: Error in cmake code at /usr/src/usbmuxd/Modules/FindUSB.cmake:13: Parse error. Function missing ending ")". Instead found left paren with text "(". CMake Error at daemon/CMakeLists.txt:1 (find_package): find_package Error reading CMake code from "/usr/src/usbmuxd/Modules/FindUSB.cmake". ...
CompileCode:# - Try to find libusb-1.0 # Once done, this will define # # USB_FOUND - system has libusb-1.0 # USB_INCLUDE_DIRS - the libusb-1.0 include directories # USB_LIBRARIES - link these to use libusb-1.0 include(LibFindMacros) # Dependencies ### ONLY MODIFY THE CODE BELOW THIS LINE ### # pkg-config + libusb fails on FreeBSD, though libusb is in base #if(NOT(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")) # Use pkg-config to get hints about paths libfind_pkg_check_modules(USB_PKGCONF libusb-1.0>=1.0.3) # We want to look for libusb-1.0 set(USB_LIBRARY_NAME usb-1.0) #else() # set(USB_PKGCONF_INCLUDE_DIRS /usr/include) # set(USB_PKGCONF_LIBRARY_DIRS /usr/lib) # set(USB_LIBRARY_NAME usb) #endif() ### AND ABOVE THIS LINE ### ...
Note the REMINDER in the above output. We'll revisit that in Part 3.Code:root@bt:/usr/src/usbmuxd/build# cmake .. -- Configuring usbmuxd v1.0.6-dirty -- Found PLIST -- Will build usbmuxd: YES -- libusbmuxd will be built with protocol version 1 support -- checking for module 'libusb-1.0>=1.0.3' -- found libusb-1.0, version 1.0.8 -- Found USB -- usbmuxd will be built with protocol version 1 support * REMINDER * Remember to add a user named 'usbmux' with USB access permissions * for the udev hotplugging feature to work out of the box. -- Configuring done -- Generating done -- Build files have been written to: /usr/src/usbmuxd/build
Part 1.3, libplist-1.3:Code:root@bt:/usr/src/usbmuxd/build# make ... root@bt:/usr/src/usbmuxd/build# make install ...
Get Source
Compile and InstallCode:root@bt:/usr/src# git clone git://github.com/JonathanBeck/libplist.git ...
Part 1.4, libimobiledevice-1.0.3:Code:root@bt:/usr/src# cd libplist/ root@bt:/usr/src/libplist# mkdir build root@bt:/usr/src/libplist# cd build/ root@bt:/usr/src/libplist/build# cmake .. ... root@bt:/usr/src/libplist/build# make ... root@bt:/usr/src/libplist/build# make install
Get Source
Compile and InstallCode:root@bt:/usr/src# git clone git://git.sukimashita.com/libimobiledevice.git ...
Part 1.5, ipheth 1.0-1:Code:root@bt:/usr/src# cd libimobiledevice/ root@bt:/usr/src/libimobiledevice# ./autogen.sh ... root@bt:/usr/src/libimobiledevice# make ... root@bt:/usr/src/libimobiledevice# make install ...
Get Source
Part 1.5.1, ipheth-driver:Code:root@bt:/usr/src# git clone git://github.com/dgiagio/ipheth.git ...
Compile and Install
If the following compilation error is found, you'll need to patch the source as there have been some usb function name changes in kernel 2.6.35 and the following bug-fix has not made it's way to the repository.Code:root@bt:/usr/src# cd ipheth/ipheth-driver/ root@bt:/usr/src/ipheth/ipheth-driver# make ...
(git.kernel.org - linux/kernel/git/torvalds/linux-2.6.git/commitdiff)
Again, only insert the below modifications into the '/usr/src/ipheth/ipheth-driver/ipheth.c' file if the above make command failed with the same error. Don't actually add the "below and above" comment lines they are simply there for reference.Code:root@bt:/usr/src/ipheth/ipheth-driver# make make -C /lib/modules/2.6.35.8/build M=/usr/src/ipheth/ipheth-driver modules make[1]: Entering directory `/usr/src/linux-source-2.6.35.8' WARNING: Symbol version dump /usr/src/linux-source-2.6.35.8/Module.symvers is missing; modules will have no dependencies and modversions. CC [M] /usr/src/ipheth/ipheth-driver/ipheth.o /usr/src/ipheth/ipheth-driver/ipheth.c: In function ‘ipheth_alloc_urbs’: /usr/src/ipheth/ipheth-driver/ipheth.c:137: error: implicit declaration of function ‘usb_buffer_alloc’ /usr/src/ipheth/ipheth-driver/ipheth.c:140: warning: assignment makes pointer from integer without a cast /usr/src/ipheth/ipheth-driver/ipheth.c:147: warning: assignment makes pointer from integer without a cast /usr/src/ipheth/ipheth-driver/ipheth.c:159: error: implicit declaration of function ‘usb_buffer_free’ make[2]: *** [/usr/src/ipheth/ipheth-driver/ipheth.o] Error 1 make[1]: *** [_module_/usr/src/ipheth/ipheth-driver] Error 2 make[1]: Leaving directory `/usr/src/linux-source-2.6.35.8' make: *** [all] Error 2
You should see something similar to the following output when the ipheth module compiles without error:Code:... #include <linux/ethtool.h> #include <linux/usb.h> #include <linux/workqueue.h> ### ONLY ADD THE CODE BELOW THIS LINE ### #include <asm/uaccess.h> #include <linux/version.h> #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34) # define usb_buffer_alloc(dev, size, mem_flags, dma) \ usb_alloc_coherent(dev, size, mem_flags, dma) # define usb_buffer_free(dev, size, addr, dma) \ usb_free_coherent(dev, size, addr, dma) #endif ### AND ABOVE THIS LINE ### #define USB_VENDOR_APPLE 0x05ac #define USB_PRODUCT_IPHONE 0x1290 #define USB_PRODUCT_IPHONE_3G 0x1292 #define USB_PRODUCT_IPHONE_3GS 0x1294 #define USB_PRODUCT_IPHONE_4 0x1297 ...
InstallCode:root@bt:/usr/src/ipheth/ipheth-driver# make make -C /lib/modules/2.6.35.8/build M=/usr/src/ipheth/ipheth-driver modules make[1]: Entering directory `/usr/src/linux-source-2.6.35.8' WARNING: Symbol version dump /usr/src/linux-source-2.6.35.8/Module.symvers is missing; modules will have no dependencies and modversions. CC [M] /usr/src/ipheth/ipheth-driver/ipheth.o Building modules, stage 2. MODPOST 1 modules CC /usr/src/ipheth/ipheth-driver/ipheth.mod.o LD [M] /usr/src/ipheth/ipheth-driver/ipheth.ko make[1]: Leaving directory `/usr/src/linux-source-2.6.35.8'
Part 1.5.2, ipheth-pair:Code:root@bt:/usr/src/ipheth/ipheth-driver# make install make -C /lib/modules/2.6.35.8/build M=/usr/src/ipheth/ipheth-driver modules_install make[1]: Entering directory `/usr/src/linux-source-2.6.35.8' INSTALL /usr/src/ipheth/ipheth-driver/ipheth.ko DEPMOD 2.6.35.8 make[1]: Leaving directory `/usr/src/linux-source-2.6.35.8'
BackTrack 4 r2 uses an older version of udev; for our version the correct syntax is `udevadm control --reload_rules`. Don't worry about the error as we'll revisit this in part 3.Code:root@bt:/usr/src# cd ipheth/ipheth-pair/ root@bt:/usr/src/ipheth/ipheth-pair# make ... root@bt:/home/spyder/src/ipheth/ipheth-pair# make install install -m 0755 ipheth-pair /lib/udev/ install -m 0644 90-iphone-tether.rules /etc/udev/rules.d /sbin/udevadm control --reload-rules unrecognized command 'reload-rules' make: *** [install] Error 1



