Linux and Ubuntu are ideal for Krux development, but if you have a computer that lacks Linux support, with no drivers available for peripherals like the webcam (the webcam is integral to many Krux workflows), you can consider developing for Krux on Windows.
We will use the combo Window WSL(2), running Ubuntu and VS Code for simulation, code edition and compiling.
To edit Krux source code, when preparation is finished, you’ll be able to open Ubuntu, navigate to Krux project and run: code .
This will open VS Code on Windows, which will be editing the project inside Ubuntu.
Open PowerShell and type the command:
wsl --install
Download VS Code and install it on Windows, making sure it is checked to be added to PATH on “additional tasks”.
Reboot the computer.
Open VS Code and install the “Remote Development” extension from Microsoft, then close it.
Run “Ubuntu” application on Windows. When prompted in the terminal, create a Linux username and password.
On Ubuntu terminal, update the system:
sudo apt update
sudo apt upgrade
Install ssl requirements:
sudo apt-get install wget ca-certificates
Clone Krux:
git clone --recurse-submodules https://github.com/selfcustody/krux
(update) Webcam won't work in WSL :/
On Ubuntu terminal, install poetry
curl -sSL https://install.python-poetry.org | python3 -
restart Ubuntu (exit command and run it again)
Test poetry:
poetry --version
Install other dependencies:
sudo apt install libgl1 zbar-tools
Reboot Ubuntu again to smooth out recent package installations.
Enter krux dir:
cd krux/
(Optional) Checkout to a develop branch:
git checkout integrated_changes
Install project’s dependencies using poetry:
poetry install --extras simulator
Enter simulator folder:
cd simulator
Run the Simulator:
poetry run python simulator.py --device maixpy_amigo_tft
Prepare:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Install:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Test:
sudo docker run hello-world
Add user to docker group:
sudo usermod -aG docker $USER
Log in to the new docker group
newgrp docker
Enter Krux main directory and build Krux:
./krux build maixpy_amigo_tft
This takes a looong time, and you may need to retry if it fails due to an internet connection instability. Subsequent builds will be much faster, as it will build only Krux binaries, not the whole tool-chain.
Windows WSL2 don’t have access to serial ports, so the best is to copy the binary to a Windows folder and run Ktool natively from there.
On Ubuntu terminal, enter in Krux main directory and run VS Code:
code .
It will open VS Code on Windows, but will live edit the project inside Ubuntu
Na instalação do poetry vc sugere
curl -sSL https://install.python-poetry.org | python3 -
, pq não fazer pelo pyhton mesmo?python3 -m pip install poetry