1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-03 01:17:45 +03:00

condition: fix device-tree firmware path

The path /sys/firmware/device-tree doesn't exist. This should be either
/proc/device-tree or /sys/firmware/devicetree.

The first path is only a link. So lets use the second path.

See https://github.com/torvalds/linux/blob/v4.14/drivers/of/base.c#L218.

(cherry picked from commit 1037178acf)
This commit is contained in:
Daniel Braunwarth 2022-08-28 20:02:50 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 96da39ddb1
commit 254b77e73c

View File

@ -555,9 +555,9 @@ static int condition_test_firmware(Condition *c, char **env) {
assert(c->type == CONDITION_FIRMWARE);
if (streq(c->parameter, "device-tree")) {
if (access("/sys/firmware/device-tree/", F_OK) < 0) {
if (access("/sys/firmware/devicetree/", F_OK) < 0) {
if (errno != ENOENT)
log_debug_errno(errno, "Unexpected error when checking for /sys/firmware/device-tree/: %m");
log_debug_errno(errno, "Unexpected error when checking for /sys/firmware/devicetree/: %m");
return false;
} else
return true;