cbfstool: set init_size for linux payloads.

We were not setting the init_size for linux payloads.
A proper value of init_size is required if the kernel
is x86_64.

This is tested in qemu and fixes the observed problem
that 974f221c84b05b1dc2f5ea50dc16d2a9d1e95eda and later would not
boot, and would in fact fail in head_64.S.

Change-Id: I254c13d16b1e014a6f1d4fd7c39b1cfe005cd9b0
Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Reviewed-on: https://review.coreboot.org/16781
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins)
This commit is contained in:
Ronald G. Minnich
2016-09-28 10:43:12 -07:00
committed by Ronald G. Minnich
parent 6d16e1ff87
commit fa74e4705d
2 changed files with 19 additions and 2 deletions

View File

@ -220,14 +220,19 @@ int parse_bzImage_to_payload(const struct buffer *input,
if (hdr->setup_sects != 0) {
setup_size = (hdr->setup_sects + 1) * 512;
} else {
WARN("hdr->setup_sects is 0, which could cause boot problems.\n");
}
/* Setup parameter block. Imitate FILO. */
struct linux_params params;
memset(&params, 0, sizeof(struct linux_params));
params.mount_root_rdonly = hdr->root_flags;
params.orig_root_dev = hdr->root_dev;
params.init_size = hdr->init_size;
/* Sensible video defaults. Might be overridden on runtime by coreboot tables. */
params.orig_video_mode = 3;
params.orig_video_cols = 80;
@ -262,6 +267,10 @@ int parse_bzImage_to_payload(const struct buffer *input,
* so if possible (relocatable kernel) use that to
* avoid a trampoline copy. */
kernel_base = ALIGN(16*1024*1024, params.kernel_alignment);
if (hdr->init_size == 0) {
ERROR("init_size 0 for relocatable kernel\n");
return -1;
}
}
}