1 # SPDX-License-Identifier: GPL-2.0
5 tristate "Firmware loading facility" if EXPERT
8 This enables the firmware loading facility in the kernel. The kernel
9 will first look for built-in firmware, if it has any. Next, it will
10 look for the requested firmware in a series of filesystem paths:
12 o firmware_class path module parameter or kernel boot param
13 o /lib/firmware/updates/UTS_RELEASE
14 o /lib/firmware/updates
15 o /lib/firmware/UTS_RELEASE
18 Enabling this feature only increases your kernel image by about
19 828 bytes, enable this option unless you are certain you don't
22 You typically want this built-in (=y) but you can also enable this
23 as a module, in which case the firmware_class module will be built.
24 You also want to be sure to enable this built-in if you are going to
25 enable built-in firmware (CONFIG_EXTRA_FIRMWARE).
27 config FW_LOADER_DEBUG
28 bool "Log filenames and checksums for loaded firmware"
29 depends on DYNAMIC_DEBUG
32 depends on CRYPTO_SHA256
35 Select this option to use dynamic debug to log firmware filenames and
36 SHA256 checksums to the kernel log for each firmware file that is
41 config FW_LOADER_PAGED_BUF
44 config FW_LOADER_SYSFS
48 string "Build named firmware blobs into the kernel binary"
50 Device drivers which require firmware can typically deal with
51 having the kernel load firmware from the various supported
52 /lib/firmware/ paths. This option enables you to build into the
53 kernel firmware files. Built-in firmware searches are preceded
54 over firmware lookups using your filesystem over the supported
55 /lib/firmware paths documented on CONFIG_FW_LOADER.
57 This may be useful for testing or if the firmware is required early on
58 in boot and cannot rely on the firmware being placed in an initrd or
61 This option is a string and takes the (space-separated) names of the
62 firmware files -- the same names that appear in MODULE_FIRMWARE()
63 and request_firmware() in the source. These files should exist under
64 the directory specified by the EXTRA_FIRMWARE_DIR option, which is
65 /lib/firmware by default.
67 For example, you might set CONFIG_EXTRA_FIRMWARE="usb8388.bin", copy
68 the usb8388.bin file into /lib/firmware, and build the kernel. Then
69 any request_firmware("usb8388.bin") will be satisfied internally
70 inside the kernel without ever looking at your filesystem at runtime.
72 WARNING: If you include additional firmware files into your binary
73 kernel image that are not available under the terms of the GPL,
74 then it may be a violation of the GPL to distribute the resulting
75 image since it combines both GPL and non-GPL work. You should
76 consult a lawyer of your own before distributing such an image.
78 NOTE: Compressed files are not supported in EXTRA_FIRMWARE.
80 config EXTRA_FIRMWARE_DIR
81 string "Firmware blobs root directory"
82 depends on EXTRA_FIRMWARE != ""
83 default "/lib/firmware"
85 This option controls the directory in which the kernel build system
86 looks for the firmware files listed in the EXTRA_FIRMWARE option.
88 config FW_LOADER_USER_HELPER
89 bool "Enable the firmware sysfs fallback mechanism"
90 select FW_LOADER_SYSFS
91 select FW_LOADER_PAGED_BUF
93 This option enables a sysfs loading facility to enable firmware
94 loading to the kernel through userspace as a fallback mechanism
95 if and only if the kernel's direct filesystem lookup for the
96 firmware failed using the different /lib/firmware/ paths, or the
97 path specified in the firmware_class path module parameter, or the
98 firmware_class path kernel boot parameter if the firmware_class is
99 built-in. For details on how to work with the sysfs fallback mechanism
100 refer to Documentation/driver-api/firmware/fallback-mechanisms.rst.
102 The direct filesystem lookup for firmware is always used first now.
104 If the kernel's direct filesystem lookup for firmware fails to find
105 the requested firmware a sysfs fallback loading facility is made
106 available and userspace is informed about this through uevents.
107 The uevent can be suppressed if the driver explicitly requested it,
108 this is known as the driver using the custom fallback mechanism.
109 If the custom fallback mechanism is used userspace must always
110 acknowledge failure to find firmware as the timeout for the fallback
111 mechanism is disabled, and failed requests will linger forever.
113 This used to be the default firmware loading facility, and udev used
114 to listen for uvents to load firmware for the kernel. The firmware
115 loading facility functionality in udev has been removed, as such it
116 can no longer be relied upon as a fallback mechanism. Linux no longer
117 relies on or uses a fallback mechanism in userspace. If you need to
118 rely on one refer to the permissively licensed firmwared:
120 https://github.com/teg/firmwared
122 Since this was the default firmware loading facility at one point,
123 old userspace may exist which relies upon it, and as such this
124 mechanism can never be removed from the kernel.
126 You should only enable this functionality if you are certain you
127 require a fallback mechanism and have a userspace mechanism ready to
128 load firmware in case it is not found. One main reason for this may
129 be if you have drivers which require firmware built-in and for
130 whatever reason cannot place the required firmware in initramfs.
131 Another reason kernels may have this feature enabled is to support a
132 driver which explicitly relies on this fallback mechanism. Only two
133 drivers need this today:
135 o CONFIG_LEDS_LP55XX_COMMON
138 Outside of supporting the above drivers, another reason for needing
139 this may be that your firmware resides outside of the paths the kernel
140 looks for and cannot possibly be specified using the firmware_class
141 path module parameter or kernel firmware_class path boot parameter
142 if firmware_class is built-in.
144 A modern use case may be to temporarily mount a custom partition
145 during provisioning which is only accessible to userspace, and then
146 to use it to look for and fetch the required firmware. Such type of
147 driver functionality may not even ever be desirable upstream by
148 vendors, and as such is only required to be supported as an interface
149 for provisioning. Since udev's firmware loading facility has been
150 removed you can use firmwared or a fork of it to customize how you
151 want to load firmware based on uevents issued.
153 Enabling this option will increase your kernel image size by about
156 If you are unsure about this, say N here, unless you are Linux
157 distribution and need to support the above two drivers, or you are
158 certain you need to support some really custom firmware loading
159 facility in userspace.
161 config FW_LOADER_USER_HELPER_FALLBACK
162 bool "Force the firmware sysfs fallback mechanism when possible"
163 depends on FW_LOADER_USER_HELPER
165 Enabling this option forces a sysfs userspace fallback mechanism
166 to be used for all firmware requests which explicitly do not disable a
167 a fallback mechanism. Firmware calls which do prohibit a fallback
168 mechanism is request_firmware_direct(). This option is kept for
169 backward compatibility purposes given this precise mechanism can also
170 be enabled by setting the proc sysctl value to true:
172 /proc/sys/kernel/firmware_config/force_sysfs_fallback
174 If you are unsure about this, say N here.
176 config FW_LOADER_COMPRESS
177 bool "Enable compressed firmware support"
179 This option enables the support for loading compressed firmware
180 files. The caller of firmware API receives the decompressed file
181 content. The compressed file is loaded as a fallback, only after
182 loading the raw file failed at first.
184 Compressed firmware support does not apply to firmware images
185 that are built into the kernel image (CONFIG_EXTRA_FIRMWARE).
187 if FW_LOADER_COMPRESS
188 config FW_LOADER_COMPRESS_XZ
189 bool "Enable XZ-compressed firmware support"
190 select FW_LOADER_PAGED_BUF
194 This option adds the support for XZ-compressed files.
195 The files have to be compressed with either none or crc32
196 integrity check type (pass "-C crc32" option to xz command).
198 config FW_LOADER_COMPRESS_ZSTD
199 bool "Enable ZSTD-compressed firmware support"
200 select ZSTD_DECOMPRESS
202 This option adds the support for ZSTD-compressed files.
204 endif # FW_LOADER_COMPRESS
207 bool "Enable firmware caching during suspend"
209 default y if PM_SLEEP
211 Because firmware caching generates uevent messages that are sent
212 over a netlink socket, it can prevent suspend on many platforms.
213 It is also not always useful, so on such platforms we have the
219 bool "Enable users to initiate firmware updates using sysfs"
220 select FW_LOADER_SYSFS
221 select FW_LOADER_PAGED_BUF
223 Enabling this option will allow device drivers to expose a persistent
224 sysfs interface that allows firmware updates to be initiated from
225 userspace. For example, FPGA based PCIe cards load firmware and FPGA
226 images from local FLASH when the card boots. The images in FLASH may
227 be updated with new images provided by the user. Enable this device
228 to support cards that rely on user-initiated updates for firmware files.