1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-01-11 15:00:39 +00:00

optee-client: fix udev and systemd handling

Eliminate the systemd specific install content fix-up commands appended
to do_install.
  - patch optee-client to allow controlling installation of systemd and
    udev specific configuration files.
  - pass driver group names to optee-client build

Signed-off-by: Gyorgy Szing <gyorgy.szing@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Gyorgy Szing
2025-04-02 16:16:49 +02:00
committed by Jon Mason
parent 2ec60ece8d
commit 91cacb6332
4 changed files with 89 additions and 5 deletions

View File

@@ -18,14 +18,16 @@ S = "${WORKDIR}/git"
EXTRA_OECMAKE = " \
-DBUILD_SHARED_LIBS=ON \
-DCFG_USE_PKGCONFIG=ON \
"
EXTRA_OECMAKE += " -DCFG_ENABLE_SYSTEMD=On -DSYSTEMD_UNIT_DIR=${systemd_system_unitdir}/"
EXTRA_OECMAKE += " -DCFG_ENABLE_UDEV=On -DUDEV_UDEV_DIR=${nonarch_base_libdir}/udev/rules.d/"
EXTRA_OECMAKE += " -DCFG_TEE_GROUP=tee -DCFG_TEEPRIV_GROUP=teepriv"
EXTRA_OECMAKE:append:toolchain-clang = " -DCFG_WERROR=0"
do_install:append() {
# installed by default
if ! ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
rm -rf ${D}${libdir}/systemd
fi
if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
install -D -p -m0755 ${UNPACKDIR}/tee-supplicant.sh ${D}${sysconfdir}/init.d/tee-supplicant
sed -i -e s:@sysconfdir@:${sysconfdir}:g \
@@ -41,6 +43,8 @@ INITSCRIPT_PACKAGES = "${PN}"
INITSCRIPT_NAME:${PN} = "tee-supplicant"
INITSCRIPT_PARAMS:${PN} = "start 10 1 2 3 4 5 . stop 90 0 6 ."
FILES:${PN} += "${nonarch_base_libdir}/udev/rules.d/"
# Users and groups:
# tee group to access /dev/tee*
# teepriv group to acess /dev/teepriv*, only tee-supplicant

View File

@@ -0,0 +1,78 @@
From 5ddaac7c0770a423eca0cb727403b2f06657ffea Mon Sep 17 00:00:00 2001
From: Gyorgy Szing <gyorgy.szing@arm.com>
Date: Tue, 14 Jan 2025 09:42:25 +0100
Subject: [PATCH 1/1] tee-supplicant: update udev & systemd install code
- Allow optionally using pkg-config to discover install location of
systemd service and udev rule files.
- Make systemd service file generation and installation optional.
- Make udev rule file generation and installation optional.
Changes are backwards compatible and the default operation is unchanged.
Upstream-Status: Pending
Signed-off-by: Gyorgy Szing <gyorgy.szing@arm.com>
---
tee-supplicant/CMakeLists.txt | 39 +++++++++++++++++++++++++++++++----
1 file changed, 35 insertions(+), 4 deletions(-)
diff --git a/tee-supplicant/CMakeLists.txt b/tee-supplicant/CMakeLists.txt
index 8df9bef..ae1f5a4 100644
--- a/tee-supplicant/CMakeLists.txt
+++ b/tee-supplicant/CMakeLists.txt
@@ -7,6 +7,9 @@ option(RPMB_EMU "Enable tee-supplicant to emulate RPMB" ON)
option(CFG_TA_GPROF_SUPPORT "Enable tee-supplicant support for TAs instrumented with gprof" ON)
option(CFG_FTRACE_SUPPORT "Enable tee-supplicant support for TAs instrumented with ftrace" ON)
option(CFG_TEE_SUPP_PLUGINS "Enable tee-supplicant plugin support" ON)
+option(CFG_ENABLE_SYSTEMD "Enable systemd service unit file generation." ON)
+option(CFG_ENABLE_UDEV "Enable udev rules file generation." ON)
+option(CFG_USE_PKGCONFIG "Use pkg-config for discovering install target directory for systemd and udev files." OFF)
set(CFG_TEE_SUPP_LOG_LEVEL "1" CACHE STRING "tee-supplicant log level")
# FIXME: Question is, is this really needed? Should just use defaults from # GNUInstallDirs?
@@ -117,8 +120,36 @@ endif()
################################################################################
# Install targets
################################################################################
+# Discover target install location of the systemd and udev files using pkg-config
+if (CFG_USE_PKGCONFIG)
+ # Note: pkg-config should return setting valid for the target platform and not the host.
+ include(FindPkgConfig)
+ if (PKG_CONFIG_FOUND)
+ pkg_search_module(SYSTEMD systemd)
+ if (SYSTEMD_FOUND AND CFG_ENABLE_SYSTEMD)
+ pkg_get_variable(UNIT_DIR systemd systemd_system_unit_dir)
+ set(SYSTEMD_UNIT_DIR "${UNIT_DIR}" CACHE PATH "Location of systemd unit files.")
+ unset(UNIT_DIR)
+ endif()
+ pkg_search_module(UDEV udev)
+ if (UDEV_FOUND)
+ pkg_get_variable(UDEV_DIR udev udev_dir)
+ set(UDEV_UDEV_DIR "${UDEV_DIR}" CACHE PATH "Location of udev files.")
+ unset(UDEV_DIR)
+ endif()
+ endif()
+endif()
+
+# Some sane defaults is discovering through pkgconfig fails or is disabled.
+set(SYSTEMD_UNIT_DIR "${CMAKE_INSTALL_LIBDIR}/systemd/system" CACHE PATH "Location of systemd unit files.")
+set(UDEV_UDEV_DIR "${CMAKE_INSTALL_SYSCONFDIR}/udev/rules.d" CACHE PATH "Location of udev files.")
+
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR})
-configure_file(tee-supplicant@.service.in tee-supplicant@.service @ONLY)
-install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/tee-supplicant@.service DESTINATION ${CMAKE_INSTALL_LIBDIR}/systemd/system)
-configure_file(optee-udev.rules.in optee-udev.rules @ONLY)
-install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/optee-udev.rules DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/udev/rules.d)
+if (CFG_ENABLE_SYSTEMD)
+ configure_file(tee-supplicant@.service.in tee-supplicant@.service @ONLY)
+ install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/tee-supplicant@.service DESTINATION ${SYSTEMD_UNIT_DIR})
+endif()
+if (CFG_ENABLE_UDEV)
+ configure_file(optee-udev.rules.in optee-udev.rules @ONLY)
+ install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/optee-udev.rules DESTINATION ${UDEV_UDEV_DIR})
+endif()
\ No newline at end of file
--
2.43.0

View File

@@ -2,7 +2,8 @@ require recipes-security/optee/optee-client.inc
SRCREV = "a5b1ffcd26e328af0bbf18ab448a38ecd558e05c"
SRC_URI += "file://0001-tee-supplicant-add-udev-rule-and-systemd-service-fil.patch"
SRC_URI += "file://0001-tee-supplicant-add-udev-rule-and-systemd-service-fil.patch \
file://0001-tee-supplicant-update-udev-systemd-install-code.patch"
inherit pkgconfig
DEPENDS += "util-linux"

View File

@@ -2,6 +2,7 @@ require recipes-security/optee/optee-client.inc
# v4.4.0
SRCREV = "d221676a58b305bddbf97db00395205b3038de8e"
SRC_URI += "file://0001-tee-supplicant-update-udev-systemd-install-code.patch"
inherit pkgconfig
DEPENDS += "util-linux"