xref: /linux/Documentation/driver-api/firmware/direct-fs-lookup.rst (revision c83b49383b595be50647f0c764a48c78b5f3c4f8)
1========================
2Direct filesystem lookup
3========================
4
5Direct filesystem lookup is the most common form of firmware lookup performed
6by the kernel. The kernel looks for the firmware directly on the root
7filesystem in the paths documented in the section 'Firmware search paths'.
8The filesystem lookup is implemented in fw_get_filesystem_firmware(), it
9uses common core kernel file loader facility kernel_read_file_from_path().
10The max path allowed is PATH_MAX -- currently this is 4096 characters.
11
12It is recommended you keep /lib/firmware paths on your root filesystem,
13avoid having a separate partition for them in order to avoid possible
14races with lookups and avoid uses of the custom fallback mechanisms
15documented below.
16
17Firmware and initramfs
18----------------------
19
20Drivers which are built-in to the kernel should have the firmware integrated
21also as part of the initramfs used to boot the kernel given that otherwise
22a race is possible with loading the driver and the real rootfs not yet being
23available. Stuffing the firmware into initramfs resolves this race issue,
24however note that using initrd does not suffice to address the same race.
25
26There are circumstances that justify not wanting to include firmware into
27initramfs, such as dealing with large firmware files for the
28remote-proc subsystem. For such cases using a userspace fallback mechanism
29is currently the only viable solution as only userspace can know for sure
30when the real rootfs is ready and mounted.
31