summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-05-08 11:54:25 -0500
committerPatrick Georgi <patrick@georgi-clan.de>2014-05-09 08:24:32 +0200
commitb2757572121f503176ebdc311591536336811953 (patch)
treefdb16aad8f80efdb33036f144d733ceeb7e90713
parent639f02b3bae1a7914501123c086491e442ea96f1 (diff)
downloadcoreboot-b2757572121f503176ebdc311591536336811953.tar.xz
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 <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/5702 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
-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;