@Fabio_Estevam thanks for sharing your experiences. Running a build here to see if I can duplicate your issues.
I made some progress and now I can add lvgl-demo-fb into IMAGE_INSTALL.
Here is the recipe that I am using now:
# Copyright (C) 2022 Cliff Brake <cbrake@bec-systems.com>
FILESEXTRAPATHS:append := "${THISDIR}/files:"
SUMMARY = "LVGL Demo Application for Framebuffer"
HOMEPAGE = "https://github.com/lvgl/lv_port_linux_frame_buffer"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=802d3d83ae80ef5f343050bf96cce3a4 \
file://lv_drivers/LICENSE;md5=d6fc0df890c5270ef045981b516bb8f2 \
file://lvgl/LICENCE.txt;md5=bf1198c89ae87f043108cea62460b03a"
SRC_URI = "gitsm://github.com/lvgl/lv_port_linux_frame_buffer.git;branch=master;protocol=https"
SRC_URI += "file://0001-improvemakefile.patch"
SRCREV = "a2384b74cec9ffd7407d12ed64a8326b5696f309"
S = "${WORKDIR}/git"
EXTRA_OEMAKE = "DESTDIR=${D}"
do_install() {
oe_runmake install
}
and the lv_port_linux_frame_buffer patch is
From 5462a44c91e1605a73c98ea689ce0c6824f6460e Mon Sep 17 00:00:00 2001
From: Fabio Estevam <festevam@denx.de>
Date: Fri, 13 Jan 2023 14:38:57 -0300
Subject: [PATCH] lvgl_fb: Add a Makefile
Add a Makefile to make installation and uninstallation
process easier.
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
Makefile | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Makefile b/Makefile
index ba6972b..c05746d 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,8 @@ CFLAGS ?= -O3 -g0 -I$(LVGL_DIR)/ -Wall -Wshadow -Wundef -Wmissing-prototypes -Wn
LDFLAGS ?= -lm
BIN = demo
+prefix ?= /usr
+bindir ?= $(prefix)/bin
#Collect the files to compile
MAINSRC = ./main.c
@@ -41,3 +43,9 @@ default: $(AOBJS) $(COBJS) $(MAINOBJ)
clean:
rm -f $(BIN) $(AOBJS) $(COBJS) $(MAINOBJ)
+install:
+ install -d $(DESTDIR)$(bindir)
+ install $(BIN) $(DESTDIR)$(bindir)
+
+uninstall:
+ $(RM) -r $(addprefix $(DESTDIR)$(bindir)/,$(BIN))
--
2.25.1
The rootfs/usr/bin/demo binary is getting installed.
I don’t have my board at the moment to try a run-time test.
Thanks
Running the “demo” binary shows the LVGL application successfully on the display ![]()
Also, sent the Makefile improvement patch:
Nice work @Fabio_Estevam – thanks for sharing!
@Fabio_Estevam
I am new to yocto and tried adding this as a meta-lvgl-demo layer and build it. After building i do not see any image inside the temp folder.
I am trying to build this on imx8mp SOM by engicam.
Can you provide some elaborated steps on how to run this?
You’ll need to add the lvgl-demo package to the image you are building. You can create a custom image or do something like:
IMAGE_INSTALL:append = " lvgl-demo-fb"
Then bitbake one of the demo images.
There is no need to add a meta-lvgl-demo layer.
The lvgl-demo-fb recipe has been accepted in meta-openembedded. Please take a look:
You need to include it in your image just like @cbrake pointed out.
You may also need to adapt LVGL_CONFIG_WAYLAND_HOR_RES, LVGL_CONFIG_WAYLAND_VER_RES , and LVGL_CONFIG_LV_COLOR_DEPTH as per your display.
Thankyou @Fabio_Estevam and @cbrake
I was able to compile it with your instructions. Now when i try to run it, i get below error
root@imx8mp-icore:/dev# cd /usr/bin
root@imx8mp-icore:/usr/bin# ./lvgl_fb
error: drmGetCap DRM_CAP_DUMB_BUFFER failed or “/dev/dri/card0” doesn’t have dumb buffer
unable to open evdev interface:: No such file or directory
You need to select one of the lvgl backends: drm, fbdev, sdl or wayland.
This can be done via PACKAGECONFIG.
It seems that it is trying to use drm in your case. Please make sure that /dev/dri/card0 is the correct rendering card. Maybe there are card1/card2 on your setup?
If you are running weston, try stopping weston first.
@Fabio_Estevam this is my current config for lvgl-demo-fb_8.3.0.bb
SUMMARY = "LVGL Demo Application for Framebuffer"
HOMEPAGE = "https://github.com/lvgl/lv_port_linux_frame_buffer"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=802d3d83ae80ef5f343050bf96cce3a4 \
file://lv_drivers/LICENSE;md5=d6fc0df890c5270ef045981b516bb8f2 \
file://lvgl/LICENCE.txt;md5=bf1198c89ae87f043108cea62460b03a"
SRC_URI = "gitsm://github.com/lvgl/lv_port_linux_frame_buffer.git;branch=master;protocol=https"
SRCREV = "adf2c4490e17a1b9ec1902cc412a24b3b8235c8e"
EXTRA_OEMAKE = "DESTDIR=${D}"
PACKAGECONFIG ??= "drm"
require lv-drivers.inc
inherit cmake
S = "${WORKDIR}/git"
TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm"
do_configure:prepend() {
if [ "${LVGL_CONFIG_USE_DRM}" -eq 1 ] ; then
# Add libdrm build dependency
sed -i '/^target_link_libraries/ s@lvgl::drivers@& drm@' "${S}/CMakeLists.txt"
# Switch from fbdev to drm usage
sed -i 's@fbdev@drm@g' "${S}/main.c"
# Pull resolution from DRM instead of hardcoding it
sed -i '/disp_drv.hor_res/ d' "${S}/main.c"
sed -i '/disp_drv.ver_res/ s@disp_drv.ver_res.*@drm_get_sizes(\&disp_drv.hor_res, \&disp_drv.ver_res, NULL);@' "${S}/main.c"
fi
if [ "${LVGL_CONFIG_USE_SDL}" -eq 1 ] ; then
# Add libsdl build dependency
sed -i '/^target_link_libraries/ s@lvgl::drivers@& SDL2@' "${S}/CMakeLists.txt"
# Switch from fbdev to sdl usage
sed -i 's@fbdev_flush@sdl_display_flush@g' "${S}/main.c"
sed -i 's@lv_drivers/display/fbdev.h@lv_drivers/sdl/sdl.h@g' "${S}/main.c"
sed -i 's@fbdev@sdl@g' "${S}/main.c"
fi
}
do_install:append() {
install -d ${D}${bindir}
install -m 0755 ${B}/lvgl_fb ${D}${bindir}/
}
i will try to change PACKAGECONFIG ??= “drm” to PACKAGECONFIG ??= “wayland”
The new LVGL v9.2 release has some interesting new features including Wayland and OpenGL ES drivers:
v9.2 26 August 2024
It’s huge release with many interesting updates:
- Built-in Wayland driver
- OpenGL ES and GLFW driver with support for external textures
- Renesas GLCDC driver
- L8 and I1 rendering support
- Matrix transformations during rendering
- New file system interfaces: LittleFS, ESP LittleFS, Arduino FS
- SDL renderer improvements (supporting all draw task types and improving speed)
- Radial, Conic, and Skew gradients supported by software rendering and VG-Lite
- QNX and MQX support
- Mouse hover handling
- Lottie support
- CI tests for UEFI builds
I’ve started learning Yocto and LVGL last month and hit an issue I can’t seem to overcome. So, I might just be not understanding some core concept correctly.
I’m building an image for the Variscite VAR-SOM-SOLO following these instructions: https://dev.variscite.com/var-som-solo-dual/mx6-yocto-scarthgap-6.6.23_2.0.0-v1.0/yocto-build-release/
I then go to this set of instructions, skipping the initial yocto setup: LVGL in Yocto - LVGL 9.4 documentation
I get to the point that I add :
IMAGE_INSTALL:append = " lvgl"
TOOLCHAIN_HOST_TASK:append = " lvgl"
Then run: bitbake core-image-base
And everything builds.
I then try to make the sdk:
bitbake core-image-base -c populate_sdk
And it fails out with:
Initialising tasks: 100% |#######################################################################################################################################| Time: 0:00:05
NOTE: Executing Tasks
WARNING: help2man-native-1.49.3-r0 do_fetch: Failed to fetch URL https: // ftp. gnu. org /gnu/help2man/help2man-1.49.3.tar.xz, attempting MIRRORS if available
ERROR: fsl-image-gui-1.0-r0 do_populate_sdk: Unable to install packages. Command ‘/workdir/build_fb/tmp/work/var_som_mx6-poky-linux-gnueabi/fsl-image-gui/1.0/recipe-sysroot-native/usr/bin/apt-get install --allow-downgrades --allow-remove-essential --allow-change-held-packages --allow-unauthenticated --no-remove lvgl nativesdk-packagegroup-sdk-host packagegroup-cross-canadian-var-som-mx6’ returned 100:
Reading package lists…
Building dependency tree…
Reading state information…
E: Unable to locate package lvgl
ERROR: Logfile of failure stored in: /workdir/build_fb/tmp/work/var_som_mx6-poky-linux-gnueabi/fsl-image-gui/1.0/temp/log.do_populate_sdk.1304570
ERROR: Task (/workdir/sources/meta-variscite-sdk-imx/recipes-fsl/images/fsl-image-gui.bb:do_populate_sdk) failed with exit code ‘1’
NOTE: Tasks Summary: Attempted 10953 tasks of which 9034 didn’t need to be rerun and 1 failed.
Summary: 1 task failed:
/workdir/sources/meta-variscite-sdk-imx/recipes-fsl/images/fsl-image-gui.bb:do_populate_sdk
Summary: There was 1 WARNING message.
Summary: There was 1 ERROR message, returning a non-zero exit code.
I check the /tmp/deploy/cortexa9t2hf-neon folder and lvgl_9.1.0-r0_armhf.deb is sitting there.
I’ve been reading the Mastering Embedded Systems with Yocto 4th Ed book and trying to figure out what is going on. To add, I also just try to do the lvgl. ioinstructions from scratch and got a whole different pile of errors.
Is there some concept I’m not getting right or some documentation that wasn’t updated due to a change in the way the tools work?
Hi @John_Goewert! Welcome to TMPDIR.
I’ve not tried to include lvgl in a SDK yet, but if there is a lvgl-dev package, you might try this:
TOOLCHAIN_TARGET_TASK:append = " lvgl-dev"
Let us know what you find.
Ah! TOOLCHAIN_TARGET_TASK vs TOOLCHAIN_HOST_TASK and a mysterious “lvgl-dev” package that doesn’t exist in any Google, Bing, or DuckDuckGo search.
That was the secret sauce. Thank you very much.
I’m going to be a little verbose here because something is telling me this is going to be the top post when someone searches for “lvgl-dev” or “lvgl yocto” in the future.
I made and installed the sdk and /opt/fsl-imx-fb/6.6-scarthgap/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi/usr/include/lvgl (the SDK directory), is there and contains what looks like a full lvgl lib set with the lv_conf.h file which I think may actually be configuring itself from the lv_conf.inc file from sources/meta-openembedded/meta-oe/graphics/lvgl.
Now that I know that TOOLCHAIN_*_TASK means, I can’t understand why lvgl’s documentation on building for Embedded Yocto is completely wrong. Their instructions are for building for a Raspberry Pi on a separate PC Linux system It isn’t like TOOLCHAIN_TARGET_TASK is new. I can’t see that their instructions would have ever worked.
I did google to see if there is anything on “lvgl-dev” but like I said at the top. Nothing on any search engine. I saw that package sitting there in /tmp/deploy and wondered what it was, but since it wasn’t documented, I figured it was some sort of add-in for the lvgl package.
I was able to build and run the lvglsim demo on my SOM + custom FrameBuffer display.
I’m now going to try and use the generated sdk to build my test app.
Great progress – glad it worked!
Thanks for the detailed reply.
