Skip to content

Instantly share code, notes, and snippets.

@yangmenghui
Last active November 20, 2018 14:27
Show Gist options
  • Save yangmenghui/d01c12561aeb133adc35 to your computer and use it in GitHub Desktop.
Save yangmenghui/d01c12561aeb133adc35 to your computer and use it in GitHub Desktop.
Introduction of creating an OCB enabled Linux system with ath9k interface

#Overview The latest Ubuntu 15.04 announced it has already support OCB mode. its kernel version is 3.19.0, however,it just added ocb feature on mac80211 and nl80211 layer, for drvier layer, we have to menully patch it by ourself. Here will show how patch whole stack to suport OCB/802.11p for Kernel 3.19.0 and ath9k step by step.

#Get 3.19.0 source code from official site

If you are in ubuntu 15.04, just follow the steps below,

apt-get source linux-image-$(uname -r)
apt-get build-dep linux-image-$(uname -r)
cd /usr/src/& tar jxf xxx-linx-xxx.tar.bz2
cd /usr/src/xxx-linux-xxx/

you can also get it from github directly

git clone -b org --single-branch https://github.com/yangmenghui/LinuxKernel3_19_V2X.git

##Modification of some sourcecode It's a lot of modification on mac80211, nl80211 and ath9k , follow the link,

from google doc

Here is the completed sourcecode

git clone -b master --single-branch https://github.com/yangmenghui/LinuxKernel3_19_V2X.git

##Build source code After make all modification, there are 2 ways to build the kernel

###Build from Fakeroot

fakeroot debian/rules clean
fakeroot debina/rules binary-headers binary-generic

###Build menually ####Config the kernel options

make menuconfig  

####Make dependencies

make dep

####Make the kernel the resulting kernel file is 'arch/i386/bzImage

make bzImage

####Make the modules

make modules

####Make moudules_install

make modules_install

#iw configuration Origin iw does not support OCB setting, so needs to modify iw module and rebuild it

git clone https://github.com/yangmenghui/iw.git
makesudo PREFIX=/ make install

Test it

/sbin/iw | grep -i ocb
	dev <devname> ocb leave
	dev <devname> ocb join <freq in MHz> <5MHZ|10MHZ> [fixed-freq]

#OCB interface configuration by iw Assuming our WiFi adaptor is wlan0

sudo iw reg set DE
sudo ip link set wlan0 down
sudo iw dev wlan0 set type ocb
sudo ip link set wlan0 up
sudo iw dev wlan0 ocb join 2422 20MHZ

By here, our system has been fully support OCB mode, next we would config our code for application

#Configing our code start here

##Get Code get code from private git

git clone git@52.11.139.225:Neusoft_V2X.git

It needs to config local git configuration file in ~/.ssh/config, and copy ssh key file to ~/.ssh folder ##Compile the module Firstly, we need to check the name of current ath9k wlan interface by command ifconfig, if it is not wlan0, we need to modify code In Neusoft_V2X folder

grep -R wlan0 . 

then build kernel module and install module

make
insmod neu16093.ko

If the module has been installed, to remove it by executing

rmmod neu17093.ko

##Build application

cd test
gcc -o executed_file_name packet_send_nogps.c  -lpthread
gcc -o executed_file_name packet_rcv_nogps.c  -lpthread
gcc -o executed_file_name packet_send_all.c  -lpthread -lm
gcc -o executed_file_name packet_rcv_all.c  -lpthread -lm

##Testing send data

executed_send_xxx wsmp|ipv6 packet_num packet_len interval psid

Rcv data

executed_send_xxx psid
@bakteria1
Copy link

How do I get access to download the V2X stack?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment