Add multi-architecture support to cbfstool
This is an initial re-factoring of CBFS code to enable multiple
architectures. To achieve a clean solution, an additional field
describing the architecture has to be added to the master header.
Hence we also increase the version number in the master header.
Change-Id: Icda681673221f8c27efbc46f16c2c5682b16a265
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: http://review.coreboot.org/1944
Tested-by: build bot (Jenkins)
diff --git a/util/cbfstool/cbfs.h b/util/cbfstool/cbfs.h
index f161ed4..5251d65 100644
--- a/util/cbfstool/cbfs.h
+++ b/util/cbfstool/cbfs.h
@@ -21,6 +21,12 @@
#include <stdint.h>
+#define CBFS_HEADER_MAGIC 0x4F524243
+#define CBFS_HEADPTR_ADDR_X86 0xFFFFFFFC
+#define VERSION1 0x31313131
+#define VERSION2 0x31313132
+#define VERSION VERSION2
+
struct cbfs_header {
uint32_t magic;
uint32_t version;
@@ -28,9 +34,14 @@
uint32_t bootblocksize;
uint32_t align;
uint32_t offset;
- uint32_t pad[2];
+ uint32_t architecture; /* Version 2 */
+ uint32_t pad[1];
} __attribute__ ((packed));
+#define CBFS_ARCHITECTURE_UNKNOWN 0xFFFFFFFF
+#define CBFS_ARCHITECTURE_X86 0x00000001
+#define CBFS_ARCHITECTURE_ARMV7 0x00000010
+
struct cbfs_file {
uint8_t magic[8];
uint32_t len;
@@ -94,7 +105,7 @@
*/
#define CBFS_COMPONENT_NULL 0xFFFFFFFF
-int cbfs_file_header(uint32_t physaddr);
+int cbfs_file_header(unsigned long physaddr);
struct cbfs_file *cbfs_create_empty_file(uint32_t physaddr, uint32_t size);
#endif