Kconfig 9.0 KB

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