|
1 | | -# Building for Desktop |
| 1 | +# OS Development on Linux |
2 | 2 |
|
3 | | -MicroPythonOS can be built to run as an application on Linux desktops (fully supported) or MacOS (untested). |
| 3 | +Most users can just use a pre-built binary from the [releases page](https://github.com/MicroPythonOS/MicroPythonOS/releases) and install it manually or using the [web installer](https://install.MicroPythonOS.com). |
4 | 4 |
|
5 | | -## Prerequisites |
| 5 | +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! |
6 | 6 |
|
7 | | -<!-- https://github.com/lvgl-micropython/lvgl_micropython?tab=readme-ov-file#compiling-for-ubuntu-linux --> |
| 7 | +## Get the prerequisites |
| 8 | + |
| 9 | +Clone the repositories: |
| 10 | + |
| 11 | +``` |
| 12 | +git clone --recurse-submodules https://github.com/MicroPythonOS/MicroPythonOS.git |
| 13 | +``` |
| 14 | + |
| 15 | +That will take a while, because it recursively clones MicroPython, LVGL, ESP-IDF and all their dependencies. |
| 16 | + |
| 17 | +While that's going on, make sure you have everything installed to compile code: |
8 | 18 |
|
9 | | -- Install dependencies (Linux): |
10 | 19 | ``` |
11 | | -sudo apt install libv4l-dev # For webcam support |
| 20 | +sudo apt update |
| 21 | +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 |
12 | 22 | ``` |
13 | | -- See [lvgl-micropython](https://github.com/MicroPythonOS/lvgl_micropython) for additional requirements. |
14 | | -- Clone repositories as described in [Building for ESP32](esp32.md). |
15 | 23 |
|
16 | | -## Build Process |
| 24 | +## Compile the code |
17 | 25 |
|
18 | | -1. **Navigate to the Repository**: |
| 26 | +1. **Make sure you're in the main repository**: |
19 | 27 |
|
20 | 28 | ``` |
21 | | - cd ~/MicroPythonOS/MicroPythonOS |
| 29 | + cd MicroPythonOS |
22 | 30 | ``` |
23 | 31 |
|
24 | | -2. **Build for Linux**: |
| 32 | +2. **Start the Compilation** |
| 33 | +
|
| 34 | + Usage: |
25 | 35 |
|
26 | 36 | ``` |
27 | | - ./scripts/build_lvgl_micropython.sh unix dev |
| 37 | + ./scripts/build_lvgl_micropython.sh <target system> <build type (prod or dev)> [optional target device] |
28 | 38 | ``` |
29 | 39 |
|
30 | | -3. **Build for MacOS** (untested): |
| 40 | + Supported target systems: esp32, unix (= Linux) and macOS |
| 41 | + |
| 42 | + Build types: |
| 43 | + - A "prod" build includes the complete filesystem that's "frozen" into the build, so it's fast and all ready to go but the files in /lib and /builtin will be read-only. |
| 44 | + - A "dev" build comes without a filesystem, so it's perfect for power users that want to work on MicroPythonOS internals. There's a simple script that will copy all the necessary files over later, and these will be writeable. |
| 45 | + Note: for unix and macOS systems, only "dev" has been tested. The "prod" builds might have issues. |
| 46 | +
|
| 47 | + Target devices: waveshare-esp32-s3-touch-lcd-2 and fri3d-2024 |
| 48 | + |
| 49 | + Examples: |
31 | 50 |
|
| 51 | + <pre> |
32 | 52 | ``` |
33 | | - ./scripts/build_lvgl_micropython.sh macOS dev |
| 53 | + ./scripts/build_lvgl_micropython.sh esp32 prod fri3d-2024 |
| 54 | + ./scripts/build_lvgl_micropython.sh esp32 dev waveshare-esp32-s3-touch-lcd-2 |
| 55 | + ./scripts/build_lvgl_micropython.sh esp32 unix dev |
| 56 | + ./scripts/build_lvgl_micropython.sh esp32 macOS dev |
34 | 57 | ``` |
| 58 | + </pre> |
| 59 | +
|
| 60 | + The resulting build file will be in `lvgl_micropython/build/`, for example: |
| 61 | + - lvgl_micropython/build/lvgl_micropy_unix |
| 62 | + - lvgl_micropython/build/lvgl_micropy_macOS |
| 63 | + - lvgl_micropython/build/lvgl_micropy_ESP32_GENERIC_S3-SPIRAM_OCT-16.bin |
35 | 64 |
|
36 | | -## Running on Desktop |
| 65 | +## Running on Linux |
37 | 66 |
|
38 | | -1. Download a release (e.g., `MicroPythonOS_amd64_Linux`) or use your build. |
| 67 | +1. Download a release binary (e.g., `MicroPythonOS_amd64_Linux`) or use your own build from above. |
39 | 68 | 2. Run the application: |
40 | 69 |
|
41 | 70 | <pre> |
42 | 71 | ``` |
43 | | - cd internal_filesystem/ |
44 | | - /path/to/MicroPythonOS_amd64_Linux -X heapsize=32M -v -i -c "$(cat boot_unix.py main.py)" |
| 72 | + ./scripts/run_desktop.sh |
45 | 73 | ``` |
46 | 74 | </pre> |
47 | 75 |
|
48 | | -3. Check `scripts/run_desktop.sh` for options like fullscreen or direct app launch. |
| 76 | +### Modifying files |
| 77 | +
|
| 78 | +You'll notice that, whenever you change a file on your local system, the changes are immediately visible whenever you reload the file. |
49 | 79 |
|
50 | | -## Notes |
| 80 | +This results in a very quick coding cycle. |
51 | 81 |
|
52 | | -- Linux is fully supported; MacOS support is experimental. |
53 | | -- See [Supported Hardware](../getting-started/supported-hardware.md) for platform details. |
| 82 | +Give this a try by editing `internal_filesystem/builtin/apps/com.micropythonos.about/assets/about.py` and then restarting the "About" app. Powerful stuff! |
0 commit comments