xref: /openwifi/doc/img_build_instruction/kuiper.md (revision a7346801b61f871223d4bb5a6f4f47e920df7b4a)
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 the devicetree compiler -- dtc. (For Ubuntu: sudo apt install device-tree-compiler)
6- Install the mkimage tool. (For Ubuntu: sudo apt install u-boot-tools)
7
8[[Use openwifi prebuilt img](#Use-openwifi-prebuilt-img)]
9[[Build SD card from scratch](#Build-SD-card-from-scratch)]
10[[Use existing SD card on new board](#Use-existing-SD-card-on-new-board)]
11
12## Use openwifi prebuilt img
13
14Download openwifi pre-built img, such as openwifi-xyz.img.xz, and extract it to .img file.
15
16Use dd command to flash the SD card. (Other software seems having issue!)
17```
18sudo dd bs=512 count=31116288 if=openwifi-xyz.img of=/dev/your_sdcard_dev
19```
20
21(To have correct count value, better to check the .img file actual situation by "fdisk -l img_filename".
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. (Other software seems having issue!)
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
70Build and put the following 3 files to the BOOT partition of the SD card:
71- Linux kernel image file (check how to generate it by prepare_kernel.sh in [Update Driver](../../README.md#Update-Driver)):
72  - adi-linux-64/arch/arm64/boot/Image (64bit)
73  - adi-linux/arch/arm/boot/uImage (32bit)
74- devicetree file:
75  - openwifi/kernel_boot/boards/zcu102_fmcs2/system.dtb (64bit)
76  - openwifi/kernel_boot/boards/$BOARD_NAME/devicetree.dtb (32bit)
77- BOOT.BIN (check how to generate it by boot_bin_gen.sh in [Update FPGA](../../README.md#Update-FPGA)):
78  - openwifi/kernel_boot/boards/$BOARD_NAME/output_boot_bin/BOOT.BIN
79
80Build openwifi driver according to [Update Driver](../../README.md#Update-Driver)). No need to copy them onboard at this moment.
81
82Create /root/openwifi directory in the rootfs partition of the SD card, and put all files in openwifi/user_space to that directory.
83
84Power 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```
96
97(You should already build Linux kernel and openwifi driver in previous steps!)
98
99Transfer the kernel modules .ko and openwifi driver .ko onto the board:
100```
101cd openwifi/user_space
102./transfer_driver_userspace_to_board.sh
103./transfer_kernel_image_module_to_board.sh $LINUX_KERNEL_SRC $BOARD_NAME
104($LINUX_KERNEL_SRC is the directory openwifi/adi-linux-64 or adi-linux)
105```
106
107In the ssh session onboard:
108```
109cd /root
110sync
111tar -zxvf openwifi.tar.gz
112./populate_kernel_image_module_reboot.sh
113reboot now
114```
115Setup routing/NAT **on the PC** for your board -- this internet connection is **important** for post installation/config.
116```
117sudo sysctl -w net.ipv4.ip_forward=1
118sudo iptables -t nat -A POSTROUTING -o NICY -j MASQUERADE
119sudo ip route add 192.168.13.0/24 via 192.168.10.122 dev ethX
120```
121**ethX** is the PC NIC name connecting the board ethernet. **NICY** is the PC NIC name connecting internet (WiFi or another ethernet).
122
123If you want, uncommenting "net.ipv4.ip_forward=1" in /etc/sysctl.conf to make IP forwarding persistent on PC.
124
125Test the connectivity. Run on board (in the ssh session):
126```
127route add default gw 192.168.10.1
128ping IP_YOU_KNOW_ON_YOUR_NETWORK
129```
130If there is issue with the connectivity (ping can not reach the target), it needs to be solved before going to the next step.
131
132Do misc configurations/installations in the ssh session onboard:
133```
134cd /root/openwifi
135route add default gw 192.168.10.1 || true
136ping google.com
137sudo apt update
138chmod +x *.sh
139
140# build sdrctl and inject_80211
141sudo apt-get -y install libnl-3-dev
142sudo apt-get -y install libnl-genl-3-dev
143cd sdrctl_src
144make
145cp sdrctl ../
146cd ../side_ch_ctl_src/
147gcc -o side_ch_ctl side_ch_ctl.c
148cp side_ch_ctl ../
149cd ..
150cd ./inject_80211/
151make
152cd ..
153
154# install and setup dhcp server
155sudo apt-get -y install isc-dhcp-server
156cp dhcpd.conf /etc/dhcp/dhcpd.conf
157
158# install hostapd and other useful tools
159sudo apt-get -y install hostapd
160sudo apt-get -y install tcpdump
161sudo apt-get -y install webfs
162sudo apt-get -y install iperf
163sudo apt-get -y install iperf3
164sudo apt-get -y install libpcap-dev
165sudo apt-get -y install bridge-utils
166
167# add video file into the onbard web server
168wget -P webserver/ https://users.ugent.be/~xjiao/openwifi-low-aac.mp4
169```
170
171Run openwifi in the ssh session onboard:
172```
173cd /root/openwifi
174./wgd.sh
175iwlist sdr0 scan
176./fosdem.sh
177```
178
179## Use existing SD card on new board
180
181You don't need to do it from scratch on a blank SD card. Instead, you can start from existing SD card (for example zcu102), and use it for a new board (for example zedboard).
182
1831. Do this section (see above) "Build and put the following 3 files to the BOOT partition of the SD card" for the new board by replacing the file on the existing SD card.
184
1852. Build openwifi driver according to [Update Driver](../../README.md#Update-Driver)). No need to copy them onboard at this moment.
186
1873. Use the existing SD card to boot the new board.
188
1894. Do this section (see above) "Transfer the kernel modules .ko and openwifi driver .ko onto the board". Do not forget the operations onboard after the file transfer:
190  ```
191  cd /root
192  sync
193  tar -zxvf openwifi.tar.gz
194  ./populate_kernel_image_module_reboot.sh
195  reboot now
196  ```
197