WiFi transplantation method in linux system

First: the phenomenon of transplanting wifi

                On the RK3399 hollow board of the Linux system, confirm that the Linux system of the rk3399 central control board can run normally. This operation is for the WIFI module on the rk3399 central control board. After the Linux kernel loads the wifi driver, and then configures the correct wifi password, the rk3399 central control board can access the Internet wirelessly through wifi.

Second: WiFi function testing method

1. Complete the kernel configuration according to the operating steps and recompile the kernel.

2. After updating the boot.img mapping, restart the rk3399 central control panel and wait to enter the desktop system.

3. Configure the wifi account and password according to the operation method, restart the system, and the rk3399 central control panel can use wifi to access the Internet.

Third: wifi operation method and implementation

 Step 1: Start the development board and wait for the Ubuntu desktop system to start.

 Step 2: Open the command terminal on the rk3399 central control panel screen and check the IP address of the current development board.

root@SOM-RK3399v2:~#
root@SOM-RK3399v2:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.106  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::24de:b444:2687:a032  prefixlen 64  scopeid 0x20<link>
        ether 1e:a0:8e:c1:a7:47  txqueuelen 1000  (Ethernet)
        RX packets 46  bytes 5812 (5.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 36  bytes 3700 (3.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 24

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 168  bytes 11768 (11.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 168  bytes 11768 (11.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@SOM-RK3399v2:~#

Supplement: Remember the IP address 192.168.1.106 viewed here, you will need to use it later.

Step 3: Install the FTP server on the RK3399 board

Note: If you have already installed the FTP server on the rk3399 board, you need to repeat the operation.

1. Install vsftp server

      Enter the following command in the terminal (board rk3399 can connect to the Internet):

      sudo apt-get install vsftpd


root@SOM-RK3399v2:~# sudo apt-get install vsftpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  cron logrotate ssl-cert
Suggested packages:
  anacron checksecurity exim4 | postfix | mail-transport-agent bsd-mailx
  | mailx openssl-blacklist
The following NEW packages will be installed:
  cron logrotate ssl-cert vsftpd
0 upgraded, 4 newly installed, 0 to remove and 3 not upgraded.
Need to get 222 kB of archives.
After this operation, 745 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ports.ubuntu.com bionic/main arm64 cron arm64 3.0pl1-128.1ubuntu1 [65.3 kB]

2. Check service status

Enter the command: sudo  service  vsftpd  status


root@SOM-RK3399v2:~# sudo service vsftpd status
● vsftpd.service - vsftpd FTP server
   Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled; vendor preset: e
   Active: active (running) since Sat 2023-09-30 03:07:21 UTC; 1min 53s ago
 Main PID: 1809 (vsftpd)
    Tasks: 1 (limit: 4601)
   CGroup: /system.slice/vsftpd.service
           └─1809 /usr/sbin/vsftpd /etc/vsftpd.conf

Sep 30 03:07:21 SOM-RK3399v2 systemd[1]: Starting vsftpd FTP server...
Sep 30 03:07:21 SOM-RK3399v2 systemd[1]: Started vsftpd FTP server.

Note: The above output shows that the vsftpd service has been successfully started and running.

3. Modify the configuration file

     First find the configuration file vsftpd.conf

     Configure the file before modifying the file. If the modification is damaged, it cannot be recovered:

sudo cp	/etc/vsftpd.conf /etc/vsftpd.conf-back

     Use vim editor to open the /etc/vsftpd.conf file

sudo vim /etc/vsftpd.conf

     Turn on write_enable=YES (that is, just remove the # in front of it), that is, change line 31.

     #write_enable=YES

     change into:

     write_enable=YES

     Save and exit.

4. Restart vsftpd service

      Since the configuration file has been modified, for the configuration file to take effect, the vsftpd  service needs to be restarted.

  sudo service vsftpd restart

5. Add user and set password

       Here we set the user name to fireflyftp 

sudo useradd -m fireflyftp

     Set password for fireflyftp user

$ sudo passwd fireflyftp
Enter new UNIX password: Retype new UNIX password:#这里输入密码 fireflyftp
passwd: password updated successfully    #这里重复输入相同的确认密码 fireflyftp

Then enter the password twice and press Enter when the following prompt appears to indicate success.

Note: The password is invisible when you enter it, so don’t worry about it .

Fourth: Linux kernel supports wifi driver method

       The Linux kernel source code corresponding to rk3399 already uses the wifi wireless network card driver, and it only needs to be configured to use it.

Note: The Linux kernel source code of the supporting materials has been configured with WIFI wireless network card driver support by default. The purpose of the following configuration process is to let everyone know what options you should configure to drive the WIFI wireless network card if the kernel source code does not yet support WIFI wireless network cards.    

Command terminal to switch to the kernel directory:

cd ~/work/FTLinuxCode/

Copy the Linux kernel source code to ~/work/FTLinuxCode:

 cp /mnt/hgfs/UbuntuShare/kernel.tar.bz2	~/work/FTLinuxCode/

Note: /mnt/hgfs/UbuntuShare/ is my shared directory. I store the kernel in this directory. Please modify it according to your actual situation, or use the mouse to copy and paste it into the Ubuntu system working directory.

Unzip the linux kernel source code to the current ~/work/FTLinuxCode/ directory:

tar -xf	~/work/FTLinuxCode/kernel.tar.bz2	-C ~/work/FTLinuxCode/

        Enter the unzipped linux kernel source code directory

cd ~/work/FTLinuxCode/kernel/

         Load basic configuration:

make firefly_linux_defconfig

Command the terminal to switch to the top-level directory of the Linux kernel source code, enter the kernel configuration menu, and enter the configuration menu command:

make menuconfig

According to the following hierarchical relationship, find the infrared remote control button driver and make sure it is selected.

  1. Configure CFG80211

CFG80211 is the standard interface for WiFi drivers and user-mode processes in the kernel. Before the emergence of CFG80211, it was WEXT. Now more and more CFG80211 is used. The WiFi Direct function is only supported by CFG80211.

Enter Network support->Wireless and set cfg80211 and mac80211 to M, as shown below.

Ensure that the following two items are selected. These two items can also be deselected by other kernel configuration items, that is, they are not configured. When certain related options are selected, these two items will be automatically configured. You can view the help information on the configuration interface. Know which configuration options will be automatically selected.

cfg80211  - wireless configuration API item description has the following information:  

Selected by: WL_ROCKCHIP [=y] && NETDEVICES [=y] && WLAN [=y] || AP6XXX [=y] && NETDEVICES [=y] && WLAN [=y] && WL_ROCKCHIP [=y]

This means that when WL_ROCKCHIP, NETDEVICES and WLAN are all configured to be selected or when AP6XXX, NETDEVICES, WLAN and WL_ROCKCHIP are all selected, the cfg80211 - wireless configuration API item will be automatically selected .

The Generic IEEE 802.11 Networking Stack (mac80211 ) item description contains the following information:     

Selected by: WL_ROCKCHIP [=y] && NETDEVICES [=y] && WLAN [=y] || AP6XXX  [= y ] && NETDEVICES [= y ] && WLAN [= y ] && WL_ROCKCHIP [= y ] || R8723AU [=n] && STAGING [=y] && USB [=y] && WLAN [=y ] && RFKILL  [= y ] .    

2, Placement Wireless Extension

WEXT is the standard interface for WiFi drivers and user-mode processes in the kernel. The debugging tools iwconfig, iwlist, and iwpriv need to use this interface. If the interface is not configured, some drivers will have compilation errors.

WEXT does not have a separate configuration item in the kernel configuration and can only be opened indirectly by opening the configuration items that depend on it. After configuring CFG80211, go to Device Drivers->Network device support->Wireless LAN-> Rockchip Wireless LAN suppor -> and set ap6xxx wireless sdio cards support to Y. As shown below.

Wireless Extension Placement

-> Device Drivers
-> Network device support (NETDEVICES [=y])
-> Wireless LAN (WLAN [=y])
-> Rockchip Wireless LAN support
-> ap6xxx wireless sdio cards support

After finding the ap6xxx wireless sdio cards support configuration is Y.

Save the configuration and exit the configuration interface.

3. Update the RK3399 central control board Linux kernel image

     make ARCH=arm64 rk3399-firefly.img -j8

4. Reburn the generated boot.img image file to the development board

Guess you like

Origin blog.csdn.net/weixin_41114301/article/details/133428935