cbfstool: Make sure CBFS data structures are packed gcc style

On Windows systems, structs can be packed gcc style or ms style.
Make sure we use the same one (gcc style) in our user space tools
that we use in coreboot.

Change-Id: I7a9ea7368f77fba53206e953b4d5ca219ed4c12e
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Signed-off-by: Scott Duplichan <scott@notabs.org>
Reviewed-on: http://review.coreboot.org/10794
Tested-by: build bot (Jenkins)
This commit is contained in:
Stefan Reinauer 2015-07-04 11:30:59 -07:00
parent 19ba110c2d
commit cfa9b99b23
1 changed files with 11 additions and 5 deletions

View File

@ -32,6 +32,12 @@
#define makemagic(b3, b2, b1, b0)\
(((b3)<<24) | ((b2) << 16) | ((b1) << 8) | (b0))
#if defined(__WIN32) || defined(__WIN64)
#define __PACKED __attribute__((gcc_struct, packed))
#else
#define __PACKED __attribute__((packed))
#endif
// Alignment (in bytes) to be used when no master header is present
#define CBFS_ENTRY_ALIGNMENT 64
@ -50,7 +56,7 @@ struct cbfs_header {
uint32_t offset;
uint32_t architecture; /* Version 2 */
uint32_t pad[1];
} __attribute__ ((packed));
} __PACKED;
#define CBFS_ARCHITECTURE_UNKNOWN 0xFFFFFFFF
#define CBFS_ARCHITECTURE_X86 0x00000001
@ -67,7 +73,7 @@ struct cbfs_file {
uint32_t type;
uint32_t checksum;
uint32_t offset;
} __attribute__ ((packed));
} __PACKED;
struct cbfs_stage {
uint32_t compression;
@ -75,7 +81,7 @@ struct cbfs_stage {
uint64_t load;
uint32_t len;
uint32_t memlen;
} __attribute__ ((packed));
} __PACKED;
#define PAYLOAD_SEGMENT_CODE makemagic('C', 'O', 'D', 'E')
#define PAYLOAD_SEGMENT_DATA makemagic('D', 'A', 'T', 'A')
@ -90,11 +96,11 @@ struct cbfs_payload_segment {
uint64_t load_addr;
uint32_t len;
uint32_t mem_len;
} __attribute__ ((packed));
} __PACKED;
struct cbfs_payload {
struct cbfs_payload_segment segments;
} __attribute__ ((packed));
} __PACKED;
/** These are standard component types for well known
components (i.e - those that coreboot needs to consume.