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 5ef526178SXianjun Jiao- Install the devicetree compiler -- dtc. (For Ubuntu: sudo apt install device-tree-compiler) 6ef526178SXianjun Jiao- Install the mkimage tool. (For Ubuntu: sudo apt install u-boot-tools) 7ef526178SXianjun Jiao 8ef526178SXianjun Jiao[[Use openwifi prebuilt img](#Use-openwifi-prebuilt-img)] 9ef526178SXianjun Jiao[[Build SD card from scratch](#Build-SD-card-from-scratch)] 10ef526178SXianjun Jiao[[Use existing SD card on new board](#Use-existing-SD-card-on-new-board)] 11ef526178SXianjun Jiao 12ef526178SXianjun Jiao## Use openwifi prebuilt img 13ef526178SXianjun Jiao 14*7eea2988SXianjun JiaoDownload openwifi pre-built img, such as openwifi-xyz.img.xz (in [Quick start](../../README.md#quick-start)), and extract it to .img file. 15ef526178SXianjun Jiao 16*7eea2988SXianjun JiaoUse dd command to flash the SD card. (Or other software like Startup Disk Creator in Ubuntu) 17ef526178SXianjun Jiao``` 18ef526178SXianjun Jiaosudo dd bs=512 count=31116288 if=openwifi-xyz.img of=/dev/your_sdcard_dev 19ef526178SXianjun Jiao``` 20*7eea2988SXianjun JiaoTo have correct count value, better to check the .img file actual situation by "fdisk -l img_filename". 21ef526178SXianjun Jiao 22*7eea2988SXianjun JiaoThen start from the 2nd step of the [Quick start](../../README.md#quick-start) in README. 23ef526178SXianjun Jiao 24ef526178SXianjun Jiao## Build SD card from scratch 25ef526178SXianjun Jiao 26ef526178SXianjun JiaoDownload image_2022-08-04-ADI-Kuiper-full.zip from https://wiki.analog.com/resources/tools-software/linux-software/kuiper-linux?redirect=1 27ef526178SXianjun Jiao 28ef526178SXianjun JiaoExtract it to .img file. 29ef526178SXianjun Jiao 30*7eea2988SXianjun JiaoUse dd command to flash the SD card. (Or other software like Startup Disk Creator in Ubuntu) 31ef526178SXianjun Jiao``` 32ef526178SXianjun Jiaosudo dd bs=512 count=24018944 if=2022-08-04-ADI-Kuiper-full.img of=/dev/your_sdcard_dev 33ef526178SXianjun Jiao``` 34ef526178SXianjun Jiao 35ef526178SXianjun 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) 36ef526178SXianjun Jiao 37ef526178SXianjun JiaoMount the BOOT and rootfs partition of SD card to your computer. 38ef526178SXianjun Jiao 39ef526178SXianjun JiaoChange the SD card file: Add following into rootfs/etc/network/interfaces 40ef526178SXianjun Jiao``` 41ef526178SXianjun Jiao# The loopback interface 42ef526178SXianjun Jiaoauto lo 43ef526178SXianjun Jiaoiface lo inet loopback 44ef526178SXianjun Jiaoauto eth0 45ef526178SXianjun Jiaoiface eth0 inet static 46ef526178SXianjun Jiao 47ef526178SXianjun Jiao#your static IP 48ef526178SXianjun Jiaoaddress 192.168.10.122 49ef526178SXianjun Jiao 50ef526178SXianjun Jiao#your gateway IP 51ef526178SXianjun Jiaogateway 192.168.10.1 52ef526178SXianjun Jiaonetmask 255.255.255.0 53ef526178SXianjun Jiao 54ef526178SXianjun Jiao#your network address "family" 55ef526178SXianjun Jiaonetwork 192.168.10.0 56ef526178SXianjun Jiaobroadcast 192.168.10.255 57ef526178SXianjun Jiao``` 58ef526178SXianjun Jiao 59ef526178SXianjun JiaoChange the SD card file: Add following into rootfs/etc/sysctl.conf 60ef526178SXianjun Jiao``` 61ef526178SXianjun Jiaonet.ipv4.ip_forward=1 62ef526178SXianjun Jiao``` 63ef526178SXianjun Jiao 64ef526178SXianjun JiaoChange the SD card file: Add following into rootfs/etc/systemd/system.conf 65ef526178SXianjun Jiao``` 66ef526178SXianjun JiaoDefaultTimeoutStopSec=2s 67ef526178SXianjun Jiao``` 68ef526178SXianjun Jiao 69ef526178SXianjun JiaoPut the openwifi/kernel_boot/10-network-device.rules into rootfs/etc/udev/rules.d/ 70ef526178SXianjun Jiao 71*7eea2988SXianjun 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. 72*7eea2988SXianjun Jiao 73*7eea2988SXianjun JiaoThe script will build and put following things into the SD card: 74*7eea2988SXianjun Jiao - Linux kernel image file ([Update Driver](../../README.md#Update-Driver)): 75ef526178SXianjun Jiao - adi-linux-64/arch/arm64/boot/Image (64bit) 76ef526178SXianjun Jiao - adi-linux/arch/arm/boot/uImage (32bit) 77ef526178SXianjun Jiao - devicetree file: 78ef526178SXianjun Jiao - openwifi/kernel_boot/boards/zcu102_fmcs2/system.dtb (64bit) 79ef526178SXianjun Jiao - openwifi/kernel_boot/boards/$BOARD_NAME/devicetree.dtb (32bit) 80*7eea2988SXianjun Jiao - BOOT.BIN ([Update FPGA](../../README.md#Update-FPGA)): 81ef526178SXianjun Jiao - openwifi/kernel_boot/boards/$BOARD_NAME/output_boot_bin/BOOT.BIN 82*7eea2988SXianjun Jiao - openwifi driver ([Update Driver](../../README.md#Update-Driver)). 83*7eea2988SXianjun Jiao - openwifi/user_space files and openwifi/webserver files 84ef526178SXianjun Jiao 85*7eea2988SXianjun 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"** 86ef526178SXianjun Jiao``` 87ef526178SXianjun Jiaossh [email protected] 88ef526178SXianjun Jiao``` 89ef526178SXianjun Jiao 90ef526178SXianjun JiaoThen change password to "openwifi" via "passwd" command onbard. 91ef526178SXianjun Jiao 92ef526178SXianjun JiaoEnlarge the onboard SD disk space, and reboot (https://github.com/analogdevicesinc/adi-kuiper-gen/releases) 93ef526178SXianjun Jiao``` 94ef526178SXianjun Jiaoraspi-config --expand-rootfs 95ef526178SXianjun Jiaoreboot now 96ef526178SXianjun Jiao``` 97ef526178SXianjun JiaoSetup routing/NAT **on the PC** for your board -- this internet connection is **important** for post installation/config. 98ef526178SXianjun Jiao``` 99ef526178SXianjun Jiaosudo sysctl -w net.ipv4.ip_forward=1 100ef526178SXianjun Jiaosudo iptables -t nat -A POSTROUTING -o NICY -j MASQUERADE 101ef526178SXianjun Jiaosudo ip route add 192.168.13.0/24 via 192.168.10.122 dev ethX 102ef526178SXianjun Jiao``` 103ef526178SXianjun Jiao**ethX** is the PC NIC name connecting the board ethernet. **NICY** is the PC NIC name connecting internet (WiFi or another ethernet). 104ef526178SXianjun Jiao 105ef526178SXianjun JiaoIf you want, uncommenting "net.ipv4.ip_forward=1" in /etc/sysctl.conf to make IP forwarding persistent on PC. 106ef526178SXianjun Jiao 107ef526178SXianjun JiaoTest the connectivity. Run on board (in the ssh session): 108ef526178SXianjun Jiao``` 109ef526178SXianjun Jiaoroute add default gw 192.168.10.1 110ef526178SXianjun Jiaoping IP_YOU_KNOW_ON_YOUR_NETWORK 111ef526178SXianjun Jiao``` 112ef526178SXianjun JiaoIf there is issue with the connectivity (ping can not reach the target), it needs to be solved before going to the next step. 113ef526178SXianjun Jiao 114ef526178SXianjun JiaoDo misc configurations/installations in the ssh session onboard: 115ef526178SXianjun Jiao``` 116ef526178SXianjun Jiaosudo apt update 117*7eea2988SXianjun Jiaochmod +x /root/openwifi/*.sh 118ef526178SXianjun Jiao 119ef526178SXianjun Jiao# install and setup dhcp server 120ef526178SXianjun Jiaosudo apt-get -y install isc-dhcp-server 121*7eea2988SXianjun Jiaocp /root/openwifi/dhcpd.conf /etc/dhcp/dhcpd.conf 122ef526178SXianjun Jiao 123ef526178SXianjun Jiao# install hostapd and other useful tools 124ef526178SXianjun Jiaosudo apt-get -y install hostapd 125ef526178SXianjun Jiaosudo apt-get -y install tcpdump 126ef526178SXianjun Jiaosudo apt-get -y install webfs 127ef526178SXianjun Jiaosudo apt-get -y install iperf 128ef526178SXianjun Jiaosudo apt-get -y install iperf3 129ef526178SXianjun Jiaosudo apt-get -y install libpcap-dev 130ef526178SXianjun Jiaosudo apt-get -y install bridge-utils 131ef526178SXianjun Jiao 132*7eea2988SXianjun Jiao# build on board tools 133*7eea2988SXianjun Jiaosudo apt-get -y install libnl-3-dev 134*7eea2988SXianjun Jiaosudo apt-get -y install libnl-genl-3-dev 135*7eea2988SXianjun Jiaocd /root/openwifi/sdrctl_src 136*7eea2988SXianjun Jiaomake clean 137*7eea2988SXianjun Jiaomake 138*7eea2988SXianjun Jiaocp sdrctl ../ 139*7eea2988SXianjun Jiaocd /root/openwifi/side_ch_ctl_src/ 140*7eea2988SXianjun Jiaogcc -o side_ch_ctl side_ch_ctl.c 141*7eea2988SXianjun Jiaocp side_ch_ctl ../ 142*7eea2988SXianjun Jiaocd /root/openwifi/inject_80211/ 143*7eea2988SXianjun Jiaomake clean 144*7eea2988SXianjun Jiaomake 145*7eea2988SXianjun Jiaocd .. 146ef526178SXianjun Jiao``` 147ef526178SXianjun Jiao 148ef526178SXianjun JiaoRun openwifi in the ssh session onboard: 149ef526178SXianjun Jiao``` 150*7eea2988SXianjun Jiao/root/openwifi/setup_once.sh (Only need to run once for new board) 151ef526178SXianjun Jiaocd /root/openwifi 152ef526178SXianjun Jiao./wgd.sh 153*7eea2988SXianjun Jiaoifconfig sdr0 up 154ef526178SXianjun Jiaoiwlist sdr0 scan 155ef526178SXianjun Jiao./fosdem.sh 156ef526178SXianjun Jiao``` 157ef526178SXianjun Jiao 158ef526178SXianjun Jiao## Use existing SD card on new board 159ef526178SXianjun Jiao 160*7eea2988SXianjun 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. 161