- Linux firmware
- Installation
- Kernel
- Kernels prior to v4.18
- Kernels v4.18 and higher
- USE flags
- USE flags for sys-kernel/linux-firmware Linux firmware files
- Emerge
- Optional: Savedconfig
- Optional: Compression
- Troubleshooting
- Searching for loaded firmware
- Removal
- Unmerge
- See also
- External resources
- References
- What is «firmware» in Linux terminology?
- What is linux-firmware when updating kernel?
Linux firmware
Linux firmware is a package distributed alongside the Linux kernel that contains firmware binary blobs necessary for partial or full functionality of certain hardware devices. These binary blobs are usually proprietary because some hardware manufacturers do not release source code necessary to build the firmware itself.
Modern graphics cards from AMD and NVIDIA almost certainly require binary blobs to be loaded for the hardware to operate correctly.
Starting at Broxton (a Skylake-based micro-architecture) Intel CPUs require binary blobs for additional low-power idle states (DMC), graphics workload scheduling on the various graphics parallel engines (GuC), and offloading some media functions from the CPU to GPU (HuC). [1]
Additionally, modern Intel Wi-Fi chipsets almost always require blobs. [2]
Installation
For security reasons, hotloading firmware into a running kernel has been shunned upon. Modern init systems such as systemd have strongly discouraged loading firmware from userspace.
Kernel
A few kernel options are important to consider when building in firmware support for certain devices in the Linux kernel:
Warning
Including firmware files into binary kernel images that are not available under the terms of the GPL, may result in a violation of the GPL if the image is distributed. It is wise to consult a lawyer before distributing images that contain firmware files from sys-kernel/linux-firmware.
Kernels prior to v4.18
For kernels released prior to version 4.18:
CONFIG_FIRMWARE_IN_KERNEL (DEPRECATED) Note this option has been removed as of versions v4.16 and above. [3] Enabling this option was previously necessary to build each required firmware blob specified by EXTRA_FIRMWARE into the kernel directly, where the request_firmware() function will find them without having to make a call out to userspace. On older kernels, it is necessary to enable it.
Device Drivers ---> Generic Driver Options ---> -*- Userspace firmware loading support [*] Include in-kernel firmware blobs in kernel binary (/lib/firmware) Firmware blobs root directory
Kernels v4.18 and higher
For kernels beginning with 4.18:
Firmware loading facility ( CONFIG_FW_LOADER ) This option is provided for the case where none of the in-tree modules require userspace firmware loading support, but a module built out-of-tree does. Build named firmware blobs into the kernel binary ( CONFIG_EXTRA_FIRMWARE ) This option is a string and takes the (space-separated) names of firmware files to be built into the kernel. These files will then be accessible to the kernel at runtime.
Device Drivers ---> Generic Driver Options ---> Firmware loader ---> -*- Firmware loading facility () Build named firmware blobs into the kernel binary (/lib/firmware) Firmware blobs root directory
USE flags
USE flags for sys-kernel/linux-firmware Linux firmware files
compress-xz | Compress firmware using xz (app-arch/xz-utils) before installation |
compress-zstd | Compress firmware using zstd (app-arch/zstd) before installation |
initramfs | Create and install initramfs for early microcode loading in /boot (only AMD for now) |
redistributable | Install also non-free (but redistributable) firmware files |
savedconfig | Allows individual selection of firmware files |
unknown-license | Install firmware files whose license is unknown |
Emerge
Optional: Savedconfig
After emerging sys-kernel/linux-firmware, the configuration file is made into /etc/portage/savedconfig/sys-kernel/linux-firmware-ddmmyyyy . This file can be edited and the unwanted lines be commented out or deleted. Edit and save the file and re-emerge sys-kernel/linux-firmware with the savedconfig USE flag:
Optional: Compression
Firmware to be loaded into the kernel can be compressed in order to achieve greater space efficiency and faster read speeds (at the expense of processing time). See the CONFIG_FW_LOADER_COMPRESS kernel symbol for additional information.
xz compression is supported via the CONFIG_FW_LOADER_COMPRESS_XZ symbol. Note that only none or crc32 integrity check types (by passing -C crc32 option to the xz command) are supported.
As of kernel version 5.19, zstd compression is supported via the CONFIG_FW_LOADER_COMPRESS_ZSTD symbol. [4]
Troubleshooting
Searching for loaded firmware
dmesg can be grepped to determine what firmware has been loaded:
Removal
Unmerge
See also
- Fwupd — a daemon that provides a safe, reliable way of applying firmware updates on Linux.
- Kernel — the core of the operating system.
- Iwlwifi — the wireless driver for Intel’s current wireless chips.
- Microcode — describes various ways to update a CPU’s microcode in Gentoo.
- AMDGPU — the next generation family of open source graphics drivers using the new Display Core (DC) framework for Vega GPUs and Raven Ridge GPUs. It is however also capable of handling newer AMD/ATI Radeon graphics cards based on GCN1.0+, namely the Southern Islands, Sea Islands, Volcanic Islands, and Arctic Islands chipsets.
- Intel — the open source graphics driver for Intel GMA on-board graphics cards and Intel Arc dedicated graphics cards, starting with the Intel 810.
External resources
References
- Эта страница в последний раз была отредактирована 5 апреля 2023 в 11:36.
- Политика конфиденциальности
- О Gentoo Wiki
- Отказ от ответственности
© 2001–2023 Gentoo Authors
Gentoo is a trademark of the Gentoo Foundation, Inc. The contents of this document, unless otherwise expressly stated, are licensed under the CC-BY-SA-4.0 license. The Gentoo Name and Logo Usage Guidelines apply.
What is «firmware» in Linux terminology?
I’m being confused by the use of firmware in the context of Linux. My understanding of firmware & driver is that firmware is the code that runs on the bare metal of a device such as a Bluetooth IC, or keyboard controller, or video card, or a single-purpose micro-controller. The firmware exposes an interface for the OS to use its services. The driver, in comparison, is the software that the kernel uses to communicate with previously mentioned interfaces provided by the firmware. Thus, a video driver, a keyboard driver, a bluetooth radio driver. So why is it that I keep reading about Linux firmware files having to be installed (e.g. here). Do these get uploaded into the hardware? Are these files used by the kernel? What is the meaning of firmware in this context?
Generally speaking: Software is a program. Hardware is a physical device. Firmware is a program integrated into hardware; typically for the purposes of configuring how the hardware works (so it is sort of between software and hardware, just as ‘firm’ is between ‘soft’ and ‘hard’ on a scale of bluntless). Generally, firmware is OS-agnostic (for example, the RAID configuration on an SCSI RAID controller).
Just to add to DopeGhoti’s comment, many devices now allow live firmware loading making them more flexible/evolutive than fixed implementations.
@DopeGhoti it doesn’t just configure the hardware, it runs on the hardware. Some firmware is very complex indeed and basically runs a mini-OS.
I agree, though I would assert that «software integrated into hardware» implies that the hardware is that upon which said software runs. (:
What is linux-firmware when updating kernel?
Many devices have two essential software pieces that make them function in your operating system. The first is a working driver, which is the software that lets your system talk to the hardware. The second is firmware, which is usually a small piece of code that is uploaded directly to the device for it to function correctly. You can think of the firmware as a way of programming the hardware inside the device. In fact, in almost all cases firmware is treated like hardware in that it’s a black box; there’s no accompanying source code that is freely distributed with it.
While many devices can work without firmware, many more complicated ones require firmware to be properly set up, e.g. almost all modern GPUs, CPUs (microcode updates which fix bugs, erratas and vulnerabilities), Ethernet cards and WiFi adapters/phone radio modules (e.g. there’s a ton of variability in terms of properly broadcasting and receiving wireless signal and there are regional limitations as well), SCSI/RAID adapters, multimedia devices including webcams, etc.
Some people choose not to use firmware because they believe it can be used to extend hardware capabilities beyond what was initially designed/built into them, check Linux-libre So, if you have a server or a relatively old PC/laptop you can try running without firmware or even use the Linux-Libre kernel. I don’t share this point of view because modern hardware already has ROM and its circuitry is in absolute most cases «closed» sourced, so it’s not obvious whether it’s backdoor-free in the first place.
This package contains not just single firmware, it contains multiple files for various hardware devices (some devices require multiple files). Like I said, if everything works for you, you may as well never install it.