diff options
author | Luis R. Rodriguez <mcgrof@kernel.org> | 2018-05-10 16:08:43 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-14 10:43:10 -0400 |
commit | 06bfd3c8ab1dbf0031022d056a90ace682f6a94c (patch) | |
tree | a6c78d27080044f797fd56411bb007c8f1ef53e0 | |
parent | 367d09824193e5a9aea98490ae0506cec8abe9c4 (diff) |
firmware_loader: move kconfig FW_LOADER entries to its own file
This will make it easier to track and easier to understand
what components and features are part of the FW_LOADER. There
are some components related to firmware which have *nothing* to
do with the FW_LOADER, souch as PREVENT_FIRMWARE_BUILD.
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/base/Kconfig | 155 | ||||
-rw-r--r-- | drivers/base/firmware_loader/Kconfig | 154 |
2 files changed, 155 insertions, 154 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 0c38df32c7fe..3e63a900b330 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig | |||
@@ -88,160 +88,7 @@ config PREVENT_FIRMWARE_BUILD | |||
88 | o CONFIG_WANXL through CONFIG_WANXL_BUILD_FIRMWARE | 88 | o CONFIG_WANXL through CONFIG_WANXL_BUILD_FIRMWARE |
89 | o CONFIG_SCSI_AIC79XX through CONFIG_AIC79XX_BUILD_FIRMWARE | 89 | o CONFIG_SCSI_AIC79XX through CONFIG_AIC79XX_BUILD_FIRMWARE |
90 | 90 | ||
91 | menu "Firmware loader" | 91 | source "drivers/base/firmware_loader/Kconfig" |
92 | |||
93 | config FW_LOADER | ||
94 | tristate "Firmware loading facility" if EXPERT | ||
95 | default y | ||
96 | help | ||
97 | This enables the firmware loading facility in the kernel. The kernel | ||
98 | will first look for built-in firmware, if it has any. Next, it will | ||
99 | look for the requested firmware in a series of filesystem paths: | ||
100 | |||
101 | o firmware_class path module parameter or kernel boot param | ||
102 | o /lib/firmware/updates/UTS_RELEASE | ||
103 | o /lib/firmware/updates | ||
104 | o /lib/firmware/UTS_RELEASE | ||
105 | o /lib/firmware | ||
106 | |||
107 | Enabling this feature only increases your kernel image by about | ||
108 | 828 bytes, enable this option unless you are certain you don't | ||
109 | need firmware. | ||
110 | |||
111 | You typically want this built-in (=y) but you can also enable this | ||
112 | as a module, in which case the firmware_class module will be built. | ||
113 | You also want to be sure to enable this built-in if you are going to | ||
114 | enable built-in firmware (CONFIG_EXTRA_FIRMWARE). | ||
115 | |||
116 | if FW_LOADER | ||
117 | |||
118 | config EXTRA_FIRMWARE | ||
119 | string "Build named firmware blobs into the kernel binary" | ||
120 | help | ||
121 | Device drivers which require firmware can typically deal with | ||
122 | having the kernel load firmware from the various supported | ||
123 | /lib/firmware/ paths. This option enables you to build into the | ||
124 | kernel firmware files. Built-in firmware searches are preceded | ||
125 | over firmware lookups using your filesystem over the supported | ||
126 | /lib/firmware paths documented on CONFIG_FW_LOADER. | ||
127 | |||
128 | This may be useful for testing or if the firmware is required early on | ||
129 | in boot and cannot rely on the firmware being placed in an initrd or | ||
130 | initramfs. | ||
131 | |||
132 | This option is a string and takes the (space-separated) names of the | ||
133 | firmware files -- the same names that appear in MODULE_FIRMWARE() | ||
134 | and request_firmware() in the source. These files should exist under | ||
135 | the directory specified by the EXTRA_FIRMWARE_DIR option, which is | ||
136 | /lib/firmware by default. | ||
137 | |||
138 | For example, you might set CONFIG_EXTRA_FIRMWARE="usb8388.bin", copy | ||
139 | the usb8388.bin file into /lib/firmware, and build the kernel. Then | ||
140 | any request_firmware("usb8388.bin") will be satisfied internally | ||
141 | inside the kernel without ever looking at your filesystem at runtime. | ||
142 | |||
143 | WARNING: If you include additional firmware files into your binary | ||
144 | kernel image that are not available under the terms of the GPL, | ||
145 | then it may be a violation of the GPL to distribute the resulting | ||
146 | image since it combines both GPL and non-GPL work. You should | ||
147 | consult a lawyer of your own before distributing such an image. | ||
148 | |||
149 | config EXTRA_FIRMWARE_DIR | ||
150 | string "Firmware blobs root directory" | ||
151 | depends on EXTRA_FIRMWARE != "" | ||
152 | default "/lib/firmware" | ||
153 | help | ||
154 | This option controls the directory in which the kernel build system | ||
155 | looks for the firmware files listed in the EXTRA_FIRMWARE option. | ||
156 | |||
157 | config FW_LOADER_USER_HELPER | ||
158 | bool "Enable the firmware sysfs fallback mechanism" | ||
159 | help | ||
160 | This option enables a sysfs loading facility to enable firmware | ||
161 | loading to the kernel through userspace as a fallback mechanism | ||
162 | if and only if the kernel's direct filesystem lookup for the | ||
163 | firmware failed using the different /lib/firmware/ paths, or the | ||
164 | path specified in the firmware_class path module parameter, or the | ||
165 | firmware_class path kernel boot parameter if the firmware_class is | ||
166 | built-in. For details on how to work with the sysfs fallback mechanism | ||
167 | refer to Documentation/driver-api/firmware/fallback-mechanisms.rst. | ||
168 | |||
169 | The direct filesystem lookup for firmware is always used first now. | ||
170 | |||
171 | If the kernel's direct filesystem lookup for firmware fails to find | ||
172 | the requested firmware a sysfs fallback loading facility is made | ||
173 | available and userspace is informed about this through uevents. | ||
174 | The uevent can be suppressed if the driver explicitly requested it, | ||
175 | this is known as the driver using the custom fallback mechanism. | ||
176 | If the custom fallback mechanism is used userspace must always | ||
177 | acknowledge failure to find firmware as the timeout for the fallback | ||
178 | mechanism is disabled, and failed requests will linger forever. | ||
179 | |||
180 | This used to be the default firmware loading facility, and udev used | ||
181 | to listen for uvents to load firmware for the kernel. The firmware | ||
182 | loading facility functionality in udev has been removed, as such it | ||
183 | can no longer be relied upon as a fallback mechanism. Linux no longer | ||
184 | relies on or uses a fallback mechanism in userspace. If you need to | ||
185 | rely on one refer to the permissively licensed firmwared: | ||
186 | |||
187 | https://github.com/teg/firmwared | ||
188 | |||
189 | Since this was the default firmware loading facility at one point, | ||
190 | old userspace may exist which relies upon it, and as such this | ||
191 | mechanism can never be removed from the kernel. | ||
192 | |||
193 | You should only enable this functionality if you are certain you | ||
194 | require a fallback mechanism and have a userspace mechanism ready to | ||
195 | load firmware in case it is not found. One main reason for this may | ||
196 | be if you have drivers which require firmware built-in and for | ||
197 | whatever reason cannot place the required firmware in initramfs. | ||
198 | Another reason kernels may have this feature enabled is to support a | ||
199 | driver which explicitly relies on this fallback mechanism. Only two | ||
200 | drivers need this today: | ||
201 | |||
202 | o CONFIG_LEDS_LP55XX_COMMON | ||
203 | o CONFIG_DELL_RBU | ||
204 | |||
205 | Outside of supporting the above drivers, another reason for needing | ||
206 | this may be that your firmware resides outside of the paths the kernel | ||
207 | looks for and cannot possibly be specified using the firmware_class | ||
208 | path module parameter or kernel firmware_class path boot parameter | ||
209 | if firmware_class is built-in. | ||
210 | |||
211 | A modern use case may be to temporarily mount a custom partition | ||
212 | during provisioning which is only accessible to userspace, and then | ||
213 | to use it to look for and fetch the required firmware. Such type of | ||
214 | driver functionality may not even ever be desirable upstream by | ||
215 | vendors, and as such is only required to be supported as an interface | ||
216 | for provisioning. Since udev's firmware loading facility has been | ||
217 | removed you can use firmwared or a fork of it to customize how you | ||
218 | want to load firmware based on uevents issued. | ||
219 | |||
220 | Enabling this option will increase your kernel image size by about | ||
221 | 13436 bytes. | ||
222 | |||
223 | If you are unsure about this, say N here, unless you are Linux | ||
224 | distribution and need to support the above two drivers, or you are | ||
225 | certain you need to support some really custom firmware loading | ||
226 | facility in userspace. | ||
227 | |||
228 | config FW_LOADER_USER_HELPER_FALLBACK | ||
229 | bool "Force the firmware sysfs fallback mechanism when possible" | ||
230 | depends on FW_LOADER_USER_HELPER | ||
231 | help | ||
232 | Enabling this option forces a sysfs userspace fallback mechanism | ||
233 | to be used for all firmware requests which explicitly do not disable a | ||
234 | a fallback mechanism. Firmware calls which do prohibit a fallback | ||
235 | mechanism is request_firmware_direct(). This option is kept for | ||
236 | backward compatibility purposes given this precise mechanism can also | ||
237 | be enabled by setting the proc sysctl value to true: | ||
238 | |||
239 | /proc/sys/kernel/firmware_config/force_sysfs_fallback | ||
240 | |||
241 | If you are unsure about this, say N here. | ||
242 | |||
243 | endif # FW_LOADER | ||
244 | endmenu | ||
245 | 92 | ||
246 | config WANT_DEV_COREDUMP | 93 | config WANT_DEV_COREDUMP |
247 | bool | 94 | bool |
diff --git a/drivers/base/firmware_loader/Kconfig b/drivers/base/firmware_loader/Kconfig new file mode 100644 index 000000000000..eb15d976a9ea --- /dev/null +++ b/drivers/base/firmware_loader/Kconfig | |||
@@ -0,0 +1,154 @@ | |||
1 | menu "Firmware loader" | ||
2 | |||
3 | config FW_LOADER | ||
4 | tristate "Firmware loading facility" if EXPERT | ||
5 | default y | ||
6 | help | ||
7 | This enables the firmware loading facility in the kernel. The kernel | ||
8 | will first look for built-in firmware, if it has any. Next, it will | ||
9 | look for the requested firmware in a series of filesystem paths: | ||
10 | |||
11 | o firmware_class path module parameter or kernel boot param | ||
12 | o /lib/firmware/updates/UTS_RELEASE | ||
13 | o /lib/firmware/updates | ||
14 | o /lib/firmware/UTS_RELEASE | ||
15 | o /lib/firmware | ||
16 | |||
17 | Enabling this feature only increases your kernel image by about | ||
18 | 828 bytes, enable this option unless you are certain you don't | ||
19 | need firmware. | ||
20 | |||
21 | You typically want this built-in (=y) but you can also enable this | ||
22 | as a module, in which case the firmware_class module will be built. | ||
23 | You also want to be sure to enable this built-in if you are going to | ||
24 | enable built-in firmware (CONFIG_EXTRA_FIRMWARE). | ||
25 | |||
26 | if FW_LOADER | ||
27 | |||
28 | config EXTRA_FIRMWARE | ||
29 | string "Build named firmware blobs into the kernel binary" | ||
30 | help | ||
31 | Device drivers which require firmware can typically deal with | ||
32 | having the kernel load firmware from the various supported | ||
33 | /lib/firmware/ paths. This option enables you to build into the | ||
34 | kernel firmware files. Built-in firmware searches are preceded | ||
35 | over firmware lookups using your filesystem over the supported | ||
36 | /lib/firmware paths documented on CONFIG_FW_LOADER. | ||
37 | |||
38 | This may be useful for testing or if the firmware is required early on | ||
39 | in boot and cannot rely on the firmware being placed in an initrd or | ||
40 | initramfs. | ||
41 | |||
42 | This option is a string and takes the (space-separated) names of the | ||
43 | firmware files -- the same names that appear in MODULE_FIRMWARE() | ||
44 | and request_firmware() in the source. These files should exist under | ||
45 | the directory specified by the EXTRA_FIRMWARE_DIR option, which is | ||
46 | /lib/firmware by default. | ||
47 | |||
48 | For example, you might set CONFIG_EXTRA_FIRMWARE="usb8388.bin", copy | ||
49 | the usb8388.bin file into /lib/firmware, and build the kernel. Then | ||
50 | any request_firmware("usb8388.bin") will be satisfied internally | ||
51 | inside the kernel without ever looking at your filesystem at runtime. | ||
52 | |||
53 | WARNING: If you include additional firmware files into your binary | ||
54 | kernel image that are not available under the terms of the GPL, | ||
55 | then it may be a violation of the GPL to distribute the resulting | ||
56 | image since it combines both GPL and non-GPL work. You should | ||
57 | consult a lawyer of your own before distributing such an image. | ||
58 | |||
59 | config EXTRA_FIRMWARE_DIR | ||
60 | string "Firmware blobs root directory" | ||
61 | depends on EXTRA_FIRMWARE != "" | ||
62 | default "/lib/firmware" | ||
63 | help | ||
64 | This option controls the directory in which the kernel build system | ||
65 | looks for the firmware files listed in the EXTRA_FIRMWARE option. | ||
66 | |||
67 | config FW_LOADER_USER_HELPER | ||
68 | bool "Enable the firmware sysfs fallback mechanism" | ||
69 | help | ||
70 | This option enables a sysfs loading facility to enable firmware | ||
71 | loading to the kernel through userspace as a fallback mechanism | ||
72 | if and only if the kernel's direct filesystem lookup for the | ||
73 | firmware failed using the different /lib/firmware/ paths, or the | ||
74 | path specified in the firmware_class path module parameter, or the | ||
75 | firmware_class path kernel boot parameter if the firmware_class is | ||
76 | built-in. For details on how to work with the sysfs fallback mechanism | ||
77 | refer to Documentation/driver-api/firmware/fallback-mechanisms.rst. | ||
78 | |||
79 | The direct filesystem lookup for firmware is always used first now. | ||
80 | |||
81 | If the kernel's direct filesystem lookup for firmware fails to find | ||
82 | the requested firmware a sysfs fallback loading facility is made | ||
83 | available and userspace is informed about this through uevents. | ||
84 | The uevent can be suppressed if the driver explicitly requested it, | ||
85 | this is known as the driver using the custom fallback mechanism. | ||
86 | If the custom fallback mechanism is used userspace must always | ||
87 | acknowledge failure to find firmware as the timeout for the fallback | ||
88 | mechanism is disabled, and failed requests will linger forever. | ||
89 | |||
90 | This used to be the default firmware loading facility, and udev used | ||
91 | to listen for uvents to load firmware for the kernel. The firmware | ||
92 | loading facility functionality in udev has been removed, as such it | ||
93 | can no longer be relied upon as a fallback mechanism. Linux no longer | ||
94 | relies on or uses a fallback mechanism in userspace. If you need to | ||
95 | rely on one refer to the permissively licensed firmwared: | ||
96 | |||
97 | https://github.com/teg/firmwared | ||
98 | |||
99 | Since this was the default firmware loading facility at one point, | ||
100 | old userspace may exist which relies upon it, and as such this | ||
101 | mechanism can never be removed from the kernel. | ||
102 | |||
103 | You should only enable this functionality if you are certain you | ||
104 | require a fallback mechanism and have a userspace mechanism ready to | ||
105 | load firmware in case it is not found. One main reason for this may | ||
106 | be if you have drivers which require firmware built-in and for | ||
107 | whatever reason cannot place the required firmware in initramfs. | ||
108 | Another reason kernels may have this feature enabled is to support a | ||
109 | driver which explicitly relies on this fallback mechanism. Only two | ||
110 | drivers need this today: | ||
111 | |||
112 | o CONFIG_LEDS_LP55XX_COMMON | ||
113 | o CONFIG_DELL_RBU | ||
114 | |||
115 | Outside of supporting the above drivers, another reason for needing | ||
116 | this may be that your firmware resides outside of the paths the kernel | ||
117 | looks for and cannot possibly be specified using the firmware_class | ||
118 | path module parameter or kernel firmware_class path boot parameter | ||
119 | if firmware_class is built-in. | ||
120 | |||
121 | A modern use case may be to temporarily mount a custom partition | ||
122 | during provisioning which is only accessible to userspace, and then | ||
123 | to use it to look for and fetch the required firmware. Such type of | ||
124 | driver functionality may not even ever be desirable upstream by | ||
125 | vendors, and as such is only required to be supported as an interface | ||
126 | for provisioning. Since udev's firmware loading facility has been | ||
127 | removed you can use firmwared or a fork of it to customize how you | ||
128 | want to load firmware based on uevents issued. | ||
129 | |||
130 | Enabling this option will increase your kernel image size by about | ||
131 | 13436 bytes. | ||
132 | |||
133 | If you are unsure about this, say N here, unless you are Linux | ||
134 | distribution and need to support the above two drivers, or you are | ||
135 | certain you need to support some really custom firmware loading | ||
136 | facility in userspace. | ||
137 | |||
138 | config FW_LOADER_USER_HELPER_FALLBACK | ||
139 | bool "Force the firmware sysfs fallback mechanism when possible" | ||
140 | depends on FW_LOADER_USER_HELPER | ||
141 | help | ||
142 | Enabling this option forces a sysfs userspace fallback mechanism | ||
143 | to be used for all firmware requests which explicitly do not disable a | ||
144 | a fallback mechanism. Firmware calls which do prohibit a fallback | ||
145 | mechanism is request_firmware_direct(). This option is kept for | ||
146 | backward compatibility purposes given this precise mechanism can also | ||
147 | be enabled by setting the proc sysctl value to true: | ||
148 | |||
149 | /proc/sys/kernel/firmware_config/force_sysfs_fallback | ||
150 | |||
151 | If you are unsure about this, say N here. | ||
152 | |||
153 | endif # FW_LOADER | ||
154 | endmenu | ||