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).
29 config FW_LOADER_PAGED_BUF
33 string "Build named firmware blobs into the kernel binary"
35 Device drivers which require firmware can typically deal with
36 having the kernel load firmware from the various supported
37 /lib/firmware/ paths. This option enables you to build into the
38 kernel firmware files. Built-in firmware searches are preceded
39 over firmware lookups using your filesystem over the supported
40 /lib/firmware paths documented on CONFIG_FW_LOADER.
42 This may be useful for testing or if the firmware is required early on
43 in boot and cannot rely on the firmware being placed in an initrd or
46 This option is a string and takes the (space-separated) names of the
47 firmware files -- the same names that appear in MODULE_FIRMWARE()
48 and request_firmware() in the source. These files should exist under
49 the directory specified by the EXTRA_FIRMWARE_DIR option, which is
50 /lib/firmware by default.
52 For example, you might set CONFIG_EXTRA_FIRMWARE="usb8388.bin", copy
53 the usb8388.bin file into /lib/firmware, and build the kernel. Then
54 any request_firmware("usb8388.bin") will be satisfied internally
55 inside the kernel without ever looking at your filesystem at runtime.
57 WARNING: If you include additional firmware files into your binary
58 kernel image that are not available under the terms of the GPL,
59 then it may be a violation of the GPL to distribute the resulting
60 image since it combines both GPL and non-GPL work. You should
61 consult a lawyer of your own before distributing such an image.
63 NOTE: Compressed files are not supported in EXTRA_FIRMWARE.
65 config EXTRA_FIRMWARE_DIR
66 string "Firmware blobs root directory"
67 depends on EXTRA_FIRMWARE != ""
68 default "/lib/firmware"
70 This option controls the directory in which the kernel build system
71 looks for the firmware files listed in the EXTRA_FIRMWARE option.
73 config FW_LOADER_USER_HELPER
74 bool "Enable the firmware sysfs fallback mechanism"
75 select FW_LOADER_PAGED_BUF
77 This option enables a sysfs loading facility to enable firmware
78 loading to the kernel through userspace as a fallback mechanism
79 if and only if the kernel's direct filesystem lookup for the
80 firmware failed using the different /lib/firmware/ paths, or the
81 path specified in the firmware_class path module parameter, or the
82 firmware_class path kernel boot parameter if the firmware_class is
83 built-in. For details on how to work with the sysfs fallback mechanism
84 refer to Documentation/driver-api/firmware/fallback-mechanisms.rst.
86 The direct filesystem lookup for firmware is always used first now.
88 If the kernel's direct filesystem lookup for firmware fails to find
89 the requested firmware a sysfs fallback loading facility is made
90 available and userspace is informed about this through uevents.
91 The uevent can be suppressed if the driver explicitly requested it,
92 this is known as the driver using the custom fallback mechanism.
93 If the custom fallback mechanism is used userspace must always
94 acknowledge failure to find firmware as the timeout for the fallback
95 mechanism is disabled, and failed requests will linger forever.
97 This used to be the default firmware loading facility, and udev used
98 to listen for uvents to load firmware for the kernel. The firmware
99 loading facility functionality in udev has been removed, as such it
100 can no longer be relied upon as a fallback mechanism. Linux no longer
101 relies on or uses a fallback mechanism in userspace. If you need to
102 rely on one refer to the permissively licensed firmwared:
104 https://github.com/teg/firmwared
106 Since this was the default firmware loading facility at one point,
107 old userspace may exist which relies upon it, and as such this
108 mechanism can never be removed from the kernel.
110 You should only enable this functionality if you are certain you
111 require a fallback mechanism and have a userspace mechanism ready to
112 load firmware in case it is not found. One main reason for this may
113 be if you have drivers which require firmware built-in and for
114 whatever reason cannot place the required firmware in initramfs.
115 Another reason kernels may have this feature enabled is to support a
116 driver which explicitly relies on this fallback mechanism. Only two
117 drivers need this today:
119 o CONFIG_LEDS_LP55XX_COMMON
122 Outside of supporting the above drivers, another reason for needing
123 this may be that your firmware resides outside of the paths the kernel
124 looks for and cannot possibly be specified using the firmware_class
125 path module parameter or kernel firmware_class path boot parameter
126 if firmware_class is built-in.
128 A modern use case may be to temporarily mount a custom partition
129 during provisioning which is only accessible to userspace, and then
130 to use it to look for and fetch the required firmware. Such type of
131 driver functionality may not even ever be desirable upstream by
132 vendors, and as such is only required to be supported as an interface
133 for provisioning. Since udev's firmware loading facility has been
134 removed you can use firmwared or a fork of it to customize how you
135 want to load firmware based on uevents issued.
137 Enabling this option will increase your kernel image size by about
140 If you are unsure about this, say N here, unless you are Linux
141 distribution and need to support the above two drivers, or you are
142 certain you need to support some really custom firmware loading
143 facility in userspace.
145 config FW_LOADER_USER_HELPER_FALLBACK
146 bool "Force the firmware sysfs fallback mechanism when possible"
147 depends on FW_LOADER_USER_HELPER
149 Enabling this option forces a sysfs userspace fallback mechanism
150 to be used for all firmware requests which explicitly do not disable a
151 a fallback mechanism. Firmware calls which do prohibit a fallback
152 mechanism is request_firmware_direct(). This option is kept for
153 backward compatibility purposes given this precise mechanism can also
154 be enabled by setting the proc sysctl value to true:
156 /proc/sys/kernel/firmware_config/force_sysfs_fallback
158 If you are unsure about this, say N here.
160 config FW_LOADER_COMPRESS
161 bool "Enable compressed firmware support"
162 select FW_LOADER_PAGED_BUF
165 This option enables the support for loading compressed firmware
166 files. The caller of firmware API receives the decompressed file
167 content. The compressed file is loaded as a fallback, only after
168 loading the raw file failed at first.
170 Currently only XZ-compressed files are supported, and they have to
171 be compressed with either none or crc32 integrity check type (pass
172 "-C crc32" option to xz command).
174 Compressed firmware support does not apply to firmware images
175 that are built into the kernel image (CONFIG_EXTRA_FIRMWARE).
178 bool "Enable firmware caching during suspend"
180 default y if PM_SLEEP
182 Because firmware caching generates uevent messages that are sent
183 over a netlink socket, it can prevent suspend on many platforms.
184 It is also not always useful, so on such platforms we have the