mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
LinuxKPI: treat firmware file names more lenient
A lot of firmware files have a "-" in the name. That "-" is a problem
when dealing with shell variables or loader (e.g., auto-loading .ko).
It may thus often be convenient to generate firmware kernel object files
with s/-/_/g in the name. In order to automatically find them from
drivers using LinuxKPI also substitue the '-' for a '_' like we do
for '/' and '.' already.
Reviewed by: hselasky, manu (ok)
Differential Revision: https://reviews.freebsd.org/D29514
(cherry picked from commit 37c3241a43)
This commit is contained in:
parent
57d5000e59
commit
bdce1eea71
1 changed files with 8 additions and 2 deletions
|
|
@ -85,9 +85,10 @@ _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware *
|
|||
fwimg = fw_name;
|
||||
fbdfw = firmware_get_flags(fwimg, flags);
|
||||
}
|
||||
/* (3) Flatten '/' and then '.' to '_' and try with adjusted name. */
|
||||
/* (3) Flatten '/', '.' and '-' to '_' and try with adjusted name. */
|
||||
if (fbdfw == NULL &&
|
||||
(strchr(fw_name, '/') != NULL || strchr(fw_name, '.') != NULL)) {
|
||||
(strchr(fw_name, '/') != NULL || strchr(fw_name, '.') != NULL ||
|
||||
strchr(fw_name, '-'))) {
|
||||
fwimg = strdup(fw_name, M_LKPI_FW);
|
||||
if (fwimg != NULL) {
|
||||
while ((p = strchr(fwimg, '/')) != NULL)
|
||||
|
|
@ -98,6 +99,11 @@ _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware *
|
|||
*p = '_';
|
||||
fbdfw = firmware_get_flags(fwimg, flags);
|
||||
}
|
||||
if (fbdfw == NULL) {
|
||||
while ((p = strchr(fwimg, '-')) != NULL)
|
||||
*p = '_';
|
||||
fbdfw = firmware_get_flags(fwimg, flags);
|
||||
}
|
||||
free(__DECONST(void *, fwimg), M_LKPI_FW);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue