移植编译aircrack-ng

一、编译PC版本
1、svn co http://svn.aircrack-ng.org/trunk aircrack
2、make 出错
   common.mak:100: *** Cannot find development files for any supported version of libnl. install either libnl1 or libnl3..  Stop.
   
   需要安装libnl库
   # pkg-config --libs libnl-1 libnl-3
  No package 'libnl-1' found
  No package 'libnl-3' found
3、# sudo apt-get install libnl-dev
   # pkg-config --libs libnl-1
     -lnl
4、make 出错
make -C src all
make[1]: Entering directory `/data/user/luotong/working/test/aircrack-ng/src'
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=2413  -DCONFIG_LIBNL   -Wno-unused-but-set-variable -Wno-array-bounds -Iinclude   -c -o aircrack-ng.o aircrack-ng.c
In file included from aircrack-ng.c:65:0:
crypto.h:42:26: fatal error: openssl/hmac.h: No such file or directory
compilation terminated.
make[1]: *** [aircrack-ng.o] Error 1
make[1]: Leaving directory `/data/user/luotong/working/test/aircrack-ng/src'
make: *** [all] Error 2

需要安装openssl库
    # sudo apt-get install openssl libssl-dev
    # pkg-config --libs openssl
      -lssl -lcrypto  
5、make 成功

二、编译ARM版本  
    export PKG_CONFIG_PATH=/data/user/luotong/working/ti-dvsdk/ti-dvsdk_dm365-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/lib/pkgconfig
1、 make TOOL_PREFIX=arm-none-linux-gnueabi-   
crypto.h:42:26: error: openssl/hmac.h: No such file or directory
crypto.h:43:25: error: openssl/sha.h: No such file or directory
crypto.h:45:25: error: openssl/rc4.h: No such file or directory
crypto.h:46:25: error: openssl/aes.h: No such file or directory

修改common.mak,指定头文件和库的路径
COMMON_CFLAGS += -I$(HOME)/working/ti-dvsdk/ti-dvsdk_dm365-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/include
COMMON_CFLAGS += -L$(HOME)/working/ti-dvsdk/ti-dvsdk_dm365-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/lib

2、 make TOOL_PREFIX=arm-none-linux-gnueabi-

osdep/radiotap/radiotap.c: In function 'ieee80211_radiotap_iterator_init':
osdep/radiotap/radiotap.c:107: warning: implicit declaration of function 'le16toh'
osdep/radiotap/radiotap.c:113: warning: implicit declaration of function 'le32toh'
arm-none-linux-gnueabi-gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=2413  -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3   -I/data/user/luotong/working/ti-dvsdk/ti-dvsdk_dm365-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/include -L/data/user/luotong/working/ti-dvsdk/ti-dvsdk_dm365-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/lib -Iinclude  airdecloak-ng.o common.o osdep/radiotap/radiotap.o -o airdecloak-ng 
osdep/radiotap/radiotap.o: In function `ieee80211_radiotap_iterator_next':
/data/user/luotong/working/test/aircrack-ng/src/osdep/radiotap/radiotap.c:319: undefined reference to `le16toh'
/data/user/luotong/working/test/aircrack-ng/src/osdep/radiotap/radiotap.c:376: undefined reference to `le32toh'
osdep/radiotap/radiotap.o: In function `ieee80211_radiotap_iterator_init':
/data/user/luotong/working/test/aircrack-ng/src/osdep/radiotap/radiotap.c:107: undefined reference to `le16toh'
/data/user/luotong/working/test/aircrack-ng/src/osdep/radiotap/radiotap.c:111: undefined reference to `le16toh'
/data/user/luotong/working/test/aircrack-ng/src/osdep/radiotap/radiotap.c:113: undefined reference to `le32toh'
/data/user/luotong/working/test/aircrack-ng/src/osdep/radiotap/radiotap.c:133: undefined reference to `le32toh'

修改osdep/radiotap/radiotap.c,加上#define ANDROID,这样就会包含byteorder.h
#if defined(ANDROID) || defined(__ANDROID__)
#include "../byteorder.h"
#endif

3、 make TOOL_PREFIX=arm-none-linux-gnueabi-

arm-none-linux-gnueabi-gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=2413  -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3   -I/data/user/luotong/working/ti-dvsdk/ti-dvsdk_dm365-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/include -L/data/user/luotong/working/ti-dvsdk/ti-dvsdk_dm365-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/lib -fPIC -I..    -c -o linux.o linux.c
linux.c:46:31: error: netlink/genl/genl.h: No such file or directory
linux.c:47:33: error: netlink/genl/family.h: No such file or directory
linux.c:48:31: error: netlink/genl/ctrl.h: No such file or directory
linux.c:49:25: error: netlink/msg.h: No such file or directory
linux.c:50:26: error: netlink/attr.h: No such file or directory

从编译信息的CFLAGS中发现libnl3的头文件目录(-I/usr/include/libnl3)指向了系统目录,虽然编译前把PKG_CONFIG_PATH指定到了DVSDK中的pkgconfig目录,
但是在common.mak中使用pkg-config产生的CFLAGS还是指向了系统的库目录,所以需要修改common.mak
把COMMON_CFLAGS +=$(shell $(PKG_CONFIG) --cflags $(NLLIBNAME))注释掉,增加
COMMON_CFLAGS += -I$(HOME)/working/ti-dvsdk/ti-dvsdk_dm365-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/include/libnl3
4、编译通过, make TOOL_PREFIX=arm-none-linux-gnueabi- install
install -d /usr/local/bin
install -m 755 aircrack-ng airdecap-ng packetforge-ng ivstools kstats makeivs-ng airdecloak-ng wpaclean /usr/local/bin
install: cannot create regular file `/usr/local/bin/aircrack-ng': Permission denied
install: cannot create regular file `/usr/local/bin/airdecap-ng': Permission denied
install: cannot create regular file `/usr/local/bin/packetforge-ng': Permission denied
install: cannot create regular file `/usr/local/bin/ivstools': Permission denied
install: cannot create regular file `/usr/local/bin/kstats': Permission denied
install: cannot create regular file `/usr/local/bin/makeivs-ng': Permission denied
install: cannot create regular file `/usr/local/bin/airdecloak-ng': Permission denied
install: cannot create regular file `/usr/local/bin/wpaclean': Permission denied

修改common.mak,把prefix修改成其他目录
prefix          = $(HOME)/local

你可能感兴趣的:(TI,DVSDK)