Firmware

From postmarketOS

Firmware is generally software which runs on another processor in the system, e.g. a wireless controller, a GPU... This software is sometimes stored in ROM attached to the relevant controller, but in recent times, controllers tend to rely on the host operating system to load their firmware for them.

These firmware files aren't used directly by the kernel, they're loaded by the kernel onto other pieces of hardware.[1]

In postmarketOS we use this proprietary firmware to get different parts of the system working, mostly for Wi-Fi, Bluetooth, Modem and in some cases Audio.

Firmware files

If your device has an official LineageOS port, you can find the proprietary files, which often also include the firmware, at TheMuppets. Do note, that if you're using the "Find file" (shortcut: T), that it might not find all files as those repositories are generally quite big and not completely indexed by GitHub.

In the case that your device has an unofficial LineageOS port, you can often find a repository in the same naming scheme (proprietary_vendor_MANUFACTURER) at the same location as the kernel source and device tree.

Find

If you can't find the firmware for your device in an existing repo, you will have to grab them from your device or an OTA image.

In some cases it's a partition that's mounted at /firmware (e.g. labelled modem), in other cases /firmware will have multiple partitions mounted into subdirectories (e.g. labelled radio, adsp & wcnss). Consult the fstab of your installation for different mount points.

In other cases, the firmware will just be in the normal filesystem, e.g. at /vendor/firmware/, /etc/firmware or other locations. You can use the find command to search for e.g. *.mbn

There's also the possibility of extracting the firmware from a file called NON-HLOS.bin which is sometimes delivered with OTA updates. These images are FAT32 images which can be mounted with sudo mount -o ro NON-HLOS.bin mountpoint.

Extract

The firmware of interest for us is adsp.*, mba.*, modem.* and wcnss.*. Note that not all of those firmware files exist on all devices.

The next step is to import those files into a git repository and pushing it to a publicly accessible location.

Package

The procedure on how to package firmware and how to add a nonfree-firmware subpackage to the device package is documented here.