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 36*9e696164SXianjun Jiaoboard_name|actual boards used|status 37*9e696164SXianjun Jiao-------|-------|---- 38*9e696164SXianjun Jiaozc706_fmcs2|Xilinx ZC706 dev board + FMCOMMS2/3/4|done 39*9e696164SXianjun Jiaoadrv9361z7035|ADRV9361Z7035 SOM + ADRV1CRR-BOB carrier board|ongoing 40*9e696164SXianjun Jiaoadrv9361z7035_fmc|ADRV9361Z7035 SOM + ADRV1CRR-FMC carrier board|ongoing 41*9e696164SXianjun Jiaoadrv9364z7020|ADRV9364Z7020 SOM + ADRV1CRR-BOB carrier board|future 42*9e696164SXianjun Jiaozcu102_fmcs2|Xilinx ZCU102 dev board + FMCOMMS2/3/4|future 43*9e696164SXianjun Jiaozcu102_9371|Xilinx ZCU102 dev board + ADRV9371|future 44*9e696164SXianjun Jiao 45*9e696164SXianjun Jiao* board_name is used to identify FPGA design in openwifi-hw/boards/ 462ee67178SXianjun 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. 47*9e696164SXianjun Jiao* zc706_fmcs2 is taken as example for following operations. 482ee67178SXianjun Jiao 492ee67178SXianjun Jiao**Quick start:** (Example instructions are verified on Ubuntu 16/18) 502ee67178SXianjun Jiao 51eb247655SJiao 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: 522ee67178SXianjun Jiao 532ee67178SXianjun Jiao``` 5486bab9c1SJiao Xianjunsudo dd bs=4M if=openwifi-1.0.0-ghent.img of=/dev/mmcblk0 552ee67178SXianjun Jiao(mmcblk0 is the dev name of sdcard in Linux. Make sure you use the correct one in your situation!) 562ee67178SXianjun Jiao(Above command takes a while) 572ee67178SXianjun Jiao``` 58*9e696164SXianjun Jiao* Connect RX/TX antenna to RX1A/TX2A ports of fmcomms2/3(For fmcomms4/ad9364, you may connect antennas to TXA/RXA), and make two antennas orthogonal to each other for good isolation. Config the board to SD card boot mode by switches (Read the board spec on internet). Insert the SD card to the board. 592ee67178SXianjun Jiao 602ee67178SXianjun Jiao* Connect the board to PC. (PC IP address should be 192.168.10.1). Power on the board. Then from PC: 612ee67178SXianjun Jiao 622ee67178SXianjun Jiao``` 632ee67178SXianjun Jiaossh [email protected] 642ee67178SXianjun Jiao(password: openwifi) 652ee67178SXianjun Jiaocd openwifi 662ee67178SXianjun Jiaoservice network-manager stop 672ee67178SXianjun Jiao./wgd.sh 6886bab9c1SJiao Xianjun(For fmcomms4, you need an extra command: ./set_ant.sh rx1 tx1) 692ee67178SXianjun Jiaoifconfig sdr0 up 702ee67178SXianjun Jiaoiwlist sdr0 scan 712ee67178SXianjun Jiao(you should see the Wi-Fi scan result) 722ee67178SXianjun Jiao``` 7386bab9c1SJiao Xianjun* Setup openwifi hotspot over topology: client -- (sdr0)|board|(eth0) -- (***ethX***)|PC|(***ethY***) -- internet 7486bab9c1SJiao Xianjun * Enable IPv4 **IP forwarding** on both **board** and **PC** 752ee67178SXianjun Jiao * Then, on board: 762ee67178SXianjun Jiao 772ee67178SXianjun Jiao ifconfig sdr0 192.168.13.1 782ee67178SXianjun Jiao route add default gw 192.168.10.1 792ee67178SXianjun Jiao service isc-dhcp-server restart 802ee67178SXianjun Jiao hostapd hostapd-openwifi.conf 812ee67178SXianjun Jiao * Then, on PC: 822ee67178SXianjun Jiao 832ee67178SXianjun Jiao sudo iptables -t nat -A POSTROUTING -o ethY -j MASQUERADE 842ee67178SXianjun Jiao sudo ip route add 192.168.13.0/24 via 192.168.10.122 dev ethX 852ee67178SXianjun Jiao * Now you can connect openwifi by your devices (phone, laptop, etc) 862ee67178SXianjun Jiao* Connect openwifi to another hotspot. Terminate hostapd, edit wpa-connect.conf properly, then: 872ee67178SXianjun Jiao 882ee67178SXianjun Jiao ./wgd.sh 8986bab9c1SJiao Xianjun (For fmcomms4, you need an extra command: ./set_ant.sh rx1 tx1) 902ee67178SXianjun Jiao route del default gw 192.168.10.1 912ee67178SXianjun Jiao wpa_supplicant -i sdr0 -c wpa-connect.conf 922ee67178SXianjun Jiao (Wait for connection done, then open another ssh terminal) 932ee67178SXianjun Jiao dhclient sdr0 94da62eb45SJiao Xianjun (Wait for its done, then you should have connection) 952ee67178SXianjun Jiao 9602d858a7SJiao Xianjun* Real-time control/config via sdrctl (time slice config, etc), please go to openwifi/doc. 9702d858a7SJiao Xianjun 9802d858a7SJiao 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. 9902d858a7SJiao Xianjun 1002ee67178SXianjun 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: 1012ee67178SXianjun Jiao 1022ee67178SXianjun Jiao root@analog:~/openwifi# ./sdrctl dev sdr0 get reg rx 20 1032ee67178SXianjun Jiao SENDaddr: 00040050 1042ee67178SXianjun Jiao reg val: 34be0123 1052ee67178SXianjun Jiao (If the last number of reg val is always 3, that means the Viterbi decoder stops working) 1062ee67178SXianjun Jiao 1072ee67178SXianjun Jiao**Build openwifi Linux img based on openwifi FPGA and driver:** 1082ee67178SXianjun Jiao 1095ae382e0SJiao Xianjun* Install Vivado/SDK 2017.4.1 (If you don't need to re-compile FPGA, WebPack version without license is enough) 1105ae382e0SJiao Xianjun* Get pre-built FPGA files from openwifi-hw repository. 1112ee67178SXianjun Jiao 1122ee67178SXianjun Jiao``` 1132ee67178SXianjun Jiaogit submodule init openwifi-hw 1142ee67178SXianjun Jiaogit submodule update openwifi-hw 1152ee67178SXianjun Jiaocd openwifi-hw 11696be0adbSJiao Xianjungit checkout master 1172ee67178SXianjun Jiaogit pull 1182ee67178SXianjun Jiao``` 1192ee67178SXianjun Jiao* Build Linux kernel and modules: 1202ee67178SXianjun Jiao 1212ee67178SXianjun Jiao``` 1222ee67178SXianjun Jiaoexport XILINX_DIR=your_Xilinx_directory 1232ee67178SXianjun Jiaocd openwifi 1242ee67178SXianjun Jiaogit submodule init adi-linux 1252ee67178SXianjun Jiaogit submodule update adi-linux 1262ee67178SXianjun Jiao(Will take a while) 1272ee67178SXianjun Jiaocd adi-linux 1282ee67178SXianjun Jiaogit reset --hard 4220d5d24c6c7589fc702db4f941f0632b5ad767 1292ee67178SXianjun Jiaocp ../kernel_boot/kernel_config ./.config 1302ee67178SXianjun Jiaosource $XILINX_DIR/SDK/2017.4/settings64.sh 1312ee67178SXianjun Jiaoexport ARCH=arm 1322ee67178SXianjun Jiaoexport CROSS_COMPILE=arm-linux-gnueabihf- 1332ee67178SXianjun Jiaomake -j12 UIMAGE_LOADADDR=0x8000 uImage 1342ee67178SXianjun Jiao(Answer "y" to Xilinx DMA Engines (XILINX_DMA_ENGINES) [N/y/?] (NEW)) 1352ee67178SXianjun Jiaomake modules 1362ee67178SXianjun Jiao``` 1372ee67178SXianjun Jiao* Build openwifi Linux driver modules: 1382ee67178SXianjun Jiao 1392ee67178SXianjun Jiao``` 1402ee67178SXianjun Jiaoexport OPENWIFI_DIR=your_openwifi_directory 1412ee67178SXianjun Jiaocd $OPENWIFI_DIR/driver 1422ee67178SXianjun Jiao./make_all.sh $XILINX_DIR/SDK/2017.4/ $OPENWIFI_DIR/adi-linux/ 1432ee67178SXianjun Jiao``` 1442ee67178SXianjun Jiao* Build openwifi Linux devicetree: 1452ee67178SXianjun Jiao 1462ee67178SXianjun Jiao``` 1472ee67178SXianjun Jiaocd $OPENWIFI_DIR/kernel_boot 1482ee67178SXianjun Jiaodtc -I dts -O dtb -o devicetree.dtb devicetree.dts 1492ee67178SXianjun Jiao``` 1502ee67178SXianjun Jiao* Build openwifi BOOT.BIN based on FPGA files generated in openwifi-hw: 1512ee67178SXianjun Jiao 1522ee67178SXianjun Jiao``` 1532ee67178SXianjun Jiaocd $OPENWIFI_DIR/kernel_boot 154c017e305SJiao Xianjunsource $XILINX_DIR/SDK/2017.4/settings64.sh 155*9e696164SXianjun Jiao./build_boot_bin.sh ../openwifi-hw/boards/zc706_fmcs2/sdk/system_top_hw_platform_0/system.hdf u-boot-zc70x.elf 1562ee67178SXianjun Jiao(u-boot-zc70x.elf is included in the original Analog Devices Linux img) 1572ee67178SXianjun Jiao``` 1582ee67178SXianjun 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. 1599e8d5e4aSJiao 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): 1602ee67178SXianjun Jiao 1612ee67178SXianjun Jiao``` 1622ee67178SXianjun Jiaoexport SDCARD_DIR=sdcard_mount_point 1632ee67178SXianjun Jiaocp $OPENWIFI_DIR/kernel_boot/devicetree.dtb $SDCARD_DIR/BOOT 1642ee67178SXianjun Jiaocp $OPENWIFI_DIR/kernel_boot/output_boot_bin/BOOT.BIN $SDCARD_DIR/BOOT 1652ee67178SXianjun Jiaocp $OPENWIFI_DIR/adi-linux/arch/arm/boot/uImage $SDCARD_DIR/BOOT 1662ee67178SXianjun Jiaocd $SDCARD_DIR/BOOT 1672ee67178SXianjun Jiaosync 1682ee67178SXianjun Jiao 1692ee67178SXianjun Jiaosudo mkdir $SDCARD_DIR/rootfs/root/openwifi 1702ee67178SXianjun Jiaosudo find $OPENWIFI_DIR/driver -name \*.ko -exec cp {} $SDCARD_DIR/rootfs/root/openwifi/ \; 1712ee67178SXianjun Jiaosudo cp $OPENWIFI_DIR/user_space/* $SDCARD_DIR/rootfs/root/openwifi/ 1722ee67178SXianjun Jiao 1732ee67178SXianjun Jiaosudo mkdir $SDCARD_DIR/rootfs/lib/modules 1742ee67178SXianjun Jiaosudo mkdir $SDCARD_DIR/rootfs/lib/modules/4.14.0-g4220d5d24c6c 1752ee67178SXianjun Jiaosudo find $OPENWIFI_DIR/adi-linux -name \*.ko -exec cp {} $SDCARD_DIR/rootfs/lib/modules/4.14.0-g4220d5d24c6c/ \; 1762ee67178SXianjun Jiaosudo rm $SDCARD_DIR/rootfs/lib/modules/4.14.0-g4220d5d24c6c/{axidmatest.ko,xilinx_dma.ko,adi_axi_hdmi.ko,ad9361_drv.ko} -f 1772ee67178SXianjun Jiao 1782ee67178SXianjun Jiaosudo rm $SDCARD_DIR/rootfs/etc/udev/rules.d/70-persistent-net.rules 1792ee67178SXianjun Jiaosudo cp $OPENWIFI_DIR/kernel_boot/70-persistent-net.rules $SDCARD_DIR/rootfs/etc/udev/rules.d/ 1802ee67178SXianjun Jiao(Above rule will auto-rename wlan0 to sdr0 which is the openwifi NIC name) 1812ee67178SXianjun Jiaocd $SDCARD_DIR/rootfs 1822ee67178SXianjun Jiaosync 1832ee67178SXianjun Jiao``` 1842ee67178SXianjun Jiao**Run Linux and do some post-config:** 1852ee67178SXianjun Jiao 1862ee67178SXianjun 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: 1872ee67178SXianjun Jiao 1882ee67178SXianjun Jiao``` 1892ee67178SXianjun Jiaodepmod 1902ee67178SXianjun Jiao(Ignore the error messages) 1912ee67178SXianjun Jiaomodprobe mac80211 19231ae0e6cSXianjun 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) 19331ae0e6cSXianjun Jiaoln -s /lib/modules/4.14.0-g4220d5d24c6c /lib/modules/4.14.0XXXYYYZZZ 19431ae0e6cSXianjun Jiaodepmod 19531ae0e6cSXianjun Jiaomodprobe mac80211 19631ae0e6cSXianjun Jiao 1972ee67178SXianjun Jiaocd openwifi 1982ee67178SXianjun Jiao./wgd.sh 19986bab9c1SJiao Xianjun(For fmcomms4, you need an extra command: ./set_ant.sh rx1 tx1) 2002ee67178SXianjun Jiao(Wait for the completion) 2012ee67178SXianjun Jiaoifconfig 2022ee67178SXianjun Jiao(You should see sdr0 interface) 2032ee67178SXianjun Jiaoiwlist sdr0 scan 2042ee67178SXianjun Jiao(You should see the Wi-Fi scan results) 2052ee67178SXianjun Jiao``` 2062ee67178SXianjun Jiao* Config ssh server and ethernet IP address of the board. In the PC serial console: 2072ee67178SXianjun Jiao 2082ee67178SXianjun Jiao``` 2092ee67178SXianjun Jiaopasswd 2102ee67178SXianjun Jiao(ssh server needs a password, such as "openwifi") 2112ee67178SXianjun JiaoAdd "UseDNS no" to /etc/ssh/sshd_config, otherwise ssh login takes too long time 2122ee67178SXianjun JiaoSet static IP to board (If you have DHCP server on PC, you can skip this step) 2132ee67178SXianjun JiaoAdd following content to /etc/network/interfaces 2142ee67178SXianjun Jiao auto lo eth0 2152ee67178SXianjun Jiao iface lo inet loopback 2162ee67178SXianjun Jiao iface eth0 inet static 2172ee67178SXianjun Jiao address 192.168.10.122 2182ee67178SXianjun Jiao netmask 255.255.255.0 2192ee67178SXianjun JiaoAdd following content to /etc/resolv.conf 2202ee67178SXianjun Jiao nameserver 8.8.8.8 2212ee67178SXianjun Jiao nameserver 4.4.4.4 2222ee67178SXianjun Jiao 2232ee67178SXianjun JiaoDisable update (long time hang) on boot or ssh session: 2242ee67178SXianjun Jiao sudo chmod -x /etc/update-motd.d/90-updates-available 2252ee67178SXianjun Jiao sudo chmod -x /etc/update-motd.d/91-release-upgrade 2262ee67178SXianjun Jiao 2279e8d5e4aSJiao Xianjunreboot the board, and set proper IP (192.168.10.1) of the connected PC, then from the PC: 2282ee67178SXianjun Jiaossh [email protected] 2292ee67178SXianjun Jiao(password: openwifi) 2302ee67178SXianjun Jiao``` 2319e8d5e4aSJiao Xianjun* Make on board file update easier: 2329e8d5e4aSJiao 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: 2339e8d5e4aSJiao Xianjun 2349e8d5e4aSJiao Xianjun mount /dev/mmcblk0p1 /sdcard 2359e8d5e4aSJiao Xianjun (Create /sdcard directory firstly if it doesn't exist) 2369e8d5e4aSJiao Xianjun cp file /sdcard 2379e8d5e4aSJiao Xianjun cd /sdcard 2389e8d5e4aSJiao Xianjun sync 2399e8d5e4aSJiao Xianjun cd / 2409e8d5e4aSJiao Xianjun umount /sdcard 2419e8d5e4aSJiao Xianjun (Remember to power cycle the board) 2429e8d5e4aSJiao 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: 2439e8d5e4aSJiao Xianjun 2449e8d5e4aSJiao Xianjun ./sdcard_boot_update.sh 2459e8d5e4aSJiao Xianjun (Above command downloads uImage, BOOT.BIN and devicetree.dtb, then copy them into boot partition. Remember to power cycle) 2469e8d5e4aSJiao Xianjun ./wgd.sh remote 2479e8d5e4aSJiao Xianjun (Above command downloads driver files, and brings up sdr0) 24886bab9c1SJiao Xianjun (For fmcomms4, you need an extra command: ./set_ant.sh rx1 tx1) 2499e8d5e4aSJiao Xianjun 25086bab9c1SJiao Xianjun**Compile sdrctl on the board** ("On the board" means that you login to the board via ssh) 2512ee67178SXianjun Jiao 2522ee67178SXianjun Jiao``` 2532ee67178SXianjun Jiaosudo apt-get install libnl-3-dev 2542ee67178SXianjun Jiaosudo apt-get install libnl-genl-3-dev 255ffe9541bSJiao Xianjun(Please find the next section to see how to connect board to the internet via your PC) 2562ee67178SXianjun Jiao(or find out .deb files by above commands and copy .deb to the board, if you do not have internet) 2572ee67178SXianjun Jiao 25886bab9c1SJiao Xianjuncopy $OPENWIFI_DIR/user_space/sdrctl_src to the board, then on the board: 2592ee67178SXianjun Jiaocd sdrctl_src 2602ee67178SXianjun Jiaochmod +x version.sh 2612ee67178SXianjun Jiaomake 2622ee67178SXianjun Jiao``` 263ecb4f4f9SXianjun Jiao 2642ee67178SXianjun Jiao**Internet config** 26586bab9c1SJiao Xianjun* Connect board to internet. Topology: board|(eth0) -- (***ethX***)|PC|(***ethY***) -- internet 26686bab9c1SJiao Xianjun * Enable IPv4 **IP forwarding** on both **board** and **PC** 26786bab9c1SJiao Xianjun * On board: 26886bab9c1SJiao Xianjun ``` 26986bab9c1SJiao Xianjun route add default gw 192.168.10.1 27086bab9c1SJiao Xianjun ``` 2712ee67178SXianjun Jiao * On PC. After this your board should have internet via NAT through your PC. 2722ee67178SXianjun Jiao 2732ee67178SXianjun Jiao ``` 2742ee67178SXianjun Jiao sudo iptables -t nat -A POSTROUTING -o ethY -j MASQUERADE 2752ee67178SXianjun Jiao ``` 27686bab9c1SJiao Xianjun* Setup AP for Wi-Fi client. Topology: client -- (sdr0)|board|(eth0) -- (***ethX***)|PC|(***ethY***) -- internet 2772ee67178SXianjun Jiao * On board: Install dhcp server preparing for serving your openwifi clients via hostapd. 2782ee67178SXianjun Jiao 2792ee67178SXianjun Jiao ``` 2802ee67178SXianjun Jiao sudo apt-get install isc-dhcp-server 2812ee67178SXianjun Jiao sudo apt-get install Haveged 28286bab9c1SJiao Xianjun sudo apt-get install hostapd 2832ee67178SXianjun Jiao ``` 2842ee67178SXianjun Jiao * Put user_space/dhcpd.conf into (overwrite) /etc/dhcp/dhcpd.conf on board. 2852ee67178SXianjun Jiao * On board: 2862ee67178SXianjun Jiao 2872ee67178SXianjun Jiao ``` 2882ee67178SXianjun Jiao cd openwifi 2892ee67178SXianjun Jiao service network-manager stop 2902ee67178SXianjun Jiao ./wgd.sh 29186bab9c1SJiao Xianjun (For fmcomms4, you need an extra command: ./set_ant.sh rx1 tx1) 2922ee67178SXianjun Jiao ifconfig sdr0 up 2932ee67178SXianjun Jiao ifconfig sdr0 192.168.13.1 2942ee67178SXianjun Jiao route add default gw 192.168.10.1 2952ee67178SXianjun Jiao service isc-dhcp-server restart 2962ee67178SXianjun Jiao hostapd hostapd-openwifi.conf 2972ee67178SXianjun Jiao ``` 2982ee67178SXianjun Jiao * On PC: 2992ee67178SXianjun Jiao 3002ee67178SXianjun Jiao ``` 3012ee67178SXianjun Jiao sudo ip route add 192.168.13.0/24 via 192.168.10.122 dev ethX 3022ee67178SXianjun Jiao ``` 303ffe9541bSJiao Xianjun * Now you can connect openwifi hotspot from your phone/laptop and access the internet. 30444dff4bdSJiao Xianjun 305e17fdc17Smmehari**Connecting a client to openwifi AP in 2.4GHz** 306e17fdc17Smmehari 307e17fdc17SmmehariOpenwifi 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. 308e17fdc17Smmehari 309e17fdc17SmmehariAs a solution to this problem, openwifi can be fully controlled only if communicating with APs/clients instantiated using hostapd/wpa_supplicant userspace programs respectively. 310e17fdc17Smmehari 311e17fdc17SmmehariFor 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. 312e17fdc17Smmehari 313e17fdc17SmmehariOn 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. 314e17fdc17Smmehari 315e17fdc17Smmehari``` 316e17fdc17Smmeharicd openwifi/user_space 317e17fdc17Smmehariwget http://w1.fi/releases/wpa_supplicant-2.1.tar.gz 318e17fdc17Smmeharitar xzvf wpa_supplicant-2.1.tar.gz 319e17fdc17Smmeharipatch -d wpa_supplicant-2.1/src/drivers/ < driver_nl80211.patch 320e17fdc17Smmeharicd wpa_supplicant-2.1/wpa_supplicant/ 321e17fdc17Smmeharicp defconfig .config 322e17fdc17Smmeharised -i 's/#CONFIG_LIBNL32.*/CONFIG_LIBNL32=y/g' .config 323e17fdc17Smmeharimake -j16 324e17fdc17Smmeharisudo make install 325e17fdc17Smmeharicd ../../ 326e17fdc17Smmeharirm -r wpa_supplicant-2.1/ wpa_supplicant-2.1.tar.gz 327e17fdc17Smmehari``` 328e17fdc17Smmehari 32944dff4bdSJiao Xianjun## cite openwifi project 33044dff4bdSJiao Xianjun 33144dff4bdSJiao XianjunAny use of openwifi project which results in a publication should include a citation via (bibtex example): 33244dff4bdSJiao Xianjun``` 33344dff4bdSJiao Xianjun@electronic{openwifigithub, 33444dff4bdSJiao Xianjun author = {Xianjun, Jiao and Wei, Liu and Michael, Mehari}, 33544dff4bdSJiao Xianjun title = {open-source IEEE802.11/Wi-Fi baseband chip/FPGA design}, 33644dff4bdSJiao Xianjun url = {https://github.com/open-sdr/openwifi}, 33744dff4bdSJiao Xianjun year = {2019}, 33844dff4bdSJiao Xianjun} 33944dff4bdSJiao Xianjun``` 340