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