compile_lvgl.sh¶
Downloads and compiles LVGL v9.2 into a static library for the kernel.
Overview¶
compile_lvgl.sh clones the LVGL graphics library source, cross-compiles every C source file to 32-bit freestanding ELF objects, and archives them into lib/liblvgl.a. It also compiles any custom Asuro-specific LVGL extension files found in lvglh/. A caching mechanism on the host-mounted /code/lvgl/ directory allows subsequent builds to skip the entire compilation.
Prerequisites¶
git,gcc,ar, and standard POSIX utilities must be available.- The
lvglh/directory must contain anlv_conf.hconfiguration header (and optionally custom.cfiles). - The
lib/output directory must exist.
Inputs¶
| Source | Description |
|---|---|
| LVGL Git repository | Cloned from https://github.com/lvgl/lvgl.git at tag v9.2.2. |
lvglh/ |
Project-local directory containing lv_conf.h and optional custom C source files. |
/code/lvgl/liblvgl.a |
Optional cached artifact from a previous build (host mount). |
Outputs¶
| File | Description |
|---|---|
lib/liblvgl.a |
Static archive containing all compiled LVGL and custom extension objects. |
/code/lvgl/ |
Cached copy of the static library, LVGL source, and object files for future builds. |
Behavior¶
- Cache check: If
/code/lvgl/liblvgl.aexists, copies it tolib/and exits immediately. - Clone: Shallow-clones the LVGL repository at the specified version tag into
/tmp/lvgl. - Discover sources: Finds all
.cfiles under the LVGLsrc/directory, excluding test files. - Compile: Compiles each source file with GCC using the following key flags:
-m32 -march=i686-- 32-bit i686 target.-ffreestanding -fno-builtin -fno-stack-protector -fno-pic -fno-pie-- Bare-metal environment.-O2-- Optimization level 2.-DLV_CONF_INCLUDE_SIMPLE-- Tells LVGL to includelv_conf.hvia a simple path.- Include paths for
lvglh/and the LVGL source tree. - Archive: Collects all
.ofiles intolib/liblvgl.ausingar rcs. - Custom extensions: If
lvglh/contains.cfiles, compiles them with the same flags and appends the resulting objects toliblvgl.a. - Cache write: Copies the static library, source, and objects to
/code/lvgl/on the host mount for future builds.
Progress is reported every 50 files. The script aborts with exit code 1 if any compilation errors occur.
Notes¶
- All intermediate work (clone, object files) happens in
/tmpfor speed on container-local filesystems. - The cache lives on the host mount at
/code/lvgl/. Deletinglvgl/liblvgl.afrom the project root forces a full rebuild. - The static library is linked into the kernel by
compile_link.shusing--start-group/--end-groupalongsidelibgcc.