Discussion:
[flashrom] Mysterious MAC-Address Changes after BIOS-Upgrade with flashrom
Peter Daum
2010-11-24 16:43:17 UTC
Permalink
Hi,

I have a whole bunch of machines with identical main boards (ASRock G43Twins FullHD, AMI BIOS) and am trying to upgrade the firmware using flashrom. At first sight everything looks fine (see the protocol attached below). Unfortunately, after some tests, I noted a pretty mysterious phenomenon:

In many cases, after the next reboot the machines network interfaces have a different MAC-address -even worse, they all have _the same_ MAC address (00:19:66:97:d7:e2). I tried it in many variations, but could not really detect any system - even under identical circumstances this problem seems occurs very often, but not always. If I restore the original ROM contents (after I noticed the problem, I always saved the original firmware) the machines always get their original MAC address back (but of course also the buggy bios that I am trying to upgrade). The ROM contents of the machines do contain their MAC addresses at a certain offset but in the vendor supplied BIOS image that I flash has all bits set to 1 in this and several other (obviously data) areas, the mysterious "default" MAC address
"00:19:66:97:d7:e2" does not occur in this file. When I flash the file under DOS using afudos.exe ("AMI firmware update utility 4.14"), the machines will keep their original MAC address.(As I just noticed, that program also has an option to explicitly set the MAC address).

Does anybody have an idea, what is going on here? (As I said, the phenomenon does not even seem to be deterministic). Maybe even an idea, how to do the upgrade using flashrom? (The machines are integrated in some Linux-based management system, so using flashrom I could do the upgrade automatic; except for the problem with the duplicated MAC addresses everything seems to work just fine after flashing the BIOS with flashrom).

Regards,
Peter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

flashrom v0.9.2-r1141 on Linux 2.6.32-5-686 (i686), built with libpci 3.1.7, GCC 4.4.5 20100728 (prerelease), little endian
flashrom is free software, get the source code at http://www.flashrom.org

Calibrating delay loop... OK.
No coreboot table found.
Found chipset "Intel ICH10", enabling flash write... OK.
This chipset supports the following protocols: FWH,SPI.
Found chip "Macronix MX25L8005" (1024 KB, SPI) at physical address 0xfff00000.
Flash image seems to be a legacy BIOS. Disabling checks.
Writing flash chip... Erasing flash before programming... Erasing flash chip... spi_block_erase_20 failed during command execution at address 0x0
spi_block_erase_52 failed during command execution at address 0x0
SUCCESS.
done.
Programming flash... done.
COMPLETE.
Verifying flash... VERIFIED.
David Hendricks
2010-11-24 19:33:57 UTC
Permalink
Post by Peter Daum
In many cases, after the next reboot the machines network interfaces have a
different MAC-address -even worse, they all have _the same_ MAC address
(00:19:66:97:d7:e2). I tried it in many variations, but could not really
detect any system - even under identical circumstances this problem seems
occurs very often, but not always. If I restore the original ROM contents
(after I noticed the problem, I always saved the original firmware) the
machines always get their original MAC address back (but of course also the
buggy bios that I am trying to upgrade). The ROM contents of the machines do
contain their MAC addresses at a certain offset but in the vendor supplied
BIOS image that I flash has all bits set to 1 in this and several other
(obviously data) areas, the mysterious "default" MAC address
"00:19:66:97:d7:e2" does not occur in this file. When I flash the file
under DOS using afudos.exe ("AMI firmware update utility 4.14"), the
machines will keep their original MAC address.(As I just noticed, that
program also has an option to explicitly set the MAC address).
Does anybody have an idea, what is going on here? (As I said, the
phenomenon does not even seem to be deterministic). Maybe even an idea, how
to do the upgrade using flashrom? (The machines are integrated in some
Linux-based management system, so using flashrom I could do the upgrade
automatic; except for the problem with the duplicated MAC addresses
everything seems to work just fine after flashing the BIOS with flashrom).
Indeed, sometimes the ethernet MAC ID is fuddled by the BIOS :-/ As a
workaround, perhaps you can use ethtool to write the MAC ID after upgrading
with Flashrom.

The "00:19:66:97:d7:e2" you're seeing can be encoded in numerous ways and
probably omits the ':' character. It may also be in a compressed portion of
the image. To find the bytes, try:
1. In Linux, dump the bios image using Flashrom (flashrom -r)
2. Boot into DOS or Windows to set the MAC address to a temporary value
(e.g. 01:23:45:67:89:ab) using AMI's utility
3. Reboot into Linux
4. Dump the BIOS again to a separate file
5. hexdump the two files and see which bytes changed (hexdump -C old.bin >
old.bin.hex; hexdump -C new.bin > new.bin.hex; sdiff -s old.bin.hex
new.bin.hex)

If this does not reveal the location of the MAC ID, it will at least provide
information about whether or not the relevant bytes are compressed.
--
David Hendricks (dhendrix)
Systems Software Engineer, Google Inc.
Peter Daum
2010-11-24 21:06:51 UTC
Permalink
Post by David Hendricks
The "00:19:66:97:d7:e2" you're seeing can be encoded in numerous ways and
probably omits the ':' character. It may also be in a compressed portion
of the image.
... actually, I already know the position, where the bios stores the MAC address. Unfortunately, it does not work to just change the address in the bios image and write the changed image back:
- In the image file that is provided by the vendor, these bytes
just contain ff:ff:ff:ff:ff:ff (without ":")
- When I flash the bios using the AMI tool, reboot and then compare
the actual bios contents with the file, those bytes have been overwritten
with the machine's MAC address (+ many other changes)
- When I flash the same image using flashroom, the MAC address is sometimes
unchanged, sometimes changed to 00:19:66:97:d7:e2; in any case, the
corresponding position in the bios also contains the MAC address again.
- My attempts to change the MAC address on file and then flash it always
ended with "00:19:66:97:d7:e2", no matter which address I used
- When I take a complete bios image from another machine and flash it,
the machine gets the MAC address from the machine the bios image
originally came from

Loading...