Add SMSC SCH3114 superio register descriptions to superiotool.
[coreboot.git] / util / cbfstool / cbfs-mkpayload.c
index 4f0e2481234fbd7549ec44490367a7f6d33ca353..baa92ff2375629256959330773e43397067fa0af 100644 (file)
@@ -27,7 +27,6 @@
 #include <fcntl.h>
 #include <getopt.h>
 #include <sys/stat.h>
-#include <arpa/inet.h>
 
 #include "common.h"
 #include "cbfs.h"
@@ -48,6 +47,12 @@ int parse_elf_to_payload(unsigned char *input, unsigned char **output,
        struct cbfs_payload_segment *segs;
        int i;
 
+       if(!iself(input)){
+               printf("Fatal error: the payload file is not in ELF format!\n");
+               exit(1);
+       }
+
+
        comp_func_ptr compress = compression_function(algo);
        if (!compress)
                return -1;
@@ -75,8 +80,10 @@ int parse_elf_to_payload(unsigned char *input, unsigned char **output,
 
                name = (char *)(strtab + shdr[i].sh_name);
 
-               if (!strcmp(name, ".note.pinfo"))
+               if (!strcmp(name, ".note.pinfo")) {
                        segments++;
+                       isize += (unsigned int)shdr[i].sh_size;
+               }
        }
 
        /* Now, regular headers - we only care about PT_LOAD headers,