1ef526178SXianjun Jiao**IMPORTANT pre-conditions**: 2ef526178SXianjun Jiao- Install Vivado 2021.1. Make sure install Vitis as well. You should have this directory: your_Xilinx_install_directory/Vitis (NOT Vitis_HLS!) 3ef526178SXianjun Jiao - If the Vitis is not installed, you can add it by running "Xilinx Design Tools --> Add Design Tools for Devices 2021.1" from Xilinx program group/menu in your OS start menu, or Help menu of Vivado. 4ef526178SXianjun Jiao- SD card at least with 16GB 5ca7b319aSJiao Xianjun- Install packages: `sudo apt install flex bison libssl-dev device-tree-compiler u-boot-tools -y` 6ef526178SXianjun Jiao 7ef526178SXianjun Jiao[[Use openwifi prebuilt img](#Use-openwifi-prebuilt-img)] 8ef526178SXianjun Jiao[[Build SD card from scratch](#Build-SD-card-from-scratch)] 9ef526178SXianjun Jiao[[Use existing SD card on new board](#Use-existing-SD-card-on-new-board)] 10ef526178SXianjun Jiao 11ef526178SXianjun Jiao## Use openwifi prebuilt img 12ef526178SXianjun Jiao 13*24baa187SJiao XianjunDownload openwifi pre-built img (see [Quick start](../../README.md#quick-start)), and extract it to .img file. 14ef526178SXianjun Jiao 157eea2988SXianjun JiaoUse dd command to flash the SD card. (Or other software like Startup Disk Creator in Ubuntu) 16ef526178SXianjun Jiao``` 17ef526178SXianjun Jiaosudo dd bs=512 count=31116288 if=openwifi-xyz.img of=/dev/your_sdcard_dev 18ef526178SXianjun Jiao``` 197eea2988SXianjun JiaoTo have correct count value, better to check the .img file actual situation by "fdisk -l img_filename". 20ef526178SXianjun Jiao 217eea2988SXianjun JiaoThen start from the 2nd step of the [Quick start](../../README.md#quick-start) in README. 22ef526178SXianjun Jiao 23ef526178SXianjun Jiao## Build SD card from scratch 24ef526178SXianjun Jiao 25ef526178SXianjun JiaoDownload image_2022-08-04-ADI-Kuiper-full.zip from https://wiki.analog.com/resources/tools-software/linux-software/kuiper-linux?redirect=1 26ef526178SXianjun Jiao 27ef526178SXianjun JiaoExtract it to .img file. 28ef526178SXianjun Jiao 297eea2988SXianjun JiaoUse dd command to flash the SD card. (Or other software like Startup Disk Creator in Ubuntu) 30ef526178SXianjun Jiao``` 31ef526178SXianjun Jiaosudo dd bs=512 count=24018944 if=2022-08-04-ADI-Kuiper-full.img of=/dev/your_sdcard_dev 32ef526178SXianjun Jiao``` 33ef526178SXianjun Jiao 34ef526178SXianjun Jiao(To have correct count value, better to check the .img file actual situation by "fdisk -l img_filename". While making .img from SD card, check the SD card dev instead) 35ef526178SXianjun Jiao 36ef526178SXianjun JiaoMount the BOOT and rootfs partition of SD card to your computer. 37ef526178SXianjun Jiao 38ef526178SXianjun JiaoChange the SD card file: Add following into rootfs/etc/network/interfaces 39ef526178SXianjun Jiao``` 40ef526178SXianjun Jiao# The loopback interface 41ef526178SXianjun Jiaoauto lo 42ef526178SXianjun Jiaoiface lo inet loopback 43ef526178SXianjun Jiaoauto eth0 44ef526178SXianjun Jiaoiface eth0 inet static 45ef526178SXianjun Jiao 46ef526178SXianjun Jiao#your static IP 47ef526178SXianjun Jiaoaddress 192.168.10.122 48ef526178SXianjun Jiao 49ef526178SXianjun Jiao#your gateway IP 50ef526178SXianjun Jiaogateway 192.168.10.1 51ef526178SXianjun Jiaonetmask 255.255.255.0 52ef526178SXianjun Jiao 53ef526178SXianjun Jiao#your network address "family" 54ef526178SXianjun Jiaonetwork 192.168.10.0 55ef526178SXianjun Jiaobroadcast 192.168.10.255 56ef526178SXianjun Jiao``` 57ef526178SXianjun Jiao 58ef526178SXianjun JiaoChange the SD card file: Add following into rootfs/etc/sysctl.conf 59ef526178SXianjun Jiao``` 60ef526178SXianjun Jiaonet.ipv4.ip_forward=1 61ef526178SXianjun Jiao``` 62ef526178SXianjun Jiao 63ef526178SXianjun JiaoChange the SD card file: Add following into rootfs/etc/systemd/system.conf 64ef526178SXianjun Jiao``` 65ef526178SXianjun JiaoDefaultTimeoutStopSec=2s 66ef526178SXianjun Jiao``` 67ef526178SXianjun Jiao 68ef526178SXianjun JiaoPut the openwifi/kernel_boot/10-network-device.rules into rootfs/etc/udev/rules.d/ 69ef526178SXianjun Jiao 707eea2988SXianjun JiaoRun **update_sdcard.sh** from openwifi/user_space directory to further prepare the SD card. The last argument $SDCARD_DIR of the script is the directory (mounting point) on your computer that has BOOT and rootfs directories/partitions. 717eea2988SXianjun Jiao 727eea2988SXianjun JiaoThe script will build and put following things into the SD card: 737eea2988SXianjun Jiao - Linux kernel image file ([Update Driver](../../README.md#Update-Driver)): 74ef526178SXianjun Jiao - adi-linux-64/arch/arm64/boot/Image (64bit) 75ef526178SXianjun Jiao - adi-linux/arch/arm/boot/uImage (32bit) 76ef526178SXianjun Jiao - devicetree file: 77ef526178SXianjun Jiao - openwifi/kernel_boot/boards/zcu102_fmcs2/system.dtb (64bit) 78ef526178SXianjun Jiao - openwifi/kernel_boot/boards/$BOARD_NAME/devicetree.dtb (32bit) 797eea2988SXianjun Jiao - BOOT.BIN ([Update FPGA](../../README.md#Update-FPGA)): 80ef526178SXianjun Jiao - openwifi/kernel_boot/boards/$BOARD_NAME/output_boot_bin/BOOT.BIN 817eea2988SXianjun Jiao - openwifi driver ([Update Driver](../../README.md#Update-Driver)). 827eea2988SXianjun Jiao - openwifi/user_space files and openwifi/webserver files 83ef526178SXianjun Jiao 847eea2988SXianjun JiaoAfter **update_sdcard.sh** finishes, please do the 2nd step "Config the correct files ..." in [Quick start](../../README.md#quick-start). Then power on the board with the SD card, connect the board to your host PC (static IP 192.168.10.1) via ethernet, and ssh to the board with password **"analog"** 85ef526178SXianjun Jiao``` 86ef526178SXianjun Jiaossh [email protected] 87ef526178SXianjun Jiao``` 88ef526178SXianjun Jiao 89ef526178SXianjun JiaoThen change password to "openwifi" via "passwd" command onbard. 90ef526178SXianjun Jiao 91ef526178SXianjun JiaoEnlarge the onboard SD disk space, and reboot (https://github.com/analogdevicesinc/adi-kuiper-gen/releases) 92ef526178SXianjun Jiao``` 93ef526178SXianjun Jiaoraspi-config --expand-rootfs 94ef526178SXianjun Jiaoreboot now 95ef526178SXianjun Jiao``` 96ef526178SXianjun JiaoSetup routing/NAT **on the PC** for your board -- this internet connection is **important** for post installation/config. 97ef526178SXianjun Jiao``` 98ef526178SXianjun Jiaosudo sysctl -w net.ipv4.ip_forward=1 99ef526178SXianjun Jiaosudo iptables -t nat -A POSTROUTING -o NICY -j MASQUERADE 100ef526178SXianjun Jiaosudo ip route add 192.168.13.0/24 via 192.168.10.122 dev ethX 101ef526178SXianjun Jiao``` 102ef526178SXianjun Jiao**ethX** is the PC NIC name connecting the board ethernet. **NICY** is the PC NIC name connecting internet (WiFi or another ethernet). 103ef526178SXianjun Jiao 104ef526178SXianjun JiaoIf you want, uncommenting "net.ipv4.ip_forward=1" in /etc/sysctl.conf to make IP forwarding persistent on PC. 105ef526178SXianjun Jiao 106ef526178SXianjun JiaoTest the connectivity. Run on board (in the ssh session): 107ef526178SXianjun Jiao``` 108ef526178SXianjun Jiaoroute add default gw 192.168.10.1 109ef526178SXianjun Jiaoping IP_YOU_KNOW_ON_YOUR_NETWORK 110ef526178SXianjun Jiao``` 111ef526178SXianjun JiaoIf there is issue with the connectivity (ping can not reach the target), it needs to be solved before going to the next step. 112ef526178SXianjun Jiao 113ef526178SXianjun JiaoDo misc configurations/installations in the ssh session onboard: 114ef526178SXianjun Jiao``` 115ef526178SXianjun Jiaosudo apt update 1167eea2988SXianjun Jiaochmod +x /root/openwifi/*.sh 117ef526178SXianjun Jiao 118ef526178SXianjun Jiao# install and setup dhcp server 119ef526178SXianjun Jiaosudo apt-get -y install isc-dhcp-server 1207eea2988SXianjun Jiaocp /root/openwifi/dhcpd.conf /etc/dhcp/dhcpd.conf 121ef526178SXianjun Jiao 122ef526178SXianjun Jiao# install hostapd and other useful tools 123ef526178SXianjun Jiaosudo apt-get -y install hostapd 124ef526178SXianjun Jiaosudo apt-get -y install tcpdump 125ef526178SXianjun Jiaosudo apt-get -y install webfs 126ef526178SXianjun Jiaosudo apt-get -y install iperf 127ef526178SXianjun Jiaosudo apt-get -y install iperf3 128ef526178SXianjun Jiaosudo apt-get -y install libpcap-dev 129ef526178SXianjun Jiaosudo apt-get -y install bridge-utils 130ef526178SXianjun Jiao 1317eea2988SXianjun Jiao# build on board tools 1327eea2988SXianjun Jiaosudo apt-get -y install libnl-3-dev 1337eea2988SXianjun Jiaosudo apt-get -y install libnl-genl-3-dev 1347eea2988SXianjun Jiaocd /root/openwifi/sdrctl_src 1357eea2988SXianjun Jiaomake clean 1367eea2988SXianjun Jiaomake 1377eea2988SXianjun Jiaocp sdrctl ../ 1387eea2988SXianjun Jiaocd /root/openwifi/side_ch_ctl_src/ 1397eea2988SXianjun Jiaogcc -o side_ch_ctl side_ch_ctl.c 1407eea2988SXianjun Jiaocp side_ch_ctl ../ 1417eea2988SXianjun Jiaocd /root/openwifi/inject_80211/ 1427eea2988SXianjun Jiaomake clean 1437eea2988SXianjun Jiaomake 1447eea2988SXianjun Jiaocd .. 145ef526178SXianjun Jiao``` 146ef526178SXianjun Jiao 147ef526178SXianjun JiaoRun openwifi in the ssh session onboard: 148ef526178SXianjun Jiao``` 1497eea2988SXianjun Jiao/root/openwifi/setup_once.sh (Only need to run once for new board) 150ef526178SXianjun Jiaocd /root/openwifi 151ef526178SXianjun Jiao./wgd.sh 1527eea2988SXianjun Jiaoifconfig sdr0 up 153ef526178SXianjun Jiaoiwlist sdr0 scan 154ef526178SXianjun Jiao./fosdem.sh 155ef526178SXianjun Jiao``` 156ef526178SXianjun Jiao 157ef526178SXianjun Jiao## Use existing SD card on new board 158ef526178SXianjun Jiao 1597eea2988SXianjun JiaoJust operate the existing/working SD card of the old board on your computer starting from the 2nd step of the [Quick start](../../README.md#quick-start) in README. Then start using the SD card on the new board. 160