tizen: Search for configuration files in /hal dir
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Tue, 1 Dec 2020 11:34:31 +0000 (12:34 +0100)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Thu, 21 Mar 2024 15:08:59 +0000 (16:08 +0100)
Since Tizen 6.5, a HAL image is mounted on the /hal directory,
which contains hardware-specific configurations and drivers,
for better portability of Tizen.

This is the priority of path searching for configuration file.
 1. /etc/
 2. /run/
 3. /usr/local/lib/
 4. /usr/lib/
 5. /hal/lib/

When the same file exists, the higher priority file is used.
In this case, "/etc" is the highest priority.

Because hal can never override platform,
hal has a lower priority than platform.

Change-Id: Ie5e6cf98e64b4317bda23d49571b5c0f60084569
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
[ Change search order for /hal to be searched last ]
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
src/basic/constants.h
src/basic/tizenhal.h [new file with mode: 0644]
src/tmpfiles/tmpfiles.c
src/udev/udev-rules.c

index 6bb5f3c..2ac8224 100644 (file)
@@ -95,3 +95,5 @@
 #define VARLINK_ADDR_PATH_MANAGED_OOM_USER "/run/systemd/oom/io.systemd.ManagedOOM"
 
 #define KERNEL_BASELINE_VERSION "4.15"
+
+#include "tizenhal.h"
diff --git a/src/basic/tizenhal.h b/src/basic/tizenhal.h
new file mode 100644 (file)
index 0000000..7983235
--- /dev/null
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+
+/* Since Tizen 6.5, a HAL image is mounted on the /hal directory,
+ * which contains hardware-specific configurations and drivers,
+ * for better portability of Tizen.
+ */
+#pragma once
+
+#define CONF_HAL_PATHS(n)                       \
+        CONF_PATHS(n),                          \
+        "/hal/lib/" n
+
+#define CONF_HAL_PATHS_NULSTR(n)                \
+        CONF_PATHS_NULSTR(n)                    \
+        "/hal/lib/" n "\0"
+
+#define CONF_HAL_PATHS_STRV(n)                  \
+        STRV_MAKE(CONF_HAL_PATHS(n))
index 230ec09..bb2e14e 100644 (file)
@@ -4436,7 +4436,7 @@ static int run(int argc, char *argv[]) {
                 break;
 
         case RUNTIME_SCOPE_SYSTEM:
-                config_dirs = strv_split_nulstr(CONF_PATHS_NULSTR("tmpfiles.d"));
+                config_dirs = strv_split_nulstr(CONF_HAL_PATHS_NULSTR("tmpfiles.d"));
                 if (!config_dirs)
                         return log_oom();
                 break;
index 5f12002..c434084 100644 (file)
@@ -42,7 +42,7 @@
 #include "user-util.h"
 #include "virt.h"
 
-#define RULES_DIRS ((const char* const*) CONF_PATHS_STRV("udev/rules.d"))
+#define RULES_DIRS (const char* const*) CONF_HAL_PATHS_STRV("udev/rules.d")
 
 typedef enum {
         OP_MATCH,        /* == */