Add a descriptive error message for kexec load failure
Subsystems (2)
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.
--- kexec/arch/i386/crashdump-x86.c | 10 ++++++---- kexec/kexec.c | 18 ++++++++++++++---- kexec/kexec.h | 6 ++++++ 3 files changed, 26 insertions(+), 8 deletions(-)
kexec/arch/i386/crashdump-x86.c +6 -4
@@ -776,7 +776,9 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,memset (memmap_p,0 , sz);add_memmap (memmap_p, info->backup_src_start, info->backup_src_size); sz = crash_reserved_mem.end - crash_reserved_mem.start +1 ; -add_memmap (memmap_p, crash_reserved_mem.start, sz); +if (add_memmap (memmap_p, crash_reserved_mem.start, sz) <0 ) { +return ENOCRASHKERNEL ; + }/* Create a backup region segment to store backup data*/ if (!(info->kexec_flags &KEXEC_PRESERVE_CONTEXT )) {
@@ -788,7 +790,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,dbgprintf ("Created backup segment at 0x%lx\n" , info->backup_start);if (delete_memmap (memmap_p, info->backup_start, sz) <0 ) -return -1 ; +return EFAILED ; }/* Create elf header segment and store crash image data. */
@@ -797,14 +799,14 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline, crash_memory_range, nr_ranges, &tmp, &bufsz, ELF_CORE_HEADER_ALIGN) < 0) - return -1; + return EFAILED; }else {if (crash_create_elf32_headers (info, &elf_info, crash_memory_range, nr_ranges, &tmp, &bufsz,ELF_CORE_HEADER_ALIGN ) <0 ) -return -1 ; +return EFAILED ; }/* the size of the elf headers allocated is returned in 'bufsz' */
kexec/kexec.c +14 -4
@@ -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 ) {
kexec/kexec.h +6 -0
@@ -57,6 +57,12 @@#error unknwon BYTE_ORDER#endif +/* +* Document some of the reasons why crashdump may fail, so we can give +* better error messages +*/ +#define EFAILED -1/* default error code */ +#define ENOCRASHKERNEL -2/* no memory reserved for crashkernel */ /* * This function doesn't actually exist. The idea is that when someone
Signature · 12 lines
1.7.8.3 ==================================================================== Khalid Aziz Unix Systems Lab (970)898-9214 Hewlett-Packard [email protected] Fort Collins, CO _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Simon Horman
AppliedQuoted 5 lines · Khalid Aziz
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.
Thanks for bringing this change in from the cold.
Quoted 1 line
Please apply.
Applied.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec