# Resumo
This blog post presents a way to enable the use of [[Rede de área de controlador|CAN network]] in [[Subsistema Windows para Linux|WSL]]. To do this, it is essential to have [[Subsistema Windows para Linux|WSL]] installed on your computer so that you can use a custom Kernel with [[Rede de área de controlador|CAN network]] modules enabled.
First of all, update your system.
```bash
sudo apt-get update -y
```
Then download the Kernel from the GitHub repository. Note that the `linux-msft-wsl-X.X.y` section should be replaced with the desired version, for example, `linux-msft-wsl-5.15.y`. To check which version of [[Subsistema Windows para Linux|WSL]] you are using use `uname -r`
```bash
git clone https://github.com/microsoft/WSL2-Linux-Kernel.git --depth=1 -b linux-msft-wsl-X.X.y
```
Now copy the modules to a .config file
```bash
cd WSL2-Linux-Kernel
cat /proc/config.gz | gunzip > .config
```
Then install the required packages.
```bash
sudo apt update && sudo apt install build-essential flex bison libssl-dev libelf-dev bc python3 pahole
```
Now use the following commands to build the custom kernel.
```bash
make prepare modules_prepare
make menuconfig
```
A screen will now appear to select the modules that should be installed. In this screen, select `Networking Support`, then press `M` on the `CAN bus subsystem support` option. Then press `Enter` to access this option and mark with `M` the modules you want to install.
Finally, build the custom kernel.
```bash
make -j4
sudo make module_install
```
Finally, copy the `BzImage` file that will be located in `arch/x86/boot/bzImage` to the Windows folder `C:` and create a `.wslconfig` file with the text below in `C:\<User>\>`
```
[wsl2]
kernel=C:\\bzImage
```
# Minha Opinião
Esta é a maneira mais simples de habilitar uma rede virtual [[Rede de área de controlador|CAN network]] no Windows. Infelizmente, esta função não é habilitada diretamente, mas pode ser usada com alguma facilidade usando o método indicado acima.