diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/cbfstool/cbfs-payload-linux.c | 9 | ||||
-rw-r--r-- | util/cbfstool/linux.h | 12 |
2 files changed, 19 insertions, 2 deletions
diff --git a/util/cbfstool/cbfs-payload-linux.c b/util/cbfstool/cbfs-payload-linux.c index 03a41cd7f4..afb0f3ac71 100644 --- a/util/cbfstool/cbfs-payload-linux.c +++ b/util/cbfstool/cbfs-payload-linux.c @@ -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(¶ms, 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; + } } } diff --git a/util/cbfstool/linux.h b/util/cbfstool/linux.h index b96f447a07..2fd2d4d32a 100644 --- a/util/cbfstool/linux.h +++ b/util/cbfstool/linux.h @@ -139,7 +139,13 @@ struct linux_params { u32 alt_mem_k; /* 0x1e0 */ u8 reserved5[4]; /* 0x1e4 */ u8 e820_map_nr; /* 0x1e8 */ - u8 reserved6[9]; /* 0x1e9 */ + u8 reserved6[8]; /* 0x1e9 */ + /* This next variable is to show where + * in this struct the Linux setup_hdr + * is located. It does not get filled in. + * We may someday find it useful to use + * its address. */ + u8 setup_hdr; /* 0x1f1 */ u16 mount_root_rdonly; /* 0x1f2 */ u8 reserved7[4]; /* 0x1f4 */ u16 ramdisk_flags; /* 0x1f8 */ @@ -170,7 +176,9 @@ struct linux_params { u32 initrd_addr_max; /* 0x22c */ u32 kernel_alignment; /* 0x230 */ u8 relocatable_kernel; /* 0x234 */ - u8 reserved13[155]; /* 0x22c */ + u8 reserved13[0x2b]; /* 0x235 */ + u32 init_size; /* 0x260 */ + u8 reserved14[0x6c]; /* 0x264 */ struct e820entry e820_map[E820MAX]; /* 0x2d0 */ u8 reserved16[688]; /* 0x550 */ #define COMMAND_LINE_SIZE 256 |