summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-09-12ARM: Add device tree support to the ARM platformMatthew Leach
To allow newer ARM platforms to use kexec, pass device tree information to the kernel during boot. By default the dtb is found from /proc/device-tree. A user can specify a dtb file or use legacy ATAGs Signed-off-by: Matthew Leach <matthew.leach@arm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-09-12arm: Make use of memory_rangesSimon Horman
Make use of struct memory_ranges and provide a global usablemem_rgns. This is in preparation for adding device tree support. Signed-off-by: Simon Horman <horms@verge.net.au>
2012-09-12libfdt: Move from kexec/arch/ppc/libfdt/ to kexec/libfdt/Simon Horman
This is in preparation for using the code on ARM as well as PPC. Signed-off-by: Simon Horman <horms@verge.net.au>
2012-09-12kexec-elf.h: Include headers for types usedSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2012-09-12fs2dt: Add a generic copy of fs2dtSimon Horman
The motivation for this is to remove duplicated code by sharing the fs2dt between different architectures. The code added by this patch is very close to the code currently used by ppc64, and thus migrating that architecture should not be difficult. The 32bit powerpc code is a little different and thus more care is needed when migrating that architecture to this code. Unfortunately I do not have any powerpc equipment available to test this code. Signed-off-by: Simon Horman <horms@verge.net.au>
2012-09-07kexec: Fix the purgatory Makefile to build arch specific purgatory code.Mahesh Salgaonkar
The latest commit 5e48916 has removed a line from purgatory/Makefile that was responsible for building arch specific purgatory code. This causes kexec -p (loading of panic kernel) to fail. This patch reverts the deleted line. Verified this fix on x86_64 and ppc64. Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-08-02build: Avoid duplicate files in tarballSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2012-08-01vmcore-dmesg: vmcore-dmesg: Make it work with new structured logging formatVivek Goyal
Now kernel has made kernel logging structured and exsisting vmcore-dmesg does not work with this new format. Hence kernel version 3.5 is broken. In 3.6 now a kernel patch has been put which exports relevant fields. This patch parses those fields and makes vmcore-dmesg work with new logging format. Currently it does not display log levels or dictionary. I personally think that log levels are not very useful and it also requires additional kernel patches so that log levels are not bitfields and relevant information is exported to user space properly. Concept of dictionary is new and relevant information is exported. One can possibly enahnce vmcore-dmesg to also print dictionary contents based on a user command line option. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-07-24vmcore-dmesg: Do not write beyond end of bufferVivek Goyal
scan_vmcoreinfo() currently assumes that every vmcoreinfo note line ends with \n and overwrites new line with \0. But last entry in note, CRASHTIME= does not end with \n and this leads to corrupting memory as we write beyond end of buffer. Normally things were fine but when I added some fields to vmcoreinfo, this bug started showing and vmcore-dmesg started crashing. I am planning to send a patch to fix this in kernel but it might be good idea to handle this case in user space too so that vmcore-dmesg works fine with cores of older kernels. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-07-13kexec: simply pass LINUX_REBOOT_CMD_KEXEC to rebootmaximilian attems
While trying to port kexec cleanly to klibc, came across this syscall usage for reboot(2). Calling reboot directly simplifies the code. Signed-off-by: maximilian attems <max@stro.at> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-07-13Do not reserve cpu spin-table for crash kernelSuzuki K. Poulose
As of now, the kexec reserves the spin-table for all the CPUs on an SMP machine. The spin-table is pointed to by the cpu-release-addr property in the device-tree. Reserving the spin-table in the crash kernel will cause a BUG(), if the table lies outside the memory reserved for the crashkernel. Disable reserving the spin-table regions and use maxcpus=1 to use only the crashing CPU to boot the crash kernel. Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-07-06kexec-tools: Read always one vmcoreinfo fileDaniel Kiper
vmcoreinfo file could exists under /sys/kernel (valid on baremetal only) and/or under /sys/hypervisor (valid when Xen dom0 is running). Read only one of them. It means that only one PT_NOTE will be always created. Remove extra code for second PT_NOTE creation. Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-06-27Fix format strings of die()Aleksey Makarov
One of them caused crash when user specifies a file that does not exist. Signed-off-by: Aleksey Makarov <aleksey.makarov@gmail.com> Removed trailing whitespace. Signed-off-by: Simon Horman <horms@verge.net.au>
2012-06-27Check format string of die()Aleksey Makarov
Use gcc's __attribute__ to check format string. Signed-off-by: Aleksey Makarov <aleksey.makarov@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-06-18Support kernel_noload uImage typeAlexandre Courbot
Do not trigger an error when loading a uImage with the IH_TYPE_KERNEL_NOLOAD type. These images do not need to be copied to their load address before being executed. All archs (excepted PPC) do not use the uImage load and entry point parameters, so their current behavior needs not be changed further than just accepting the image type. Tested and validated on ARM. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-06-13Load bzImages smaller than 32 KiBEric Biggers
Allow bzImages smaller than 32KiB to be kexec'ed. The current code will fail to load a bzImage smaller than 32768 bytes (sizeof struct x86_linux_header), but the 'memdisk' program that comes with syslinux is only about 26 KiB. This patch changes the minimum size to 1024 bytes (2 sectors), which appears to be the limit that syslinux enforces. Removed the "tail" field of struct x86_linux_header because it doesn't seem to actually be used (is there a reason for it?). Also, note that bzImage_probe() was incorrectly using `sizeof (header)', even though header is a pointer. Signed-off-by: Eric Biggers <ebiggers3@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-06-11ppc/ppc64: Compile purgatory code with gcc option -msoft-floatVivek Goyal
Recently we faced an issue on power7 machine where kernel hanged in purgatory. Some investigation revealed that gcc is generating hardware FPU instructions. I have been told we can't use it at this point of time and as kernel is compiled with -msoft-float for ppc/ppc64, so should be purgatory (as it runs inside kernel context). Thanks to Jakub Jelinek and Lingzhu Xiang for debugging and coming up with a fix for this issue. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Tested-by: Lingzhu Xiang <lxiang@redhat.com> Tested-by: Suzuki K. Poulose <suzuki@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-05-18ppc: move DEBUG code to --debugCong Wang
From: Cong Wang <xiyou.wangcong@gmail.com> V2: Fix a compile error Like commit 28d4ab53280853d2aeefdfb7c369331e89ab9ac2 ("Add generic debug option"), this one moves code under #if DEBUG to --debug on ppc arch. Sorry that I still can't find a ppc32 machine to test this. Cc: Simon Horman <horms@verge.net.au> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-04-23Correct section number for shutdown and clarify what -e does in manpageKhalid Aziz
Another patch that I have been carrying in debian kexec-tools package. It corrects the section number for shutdown in the man page. This patch also adds little more descriptive note for the -e option to clarify that this does not do an orderly shutdown. Please apply. Signed-off-by: Khalid Aziz <khalid.aziz@hp.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-04-23kexec-tools: Fix CRC calculation for padded uImageHelmut Schaa
Instead of calulating the CRC on the whole file just calculate the CRC on the actual uImage length as given by the uImage header. This fixes loading padded uImages, for example from a mtd partition. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
2012-04-16Add more debug infos when usable memory range changingHan Pingtian
In the past, we did neglected some usable memory range changing infos. With those deubg code added, we can now catch them. Signed-off-by: Simon Horman <horms@verge.net.au>
2012-03-29Add a descriptive error message for kexec load failureKhalid 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. Please apply. Signed-off-by: Khalid Aziz <khalid.aziz@hp.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-03-29sh: move DEBUG code to --debugCong Wang
Like patch 1/5, this one moves code under #if DEBUG to --debug on sh arch. Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-03-29mips: move DEBUG code to --debugCong Wang
Like patch 1/5, this one moves code under #if DEBUG to --debug on mips arch. Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-03-29arm: move DEBUG code to --debugCong Wang
Like patch 1/5, this one moves code under #if DEBUG to --debug on arm arch. Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-03-15Add generic debug optionCong Wang
Currently the debugging code is under #ifdef DEBUG, which means when we want to debug, we have to re-compile the source code with -DDEBUG. This is not convenient, we want to have a generic --debug option so that we can enable debugging code without re-compiling. This patch moves the arch-specific --debug to generic place and moves code under #ifdef DEBUG to --debug on x86. BTW, the size of kexec binary increases very little after this patch. Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-03-12i386: Don't print debug message when VESA framebuffer is loadedSimon Horman
This messages seems unnecessarily verbose. Reported-by: Maxim Kammerer <mk@dee.su> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-03-03remove useless call to setup_memory_ranges() in ppc64Han Pingtian
setup_memory_ranges() is being called twice in ppc64. First in my_load() through get_memory_ranges(), then in elf_ppc64_load(). Looks like we can remove the latter. Signed-off-by: Simon Horman <horms@verge.net.au>
2012-02-08Fix out-of-tree buildTyler Hall
Use automatic variables for prerequisites when copying man pages and include a makefile relative to $(srcdir). Signed-off-by: Tyler Hall <tylerwhall@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-02-01kexec: make some functions staticCong Wang
The following functions/variables can become static. Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-02-01kexec-tools 2.0.3.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>
2012-01-16kexec-tools 2.0.3Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2012-01-10Correct magic varible of function name in debug codeHan Pingtian
The magic varible of function name should be uppercase. Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-12-11kexec-tools: s390: Do not create ELF header by defaultMichael Holzheu
For s390 we have two modes for kdump: For the first mode, as on all other architectures, the kexec tool creates the ELF header and the 2nd kernel processes it for /proc/vmcore setup. This mode has the disadvantage that for memory and CPU hotplug the kdump kernel has to be reloaded by the kexec tool. For s390 this is a real problem because we have a cpuplugd daemon that sets CPUs online and offline according to the current workload. So CPU online/offline events occur very often. For the second mode on s390, the ELF header is created by the kdump kernel. This is done automatically when the kernel is booted in kdump mode and no "elfcorehdr" kernel parameter is specified. On s390 the kdump kernel can get all necessary information to build the ELF header. We can get the memory map, all CPU registers, and vmcoreinfo With this patch a compile switch WITH_ELF_HEADER is introduced. When the macro is defined, kexec will create the ELF header and add the "elfcorehdr" kernel parameter. If it is not specified (default), no header is created. For s390 we want to have the 2nd mode as default because it has only advantages for us. Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-12-02kexec skips some load segments on ia64Petr Tesarik
There is a bug in add_loaded_segments_info, which causes that some LOAD segments may be skipped on ia64. For two consecutive segments which cannot be combined, the 'i' counter is incremented twice, effectively skipping over the second segment. For example, these are the program header of my vmlinux: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align LOAD 0x0000000000010000 0xa000000100000000 0x0000000004000000 0x0000000000ee0e90 0x0000000000ee0e90 RWE 10000 LOAD 0x0000000000f00000 0xfffffffffffc0000 0x0000000004f00000 0x0000000000006d80 0x0000000000006d80 RW 10000 LOAD 0x0000000000f10000 0xa000000100f40000 0x0000000004f40000 0x00000000005e3028 0x0000000000dc9198 RW 10000 NOTE 0x000000000098dc60 0xa00000010097dc60 0x000000000497dc60 0x0000000000000024 0x0000000000000024 R 4 IA_64_UNWIND 0x00000000009edd58 0xa0000001009ddd58 0x00000000049ddd58 0x000000000005d468 0x000000000005d468 R 8 And these are the resulting load segments: 0x6004000000 - 0x6004ef0000 (LOAD 1) 0x6004f40000 - 0x6005d10000 (LOAD 3) 0x6023fc0000 - 0x6023fc1000 (elfcorehdr) Note: The crash kernel is loaded at 0x6004000000 on this machine. Signed-off-by: Petr Tesarik <ptesarik@suse.cz> [horms@verge.net.au: Trivial up-port] Signed-off-by: Simon Horman <horms@verge.net.au>
2011-11-21fix rpm build errorsCong Wang
a) rpmbuild doesn't like '-' in version, replace it with '.'. b) update the files installed in kexec-tools.spec Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-11-21kexec: fix several issues in get_crash_notes()Cong Wang
a) We don't need 'crash_notes' array at all, save some bytes on stack. b) We forgot to fclose 'fp' before return. Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-11-18kexec: improve the debug printf in get_crash_notes_per_cpu()WANG Cong
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-11-14kexec-tools: powerpc: Add more 64bit relocationsAnton Blanchard
Add all the TOC16 relocations. These were hit when building kexec with a recent toolchain. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-11-14kexec-tools: powerpc: Cleanup relocation codeAnton Blanchard
Some cleanup of the relocation code: - Whitespace changes - Use braces to add clarity to nested for/if loop. - Order ADDR16 relocations - No need for to return from a void function. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-11-14kexec-tools: powerpc: Fix 64bit optimize for size (gcc -Os) buildAnton Blanchard
commit 46b2d0b8a719 (kexec/powerpc fix optimization for size (gcc -Os) build) added out of line GPR save/restore handlers for 32bit -Os builds. This patch adds the handlers for 64bit builds. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-11-09remove unnecessary check code for hole_alignDave Young
hole_align == 0 check is not neccesary, because it will be set to pagesize if it's zero. Just remove it here. Signed-off-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-10-31Currently on s390 for memory detection only the "/proc/iomem" file is used.Michael Holzheu
This file does not include information on offlined memory chunks. With this patch the memory hotplug information is read from "/sys/devices/system/memory" and is added to the "/proc/iomem" info. Also the MAX_MEMORY_RANGES count is increased to 1024 in order to support systems with many memory holes. Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-10-21kexec: powerpc: crash_dump: No backup region for PPC BookESuzuki K. Poulose
Disable backup regions for BookE in case of a CRASH Dump, as they can be run from anywhere. The patch introduces --with-booke option to support the BookE. With the patch, we get : ## On a 256M machine: # busybox cat /proc/cmdline init=/bin/init console=ttyS0,16550 crashkernel=128M@100M # kexec -p root/vmlinux usable memory rgns size:1 base:6400000 size:8000000 CRASH MEMORY RANGES 0000000000000000-0000000006400000 000000000e400000-0000000010000000 Command line after adding elfcorehdr: elfcorehdr=112380K Command line after adding elfcorehdr: elfcorehdr=112380K savemaxmem=256M Signed-off-by: Suzuki K. Poulose<suzuki@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-10-11sh: On 32bit segments may not be in P2Simon Horman
Cc: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-10-11sh: Correct logic errors in is_32bit()Simon Horman
This corrects logic errors so that is_32bit() can actually detect that it is running on a 32 bit system - something the original version I wrote failed at woefully. Signed-off-by: Simon Horman <horms@verge.net.au>
2011-10-05sh: Take into account the base of System RAM in virt_to_phys()Simon Horman
Previously virt_to_phys() assumed that physical memory always started at address 0. This is not always the case. Tested on an sh7757lcr (32bit system) whose only System RAM region is 40000000-4effffff and an ecovec24 (29bit system). Signed-off-by: Simon Horman <horms@verge.net.au>
2011-09-17kexec-tools: s390: Find correct address for ramdiskMichael Holzheu
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>
2011-09-07kexec-tools: Add --append option for s390Michael Holzheu
Hello Simon, From: Michael Holzheu <holzheu@linux.vnet.ibm.com> All architectures define the "--append" option together with the "--command-line" option to specify kernel parameters. This option is also used by kdump init scripts. In order to be compatible this patch introduces the "--append" option also for s390. In addition to that the help text is adjusted so that it is now the same as on all other architectures. Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-09-06Use unsigned char buffers in uImage loaderSimon Horman
This avoids out of range comparisons (for values >= 128) and an unnecessary cast. Signed-off-by: Simon Horman <horms@verge.net.au>