diff options
| author | Peter Kjellerstedt <pkj@axis.com> | 2025-10-25 05:17:44 +0200 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2025-10-24 20:41:20 -0700 |
| commit | 1c1c5c5633663565eb9683dd2517a5fb55aa4b30 (patch) | |
| tree | 927328be189b89656df5eb729b76221eb2746546 | |
| parent | 9c201b0f8550870f6f586a604395ba30a8c42753 (diff) | |
| download | meta-openembedded-1c1c5c5633663565eb9683dd2517a5fb55aa4b30.tar.gz | |
lvgl: Use Kconfig to configure
This switches the recipe from manipulating the lv_conf.h file directly,
to instead using Kconfig to configure lvgl.
* Drop configuration of LV_TICK_CUSTOM* as they were removed in 9.0.0.
* Drop configuration options that match their defaults.
Co-authored-by: Adam x Nilsson <adam.x.nilsson@axis.com>
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-graphics/lvgl/files/debug.cfg | 3 | ||||
| -rw-r--r-- | meta-oe/recipes-graphics/lvgl/files/defconfig | 1 | ||||
| -rw-r--r-- | meta-oe/recipes-graphics/lvgl/files/drm.cfg | 2 | ||||
| -rw-r--r-- | meta-oe/recipes-graphics/lvgl/files/fbdev.cfg | 2 | ||||
| -rw-r--r-- | meta-oe/recipes-graphics/lvgl/files/gridnav.cfg | 1 | ||||
| -rw-r--r-- | meta-oe/recipes-graphics/lvgl/files/sdl.cfg | 3 | ||||
| -rw-r--r-- | meta-oe/recipes-graphics/lvgl/files/thorvg.cfg | 3 | ||||
| -rw-r--r-- | meta-oe/recipes-graphics/lvgl/lv-conf.inc | 106 |
8 files changed, 41 insertions, 80 deletions
diff --git a/meta-oe/recipes-graphics/lvgl/files/debug.cfg b/meta-oe/recipes-graphics/lvgl/files/debug.cfg new file mode 100644 index 0000000000..022375d4ae --- /dev/null +++ b/meta-oe/recipes-graphics/lvgl/files/debug.cfg | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | CONFIG_LV_USE_ASSERT_STYLE=y | ||
| 2 | CONFIG_LV_USE_ASSERT_MEM_INTEGRITY=y | ||
| 3 | CONFIG_LV_USE_ASSERT_OBJ=y | ||
diff --git a/meta-oe/recipes-graphics/lvgl/files/defconfig b/meta-oe/recipes-graphics/lvgl/files/defconfig new file mode 100644 index 0000000000..1f42f11f7a --- /dev/null +++ b/meta-oe/recipes-graphics/lvgl/files/defconfig | |||
| @@ -0,0 +1 @@ | |||
| CONFIG_LV_COLOR_DEPTH_32=y | |||
diff --git a/meta-oe/recipes-graphics/lvgl/files/drm.cfg b/meta-oe/recipes-graphics/lvgl/files/drm.cfg new file mode 100644 index 0000000000..c2387087f2 --- /dev/null +++ b/meta-oe/recipes-graphics/lvgl/files/drm.cfg | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | CONFIG_LV_USE_LINUX_DRM=y | ||
| 2 | CONFIG_LV_USE_EVDEV=y | ||
diff --git a/meta-oe/recipes-graphics/lvgl/files/fbdev.cfg b/meta-oe/recipes-graphics/lvgl/files/fbdev.cfg new file mode 100644 index 0000000000..4ba7f8f5ad --- /dev/null +++ b/meta-oe/recipes-graphics/lvgl/files/fbdev.cfg | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | CONFIG_LV_USE_LINUX_FBDEV=y | ||
| 2 | CONFIG_LV_USE_EVDEV=y | ||
diff --git a/meta-oe/recipes-graphics/lvgl/files/gridnav.cfg b/meta-oe/recipes-graphics/lvgl/files/gridnav.cfg new file mode 100644 index 0000000000..02b80c3e57 --- /dev/null +++ b/meta-oe/recipes-graphics/lvgl/files/gridnav.cfg | |||
| @@ -0,0 +1 @@ | |||
| CONFIG_LV_USE_GRIDNAV=y | |||
diff --git a/meta-oe/recipes-graphics/lvgl/files/sdl.cfg b/meta-oe/recipes-graphics/lvgl/files/sdl.cfg new file mode 100644 index 0000000000..3ba28d7b01 --- /dev/null +++ b/meta-oe/recipes-graphics/lvgl/files/sdl.cfg | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | CONFIG_LV_USE_DRAW_SDL=y | ||
| 2 | CONFIG_LV_USE_SDL=y | ||
| 3 | CONFIG_LV_SDL_DOUBLE_BUFFER=y | ||
diff --git a/meta-oe/recipes-graphics/lvgl/files/thorvg.cfg b/meta-oe/recipes-graphics/lvgl/files/thorvg.cfg new file mode 100644 index 0000000000..4dbffdfe09 --- /dev/null +++ b/meta-oe/recipes-graphics/lvgl/files/thorvg.cfg | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | CONFIG_LV_USE_VECTOR_GRAPHIC=y | ||
| 2 | CONFIG_LV_USE_LOTTIE=y | ||
| 3 | CONFIG_LV_USE_THORVG=y | ||
diff --git a/meta-oe/recipes-graphics/lvgl/lv-conf.inc b/meta-oe/recipes-graphics/lvgl/lv-conf.inc index 7c16eb3936..ab3ad01a5a 100644 --- a/meta-oe/recipes-graphics/lvgl/lv-conf.inc +++ b/meta-oe/recipes-graphics/lvgl/lv-conf.inc | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | # SPDX-FileCopyrightText: Axis Communication AB <https://www.axis.com/> | ||
| 2 | # SPDX-License-Identifier: MIT | ||
| 3 | |||
| 4 | DEPENDS += "python3-kconfiglib-native python3-pcpp-native" | ||
| 5 | |||
| 6 | SRC_URI += " \ | ||
| 7 | file://defconfig \ | ||
| 8 | ${@oe.utils.vartrue('DEBUG_BUILD', 'file://debug.cfg', '', d)} \ | ||
| 9 | ${@bb.utils.contains('PACKAGECONFIG', 'drm', 'file://drm.cfg', '', d)} \ | ||
| 10 | ${@bb.utils.contains('PACKAGECONFIG', 'fbdev', 'file://fbdev.cfg', '', d)} \ | ||
| 11 | ${@bb.utils.contains('PACKAGECONFIG', 'gridnav', 'file://gridnav.cfg', '', d)} \ | ||
| 12 | ${@bb.utils.contains('PACKAGECONFIG', 'sdl', 'file://sdl.cfg', '', d)} \ | ||
| 13 | ${@bb.utils.contains('PACKAGECONFIG', 'thorvg', 'file://thorvg.cfg', '', d)} \ | ||
| 14 | " | ||
| 15 | |||
| 1 | PACKAGECONFIG ??= "drm" | 16 | PACKAGECONFIG ??= "drm" |
| 2 | 17 | ||
| 3 | PACKAGECONFIG[drm] = ",,libdrm libevdev" | 18 | PACKAGECONFIG[drm] = ",,libdrm libevdev" |
| @@ -6,6 +21,10 @@ PACKAGECONFIG[gridnav] = ",," | |||
| 6 | PACKAGECONFIG[thorvg] = ",," | 21 | PACKAGECONFIG[thorvg] = ",," |
| 7 | PACKAGECONFIG[sdl] = ",,virtual/libsdl2 libsdl2-image" | 22 | PACKAGECONFIG[sdl] = ",,virtual/libsdl2 libsdl2-image" |
| 8 | 23 | ||
| 24 | inherit python3native | ||
| 25 | |||
| 26 | EXTRA_OECMAKE += "-DLV_BUILD_USE_KCONFIG=ON" | ||
| 27 | |||
| 9 | # Add libdrm include if drm is selected in PACKAGECONFIG | 28 | # Add libdrm include if drm is selected in PACKAGECONFIG |
| 10 | LVGL_FLAGS += " \ | 29 | LVGL_FLAGS += " \ |
| 11 | ${@bb.utils.contains('PACKAGECONFIG', 'drm', '-I${STAGING_INCDIR}/libdrm', '', d)} \ | 30 | ${@bb.utils.contains('PACKAGECONFIG', 'drm', '-I${STAGING_INCDIR}/libdrm', '', d)} \ |
| @@ -13,86 +32,13 @@ LVGL_FLAGS += " \ | |||
| 13 | CFLAGS += "${LVGL_FLAGS}" | 32 | CFLAGS += "${LVGL_FLAGS}" |
| 14 | CXXFLAGS += "${LVGL_FLAGS}" | 33 | CXXFLAGS += "${LVGL_FLAGS}" |
| 15 | 34 | ||
| 16 | LVGL_CONFIG_USE_DRM = "${@bb.utils.contains('PACKAGECONFIG', 'drm', '1', '0', d)}" | 35 | KCONFIG_CONFIG_ROOTDIR ?= "${S}" |
| 17 | 36 | KCONFIG_FILE ?= "${KCONFIG_CONFIG_ROOTDIR}/Kconfig" | |
| 18 | LVGL_CONFIG_USE_EVDEV = "${@bb.utils.contains_any('PACKAGECONFIG', 'drm fbdev', '1', '0', d)}" | 37 | export KCONFIG_CONFIG ?= "${KCONFIG_CONFIG_ROOTDIR}/.config" |
| 19 | |||
| 20 | LVGL_CONFIG_USE_FBDEV = "${@bb.utils.contains('PACKAGECONFIG', 'fbdev', '1', '0', d)}" | ||
| 21 | |||
| 22 | LVGL_CONFIG_USE_SDL = "${@bb.utils.contains('PACKAGECONFIG', 'sdl', '1', '0', d)}" | ||
| 23 | |||
| 24 | LVGL_CONFIG_SDL_FULLSCREEN ?= "0" | ||
| 25 | |||
| 26 | LVGL_CONFIG_LV_MEM_CUSTOM ?= "0" | ||
| 27 | LVGL_CONFIG_LV_MEM_SIZE ?= "(64 * 1024U)" | ||
| 28 | LVGL_CONFIG_LV_COLOR_DEPTH ?= "32" | ||
| 29 | |||
| 30 | LVGL_CONFIG_LV_USE_LOG ?= "0" | ||
| 31 | LVGL_CONFIG_LV_LOG_LEVEL ?= "LV_LOG_LEVEL_WARN" | ||
| 32 | LVGL_CONFIG_LV_LOG_PRINTF ?= "0" | ||
| 33 | |||
| 34 | LVGL_CONFIG_LV_USE_FONT_COMPRESSED ?= "0" | ||
| 35 | |||
| 36 | LVGL_CONFIG_LV_USE_GRIDNAV = "${@bb.utils.contains('PACKAGECONFIG', 'gridnav', '1', '0', d)}" | ||
| 37 | |||
| 38 | LVGL_CONFIG_LV_THEME_DEFAULT_DARK ?= "0" | ||
| 39 | |||
| 40 | LVGL_CONFIG_USE_LOTTIE = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}" | ||
| 41 | |||
| 42 | LVGL_CONFIG_USE_VECTOR_GRAPHICS = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}" | ||
| 43 | |||
| 44 | LVGL_CONFIG_USE_THORVG_INTERNAL = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}" | ||
| 45 | |||
| 46 | LVGL_CONFIG_USE_MATRIX = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}" | ||
| 47 | |||
| 48 | LVGL_CONFIG_USE_FLOAT = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}" | ||
| 49 | |||
| 50 | DEBUG_BUILD ??= "0" | ||
| 51 | 38 | ||
| 52 | do_configure:prepend() { | 39 | do_configure() { |
| 53 | # If there is a configuration template, start from that | 40 | cat ${UNPACKDIR}/defconfig ${@" ".join(find_cfgs(d))} > ${B}/defconfig |
| 54 | [ -r "${S}/lv_conf_template.h" ] && cp -Lv "${S}/lv_conf_template.h" "${S}/lv_conf.h" | 41 | defconfig --kconfig ${KCONFIG_FILE} ${B}/defconfig |
| 55 | 42 | ||
| 56 | sed -r -e "s|#if 0 .*Set it to \"1\" to enable content.*|#if 1 // Enabled by ${PN}|" \ | 43 | cmake_do_configure |
| 57 | \ | ||
| 58 | -e "s|^([[:space:]]*#define LV_USE_LINUX_DRM[[:space:]]).*|\1${LVGL_CONFIG_USE_DRM}|" \ | ||
| 59 | \ | ||
| 60 | -e "s|^([[:space:]]*#define LV_USE_LINUX_FBDEV[[:space:]]).*|\1${LVGL_CONFIG_USE_FBDEV}|" \ | ||
| 61 | \ | ||
| 62 | -e "s|^([[:space:]]*#define LV_USE_SDL[[:space:]]).*|\1${LVGL_CONFIG_USE_SDL}|" \ | ||
| 63 | -e "s|^([[:space:]]*#define LV_USE_DRAW_SDL[[:space:]]).*|\1${LVGL_CONFIG_USE_SDL}|" \ | ||
| 64 | -e "s|^([[:space:]]*#define LV_SDL_BUF_COUNT[[:space:]]).*|\1 2|" \ | ||
| 65 | -e "s|^([[:space:]]*#define LV_SDL_FULLSCREEN[[:space:]]).*|\1${LVGL_CONFIG_SDL_FULLSCREEN}|" \ | ||
| 66 | \ | ||
| 67 | -e "s|^([[:space:]]*#define LV_COLOR_DEPTH[[:space:]]).*|\1${LVGL_CONFIG_LV_COLOR_DEPTH}|" \ | ||
| 68 | -e "s|^([[:space:]]*#define LV_MEM_CUSTOM[[:space:]]).*|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|" \ | ||
| 69 | -e "s|^([[:space:]]*#define LV_MEM_SIZE[[:space:]]).*|\1${LVGL_CONFIG_LV_MEM_SIZE}|" \ | ||
| 70 | \ | ||
| 71 | -e "s|^([[:space:]]*#define LV_TICK_CUSTOM[[:space:]]).*|\1 1|" \ | ||
| 72 | -e "s|^([[:space:]]*#define LV_TICK_CUSTOM_INCLUDE[[:space:]]).*|\1 <stdint.h>|" \ | ||
| 73 | -e "s|^([[:space:]]*#define LV_TICK_CUSTOM_SYS_TIME_EXPR[[:space:]]).*|extern uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|" \ | ||
| 74 | \ | ||
| 75 | -e "s|^([[:space:]]*#define LV_USE_EVDEV[[:space:]]).*|\1${LVGL_CONFIG_USE_EVDEV}|" \ | ||
| 76 | \ | ||
| 77 | -e "s|^([[:space:]]*#define LV_USE_ASSERT_NULL[[:space:]]).*|\1${DEBUG_BUILD}|" \ | ||
| 78 | -e "s|^([[:space:]]*#define LV_USE_ASSERT_MALLOC[[:space:]]).*|\1${DEBUG_BUILD}|" \ | ||
| 79 | -e "s|^([[:space:]]*#define LV_USE_ASSERT_STYLE[[:space:]]).*|\1${DEBUG_BUILD}|" \ | ||
| 80 | -e "s|^([[:space:]]*#define LV_USE_ASSERT_MEM_INTEGRITY[[:space:]]).*|\1${DEBUG_BUILD}|" \ | ||
| 81 | -e "s|^([[:space:]]*#define LV_USE_ASSERT_OBJ[[:space:]]).*|\1${DEBUG_BUILD}|" \ | ||
| 82 | \ | ||
| 83 | -e "s|^([[:space:]]*#define LV_USE_LOG[[:space:]]).*|\1${LVGL_CONFIG_LV_USE_LOG}|" \ | ||
| 84 | -e "s|^([[:space:]]*#define LV_LOG_LEVEL[[:space:]]).*|\1${LVGL_CONFIG_LV_LOG_LEVEL}|" \ | ||
| 85 | -e "s|^([[:space:]]*#define LV_LOG_PRINTF[[:space:]]).*|\1${LVGL_CONFIG_LV_LOG_PRINTF}|" \ | ||
| 86 | \ | ||
| 87 | -e "s|^([[:space:]]*#define LV_USE_FONT_COMPRESSED[[:space:]]).*|\1${LVGL_CONFIG_LV_USE_FONT_COMPRESSED}|" \ | ||
| 88 | -e "s|^([[:space:]]*#define LV_USE_GRIDNAV[[:space:]]).*|\1${LVGL_CONFIG_LV_USE_GRIDNAV}|" \ | ||
| 89 | -e "s|^([[:space:]]*#define LV_THEME_DEFAULT_DARK[[:space:]]).*|\1${LVGL_CONFIG_LV_THEME_DEFAULT_DARK}|" \ | ||
| 90 | \ | ||
| 91 | -e "s|^([[:space:]]*#define LV_USE_VECTOR_GRAPHIC[[:space:]]).*|\1${LVGL_CONFIG_USE_VECTOR_GRAPHICS}|" \ | ||
| 92 | -e "s|^([[:space:]]*#define LV_USE_THORVG_INTERNAL[[:space:]]).*|\1${LVGL_CONFIG_USE_THORVG_INTERNAL}|" \ | ||
| 93 | -e "s|^([[:space:]]*#define LV_USE_MATRIX[[:space:]]).*|\1${LVGL_CONFIG_USE_MATRIX}|" \ | ||
| 94 | -e "s|^([[:space:]]*#define LV_USE_FLOAT[[:space:]]).*|\1${LVGL_CONFIG_USE_FLOAT}|" \ | ||
| 95 | \ | ||
| 96 | -e "s|^([[:space:]]*#define LV_USE_LOTTIE[[:space:]]).*|\1${LVGL_CONFIG_USE_LOTTIE}|" \ | ||
| 97 | -i "${S}/lv_conf.h" | ||
| 98 | } | 44 | } |
