New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raspberry Pi WiFi hotspot firmware reliability fix, incl new/better choices for 3B+ & 4 (WIP, this is PR #3101 rebased) #3103
Conversation
…o rpi-wifi-firmware
Rather than copying some old version of the firmware to brcmfmacxxxx-sdio.bin.iiab could we start naming them by their version number and use symlinks to activate them, much as @beta-tester suggested on #2853 |
That's what this PR does. Intensive testing continues, over more than 4 days now. |
are you saying that's what this does?
what is the .iiab for? why is there a mv? I thought it's /usr/lib/firmware. |
Each .iiab is a symlink that protects the IIAB implementer's choice of firmware (e.g. among ~4 choices, in the case of Raspberry Pi 4 and 3 B+), that points to the actual firmware files chosen during IIAB installation. This allows /usr/bin/iiab-check-firmware (and iiab-check-firmware.service during bootup) to "instantly" restore the implementer's choice — without slowpoke Ansible bureaucracy — after an apt update. (In lieu of the heavy-handed
To capture and retain the results of any apt updates. Allowing advanced operators visibility into all future firmware options. What is moved after an apt update can be a symlink or a file, either way, for safekeeping.
It's /lib/firmware/brcm and /lib/firmware/cypress
Raspberry Pi Foundation often does not use the canonical firmware files from Broadcom/Cypress/Infineon. These are often customized before being included within Raspberry Pi OS. So the actual heritage/lineage of firmware files are being indicated (or at least summarized) in the filenames, including the publisher's own timestamp (datestamp) e.g. from GitHub typically, if that's what's available. If Raspberry Pi OS (or anyone!) later releases demonstrably better firmware files, that will be great. At that time, these too will be labelled to indicate (summarize) where they came from. |
root@box:~# ll /lib Sounds like most of this is to protect against apt update and assumes it will update brcmfmac43455-sdio.bin. Before iiab install that was a symlink to ../cypress/cyfmac43455-sdio.bin, so I doubt it will get updated. If instead it was a symlink to brcmfmac43455-sdio.bin_2020-05-22_7.45.214 wouldn't that remain after an update? Aren't the actual firmware files now in ../cypress? That's where cyfmac43455-sdio-minimal.bin is. So if an implementer wants your 19, just symlink brcmfmac43455-sdio.bin to ../cypress/cyfmac43455-sdio-minimal.bin. I don't think an update will change that. |
The 4 files (or symlinks) that matter to activate WiFi are:
A crystal ball is (effectively) needed to be able to determine what future apt updates will do to the above 4 files — on every different OS. e.g. if any OS and its apt updates choose to rename or move /lib/firmware/cypress to /lib/firmware/infineon (the new name of the company, which changed yet again) that is their choice. Hence the reason the above 4 crucial files/symlinks are verified and re-established by iiab-check-firmware.service during each boot (if both firmware variables specify anything other than "os", in /etc/iiab/local_vars.yml etc). |
Well I just did an iiab install and see
There's no need for all of that. Just have brcmfmac43455-sdio.bin point to one of ./cypress/cyfmac43455-sdio.bin where xxx and yyy are the old versions preserved by iiab
True, but then raspios will break on apt update. |
I avoided the above approach to make it more resilient after apt updates. So both (1) implementer's install-time choice of firmware, (encoded in the 4 .iiab symlinks) and (2) a rigorous set of firmware choices — remain explicitly visible to operators within /lib/firmware/* — even after apt updates. (There have been times in recent years when RasPiOS has accidentally pushed a highly imperfect WiFi firmware, so it's best to be prepared for all sorts of similar problems, to be able to revert flexibly and quickly.)
My point was that any OS (including RasPiOS itself) can change most any file/symlink in /lib/firmware/* at any time, upon any subsequent apt update. Wiping away cypress/cyfmac43455-sdio.bin or whatever. So best to be prepared, allowing for nearly instant and easy reverting. ASIDE/FWIW: Linux's "5.15" kernel's support for multiple / versioned WiFi firmwares...might be implemented by RasPiOS and/or other OS's to change this layout in coming years...to deal with situations exactly like this. |
and mine was that that would break raspios as they currently use symlinks from brcm to cypress as a key part of their strategy. to change that link would be highly reckless and would only be undertaken when there is a new release of raspios at which point all of this would be broken. that's definitely a glass half empty approach. it says the snapshot you took is guaranteed to be better than current shipping version. |
Just to be clear, on installation of raspios brcm/brcmfmac43455-sdio.bin is a symlink to cypress/cyfmac43455-sdio.bin. |
These questions don't make sense as this PR very intentionally removes variable What matters, as mentioned near the top of this ticket, is that these 4 files (or symlinks) activate WiFi:
Every apt WiFi firmware package from RaspiOS or Ubuntu to date makes adjustments to those 4 files-or-symlinks, as these are the 4 files/symlinks that matter. Just the same as IIAB has done for about 1.5 years now, and will continue to do. I apologize I do not understand any of the above claims about breaking RasPiOS or any other OS. (But insofar as I can tell, they appear to be based on extreme hypotheticals.) |
sorry missed that. so does rpi3bplus_rpi4_wifi_firmware: os then do nothing? |
Essentially that's correct. The details are:
|
the ones in cypress? nothing is removing or changing the cypress file, so what is the need to preserve it?
where is this done? are you saying that on some occasions a script named check makes a change?
are from what to what? What setting do I use if I don't want any of the 4 steps? What setting do I use if I just want the links from brcm to cypress minimal? |
Yes.
Your assumption is incorrect. Every OS overwrites /lib/firmware/cypress/cypress/cyfmac43455-sdio.bin (etc, and the links to them) during apt updates at the moment, and again this is precisely why these 2+2 are being copied to *.orig during IIAB installation. As Raspberry Pi's Phil Elwell has mentioned, the 5.15 LTS kernel released 2021-10-31 begins to address this core issue, allowing more flexible firmware filenames, so we might see that in coming years, if diverse OS's choose to implement this (hopefully not each in their own way!)
As has been the case for about 1.5 years now, yes. Recall that during on every boot iiab-check-firmware.service invokes /usr/bin/iiab-check-firmware to do exactly this. And again: if firmware vars are set to "os" it intentionally allows ongoing/future WiFi firmware apt updates to take effect (for that chip family).
The 2 pairs of high-level /lib/firmware/brcm files/symlinks (that's the 4 critical files/symlinks, that have been repeatedly listed above) are linked to *.iiab when the firmware vars as not set to "os". RECAP EXAMPLES:
|
OK. I'll wait for the movie. |
FYI
|
It's time to expand community testing of this PR by merging it into master. Thank you to everyone who is able to help! Aside: This can and will be backported into IIAB 7.2 later, if all looks good. |
FYI, arising from 2022-06-13:
Per: Thanks to @martignoni: Tangentially related: |
Same as PR #3101 but rebased to avoid clutter.
This brings much improved handling of firmware options on Raspberry Pi 3 B+ and 4 especially, and better explanations.
WiFi Hotspot Reliability testing is ongoing but more is needed on the 43430 family (i.e. RPi 3, RPi Zero W, RPi Zero 2 W).
Refs: