This repository includes Linux driver and software. [openwifi-hw](https://github.com/open-sdr/openwifi-hw) repository has the FPGA design. [[Detailed architecture](https://github.com/open-sdr/openwifi/tree/master/doc)]
Openwifi code has dual licenses. AGPLv3 is the opensource license. For non-opensource license, please contact Filip.Louagie@UGent.be. Openwifi project also leverages some 3rd party modules. It is your duty to check and follow licenses of those modules according to your purpose. You can find [an example explanation from Analog Devices](https://github.com/analogdevicesinc/hdl/blob/master/LICENSE) for this compound license conditions.
Openwifi was born in [ORCA project](https://www.orca-project.eu/) (EU's Horizon2020 programme under agreement number 732174).
**Performance (AP: openwifi at channel 44, client: TL-WDN4200 N900 Wireless Dual Band USB Adapter. iperf test):**
* AP --> client: 30.6Mbps(TCP), 38.8Mbps(UDP)
* client --> AP: 17.0Mbps(TCP), 21.5Mbps(UDP)
**Supported SDR platforms:**
* zc706 (Xilinx) + fmcomms2 (Analog Devices)
* On roadmap: ADRV9361-Z7035/ADRV9364-Z7020 + ADRV1CRR-BOB (Analog Devices)
* On roadmap: zcu102 (Xilinx) + fmcomms2/ADRV9371 (Analog Devices)
* Don't have any boards? Or you like JTAG boot instead of SD card? Check our test bed [w-iLab.t](https://doc.ilabt.imec.be/ilabt/wilab/tutorials/openwifi.html) tutorial.
**Quick start:** (Example instructions are verified on Ubuntu 16/18)
(mmcblk0 is the dev name of sdcard in Linux. Make sure you use the correct one in your situation!)
(Above command takes a while)
```
* Connect RX/TX antenna to RX1A/TX2A ports of your zc706+fmcomms2 platform, and make two antennas orthogonal to each other for good isolation. Config zc706 to SD card boot mode by switches (Read zc706 board spec on internet). Insert the SD card to zc706.
* Connect the board to PC. (PC IP address should be 192.168.10.1). Power on the board. Then from PC:
```
ssh root@192.168.10.122
(password: openwifi)
cd openwifi
service network-manager stop
./wgd.sh
ifconfig sdr0 up
iwlist sdr0 scan
(you should see the Wi-Fi scan result)
```
* Setup openwifi hotspot over topology: client -- (sdr0)|zc706|(eth0) -- (***ethX***)|PC|(***ethY***) -- internet
* Enable IPv4 IP forwarding on both zc706 and PC
* Then, on board:
ifconfig sdr0 192.168.13.1
route add default gw 192.168.10.1
service isc-dhcp-server restart
hostapd hostapd-openwifi.conf
* Then, on PC:
sudo iptables -t nat -A POSTROUTING -o ethY -j MASQUERADE
sudo ip route add 192.168.13.0/24 via 192.168.10.122 dev ethX
* Now you can connect openwifi by your devices (phone, laptop, etc)
* Connect openwifi to another hotspot. Terminate hostapd, edit wpa-connect.conf properly, then:
./wgd.sh
route del default gw 192.168.10.1
wpa_supplicant -i sdr0 -c wpa-connect.conf
(Wait for connection done, then open another ssh terminal)
dhclient sdr0
(Wait for its donw, then you should have connection)
* ***Note***: If openwifi stops working after ~2 hours, it means the evaluation license of Xilinx Viterbi decoder has expired. You need to power cycle the board. Run this command several times on board to confirm:
root@analog:~/openwifi# ./sdrctl dev sdr0 get reg rx 20
SENDaddr: 00040050
reg val: 34be0123
(If the last number of reg val is always 3, that means the Viterbi decoder stops working)
(u-boot-zc70x.elf is included in the original Analog Devices Linux img)
```
* Download [2017_R1-2018_01_29.img.xz](http://swdownloads.analog.com/cse/2017_R1-2018_01_29.img.xz) from [Analog Devices Wiki](https://wiki.analog.com/resources/tools-software/linux-software/zynq_images). Burn it into a SD card via your PC.
* Mount SD card BOOT/rootfs partitions to SDCARD_DIR directory of your PC (If it is mounted automatically, find the directory). Then copy built files to SD card via your PC. (You can also update files over ftp/ssh after your full system runs. Please check next section. Read carefully user_space/sdcard_boot_update.sh and set your ftp root directory to $OPENWIFI_DIR in your PC):
(Above rule will auto-rename wlan0 to sdr0 which is the openwifi NIC name)
cd $SDCARD_DIR/rootfs
sync
```
**Run Linux and do some post-config:**
* Insert the SD card to the board, power on and run serial console (such as minicom) from a PC via USB-UART cable to the board. After booting completes, in the PC serial console:
* Option 1: Access the board disk/rootfs from Ubuntu PC: "File manager --> Connect to Server...", input: sftp://root@192.168.10.122/root . Then you can operate files on board like normal files on your disk. To update files that need to be in boot partition (BOOT.BIN, uImage and devicetree.dtb), you can transfer those files to rootfs firstly, then on board:
mount /dev/mmcblk0p1 /sdcard
(Create /sdcard directory firstly if it doesn't exist)
cp file /sdcard
cd /sdcard
sync
cd /
umount /sdcard
(Remember to power cycle the board)
* Option 2: Setup [ftp server](https://help.ubuntu.com/lts/serverguide/ftp-server.html) on PC, allow anonymous and change ftp root directory to $OPENWIFI_DIR. Then on board:
./sdcard_boot_update.sh
(Above command downloads uImage, BOOT.BIN and devicetree.dtb, then copy them into boot partition. Remember to power cycle)
./wgd.sh remote
(Above command downloads driver files, and brings up sdr0)