Firmware packages: What do they actually do?

As Anthony Geoghegan mentions, What is "firmware" in Linux terminology? and Why do some drivers still require firmware? provide useful background.

Firmware packages are packages which contain firmware files, i.e. files which contain code which is intended to run on devices in or connected to your system — common examples include wifi chipsets, as in your case. They are not one-shot installers, and they do not care whether the hardware is available. The files they make available are used by the corresponding kernel drivers, if the relevant hardware is present: the drivers load the firmware into memory attached to the target hardware, which then runs the firmware to operate.

These firmware packages aren’t related to the firmware installers you’re thinking about, which load firmware updates into flash memory (which only needs to be done when an update is required). That process is indeed lengthy, often complex, and seemingly fraught with danger (at least, if you base your impressions on the manufacturer’s warnings). Firmware packages included in Linux distributions contain firmware which is needed every time the system boots, because it is loaded into volatile memory.

Loadable firmware is typically not "one-shot" installs that are written to flash on the device. The firmware is loaded into volatile storage on the device and needs to be done each time the host computer is turned on. The device does not function before the firmware is loaded. The firmware can be written to RAM on the device, in which case it contains code and data for the processor on the device, but it can also be a bit stream defining the logic of a field-programmable logic array (FPGA), or some combination of both.

On the other hand, firmware in flash memory is typically pre-programmed on the devices, and only needs to be rewritten if there is an update to the firmware from the manufacturer. This is typically done via other mechanisms, like a separate executable that is run by the user.

There are a few reasons why manufacturers want to use RAM instead of flash memory. First of all, it makes it possible to design a single version of the hardware, but at the same time deliver several versions of the product (for different market areas, for example). If the product is expected to be field-upgraded frequently, it may be easier to handle the firmware upgrades this way than go through the trouble of creating a program for upgrading the flash memory on the device. This program should have a nice user interface and be designed to be as user friendly as possible, since it is typically intended run by the end user of the product. Some devices with flash storage often run code from RAM anyway, and they just copy the contents of the flash to RAM when the device is started, in which case the flash chip just sits idle most of the time and is an extra expense.

Adding to the already excellent answers.

Firmware files, aka proprietary binary blobs, are loaded into your firmware at least at the time of cold (re)boots of the device.

The device was so devised to get firmware in RAM instead of having a ROM+RAM to cut down in costs of production. As example, you have some Broadcom wifi chipsets and internal switch chipsets that work that way.

Addressing the other point of your question of using firmware files in a VM.

As you are dealing with a VM, you do not need firmware files. They won't be loaded anywhere; much less ethernet or wifi "firmware" files.

Likewise, considering firmware is not needed in a VM environment, it is a big idiosyncrasy having in Debian the dependencies on a generic firmware file package in the Linux kernel.