On Sunday 27 Mar 2011 18:14:27 Tadas wrote:
> I'm trying to flash this NIC to support ipxe. As I couldn't find any
> original software for flashing from 3COM, I tried using flashrom. Flashrom
> supports flashing 3COM NIC's, but I ran into problem. IPXE generated image
> is 59.5 KiB and space in NIC option ROM ir 64 KiB. The main problem is that
> flashrom can't use images if they aren't the same size as ROM. Can I
> somehow generate IPXE image that is exactly 64 KiB in size, o should I
> report this issue to flashrom devs?
As a workaround, you can manually pad the image using util/padimg.pl. For
example:
make bin/10b79200.rom
./util/padimg.pl --blksize=65536 --byte=0xff bin/10b79200.rom
will produce a 64kB ROM image.
Being able to use non-padded images does seem like a sensible feature request
for flashrom. You could try the attached flashrom patch (which compiles, but
is
otherwise totally untested). It should allow you to use an image that is
smaller than the space available in the ROM. Please let me know if it works!
Michael
diff --git a/flashrom.c b/flashrom.c
index 34248ed..235fdd8 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1228,6 +1228,7 @@ int read_buf_from_file(unsigned char *buf, unsigned long size, char *filename)
unsigned long numbytes;
FILE *image;
struct stat image_stat;
+ unsigned long image_size;
if ((image = fopen(filename, "rb")) == NULL) {
perror(filename);
@@ -1238,19 +1239,20 @@ int read_buf_from_file(unsigned char *buf, unsigned long size, char *filename)
fclose(image);
return 1;
}
- if (image_stat.st_size != size) {
- msg_gerr("Error: Image size doesn't match\n");
+ image_size = image_stat.st_size;
+ if (image_size > size) {
+ msg_gerr("Error: Image too large\n");
fclose(image);
return 1;
}
- numbytes = fread(buf, 1, size, image);
+ numbytes = fread(buf, 1, image_size, image);
if (fclose(image)) {
perror(filename);
return 1;
}
- if (numbytes != size) {
+ if (numbytes != image_size) {
msg_gerr("Error: Failed to read complete file. Got %ld bytes, "
- "wanted %ld!\n", numbytes, size);
+ "wanted %ld!\n", numbytes, image_size);
return 1;
}
return 0;
_______________________________________________
ipxe-devel mailing list
[email protected]
https://lists.ipxe.org/mailman/listinfo/ipxe-devel