1
0

6 Коммиты ec610e2baf ... 00162ef153

Автор SHA1 Сообщение Дата
  Stefano Babic 00162ef153 swupdategui-rs: bump to de64c91 2 дней назад
  Stefano Babic 17044b52f5 initscripts-swupdate-usb: fix S on scarthgap 2 дней назад
  Stefano Babic 98c7616e00 swupdate-gui: use WORKDIR on scarthgap 2 дней назад
  Stefano Babic 90c4d8c17f swupdategui-rs: build on scarthgap 2 дней назад
  Stefano Babic 37dc4bda27 lvgl: set the C library allocator in lv_conf.h 2 дней назад
  Stefano Babic 647ecf3841 lvgl: add 9.2.2 for scarthgap 2 дней назад

+ 13 - 0
README

@@ -12,6 +12,19 @@ This layer depends on:
 URI: git://github.com/openembedded/meta-openembedded.git
 subdirectory: meta-oe
 
+Recovery GUI in Rust (swupdategui-rs)
+-------------------------------------
+
+swupdategui-rs needs more than scarthgap provides:
+
+* Rust >= 1.77 (scarthgap ships 1.75), for example from
+  URI: https://git.yoctoproject.org/meta-lts-mixins
+  branch: scarthgap/rust
+* clang-native, from
+  URI: https://github.com/kraj/meta-clang
+  branch: scarthgap
+* LVGL >= 9.2: this layer provides LVGL 9.2.2
+
 Documentation for the layer
 ---------------------------
 

+ 1 - 2
recipes-core/initscripts-swupdate/initscripts-swupdate-usb.bb

@@ -7,8 +7,7 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda
 SRC_URI = "file://rcS.swupdate \
 	"
 
-S = "${WORKDIR}/sources"
-UNPACKDIR = "${S}"
+S = "${WORKDIR}"
 
 inherit allarch update-alternatives
 

+ 32 - 0
recipes-graphics/lvgl/files/0001-thorvg-fix-build-with-gcc-15.patch

@@ -0,0 +1,32 @@
+From a9e41f7e9590c757e74877cace6442dd676223ff Mon Sep 17 00:00:00 2001
+From: Martin Jansa <martin.jansa@gmail.com>
+Date: Fri, 21 Mar 2025 10:25:43 +0000
+Subject: [PATCH] thorvg: fix build with gcc-15
+
+* add missing include to fix:
+  src/libs/thorvg/thorvg.h:357:20: error: 'uint8_t' has not been declared
+  357 |     Result opacity(uint8_t o) noexcept;
+      |                    ^~~~~~~
+
+* not needed with latest master where it was resolved differently in
+  fc5c15638 feat(thorvg): use LVGL's malloc/realloc/zalloc/free (#7772)
+  which includes stdlib/lv_string.h which includes misc/lv_types.h which
+  includes stdint
+
+Upstream-Status: Pending [not needed with latest master where it was resolved differently in fc5c15638 feat(thorvg): use LVGL's malloc/realloc/zalloc/free (#7772)]
+
+Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
+---
+ src/libs/thorvg/thorvg.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/src/libs/thorvg/thorvg.h
++++ b/src/libs/thorvg/thorvg.h
+@@ -12,6 +12,7 @@
+ #define TVG_BUILD 1
+ 
+ 
++#include <cstdint>
+ #include <functional>
+ #include <memory>
+ #include <string>

+ 0 - 4
recipes-graphics/lvgl/files/clib-malloc.cfg

@@ -1,4 +0,0 @@
-# Use the C library allocator instead of LVGL's builtin pool. The builtin
-# pool has a fixed size (64 KB by default) and running out of it ends in
-# LV_ASSERT_HANDLER (while(1)): the recovery GUI hangs at 100% CPU.
-CONFIG_LV_USE_CLIB_MALLOC=y

+ 98 - 0
recipes-graphics/lvgl/lv-conf.inc

@@ -0,0 +1,98 @@
+PACKAGECONFIG ??= "drm"
+
+PACKAGECONFIG[drm] = ",,libdrm"
+PACKAGECONFIG[fbdev] = ",,"
+PACKAGECONFIG[gridnav] = ",,"
+PACKAGECONFIG[thorvg] = ",,"
+PACKAGECONFIG[sdl] = ",,virtual/libsdl2 libsdl2-image"
+
+# Add libdrm include if drm is selected in PACKAGECONFIG
+TARGET_CFLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'drm', '-I${STAGING_INCDIR}/libdrm', '', d)}"
+
+LVGL_CONFIG_USE_DRM = "${@bb.utils.contains('PACKAGECONFIG', 'drm', '1', '0', d)}"
+
+LVGL_CONFIG_USE_EVDEV = "${@bb.utils.contains_any('PACKAGECONFIG', 'drm fbdev', '1', '0', d)}"
+
+LVGL_CONFIG_USE_FBDEV = "${@bb.utils.contains('PACKAGECONFIG', 'fbdev', '1', '0', d)}"
+
+LVGL_CONFIG_USE_SDL = "${@bb.utils.contains('PACKAGECONFIG', 'sdl', '1', '0', d)}"
+
+LVGL_CONFIG_SDL_FULLSCREEN ?= "0"
+
+LVGL_CONFIG_LV_MEM_CUSTOM ?= "0"
+LVGL_CONFIG_LV_MEM_SIZE ?= "(64 * 1024U)"
+LVGL_CONFIG_LV_COLOR_DEPTH ?= "32"
+
+LVGL_CONFIG_LV_USE_LOG    ?= "0"
+LVGL_CONFIG_LV_LOG_LEVEL  ?= "LV_LOG_LEVEL_WARN"
+LVGL_CONFIG_LV_LOG_PRINTF ?= "0"
+
+LVGL_CONFIG_LV_USE_FONT_COMPRESSED ?= "0"
+
+LVGL_CONFIG_LV_USE_GRIDNAV = "${@bb.utils.contains('PACKAGECONFIG', 'gridnav', '1', '0', d)}"
+
+LVGL_CONFIG_LV_THEME_DEFAULT_DARK ?= "0"
+
+LVGL_CONFIG_USE_LOTTIE = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}"
+
+LVGL_CONFIG_USE_VECTOR_GRAPHICS = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}"
+
+LVGL_CONFIG_USE_THORVG_INTERNAL = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}"
+
+LVGL_CONFIG_USE_MATRIX = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}"
+
+LVGL_CONFIG_USE_FLOAT = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}"
+
+DEBUG_BUILD ??= "0"
+
+ALLOW_EMPTY:${PN} = "1"
+
+EXTRA_OECMAKE += "-Dinstall:BOOL=ON -DLIB_INSTALL_DIR=${baselib}"
+
+do_configure:append() {
+    # If there is a configuration template, start from that
+    [ -r "${S}/lv_conf_template.h" ] && cp -Lv "${S}/lv_conf_template.h" "${S}/lv_conf.h"
+
+    sed -r -e "s|#if 0 .*Set it to \"1\" to enable content.*|#if 1 // Enabled by ${PN}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_LINUX_DRM[[:space:]]).*|\1${LVGL_CONFIG_USE_DRM}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_LINUX_FBDEV[[:space:]]).*|\1${LVGL_CONFIG_USE_FBDEV}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_SDL[[:space:]]).*|\1${LVGL_CONFIG_USE_SDL}|" \
+        -e "s|^([[:space:]]*#define LV_USE_DRAW_SDL[[:space:]]).*|\1${LVGL_CONFIG_USE_SDL}|" \
+        -e "s|^([[:space:]]*#define LV_SDL_BUF_COUNT[[:space:]]).*|\1 2|" \
+        -e "s|^([[:space:]]*#define LV_SDL_FULLSCREEN[[:space:]]).*|\1${LVGL_CONFIG_SDL_FULLSCREEN}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_COLOR_DEPTH[[:space:]]).*|\1${LVGL_CONFIG_LV_COLOR_DEPTH}|" \
+        -e "s|^([[:space:]]*#define LV_MEM_CUSTOM[[:space:]]).*|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|" \
+        -e "s|^([[:space:]]*#define LV_MEM_SIZE[[:space:]]).*|\1${LVGL_CONFIG_LV_MEM_SIZE}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_TICK_CUSTOM[[:space:]]).*|\1 1|" \
+        -e "s|^([[:space:]]*#define LV_TICK_CUSTOM_INCLUDE[[:space:]]).*|\1 <stdint.h>|" \
+        -e "s|^([[:space:]]*#define LV_TICK_CUSTOM_SYS_TIME_EXPR[[:space:]]).*|extern uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_EVDEV[[:space:]]).*|\1${LVGL_CONFIG_USE_EVDEV}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_ASSERT_NULL[[:space:]]).*|\1${DEBUG_BUILD}|" \
+        -e "s|^([[:space:]]*#define LV_USE_ASSERT_MALLOC[[:space:]]).*|\1${DEBUG_BUILD}|" \
+        -e "s|^([[:space:]]*#define LV_USE_ASSERT_STYLE[[:space:]]).*|\1${DEBUG_BUILD}|" \
+        -e "s|^([[:space:]]*#define LV_USE_ASSERT_MEM_INTEGRITY[[:space:]]).*|\1${DEBUG_BUILD}|" \
+        -e "s|^([[:space:]]*#define LV_USE_ASSERT_OBJ[[:space:]]).*|\1${DEBUG_BUILD}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_LOG[[:space:]]).*|\1${LVGL_CONFIG_LV_USE_LOG}|" \
+        -e "s|^([[:space:]]*#define LV_LOG_LEVEL[[:space:]]).*|\1${LVGL_CONFIG_LV_LOG_LEVEL}|" \
+        -e "s|^([[:space:]]*#define LV_LOG_PRINTF[[:space:]]).*|\1${LVGL_CONFIG_LV_LOG_PRINTF}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_FONT_COMPRESSED[[:space:]]).*|\1${LVGL_CONFIG_LV_USE_FONT_COMPRESSED}|" \
+        -e "s|^([[:space:]]*#define LV_USE_GRIDNAV[[:space:]]).*|\1${LVGL_CONFIG_LV_USE_GRIDNAV}|" \
+        -e "s|^([[:space:]]*#define LV_THEME_DEFAULT_DARK[[:space:]]).*|\1${LVGL_CONFIG_LV_THEME_DEFAULT_DARK}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_VECTOR_GRAPHIC[[:space:]]).*|\1${LVGL_CONFIG_USE_VECTOR_GRAPHICS}|" \
+        -e "s|^([[:space:]]*#define LV_USE_THORVG_INTERNAL[[:space:]]).*|\1${LVGL_CONFIG_USE_THORVG_INTERNAL}|" \
+        -e "s|^([[:space:]]*#define LV_USE_MATRIX[[:space:]]).*|\1${LVGL_CONFIG_USE_MATRIX}|" \
+        -e "s|^([[:space:]]*#define LV_USE_FLOAT[[:space:]]).*|\1${LVGL_CONFIG_USE_FLOAT}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_LOTTIE[[:space:]]).*|\1${LVGL_CONFIG_USE_LOTTIE}|" \
+        -i "${S}/lv_conf.h"
+}

+ 7 - 3
recipes-graphics/lvgl/lvgl_%.bbappend

@@ -1,5 +1,9 @@
-FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
-
 PACKAGECONFIG += "fbdev gridnav"
 
-SRC_URI += "file://clib-malloc.cfg"
+# Use the C library allocator instead of LVGL's builtin pool. The builtin
+# pool has a fixed size (64 KB by default) and running out of it ends in
+# LV_ASSERT_HANDLER (while(1)): the recovery GUI hangs at 100% CPU.
+do_configure:append() {
+    sed -r -e "s|^([[:space:]]*#define LV_USE_STDLIB_MALLOC[[:space:]]).*|\1LV_STDLIB_CLIB|" \
+        -i "${S}/lv_conf.h"
+}

+ 29 - 0
recipes-graphics/lvgl/lvgl_9.2.2.bb

@@ -0,0 +1,29 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: MIT
+
+# Backported from meta-openembedded walnascar (07330a9): swupdategui-rs
+# needs LVGL >= 9.2 (typedef enums and non-inline helpers for bindgen).
+
+HOMEPAGE = "https://lvgl.io/"
+DESCRIPTION = "LVGL is an OSS graphics library to create embedded GUI"
+SUMMARY = "Light and Versatile Graphics Library"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENCE.txt;md5=bf1198c89ae87f043108cea62460b03a"
+
+SRC_URI = "\
+	git://github.com/lvgl/lvgl;protocol=https;branch=release/v9.2 \
+    file://0001-thorvg-fix-build-with-gcc-15.patch \
+	"
+SRCREV = "7f07a129e8d77f4984fff8e623fd5be18ff42e74"
+
+inherit cmake
+
+EXTRA_OECMAKE = "-DLIB_INSTALL_DIR=${baselib} -DBUILD_SHARED_LIBS=ON"
+S = "${WORKDIR}/git"
+
+require lv-conf.inc
+
+do_install:append() {
+    install -m 0644 "${S}/lv_conf.h" "${D}${includedir}/${BPN}/lv_conf.h"
+}

+ 1 - 1
recipes-support/rescuegui/swupdate-gui_git.bb

@@ -43,7 +43,7 @@ do_install:append () {
 
         # The GUI opens /dev/fb and /dev/input/{keyboard0,touchscreen0}
         install -d ${D}${sysconfdir}/udev/rules.d
-        install -m 0644 ${UNPACKDIR}/90-recovery-gui.rules ${D}${sysconfdir}/udev/rules.d/
+        install -m 0644 ${WORKDIR}/90-recovery-gui.rules ${D}${sysconfdir}/udev/rules.d/
 }
 
 FILES:${PN} += "${sysconfdir}/udev/rules.d/90-recovery-gui.rules"

+ 62 - 0
recipes-support/rescuegui/swupdategui-rs/0001-lv-build-with-LVGL-9.2.patch

@@ -0,0 +1,62 @@
+From 11f311332ab8307607884ce176d2b8ac05a623a9 Mon Sep 17 00:00:00 2001
+From: Stefano Babic <stefano.babic@swupdate.org>
+Date: Fri, 23 Oct 2026 13:59:43 +0200
+Subject: [PATCH] lv: build with LVGL 9.2
+
+LVGL 9.2 declares lv_state_t as uint16_t, while bindgen emits the
+LV_STATE_* values as u32. Accept any integer convertible to u32 in the
+state helpers and cast it to lv_state_t.
+
+lv_slider_set_value() takes an lv_anim_enable_t up to 9.2 and a bool
+in later versions: pass the default value, that is "animation off"
+for both.
+
+Upstream-Status: Pending
+Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
+---
+ src/lv.rs | 17 ++++++++++-------
+ 1 file changed, 10 insertions(+), 7 deletions(-)
+
+diff --git a/src/lv.rs b/src/lv.rs
+index 55d7fe3..6eb41e0 100644
+--- a/src/lv.rs
++++ b/src/lv.rs
+@@ -215,16 +215,17 @@ impl Obj {
+         self.remove_flag(sys::LV_OBJ_FLAG_SCROLLABLE);
+     }
+ 
+-    pub fn add_state(self, state: sys::lv_state_t) {
+-        unsafe { sys::lv_obj_add_state(self.raw(), state) }
++    /* LVGL 9.2: lv_state_t is u16 but bindgen emits the LV_STATE_* values as u32 */
++    pub fn add_state(self, state: impl Into<u32>) {
++        unsafe { sys::lv_obj_add_state(self.raw(), state.into() as sys::lv_state_t) }
+     }
+ 
+-    pub fn remove_state(self, state: sys::lv_state_t) {
+-        unsafe { sys::lv_obj_remove_state(self.raw(), state) }
++    pub fn remove_state(self, state: impl Into<u32>) {
++        unsafe { sys::lv_obj_remove_state(self.raw(), state.into() as sys::lv_state_t) }
+     }
+ 
+-    pub fn has_state(self, state: sys::lv_state_t) -> bool {
+-        unsafe { sys::lv_obj_has_state(self.raw(), state) }
++    pub fn has_state(self, state: impl Into<u32>) -> bool {
++        unsafe { sys::lv_obj_has_state(self.raw(), state.into() as sys::lv_state_t) }
+     }
+ 
+     /* styles */
+@@ -292,8 +293,10 @@ impl Obj {
+ 
+     /* slider */
+ 
++    /* The animation flag is lv_anim_enable_t up to LVGL 9.2 and bool later:
++     * the default value is "off" for both */
+     pub fn slider_set_value(self, value: i32) {
+-        unsafe { sys::lv_slider_set_value(self.raw(), value, false) }
++        unsafe { sys::lv_slider_set_value(self.raw(), value, Default::default()) }
+     }
+ 
+     /* text area */
+-- 
+2.53.0
+

+ 22 - 4
recipes-support/rescuegui/swupdategui-rs_git.bb

@@ -8,17 +8,27 @@ LICENSE = "GPL-2.0-or-later"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=de4b1111cc7f3c8bc81546de6f9b24e4"
 
 SRC_URI = "git://github.com/sbabic/SWUpdateGUI.git;protocol=https;branch=rust-port \
+	file://0001-lv-build-with-LVGL-9.2.patch \
+	file://swupdate-gui \
 	file://swupdate-gui.service \
 	file://90-recovery-gui.rules \
 	"
-SRCREV = "e904a5768fba63dc484d2fdc948ae10772406af9"
+SRCREV = "de64c91ea54671f25c47029cfcd36fc8a7a05a41"
+
+S = "${WORKDIR}/git"
 
 PV = "1.0.0+git"
 
 include swupdategui-rs-crates.inc
 
-inherit cargo cargo-update-recipe-crates pkgconfig systemd
+inherit cargo cargo-update-recipe-crates pkgconfig update-rc.d systemd
 
+# Requirements in scarthgap:
+# - Rust >= 1.77 (scarthgap ships 1.75), for example from meta-lts-mixins,
+#   branch scarthgap/rust
+# - LVGL >= 9.2 (provided by this layer)
+# - clang-native from meta-clang
+#
 # Bindings for LVGL and libswupdate are generated by bindgen, which needs libclang.
 # LVGL is found with pkg-config, libswupdate in the target sysroot.
 DEPENDS += "clang-native lvgl swupdate"
@@ -27,11 +37,19 @@ export BINDGEN_EXTRA_CLANG_ARGS = "--sysroot=${STAGING_DIR_HOST} -I${STAGING_INC
 export SWUPDATE_INCLUDE_DIR = "${STAGING_INCDIR}"
 export SWUPDATE_LIB_DIR = "${STAGING_LIBDIR}"
 
+INITSCRIPT_NAME = "swupdate-gui"
+INITSCRIPT_PARAMS = "defaults 90"
 SYSTEMD_SERVICE:${PN} = "swupdate-gui.service"
 
 do_install:append() {
 	install -d ${D}${systemd_system_unitdir}
-	install -m 0644 ${UNPACKDIR}/swupdate-gui.service ${D}${systemd_system_unitdir}
+	install -m 0644 ${WORKDIR}/swupdate-gui.service ${D}${systemd_system_unitdir}
+
+	# Same init script as the C implementation
+	if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
+		install -d ${D}${sysconfdir}/init.d
+		install -m 0755 ${WORKDIR}/swupdate-gui ${D}${sysconfdir}/init.d/
+	fi
 
 	install -d ${D}${sysconfdir}/recovery_gui
 	install -m 0644 ${S}/config/config.txt ${D}${sysconfdir}/recovery_gui/
@@ -43,7 +61,7 @@ do_install:append() {
 
 	# The GUI opens /dev/fb and /dev/input/{keyboard0,touchscreen0}
 	install -d ${D}${sysconfdir}/udev/rules.d
-	install -m 0644 ${UNPACKDIR}/90-recovery-gui.rules ${D}${sysconfdir}/udev/rules.d/
+	install -m 0644 ${WORKDIR}/90-recovery-gui.rules ${D}${sysconfdir}/udev/rules.d/
 }
 
 FILES:${PN} += "${sysconfdir}/udev/rules.d/90-recovery-gui.rules"