Local Building po-util with Bash on Windows, WSL (Windows Subsystem for Linux)

With @nrobinson2000 help I just got pu-util.com working on windows using the WSL

po-util is a little known option for local compiling of particle programs (However it can also be installed on cloud software so it becomes another option for the Particle Cloud Web IDE)

It is a wonderful program, but only works on linux or MacOS. In the past I have been frustrated with Bash On Windows or (WSL) as an almost useless Linux on windows, but in this case I think it works. If there is interest I will try to do some better instructions.

Now it is not perfect. It can’t do serial or usb local transfers, but a trick I got working today was from linux to copy your .bin file to the windows area

cp myCompiledFile.bin /mnt/c/Documents/yourFolder/

and then use the working particle-client for windows to DFU or serial install your files.

I have the best approach which seems to work but is not really a local solution as I use OTA to install the compiled files from po-util directly through the cloud to my device. This method does work from WSL.

I used the normal po-util installation once I got ubuntu up and running and after the installation I followed this stackoverflow

sudo apt install qemu-user-static
sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic '\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00' --mask '\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff'

sudo service binfmt-support start

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install gcc:i386

which the last step did not work but po-util seemed to work.

The only caveat is that each time you start ubuntu you need to run this command again

sudo service binfmt-support start

No idea if everything works but a very interesting option for windows users.

1 Like