Linux subsystem built using Windows Embedded development environment

  Pro, both in 9102, and still do cross-compilation chain embedded with VMware to run?

  Beijing time on June 13, 2019, Windows 10 released a preview version 18917 . The main function version of the Linux subsystem (windows sub-system linux version 2 , hereinafter referred to as wsl2) has been upgraded, it can be seen from the description of the Internet, the new version of wsl claimed that the introduction of a complete Linux kernel, means that we can and use it to run docker i686 architecture program (former Microsoft official page in the show, which is wsl1 not supported, so before or embedded development can only run a virtual machine or dual system, because the embedded compiler chain 32 in the majority, for example, I use hisi compiler chain).

  Well, he did not talk much, we started to build the environment, first of all you need to join Preview Program (as of October 2019, the consumer version or 184xx version can not be upgraded to 18917), was added as follows:

  The first is the addition of a preview Experience Program:

  After completion of the need to restart the update frequency modulation faster, and then go to the update screen refresh, it will automatically install the preview version of the OS:

  When the screen displays the word "Insider Preview" "vb_release" and so on, you will soon eat a preview.

  After the end of this long process, we enable Linux subsystem functions, this step tutorial we refer to the Internet, such as how to install Linux subsystem WSL2 in Windows 10 in .
  I quote this article we refer to first and second step, it is worth mentioning that there are two places in which to explain, first install Ubuntu good first run, as follows:

There is one line statement that he was wrong

wsl --set-version Ubuntu> 2

This should be no ">", that should be

wsl --set-version Ubuntu 2

  After installing Ubuntu, we can try to install cross compiler tool chain and try to compile (I use vscode open the terminal for subsequent operations, the default terminal vscode I also set wsl, and this would facilitate a number):

Then the installation tool 32 and the host libraries, using the following command:

#宿主开发环境
sudo apt install -y build-essential
#32位库
sudo apt install -y lib32ncurses5 lib32z1
sudo apt install -y lib32stdc++6

Of course, you can also replace the source packages for the first Ali cloud, you can use the following statement:

sudo sed -i "s/archive\.ubuntu\./mirrors\.aliyun\./g" /etc/apt/sources.list
sudo apt update

  The next most important step is to open the 32-bit support for Ubuntu, use the following statement. Then on Windows restart a service (equivalent to restart Ubuntu, the picture restart mode choose one)

sudo dpkg --add-architecture i386

Then compile the good news is successful:

Compiled by the program, the machine can be put on the run, here is my test shots.

Use wsl there is a benefit! That we can use the synchronization code debugging in linux inside, like my following operation

Further, we can debug in Ubuntu (due vscode + wsl supports remote debugging, so maybe you could use a good ide debugging in wsl in the code, and then ported to the embedded platform).

Guess you like

Origin www.cnblogs.com/Johness/p/use-wsl-build-cross-compile-environment.html