Hi,

I tried to perform a firmware update on an IPMI card with
ipmitool verion 1.8.10 (I also tried 1.8.11 now, the patches are
against 1.8.11, it seems there were no significant changes) and got:

ipmitool -I open fwum upgrade OPMA-M3G4-RevK-APML-Support-040400-7205.bin
WUM extension Version 1.3                                                       
                                                                                
     
Upgrading using file name OPMA-M3G4-RevK-APML-Support-040400-7205.bin           
                                                                                
      
Segmentation fault (core dumped)                                          0 %

The gdb backtrace showed:
#0  0x00007f0742328053 in fread () from /lib64/libc.so.6                        
                        
(gdb) bt
#0  0x00007f0742328053 in fread () from /lib64/libc.so.6
#1  0x000000000042d20a in KfwumMain (intf=0x68a900, task=KFWUM_TASK_UPGRADE) at 
ipmi_fwum.c:524
#2  0x000000000042d82b in ipmi_fwum_main (intf=0x68a900, argc=<value optimized 
out>, argv=0x7fff4b053f18) at ipmi_fwum.c:249
#3  0x000000000043162d in ipmi_main (argc=6, argv=0x7fff4b053ef8, 
cmdlist=0x678480, intflist=0x0) at ipmi_main.c:637        
#4  0x00000000004046f0 in main (argc=3, argv=0x4000) at ipmitool.c:122

and looking into this I found that the firmware file must not
be bigger than 512K. Attached is a patch that increases the possible
firmware size and avoids segfaults, even if the filesize should still
be bigger.

I tried again and now it is complaining that the
Firmware is invalid for the target board.

The second attached patch is providing a bit more info if this happens,
I then get:
FWUM extension Version 1.3
Upgrading using file name /tmp/OPMA-M3G4-RevK-APML-Support-040400-7205.bin
Reading Firmware from File : ########################################## 100 %
Board IANA [10437] does not match firmware IANA [57760]
Error: Board ID [2] does not match firmware board ID [2030]
Firmware invalid for target board.  Download of upgrade aborted
Target Board Id            : 2
Target IANA number         : 10437
FW File Board Id           : 2030
FW File IANA number        : 57760
File Size                  : 41187 bytes
Firmware Version           : 14.014 SDR 240

So it looks like the firmware file is somewhat wronlgy parsed.
Before I go on here, I have some questions:
  - the ipmi_fwum.c file looks as if it didn't get much maintenance
    and has a totally other coding style than other files
    Does it make sense at all to look further at this or do I have
    to expect to stumble from one problem into the other again and
    again.
  - I won't be able to re-flash my IPMI card if something goes wrong
    while flashing. How high are the chances that I convert my card into
    a brick (some hints to avoid this?)?
  - Is there another ipmi firmware flasher Linux tool than ipmitool fwum which
    is more widely spread or the tool everyone else is using :)

Thanks,

   Thomas

PS: Someone might want to add these two patches to the ipmitools repo.
    They are harmless and will help if others also try ipmitools fwum and
    run into similar issues.
Be more verbose when detecting a board mismatch when trying to flash the firmware

Signed-off-by: Thomas Renninger <tr...@suse.de>

---
 lib/ipmi_fwum.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Index: ipmitool-1.8.11/lib/ipmi_fwum.c
===================================================================
--- ipmitool-1.8.11.orig/lib/ipmi_fwum.c
+++ ipmitool-1.8.11/lib/ipmi_fwum.c
@@ -1655,13 +1655,15 @@ tKFWUM_Status KfwumValidFirmwareForBoard
 
    if(boardInfo.iana != firmInfo.iana)
    {
-      printf("Board IANA does not match firmware IANA\n");
+      printf("Board IANA [%u] does not match firmware IANA [%u]\n",
+         boardInfo.iana, firmInfo.iana);
       status = KFWUM_STATUS_ERROR;
    }
 
    if(boardInfo.boardId != firmInfo.boardId)
    {
-      printf("Board IANA does not match firmware IANA\n");
+      printf("Error: Board ID [%u] does not match firmware board ID [%u]\n",
+         boardInfo.boardId, firmInfo.boardId);
       status = KFWUM_STATUS_ERROR;
    }
 
@@ -1679,6 +1681,8 @@ static void KfwumOutputInfo(tKFWUM_Board
 {
    printf("Target Board Id            : %u\n",boardInfo.boardId);
    printf("Target IANA number         : %u\n",boardInfo.iana);
+   printf("FW File Board Id           : %u\n",firmInfo.boardId);
+   printf("FW File IANA number        : %u\n",firmInfo.iana);
    printf("File Size                  : %lu bytes\n",firmInfo.fileSize);
    printf("Firmware Version           : %d.%d%d SDR %d\n",firmInfo.versMajor,
                    firmInfo.versMinor, firmInfo.versSubMinor, firmInfo.sdrRev);
Increase possible file size for FW upgrades and avoid segfaults if still too big

Signed-off-by: Thomas Renninger <tr...@suse.de>

---
 lib/ipmi_fwum.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: ipmitool-1.8.11/lib/ipmi_fwum.c
===================================================================
--- ipmitool-1.8.11.orig/lib/ipmi_fwum.c
+++ ipmitool-1.8.11/lib/ipmi_fwum.c
@@ -141,7 +141,8 @@ typedef struct sKFWUM_SaveFirmwareInfo
 
 extern int verbose;
 static unsigned char fileName[512];
-static unsigned char firmBuf[1024*512];
+#define MAX_FW_FILE_SIZE 1024*512
+static unsigned char firmBuf[MAX_FW_FILE_SIZE];
 static tKFWUM_SaveFirmwareInfo saveFirmwareInfo;
 
 static void KfwumOutputHelp(void);
@@ -516,6 +517,12 @@ static tKFWUM_Status KfwumSetupBuffersFr
       int modulus = fileSize % MAX_BUFFER_SIZE;
       int qty     =0;
 
+      if(fileSize >= MAX_FW_FILE_SIZE)
+      {
+         printf("Error: Firmware file size exceeds %dK\n", MAX_FW_FILE_SIZE / 1024);
+         return KFWUM_STATUS_ERROR;
+      }
+
       rewind(pFileHandle);
 
       for(qty=0;qty<count;qty++)
------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to