Kconfig 9.6 KB

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