summaryrefslogtreecommitdiff
path: root/util/cbfstool/common.h
diff options
context:
space:
mode:
authorPatrick Georgi <patrick.georgi@coresystems.de>2009-09-14 13:29:27 +0000
committerPatrick Georgi <patrick.georgi@coresystems.de>2009-09-14 13:29:27 +0000
commitb7b56dd8fbe123958e196f396dab5ff3000b68dd (patch)
tree19972cda7bd87504eeea26ed90535e4aa7585da4 /util/cbfstool/common.h
parentc8d4a05f8f5df06bd98f8ee7d5ef46e61986e6b0 (diff)
downloadcoreboot-b7b56dd8fbe123958e196f396dab5ff3000b68dd.tar.xz
New cbfstool. Works without mmap or fork/exec and
supports fixed location files. Some parts are salvaged from the pre-commit version (esp. stage and payload creation), others are completely rewritten (eg. the main loop that handles file addition) Also adapt newconfig (we don't need cbfs/tools anymore) and fix some minor issues in the cbfstool-README. Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4630 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/cbfstool/common.h')
-rw-r--r--util/cbfstool/common.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/util/cbfstool/common.h b/util/cbfstool/common.h
new file mode 100644
index 0000000000..944f215b5d
--- /dev/null
+++ b/util/cbfstool/common.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2009 coresystems GmbH
+ * written by Patrick Georgi <patrick.georgi@coresystems.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ */
+
+#include <stdint.h>
+
+extern void *offset;
+extern struct cbfs_header *master_header;
+extern uint32_t phys_start, phys_end, align, romsize;
+
+static void *phys_to_virt(uint32_t addr)
+{
+ return offset + addr;
+}
+
+static uint32_t virt_to_phys(void *addr)
+{
+ return (long)(addr - offset) & 0xffffffff;
+}
+
+#define ALIGN(val, by) (((val) + (by)-1)&~((by)-1))
+
+void *loadfile(const char *filename, uint32_t * romsize_p, void *content,
+ int place);
+void *loadrom(const char *filename);
+void writerom(const char *filename, void *start, uint32_t size);
+
+int iself(unsigned char *input);
+
+typedef void (*comp_func_ptr) (char *, int, char *, int *);
+typedef enum { CBFS_COMPRESS_NONE = 0, CBFS_COMPRESS_LZMA = 1 } comp_algo;
+
+comp_func_ptr compression_function(comp_algo algo);
+
+uint64_t intfiletype(const char *name);
+
+int parse_elf_to_payload(unsigned char *input, unsigned char **output,
+ comp_algo algo);
+int parse_elf_to_stage(unsigned char *input, unsigned char **output,
+ comp_algo algo, uint32_t * location);
+
+void *create_cbfs_file(const char *filename, void *data, uint32_t * datasize,
+ uint32_t type, uint32_t * location);
+
+int create_cbfs_image(const char *romfile, uint32_t romsize,
+ const char *bootblock, uint32_t align);
+
+int add_file_to_cbfs(void *content, uint32_t contentsize, uint32_t location);
+void print_cbfs_directory(const char *filename);