aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/cbfstool/cbfstool.c22
-rw-r--r--util/cbfstool/common.c8
-rw-r--r--util/cbfstool/common.h3
3 files changed, 19 insertions, 14 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 913fd330ac..f74497c78f 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -245,7 +245,11 @@ static int cbfs_create(int argc, char **argv)
if (argc > 5)
align = strtoul(argv[5], NULL, 0);
- return create_cbfs_image(romname, size, bootblock, align);
+ uint32_t offs = 0;
+ if (argc > 6)
+ offs = strtoul(argv[6], NULL, 0);
+
+ return create_cbfs_image(romname, size, bootblock, align, offs);
}
static int cbfs_locate(int argc, char **argv)
@@ -318,14 +322,14 @@ static void usage(void)
" cbfstool FILE COMMAND [PARAMETERS]...\n\n" "OPTIONs:\n"
" -h Display this help message\n\n"
"COMMANDs:\n"
- " add FILE NAME TYPE [base address] Add a component\n"
- " add-payload FILE NAME [COMP] [base] Add a payload to the ROM\n"
- " add-stage FILE NAME [COMP] [base] Add a stage to the ROM\n"
- " remove FILE NAME Remove a component\n"
- " create SIZE BOOTBLOCK [ALIGN] Create a ROM file\n"
- " locate FILE NAME ALIGN Find a place for a file of that size\n"
- " print Show the contents of the ROM\n"
- " extract NAME FILE Extracts a raw payload from ROM\n"
+ " add FILE NAME TYPE [base address] Add a component\n"
+ " add-payload FILE NAME [COMP] [base] Add a payload to the ROM\n"
+ " add-stage FILE NAME [COMP] [base] Add a stage to the ROM\n"
+ " remove FILE NAME Remove a component\n"
+ " create SIZE BOOTBLOCK [ALIGN] [offset] Create a ROM file\n"
+ " locate FILE NAME ALIGN Find a place for a file of that size\n"
+ " print Show the contents of the ROM\n"
+ " extract NAME FILE Extracts a raw payload from ROM\n"
"\n"
"TYPEs:\n"
);
diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c
index 648bfa849d..23f3ecfa87 100644
--- a/util/cbfstool/common.c
+++ b/util/cbfstool/common.c
@@ -446,7 +446,7 @@ void *create_cbfs_file(const char *filename, void *data, uint32_t * datasize,
}
int create_cbfs_image(const char *romfile, uint32_t _romsize,
- const char *bootblock, uint32_t align)
+ const char *bootblock, uint32_t align, uint32_t offs)
{
romsize = _romsize;
unsigned char *romarea = malloc(romsize);
@@ -473,14 +473,14 @@ int create_cbfs_image(const char *romfile, uint32_t _romsize,
master_header->romsize = htonl(romsize);
master_header->bootblocksize = htonl(bootblocksize);
master_header->align = htonl(align);
- master_header->offset = htonl(0);
+ master_header->offset = htonl(offs);
((uint32_t *) phys_to_virt(0xfffffffc))[0] =
virt_to_phys(master_header);
recalculate_rom_geometry(romarea);
- cbfs_create_empty_file((0 - romsize) & 0xffffffff,
- romsize - bootblocksize -
+ cbfs_create_empty_file((0 - romsize + offs) & 0xffffffff,
+ romsize - offs - bootblocksize -
sizeof(struct cbfs_header) -
sizeof(struct cbfs_file) - 16);
diff --git a/util/cbfstool/common.h b/util/cbfstool/common.h
index 296ab2dd05..7ef50c41e1 100644
--- a/util/cbfstool/common.h
+++ b/util/cbfstool/common.h
@@ -64,9 +64,10 @@ 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);
+ 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);
int extract_file_from_cbfs(const char *filename, const char *payloadname, const char *outpath);
int remove_file_from_cbfs(const char *filename);