Close

How to Support Virtual Network on Linux 4.1.15?

forlinx-embeddedforlinx embedded wrote 03/16/2024 at 06:51 • 5 min read • Like

Taking the FETMX6ULL-C platform as an example, if you want to use VPN, you need to open the tun configuration in the kernel in the following way:

Kernel Compilation

Choose either of the two methods below:

1. Modify the.config file directly

Locate the.config file in the kernel source path.

How to Support Virtual Network on Linux 4.1.15?

Find the CONFIG _ TUN in the file and modify it as follows:

How to Support Virtual Network on Linux 4.1.15

Replace the kernel's config file with .config.

How to Support Virtual Network on Linux 4.1.15

* Subject to actual use.

Recompile the kernel.

How to Support Virtual Network on Linux 4.1.15

2. Configure the TUN using the graphical configuration interface

Make menuconfig.

Locate the following locations:

How to Support Virtual Network on Linux 4.1.15

Save and exit after modification, which can be seen in.config

How to Support Virtual Network on Linux 4.1.15

Replace the kernel's config file with .config.

How to Support Virtual Network on Linux 4.1.15

* Subject to actual use.

Recompile the kernel.

How to Support Virtual Network on Linux 4.1.15

Update kernel:

The arch/arm/boot/zImage file is generated after compilation, and the kernel can be replaced either by updating the kernel separately or by re-burning it.

Use this file to replace the file with the same name in the target path of the flashing tool.

Refer to the single-step kernel update chapter of the FETmx6ull-c User's Manual to replace the zImage file separately.

Compilation module:

In the kernel source code, some of the drivers are compiled in the form of modules, which are loaded from the specified path by the kernel version number when the system boots. When we recompile the kernel and update the kernel, the kernel version number in the system will be changed, the kernel version number can be viewed through the uname -r command. When you update the kernel, the uname -r version number changes, but the version number in the path where the module is stored (/lib/modules/) does not change. It may cause the module to fail to load, typically after updating the kernel, WiFi cannot be used.

As seen below, the name under uanme -r and the name under /lib/modules/ are not the same, so you can't load the module when you go to the/lib/modules/$(uname -r) directory when booting up, and you need to change both names to be the same.

How to Support Virtual Network on Linux 4.1.15

You can solve this problem in two ways:

1. Modify the module load path and change to the version number of the kernel;

How to Support Virtual Network on Linux 4.1.15

2. Repackage modules;

The first method has two disadvantages:

a. Not suitable for batch modification;

b. Not suitable for changing the module driver;

So it is possible to repackage the module when compiling the kernel:

After executing the above operation, .tmp/root/modules.tar.bz2 will be generated, which can replace the file with the same name under the target path in the flashing tool.

It is also extracted directly in the file system:

Like

Discussions