aodv-uu-0.9.6编译移植Mini6410 组建ad-hoc网络

时间:2022-01-12 03:59:01
一.编译aodv源代码:

内核版本:linux-2.6.38   aodv-uu:aodv-uu-0.9.6

1.修改Makefile内核源码路径和编译器版本

# KERNEL_DIR=/lib/modules/$(KERNEL)/build
  KERNEL_DIR=/home/administrator/Mini6410/linux-2.6.38
  KERNEL_INC=$(KERNEL_DIR)/include

# Compiler and options:
# ##### for RCP use: big-endian
# CC=gcc
  CC=arm-linux-gcc (版本:4.5.1)

2.在lnx/kaodv-debug.h程序中添加头文件 #include <linux/kernel.h>

3.在lnx/kaodv-netlink.c中将 static DECLARE_MUTEX(kaodvnl_sem); 改为 static DEFINE_SEMAPHORE(kaodvnl_sem);

4.手工定制内核,重新编译内核将netfilter模块加进去。
Networking support --->
   Networking options --->
      Networking packet filtering framework (Netfilter) --->
         IP: Netfilter configuration --->
            <*> IP Userspace queueing via NETLINK (OBSOLETE)
            
二.组建adhoc网络:

1.发起发:
    iwconfig wlan0 mode ad-hoc
    iwconfig wlan0 essid "aodv-adhoc"
    ifconfig wlan0 up
    ifconfig wlan0 192.168.1.1
    
2.接入方:
    iwconfig wlan0 mode ad-hoc
    ifconfig wlan0 up
    ifconfig wlan0 192.168.1.3
    iwlist wlan0 scan (确保能搜到aodv-adhoc网络)
    iwconfig wlan0 essid aodv-adhoc
    iwconfig wlan0 查看cell是否为iwlist搜出aodv-adhoc对应的cell,如果一致,则接入成功。
    
3.加载aodv模块
    insmod kaodv.ko
    
4.运行aodv协议
    ./aodvd

    20:02:17.416 host_init: Attaching to rausb0, override with -i <if1,if2,...>.
    20:02:17.548 aodv_socket_init: RAW send socket buffer size set to 221184
    20:02:17.548 aodv_socket_init: Receive buffer size set to 221184
    20:02:17.548 main: In wait on reboot for 15000 milliseconds. Disable with "-D".
    20:02:17.548 hello_start: Starting to send HELLOs!
    20:02:20.217 neighbor_add: 192.168.1.1 new NEIGHBOR!
    20:02:20.217 rt_table_insert: Inserting 192.168.1.1 (bucket 0) next hop 192.168.1.1
    20:02:20.217 nl_send_add_route_msg: ADD/UPDATE: 192.168.1.1:192.168.1.1 ifindex=3
    显示发现邻居192.168.1.1并将其添加到路由表中,协议运转正常。