Compiling Wireless Tools for Nokia N810

This tutorial will help you configure the Scratchbox environment to compile the latest svn of aircrack-ng, latest stable kismet, and reaver 1.4 for the Nokia n810. A lot of love is getting sent to the N900 but the n8x0 series of devices are still great for wireless testing. With this tutorial you will be not only to compile the software but create Debian packages for easy installation on your Nokia device. Of important note were the errors I encountered while compiling aircrack-ng. The error had not been documented on the Internet. Trust me I Googled my heart out. Everyones solution was update the linux kernel headers. Well in this case that wasn’t possible. I’m not a Linux programmer but I figured out how to edit the header file to make the changed needed to get Aircrack-ng to compile.

Install and Configure Scratchbox for Diablo

Visit http://maemovmware.garage.maemo.org/2nd_edition/ and download the Maemo SDK Virtual Image. It will bring you http://tablets-dev.nokia.com/maemo-dev-env-downloads.php to download the virtual image. As of this tutorial the image for Desktop Ubuntu Lucid Lynx is still supported by Ubuntu. It is an Long Term Service release that will be good until 2013.

Download : Maemo_Ubuntu_Lucid_Desktop_SDK_Virtual_Image_Final.7z

Extract the image from the compressed 7z archive and boot it with your preferred Virtual Emulator (VMWare, VirtualBox, etc). How to use Virtual Image software is beyond the scope of this document. I used Virtualbox (http://www.virtualbox.org/manual/ch01.html) and make some references to it throughout the tutorial.

First thing you should do after you boot your image is update the software and install the Virtual Emulator software/drivers. Username and password are maemo/maemo. For example, I use VirtualBox and I will install the Guest Additions. Note, install the latest guest additions and not what comes with the SDK image.

To update the OS open a terminal session and preform these two commands.

$sudo apt-get update
$sudo apt-get upgrade

In the maemo user home directory Desktop folder are the scripts and programs to install and configure the cross-compilation platform for Maemo 4 OS2008 Diablo. The SDK comes preconfigured with Maemo 5 Fremantle OS environment. That environment is for the Nokia N900 Internet phone.

(NOTE: I prefer to SSH into the image from my Windows 7 host computer using Putty. This makes it easier to copy and paste commands in this tutorial)


$cd ~/Desktop/DiabloSDKInstall
$sudo ./maemo-scratchbox-install_4.1.2.sh -s /opt/scratchbox
$./maemo-sdk-install_4.1.2.sh -d -s /opt/scratchbox

.
.
.
.
.
This offer is valid for a period of three (3) years.

The exact license terms of GPL, LGPL and said certain other licenses, as well
as the required copyright and other notices, permissions and acknowledgements
are reproduced in and delivered to you as part of the referred source code.

--------------------------------------------------------------------------------

Press Enter to accept (Crtl+C to cancel).

The process downloads and installs a lot of files.  When it is finished you will see

Installation was successful!
----------------------------

IMPORTANT! Please read this.

You now have the maemo 4.1.2 diablo installed on your computer.
You can now start your maemo SDK session with /opt/scratchbox/login and
then select your target with 'sb-conf select DIABLO_ARMEL' for the
armel target or 'sb-conf select DIABLO_X86' for the i386 target.

If you have any problems with targets' package databases, you can try
running 'fakeroot apt-get -f install' on your scratchbox target.
This command will try to fix any problems with the package database.

Happy hacking!

Install the Maemo SDK Nokia Binaries.

$./maemo-sdk-nokia-binaries_4.1.2.sh

.
.
.
Do you accept all the terms of the preceding License Agreement?
Please reply with 'I accept' if you do.
> I accept
Thank you.

Extracting files...

Nokia binaries repository has now been extracted to a directory under
your scratchbox home path. Add the following line to maemo 4.1.2 diablo
scratchbox targets' /etc/apt/sources.list files to make the repository
visible to Debian apt tools:

deb file:/home/maemo/maemo-sdk-nokia-binaries_4.1.2 diablo explicit

Run 'apt-get update' inside scratchbox to read package index files.

NOTE:  This line goes in the sources.list file when you are logged into scratchbox

$sudo apt-get install vim
$sudo /opt/scratchbox/sbin/sbox_adduser maemo yes
The user `maemo' is already a member of `sbox'.
Scratchbox user account for user maemo added
$sudo /opt/scratchbox/sbin/sbox_ctl start
$ /opt/scratchbox/login
Welcome to Scratchbox, the cross-compilation toolkit!

Use 'sb-menu' to change your compilation target.
See /scratchbox/doc/ for documentation.

[sbox-DIABLO_ARMEL: ~] >vim /etc/apt/sources.list
Add the new repository to the APT sources.list
[sbox-DIABLO_ARMEL: ~] >apt-get update
[sbox-DIABLO_ARMEL: ~] >mkdir source
[sbox-DIABLO_ARMEL: ~/source] >exit
$sudo apt-get install subversion libapr1 libaprutil1 libsvn1 vim

Compile and Package Aircrack-ng

These steps will download the latest version of Aircrack-ng and modify the Maemo Linux header files so the software will compile.


$cd /opt/scratchbox/users/maemo/home/maemo/source
$svn co  http://trac.aircrack-ng.org/svn/trunk/ aircrack-ng-4.20.2012.svn
$ /opt/scratchbox/login
[sbox-DIABLO_ARMEL: ~] >cd source/aircrack-ng-4.20.2012.svn
[sbox-DIABLO_ARMEL: ~/source/aircrack-ng-4.20.2012.svn] >make

Click here for compile output including the error messages

The compilation first breaks when trying to compile aireplay-ng. The beginning of the error is this:

gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=-1 -Iinclude -c -o aireplay-ng.o aireplay-ng.c
In file included from /usr/include/linux/cpumask.h:86,
from /usr/include/linux/interrupt.h:10,
from /usr/include/linux/rtc.h:14,
from aireplay-ng.c:39:
/usr/include/linux/bitmap.h: In function `bitmap_zero':

After some research, okay, A LOT of research (Googling), it appears that #include should not be in rtc.h. I’ve found references to a kernel bug on the Internet. I am specifically creating this tutorial because this error alone wasted a lot of my time and I want to help someone else down the road.


[sbox-DIABLO_ARMEL: ~/source/aircrack-ng-4.20.2012.svn] >vim /usr/include/linux/rtc.h

Line 14 goes from this #include <linux/interrupt.h > to this /*#include <linux/interrupt.h >*/
Save the file and try to compile again.

[sbox-DIABLO_ARMEL: ~/source/aircrack-ng-4.20.2012.svn] >make

SUCCESS!!! Okay, so you know it compiles. Best thing to do is make a Debian package so we are going to “start over” compiling aircrack-ng

[sbox-DIABLO_ARMEL: ~/source/aircrack-ng-4.20.2012.svn] >make clean

NOTE: If you like to have your aircrack-ng binaries in /usr/(s)bin instead of /usr/local/(s)bin then modify the common.mak file. Line 73, set prefix to /usr (or whatever you prefer).

[sbox-DIABLO_ARMEL: ~/source/aircrack-ng-4.20.2012.svn] >cd ..
[sbox-DIABLO_ARMEL: ~/source] >tar czvf aircrack-ng-4.20.2012.svn.tar.gz aircrack-ng-4.20.2012.svn/
[sbox-DIABLO_ARMEL: ~/source] >cd aircrack-ng-4.20.2012.svn
[sbox-DIABLO_ARMEL: ~/source/aircrack-ng-4.20.2012.svn] > dh_make -c gpl -e james.edge@jedge.com -m -f ../aircrack-ng-4.20.2012.svn.tar.gz
Maintainer name : unknown
Email-Address   : james.edge@jedge.com
Date            : Fri, 20 Apr 2012 11:22:26 -0400
Package Name    : aircrack-ng
Version         : 4.20.2012.svn
License         : gpl
Type of Package : Multi-Binary
Hit <enter> to confirm:
Done. Please edit the files in the debian/ subdirectory now. You should also
check that the aircrack-ng Makefiles install into $DESTDIR and not in / .

You can modify the debian/control file to include more details about the utility and who you are (maintainer).
You can also modify it so the share files are not created to reduce the amount of space that is taken up on your device.

Add the following line below install-arch: (line 77) just above dh_install -s (line 87)
rm -Rf $(CURDIR)/debian/aircrack-ng/usr/share


[sbox-DIABLO_ARMEL: ~/source/aircrack-ng-4.20.2012.svn] >dpkg-buildpackage -rfakeroot -us -uc –B

You now have an Aircrack-ng Debian package!

Compile and Package Kismet

Note: The Maemo 4 kernel is too old for mac80211 or nl80211, even if you have libnl installed. That is why the latest svn of Kismet will not work. 2011-03-R2 will probably be the latest version of Kismet that will work on the n810.


[sbox-DIABLO_ARMEL: ~] > cd source
[sbox-DIABLO_ARMEL: ~/source] > wget http://www.kismetwireless.net/code/kismet-2011-03-R2.tar.gz
[sbox-DIABLO_ARMEL: ~/source] > tar zxvf kismet-2011-03-R2.tar.gz
[sbox-DIABLO_ARMEL: ~/source] > cd kismet-2011-03-R2
[sbox-DIABLO_ARMEL: ~/source/kismet-2011-03-R2] > dh_make -c gpl -e james.edge@jedge.com -m -f ../kismet-2011-03-R2.tar.gz
[sbox-DIABLO_ARMEL: ~/source/kismet-2011-03-R2] >vim debian/rules

edit the configure options so that the config files will be in /etc/kismet and the binary will be in /bin (see below).
./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --sysconfdir=/etc/kismet --bindir=/bin --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --with-suidgroup=users CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
Also add the following lines below install-arch: (line 86) just above dh_install -s (line 96)

rm -Rf $(CURDIR)/debian/kismet/usr/share/man
dh_install debian/manuf etc/
dh_install conf/kismet.conf etc/kismet
dh_install conf/kismet_drone.conf etc/kismet



[sbox-DIABLO_ARMEL: ~/source/kismet-2011-03-R2] >vim debian/dirs

Add the directories etc and etc/kismet to the file

[sbox-DIABLO_ARMEL: ~/source/kismet-2011-03-R2] >vim conf/kismet.conf.in

Uncomment logprefix and set it to the following (line 13)
logprefix=/media/mmc1
add the ncsource line that works with the n810 (below line 31)
ncsource=wlan0:type=nokia810,fcs=true,validatefcs=true

[sbox-DIABLO_ARMEL: ~/source/kismet-2011-03-R2] > wget –cd -N -P debian http://anonsvn.wireshark.org/wireshark/trunk/manuf
[sbox-DIABLO_ARMEL: ~/source/kismet-2011-03-R2] > dpkg-buildpackage -rfakeroot -us -uc -B

After everything is done you will bind the deb packages in the source folder

Twitter
Follow by Email
LinkedIn
YouTube
Google+
RSS

2 thoughts to “Compiling Wireless Tools for Nokia N810”

  1. thanks for all the inffo can you help me get the files that you can’t get through the nokia links anymore?? Also do you have any N900 files?
    Excellent site please supply files!

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.