Alexandru Gagniuc (mr.nuke.me@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5103
-gerrit
commit f26decb8acd759445758595c955e793ed702dca1 Author: Alexandru Gagniuc mr.nuke.me@gmail.com Date: Sun Feb 2 21:48:18 2014 -0600
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 --- util/cbfstool/common.c | 120 ------------------------------------------------- util/cbfstool/common.h | 3 -- 2 files changed, 123 deletions(-)
diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c index b646cec..0aaeb13 100644 --- a/util/cbfstool/common.c +++ b/util/cbfstool/common.c @@ -676,126 +676,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 4a0a632..a50419b 100644 --- a/util/cbfstool/common.h +++ b/util/cbfstool/common.h @@ -106,9 +106,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);