OS Development on Linux
Most users can just use a pre-built binary from the releases page and install it manually or using the web installer.
But if for some reason that one doesn't work, or you really want to modify things under the hood, you're in the right place here!
Get the prerequisites
Clone the repositories:
git clone --recurse-submodules https://github.com/MicroPythonOS/MicroPythonOS.git
That will take a while, because it recursively clones MicroPython, LVGL, ESP-IDF and all their dependencies.
While that's going on, make sure you have everything installed to compile code:
sudo apt update
sudo apt-get install -y build-essential libffi-dev pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev libpipewire-0.3-dev libwayland-dev libdecor-0-dev libv4l-dev
Compile the code
-
Make sure you're in the main repository:
cd MicroPythonOS/ -
Start the Compilation
Usage:
./scripts/build_mpos.sh <target system>Target systems:
esp32,unix(= Linux) andmacOSExamples:
./scripts/build_mpos.sh esp32 ./scripts/build_mpos.sh unix ./scripts/build_mpos.sh macOSThe resulting build file will be in
lvgl_micropython/build/, for example:lvgl_micropython/build/lvgl_micropy_unixlvgl_micropython/build/lvgl_micropy_macOSlvgl_micropython/build/lvgl_micropy_ESP32_GENERIC_S3-SPIRAM_OCT-16.bin
Running on Linux or MacOS
-
Make sure you have the software
Either you built your own on MacOS or Linux or you can download a pre-built executable binary (e.g.,
MicroPythonOS_amd64_Linux,MicroPythonOS_amd64_MacOS) from the releases page.Give it executable permissions:
chmod +x /path/to/MicroPythonOS_executable_binary -
Make sure you have the
local_filesystem/folderYou probably already have a local clone that contains the internal_filesystem.
If not, then clone it now:
git clone --recurse-submodules https://github.com/MicroPythonOS/MicroPythonOS.git cd MicroPythonOS/ -
Start it from the local_filesystem/ folder:
cd internal_filesystem/ # make sure you're in the right place to find the filesystem /path/to/MicroPythonOS_executable_binary -X heapsize=32M -v -i -c "$(cat boot_unix.py main.py)"There's also a convenient
./scripts/run_desktop.shscript that will attempt to start the latest build that you compiled yourself.
Modifying files
You'll notice that, whenever you change a file on your local system, the changes are immediately visible whenever you reload the file.
This results in a very quick coding cycle.
Give this a try by editing internal_filesystem/builtin/apps/com.micropythonos.about/assets/about.py and then restarting the "About" app. Powerful stuff!