xref: /openwifi/README.md (revision e17fdc17d583cc389b5f7b3e358e5d068d2f9dbf)
10df4ca4dSimoerman# openwifi
22ee67178SXianjun Jiao<img src="./openwifi-arch.jpg" width="900">
32ee67178SXianjun Jiao
438f76c01SJiao Xianjun**openwifi:** Linux mac80211 compatible full-stack IEEE802.11/Wi-Fi design based on SDR (Software Defined Radio).
52ee67178SXianjun Jiao
6baca0e72SJiao XianjunThis repository includes Linux driver and software. [openwifi-hw](https://github.com/open-sdr/openwifi-hw) repository has the FPGA design. [[Detailed document](https://github.com/open-sdr/openwifi/tree/master/doc)]
72ee67178SXianjun Jiao
844dff4bdSJiao Xianjun[Demo [video](https://youtu.be/NpjEaszd5u4) and video [download](https://users.ugent.be/~xjiao/openwifi-low-aac.mp4)]   [openwifi [maillist](https://lists.ugent.be/wws/subscribe/openwifi)] [[Cite openwifi project](#cite-openwifi-project)]
92ee67178SXianjun Jiao
10a984b3fbSJiao XianjunOpenwifi code has dual licenses. AGPLv3 is the opensource license. For non-opensource license, please contact [email protected]. Openwifi project also leverages some 3rd party modules. It is user's duty to check and follow licenses of those modules according to the purpose/usage. You can find [an example explanation from Analog Devices](https://github.com/analogdevicesinc/hdl/blob/master/LICENSE) for this compound license conditions.
112ee67178SXianjun Jiao
122ee67178SXianjun JiaoOpenwifi was born in [ORCA project](https://www.orca-project.eu/) (EU's Horizon2020 programme under agreement number 732174).
132ee67178SXianjun Jiao
142ee67178SXianjun Jiao**Features:**
152ee67178SXianjun Jiao
16a20313b8SJiao Xianjun* 802.11a/g
17a20313b8SJiao Xianjun* 802.11n MCS 0~7 (Only PHY rx for now. Full system support of 802.11n will come soon)
18a20313b8SJiao Xianjun* 20MHz bandwidth; 70 MHz to 6 GHz frequency range
19149fafc0SJiao Xianjun* Mode tested: Ad-hoc; Station; AP, Monitor
20836d8a87SJiao Xianjun* DCF (CSMA/CA) low MAC layer in FPGA (10us SIFS is achieved)
212ee67178SXianjun Jiao* Configurable channel access priority parameters:
222ee67178SXianjun Jiao  * duration of RTS/CTS, CTS-to-self
232ee67178SXianjun Jiao  * SIFS/DIFS/xIFS/slot-time/CW/etc
242ee67178SXianjun Jiao* Time slicing based on MAC address
252ee67178SXianjun Jiao* Easy to change bandwidth and frequency:
262ee67178SXianjun Jiao  * 2MHz for 802.11ah in sub-GHz
272ee67178SXianjun Jiao  * 10MHz for 802.11p/vehicle in 5.9GHz
282ee67178SXianjun Jiao* On roadmap: **802.11ax**
292ee67178SXianjun Jiao
302ee67178SXianjun Jiao**Performance (AP: openwifi at channel 44, client: TL-WDN4200 N900 Wireless Dual Band USB Adapter. iperf test):**
312ee67178SXianjun Jiao* AP --> client: 30.6Mbps(TCP), 38.8Mbps(UDP)
322ee67178SXianjun Jiao* client --> AP: 17.0Mbps(TCP), 21.5Mbps(UDP)
332ee67178SXianjun Jiao
342ee67178SXianjun Jiao**Supported SDR platforms:**
352ee67178SXianjun Jiao
3686bab9c1SJiao Xianjun* zc706 (Xilinx) + fmcomms2/fmcomms4 (Analog Devices)
372ee67178SXianjun Jiao* On roadmap: ADRV9361-Z7035/ADRV9364-Z7020 + ADRV1CRR-BOB (Analog Devices)
3886bab9c1SJiao Xianjun* On roadmap: zcu102 (Xilinx) + fmcomms2/fmcomms4/ADRV9371 (Analog Devices)
392ee67178SXianjun Jiao* 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.
402ee67178SXianjun Jiao
412ee67178SXianjun Jiao**Quick start:** (Example instructions are verified on Ubuntu 16/18)
422ee67178SXianjun Jiao
43eb247655SJiao Xianjun* Download pre-built [openwifi Linux img file](https://users.ugent.be/~xjiao/openwifi-1.0.0-ghent.zip). Burn the img file to a 16G SD card:
442ee67178SXianjun Jiao
452ee67178SXianjun Jiao```
4686bab9c1SJiao Xianjunsudo dd bs=4M if=openwifi-1.0.0-ghent.img of=/dev/mmcblk0
472ee67178SXianjun Jiao(mmcblk0 is the dev name of sdcard in Linux. Make sure you use the correct one in your situation!)
482ee67178SXianjun Jiao(Above command takes a while)
492ee67178SXianjun Jiao```
5086bab9c1SJiao Xianjun* 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. (For fmcomms4/ad9364, you may connect antennas to TXA/RXA)
512ee67178SXianjun Jiao
522ee67178SXianjun Jiao* Connect the board to PC. (PC IP address should be 192.168.10.1). Power on the board. Then from PC:
532ee67178SXianjun Jiao
542ee67178SXianjun Jiao```
552ee67178SXianjun Jiaossh [email protected]
562ee67178SXianjun Jiao(password: openwifi)
572ee67178SXianjun Jiaocd openwifi
582ee67178SXianjun Jiaoservice network-manager stop
592ee67178SXianjun Jiao./wgd.sh
6086bab9c1SJiao Xianjun(For fmcomms4, you need an extra command: ./set_ant.sh rx1 tx1)
612ee67178SXianjun Jiaoifconfig sdr0 up
622ee67178SXianjun Jiaoiwlist sdr0 scan
632ee67178SXianjun Jiao(you should see the Wi-Fi scan result)
642ee67178SXianjun Jiao```
6586bab9c1SJiao Xianjun* Setup openwifi hotspot over topology: client -- (sdr0)|board|(eth0) -- (***ethX***)|PC|(***ethY***) -- internet
6686bab9c1SJiao Xianjun  * Enable IPv4 **IP forwarding** on both **board** and **PC**
672ee67178SXianjun Jiao  * Then, on board:
682ee67178SXianjun Jiao
692ee67178SXianjun Jiao        ifconfig sdr0 192.168.13.1
702ee67178SXianjun Jiao        route add default gw 192.168.10.1
712ee67178SXianjun Jiao        service isc-dhcp-server restart
722ee67178SXianjun Jiao        hostapd hostapd-openwifi.conf
732ee67178SXianjun Jiao  * Then, on PC:
742ee67178SXianjun Jiao
752ee67178SXianjun Jiao        sudo iptables -t nat -A POSTROUTING -o ethY -j MASQUERADE
762ee67178SXianjun Jiao        sudo ip route add 192.168.13.0/24 via 192.168.10.122 dev ethX
772ee67178SXianjun Jiao  * Now you can connect openwifi by your devices (phone, laptop, etc)
782ee67178SXianjun Jiao* Connect openwifi to another hotspot. Terminate hostapd, edit wpa-connect.conf properly, then:
792ee67178SXianjun Jiao
802ee67178SXianjun Jiao        ./wgd.sh
8186bab9c1SJiao Xianjun        (For fmcomms4, you need an extra command: ./set_ant.sh rx1 tx1)
822ee67178SXianjun Jiao        route del default gw 192.168.10.1
832ee67178SXianjun Jiao        wpa_supplicant -i sdr0 -c wpa-connect.conf
842ee67178SXianjun Jiao        (Wait for connection done, then open another ssh terminal)
852ee67178SXianjun Jiao        dhclient sdr0
86da62eb45SJiao Xianjun        (Wait for its done, then you should have connection)
872ee67178SXianjun Jiao
8802d858a7SJiao Xianjun* Real-time control/config via sdrctl (time slice config, etc), please go to openwifi/doc.
8902d858a7SJiao Xianjun
9002d858a7SJiao Xianjun* ***Note***: The files (BOOT.BIN, drivers, etc) in pre-built SD card img might not have the latest bug-fixes/features. Check related section in this README on how to generate them and update them if needed.
9102d858a7SJiao Xianjun
922ee67178SXianjun Jiao* ***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:
932ee67178SXianjun Jiao
942ee67178SXianjun Jiao        root@analog:~/openwifi# ./sdrctl dev sdr0 get reg rx 20
952ee67178SXianjun Jiao        SENDaddr: 00040050
962ee67178SXianjun Jiao        reg  val: 34be0123
972ee67178SXianjun Jiao        (If the last number of reg val is always 3, that means the Viterbi decoder stops working)
982ee67178SXianjun Jiao
992ee67178SXianjun Jiao**Build openwifi Linux img based on openwifi FPGA and driver:**
1002ee67178SXianjun Jiao
1015ae382e0SJiao Xianjun* Install Vivado/SDK 2017.4.1 (If you don't need to re-compile FPGA, WebPack version without license is enough)
1025ae382e0SJiao Xianjun* Get pre-built FPGA files from openwifi-hw repository.
1032ee67178SXianjun Jiao
1042ee67178SXianjun Jiao```
1052ee67178SXianjun Jiaogit submodule init openwifi-hw
1062ee67178SXianjun Jiaogit submodule update openwifi-hw
1072ee67178SXianjun Jiaocd openwifi-hw
10896be0adbSJiao Xianjungit checkout master
1092ee67178SXianjun Jiaogit pull
1102ee67178SXianjun Jiao```
1112ee67178SXianjun Jiao* Build Linux kernel and modules:
1122ee67178SXianjun Jiao
1132ee67178SXianjun Jiao```
1142ee67178SXianjun Jiaoexport XILINX_DIR=your_Xilinx_directory
1152ee67178SXianjun Jiaocd openwifi
1162ee67178SXianjun Jiaogit submodule init adi-linux
1172ee67178SXianjun Jiaogit submodule update adi-linux
1182ee67178SXianjun Jiao(Will take a while)
1192ee67178SXianjun Jiaocd adi-linux
1202ee67178SXianjun Jiaogit reset --hard 4220d5d24c6c7589fc702db4f941f0632b5ad767
1212ee67178SXianjun Jiaocp ../kernel_boot/kernel_config ./.config
1222ee67178SXianjun Jiaosource $XILINX_DIR/SDK/2017.4/settings64.sh
1232ee67178SXianjun Jiaoexport ARCH=arm
1242ee67178SXianjun Jiaoexport CROSS_COMPILE=arm-linux-gnueabihf-
1252ee67178SXianjun Jiaomake -j12 UIMAGE_LOADADDR=0x8000 uImage
1262ee67178SXianjun Jiao(Answer "y" to Xilinx DMA Engines (XILINX_DMA_ENGINES) [N/y/?] (NEW))
1272ee67178SXianjun Jiaomake modules
1282ee67178SXianjun Jiao```
1292ee67178SXianjun Jiao* Build openwifi Linux driver modules:
1302ee67178SXianjun Jiao
1312ee67178SXianjun Jiao```
1322ee67178SXianjun Jiaoexport OPENWIFI_DIR=your_openwifi_directory
1332ee67178SXianjun Jiaocd $OPENWIFI_DIR/driver
1342ee67178SXianjun Jiao./make_all.sh $XILINX_DIR/SDK/2017.4/ $OPENWIFI_DIR/adi-linux/
1352ee67178SXianjun Jiao```
1362ee67178SXianjun Jiao* Build openwifi Linux devicetree:
1372ee67178SXianjun Jiao
1382ee67178SXianjun Jiao```
1392ee67178SXianjun Jiaocd $OPENWIFI_DIR/kernel_boot
1402ee67178SXianjun Jiaodtc -I dts -O dtb -o devicetree.dtb devicetree.dts
1412ee67178SXianjun Jiao```
1422ee67178SXianjun Jiao* Build openwifi BOOT.BIN based on FPGA files generated in openwifi-hw:
1432ee67178SXianjun Jiao
1442ee67178SXianjun Jiao```
1452ee67178SXianjun Jiaocd $OPENWIFI_DIR/kernel_boot
146c017e305SJiao Xianjunsource $XILINX_DIR/SDK/2017.4/settings64.sh
1472ee67178SXianjun Jiao./build_boot_bin.sh ../openwifi-hw/zc706_fmcs2/sdk/system_top_hw_platform_0/system.hdf u-boot-zc70x.elf
1482ee67178SXianjun Jiao(u-boot-zc70x.elf is included in the original Analog Devices Linux img)
1492ee67178SXianjun Jiao```
1502ee67178SXianjun Jiao* 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.
1519e8d5e4aSJiao Xianjun* 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):
1522ee67178SXianjun Jiao
1532ee67178SXianjun Jiao```
1542ee67178SXianjun Jiaoexport SDCARD_DIR=sdcard_mount_point
1552ee67178SXianjun Jiaocp $OPENWIFI_DIR/kernel_boot/devicetree.dtb $SDCARD_DIR/BOOT
1562ee67178SXianjun Jiaocp $OPENWIFI_DIR/kernel_boot/output_boot_bin/BOOT.BIN $SDCARD_DIR/BOOT
1572ee67178SXianjun Jiaocp $OPENWIFI_DIR/adi-linux/arch/arm/boot/uImage $SDCARD_DIR/BOOT
1582ee67178SXianjun Jiaocd $SDCARD_DIR/BOOT
1592ee67178SXianjun Jiaosync
1602ee67178SXianjun Jiao
1612ee67178SXianjun Jiaosudo mkdir $SDCARD_DIR/rootfs/root/openwifi
1622ee67178SXianjun Jiaosudo find $OPENWIFI_DIR/driver -name \*.ko -exec cp {} $SDCARD_DIR/rootfs/root/openwifi/ \;
1632ee67178SXianjun Jiaosudo cp $OPENWIFI_DIR/user_space/* $SDCARD_DIR/rootfs/root/openwifi/
1642ee67178SXianjun Jiao
1652ee67178SXianjun Jiaosudo mkdir $SDCARD_DIR/rootfs/lib/modules
1662ee67178SXianjun Jiaosudo mkdir $SDCARD_DIR/rootfs/lib/modules/4.14.0-g4220d5d24c6c
1672ee67178SXianjun Jiaosudo find $OPENWIFI_DIR/adi-linux -name \*.ko -exec cp {} $SDCARD_DIR/rootfs/lib/modules/4.14.0-g4220d5d24c6c/ \;
1682ee67178SXianjun Jiaosudo rm $SDCARD_DIR/rootfs/lib/modules/4.14.0-g4220d5d24c6c/{axidmatest.ko,xilinx_dma.ko,adi_axi_hdmi.ko,ad9361_drv.ko} -f
1692ee67178SXianjun Jiao
1702ee67178SXianjun Jiaosudo rm $SDCARD_DIR/rootfs/etc/udev/rules.d/70-persistent-net.rules
1712ee67178SXianjun Jiaosudo cp $OPENWIFI_DIR/kernel_boot/70-persistent-net.rules $SDCARD_DIR/rootfs/etc/udev/rules.d/
1722ee67178SXianjun Jiao(Above rule will auto-rename wlan0 to sdr0 which is the openwifi NIC name)
1732ee67178SXianjun Jiaocd $SDCARD_DIR/rootfs
1742ee67178SXianjun Jiaosync
1752ee67178SXianjun Jiao```
1762ee67178SXianjun Jiao**Run Linux and do some post-config:**
1772ee67178SXianjun Jiao
1782ee67178SXianjun Jiao* 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:
1792ee67178SXianjun Jiao
1802ee67178SXianjun Jiao```
1812ee67178SXianjun Jiaodepmod
1822ee67178SXianjun Jiao(Ignore the error messages)
1832ee67178SXianjun Jiaomodprobe mac80211
18431ae0e6cSXianjun Jiao(if you get error like: could not open moddep file 'lib/modules/4.14.0XXXYYYZZZ/modules.dep.bin', you could make a symbol link and modprobe again)
18531ae0e6cSXianjun Jiaoln -s /lib/modules/4.14.0-g4220d5d24c6c /lib/modules/4.14.0XXXYYYZZZ
18631ae0e6cSXianjun Jiaodepmod
18731ae0e6cSXianjun Jiaomodprobe mac80211
18831ae0e6cSXianjun Jiao
1892ee67178SXianjun Jiaocd openwifi
1902ee67178SXianjun Jiao./wgd.sh
19186bab9c1SJiao Xianjun(For fmcomms4, you need an extra command: ./set_ant.sh rx1 tx1)
1922ee67178SXianjun Jiao(Wait for the completion)
1932ee67178SXianjun Jiaoifconfig
1942ee67178SXianjun Jiao(You should see sdr0 interface)
1952ee67178SXianjun Jiaoiwlist sdr0 scan
1962ee67178SXianjun Jiao(You should see the Wi-Fi scan results)
1972ee67178SXianjun Jiao```
1982ee67178SXianjun Jiao* Config ssh server and ethernet IP address of the board. In the PC serial console:
1992ee67178SXianjun Jiao
2002ee67178SXianjun Jiao```
2012ee67178SXianjun Jiaopasswd
2022ee67178SXianjun Jiao(ssh server needs a password, such as "openwifi")
2032ee67178SXianjun JiaoAdd "UseDNS no" to /etc/ssh/sshd_config, otherwise ssh login takes too long time
2042ee67178SXianjun JiaoSet static IP to board (If you have DHCP server on PC, you can skip this step)
2052ee67178SXianjun JiaoAdd following content to /etc/network/interfaces
2062ee67178SXianjun Jiao  auto lo eth0
2072ee67178SXianjun Jiao  iface lo inet loopback
2082ee67178SXianjun Jiao  iface eth0 inet static
2092ee67178SXianjun Jiao          address 192.168.10.122
2102ee67178SXianjun Jiao          netmask 255.255.255.0
2112ee67178SXianjun JiaoAdd following content to /etc/resolv.conf
2122ee67178SXianjun Jiao  nameserver 8.8.8.8
2132ee67178SXianjun Jiao  nameserver 4.4.4.4
2142ee67178SXianjun Jiao
2152ee67178SXianjun JiaoDisable update (long time hang) on boot or ssh session:
2162ee67178SXianjun Jiao  sudo chmod -x /etc/update-motd.d/90-updates-available
2172ee67178SXianjun Jiao  sudo chmod -x /etc/update-motd.d/91-release-upgrade
2182ee67178SXianjun Jiao
2199e8d5e4aSJiao Xianjunreboot the board, and set proper IP (192.168.10.1) of the connected PC, then from the PC:
2202ee67178SXianjun Jiaossh [email protected]
2212ee67178SXianjun Jiao(password: openwifi)
2222ee67178SXianjun Jiao```
2239e8d5e4aSJiao Xianjun* Make on board file update easier:
2249e8d5e4aSJiao Xianjun  * Option 1: Access the board disk/rootfs from Ubuntu PC: "File manager --> Connect to Server...", input: sftp://[email protected]/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:
2259e8d5e4aSJiao Xianjun
2269e8d5e4aSJiao Xianjun         mount /dev/mmcblk0p1 /sdcard
2279e8d5e4aSJiao Xianjun         (Create /sdcard directory firstly if it doesn't exist)
2289e8d5e4aSJiao Xianjun         cp file /sdcard
2299e8d5e4aSJiao Xianjun         cd /sdcard
2309e8d5e4aSJiao Xianjun         sync
2319e8d5e4aSJiao Xianjun         cd /
2329e8d5e4aSJiao Xianjun         umount /sdcard
2339e8d5e4aSJiao Xianjun         (Remember to power cycle the board)
2349e8d5e4aSJiao Xianjun  * 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:
2359e8d5e4aSJiao Xianjun
2369e8d5e4aSJiao Xianjun        ./sdcard_boot_update.sh
2379e8d5e4aSJiao Xianjun        (Above command downloads uImage, BOOT.BIN and devicetree.dtb, then copy them into boot partition. Remember to power cycle)
2389e8d5e4aSJiao Xianjun        ./wgd.sh remote
2399e8d5e4aSJiao Xianjun        (Above command downloads driver files, and brings up sdr0)
24086bab9c1SJiao Xianjun        (For fmcomms4, you need an extra command: ./set_ant.sh rx1 tx1)
2419e8d5e4aSJiao Xianjun
24286bab9c1SJiao Xianjun**Compile sdrctl on the board** ("On the board" means that you login to the board via ssh)
2432ee67178SXianjun Jiao
2442ee67178SXianjun Jiao```
2452ee67178SXianjun Jiaosudo apt-get install libnl-3-dev
2462ee67178SXianjun Jiaosudo apt-get install libnl-genl-3-dev
247ffe9541bSJiao Xianjun(Please find the next section to see how to connect board to the internet via your PC)
2482ee67178SXianjun Jiao(or find out .deb files by above commands and copy .deb to the board, if you do not have internet)
2492ee67178SXianjun Jiao
25086bab9c1SJiao Xianjuncopy $OPENWIFI_DIR/user_space/sdrctl_src to the board, then on the board:
2512ee67178SXianjun Jiaocd sdrctl_src
2522ee67178SXianjun Jiaochmod +x version.sh
2532ee67178SXianjun Jiaomake
2542ee67178SXianjun Jiao```
2552ee67178SXianjun Jiao**Internet config**
25686bab9c1SJiao Xianjun* Connect board to internet. Topology: board|(eth0) -- (***ethX***)|PC|(***ethY***) -- internet
25786bab9c1SJiao Xianjun  * Enable IPv4 **IP forwarding** on both **board** and **PC**
25886bab9c1SJiao Xianjun  * On board:
25986bab9c1SJiao Xianjun  ```
26086bab9c1SJiao Xianjun  route add default gw 192.168.10.1
26186bab9c1SJiao Xianjun  ```
2622ee67178SXianjun Jiao  * On PC. After this your board should have internet via NAT through your PC.
2632ee67178SXianjun Jiao
2642ee67178SXianjun Jiao  ```
2652ee67178SXianjun Jiao  sudo iptables -t nat -A POSTROUTING -o ethY -j MASQUERADE
2662ee67178SXianjun Jiao  ```
26786bab9c1SJiao Xianjun* Setup AP for Wi-Fi client. Topology: client -- (sdr0)|board|(eth0) -- (***ethX***)|PC|(***ethY***) -- internet
2682ee67178SXianjun Jiao  * On board: Install dhcp server preparing for serving your openwifi clients via hostapd.
2692ee67178SXianjun Jiao
2702ee67178SXianjun Jiao  ```
2712ee67178SXianjun Jiao  sudo apt-get install isc-dhcp-server
2722ee67178SXianjun Jiao  sudo apt-get install Haveged
27386bab9c1SJiao Xianjun  sudo apt-get install hostapd
2742ee67178SXianjun Jiao  ```
2752ee67178SXianjun Jiao  * Put user_space/dhcpd.conf into (overwrite) /etc/dhcp/dhcpd.conf on board.
2762ee67178SXianjun Jiao  * On board:
2772ee67178SXianjun Jiao
2782ee67178SXianjun Jiao  ```
2792ee67178SXianjun Jiao  cd openwifi
2802ee67178SXianjun Jiao  service network-manager stop
2812ee67178SXianjun Jiao  ./wgd.sh
28286bab9c1SJiao Xianjun  (For fmcomms4, you need an extra command: ./set_ant.sh rx1 tx1)
2832ee67178SXianjun Jiao  ifconfig sdr0 up
2842ee67178SXianjun Jiao  ifconfig sdr0 192.168.13.1
2852ee67178SXianjun Jiao  route add default gw 192.168.10.1
2862ee67178SXianjun Jiao  service isc-dhcp-server restart
2872ee67178SXianjun Jiao  hostapd hostapd-openwifi.conf
2882ee67178SXianjun Jiao  ```
2892ee67178SXianjun Jiao  * On PC:
2902ee67178SXianjun Jiao
2912ee67178SXianjun Jiao  ```
2922ee67178SXianjun Jiao  sudo ip route add 192.168.13.0/24 via 192.168.10.122 dev ethX
2932ee67178SXianjun Jiao  ```
294ffe9541bSJiao Xianjun  * Now you can connect openwifi hotspot from your phone/laptop and access the internet.
29544dff4bdSJiao Xianjun
296*e17fdc17Smmehari**Connecting a client to openwifi AP in 2.4GHz**
297*e17fdc17Smmehari
298*e17fdc17SmmehariOpenwifi only applies OFDM as its modulation scheme and as a result, it is not backward compatible with 802.11b clients or modes of operation. This is usually the case during beacon transmission, connection establishment, and robust communication.
299*e17fdc17Smmehari
300*e17fdc17SmmehariAs a solution to this problem, openwifi can be fully controlled only if communicating with APs/clients instantiated using hostapd/wpa_supplicant userspace programs respectively.
301*e17fdc17Smmehari
302*e17fdc17SmmehariFor hostapd program, 802.11b rates can be suppressed using configuration commands (i.e. supported_rates, basic_rates) and an example configuration file is provided (i.e. hostapd-openwifi.conf). One small caveat to this one comes from fullMAC Wi-Fi cards as they must implement the *NL80211_TXRATE_LEGACY* NetLink handler at the device driver level.
303*e17fdc17Smmehari
304*e17fdc17SmmehariOn the other hand, the wpa_supplicant program on the client side (commercial Wi-Fi dongle/board) cannot suppress 802.11b rates out of the box in 2.4GHz band, so there will be an issue when connecting openwifi (OFDM only). A patched wpa_supplicant should be used at the client side.
305*e17fdc17Smmehari
306*e17fdc17Smmehari```
307*e17fdc17Smmeharicd openwifi/user_space
308*e17fdc17Smmehariwget http://w1.fi/releases/wpa_supplicant-2.1.tar.gz
309*e17fdc17Smmeharitar xzvf wpa_supplicant-2.1.tar.gz
310*e17fdc17Smmeharipatch -d wpa_supplicant-2.1/src/drivers/ < driver_nl80211.patch
311*e17fdc17Smmeharicd wpa_supplicant-2.1/wpa_supplicant/
312*e17fdc17Smmeharicp defconfig .config
313*e17fdc17Smmeharised -i 's/#CONFIG_LIBNL32.*/CONFIG_LIBNL32=y/g' .config
314*e17fdc17Smmeharimake -j16
315*e17fdc17Smmeharisudo make install
316*e17fdc17Smmeharicd ../../
317*e17fdc17Smmeharirm -r wpa_supplicant-2.1/ wpa_supplicant-2.1.tar.gz
318*e17fdc17Smmehari```
319*e17fdc17Smmehari
32044dff4bdSJiao Xianjun## cite openwifi project
32144dff4bdSJiao Xianjun
32244dff4bdSJiao XianjunAny use of openwifi project which results in a publication should include a citation via (bibtex example):
32344dff4bdSJiao Xianjun```
32444dff4bdSJiao Xianjun@electronic{openwifigithub,
32544dff4bdSJiao Xianjun            author = {Xianjun, Jiao and Wei, Liu and Michael, Mehari},
32644dff4bdSJiao Xianjun            title = {open-source IEEE802.11/Wi-Fi baseband chip/FPGA design},
32744dff4bdSJiao Xianjun            url = {https://github.com/open-sdr/openwifi},
32844dff4bdSJiao Xianjun            year = {2019},
32944dff4bdSJiao Xianjun}
33044dff4bdSJiao Xianjun```
331