Online firmware upgrade in non-embedded systems
Subsystems (3)
Network and disk controllers normally have at least some firmware in flash to support their use as boot devices. Solarflare's current network adapters can have as many as 4 distinct firmware partitions: one for each PHY, one for the management CPU and one for net-boot. Any or all of these may need to be updated in the field, to fix bugs or to add features. (Furthermore, the net-boot firmware is based on gPXE and is therefore modifiable by any user.)
Currently the sfc network driver is optionally combined with an MTD driver (CONFIG_SFC_MTD) which exposes all upgradable firmware and configuration partitions in flash. This works nicely in kernels with MTD enabled, but since MTD is mainly used in embedded systems with on-board flash it is often disabled in distribution kernels and custom kernels alike. This leaves users of sfc unable to upgrade firmware without rebuilding the kernel or booting some other distribution. The lack of widespread MTD support is a regular cause of support requests.
There are two main alternatives I'm aware of:
- Use the ethtool ETHTOOL_SEEPROM command with multiple magic numbers for different partitions. bnx2x does something a little like this for PHY firmware upgrades. The ethtool core passes in a page at a time so this won't work well with flash block sizes greater than PAGE_SIZE.
- Use the ethtool ETHTOOL_FLASHDEV command. It's intended for precisely this purpose, but the driver is supposed to implement it using request_firmware(). That seems to require any firmware update program to integrate with udev or to copy firmware images under /lib/firmware even though they are one-time updates. That doesn't make a lot of sense to me. Am I missing something?
Of course these are both specific to network devices; it seems deisrable to have a more general convention for online firmware upgrades. MTDs clearly are more generally applicable, and pretty much every computer does have flash storage for firmware and boot configuration, so perhaps it should be treated as more of a standard feature?
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Quoted 10 lines · In gmane.linux.kernel Ben Hutchings
Currently the sfc network driver is optionally combined with an MTD driver (
CONFIG_SFC_MTD) which exposes all upgradable firmware and configuration partitions in flash. This works nicely in kernels with MTD enabled, but since MTD is mainly used in embedded systems with on-board flash it is often disabled in distribution kernels and custom kernels alike. This leaves users of sfc unable to upgrade firmware without rebuilding the kernel or booting some other distribution. The lack of widespread MTD support is a regular cause of support requests.
----
ac56@proxy0:~$ uname -a
Linux proxy0 2.6.32-5-686 #1 SMP Wed Aug 25 14:28:12 UTC 2010 i686 GNU/Linux
ac56@proxy0:~$ cat /etc/debian_version
squeeze/sid
ac56@proxy0:~$ grep CONFIG_SFC_MTD /boot/config-2.6.32-5-686
CONFIG_SFC_MTD=y
ac56@proxy0:~$ grep '^CONFIG_MTD' /boot/config-2.6.32-5-686 | wc
72 72 1693
----I tell them "use a real distribution".
Cheers
Signature · 3 lines
Alexander Clouter
.sigmonster says: BOFH excuse #119:
evil hackers from Serbia.[adding [email protected] to CC, senders will be whitelisted after a short delay]
Quoted 16 lines · Ben Hutchings
Network and disk controllers normally have at least some firmware in flash to support their use as boot devices. [...]
Currently the sfc network driver is optionally combined with an MTD driver (
CONFIG_SFC_MTD) which exposes all upgradable firmware and configuration partitions in flash. This works nicely in kernels with MTD enabled, but since MTD is mainly used in embedded systems with on-board flash it is often disabled in distribution kernels and custom kernels alike. This leaves users of sfc unable to upgrade firmware without rebuilding the kernel or booting some other distribution. The lack of widespread MTD support is a regular cause of support requests.There are two main alternatives I'm aware of:
- Use the ethtool
ETHTOOL_SEEPROM[...]
Quoted 8 lines
- Use the ethtool
ETHTOOL_FLASHDEVcommand [..]Of course these are both specific to network devices; it seems deisrable to have a more general convention for online firmware upgrades. MTDs clearly are more generally applicable, and pretty much every computer does have flash storage for firmware and boot configuration, so perhaps it should be treated as more of a standard feature?
Given that the flashrom utility <http://www.flashrom.org/> (GPLv2) supports flashing many network cards, SATA/PATA controllers, graphics cards, and of course the main system firmware/BIOS/EFI, and it does that from userspace without any kernel support, using flashrom for those purposes makes sense IMHO.
flashrom works fine under Linux 2.4, 2.6 and pretty much every other OS out there. There is a focus on x86, but MIPS, PowerPC and other architectures are supported as well. flashrom is independent of the MTD framework, so you don't need to boot a special kernel for a firmware upgrade.
That said, writing a flashrom driver for your hardware is pretty easy. You could even use existing kernel code for your device as a template for the flashrom driver since the license is compatible.
If you have any questions, please ask.
Regards,
Carl-Daniel
Quoted 29 lines · Carl-Daniel Hailfinger
[adding [email protected] to CC, senders will be whitelisted after a short delay]
Quoted 16 lines · Ben Hutchings
Network and disk controllers normally have at least some firmware in flash to support their use as boot devices. [...]
Currently the sfc network driver is optionally combined with an MTD driver (
CONFIG_SFC_MTD) which exposes all upgradable firmware and configuration partitions in flash. This works nicely in kernels with MTD enabled, but since MTD is mainly used in embedded systems with on-board flash it is often disabled in distribution kernels and custom kernels alike. This leaves users of sfc unable to upgrade firmware without rebuilding the kernel or booting some other distribution. The lack of widespread MTD support is a regular cause of support requests.There are two main alternatives I'm aware of:
- Use the ethtool
ETHTOOL_SEEPROM[...]Quoted 8 lines
- Use the ethtool
ETHTOOL_FLASHDEVcommand [..]Of course these are both specific to network devices; it seems deisrable to have a more general convention for online firmware upgrades. MTDs clearly are more generally applicable, and pretty much every computer does have flash storage for firmware and boot configuration, so perhaps it should be treated as more of a standard feature?
Quoted 4 lines
Given that the flashrom utility <http://www.flashrom.org/> (GPLv2) supports flashing many network cards, SATA/PATA controllers, graphics cards, and of course the main system
firmware/BIOS/EFI, and it does that from userspace without any kernel support,
[...]
I'm looking for a clean solution, not a hack.
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Quoted 11 lines · Ben Hutchings
Quoted 9 lines · Carl-Daniel Hailfinger
[adding [email protected] to CC, senders will be whitelisted after a short delay]
Quoted 4 lines · Ben Hutchings
Network and disk controllers normally have at least some firmware in flash to support their use as boot devices. [...]
Quoted 9 lines
Quoted 5 lines
Given that the flashrom utility <http://www.flashrom.org/> (GPLv2) supports flashing many network cards, SATA/PATA controllers, graphics cards, and of course the main system
firmware/BIOS/EFI, and it does that from userspace without any kernel support,[...]
I'm looking for a clean solution, not a hack.
What would qualify as a clean solution? And is cross-platform code one of your goals?
Regards,
Carl-Daniel
Quoted 17 lines · Carl-Daniel Hailfinger
Quoted 16 lines · Ben Hutchings
Quoted 14 lines · Carl-Daniel Hailfinger
[adding [email protected] to CC, senders will be whitelisted after a short delay]
Quoted 4 lines · Ben Hutchings
Network and disk controllers normally have at least some firmware in flash to support their use as boot devices. [...]
Given that the flashrom utility <http://www.flashrom.org/> (GPLv2) supports flashing many network cards, SATA/PATA controllers, graphics cards, and of course the main system
firmware/BIOS/EFI, and it does that from userspace without any kernel support,
Quoted 6 lines
Quoted 4 lines
[...]
I'm looking for a clean solution, not a hack.
What would qualify as a clean solution?
One where hardware access is mediated by the kernel, and doesn't involve unloading or potentially conflicting with the driver for that hardware.
Quoted 1 line
And is cross-platform code one of your goals?
Not at this level. At the application level, yes, but we already have a working application so I'm not interested in using flashrom for that.
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Quoted 26 lines · Ben Hutchings
Quoted 24 lines · Carl-Daniel Hailfinger
Quoted 22 lines · Ben Hutchings
Quoted 17 lines · Carl-Daniel Hailfinger
[adding [email protected] to CC, senders will be whitelisted after a short delay]
Quoted 5 lines · Ben Hutchings
Network and disk controllers normally have at least some firmware in flash to support their use as boot devices. [...]
Given that the flashrom utility <http://www.flashrom.org/> (GPLv2) supports flashing many network cards, SATA/PATA controllers, graphics cards, and of course the main system
firmware/BIOS/EFI, and it does that from userspace without any kernel support,[...]
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
I'm looking for a clean solution, not a hack.
What would qualify as a clean solution?
One where hardware access is mediated by the kernel, and doesn't involve unloading or potentially conflicting with the driver for that hardware.
flashrom can ask the kernel driver to "please stop accessing flash". No unloading needed, no conflict in place.
Quoted 6 lines
Quoted 2 lines
And is cross-platform code one of your goals?
Not at this level. At the application level, yes, but we already have a working application so I'm not interested in using flashrom for that.
I see. Just because I'm interested in how other flashing applications solve this: Does that application work on *BSD as well? And could you tell me the name of the app so I can take a look at it? Thanks.
Regards,
Carl-Daniel
Signature · 1 line
http://www.hailfinger.org/
Quoted 8 lines · Ben Hutchings
Currently the sfc network driver is optionally combined with an MTD driver (
CONFIG_SFC_MTD) which exposes all upgradable firmware and configuration partitions in flash. This works nicely in kernels with MTD enabled, but since MTD is mainly used in embedded systems with on-board flash it is often disabled in distribution kernels and custom kernels alike. This leaves users of sfc unable to upgrade firmware without rebuilding the kernel or booting some other distribution. The lack of widespread MTD support is a regular cause of support requests.
At least Fedora does have MTD enabled. But I guess commercial distributions like RHEL might have it disabled (but I did not check), and I think I could guess the reason for this.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Quoted 10 lines · Artem Bityutskiy
Quoted 8 lines · Ben Hutchings
Currently the sfc network driver is optionally combined with an MTD driver (
CONFIG_SFC_MTD) which exposes all upgradable firmware and configuration partitions in flash. This works nicely in kernels with MTD enabled, but since MTD is mainly used in embedded systems with on-board flash it is often disabled in distribution kernels and custom kernels alike. This leaves users of sfc unable to upgrade firmware without rebuilding the kernel or booting some other distribution. The lack of widespread MTD support is a regular cause of support requests.
Quoted 3 lines
At least Fedora does have MTD enabled. But I guess commercial distributions like RHEL might have it disabled (but I did not check), and I think I could guess the reason for this.
RHEL 4 and 5 have it; the first RHEL 6 beta did not but this was changed at my request.
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.