Kconfig 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. # SPDX-License-Identifier: GPL-2.0
  2. menu "Firmware loader"
  3. config FW_LOADER
  4. tristate "Firmware loading facility" if EXPERT
  5. select CRYPTO_LIB_SHA256 if FW_LOADER_DEBUG
  6. default y
  7. help
  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:
  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. Enabling this feature only increases your kernel image by about
  17. 828 bytes, enable this option unless you are certain you don't
  18. need firmware.
  19. You typically want this built-in (=y) but you can also enable this
  20. as a module, in which case the firmware_class module will be built.
  21. You also want to be sure to enable this built-in if you are going to
  22. enable built-in firmware (CONFIG_EXTRA_FIRMWARE).
  23. config FW_LOADER_DEBUG
  24. bool "Log filenames and checksums for loaded firmware"
  25. depends on DYNAMIC_DEBUG
  26. depends on FW_LOADER
  27. default FW_LOADER
  28. help
  29. Select this option to use dynamic debug to log firmware filenames and
  30. SHA256 checksums to the kernel log for each firmware file that is
  31. loaded.
  32. config RUST_FW_LOADER_ABSTRACTIONS
  33. bool "Rust Firmware Loader abstractions"
  34. depends on RUST
  35. select FW_LOADER
  36. help
  37. This enables the Rust abstractions for the firmware loader API.
  38. if FW_LOADER
  39. config FW_LOADER_PAGED_BUF
  40. bool
  41. config FW_LOADER_SYSFS
  42. bool
  43. config EXTRA_FIRMWARE
  44. string "Build named firmware blobs into the kernel binary"
  45. help
  46. Device drivers which require firmware can typically deal with
  47. having the kernel load firmware from the various supported
  48. /lib/firmware/ paths. This option enables you to build into the
  49. kernel firmware files. Built-in firmware searches are preceded
  50. over firmware lookups using your filesystem over the supported
  51. /lib/firmware paths documented on CONFIG_FW_LOADER.
  52. This may be useful for testing or if the firmware is required early on
  53. in boot and cannot rely on the firmware being placed in an initrd or
  54. initramfs.
  55. This option is a string and takes the (space-separated) names of the
  56. firmware files -- the same names that appear in MODULE_FIRMWARE()
  57. and request_firmware() in the source. These files should exist under
  58. the directory specified by the EXTRA_FIRMWARE_DIR option, which is
  59. /lib/firmware by default.
  60. For example, you might set CONFIG_EXTRA_FIRMWARE="usb8388.bin", copy
  61. the usb8388.bin file into /lib/firmware, and build the kernel. Then
  62. any request_firmware("usb8388.bin") will be satisfied internally
  63. inside the kernel without ever looking at your filesystem at runtime.
  64. WARNING: If you include additional firmware files into your binary
  65. kernel image that are not available under the terms of the GPL,
  66. then it may be a violation of the GPL to distribute the resulting
  67. image since it combines both GPL and non-GPL work. You should
  68. consult a lawyer of your own before distributing such an image.
  69. NOTE: Compressed files are not supported in EXTRA_FIRMWARE.
  70. config EXTRA_FIRMWARE_DIR
  71. string "Firmware blobs root directory"
  72. depends on EXTRA_FIRMWARE != ""
  73. default "/lib/firmware"
  74. help
  75. This option controls the directory in which the kernel build system
  76. looks for the firmware files listed in the EXTRA_FIRMWARE option.
  77. config FW_LOADER_USER_HELPER
  78. bool "Enable the firmware sysfs fallback mechanism"
  79. select FW_LOADER_SYSFS
  80. select FW_LOADER_PAGED_BUF
  81. help
  82. This option enables a sysfs loading facility to enable firmware
  83. loading to the kernel through userspace as a fallback mechanism
  84. if and only if the kernel's direct filesystem lookup for the
  85. firmware failed using the different /lib/firmware/ paths, or the
  86. path specified in the firmware_class path module parameter, or the
  87. firmware_class path kernel boot parameter if the firmware_class is
  88. built-in. For details on how to work with the sysfs fallback mechanism
  89. refer to Documentation/driver-api/firmware/fallback-mechanisms.rst.
  90. The direct filesystem lookup for firmware is always used first now.
  91. If the kernel's direct filesystem lookup for firmware fails to find
  92. the requested firmware a sysfs fallback loading facility is made
  93. available and userspace is informed about this through uevents.
  94. The uevent can be suppressed if the driver explicitly requested it,
  95. this is known as the driver using the custom fallback mechanism.
  96. If the custom fallback mechanism is used userspace must always
  97. acknowledge failure to find firmware as the timeout for the fallback
  98. mechanism is disabled, and failed requests will linger forever.
  99. This used to be the default firmware loading facility, and udev used
  100. to listen for uvents to load firmware for the kernel. The firmware
  101. loading facility functionality in udev has been removed, as such it
  102. can no longer be relied upon as a fallback mechanism. Linux no longer
  103. relies on or uses a fallback mechanism in userspace. If you need to
  104. rely on one refer to the permissively licensed firmwared:
  105. 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.
  109. You should only enable this functionality if you are certain you
  110. require a fallback mechanism and have a userspace mechanism ready to
  111. load firmware in case it is not found. One main reason for this may
  112. be if you have drivers which require firmware built-in and for
  113. whatever reason cannot place the required firmware in initramfs.
  114. Another reason kernels may have this feature enabled is to support a
  115. driver which explicitly relies on this fallback mechanism. Only two
  116. drivers need this today:
  117. o CONFIG_LEDS_LP55XX_COMMON
  118. o CONFIG_DELL_RBU
  119. Outside of supporting the above drivers, another reason for needing
  120. this may be that your firmware resides outside of the paths the kernel
  121. looks for and cannot possibly be specified using the firmware_class
  122. path module parameter or kernel firmware_class path boot parameter
  123. if firmware_class is built-in.
  124. A modern use case may be to temporarily mount a custom partition
  125. during provisioning which is only accessible to userspace, and then
  126. to use it to look for and fetch the required firmware. Such type of
  127. driver functionality may not even ever be desirable upstream by
  128. vendors, and as such is only required to be supported as an interface
  129. for provisioning. Since udev's firmware loading facility has been
  130. removed you can use firmwared or a fork of it to customize how you
  131. want to load firmware based on uevents issued.
  132. Enabling this option will increase your kernel image size by about
  133. 13436 bytes.
  134. If you are unsure about this, say N here, unless you are Linux
  135. distribution and need to support the above two drivers, or you are
  136. certain you need to support some really custom firmware loading
  137. facility in userspace.
  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. /proc/sys/kernel/firmware_config/force_sysfs_fallback
  149. If you are unsure about this, say N here.
  150. config FW_LOADER_COMPRESS
  151. bool "Enable compressed firmware support"
  152. help
  153. This option enables the support for loading compressed firmware
  154. files. The caller of firmware API receives the decompressed file
  155. content. The compressed file is loaded as a fallback, only after
  156. loading the raw file failed at first.
  157. Compressed firmware support does not apply to firmware images
  158. that are built into the kernel image (CONFIG_EXTRA_FIRMWARE).
  159. if FW_LOADER_COMPRESS
  160. config FW_LOADER_COMPRESS_XZ
  161. bool "Enable XZ-compressed firmware support"
  162. select FW_LOADER_PAGED_BUF
  163. select XZ_DEC
  164. default y
  165. help
  166. This option adds the support for XZ-compressed files.
  167. The files have to be compressed with either none or crc32
  168. integrity check type (pass "-C crc32" option to xz command).
  169. config FW_LOADER_COMPRESS_ZSTD
  170. bool "Enable ZSTD-compressed firmware support"
  171. select ZSTD_DECOMPRESS
  172. help
  173. This option adds the support for ZSTD-compressed files.
  174. endif # FW_LOADER_COMPRESS
  175. config FW_CACHE
  176. bool "Enable firmware caching during suspend"
  177. depends on PM_SLEEP
  178. default y if PM_SLEEP
  179. help
  180. Because firmware caching generates uevent messages that are sent
  181. over a netlink socket, it can prevent suspend on many platforms.
  182. It is also not always useful, so on such platforms we have the
  183. option.
  184. If unsure, say Y.
  185. config FW_UPLOAD
  186. bool "Enable users to initiate firmware updates using sysfs"
  187. select FW_LOADER_SYSFS
  188. select FW_LOADER_PAGED_BUF
  189. help
  190. Enabling this option will allow device drivers to expose a persistent
  191. sysfs interface that allows firmware updates to be initiated from
  192. userspace. For example, FPGA based PCIe cards load firmware and FPGA
  193. images from local FLASH when the card boots. The images in FLASH may
  194. be updated with new images provided by the user. Enable this device
  195. to support cards that rely on user-initiated updates for firmware files.
  196. If unsure, say N.
  197. endif # FW_LOADER
  198. endmenu