From 632175802e3d6c3265aa6f511a5aa400d00953d1 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Mon, 29 Oct 2012 16:52:36 -0700 Subject: cbfstool: Rework to use getopt style parameters - Adding more and more optional and non-optional parameters bloated cbfstool and made the code hard to read with a lot of parsing in the actual cbfs handling functions. This change switches over to use getopt style options for everything but command and cbfs file name. - This allows us to simplify the coreboot Makefiles a bit - Also, add guards to include files - Fix some 80+ character lines - Add more detailed error reporting - Free memory we're allocating Signed-off-by: Stefan Reinauer Change-Id: Ia9137942deb8d26bbb30068e6de72466afe9b0a7 Reviewed-on: http://review.coreboot.org/1800 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- util/cbfstool/common.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'util/cbfstool/common.h') diff --git a/util/cbfstool/common.h b/util/cbfstool/common.h index 7ef50c41e1..4fcc1eee68 100644 --- a/util/cbfstool/common.h +++ b/util/cbfstool/common.h @@ -16,6 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA */ +#ifndef __CBFSTOOL_COMMON_H +#define __CBFSTOOL_COMMON_H + #include #include "swab.h" #define ntohl(x) (host_bigendian?(x):swab32(x)) @@ -24,8 +27,7 @@ #define htonll(x) (host_bigendian?(x):swab64(x)) extern void *offset; -extern struct cbfs_header *master_header; -extern uint32_t phys_start, phys_end, align, romsize; +extern uint32_t romsize; extern int host_bigendian; static inline void *phys_to_virt(uint32_t addr) @@ -40,7 +42,7 @@ static inline uint32_t virt_to_phys(void *addr) #define ALIGN(val, by) (((val) + (by)-1)&~((by)-1)) -uint32_t getfilesize(const char *filename); +size_t getfilesize(const char *filename); void *loadfile(const char *filename, uint32_t * romsize_p, void *content, int place); void *loadrom(const char *filename); @@ -77,4 +79,6 @@ uint32_t cbfs_find_location(const char *romfile, uint32_t filesize, void print_supported_filetypes(void); -#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +#define ARRAY_SIZE(a) (int)(sizeof(a) / sizeof((a)[0])) + +#endif -- cgit v1.2.3