Age | Commit message (Collapse) | Author |
|
By replacing all the explicit align opertion with marco _ALIGN*,
the code logic could more clear.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
If size is zero, it is unnecessary to do the malloc operation.
So checking size first is better than doing malloc first.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
[ horms@verge.net.au: Applied manually due to conflict ]
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This check makes sure that we indeed get the memory information.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The function only had one user, the error checking was wrong,
and the functions it performed are best done elsewhere
so remove the tempation of a problemenatic hook.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
|
|
The argument parsing is currently a bit broken as main()'s getopt_long()
knows nothing about either the architecture-specific options or, even
more specifically, the architecture-and-loader-specific options.
This patch introduces new #defines for all architectures,
KEXEC_ALL_OPTIONS and KEXEC_ALL_OPT_STR. These contain all possible
options for a given build, and the getopt_long() passes in main() and
arch_process_options() will now recognise arch- and loader-specific
options; these will not be re-ordered in argv[], there is no confusion
over which argv[] entry is the kernel filename, and using '--opt=foo' and
'--opt foo' both work.
All architectures have command line options (and #define OPT_BLAHs)
consolidated into their include/arch/option.h files. x86_64 builds
parts of i386/ as well, so now both share a single option.h file (with
a symlink).
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
|
|
This moves the computing of our native archtecture earlier so
that load can use it, as arch/i386/crashdump-x86.c has been
trying to.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
When removing the potential leak the logic was flipped which
mean we never reached the case for handling when both parameters
were set.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
fstat() is used to determine the filesize before read() and
it requires a filesystem. That means that it can not be used
on character nodes. This makes it impossible to obtains the
kernel from a char node like mtd or more likely ubi.
We can't use this in every case because files in /proc don't
support lseek(). This is required by the powerpc part to read
some device-tree entries.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
This fixes a bug when using gdb with vmcore
as explained by Dave Anderson:
The kexec/arch/x86_64/crashdump-x86_64.h file contains a
stale PAGE_OFFSET value. In 2.6.27 it was changed from
0xffff810000000000UL to 0xffff880000000000UL. This is
only a problem when using gdb with the vmlinux/vmcore
pair, because gdb relies upon the PT_LOAD segment's p_vaddr
values in the ELF header to be correct.
Cc: Dave Anderson <anderson@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
A colleague of mine implemented kdump and it used --reuse-cmdline
with some rather interesting and unexpected results.
Update the getopt specification so that --reuse-cmdline does not
attempt to take an argument that it will not use.
Update the processing of --append so that --reuse-cmdline followed
by --append actually appends the parameters specified by --reuse-cmdline.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
|
|
This patch allows one to load a lzma compressed kernel using kexec -l.
As I wanted the lzma code to be very similar to the existing
zlib slurp_decompress I took lzread and associated routines
from the cpio lzma support. Tested on my x86 laptop using the
following commands:
lzma e bzImage bzImage.lzma
kexec -l bzImage.lzma
Having lzma support is particularly useful on some embedded
systems on which we have the kernel already lzma compressed
and available on a mtd partition.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
When --reuse-cmdline is specified, kexec automatically removes some command
line parameter that are *known* to break the kexec'd target. That patch
corrects that behaviour:
1. BOOT_IMAGE should be removed always when --reuse-cmdline is specified since
it's likely that the kernel is not the same as the running kernel. As only
lilo-like bootloaders (i.e. not GRUB) adds that parameter, there's no need
to add a BOOT_IMAGE here.
2. crashkernel should be only removed when 'kexec -p' is called. For the
normal kexec, the crashkernel parameter can be passed as in the
running kernel.
The mistake has been introduced by commit 3c5bb06948881b3e31c783c19edef74275794280
by myself.
Signed-off-by: Bernhard Walle <bwalle@suse.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This fixes the problem in kexec-tools that the patch
http://article.gmane.org/gmane.linux.kernel/685027 tries to fix in kernel.
The fix in userspace is correct.
Signed-off-by: Bernhard Walle <bwalle@suse.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This code was copy-pasted into every architecture and was basically
identical.
Besides producing a nice net reduction in code, this factors a
portability challenge into a single function that can be easily replaced
at build-time.
Signed-off-by: Jamey Sharp <jamey@thetovacompany.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Jamey Sharp <jamey@thetovacompany.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Jamey Sharp <jamey@thetovacompany.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This patch adds an option "--reuse-cmdline" for people that are lazy in typing
--append="$(cat /proc/cmdline)". The advantage of "--reuse-cmdline" is also that
it strips off BOOT_IMAGE (since it may not be correct any more) from lilo and
other boot loaders, and, more important, the crashkernel option in case a
panic kernel is loaded.
If you like the option I can also add it for really all architectures. Tested only
with x86-bzImage both the kexec and kdump case.
Signed-off-by: Bernhard Walle <bwalle@suse.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Jamey Sharp <jamey@thetovacompany.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Jamey Sharp <jamey@thetovacompany.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This reduces the kexec-tools' demands on the capabilities of the
toolchain, and improves standards conformance, without really changing
maintenance complexity.
Signed-off-by: Jamey Sharp <jamey@thetovacompany.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Jamey Sharp <jamey@thetovacompany.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
On all architectures except mipsel add_buffer() expects
add_segment() to work with the virtual address passed.
On mipsel it is expected that add_segment() converts
the virtual address to a physical address first.
add_buffer_virt() is porvided on mipsel for the handful
of cases that don't want the address to be converted.
This patch maintains that behaviour, but without the need for #ifdef
__MIPSEL__ from kexec/kexec.c and much duplicated code.
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Hello,
We developed a patch to port kexec-tools to mips arch and included support for
command line passing through elf boot notes.
We did it for a customer of ours on a specific platform derived from toshiba
tx4938 (so we think it should work at least for tx4938 evaluation board also).
We would like to contribute it in case somebody else needs it or wants to
improve it.
This patch works for us but the assembler part in particular, should be
considered as a starting point because my assembly knowledge is not too deep.
As this is the first time I submit a patch I tried to guess reading tpp.txt if
this is the right way to submit. Please let me know about any mistakes I may
have made.
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Check the next region we are including is type RANGE_RAM as well.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Hi,
This fixes a minor regression that occured with Jeremy's recent
reworking of the build system. I guess he wasn't dealing with
compressed images and thus didn't notice that zlib support had
been disabled.
The fix involves updating an #ifdef to use the new symbol,
and ensuring that -lz is passed to the linker as neccessary.
Cc: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Instead of putting a heap of -D directives in CPPFLAGS, use a config.h
header.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Just use fclose() instead of close() to close a pointer of type FILE *.
That fixes the compile warning
kexec/kexec.c: In function 'check_reuse_initrd':
kexec/kexec.c:793: warning: passing argument 1 of 'close' makes integer from pointer without a cast
Signed-off-by: Bernhard Walle <bwalle@suse.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Adds a generic --reuseinitrd option and performs some sanity checks on
it. Can be used with the retain_initrd kernel option.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Move memory range variables
The common kexec code is currently using two global variables to keep
track of memory ranges. Other data is kept in a per-instance structure.
This mix is of per-instance and global variables is confusing and leads
to messy code in general. So let's not.
This patch moves the global variables into struct kexec_info and makes
sure that structure is passed along where needed. No logic is changed.
Signed-off-by: Magnus Damm <magnus@valinux.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Simon Horman <horms@verge.net.au>
kexec/kexec.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|