Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Clone and compile the Linux kernel
==================================
# Use some extra directory for all the components needed
cd c2c/
# Clone the repository (this will take a *few minutes*)
c2c$ git clone https://github.com/CTU-IIG/802.11p-linux.git
c2c$ cd 802.11p-linux
# Checkout particular branch
c2c/802.11p-linux$ git checkout its-g5_v3
# Prepare the folder for compilation
c2c/802.11p-linux$ mkdir _build
# Use the appropriate defconfig
c2c/802.11p-linux$ make O=_build x86_64_defconfig
# Configure the kernel if necessary (enable MAC80211_OCB_DEBUG, CONFIG_MAC80211_STA_DEBUG etc.)
c2c/802.11p-linux$ cd _build
c2c/802.11p-linux/_build$ make menuconfig
# Run the compilation
c2c/802.11p-linux/_build$ make -j4
# Install the modules and the kernel
c2c/802.11p-linux/_build$ sudo make modules_install
c2c/802.11p-linux/_build$ sudo make install
iw -- wifi configuration tool
=============================
# Use some extra directory for all the components needed
cd c2c/
# Install libnl development files
c2c$ sudo apt-get install libnl-dev
# Clone the official iw repository
c2c$ git clone https://github.com/CTU-IIG/802.11p-iw.git
c2c$ cd 802.11p-iw
c2c/802.11p-iw$ git checkout its-g5_v3
# Build it
c2c/802.11p-iw$ make
# Install it
c2c/802.11p-iw$ sudo PREFIX=/ make install
# Test it
c2c/802.11p-iw$ /sbin/iw | grep -i ocb
dev <devname> ocb leave
dev <devname> ocb join <freq in MHz> <5MHZ|10MHZ> [fixed-freq]
wireless-regdb -- regulatory information
========================================
# Use some extra directory for all the components needed
cd c2c/
# Install some extra packages
c2c$ sudo apt-get install python-m2crypto
# Clone the repository
c2c$ git clone https://github.com/CTU-IIG/802.11p-wireless-regdb.git
c2c$ cd 802.11p-wireless-regdb
c2c/802.11p-wireless-regdb$ git checkout its-g5_v1
c2c/802.11p-wireless-regdb$ make
c2c/802.11p-wireless-regdb$ sudo PREFIX=/ make install
CRDA -- Central Regulatory Domain Agent
=======================================
# Use some extra directory for all the components needed
cd c2c/
# Install some extra packages
c2c$ sudo apt-get install python-m2crypto
c2c$ sudo apt-get install libgcrypt11-dev
# Clone the repository
c2c$ git clone https://github.com/CTU-IIG/802.11p-crda.git
c2c$ cd 802.11p-crda
c2c/802.11p-crda$ git checkout its-g5_v1
# We are using our own key for regulatory.bin and CRDA
c2c/802.11p-crda$ cp /lib/crda/pubkeys/username.key.pub.pem pubkeys/
# Compile + install it
c2c/802.11p-crda$ make
c2c/802.11p-crda$ sudo PREFIX=/ REG_BIN=/lib/crda/regulatory.bin make install
# Test CRDA + generated regulatory.bin
c2c/802.11p-crda$ sudo /sbin/regdbdump ../802.11p-wireless-regdb/regulatory.bin | grep -i ocb
country 00: invalid
(5850.000 - 5925.000 @ 20.000), (20.00), NO-CCK, OCB-ONLY
# Right now is probably the right time reboot
# the computer into the newly compiled kernel
Configure OCB interface
=======================
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 5890 10MHZ
# Get the interface statistics
ip -s link show dev wlan0
@apaixao

This comment has been minimized.

Copy link

commented Jan 19, 2015

Hi,
thanks for the steo-by-step.
I am having trouble building iw, seems to fails on version.sh.

~/c2c/802.11p-iw$ make
CC iw.o
CC genl.o
CC event.o
CC info.o
CC phy.o
CC interface.o
CC ibss.o
CC station.o
CC survey.o
CC util.o
CC mesh.o
CC mpath.o
CC mpp.o
CC scan.o
CC reg.o
GEN version.c
make: *** [version.c] Error 2

Any ideas?
Best

@tpvamsikrishna

This comment has been minimized.

Copy link

commented Jan 21, 2015

Open version.c file and edit version 3.17 to 3.15

@apaixao

This comment has been minimized.

Copy link

commented Jan 21, 2015

Hi,
thank you for the prompt answer.
Just to clarify anyone who stumble across the same, the file to be edited is version.sh.
VERSION="3.15" instead of VERSION="3.17"

@apaixao

This comment has been minimized.

Copy link

commented Jan 30, 2015

Hi,
I got a test environment, right kernel, iw, regdb, crda installed.
I use ath5k instead of athk9 done by lisovy.

iw returns ok:
/sbin/iw | grep -i ocb
dev ocb leave
dev ocb join <5MHZ|10MHZ> [fixed-freq]

when I define the ocb type by:
$sudo ip link set wlan0 down
$iw dev wlan0 set type ocb
command failed: Operation not supported (-95)

$iw dev wlan0 ocb join 5890 10MHZ
command failed: Invalid argument (-22)

any ideas?

best

@tpvamsikrishna

This comment has been minimized.

Copy link

commented Feb 9, 2015

I am also getting same error.

give me any suggestions

@apaixao

This comment has been minimized.

Copy link

commented Feb 9, 2015

Hi,
what card are you using? AR5 or AR9?

@tpvamsikrishna

This comment has been minimized.

Copy link

commented Feb 16, 2015

I am using AR9 cards but i am getting error

@apaixao

This comment has been minimized.

Copy link

commented Feb 18, 2015

Just a quick guess -- have you modified
hw->wiphy->interface_modes = ... | BIT(NL80211_IFTYPE_OCB);

@tpvamsikrishna

This comment has been minimized.

Copy link

commented Feb 24, 2015

I am not changed any code what ever git clone i am using that one

@hiteshradia

This comment has been minimized.

Copy link

commented Mar 6, 2015

please check that you are booted in the same kernel CONFIG_LOCALVERSION="test1" .
uname -a |grep test1

@DRN0703

This comment has been minimized.

Copy link

commented Sep 1, 2015

I have used Linux kernel 3.18.17. Complete installation went smoothly and everything is the same as what is in the document. Only when I tried to OCB mode sets the reported error card R52Hn (ath9k) :

$iw dev wlan0 set type ocb
command failed: Operation not supported (-95)

$iw dev wlan0 ocb join 5890 10MHZ
command failed: Invalid argument (-22)

any idea?

@severinson

This comment has been minimized.

Copy link

commented Nov 13, 2015

I'm having similar problems. I can do $iw dev wlan0 set type ocb without problem, but when I do
$iw dev wlan0 ocb join 5890 10MHZ
I get the command failed: Invalid argument (-22) error. I have three PC Engines APU boards with Atheros r9280 NICs, and on one everything works fine. Even doing ocb join. However, on the other 2 I get stuck at the (-22) error message.
On the working machine I get the following two messages when typing dmesg:
[ 5.239890] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[ 5.270494] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

On the two non-working machines the card never becomes ready.
[ 5.239890] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready

Also, on the non-working machines I get the following warning:

[   69.795312] WARNING: CPU: 1 PID: 0 at ../net/mac80211/ocb.c:66 ieee80211_ocb_rx_no_sta+0x134/0x140()
[   69.795319] Modules linked in:
[   69.795335] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.18.0+ #2
[   69.795342] Hardware name: PC Engines APU/APU, BIOS 4.0 09/08/2014
[   69.795350]  ffffffff81ca53b8 ffff88011ed03bf8 ffffffff818cc472 0000000000040400
[   69.795360]  0000000000000000 ffff88011ed03c38 ffffffff8104ecb5 0000000000000000
[   69.795370]  ffff880037834880 ffff8800dab984ca ffff8800378f8660 ffff880119bcfd00
[   69.795380] Call Trace:
[   69.795388]  <IRQ>  [<ffffffff818cc472>] dump_stack+0x45/0x57
[   69.795409]  [<ffffffff8104ecb5>] warn_slowpath_common+0x85/0xc0
[   69.795419]  [<ffffffff8104ed95>] warn_slowpath_null+0x15/0x20
[   69.795431]  [<ffffffff818bbb64>] ieee80211_ocb_rx_no_sta+0x134/0x140
[   69.795442]  [<ffffffff818910c6>] ieee80211_prepare_and_rx_handle+0x866/0xaf0
[   69.795453]  [<ffffffff816f228e>] ? build_skb+0x2e/0x130
[   69.795462]  [<ffffffff8189192e>] ieee80211_rx+0x5de/0x8f0
[   69.795475]  [<ffffffff81577248>] ath_rx_tasklet+0x698/0xd90
[   69.795486]  [<ffffffff81574adc>] ath9k_tasklet+0xdc/0x260
[   69.795497]  [<ffffffff8105293f>] tasklet_action+0xcf/0xe0
[   69.795506]  [<ffffffff81052c87>] __do_softirq+0xa7/0x290
[   69.795515]  [<ffffffff81052fa5>] irq_exit+0x85/0x90
[   69.795525]  [<ffffffff81004943>] do_IRQ+0x53/0xe0
[   69.795534]  [<ffffffff818d536a>] common_interrupt+0x6a/0x6a
[   69.795540]  <EOI>  [<ffffffff8166c3fc>] ? cpuidle_enter_state+0x6c/0x160
[   69.795568]  [<ffffffff8166c3e5>] ? cpuidle_enter_state+0x55/0x160
[   69.795578]  [<ffffffff8166c5c2>] cpuidle_enter+0x12/0x20
[   69.795589]  [<ffffffff81085e58>] cpu_startup_entry+0x2f8/0x3a0
[   69.795601]  [<ffffffff81032daa>] start_secondary+0x13a/0x150
[   69.795608] ---[ end trace ba87725444b9a94c ]---

Any ideas on what could be wrong would be very appreciated!

@raghav3276

This comment has been minimized.

Copy link

commented Dec 22, 2015

You may have to do the following changes in the driver (drivers/net/wireless/ath/regd.c), or apply the patch:

From e21f502fbc3858c3ed3cc8ee97f64f41214e43d7 Mon Sep 17 00:00:00 2001
From: A Raghavendra Rao <arrao@cdac.in>
Date: Mon, 21 Dec 2015 11:29:29 +0530
Subject: [PATCH 01/17] Regd changes

- Removed REGULATORY_STRICT_REG flag to support all ath9k cards
- Modified NL80211_REGDOM_SET_BY_DRIVER to NL80211_REGDOM_SET_BY_USER
  This flags will enforce the user space regulatory domain to be used

Signed-off-by: A Raghavendra Rao <arrao@cdac.in>

---
 drivers/net/wireless/ath/regd.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index b1e4171..dec6ec7 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -633,8 +633,7 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
    const struct ieee80211_regdomain *regd;

    wiphy->reg_notifier = reg_notifier;
-   wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
-                  REGULATORY_CUSTOM_REG;
+   wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;

    if (ath_is_world_regd(reg)) {
        /*
@@ -654,7 +653,7 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,

    wiphy_apply_custom_regulatory(wiphy, regd);
    ath_reg_apply_radar_flags(wiphy);
-   ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg);
+   ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_USER, reg);
    return 0;
 }

-- 
1.7.9.5

@scateu

This comment has been minimized.

Copy link

commented Feb 16, 2016

line 91, need to add REG_BIN=/lib/crda/regulatory.bin

c2c/802.11p-crda$ make REG_BIN=/lib/crda/regulatory.bin 

or it will cause error, though it doesn't do any harm to the whole process.

@abualhoul44

This comment has been minimized.

Copy link

commented Apr 22, 2016

Why I keep having this whever I try to make iw -- wifi configuration tool

/bin/sh: pkg-config: not found
/bin/sh: pkg-config: not found
/bin/sh: pkg-config: not found
/bin/sh: pkg-config: not found
/bin/sh: pkg-config: not found
Makefile:76: *** Cannot find development files for any supported version of libnl.  Stop.
@jfpastrana

This comment has been minimized.

Copy link

commented May 15, 2016

abualhoul44, you should install the package "pkg-config". Then you should install the libnl packages, however it depends of the version that you have installed, in my case I needed "libnl" and "libnl-devel".

@abualhoul44

This comment has been minimized.

Copy link

commented Jun 27, 2016

I have followed the procedure, Kernel updated, each build and make was smooth on apu2 box and Voyage 0.10. but when reboot to the new kernel, I have no more wireless card or eithernet.

@pepros

This comment has been minimized.

Copy link

commented Jun 27, 2017

Hi,
Thank you very much for the detailed instruction.
I have the same problem as @apaixao when using ath5k (Unex DCMA-86P2 with Atheros AR5414A-B2B)
$iw dev wlan0 set type ocb
command failed: Operation not supported (-95)
Does anyone know how to resolve the problem? If it doesn't work on ath5k, can you suggest an alternative way to enable 802.11p on ath5k.
Thank you very much.

@Taknok

This comment has been minimized.

Copy link

commented Nov 18, 2017

Hi,
When I do $iw dev wlan0 set type ocb the operation is ok but at sudo ip link set wlan0 up I get RTNETLINK answers: Operation not supported
Does anyone know how to solve this ?
Thank

@abakabir

This comment has been minimized.

Copy link

commented Apr 25, 2018

Hi.
Could i follow this procedure on openwrt installed on a raspberry?
Thank you for your reply.

@saya7

This comment has been minimized.

Copy link

commented May 7, 2018

Hello,
what is the name of the board that you have used ?

@zpymyyn

This comment has been minimized.

Copy link

commented Mar 8, 2019

Hi,
Anyone solved the old issue "iw dev wlan0 set type ocb command failed: Operation not supported (-95)" ?

@anasbinmuslim

This comment has been minimized.

Copy link

commented Aug 21, 2019

I am having the similar problem i.e. when i do ocb join at 5890Mhz, i get a "command failed: invalid argument (-22)" error. Anyone managed to solve this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.