summaryrefslogtreecommitdiff
path: root/kexec/arch/s390/kexec-image.c
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>2011-09-16 14:46:04 +0200
committerSimon Horman <horms@verge.net.au>2011-09-17 18:59:06 +0900
commit6b8a0f7285fa3eb3f67dfa0d8d5b61ade69e953d (patch)
treeed4b374fd9d6a359b346f46550b1f55e82c00c4e /kexec/arch/s390/kexec-image.c
parent3ca990e0906349623cbdd969ff12032199721097 (diff)
kexec-tools: s390: Find correct address for ramdisk
When the kernel image size is larger than 8 MiB on s390, we currently can't load the ramdisk, because it is loaded to the fix address 8 MiB (RAMDISK_ORIGIN_ADDR) per default. With this patch the ramdisk is loaded behind the image with an 1 MiB alignment. To be compatible with older kernels we still load the ramdisk to 8 MiB, if the kernel is smaller than 8 MiB. Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/arch/s390/kexec-image.c')
-rw-r--r--kexec/arch/s390/kexec-image.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/kexec/arch/s390/kexec-image.c b/kexec/arch/s390/kexec-image.c
index 3d57b7d..ee101cb 100644
--- a/kexec/arch/s390/kexec-image.c
+++ b/kexec/arch/s390/kexec-image.c
@@ -101,16 +101,20 @@ image_s390_load(int argc, char **argv, const char *kernel_buf,
/* We do want to change the kernel image */
krnl_buffer = (void *) kernel_buf + IMAGE_READ_OFFSET;
- /* Load ramdisk if present */
+ /*
+ * Load ramdisk if present: If image is larger than RAMDISK_ORIGIN_ADDR,
+ * we load the ramdisk directly behind the image with 1 MiB alignment.
+ */
if (ramdisk) {
rd_buffer = slurp_file(ramdisk, &ramdisk_len);
if (rd_buffer == NULL) {
fprintf(stderr, "Could not read ramdisk.\n");
return -1;
}
- ramdisk_origin = RAMDISK_ORIGIN_ADDR;
+ ramdisk_origin = MAX(RAMDISK_ORIGIN_ADDR, kernel_size);
+ ramdisk_origin = ALIGN_UP(ramdisk_origin, 0x100000);
add_segment_check(info, rd_buffer, ramdisk_len,
- RAMDISK_ORIGIN_ADDR, ramdisk_len);
+ ramdisk_origin, ramdisk_len);
}
if (info->kexec_flags & KEXEC_ON_CRASH) {
if (load_crashdump_segments(info, crash_base, crash_end))