From da895169a7a04da3713dece1be487267be128674 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Wed, 21 Apr 2021 14:54:14 -0500 Subject: [PATCH] Add a new path for configuring runtime firmware load path The kernel allows configuring this, and certain plugins will use this path to be able to load firmware in the kernel driver through runtime, but to flash to the device. --- libfwupdplugin/fu-common.c | 6 ++++++ libfwupdplugin/fu-common.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/libfwupdplugin/fu-common.c b/libfwupdplugin/fu-common.c index d67edfc3769..598066a710d 100644 --- a/libfwupdplugin/fu-common.c +++ b/libfwupdplugin/fu-common.c @@ -1175,6 +1175,12 @@ fu_common_get_path (FuPathKind path_kind) if (tmp != NULL) return g_strdup (tmp); return g_strdup ("/sys/firmware/acpi/tables"); + /* /sys/module/firmware_class/parameters/path */ + case FU_PATH_KIND_FIRMWARE_SEARCH: + tmp = g_getenv ("FWUPD_FIRMWARESEARCH"); + if (tmp != NULL) + return g_strdup (tmp); + return g_strdup ("/sys/module/firmware_class/parameters/path"); /* /etc */ case FU_PATH_KIND_SYSCONFDIR: tmp = g_getenv ("FWUPD_SYSCONFDIR"); diff --git a/libfwupdplugin/fu-common.h b/libfwupdplugin/fu-common.h index 31fc63edeb5..75dbc384cff 100644 --- a/libfwupdplugin/fu-common.h +++ b/libfwupdplugin/fu-common.h @@ -68,6 +68,7 @@ typedef guint FuEndianType; * @FU_PATH_KIND_ACPI_TABLES: The location of the ACPI tables * @FU_PATH_KIND_LOCKDIR: The lock directory (IE /run/lock) * @FU_PATH_KIND_SYSFSDIR_FW_ATTRIB The firmware attributes directory (IE /sys/class/firmware-attributes) + * @FU_PATH_KIND_FIRMWARE_SEARCH: The path to configure the kernel policy for runtime loading other than /lib/firmware (IE /sys/module/firmware_class/parameters/path) * * Path types to use when dynamically determining a path at runtime **/ @@ -90,6 +91,7 @@ typedef enum { FU_PATH_KIND_ACPI_TABLES, FU_PATH_KIND_LOCKDIR, FU_PATH_KIND_SYSFSDIR_FW_ATTRIB, + FU_PATH_KIND_FIRMWARE_SEARCH, /*< private >*/ FU_PATH_KIND_LAST } FuPathKind;