On Fri, Jun 13, 2008 at 02:30:31PM -0700, Victor Zele wrote:
bash-3.00# ./flashrom -vw sa6k14.rom
..
coreboot last image size (not ROM size) is -1791885312 bytes. Segmentation fault
Victor used the factory flashing utility to update his factory BIOS, then he read back the sa6k14.rom file using flashrom.
When trying to write sa6k14.rom, flashrom mistakes it for a coreboot image and crashes because it is in fact not a coreboot image, and where coreboot stores hints for flashrom, sa6k14.rom has data which is garbage to flashrom.
The problem lies in layout.c:show_id() which does this to identify a factory BIOS:
--8<-- walk = (unsigned int *)(bios + size - 0x10); walk--;
if ((*walk) == 0 || ((*walk) & 0x3ff) != 0) { /* We might have an Nvidia chipset bios * which stores the id information at a * different location. */ walk = (unsigned int *)(bios + size - 0x80); walk--; }
if ((*walk) == 0 || ((*walk) & 0x3ff) != 0) { printf("Flash image seems to be a legacy BIOS. mainboard_vendor = def_name; mainboard_part = def_name; return 0; } -->8--
Seems that the 4 last bytes before the reset vector are checked, and that flashrom considers the image to be coreboot when bits 9-0 are 0 and one or more of bits 31-10 are 1.
This heuristic is no longer good enough. Any ideas for a nice and simple coreboot signature?
//Peter