Index: cbootimage.c |
diff --git a/cbootimage.c b/cbootimage.c |
index 798ce0487aa7160b250fd6eda83556e255135b45..1792749c6e3a75066b0f86a466379a701a861bfb 100644 |
--- a/cbootimage.c |
+++ b/cbootimage.c |
@@ -30,6 +30,7 @@ |
#include "data_layout.h" |
#include "parse.h" |
#include "set.h" |
+#include "context.h" |
/* |
* Global data |
@@ -43,64 +44,6 @@ static int help_only = 0; // Only print help & exit |
*/ |
int main(int argc, char *argv[]); |
-static int |
-query_alloc(build_image_context *context, |
- nvbct_lib_id size_id, |
- u_int8_t **dst) |
-{ |
- u_int32_t size; |
- |
- /* Note: 3rd argument not used in this particular query. */ |
- if (context->bctlib.get_value(size_id, |
- &size, context->bct) != 0) |
- return -ENODATA; |
- *dst = malloc(size); |
- |
- if (*dst == NULL) |
- return -ENOMEM; |
- |
- memset(*dst, 0, size); |
- |
- return 0; |
-} |
- |
-static void |
-cleanup_context(build_image_context *context) |
-{ |
- destroy_block_list(context->memory); |
- destroy_addon_list(context->addon_tbl.addon_item_list); |
- free(context->bct); |
-} |
- |
-static int |
-init_context(build_image_context *context) |
-{ |
- int e = 0; |
- |
- /* Set defaults */ |
- context->memory = new_block_list(); |
- context->journal_blk = 1; /* Default to 1st block */ |
- |
- /* Allocate space for the bct. |
- * Note that this is different from the old code which pointed directly |
- * into a memory image. |
- */ |
- e = query_alloc(context, nvbct_lib_id_bct_size, &(context->bct)); |
- if (e != 0) |
- goto fail; |
- |
- context_set_value(context, token_page_size, 2048); |
- context_set_value(context, token_redundancy, 1); |
- context_set_value(context, token_version, 1); |
- |
- return 0; |
- |
- fail: |
- cleanup_context(context); |
- |
- return e; |
-} |
- |
int |
write_image_file(build_image_context *context) |
{ |