Objective: to carry out CSI experiment under the Ubuntu system of the latest version (Ubuntu 18.04)
Environment requirements: Ubuntu 18.04 + kernel version 4.15
Dual system installation:
https://www.cnblogs.com/masbay/p/11627727.html
Auxiliary reference: https://blog.csdn.net/weixin_44623637/article/details/106723462 ;
After installation, the kernel version is:
zhutao1@zhutao1-B360M-POWER:~$ uname -r
5.4.0-58-generic
The following is the text:
1, Reduce version to 4.15:
~# uname -a
5.4.0-58-generic #64~18.04.1-Ubuntu SMP Wed Dec 9 17:11:11 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Search for existing kernel versions. Use command:
apt-cache search linux|grep linux-image
#Sudo apt get install linux-image-4.15.0-20-generic / / install a header file
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-headers-4.15.0-041500_4.15.0-041500.201802011154_all.deb wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-headers-4.15.0-041500-generic_4.15.0-041500.201802011154_amd64.deb wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-image-4.15.0-041500-generic_4.15.0-041500.201802011154_amd64.deb
After downloading, use the following command to install Linux Kernel 4.15:
sudo dpkg -i *.deb
Update the Grub boot loader with the following command:
sudo update-grub
Use the command: reboot
Supplement: select the ubuntu advanced option (the second line) and select the version to enter. Select the version without parentheses to enter.
Press del to enter bios;
sudo gedit /etc/default/grub;
Note: GRUB_HIDDEN_TIMEOUT=0
sudo update-grub
Update grub configuration again. Restart.
To view the installed kernel:
sudo dpkg --get-selections |grep linux
Uninstall the latest downloaded or unnecessary kernel version, and the system will return to the remaining kernel versions. The uninstall command is:
sudo apt purge Kernel name kernel name
2, Install CSI TOOL
CSI tool installation reference:
https://blog.csdn.net/u014645508/article/details/81359409;
https://www.codenong.com/cs105268110/
In order to carry out CSI experiment under the newer version of Ubuntu system, through online search, we found an improved version of CSI TOOL, which is also a GitHub project. The specific website is as follows:
https://github.com/spanev/linux-80211n-csitool;
1. Prepare
Packages required for installation:
$ sudo apt install build-essential linux-headers-$(uname -r) git-core
Compiler supporting retpoline (Ubuntu 16.04). Newer kernel requires compiler with retpoline support. GCC and G + + versions 7.3 and later support this feature. The following example shows how to install GCC / G + + version 8:
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test $ sudo apt update $ sudo apt install gcc-8 g++-8
To ensure that the make command uses the correct version of the compiler. You can use the following methods:
Redirect the system wide link to the compiler executable and check where the current link points. Command:
$ ls -l /usr/bin/gcc /usr/bin/g++
A similar output should be generated:
lrwxrwxrwx 1 root 5 Mar 27 2018 /usr/bin/g++ -> g+±7
lrwxrwxrwx 1 root 5 Mar 27 2018 /usr/bin/gcc -> gcc-7
The current link points to version 5. Therefore, you need to redirect them to version 8. To do this, delete the current path:
$ sudo rm /usr/bin/gcc $ sudo rm /usr/bin/g++
And create a new:
$ sudo ln -s /usr/bin/gcc-8 /usr/bin/gcc $ sudo ln -s /usr/bin/g++-8 /usr/bin/g++
2. Generate and install the modified wireless driver
Clone the modified Linux kernel code
$ git clone https://github.com/spanev/linux-80211n-csitool.git $ cd linux-80211n-csitool
Check out the correct release
$ CSITOOL_KERNEL_TAG=csitool-$(uname -r | cut -d . -f 1-2) $ git checkout ${CSITOOL_KERNEL_TAG}
Build the modified network card driver in the current kernel
$ make -j `nproc` -C /lib/modules/$(uname -r)/build M=$(pwd)/drivers/net/wireless/intel/iwlwifi modules $ sudo make -C /lib/modules/$(uname -r)/build M=$(pwd)/drivers/net/wireless/intel/iwlwifi \ > INSTALL_MOD_DIR=updates modules_install
Note: if you receive an error message similar to the following during the execution of the above command
- SSL error:02001002:system library:fopen:No such file or directory: bss_file.c:175
- SSL error:2006D080:BIO routines:BIO_new_file:no such file: bss_file.c:178
sign-file: certs/signing_key.pem: No such file or directory
don't worry. The operating system complained because the driver did not have an SSL signature. This will not interfere with the installation of the driver. Therefore, just ignore the message and continue the installation process.
$ sudo depmod //It can detect the dependency of modules, which can be used by modprobe when installing modules. $ cd .. //Return to the previous directory
3. Install the modified firmware
Obtain supplementary materials for CSI tools:
$ git clone https://github.com/dhalperi/linux-80211n-csitool-supplementary.git
Reposition all existing firmware for the Intel Wi Fi link 5000 Series adapter:
$ for file in /lib/firmware/iwlwifi-5000-*.ucode; do sudo mv $file $file.orig; done
Install the modified firmware:
$ sudo cp linux-80211n-csitool-supplementary/firmware/iwlwifi-5000-2.ucode.sigcomm2010 /lib/firmware/ $ sudo ln -s iwlwifi-5000-2.ucode.sigcomm2010 /lib/firmware/iwlwifi-5000-2.ucode //There is no command line reaction in these steps, but only in folder operation
For the method of using the tool, refer to the previous article:
1. Compile data collection file
Switch to the netlink directory and prepare for compilation
cd ~/linux-80211n-csitool-supplementary/netlink
implement
make
This step is to compile the generated log_to_file and other files. log_to_file can realize the data collection function.
In the next step, I succeeded without changing the driving parameters
2. Change driving parameters:
sudo gedit /home/zhutao1/linux-80211n-csitool/drivers/net/wireless/intel/iwlwifi/dvm/main.c
Use the search function to search for connectors_ Log, set the right side of the sentence to 1, i.e
priv->connector_log=1;
preservation.
After the modification, you need to re install the modified kernel driver, so we execute
cd linux-80211n-csitool CSITOOL_KERNEL_TAG=csitool-$(uname -r | cut -d . -f 1-2) git checkout ${CSITOOL_KERNEL_TAG} make -C /lib/modules/$(uname -r)/build M=$(pwd)/drivers/net/wireless/intel/iwlwifi modules //uname -r indicates the output kernel release number sudo make -C /lib/modules/$(uname -r)/build M=$(pwd)/drivers/net/wireless/intel/iwlwifi INSTALL_MOD_DIR=updates \modules_install sudo depmod cd .. sudo update-grub
2. Do not change the drive:
sudo modprobe -r iwlwifi mac80211 //uninstall
If an error... is in use by... Is reported in this step, it indicates that the module you want to uninstall is being used by other modules. for example
cfg80211 is in use by ath9k, then we need to use sudo rmmod to uninstall ath9k first.
eg. sudo rmmod iwlwifi
sudo modprobe iwlwifi connector_log=0x1
Use ctrl+alt+T to create another terminal and execute the command
ping 192.168.1.1 -i 0.5(0.5 is the contracting interval, and shorter contracting interval can be obtained by using sudo permission)
Our computer will keep pinging AP, and then we can measure CSI.
Open log in the original terminal_ to_ File receipt:
cd /home/zhutao/linux-80211n-csitool-supplementary/netlink sudo ./log_to_file test.dat