summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2015-07-04 11:30:59 -0700
committerStefan Reinauer <stefan.reinauer@coreboot.org>2015-07-07 18:30:32 +0200
commitcfa9b99b23702ed35d61c9fcf3ad30ec55280174 (patch)
treee470dd6b71a9f07b51df2754781bf6c2df715309 /util
parent19ba110c2d04452553b9e07d910ccf6458be4f9b (diff)
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)
Diffstat (limited to 'util')
-rw-r--r--util/cbfstool/cbfs.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/util/cbfstool/cbfs.h b/util/cbfstool/cbfs.h
index befdb2fc4b..8092057d14 100644
--- a/util/cbfstool/cbfs.h
+++ b/util/cbfstool/cbfs.h
@@ -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.