README.md (0fae09a874949b04bb107b2729f18ecb6ac508cf) | README.md (abdb610f56e6ff7bc54e8ad29637bde718951d91) |
---|---|
1<!-- 2Author: Xianjun jiao, Michael Mehari, Wei Liu 3SPDX-FileCopyrightText: 2019 UGent 4SPDX-License-Identifier: AGPL-3.0-or-later 5--> 6 7# openwifi 8<img src="./openwifi-arch.jpg" width="900"> --- 112 unchanged lines hidden (view full) --- 121## Update FPGA 122 123Since the pre-built SD card image might not have the latest bug-fixes/updates, it is recommended to update the fpga bitstream on board. 124 125- Install Vivado/SDK 2018.3 (If you don't need to generate new FPGA bitstream, WebPack version without license is enough) 126- Setup environment variables (use absolute path): 127 ``` 128 export XILINX_DIR=your_Xilinx_directory | 1<!-- 2Author: Xianjun jiao, Michael Mehari, Wei Liu 3SPDX-FileCopyrightText: 2019 UGent 4SPDX-License-Identifier: AGPL-3.0-or-later 5--> 6 7# openwifi 8<img src="./openwifi-arch.jpg" width="900"> --- 112 unchanged lines hidden (view full) --- 121## Update FPGA 122 123Since the pre-built SD card image might not have the latest bug-fixes/updates, it is recommended to update the fpga bitstream on board. 124 125- Install Vivado/SDK 2018.3 (If you don't need to generate new FPGA bitstream, WebPack version without license is enough) 126- Setup environment variables (use absolute path): 127 ``` 128 export XILINX_DIR=your_Xilinx_directory |
129 export OPENWIFI_DIR=your_openwifi_directory | 129 export OPENWIFI_HW_DIR=your_openwifi-hw_directory |
130 export BOARD_NAME=your_board_name 131 ``` | 130 export BOARD_NAME=your_board_name 131 ``` |
132- Get the latest FPGA bitstream from openwifi-hw, generate BOOT.BIN and transfer it on board via ssh channel: | 132- Pick the FPGA bitstream from openwifi-hw, and generate BOOT.BIN and transfer it on board via ssh channel: |
133 ``` | 133 ``` |
134 $OPENWIFI_DIR/user_space/get_fpga.sh $OPENWIFI_DIR 135 | |
136 For Zynq 7000: | 134 For Zynq 7000: |
137 $OPENWIFI_DIR/user_space/boot_bin_gen.sh $OPENWIFI_DIR $XILINX_DIR $BOARD_NAME | |
138 | 135 |
136 cd openwifi/user_space; ./boot_bin_gen.sh $OPENWIFI_HW_DIR $XILINX_DIR $BOARD_NAME 137 |
|
139 For Zynq MPSoC (like zcu102 board): | 138 For Zynq MPSoC (like zcu102 board): |
140 $OPENWIFI_DIR/user_space/boot_bin_gen_zynqmp.sh $OPENWIFI_DIR $XILINX_DIR $BOARD_NAME | 139 cd openwifi/user_space; ./boot_bin_gen_zynqmp.sh $OPENWIFI_HW_DIR $XILINX_DIR $BOARD_NAME |
141 | 140 |
142 scp $OPENWIFI_DIR/kernel_boot/boards/$BOARD_NAME/output_boot_bin/BOOT.BIN [email protected]: | 141 cd openwifi/kernel_boot/boards/$BOARD_NAME/output_boot_bin; scp ./BOOT.BIN [email protected]: |
143 ``` 144- On board: Put the BOOT.BIN into the BOOT partition. 145 ``` 146 mount /dev/mmcblk0p1 /mnt 147 cp ~/BOOT.BIN /mnt 148 umount /mnt 149 ``` 150 **Power cycle** the board to load new FPGA bitstream. 151 152## Update Driver 153 154Since the pre-built SD card image might not have the latest bug-fixes/updates, it is recommended to update the driver on board. 155- Prepare Analog Devices Linux kernel source code (only need to run once): 156 ``` | 142 ``` 143- On board: Put the BOOT.BIN into the BOOT partition. 144 ``` 145 mount /dev/mmcblk0p1 /mnt 146 cp ~/BOOT.BIN /mnt 147 umount /mnt 148 ``` 149 **Power cycle** the board to load new FPGA bitstream. 150 151## Update Driver 152 153Since the pre-built SD card image might not have the latest bug-fixes/updates, it is recommended to update the driver on board. 154- Prepare Analog Devices Linux kernel source code (only need to run once): 155 ``` |
157 $OPENWIFI_DIR/user_space/prepare_kernel.sh $OPENWIFI_DIR $XILINX_DIR ARCH_BIT | 156 cd openwifi/user_space; ./prepare_kernel.sh $XILINX_DIR ARCH_BIT build |
158 (For Zynq 7000, ARCH_BIT should be 32, for Zynq MPSoC, ARCH_BIT should be 64) 159 ``` 160 **Note**: In Ubuntu, gcc-10 might have issue ('yylloc' error), so use gcc-9 if you encounter error. 161- Compile the latest openwifi driver 162 ``` | 157 (For Zynq 7000, ARCH_BIT should be 32, for Zynq MPSoC, ARCH_BIT should be 64) 158 ``` 159 **Note**: In Ubuntu, gcc-10 might have issue ('yylloc' error), so use gcc-9 if you encounter error. 160- Compile the latest openwifi driver 161 ``` |
163 $OPENWIFI_DIR/driver/make_all.sh $OPENWIFI_DIR $XILINX_DIR ARCH_BIT | 162 cd openwifi/driver; ./make_all.sh $XILINX_DIR ARCH_BIT |
164 (For Zynq 7000, ARCH_BIT should be 32, for Zynq MPSoC, ARCH_BIT should be 64) 165 ``` 166- Copy the driver files to the board via ssh channel 167 ``` | 163 (For Zynq 7000, ARCH_BIT should be 32, for Zynq MPSoC, ARCH_BIT should be 64) 164 ``` 165- Copy the driver files to the board via ssh channel 166 ``` |
168 scp `find $OPENWIFI_DIR/driver/ -name \*.ko` [email protected]:openwifi/ | 167 cd openwifi/driver; scp `find ./ -name \*.ko` [email protected]:openwifi/ |
169 ``` 170 Now you can use **wgd.sh** on board to load the new openwifi driver. 171 **Note**: If you have symbol or version error while loadng the driver, it could be because the kernel in the SD card image is too old. In this case, you need to follow [[Build openwifi Linux img from scratch](#Build-openwifi-Linux-img-from-scratch)] to generate your new SD card image. 172 173## Update sdrctl 174- Copy the sdrctl source files to the board via ssh channel 175 ``` | 168 ``` 169 Now you can use **wgd.sh** on board to load the new openwifi driver. 170 **Note**: If you have symbol or version error while loadng the driver, it could be because the kernel in the SD card image is too old. In this case, you need to follow [[Build openwifi Linux img from scratch](#Build-openwifi-Linux-img-from-scratch)] to generate your new SD card image. 171 172## Update sdrctl 173- Copy the sdrctl source files to the board via ssh channel 174 ``` |
176 scp `find $OPENWIFI_DIR/user_space/sdrctl_src/ -name \*` [email protected]:openwifi/sdrctl_src/ | 175 cd openwifi/user_space/sdrctl_src; scp `find ./ -name \*` [email protected]:openwifi/sdrctl_src/ |
177 ``` 178- Compile the sdrctl **on board**: 179 ``` 180 cd ~/openwifi/sdrctl_src/ && make && cp sdrctl ../ && cd .. 181 ``` 182## Easy Access and etc 183 184- FPGA and driver on board update scripts | 176 ``` 177- Compile the sdrctl **on board**: 178 ``` 179 cd ~/openwifi/sdrctl_src/ && make && cp sdrctl ../ && cd .. 180 ``` 181## Easy Access and etc 182 183- FPGA and driver on board update scripts |
185 - Setup [ftp server](https://help.ubuntu.com/lts/serverguide/ftp-server.html) on PC, allow anonymous and change ftp root directory to $OPENWIFI_DIR. | 184 - Setup [ftp server](https://help.ubuntu.com/lts/serverguide/ftp-server.html) on PC, allow anonymous and change ftp root directory to the openwifi directory. |
186 - On board: 187 ``` 188 ./sdcard_boot_update.sh $BOARD_NAME 189 (Above command downloads uImage, BOOT.BIN and devicetree.dtb, then copy them into boot partition. Remember to power cycle) 190 ./wgd.sh remote 191 (Above command downloads driver files, and brings up sdr0) 192 ``` 193- Access the board disk/rootfs like a disk: 194 - On PC: "File manager --> Connect to Server...", input: sftp://[email protected]/root 195 - Input password "openwifi" 196 197## Build openwifi Linux img from scratch 198- Download [2019_R1-2020_02_04.img.xz](https://swdownloads.analog.com/cse/2019_R1-2020_02_04.img.xz) from [Analog Devices Wiki](https://wiki.analog.com/resources/tools-software/linux-software/zynq_images). Burn it to a SD card. 199- Insert the SD card to your Linux PC. Find out the mount point (that has two sub directories BOOT and rootfs), and setup environment variables (use absolute path): 200 ``` 201 export SDCARD_DIR=sdcard_mount_point 202 export XILINX_DIR=your_Xilinx_directory | 185 - On board: 186 ``` 187 ./sdcard_boot_update.sh $BOARD_NAME 188 (Above command downloads uImage, BOOT.BIN and devicetree.dtb, then copy them into boot partition. Remember to power cycle) 189 ./wgd.sh remote 190 (Above command downloads driver files, and brings up sdr0) 191 ``` 192- Access the board disk/rootfs like a disk: 193 - On PC: "File manager --> Connect to Server...", input: sftp://[email protected]/root 194 - Input password "openwifi" 195 196## Build openwifi Linux img from scratch 197- Download [2019_R1-2020_02_04.img.xz](https://swdownloads.analog.com/cse/2019_R1-2020_02_04.img.xz) from [Analog Devices Wiki](https://wiki.analog.com/resources/tools-software/linux-software/zynq_images). Burn it to a SD card. 198- Insert the SD card to your Linux PC. Find out the mount point (that has two sub directories BOOT and rootfs), and setup environment variables (use absolute path): 199 ``` 200 export SDCARD_DIR=sdcard_mount_point 201 export XILINX_DIR=your_Xilinx_directory |
203 export OPENWIFI_DIR=your_openwifi_directory | 202 export OPENWIFI_HW_DIR=your_openwifi-hw_directory |
204 export BOARD_NAME=your_board_name 205 ``` 206- Run script to update SD card: 207 ``` | 203 export BOARD_NAME=your_board_name 204 ``` 205- Run script to update SD card: 206 ``` |
208 $OPENWIFI_DIR/user_space/update_sdcard.sh $OPENWIFI_DIR $XILINX_DIR $BOARD_NAME $SDCARD_DIR | 207 cd openwifi/user_space; ./update_sdcard.sh $OPENWIFI_HW_DIR $XILINX_DIR $BOARD_NAME $SDCARD_DIR |
209 ``` 210- Config your board to SD card boot mode (check the board manual). Insert the SD card to the board. Power on. 211- Login to the board from your PC (PC Ethernet should have IP 192.168.10.1) with one time password **analog**. 212 ``` 213 ssh [email protected] 214 ``` 215- Setup routing/NAT **on the PC** for your board -- this internet connection is **important** for post installation/config. 216 ``` --- 16 unchanged lines hidden (view full) --- 233 234As a solution to this problem, openwifi can be fully controlled only if communicating with APs/clients instantiated using hostapd/wpa_supplicant userspace programs respectively. 235 236For 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. 237 238On 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. 239``` 240sudo apt-get install libssl1.0-dev | 208 ``` 209- Config your board to SD card boot mode (check the board manual). Insert the SD card to the board. Power on. 210- Login to the board from your PC (PC Ethernet should have IP 192.168.10.1) with one time password **analog**. 211 ``` 212 ssh [email protected] 213 ``` 214- Setup routing/NAT **on the PC** for your board -- this internet connection is **important** for post installation/config. 215 ``` --- 16 unchanged lines hidden (view full) --- 232 233As a solution to this problem, openwifi can be fully controlled only if communicating with APs/clients instantiated using hostapd/wpa_supplicant userspace programs respectively. 234 235For 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. 236 237On 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. 238``` 239sudo apt-get install libssl1.0-dev |
241$OPENWIFI_DIR/user_space/build_wpa_supplicant_wo11b.sh $OPENWIFI_DIR | 240cd openwifi/user_space; ./build_wpa_supplicant_wo11b.sh |
242``` 243## Porting guide 244 245This section explains the porting work by showing the differences between openwifi and Analog Devices reference design. openwifi is based on 2019_R1 of [HDL Reference Designs](https://github.com/analogdevicesinc/hdl). 246- Open the fmcomms2 + zc706 reference design at hdl/projects/fmcomms2/zc706 (Please read Analog Devices help) 247- Open the openwifi design zc706_fmcs2 at openwifi-hw/boards/zc706_fmcs2 (Please read openwifi-hw repository) 248- "Open Block Design", you will see the differences between openwifi and the reference design. Both in "diagram" and in "Address Editor". 249- The address/interrupts of FPGA blocks hooked to the ARM bus should be put/aligned to the devicetree file openwifi/kernel_boot/boards/zc706_fmcs2/devicetree.dts. Linux will parse the devicetree.dtb when booting to know information of attached device (FPGA blocks in our case). 250- We use dtc command to get devicetree.dts converted from devicetree.dtb in [Analog Devices Linux image](https://wiki.analog.com/resources/tools-software/linux-software/zynq_images), then do modification according to what we have added/modified to the reference design. 251- Please learn the script in [[Build openwifi Linux img from scratch](#Build-openwifi-Linux-img-from-scratch)] to understand how we generate devicetree.dtb, BOOT.BIN and Linux kernel uImage and put them together to build the full SD card image. 252 253## License 254 255This project is available as open source under the terms of the AGPL 3.0 Or later. However, some elements are being licensed under GPL 2-0 or later and BSD 3 license . For accurate information, please check individual files. | 241``` 242## Porting guide 243 244This section explains the porting work by showing the differences between openwifi and Analog Devices reference design. openwifi is based on 2019_R1 of [HDL Reference Designs](https://github.com/analogdevicesinc/hdl). 245- Open the fmcomms2 + zc706 reference design at hdl/projects/fmcomms2/zc706 (Please read Analog Devices help) 246- Open the openwifi design zc706_fmcs2 at openwifi-hw/boards/zc706_fmcs2 (Please read openwifi-hw repository) 247- "Open Block Design", you will see the differences between openwifi and the reference design. Both in "diagram" and in "Address Editor". 248- The address/interrupts of FPGA blocks hooked to the ARM bus should be put/aligned to the devicetree file openwifi/kernel_boot/boards/zc706_fmcs2/devicetree.dts. Linux will parse the devicetree.dtb when booting to know information of attached device (FPGA blocks in our case). 249- We use dtc command to get devicetree.dts converted from devicetree.dtb in [Analog Devices Linux image](https://wiki.analog.com/resources/tools-software/linux-software/zynq_images), then do modification according to what we have added/modified to the reference design. 250- Please learn the script in [[Build openwifi Linux img from scratch](#Build-openwifi-Linux-img-from-scratch)] to understand how we generate devicetree.dtb, BOOT.BIN and Linux kernel uImage and put them together to build the full SD card image. 251 252## License 253 254This project is available as open source under the terms of the AGPL 3.0 Or later. However, some elements are being licensed under GPL 2-0 or later and BSD 3 license . For accurate information, please check individual files. |