1*06bfd3c8SLuis R. Rodriguezmenu "Firmware loader" 2*06bfd3c8SLuis R. Rodriguez 3*06bfd3c8SLuis R. Rodriguezconfig FW_LOADER 4*06bfd3c8SLuis R. Rodriguez tristate "Firmware loading facility" if EXPERT 5*06bfd3c8SLuis R. Rodriguez default y 6*06bfd3c8SLuis R. Rodriguez help 7*06bfd3c8SLuis R. Rodriguez This enables the firmware loading facility in the kernel. The kernel 8*06bfd3c8SLuis R. Rodriguez will first look for built-in firmware, if it has any. Next, it will 9*06bfd3c8SLuis R. Rodriguez look for the requested firmware in a series of filesystem paths: 10*06bfd3c8SLuis R. Rodriguez 11*06bfd3c8SLuis R. Rodriguez o firmware_class path module parameter or kernel boot param 12*06bfd3c8SLuis R. Rodriguez o /lib/firmware/updates/UTS_RELEASE 13*06bfd3c8SLuis R. Rodriguez o /lib/firmware/updates 14*06bfd3c8SLuis R. Rodriguez o /lib/firmware/UTS_RELEASE 15*06bfd3c8SLuis R. Rodriguez o /lib/firmware 16*06bfd3c8SLuis R. Rodriguez 17*06bfd3c8SLuis R. Rodriguez Enabling this feature only increases your kernel image by about 18*06bfd3c8SLuis R. Rodriguez 828 bytes, enable this option unless you are certain you don't 19*06bfd3c8SLuis R. Rodriguez need firmware. 20*06bfd3c8SLuis R. Rodriguez 21*06bfd3c8SLuis R. Rodriguez You typically want this built-in (=y) but you can also enable this 22*06bfd3c8SLuis R. Rodriguez as a module, in which case the firmware_class module will be built. 23*06bfd3c8SLuis R. Rodriguez You also want to be sure to enable this built-in if you are going to 24*06bfd3c8SLuis R. Rodriguez enable built-in firmware (CONFIG_EXTRA_FIRMWARE). 25*06bfd3c8SLuis R. Rodriguez 26*06bfd3c8SLuis R. Rodriguezif FW_LOADER 27*06bfd3c8SLuis R. Rodriguez 28*06bfd3c8SLuis R. Rodriguezconfig EXTRA_FIRMWARE 29*06bfd3c8SLuis R. Rodriguez string "Build named firmware blobs into the kernel binary" 30*06bfd3c8SLuis R. Rodriguez help 31*06bfd3c8SLuis R. Rodriguez Device drivers which require firmware can typically deal with 32*06bfd3c8SLuis R. Rodriguez having the kernel load firmware from the various supported 33*06bfd3c8SLuis R. Rodriguez /lib/firmware/ paths. This option enables you to build into the 34*06bfd3c8SLuis R. Rodriguez kernel firmware files. Built-in firmware searches are preceded 35*06bfd3c8SLuis R. Rodriguez over firmware lookups using your filesystem over the supported 36*06bfd3c8SLuis R. Rodriguez /lib/firmware paths documented on CONFIG_FW_LOADER. 37*06bfd3c8SLuis R. Rodriguez 38*06bfd3c8SLuis R. Rodriguez This may be useful for testing or if the firmware is required early on 39*06bfd3c8SLuis R. Rodriguez in boot and cannot rely on the firmware being placed in an initrd or 40*06bfd3c8SLuis R. Rodriguez initramfs. 41*06bfd3c8SLuis R. Rodriguez 42*06bfd3c8SLuis R. Rodriguez This option is a string and takes the (space-separated) names of the 43*06bfd3c8SLuis R. Rodriguez firmware files -- the same names that appear in MODULE_FIRMWARE() 44*06bfd3c8SLuis R. Rodriguez and request_firmware() in the source. These files should exist under 45*06bfd3c8SLuis R. Rodriguez the directory specified by the EXTRA_FIRMWARE_DIR option, which is 46*06bfd3c8SLuis R. Rodriguez /lib/firmware by default. 47*06bfd3c8SLuis R. Rodriguez 48*06bfd3c8SLuis R. Rodriguez For example, you might set CONFIG_EXTRA_FIRMWARE="usb8388.bin", copy 49*06bfd3c8SLuis R. Rodriguez the usb8388.bin file into /lib/firmware, and build the kernel. Then 50*06bfd3c8SLuis R. Rodriguez any request_firmware("usb8388.bin") will be satisfied internally 51*06bfd3c8SLuis R. Rodriguez inside the kernel without ever looking at your filesystem at runtime. 52*06bfd3c8SLuis R. Rodriguez 53*06bfd3c8SLuis R. Rodriguez WARNING: If you include additional firmware files into your binary 54*06bfd3c8SLuis R. Rodriguez kernel image that are not available under the terms of the GPL, 55*06bfd3c8SLuis R. Rodriguez then it may be a violation of the GPL to distribute the resulting 56*06bfd3c8SLuis R. Rodriguez image since it combines both GPL and non-GPL work. You should 57*06bfd3c8SLuis R. Rodriguez consult a lawyer of your own before distributing such an image. 58*06bfd3c8SLuis R. Rodriguez 59*06bfd3c8SLuis R. Rodriguezconfig EXTRA_FIRMWARE_DIR 60*06bfd3c8SLuis R. Rodriguez string "Firmware blobs root directory" 61*06bfd3c8SLuis R. Rodriguez depends on EXTRA_FIRMWARE != "" 62*06bfd3c8SLuis R. Rodriguez default "/lib/firmware" 63*06bfd3c8SLuis R. Rodriguez help 64*06bfd3c8SLuis R. Rodriguez This option controls the directory in which the kernel build system 65*06bfd3c8SLuis R. Rodriguez looks for the firmware files listed in the EXTRA_FIRMWARE option. 66*06bfd3c8SLuis R. Rodriguez 67*06bfd3c8SLuis R. Rodriguezconfig FW_LOADER_USER_HELPER 68*06bfd3c8SLuis R. Rodriguez bool "Enable the firmware sysfs fallback mechanism" 69*06bfd3c8SLuis R. Rodriguez help 70*06bfd3c8SLuis R. Rodriguez This option enables a sysfs loading facility to enable firmware 71*06bfd3c8SLuis R. Rodriguez loading to the kernel through userspace as a fallback mechanism 72*06bfd3c8SLuis R. Rodriguez if and only if the kernel's direct filesystem lookup for the 73*06bfd3c8SLuis R. Rodriguez firmware failed using the different /lib/firmware/ paths, or the 74*06bfd3c8SLuis R. Rodriguez path specified in the firmware_class path module parameter, or the 75*06bfd3c8SLuis R. Rodriguez firmware_class path kernel boot parameter if the firmware_class is 76*06bfd3c8SLuis R. Rodriguez built-in. For details on how to work with the sysfs fallback mechanism 77*06bfd3c8SLuis R. Rodriguez refer to Documentation/driver-api/firmware/fallback-mechanisms.rst. 78*06bfd3c8SLuis R. Rodriguez 79*06bfd3c8SLuis R. Rodriguez The direct filesystem lookup for firmware is always used first now. 80*06bfd3c8SLuis R. Rodriguez 81*06bfd3c8SLuis R. Rodriguez If the kernel's direct filesystem lookup for firmware fails to find 82*06bfd3c8SLuis R. Rodriguez the requested firmware a sysfs fallback loading facility is made 83*06bfd3c8SLuis R. Rodriguez available and userspace is informed about this through uevents. 84*06bfd3c8SLuis R. Rodriguez The uevent can be suppressed if the driver explicitly requested it, 85*06bfd3c8SLuis R. Rodriguez this is known as the driver using the custom fallback mechanism. 86*06bfd3c8SLuis R. Rodriguez If the custom fallback mechanism is used userspace must always 87*06bfd3c8SLuis R. Rodriguez acknowledge failure to find firmware as the timeout for the fallback 88*06bfd3c8SLuis R. Rodriguez mechanism is disabled, and failed requests will linger forever. 89*06bfd3c8SLuis R. Rodriguez 90*06bfd3c8SLuis R. Rodriguez This used to be the default firmware loading facility, and udev used 91*06bfd3c8SLuis R. Rodriguez to listen for uvents to load firmware for the kernel. The firmware 92*06bfd3c8SLuis R. Rodriguez loading facility functionality in udev has been removed, as such it 93*06bfd3c8SLuis R. Rodriguez can no longer be relied upon as a fallback mechanism. Linux no longer 94*06bfd3c8SLuis R. Rodriguez relies on or uses a fallback mechanism in userspace. If you need to 95*06bfd3c8SLuis R. Rodriguez rely on one refer to the permissively licensed firmwared: 96*06bfd3c8SLuis R. Rodriguez 97*06bfd3c8SLuis R. Rodriguez https://github.com/teg/firmwared 98*06bfd3c8SLuis R. Rodriguez 99*06bfd3c8SLuis R. Rodriguez Since this was the default firmware loading facility at one point, 100*06bfd3c8SLuis R. Rodriguez old userspace may exist which relies upon it, and as such this 101*06bfd3c8SLuis R. Rodriguez mechanism can never be removed from the kernel. 102*06bfd3c8SLuis R. Rodriguez 103*06bfd3c8SLuis R. Rodriguez You should only enable this functionality if you are certain you 104*06bfd3c8SLuis R. Rodriguez require a fallback mechanism and have a userspace mechanism ready to 105*06bfd3c8SLuis R. Rodriguez load firmware in case it is not found. One main reason for this may 106*06bfd3c8SLuis R. Rodriguez be if you have drivers which require firmware built-in and for 107*06bfd3c8SLuis R. Rodriguez whatever reason cannot place the required firmware in initramfs. 108*06bfd3c8SLuis R. Rodriguez Another reason kernels may have this feature enabled is to support a 109*06bfd3c8SLuis R. Rodriguez driver which explicitly relies on this fallback mechanism. Only two 110*06bfd3c8SLuis R. Rodriguez drivers need this today: 111*06bfd3c8SLuis R. Rodriguez 112*06bfd3c8SLuis R. Rodriguez o CONFIG_LEDS_LP55XX_COMMON 113*06bfd3c8SLuis R. Rodriguez o CONFIG_DELL_RBU 114*06bfd3c8SLuis R. Rodriguez 115*06bfd3c8SLuis R. Rodriguez Outside of supporting the above drivers, another reason for needing 116*06bfd3c8SLuis R. Rodriguez this may be that your firmware resides outside of the paths the kernel 117*06bfd3c8SLuis R. Rodriguez looks for and cannot possibly be specified using the firmware_class 118*06bfd3c8SLuis R. Rodriguez path module parameter or kernel firmware_class path boot parameter 119*06bfd3c8SLuis R. Rodriguez if firmware_class is built-in. 120*06bfd3c8SLuis R. Rodriguez 121*06bfd3c8SLuis R. Rodriguez A modern use case may be to temporarily mount a custom partition 122*06bfd3c8SLuis R. Rodriguez during provisioning which is only accessible to userspace, and then 123*06bfd3c8SLuis R. Rodriguez to use it to look for and fetch the required firmware. Such type of 124*06bfd3c8SLuis R. Rodriguez driver functionality may not even ever be desirable upstream by 125*06bfd3c8SLuis R. Rodriguez vendors, and as such is only required to be supported as an interface 126*06bfd3c8SLuis R. Rodriguez for provisioning. Since udev's firmware loading facility has been 127*06bfd3c8SLuis R. Rodriguez removed you can use firmwared or a fork of it to customize how you 128*06bfd3c8SLuis R. Rodriguez want to load firmware based on uevents issued. 129*06bfd3c8SLuis R. Rodriguez 130*06bfd3c8SLuis R. Rodriguez Enabling this option will increase your kernel image size by about 131*06bfd3c8SLuis R. Rodriguez 13436 bytes. 132*06bfd3c8SLuis R. Rodriguez 133*06bfd3c8SLuis R. Rodriguez If you are unsure about this, say N here, unless you are Linux 134*06bfd3c8SLuis R. Rodriguez distribution and need to support the above two drivers, or you are 135*06bfd3c8SLuis R. Rodriguez certain you need to support some really custom firmware loading 136*06bfd3c8SLuis R. Rodriguez facility in userspace. 137*06bfd3c8SLuis R. Rodriguez 138*06bfd3c8SLuis R. Rodriguezconfig FW_LOADER_USER_HELPER_FALLBACK 139*06bfd3c8SLuis R. Rodriguez bool "Force the firmware sysfs fallback mechanism when possible" 140*06bfd3c8SLuis R. Rodriguez depends on FW_LOADER_USER_HELPER 141*06bfd3c8SLuis R. Rodriguez help 142*06bfd3c8SLuis R. Rodriguez Enabling this option forces a sysfs userspace fallback mechanism 143*06bfd3c8SLuis R. Rodriguez to be used for all firmware requests which explicitly do not disable a 144*06bfd3c8SLuis R. Rodriguez a fallback mechanism. Firmware calls which do prohibit a fallback 145*06bfd3c8SLuis R. Rodriguez mechanism is request_firmware_direct(). This option is kept for 146*06bfd3c8SLuis R. Rodriguez backward compatibility purposes given this precise mechanism can also 147*06bfd3c8SLuis R. Rodriguez be enabled by setting the proc sysctl value to true: 148*06bfd3c8SLuis R. Rodriguez 149*06bfd3c8SLuis R. Rodriguez /proc/sys/kernel/firmware_config/force_sysfs_fallback 150*06bfd3c8SLuis R. Rodriguez 151*06bfd3c8SLuis R. Rodriguez If you are unsure about this, say N here. 152*06bfd3c8SLuis R. Rodriguez 153*06bfd3c8SLuis R. Rodriguezendif # FW_LOADER 154*06bfd3c8SLuis R. Rodriguezendmenu 155