summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2009-11-27kexec.c: workaround getline and fscanf to make it *libc agnostic. Tested ↵Andrea Adami
against klibc and dietlibc. Based on a patch by Andrea Adami and Yuri Bushmelev I have: * Cleaned up indentation * Rearranged the logic in get_command_line() * Increased the buffer for reading the command line from 1024 to 2048 bytes as this is now possible on x86 Only compile tested against glibc. Cc: Andrea Adami <andrea.adami@gmail.com> Cc: Yuri Bushmelev <jay4mail@gmail.com> Cc: Bernhard Walle <bernhard@bwalle.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-11-26arm: fix architecture detectionSimon Horman
There are many variants of arm and it seems to be impractical to add them all to the arches array. Instead just match on the leading "arm" portion of the utsname. I have made this specific to arm for now, as I'm not sure what fallout might occur if it was made more generic. e.g. arch ppc matching utsname ppc64 is a concern. Based on variants of this patch submitted by Andrea Adami and Marc Andre Tanner, and feedback from Magnus Damm. Cc: Andrea Adami <andrea.adami@gmail.com> Cc: Marc Andre Tanner <mat@brain-dump.org> Cc: Magnus Damm <magnus.damm@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-11-26Write to HVC terminal from purgatory codeM. Mohan Kumar
Current x86/x86-64 kexec-tools print the message "I'm in purgatory" to serial console/VGA while executing the purgatory code. Implement this feature for POWERPC pseries platform by using the H_PUT_TERM_CHAR hypervisor call by printng to hvc console. Includes the changes suggested by Michael Ellerman Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-11-21kexec-arm: add uImage supportMarc Andre Tanner
uImages are basically just zImages with a special header, we therefore just skip the header and let the normal zImage infrastructure do the actual work. Signed-off-by: Marc Andre Tanner <mat@brain-dump.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-11-19add kexec-tools support for armv7l processorsMagnus Damm
Add kexec-tools support for arm processors identifying themselves as armv7l. This includes sh7377 and the omap3 on my beagle board. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-11-19add kexec-tools support for armv6l processorsMagnus Damm
Add kexec-tools support for arm processors identifying themselves as armv6l. Tested on a sh7367. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-09-10Fix a problem caused by autoconf 2.64 which redefined AC_MSG_ERRORKhalid Aziz
autoconf 2.64 redefined AC_MSG_ERROR and now a ";" is required at the end of AC_MSG_ERROR macro invocation in configure.ac. Absence of this ";" causes an "unexpected end of file" message when configure script generated by autoconf is run. This patch adds the ";" in right places. I have verified that configure.ac still works fine after these changes with autoconf 2.63 and 2.61. [horms@verge.net.au: removed trailing whitespace] Signed-off-by: Khalid Aziz <khalid.aziz@hp.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-08-13Increase kernel text size for x86_64Hannes Reinecke
Hi all, I cannot load a x86_64 kernel with kexec on 2.6.31; the error message is: Can't find kernel text map area from kcore Cannot load /boot/vmlinuz Digging through the source I found a mismatch between the assumed kernel text size; kexec has: #define KERNEL_TEXT_SIZE (40UL*1024*1024) but on the kernel side we have: include/asm/page_64_types.h: #define KERNEL_IMAGE_SIZE (512 * 1024 * 1024) And, indeed, changing the definition in kexec-tools to the kernel one fixed the problem. Not sure if this has been reported before, if so please ignore the noise. Cheers, Hannes -- Dr. Hannes Reinecke zSeries & Storage hare@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Markus Rex, HRB 16746 (AG Nürnberg) Signed-off-by: Simon Horman <horms@verge.net.au>
2009-08-13kexec-tools 2.0.1-gitSimon Horman
Add -git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2009-08-13kexec-tools 2.0.1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-08-13Support R_PPC64_REL32 relocation typeM. Mohan Kumar
[PATCH 2/2] Support R_PPC64_REL32 relocation type gcc-4.4 compiler creates R_PPC64_REL32 relocation type in the ppc64 purgatory code. Add support to handle R_PPC64_REL32 relocation type. Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-08-13Make dtstruct variable to be 8 byte alignedM. Mohan Kumar
[PATCH 1/2] Make dtstruct variable to be 8 byte aligned kexec is creating a version 3 device tree to be backwards compatible. This version of the struct has 8-byte alignment for properties whose value is 8 or more bytes. As the code directly checks the pointer when deciding to add the alignment word, the struct memory must start on an 8 byte boundary. Force the dtstruct variable to be always 8 bytes aligned. Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-07-28kexec: Handle datarootdir for newer autoconf versions.Paul Mundt
This fixes up the: config.status: WARNING: 'Makefile.in' seems to ignore the --datarootdir setting warning when producing the output Makefile. Signed-off-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-07-22kexec-tools 2.0.1-rc1-gitSimon Horman
Add -git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2009-07-22kexec-tools 2.0.1-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-07-22Include kexec/arch/cris/kexec-cris.h in distribution tarballSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-07-22Include kexec/arch/sh/crashdump-sh.h in distribution tarballSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-23kexec: Fix printed symbol valueGeoff Levand
Move the print statement so that the variable value has been assigned before its value is printed. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-03-19sh: use physical address for zImage entryMagnus Damm
Use a physical address for the SuperH zImage entry point. This makes the zImage loader behave as the elf loader. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-03-18kexec jump: SuperH vmlinux supportMagnus Damm
Create elf header and modify the kernel command line when loading a crash kernel or a kexec jump kernel. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-03-18kexec jump: use add_segment_phys_virt()Magnus Damm
Since /proc/iomem contains physical addresses, use add_segment_phys_virt(xxx, 0) instead of add_segment() in add_backup_segments(). This fix is needed for kexec jump on SuperH where add_segment() only takes virtual addresses. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-02-10Correct email addressesBernhard Walle
Since I don't work for SUSE any more and 'bwalle@suse.de' is invalid, correct it in the copyright so that people can still contact me. Signed-off-by: Bernhard Walle <bernhard.walle@gmx.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-02-08x86_64 : exclude gart memory region in kexec toolsChandru
The following patch was discussed sometime back on kexec-tools mailing list. http://lists.infradead.org/pipermail/kexec/2008-December/003096.html Sending it here again for inclusion into kexec-tools. thanks ==================================== Exclude GART memory region and make kexec-tools to not create elf headers to it. Currently it seems like the dump analysis tools do not need a copy of the GART memory region, hence ignoring it in kexec-tools. Symtoms of accessing this region in kdump kernel included hangs, spurious restarts, and MCE (Machine Check Exception) panics in some AMD Opteron systems Signed-off-by: Chandru S <chandru@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-02-08powerpc: initialize drconf variablesChandru
The initialization of lmb_size and num_of_lmbs got removed as part of the 'kexec memory ranges dynamic allocation' patch to kexec-tools (which added realloc_memory_ranges() code to kexec-tools). These variables are pertinent to ppc64 systems with ibm,dynamic-reconfiguration-memory node in device-tree, i.e systems with /proc/device-tree/ibm,dynamic-reconfiguration-memory. The following patch adds code to initialize the variables back again in kexec-tools. Without this patch kexec-tools will think that it needs to save only the memory represented in memory@ nodes and will skip the memory in /proc/device-tree/ibm,dynamic-reconfiguration-memory node of the device-tree. Signed-off-by: Chandru S <chandru@linux.vnet.ibm.com> Reviewed-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-01-19printf() consolidationBernhard Walle
Remove the fprintf(stderr,...) in get_memory_ranges() that adds unnecessary output in the normal kexec case that the user don't want to see. Use dbgprintf() in get_base_ranges() instead of #ifdef DEBUG fprintf(stderr,...) #endif to to make the code more readable. Signed-off-by: Bernhard Walle <bwalle@suse.de>diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c index ad8a31c..8d4e42b 100644 Signed-off-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-01-19Fix memory corruption when using realloc_memory_ranges()Bernhard Walle
Because realloc_memory_ranges() makes the old memory invalid, and we return a pointer to memory_range in get_memory_ranges(), we need to copy the contents in get_memory_ranges(). Some code that calls realloc_memory_ranges() may be triggered by get_base_ranges() which is called after get_memory_ranges(). Yes, the memory needs to be deleted somewhere, but I don't know currently where it's the best, and since it's not in a loop and memory is deleted anyway after program termination I don't want to introduce unneccessary complexity. The problem is that get_base_ranges() gets called from architecture independent code and that allocation is PPC64-specific here. Signed-off-by: Bernhard Walle <bwalle@suse.de>diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c index b0d8acd..ad8a31c 100644 Signed-off-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-01-19Fix typo in realloc_memory_ranges()Bernhard Walle
The base_memory_range should not become memory_range. We need to realloc base_memory_range to not change the contents of memory. That was a copy & paste error. Signed-off-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-01-19Fix missing FILE argument in fprintf()Bernhard Walle
This fixes the following compiler warning kexec/arch/i386/crashdump-x86.c: In function 'get_crash_memory_ranges': kexec/arch/i386/crashdump-x86.c:144: warning: passing argument 1 of \ 'fprintf' from incompatible pointer type kexec/arch/i386/crashdump-x86.c:144: warning: passing argument 2 of \ 'fprintf' makes pointer from integer without a cast Signed-off-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-01-16ppc64: cleanupsMilton Miller
don't copy purgatory, as elf-load-rel does that for us (like x86_64). move function declarations from c to h files remove casts between void * and various pointers change some pointers between char and unsigned char * change args to be vars of the right type instead of casting or copying between types Signed-off-by: Milton Miller <miltonm@bga.com> Tested-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-01-16entry wants to be void *Milton Miller
The kexec info struct defines entry to be a void *, so pass around the user supplied value as one. This fixes the following warning: gcc -g -O2 -fno-strict-aliasing -Wall -Wstrict-prototypes -I./include -I./util_lib/include -Iinclude/ -I./kexec/arch/ppc64/include -c -MD -o kexec/kexec.o kexec/kexec.c kexec/kexec.c: In function ‘my_load’: kexec/kexec.c:773: warning: assignment makes pointer from integer without a cast Signed-off-by: Milton Miller <miltonm@bga.com> Tested-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-01-16ppc64: segments may be reorderedMilton Miller
Instead of fetching data from the segment array, remember the address when added and find the kernel text from the parsed elf header. While add_segment (and hence add_buffer) always adds to the end of the list of segments, it sorts the previous segments before each allocation. In some layouts, the device tree or initrd will fit in a hole below the the kernel. When that happens, the previus code mis-patches purgatory and the kexec fails. Signed-off-by: Milton Miller <miltonm@bga.com> Tested-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-01-16ppc64: update kdump for 2.6.28 relocatable kernelMilton Miller
The kernel updated its ABI to tell the relocatable kernel to run where it was loaded. We now need to set a flag in the kernel image. Since we only have the kernel image avialable as const data to kexec-tools c code, set the flag in the copy we put in purgatory, and have it set the flag in the kernel (after purgatory has run its checksum). To simplfy the purgatory code we can always copy the flag word back to the kernel as the c code made a copy of the original flag value. Signed-off-by: Milton Miller <miltonm@bga.com> Tested-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2009-01-16ppc64: always check number of ranges when adding themMilton Miller
make the idom "always call realloc_memory_ranges when filling a range entry" kexec was core dumping after using 5 exclude_range pairs when only 3 were allocated. also delcare realloc_memory_ranges to take void. Signed-off-by: Milton Miller <miltonm@bga.com> Tested-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-11-28Make x86_setup_jump_back_entry() static with a void argument listSimon Horman
gcc complains because x86_setup_jump_back_entry() has no arguments, making the argument list void resolves this. Also, make the function static as it isn't used in any other files. And move the function above where it is used, to eliminate the need for a forward-declaration. Signed-off-by: Simon Horman <horms@verge.net.au>
2008-11-28Fix compile warnings in get_memory_ranges()Bernhard Walle
This patch fixes: kexec/arch/i386/kexec-x86-common.c: In function ‘get_memory_ranges’: kexec/arch/i386/kexec-x86-common.c:189: \ warning: passing argument 2 of ‘parse_iomem_single’ from incompatible pointer type kexec/arch/i386/kexec-x86-common.c:189: \ warning: passing argument 3 of ‘parse_iomem_single’ from incompatible pointer type Yes, that was my own code. :-( Signed-off-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-11-28Don't use /sys/firmware/memmap for XenBernhard Walle
On Xen, we have to use /proc/iomem to retrieve the memory area for the kexec'd kernel, not /sys/firmware/memmap. Dom0 kernel gets a E820 map that contains only one region: 0000000000000000-0000000018e5e000 (System RAM) Compared to the /proc/iomem: 00000000-0009cbff : System RAM 0009cc00-0009ffff : reserved 000ce000-000d3fff : reserved 000e0000-000fffff : reserved 00100000-1fd6ffff : System RAM 01000000-04ffffff : Crash kernel 1ec00000-1fbfffff : Hypervisor code and data 1f0b4680-1f0b4873 : Crash note 1f0b4900-1f0b4a93 : Crash note 1f0b4b80-1f0b4d13 : Crash note 1f0b4e00-1f0b4f93 : Crash note ... Without that patch, /proc/vmcore is empty in the kexec'd kernel and I'm unable to copy the crashdump. Signed-off-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-11-26Fix kexec x86_64 load failed bugHuang Ying
Fix a bug of kexec load on x86_64. Kexec fails to do load on x86_64, with error message: Symbol: cmdline_end not found cannot set Because kexec/arch/i386/kexec-bzImage.c accesses cmdline_end symbol in i386 purgatory, but there is no cmdline_end in x86_64 purgatory, and kexec-bzImage.c is used by x86_64 too. cmdline_end is added into x86_64 purgatory to solve the bug, because kexec jump support for x86_64 is planned. Reported-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-11-17Fix spell error in help outputBernhard Walle
This patch just fixes a spell error. Found by Dave Plater. Signed-off-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-11-10Add include for offsetof macroStefan Assmann
kexec/arch/i386/kexec-elf-x86.c and kexec/arch/x86_64/kexec-elf-x86_64.c both use the macro offsetof() which according to the man page requires #include <stddef.h>. The include is not present at the moment and this patch adds it. This is necessary for compatibility with i.e. uClibc. Signed-off-by: Stefan Assmann <sassmann@suse.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-11-03ppc64: kexec memory ranges dynamic allocationMaxim Uvarov
Do not count max_memory_range for allocation. Increase allocation buffers when it is needed. This actually allows us to avoid a lot of troubles with various device-tree files. Signed-off-by: Maxim Uvarov <muvarov@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-10-31core dump file support for ELF loaderHuang Ying
This patch adds core dump file support to ELF file loader. This can be used by kexec based hibernation to load hibernated image, which is from /proc/vmcore, a core dump file. Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-10-31kexec jump support for kexec-toolsHuang Ying
To support memory backup/restore an option named --load-preserve-context is added to kexec. When it is specified toggether with --mem-max, most segments for crash dump support are loaded, and the memory range between mem_min to mem_max which has no segments loaded are loaded as backup segments. To support jump back from kexeced, options named --load-jump-back-helper and --entry are added to load a helper image with specified entry to jump back. Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-10-23kdump: check flags field from drconf memoryChandru
On a powerpc machine when memory is dynamically removed/added from an lpar, the corresponding flags field in the drconf memory reflects the same with the bits unset/set accordingly. The kernel does a check on these flags while booting. Following are the similar changes brought in to kexec-tools. This makes kexec-tools to skip those memory regions that do not belong or are not assigned to the current partition ( but are available to dynamically add them back ). Without this patch (and with memory remove operation) copying vmcore fails with error as Copying data : [ 84 %] readmem: Can't read the dump memory(/proc/vmcore). Bad address read_pfn: Can't get the page data. Signed-off-by : Chandru S <chandru@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-10-23IA64: better calculate PT_LOAD segment sizeJay Lan
This patch combines consecutive PL_LOAD segments into one. The end address of the last PL_LOAD segment, calculated by adding p_memsz to p_paddr & rounded up to ELF_PAGE_SIZE, will be the end address of this loaded_segments[] entry. This patch fixes the kdump kernel MCA problem caused by under- allocation of memory and a "kdump broken on ALtix 350" problem reported by Bernhard Walle. Simon, this patch replaces my previous patch I submitted on the underallocation issue. Signed-off-by: Jay Lan <jlan@sgi.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-10-10Fix declaration of get_dyn_reconf_crash_memory_ranges()Simon Horman
powerpc64-unknown-linux-gnu-gcc (GCC) 4.1.1 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. kexec/arch/ppc64/crashdump-ppc64.c:125: warning: function declaration isn't a prototype Signed-off-by: Simon Horman <horms@verge.net.au>
2008-10-10Use return value of count_dyn_reconf_memory_ranges()Bernhard Walle
This patch fixes the build error kexec/arch/ppc64/kexec-ppc64.c:140: \ warning: control reaches end of non-void function The patch returns 0 on success, and checks when the function is called for a non-zero value. Signed-off-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-10-09kexec/kdump : get details of ibm, dynamic-reconfiguration-memory node of ↵Chandru
device tree Get number of lmb's (logical memory blocks) , size of each lmb from ibm,dynamic-memory property , get base memory ranges from ibm,dynamic-reconfiguration-memory node. Signed-off-by: Chandru Siddalingappa <chandru@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-10-09kexec/kdump : add a new linux, usable-drconf-memory node to the device treeChandru
Add a new linux,usable-drconf-memory property to the device tree passed to the 2nd kernel. Each entry in the property is of the form: a count followed by so many (base, size) pairs of usable memory regions. The total number of such entries is equal to number of lmb's in ibm,dynamic-memory property. Signed-off-by: Chandru Siddalingappa <chandru@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-10-09kexec/kdump: read crash memory ranges from drconf memoryChandru
Get the memory ranges of the 1st kernel excluding the memory reserved for kexec/kdump kernel in case of ibm,dynamic-reconfiguration-memory node of device tree Signed-off-by: Chandru Siddalingappa <chandru@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-10-08Relocatable kdump kernel support in kexec-toolsMohan Kumar M
Relocatable kdump kernel support in kexec-tools This patch adds relocatable kernel support for kdump in the kexec-tools code. A signature (0xfeed1234) is passed in r6 from panic code to the purgatory code through kexec_sequence function. The signature is used to differentiate between relocatable kdump kernel and non-kdump kernels. The purgatory code compares the signature and sets the __kdump_flag in head_64.S by using the offset with respect to next kernel load address. During the boot up, kernel code checks __kdump_flag and if it is set, the kernel will behave as relocatable kdump kernel. Signed-off-by: Mohan Kumar M <mohan@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>