summaryrefslogtreecommitdiff
path: root/kexec/kexec.c
diff options
context:
space:
mode:
authorCong Wang <xiyou.wangcong@gmail.com>2012-03-08 14:39:38 +0800
committerSimon Horman <horms@verge.net.au>2012-03-15 15:09:41 +0900
commit28d4ab53280853d2aeefdfb7c369331e89ab9ac2 (patch)
treec4dcab7622680c57bfc499c36b9271335ffea45e /kexec/kexec.c
parentf1facd4b11aa141ffd9bbacb2631ad18dc33669c (diff)
Add generic debug option
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>
Diffstat (limited to 'kexec/kexec.c')
-rw-r--r--kexec/kexec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kexec/kexec.c b/kexec/kexec.c
index 89e725e..19133fa 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -50,6 +50,7 @@
unsigned long long mem_min = 0;
unsigned long long mem_max = ULONG_MAX;
static unsigned long kexec_flags = 0;
+int kexec_debug = 0;
void die(char *fmt, ...)
{
@@ -893,6 +894,7 @@ void usage(void)
" context of current kernel during kexec.\n"
" --load-jump-back-helper Load a helper image to jump back\n"
" to original kernel.\n"
+ " -d, --debug Enable debugging to help spot a failure.\n"
"\n"
"Supported kernel file types and options: \n");
for (i = 0; i < file_types; i++) {
@@ -1066,6 +1068,8 @@ int main(int argc, char *argv[])
case OPT_VERSION:
version();
return 0;
+ case OPT_DEBUG:
+ kexec_debug = 1;
case OPT_NOIFDOWN:
do_ifdown = 0;
break;