summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/cbfstool/cbfs-payload-linux.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/util/cbfstool/cbfs-payload-linux.c b/util/cbfstool/cbfs-payload-linux.c
index 12fa23858f..33a5e1afb1 100644
--- a/util/cbfstool/cbfs-payload-linux.c
+++ b/util/cbfstool/cbfs-payload-linux.c
@@ -67,8 +67,6 @@ static int bzp_init(struct bzpayload *bzp, comp_algo algo)
*/
bzp->num_segments = 1;
- buffer_init(&bzp->trampoline, NULL, trampoline_start, trampoline_size);
-
bzp->algo = algo;
bzp->compress = compression_function(algo);
if (bzp->compress == NULL) {
@@ -101,6 +99,12 @@ static void bzp_add_segment(struct bzpayload *bzp, struct buffer *b, void *data,
bzp->num_segments++;
}
+static int bzp_add_trampoline(struct bzpayload *bzp)
+{
+ bzp_add_segment(bzp, &bzp->trampoline, trampoline_start,
+ trampoline_size);
+ return 0;
+}
static int bzp_add_cmdline(struct bzpayload *bzp, char *cmdline)
{
@@ -209,6 +213,9 @@ int parse_bzImage_to_payload(const struct buffer *input,
if (bzp_init(&bzp, algo) != 0)
return -1;
+ if (bzp_add_trampoline(&bzp) != 0)
+ return -1;
+
if (bzp_add_initrd(&bzp, initrd_name) != 0)
return -1;