From: Wenji Huang <wenji.huang@oracle.com>
To: linux-kbuild@vger.kernel.org
Subject: [PATCH] Kbuild: generate debug info in building
Date: Tue, 18 Nov 2008 10:08:12 +0800 [thread overview]
Message-ID: <4922238C.40807@oracle.com> (raw)
This patch will generate kernel debuginfo in Kbuild when invoking "make
debug_info". The separate debug files are in .debug under building tree.
They can help the cases of requiring debug info for tracing/debug tools,
especially cross-compilation. Moreover, it can simplify or standardize
the packaging process for the distributions those will provide
kernel-debuginfo.
Signed-off-by: Wenji Huang <wenji.huang@oracle.com>
---
Makefile | 14 ++++++++++++++
scripts/Makefile.modpost | 14 ++++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index 7f9ff9b..eed7510 100644
--- a/Makefile
+++ b/Makefile
@@ -814,6 +814,20 @@ define rule_vmlinux-modpost
$(Q)echo 'cmd_$@ := $(cmd_vmlinux-modpost)' > $(dot-target).cmd
endef
+ifdef CONFIG_DEBUG_INFO
+quiet_cmd_vmlinux_debug = GEN $<.debug
+ cmd_vmlinux_debug = mkdir -p .debug; \
+ $(OBJCOPY) --only-keep-debug \
+ $< .debug/$<.debug
+targets += vmlinux.debug
+endif
+
+debug_info: vmlinux FORCE
+ifdef CONFIG_DEBUG_INFO
+ $(call if_changed,vmlinux_debug)
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
+endif
+
# vmlinux image - including updated kernel symbols
vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o
$(kallsyms.o) FORCE
ifdef CONFIG_HEADERS_CHECK
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index f4053dc..0df73b2 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -137,6 +137,20 @@ $(modules): %.ko :%.o %.mod.o FORCE
targets += $(modules)
+modules-debug := $(modules:.ko=.ko.debug)
+ifdef CONFIG_DEBUG_INFO
+quiet_cmd_debug_ko = GEN $@
+ cmd_debug_ko = mkdir -p .debug/`dirname $@`; \
+ $(OBJCOPY) --only-keep-debug $< .debug/$@
+targets += $(modules-debug)
+endif
+
+debug_info: $(modules-debug) FORCE
+
+$(modules-debug): $(modules) FORCE
+ifdef CONFIG_DEBUG_INFO
+ $(call if_changed,debug_ko)
+endif
# Add FORCE to the prequisites of a target to force it to be always
rebuilt.
#
---------------------------------------------------------------------------
--
1.5.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
next reply other threads:[~2008-11-18 2:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-18 2:08 Wenji Huang [this message]
2008-11-22 11:43 ` [PATCH] Kbuild: generate debug info in building Sam Ravnborg
2008-11-26 5:51 ` Wenji Huang
2009-01-13 3:13 ` Wenji Huang
2009-01-13 3:23 ` Building error of 2.6.29-rc1 using old binutils Wenji Huang
2009-01-13 6:04 ` Wenji Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4922238C.40807@oracle.com \
--to=wenji.huang@oracle.com \
--cc=linux-kbuild@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.