From b2757572121f503176ebdc311591536336811953 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Thu, 8 May 2014 11:54:25 -0500 Subject: cbfstool: account for the trampoline code in bzImage payload For bzImages the trampoline segment is added unconditionally. However, that segment wasn't properly being accounted for. Explicitly add the trampoline segments like the other ones. Change-Id: I74f6fcc2a65615bb87578a8a3a76cecf858fe856 Signed-off-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/5702 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Edward O'Callaghan Reviewed-by: Patrick Georgi --- util/cbfstool/cbfs-payload-linux.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'util') 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; -- cgit v1.2.3