Firmware
In plain English
Plain definition
Think of a coffee machine. The plastic and metal are the hardware, but it also holds a small recipe card that tells it how long to heat the water and when to stop. Replace the card and the same machine behaves differently. Firmware is that recipe card for a network card, a disk or a graphics chip. You usually notice it only when a device refuses to work until the right file turns up, or when a vendor says an update fixes a fault.
Firmware is the low-level software that a device needs in order to operate its own hardware. On Linux, many drivers do not carry that software themselves: a driver asks the kernel for a firmware file by name, the kernel finds it on the root filesystem, and the driver copies it to the device. Listing the firmware files in /lib/firmware changes nothing on the machine.
How firmware works on Linux, technically
A driver typically calls request_firmware with the name of the file it wants, copies the returned data to its device, and then calls release_firmware. A synchronous request waits until the firmware is found or an error is returned. The name must not contain .. path components.
The kernel looks for the file on the root filesystem in four places, in this order: /lib/firmware/updates/UTS_RELEASE/, /lib/firmware/updates/, /lib/firmware/UTS_RELEASE/ and /lib/firmware/. A custom search path set through the firmware_class module parameter path is searched first. It can be up to 256 characters long and is visible at /sys/module/firmware_class/parameters/path.
Firmware can also be built into the kernel with CONFIG_EXTRA_FIRMWARE and CONFIG_EXTRA_FIRMWARE_DIR, which avoids a filesystem lookup. The kernel documentation lists the costs: some firmware is not GPL compatible, and because firmware upgrades are possible, a new firmware would mean a complete kernel rebuild.
Where you meet firmware day to day
You meet firmware when a new server arrives, when a network or storage device will not start after an operating system install, or when a vendor advisory tells you to update it. Which firmware a device needs, and which version, is set by the hardware vendor, so check the vendor’s page for your hardware and your Linux distribution before changing anything.
Where it fits in the machine
Firmware sits below the driver. The driver is part of the kernel; the firmware runs on the device. Some devices expose an update path through the kernel: a driver that registers with the firmware loader exposes persistent sysfs nodes under /sys/class/firmware that let a user start a firmware update for that device.
The kernel documentation says it is the responsibility of the device driver and the device itself to validate the data received, so the file you write has to be the one the vendor supplies for that exact device.
Many Linux distributions also ship fwupd, a project that aims to make updating firmware on Linux automatic, safe and reliable. Its command-line client is fwupdmgr.
Example: seeing the firmware on a machine
These commands only read information. In a terminal on the machine:
ls -l /lib/firmware
cat /sys/module/firmware_class/parameters/path
fwupdmgr get-devices
fwupdmgr get-history
The first lists the firmware files the kernel can load from the default path. The second shows whether a custom search path is set; an empty result means the default paths apply. The third shows every device fwupd knows about, and the fourth shows the firmware update history it has stored. If fwupdmgr is not installed, skip those two.
All four commands change nothing, so there is nothing to roll back. Updating is different. fwupdmgr downgrade installs an older release for a device if one is available, which is the route back after a bad update, but it is itself a firmware write. Before any firmware change, record the current versions from fwupdmgr get-devices, confirm the vendor’s release is for that exact device, and make the change on one non-production machine first.
Firmware is often confused with drivers and with BIOS
The first mistake is treating firmware and a driver as the same thing. The driver runs in the operating system; the firmware it loads runs on the device. The second is assuming a file in /lib/firmware is the only copy: a device may hold its own firmware, and the kernel can carry some inside its image.
The third is treating an update as routine. A firmware write can leave a device unusable if it is the wrong file or is interrupted, so plan the rollback before you start.
Related terms for firmware
- Driver: the kernel code that talks to a device and loads its firmware.
- request_firmware: the kernel call a driver uses to ask for a firmware file.
- Built-in firmware: firmware compiled into the kernel image.
- fwupd: the project and daemon for updating firmware on Linux.
- sysfs: the virtual filesystem through which the kernel exposes device attributes.
Further reading on firmware
- The Linux Kernel documentation: “Firmware search paths”, “request_firmware API”, “Built-in firmware” and “Firmware Upload API”.
- The fwupd project: the
fwupdmgrmanual.
Checks before you change firmware
Record the current versions with fwupdmgr get-devices, confirm the vendor’s file is for that exact device, and keep the way back to the old version. The next safe decision is to update one device on one non-production machine and confirm it still works.
Authoritative Sources
About this page
Credited to
Dates
Published
Corrections
No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
Found this useful? Follow KBY for more like it.
Recommended reading
More from KBY that goes with this term.
- Microsoft Intune error
0x800705b4: Autopilot self-deploying mode fails at Securing your hardware
2 min read
Education ITClassroom management software for schools: check what your devices already include
8 min read
