Page MenuHomeFreeBSD

sys/kern/subr_firmware: implement firmware_path search path
Needs ReviewPublic

Authored by mcq_disroot.org on Sat, Feb 28, 7:55 PM.
Referenced Files
Unknown Object (File)
Mon, Mar 2, 5:46 AM
Unknown Object (File)
Mon, Mar 2, 4:28 AM
Unknown Object (File)
Sun, Mar 1, 10:16 PM
Unknown Object (File)
Sun, Mar 1, 10:15 PM
Unknown Object (File)
Sun, Mar 1, 9:32 PM
Unknown Object (File)
Sun, Mar 1, 9:09 PM
Unknown Object (File)
Sun, Mar 1, 5:39 PM
Unknown Object (File)
Sun, Mar 1, 12:10 PM
Subscribers

Details

Summary

sys/kern/subr_firmware.c had a hardcoded single directory path for
bin firmware loading. this implements the firmware_path sysctl
and kenv variable

the default path is /boot/firmware. the paths can be configured
through loader.conf or through sysctl kern.firmware_path.

Test Plan

tested on a VM so far and didn't break but didn't do much else but set the kern.firmware_path to another directory and was decently stable.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

can you either use git arc to update this patch, or generate the diff with -U99999 please? I need a little more context to review it.

Generated with U99999 for full context.

sys/kern/subr_firmware.c
272

RWTUN already handles this, so you don't need another TUNABLE_STR here.

354

Do you need to guard against a firmware path that's exactly MAXAPATHLEN bytes long? Do you know that string will be NUL terminated always?

355

strchr() I think would be better here.

367

I'd include the firmware path string here.

A couple of small suggestions, and one question that needs to be answered.

Generated with U99999 for full context.

Thanks! I was able to see the context I couldn't the first time. This looks pretty good.

sys/kern/subr_firmware.c
267

We need to maintain this anyways as a fallback, but I'd probably go ahead and add a default in ^/stand/defaults/loader.conf that matches it -- if nothing else, it's an example

mcq_disroot.org marked an inline comment as done.

used strchr(3) in try_binary_file() instead of manual parsing
ensured proper checking in try_binary_file(), and added a default for firmware_path in /stand/defaults/loader.conf
also removed TUNABLE_STR because CTLFLAG_RWTUN already sets it

refer to previous commit msg, just added /usr/share/firmware as another path in firmware_path[MAXPATHLEN]