2

CentOS 7 has merged a number of firmware packages into 'linux-firmware' and made these a dependency of kernels. Is there an easy way to create a stripped down version of this, removing those firmware packages that I know I don't need because I never installed them for CentOS 6 on the same platforms?

2

First it is worth mentioning that the linux-firmware source RPM in the source for a number of RPMs, one of which is linux-firmware plus some other (typically WiFi related) firmware files. It looks like the mechanism that is used to split the source files between the different RPMs can be used to trim linux-firmware further, if you are careful.

The process looks like it should be this:

  1. Download the linux-firmware source RPM and install it
  2. Copy the SPEC file, update the version (add a prefix) so that you can distinguish your version from the original and save as a new SPEC file.
  3. Copy the existing %package -n and %file -n code to create a new sub-package (let's call it unwanted-firmware)
  4. In the SOURCE directory, untar the source files so that you can see what source you will/not want
  5. Identify all unwanted source (for example I know there are no WiFi cards or Radeon video cards in the hardware I'm using) and add the appropriate files to the list of files for unwanted-firmware
  6. When done, rebuild linux-firmware, remembering to use the updated SPEC file.

You should end up with your smaller, custom linux-firmware RPM, a new unwanted-firmware RPM and the other additional firmware files that linux-firmware creates.

You will want to thoroughly test your new system and check logs etc for broken firmware; if you find some then you might need to tweak your unwanted-firmware file list.

  • There's a nasty gotcha. The SPEC file has code to trim the 'everything' list of files down to remove those placed into other firmware files. This code does not seem to work properly for %dir lists so my initial attempt has created an unwanted-firmware RPM but the files inside are still in the linux-firmware RPM too :-(. – Paul D Smith Aug 29 '18 at 13:00
  • In the SPEC file, about line 295, you will find this: sed -i -e '/^iwlwifi/d' linux-firmware.files (split over two lines) Look carefully because this is trimming files from the iwlwifi directory! You want to add your extra directories here and also be careful because some directory names clash with files that you might also want to trim. But there is plenty of fat to trim here if you need to. – Paul D Smith Sep 3 '18 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.