From 1ddd7e57eee5f5ff2363f3f5acb9ff8878750519 Mon Sep 17 00:00:00 2001 From: Gabriel Valcazar Date: Thu, 14 Mar 2019 11:46:35 +0100 Subject: [PATCH] systemd: add upstream patch to expand the list of rules.d directories Unlike eudev, which is used on images without systemd, the list of paths systemd-udev uses to look for rules is very limited. Include an upstream patch (commit 116b91e8ccfee1d44fc2b140d831d688e3747902 in the systemd repo) that expands said list. This fixes an issue with crda's regulatory domain rule file, which was being excluded due to it being in a path systemd-udev was ignoring (/usr/lib/udev). Because of this, the regulatory domain was never set properly and hostapd was failing when configured to use 5GHz channels (which is the default config). https://jira.digi.com/browse/DEL-6504 Signed-off-by: Gabriel Valcazar --- ...ual-set-of-load-paths-for-udev-rules.patch | 109 ++++++++++++++++++ .../recipes-core/systemd/systemd_%.bbappend | 2 +- 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 meta-digi-dey/recipes-core/systemd/systemd/0001-udev-use-the-usual-set-of-load-paths-for-udev-rules.patch diff --git a/meta-digi-dey/recipes-core/systemd/systemd/0001-udev-use-the-usual-set-of-load-paths-for-udev-rules.patch b/meta-digi-dey/recipes-core/systemd/systemd/0001-udev-use-the-usual-set-of-load-paths-for-udev-rules.patch new file mode 100644 index 000000000..3434f1729 --- /dev/null +++ b/meta-digi-dey/recipes-core/systemd/systemd/0001-udev-use-the-usual-set-of-load-paths-for-udev-rules.patch @@ -0,0 +1,109 @@ +From: Zbigniew Jędrzejewski-Szmek +Date: Thu, 3 Jan 2019 12:31:06 +0100 +Subject: [PATCH] udev: use the usual set of load paths for udev rules + +This adds /usr/local/lib/udev/rules.d to the search path on non-split-usr systems. +On split-usr systems, the paths with /usr/-prefixes are added too. +In the past, on split-usr systems, it made sense to only load rules from +/lib/udev/rules.d, because /usr could be mounted late. But we don't support running +without /usr since 80758717a63, so in practice it doesn't matter whether the +rules files are in /lib/udev/rules.d or /usr/lib/udev/rules.d. Distributions +that maintain the illusion of functional split-usr are welcome to simply not put any +files in /usr/lib/udev/rules.d/. + +In practice this doesn't change much, but it makes udev more consistent with the +rest of the systemd suite. +--- + man/udev.xml | 26 ++++++++++++-------------- + src/udev/udev-rules.c | 13 ++++--------- + 2 files changed, 16 insertions(+), 23 deletions(-) + +diff --git a/man/udev.xml b/man/udev.xml +index 15e6d8e..955aff8 100644 +--- a/man/udev.xml ++++ b/man/udev.xml +@@ -45,20 +45,18 @@ + + + Rules Files +- The udev rules are read from the files located in the +- system rules directory /usr/lib/udev/rules.d, +- the volatile runtime directory /run/udev/rules.d +- and the local administration directory /etc/udev/rules.d. +- All rules files are collectively sorted and processed in lexical order, +- regardless of the directories in which they live. However, files with +- identical filenames replace each other. Files in /etc +- have the highest priority, files in /run take precedence +- over files with the same name in /usr/lib. This can be +- used to override a system-supplied rules file with a local file if needed; +- a symlink in /etc with the same name as a rules file in +- /usr/lib, pointing to /dev/null, +- disables the rules file entirely. Rule files must have the extension +- .rules; other extensions are ignored. ++ The udev rules are read from the files located in the system rules directories ++ /usr/lib/udev/rules.d and /usr/local/lib/udev/rules.d, the ++ volatile runtime directory /run/udev/rules.d and the local administration ++ directory /etc/udev/rules.d. All rules files are collectively sorted and ++ processed in lexical order, regardless of the directories in which they live. However, files with ++ identical filenames replace each other. Files in /etc have the highest priority, ++ files in /run take precedence over files with the same name under ++ /usr. This can be used to override a system-supplied rules file with a local ++ file if needed; a symlink in /etc with the same name as a rules file in ++ /usr/lib, pointing to /dev/null, disables the rules file ++ entirely. Rule files must have the extension .rules; other extensions are ++ ignored. + + Every line in the rules file contains at least one key-value pair. + Except for empty lines or lines beginning with #, which are ignored. +diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c +index f029395..cd8f4ef 100644 +--- a/src/udev/udev-rules.c ++++ b/src/udev/udev-rules.c +@@ -18,6 +18,7 @@ + + #include "alloc-util.h" + #include "conf-files.h" ++#include "def.h" + #include "dirent-util.h" + #include "escape.h" + #include "fd-util.h" +@@ -36,6 +37,7 @@ + #include "util.h" + + #define PREALLOC_TOKEN 2048 ++#define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d") + + struct uid_gid { + unsigned int name_off; +@@ -45,13 +47,6 @@ struct uid_gid { + }; + }; + +-static const char* const rules_dirs[] = { +- "/etc/udev/rules.d", +- "/run/udev/rules.d", +- UDEVLIBEXECDIR "/rules.d", +- NULL +-}; +- + struct udev_rules { + struct udev *udev; + usec_t dirs_ts_usec; +@@ -1542,7 +1537,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) { + + udev_rules_check_timestamp(rules); + +- r = conf_files_list_strv(&files, ".rules", NULL, 0, rules_dirs); ++ r = conf_files_list_strv(&files, ".rules", NULL, 0, RULES_DIRS); + if (r < 0) { + log_error_errno(r, "failed to enumerate rules files: %m"); + return udev_rules_unref(rules); +@@ -1598,7 +1593,7 @@ bool udev_rules_check_timestamp(struct udev_rules *rules) { + if (!rules) + return false; + +- return paths_check_timestamp(rules_dirs, &rules->dirs_ts_usec, true); ++ return paths_check_timestamp(RULES_DIRS, &rules->dirs_ts_usec, true); + } + + static int match_key(struct udev_rules *rules, struct token *token, const char *val) { diff --git a/meta-digi-dey/recipes-core/systemd/systemd_%.bbappend b/meta-digi-dey/recipes-core/systemd/systemd_%.bbappend index 4f525f188..4efaad656 100644 --- a/meta-digi-dey/recipes-core/systemd/systemd_%.bbappend +++ b/meta-digi-dey/recipes-core/systemd/systemd_%.bbappend @@ -1,6 +1,6 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" - +SRC_URI += "file://0001-udev-use-the-usual-set-of-load-paths-for-udev-rules.patch" #FIX-it: Workaround as missing ending slash in FIRMWARE_PATH [YOCIMX-2831] EXTRA_OEMESON_remove = "-Dfirmware-path=${nonarch_base_libdir}/firmware "