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