Setting up WSL2, Docker, and running your first container.
WSL (Windows Subsystem for Linux)

WSL, or Windows Subsystem for Linux, is a handy feature for Windows users who want to run Linux without all the hassle. It lets you open up a Linux terminal right on your Windows machine, so you can use Linux commands and tools without needing a separate Linux computer or a virtual machine. It's perfect for developers and anyone who likes the flexibility of Linux but prefers sticking with Windows for their day-to-day stuff.

Docker

Docker is like having a magic box for your apps. You put your application and everything it needs to run (like code, libraries, and settings) into this box, called a container. Then, you can run this container on any machine with Docker installed, and it will work exactly the same. It's super useful because it means your app can run anywhere, from your laptop to a big server in the cloud, without any weird issues popping up. Plus, it makes sharing your app with others a breeze.. We use Docker for compiling as the container can be started/stopped at will and also resets the rootfs every boot.

WSL
Docker

WSL and Docker

What we'll be doing:
  1. Enable WSL and set WSL2 as default.
  2. Install a Linux distribution from Microsoft Store.
  3. Install Docker Desktop and enable WSL2 integration.
  4. Install Git and Make in your WSL terminal.
  5. Clone a repository and build the Docker image.
Step 1: Enable WSL and Install WSL2

Enable WSL: Open PowerShell as Administrator and run:

wsl --install

Set WSL2 as the Default Version:

wsl --set-default-version 2

Restart Your Computer: Restart your computer to apply changes.

Step 2: Install a Linux Distribution

Install a Linux Distribution: Open Microsoft Store, search for your preferred Linux distribution (e.g., Ubuntu), and install it.

Set Up Your Linux Distribution: Launch the installed distribution from the Start menu and complete the initial setup (create a user account and set a password).

Step 3: Install Docker Desktop

Download Docker Desktop: Docker's official website

Enable WSL2 Integration: During the installation, ensure the option "Use the WSL 2 based engine" is checked.

Finish Installation: Complete the installation and start Docker Desktop.

Step 4: Configure Docker to Use WSL2

Open Docker Desktop: Go to Settings.

Enable WSL2 Integration:

Navigate to Resources -> WSL Integration. Ensure that the Linux distribution you installed is checked to enable integration.

Step 5: Install Make and Git in WSL

Open WSL Terminal: Open your installed Linux distribution from the Start menu.

Update Package Lists:

sudo apt update

Install Git and Make:

sudo apt install git make

Step 6: Clone the Repository and Build the Docker Image

The Union toolchain is a pre-built toolchain by Shauninman. It contains everything you need to compile for the Miyoo Mini(&Plus)

Clone the Repository:

git clone https://github.com/shauninman/union-miyoomini-toolchain.git

Navigate to the Directory:

cd union-miyoomini-toolchain

Build and Run the Docker Container:

make shell

Icon

mattpc@MattPC:~/union-miyoomini-toolchain$ make shell

docker run -it --rm -v "/home/mattpc/union-miyoomini-toolchain/workspace":/root/workspace miyoomini-toolchain /bin/bash

root@7ee8499587da:~/workspace#


You're now in a containerised shell and can begin compiling; why not try this script out to compile your first Miyoo compatible binary?
The Hello-Miyoo test app