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