Build question, how to control which firmware version gets packaged? (RESOLVED)

I am building LEDE from the current 17.01 snapshot, targeting an APU-2C4 (x86/64, like this https://openwrt.org/toh/hwdata/pc_engines/pc_engines_apu2c4), and making a combined ext4 image.

The wifi card my device has is the Intel 7260. I added those drivers and kernel packages using 'make menuconfig', and I see them get included in the package... so far so good.

However, when the device boots, it fails to load the firmware because it is looking for "wlwifi-7260-17.ucode", but only the "wlwifi-7260-16.ucode" version was included in the image.

Now to my question... I can see that the "-17" version of the driver is in my build folder, at: "./build_dir/target-x86_64_musl-1.1.16/linux-firmware-2016-09-21-42ad5367/iwlwifi-7260-17.ucode". However, what ends up "/lib/firmware" is only the "-16" version. I copied the "-17" version into "/lib/firmware" manually, and now the interface is found at boot time.

So given all the files are part of the build, how can I configure my build to bundle the "-17" version of the driver instead of the older one?

Sorry if this is a dumb question. I looked at the FAQs and also started digging into the Makefiles, but I am a bit over my head.

Thanks in advance, all!

-N

You should indeed modify the Makefile (tip: git grep works wonders when you're looking for something of which you have no clue where it might be).

$ git grep 7260|grep ucode
package/firmware/linux-firmware/intel.mk:	$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-7260-16.ucode $(1)/lib/firmware

So now you know what file (and line to edit) :slight_smile:

ifneq ($(CONFIG_IWL7260_FW),)
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-7260-16.ucode $(1)/lib/firmware

I checked master and that one already uses -17.

1 Like

Kernel modules for wlan cards often support more than one firmware ABI, while it may look for the newest one first (and complain about its potential absence), it will transparently fall back to an older supported alternative. In either case, a missing wlan firmware won't prevent your device from booting, it should still boot up fine and be accessible via ethernet.

If your device fails to boot, the reason is most likely to be found elsewhere.

The driver should indeed pick up the older firmware. I overlooked that. The failure will still report in dmesg, but it shouldn't break the driver.

Thanks to @Borromini and @slh for your quick and helpful replies!

So, here is the result: editing the linux-firmware/intel.mk makefile to reference iwlwifi-7260-17.ucode instead of iwlwifi-7260-16.ucode solves it, and the firmware is loaded at boot time.

I tried it again with the default makefile, and it definitely does not fail back to the older -16 firmware, even though it is in /lib/firmware. I don't know if this is a failure in some other area or what might cause it?

Here is the boot log from an image with just the -16 firmware (somehow attempts to load -17, fails, and does not load -16, no interface defined):

...
[    8.681982] Intel(R) Wireless WiFi driver for Linux
[    8.686978] Copyright(c) 2003- 2015 Intel Corporation
[    8.693770] iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-7260-17.ucode failed with error -2
[    8.703240] iwlwifi 0000:04:00.0: Falling back to user helper
[    8.717039] firmware iwlwifi-7260-17.ucode: firmware_loading_store: map pages failed
[    8.722691] PPP generic driver version 2.4.2
[    8.723246] NET: Registered protocol family 24
[    8.734719] iwlwifi 0000:04:00.0: no suitable firmware found!
...
root@(none):/# iwinfo
root@(none):/# 

And here is a boot log from an image with -16 replaced by -17 in the makefile (attemps to load -17 and succeeds, WLAN interface successfully defined):

...
[    8.671035] Intel(R) Wireless WiFi driver for Linux
[    8.676031] Copyright(c) 2003- 2015 Intel Corporation
[    8.699036] iwlwifi 0000:04:00.0: loaded firmware version 17.352738.0 op_mode iwlmvm
[    8.702421] PPP generic driver version 2.4.2
[    8.703017] NET: Registered protocol family 24
[    8.716520] iwlwifi 0000:04:00.0: failed to load module iwlmvm (error -2), is dynamic loading enabled?
[    8.730467] iwlwifi 0000:04:00.0: Detected Intel(R) Dual Band Wireless AC 7260, REV=0x144
[    8.740662] iwlwifi 0000:04:00.0: L1 Disabled - LTR Disabled
[    8.746648] iwlwifi 0000:04:00.0: L1 Disabled - LTR Disabled
...
root@LEDE:/# iwinfo 
wlan0     ESSID: unknown
          Access Point: 00:00:00:00:00:00
          Mode: Client  Channel: unknown (unknown)
          Tx-Power: unknown  Link Quality: unknown/70
          Signal: unknown  Noise: unknown
          Bit Rate: unknown
          Encryption: unknown
          Type: nl80211  HW Mode(s): 802.11bgnac
          Hardware: 8086:08B1 8086:4470 [Generic MAC80211]
          TX power offset: unknown
          Frequency offset: unknown
          Supports VAPs: no  PHY name: phy0

So, I should be all set for now. Any suggestions on why the previous version of the driver doesn't get loaded when the newer one is not found? This is not stopping me for now, though.

Thanks again!