Build system setup WSL

This method is NOT OFFICIALLY supported. A native GNU/Linux environment is recommended.

The OpenWrt buildroot build system can work in a Windows Subsystem for Linux (WSL).

To install the WSL and a Linux distribution use the “Windows Subsystem for Linux Documentation”.
WSL 2 should be faster than WSL 1 (reference Microsoft).
Also mind instruction of the WSL Linux distribution, eg. with Debian:

sudo apt update
sudo apt dist-upgrade

To be able to build an OpenWrt image, configure WSL so that no Windows path elements (starts with '/mnt/') are in the $PATH environment variable of the Linux distribution.
In the Linux environment (eg. Debian) create /etc/wsl.conf.

sudo nano /etc/wsl.conf

In /etc/wsl.confadd following lines (reference Microsoft).

[interop]
appendWindowsPath = false

Save in nano the file with ‘’ctrl+s’’ and exit with ‘’ctrl+x’’.
Exit Linux session (eg. Debian).

exit

Restart WSL (eg. in ‘’Command Prompt’’ by command ‘’wsl –shutdown’’) to invoke changes.
In the Linux environment (eg. Debian) verify whether no Windows path elements appear in the $PATH environment variable by following command.

echo $PATH

There are alternative methods to remove the Windows path elements from the $PATH environment variable, but probably depreciated.

It is possible to limit `WSL2`'s use of RAM/CPU resources by creating/editing C:\Users\<yourUserName>\.wslconfig.(reference Microsoft).

[wsl2]
memory=8GB # Limits VM memory in WSL 2 to 8 GB
processors=4 # Makes the WSL 2 VM use four virtual processors

You must restart WSL (eg. in ‘’Command Prompt’’ by command ‘’wsl –shutdown’’) to invoke changes.

By default, WSL2 mounts your Windows drive under /mnt/c/, so you can access from WSL2 to Windows.

You can access the WSL2 file system from Windows 10 by opening explorer.exe and entering \\wsl$\<name of WSL Instance> (eg: \\wsl$\Ubuntu-20.04). You can Map this to a drive letter to easily access the WSL2 system from Windows programs (like Atom or other Graphical IDE software)

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2021/05/14 04:05
  • by grommish