* make -v switch print debug messages.
authorStefan Reinauer <stepan@openbios.org>
Sun, 18 Dec 2005 16:41:10 +0000 (16:41 +0000)
committerStefan Reinauer <stepan@openbios.org>
Sun, 18 Dec 2005 16:41:10 +0000 (16:41 +0000)
* do case insensitive comparison of mainboards, as wished on the
  mailinglist

git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2146 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

util/flashrom/debug.h
util/flashrom/flash_rom.c
util/flashrom/layout.c

index 7d540b5e2c6993afaf9c8cf389ec60259b18dc78..0614747ba8665e79c51b5ed97b3719591222c618 100644 (file)
@@ -2,6 +2,9 @@
 #define __DEBUG_H__ 1
 
 //#define printf_debug(x...) printf(x)
-#define printf_debug(x...) { }
+
+extern int verbose;
+
+#define printf_debug(x...) { if(verbose) printf(x); }
 
 #endif
index 7b38c8a37eb4cbc7022573951c925e7e34083a7c..fb7d03002aaa29a18cfbc21e0106c0b2c97d6251 100644 (file)
@@ -40,6 +40,9 @@
 
 char *chip_to_probe = NULL;
 
+int exclude_start_page, exclude_end_page;
+int force=0, verbose=0;
+
 struct flashchip *probe_flash(struct flashchip *flash)
 {
        int fd_mem;
@@ -86,7 +89,7 @@ struct flashchip *probe_flash(struct flashchip *flash)
        return NULL;
 }
 
-int verify_flash(struct flashchip *flash, uint8_t *buf, int verbose)
+int verify_flash(struct flashchip *flash, uint8_t *buf)
 {
        int i;
        int total_size = flash->total_size * 1024;
@@ -132,9 +135,6 @@ void usage(const char *name)
        exit(1);
 }
 
-int exclude_start_page, exclude_end_page;
-int force=0;
-
 int main(int argc, char *argv[])
 {
        uint8_t *buf;
@@ -147,7 +147,6 @@ int main(int argc, char *argv[])
            write_it = 0, 
            erase_it = 0, 
            verify_it = 0;
-       int verbose = 0;
 
        static struct option long_options[]= {
                { "read", 0, 0, 'r' },
@@ -340,7 +339,7 @@ int main(int argc, char *argv[])
                flash->write(flash, buf);
 
        if (verify_it)
-               verify_flash(flash, buf, verbose);
+               verify_flash(flash, buf);
 
        return 0;
 }
index 22190962469da72f8bbdd0378ba560102e086612..8ac3af876d05bead4f239c6030eab609acf83b5a 100644 (file)
@@ -50,14 +50,18 @@ int show_id(uint8_t *bios, int size)
                return 0;
        }
        
-       printf("LinuxBIOS image size=%d\n", *walk);
+       printf("LinuxBIOS last image size (not rom size) is %d bytes.\n", *walk);
        
        walk--; mainboard_part=strdup((const char *)(bios+size-*walk));
        walk--; mainboard_vendor=strdup((const char *)(bios+size-*walk));
        printf("MANUFACTURER: %s\n", mainboard_vendor);
        printf("MAINBOARD ID: %s\n", mainboard_part);
-       if(lb_vendor && !strcmp(mainboard_vendor, lb_vendor) && 
-          lb_part && !strcmp(mainboard_part, lb_part)) {
+       
+       /* These comparisons are case insensitive to make things
+        * a little less user^Werror prone. 
+        */
+       if(lb_vendor && !strcasecmp(mainboard_vendor, lb_vendor) && 
+          lb_part && !strcasecmp(mainboard_part, lb_part)) {
                printf ("This firmware image matches "
                        "this motherboard.\n");
        } else {