From a77ae20f1749878aa76d427868ca096c614d10a8 Mon Sep 17 00:00:00 2001 From: Khalid Aziz Date: Wed, 28 Mar 2012 13:09:02 -0600 Subject: Add a descriptive error message for kexec load failure kexec-tools package for debian includes a patch that adds a more descriptive error message when someone tries to laod a crash kernel and didn't remember to boot up with crashkernel= parameter. This patch would be of general interest. This patch was originally written by Alastair McKinstry. Please apply. Signed-off-by: Khalid Aziz Signed-off-by: Simon Horman --- kexec/kexec.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'kexec/kexec.c') diff --git a/kexec/kexec.c b/kexec/kexec.c index 19133fa..d2d05a8 100644 --- a/kexec/kexec.c +++ b/kexec/kexec.c @@ -718,10 +718,20 @@ static int my_load(const char *type, int fileind, int argc, char **argv, } info.kexec_flags |= native_arch; - if (file_type[i].load(argc, argv, kernel_buf, - kernel_size, &info) < 0) { - fprintf(stderr, "Cannot load %s\n", kernel); - return -1; + result = file_type[i].load(argc, argv, kernel_buf, kernel_size, &info); + if (result < 0) { + switch (result) { + case ENOCRASHKERNEL: + fprintf(stderr, + "No crash kernel segment found in /proc/iomem\n" + "Please check the crashkernel= boot parameter.\n"); + break; + case EFAILED: + default: + fprintf(stderr, "Cannot load %s\n", kernel); + break; + } + return result; } /* If we are not in native mode setup an appropriate trampoline */ if (arch_compat_trampoline(&info) < 0) { -- cgit