diff options
author | David Hendricks <dhendrix@chromium.org> | 2012-11-16 14:48:22 -0800 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2012-11-30 00:42:31 +0100 |
commit | 90ca3b6bd7d7849898fe2363a9e6d0e002c95943 (patch) | |
tree | be21c4f63d3f01afa0ec98018d83131c4f150f52 /src | |
parent | 11a20b614e708582ebd7607d39487938f35f2550 (diff) |
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)
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/x86/Makefile.inc | 2 | ||||
-rw-r--r-- | src/include/cbfs_core.h | 26 |
2 files changed, 19 insertions, 9 deletions
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc index 68e5dcdd07..4afa7d5430 100644 --- a/src/arch/x86/Makefile.inc +++ b/src/arch/x86/Makefile.inc @@ -65,7 +65,7 @@ prebuild-files = \ prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file))) $(obj)/coreboot.pre1: $(objcbfs)/bootblock.bin $$(prebuilt-files) $(CBFSTOOL) - $(CBFSTOOL) $@.tmp create -s $(CONFIG_COREBOOT_ROMSIZE_KB)K \ + $(CBFSTOOL) $@.tmp create -m x86 -s $(CONFIG_COREBOOT_ROMSIZE_KB)K \ -B $(objcbfs)/bootblock.bin -a 64 \ -o $$(( $(CONFIG_ROM_SIZE) - $(CONFIG_CBFS_SIZE) )) $(prebuild-files) true diff --git a/src/include/cbfs_core.h b/src/include/cbfs_core.h index 43e6b9b1d3..32f2670b5b 100644 --- a/src/include/cbfs_core.h +++ b/src/include/cbfs_core.h @@ -2,6 +2,7 @@ * This file is part of the coreboot project. * * Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net> + * Copyright (C) 2012 Google, Inc. * * This file is dual-licensed. You can choose between: * - The GNU GPL, version 2, as published by the Free Software Foundation @@ -49,8 +50,6 @@ #ifndef _CBFS_CORE_H_ #define _CBFS_CORE_H_ -#include <arch/byteorder.h> - /** These are standard values for the known compression alogrithms that coreboot knows about for stages and payloads. Of course, other CBFS users can use whatever @@ -78,13 +77,17 @@ /** this is the master cbfs header - it need to be located somewhere in the bootblock. Where it - actually lives is up to coreboot. A pointer to - this header will live at 0xFFFFFFFc, so we can - easily find it. */ + actually lives is up to coreboot. On x86, a + pointer to this header will live at 0xFFFFFFFC, + so we can easily find it. */ #define CBFS_HEADER_MAGIC 0x4F524243 -#define CBFS_HEADPTR_ADDR 0xFFFFFFFc +#if CONFIG_ARCH_X86 +#define CBFS_HEADPTR_ADDR 0xFFFFFFFC +#endif #define VERSION1 0x31313131 +#define VERSION2 0x31313132 +#define VERSION VERSION2 struct cbfs_header { uint32_t magic; @@ -93,9 +96,17 @@ struct cbfs_header { uint32_t bootblocksize; uint32_t align; uint32_t offset; - uint32_t pad[2]; + uint32_t architecture; + uint32_t pad[1]; } __attribute__((packed)); +/* "Unknown" refers to CBFS headers version 1, + * before the architecture was defined (i.e., x86 only). + */ +#define CBFS_ARCHITECTURE_UNKNOWN 0xFFFFFFFF +#define CBFS_ARCHITECTURE_X86 0x00000001 +#define CBFS_ARCHITECTURE_ARMV7 0x00000010 + /** This is a component header - every entry in the CBFS will have this header. @@ -180,4 +191,3 @@ void *cbfs_find_file(const char *name, int type); int cbfs_decompress(int algo, void *src, void *dst, int len); struct cbfs_header *get_cbfs_header(void); #endif - |