flash - Linux


Overview

flash is a command-line utility that plays a crucial role in system management. It is used to update and write firmware images directly to supported hardware devices, such as BIOS, EFI, network cards, storage controllers, and more. By updating firmware, you can enhance device functionality, resolve compatibility issues, and patch security vulnerabilities.

Syntax

flash [options] <device> <firmware_image>

Options/Flags

| Option | Description | Default |
|—|—|—|
| -l | List supported devices | N/A |
| -d | Display device details | N/A |
| -v | Increase verbosity for debugging | N/A |
| -V | Display version information | N/A |
| -y | Bypass confirmation prompts | N/A |
| -C | Check firmware compatibility before writing | N/A |
| -R | Readback firmware from device after writing | N/A |

Examples

Basic Usage:

flash /dev/nvme0 firmware.bin

List Supported Devices:

flash -l

Update BIOS with Compatibility Check:

flash -C -y /dev/nvme0 bios.bin

Common Issues

  • Incorrect Device: Ensure you identify the correct device path before writing firmware.
  • Incompatible Firmware: Verify that the firmware image is compatible with the target device.
  • Interruptions: Avoid system interruptions during the flashing process, as they can corrupt the firmware.

Integration

Device and Firmware Validation:

lshw -C system | flash -d /dev/nvme0 | flash -C /dev/nvme0 latest.bin

Automated Flashing:

for device in $(flash -l); do flash -y /dev/$device latest.bin & done
wait

Related Commands

  • lshw – Lists hardware devices.
  • fwupd – Command-line interface for firmware updates.
  • efivar – Manipulates EFI variables.