[SeaBIOS] [PATCH] coreboot: Support alternative locations for CBFS.

Kevin O'Connor kevin at koconnor.net
Sat Jan 18 02:27:19 CET 2014


The Google builds of SeaBIOS place the CBFS data in a non-standard
location.  Add a config parameter to support non-standard locations.
This is based on a patch from Stefan Reinauer <reinauer at chromium.org>
in the Chromium seabios repo (commit 60534ec785).

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/Kconfig       | 12 +++++++++++-
 src/fw/coreboot.c |  6 +++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/Kconfig b/src/Kconfig
index a42ab2d..071a16e 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -96,7 +96,17 @@ endchoice
         default y
         help
             Support CBFS files compressed using the lzma decompression
-            algorighm.
+            algorithm.
+    config CBFS_LOCATION
+        depends on COREBOOT_FLASH
+        hex "CBFS memory end location"
+        default 0
+        help
+            Memory address of where the CBFS data ends.  This should
+            be zero for normal builds.  It may be a non-zero value if
+            the CBFS filesystem is at a non-standard location (eg,
+            0xffe00000 if CBFS ends 2Meg below the end of flash).
+
     config FLASH_FLOPPY
         depends on COREBOOT_FLASH
         bool "Floppy images in CBFS"
diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c
index 01a6fcd..0bdd68b 100644
--- a/src/fw/coreboot.c
+++ b/src/fw/coreboot.c
@@ -297,7 +297,6 @@ ulzma(u8 *dst, u32 maxlen, const u8 *src, u32 srclen)
  ****************************************************************/
 
 #define CBFS_HEADER_MAGIC 0x4F524243
-#define CBFS_HEADPTR_ADDR 0xFFFFFFFc
 #define CBFS_VERSION1 0x31313131
 
 struct cbfs_header {
@@ -369,7 +368,7 @@ coreboot_cbfs_init(void)
     if (!CONFIG_COREBOOT_FLASH)
         return;
 
-    struct cbfs_header *hdr = *(void **)CBFS_HEADPTR_ADDR;
+    struct cbfs_header *hdr = *(void **)(CONFIG_CBFS_LOCATION - 4);
     if (hdr->magic != cpu_to_be32(CBFS_HEADER_MAGIC)) {
         dprintf(1, "Unable to find CBFS (ptr=%p; got %x not %x)\n"
                 , hdr, hdr->magic, cpu_to_be32(CBFS_HEADER_MAGIC));
@@ -377,7 +376,8 @@ coreboot_cbfs_init(void)
     }
     dprintf(1, "Found CBFS header at %p\n", hdr);
 
-    struct cbfs_file *fhdr = (void *)(0 - be32_to_cpu(hdr->romsize)
+    struct cbfs_file *fhdr = (void *)(CONFIG_CBFS_LOCATION
+                                      - be32_to_cpu(hdr->romsize)
                                       + be32_to_cpu(hdr->offset));
     for (;;) {
         if (fhdr < (struct cbfs_file *)(0xFFFFFFFF - be32_to_cpu(hdr->romsize)))
-- 
1.8.3.1




More information about the SeaBIOS mailing list