summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Gagniuc <mr.nuke.me@gmail.com>2014-02-02 21:48:18 -0600
committerRonald G. Minnich <rminnich@gmail.com>2014-02-03 17:02:38 +0100
commitbc06691a3bcb799954074bbff8846db5fd31afe6 (patch)
tree820716780bf65207b4603a713e3c375ce232c2e5
parentebe3b3cfe212a2e985e12f1ab93bdef4487733f5 (diff)
cbfstool: remove unused function create_cbfs_image()
It's not used anymore. Instead, we have the better replacements cbfs_image_create() and cbfs_image_from_file(). Change-Id: I7835f339805f6b41527fe3550028b29f79e35d13 Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-on: http://review.coreboot.org/5103 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
-rw-r--r--util/cbfstool/common.c120
-rw-r--r--util/cbfstool/common.h3
2 files changed, 0 insertions, 123 deletions
diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c
index 356ba2f4db..e10d9fb4c4 100644
--- a/util/cbfstool/common.c
+++ b/util/cbfstool/common.c
@@ -666,126 +666,6 @@ void *create_cbfs_file(const char *filename, void *data, uint32_t * datasize,
return newdata;
}
-int create_cbfs_image(const char *romfile, uint32_t _romsize,
- const char *bootblock, uint32_t create_align, uint32_t offs)
-{
- uint32_t bootblocksize = 0;
- struct cbfs_header *master_header;
- unsigned char *romarea, *bootblk;
-
- romsize = _romsize;
- romarea = malloc(romsize);
- if (!romarea) {
- ERROR("Could not get %d bytes of memory"
- " for CBFS image.\n", romsize);
- exit(1);
- }
- memset(romarea, 0xff, romsize);
-
- if (create_align == 0)
- create_align = 64;
-
- bootblk = loadfile(bootblock, &bootblocksize,
- romarea + romsize, SEEK_END);
- if (!bootblk) {
- ERROR("Could not load bootblock %s.\n",
- bootblock);
- free(romarea);
- return 1;
- }
-
- // TODO(hungte) Replace magic numbers by named constants.
- switch (arch) {
- case CBFS_ARCHITECTURE_ARMV7:
- /* Set up physical/virtual mapping */
- cbfstool_offset = romarea;
-
- /*
- * The initial jump instruction and bootblock will be placed
- * before and after the master header, respectively. The
- * bootblock image must contain a blank, aligned region large
- * enough for the master header to fit.
- *
- * An anchor string must be left such that when cbfstool is run
- * we can find it and insert the master header at the next
- * aligned boundary.
- */
- loadfile(bootblock, &bootblocksize, romarea + offs, SEEK_SET);
-
- unsigned char *p = romarea + offs;
- while (1) {
- /* FIXME: assumes little endian... */
- if (*(uint32_t *)p == 0xdeadbeef)
- break;
- if (p >= (romarea + _romsize)) {
- ERROR("Could not determine CBFS "
- "header location.\n");
- return 1;
- }
- p += (sizeof(unsigned int));
- }
- unsigned int u = ALIGN((unsigned int)(p - romarea), align);
- master_header = (struct cbfs_header *)(romarea + u);
-
- master_header->magic = ntohl(CBFS_HEADER_MAGIC);
- master_header->version = ntohl(CBFS_HEADER_VERSION);
- master_header->romsize = htonl(romsize);
- master_header->bootblocksize = htonl(bootblocksize);
- master_header->align = htonl(align);
- master_header->offset = htonl(
- ALIGN((0x40 + bootblocksize), align));
- master_header->architecture = htonl(CBFS_ARCHITECTURE_ARMV7);
-
- ((uint32_t *) phys_to_virt(0x4 + offs))[0] =
- virt_to_phys(master_header);
-
- recalculate_rom_geometry(romarea);
-
- cbfs_create_empty_file(
- offs + ALIGN((0x40 + bootblocksize), align),
- romsize - offs - sizeof(struct cbfs_file) -
- ALIGN((bootblocksize + 0x40), align));
- break;
-
- case CBFS_ARCHITECTURE_X86:
- // Set up physical/virtual mapping
- cbfstool_offset = romarea + romsize - 0x100000000ULL;
-
- loadfile(bootblock, &bootblocksize, romarea + romsize,
- SEEK_END);
- master_header = (struct cbfs_header *)(romarea + romsize -
- bootblocksize - sizeof(struct cbfs_header));
-
- master_header->magic = ntohl(CBFS_HEADER_MAGIC);
- master_header->version = ntohl(CBFS_HEADER_VERSION);
- master_header->romsize = htonl(romsize);
- master_header->bootblocksize = htonl(bootblocksize);
- master_header->align = htonl(align);
- master_header->offset = htonl(offs);
- master_header->architecture = htonl(CBFS_ARCHITECTURE_X86);
-
- ((uint32_t *) phys_to_virt(CBFS_HEADPTR_ADDR_X86))[0] =
- virt_to_phys(master_header);
-
- recalculate_rom_geometry(romarea);
-
- cbfs_create_empty_file((0 - romsize + offs) & 0xffffffff,
- romsize - offs - bootblocksize -
- sizeof(struct cbfs_header) -
- sizeof(struct cbfs_file) - 16);
- break;
-
- default:
- // Should not happen.
- ERROR("You found a bug in cbfstool.\n");
- exit(1);
- }
-
- writerom(romfile, romarea, romsize);
- free(romarea);
- return 0;
-}
-
static int in_segment(int addr, int size, int gran)
{
return ((addr & ~(gran - 1)) == ((addr + size) & ~(gran - 1)));
diff --git a/util/cbfstool/common.h b/util/cbfstool/common.h
index e49a3f6535..e41618f1cd 100644
--- a/util/cbfstool/common.h
+++ b/util/cbfstool/common.h
@@ -117,9 +117,6 @@ int parse_elf_to_stage(const struct buffer *input, struct buffer *output,
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, uint32_t offs);
-
int add_file_to_cbfs(void *content, uint32_t contentsize, uint32_t location);
int remove_file_from_cbfs(const char *filename);
void print_cbfs_directory(const char *filename);