Bug#365349: Add support for creating a "debuginfo" package
tags 365349 + patch
thanks
On Tue, Jul 14, 2009 at 11:45:29AM -0600, dann frazier wrote:
> On Tue, Jul 14, 2009 at 12:02:52PM -0400, Lucas Nussbaum wrote:
> > On 14/07/09 at 09:47 +0200, maximilian attems wrote:
> > > On Mon, 13 Jul 2009, Lucas Nussbaum wrote:
> > > >
> > > > What's the status on the addition of a "debuginfo" package in addition
> > > > to linux-image-*? Is it just waiting on someone to do the work, and is
> > > > it something that needs to be discussed first?
> > >
> > > yep, nobody dedicated time yet to linux-debug flavour.
> > > a good start would be x86 only.
> >
> > Why do you see this as a new flavor? Wouldn't it be better to have it
> > based on the standard flavor, splitting off the debug info after the
> > build?
> >
> > If I remember correctly, enabling such options has no performance impact
> > (and other distros are doing it too).
>
> fwiw, I'd like to see these too. Coworkers of mine have patches to do
> this within kernel-package but, by the time we got the k-p maintainer
> to serious look at them, linux-2.6 was migrating away from k-p.
>
> In addition to systemtap, it should also make it easier to get crash
> to work on released kernel images.
I'm attaching a patch to linux-2.6 to build a -dbg kernel for each
flavor.
The first patch just enables CONFIG_DEBUG_INFO and builds the -dbg
packages; the second patch should add the necessary bits for systemtap.
--
+----------------------------------------------------------+
| John Wright <john.wright@hp.com> |
| HP Mission Critical OS Enablement & Solution Test (MOST) |
+----------------------------------------------------------+
>From d6d318ef1927c6e0688920e9c7218fcb1f437333 Mon Sep 17 00:00:00 2001
From: John Wright <john.wright@hp.com>
Date: Wed, 3 Jun 2009 14:57:19 -0600
Subject: [PATCH 1/2] Build debuggable kernel
---
config/config | 2 +-
config/defines | 2 +-
rules.real | 23 ++++++++++++++++-------
templates/control.image.type-plain.in | 11 +++++++++++
4 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/config/config b/config/config
index 7e7f19e..3c3c0ee 100644
--- a/config/config
+++ b/config/config
@@ -2979,7 +2979,7 @@ CONFIG_TIMER_STATS=y
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_DEBUG_BUGVERBOSE=y
-# CONFIG_DEBUG_INFO is not set
+CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_VM is not set
# CONFIG_DEBUG_VIRTUAL is not set
# CONFIG_DEBUG_WRITECOUNT is not set
diff --git a/config/defines b/config/defines
index 2790095..61f7429 100644
--- a/config/defines
+++ b/config/defines
@@ -1,5 +1,5 @@
[abi]
-abiname: 1
+abiname: 2
ignore-changes:
# kvm
__kvm* kvm* emulate_instruction emulator_write_emulated fx_init gfn_to_hva gfn_to_memslot_unaliased gfn_to_page gfn_to_pfn load_pdptrs
diff --git a/rules.real b/rules.real
index 18d5bd7..4410f54 100644
--- a/rules.real
+++ b/rules.real
@@ -295,25 +295,34 @@ install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): REAL_VERSION = $(UPSTREA
install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): PACKAGE_NAME = linux-image-$(REAL_VERSION)
install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): PACKAGE_DIR = debian/$(PACKAGE_NAME)
install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): INSTALL_DIR = $(PACKAGE_DIR)/boot
+install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): DEBUG_PACKAGE_NAME = linux-image-$(REAL_VERSION)-dbg
+install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): DEBUG_DIR = debian/$(DEBUG_PACKAGE_NAME)/usr/lib/debug/
install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): DIR = $(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
-install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): DH_OPTIONS = -p$(PACKAGE_NAME)
+install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): DH_OPTIONS =
install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE)
install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain:
dh_testdir
dh_testroot
- dh_prep
- dh_installdirs 'boot'
+ dh_prep -p$(PACKAGE_NAME) -p$(DEBUG_PACKAGE_NAME)
+ dh_installdirs -p$(PACKAGE_NAME) 'boot'
+ dh_installdirs -p$(DEBUG_PACKAGE_NAME) 'usr/lib/debug'
+$(MAKE_SELF) \
install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain_image \
DIR='$(DIR)' PACKAGE_DIR='$(PACKAGE_DIR)' INSTALL_DIR='$(INSTALL_DIR)' REAL_VERSION='$(REAL_VERSION)'
+ install -m644 $(DIR)/vmlinux $(DEBUG_DIR)/vmlinux-$(REAL_VERSION)
ifeq ($(MODULES),True)
- +$(MAKE_CLEAN) -C $(DIR) modules_install INSTALL_MOD_PATH='$(CURDIR)'/$(PACKAGE_DIR)
+ +$(MAKE_CLEAN) -C $(DIR) modules_install INSTALL_MOD_PATH='$(CURDIR)'/$(PACKAGE_DIR) INSTALL_MOD_STRIP=1
+ +$(MAKE_CLEAN) -C $(DIR) modules_install INSTALL_MOD_PATH='$(CURDIR)'/$(DEBUG_DIR)
cp $(DIR)/.config $(PACKAGE_DIR)/boot/config-$(REAL_VERSION)
+ cp $(DIR)/.config $(DEBUG_DIR)/config-$(REAL_VERSION)
cp $(DIR)/System.map $(PACKAGE_DIR)/boot/System.map-$(REAL_VERSION)
+ cp $(DIR)/System.map $(DEBUG_DIR)/System.map-$(REAL_VERSION)
rm $(PACKAGE_DIR)/lib/modules/$(REAL_VERSION)/{build,source,modules.*}
+ rm $(DEBUG_DIR)/lib/modules/$(REAL_VERSION)/{build,source,modules.*}
# TODO: Move somewhere else
rm $(PACKAGE_DIR)/lib/firmware -rf
+ rm $(DEBUG_DIR)/lib/firmware -rf
endif
+$(MAKE_SELF) \
install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain_templates \
@@ -321,7 +330,7 @@ endif
+$(MAKE_SELF) \
install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain_bug \
PACKAGE_DIR='$(PACKAGE_DIR)' PACKAGE_NAME='$(PACKAGE_NAME)' REAL_VERSION='$(REAL_VERSION)'
- +$(MAKE_SELF) install-base
+ +$(MAKE_SELF) install-base DH_OPTIONS='-p$(PACKAGE_NAME) -p$(DEBUG_PACKAGE_NAME)'
install-image_arm_$(FEATURESET)_$(FLAVOUR)_plain_image \
install-image_armel_$(FEATURESET)_$(FLAVOUR)_plain_image \
@@ -393,8 +402,8 @@ install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain_templates:
chmod 644 $(PACKAGE_DIR)/DEBIAN/templates
install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain_bug:
- dh_installdirs usr/share/bug/$(PACKAGE_NAME)
- dh_install debian/templates/image.plain.bug/* usr/share/bug/$(PACKAGE_NAME)
+ dh_installdirs -p$(PACKAGE_NAME) usr/share/bug/$(PACKAGE_NAME)
+ dh_install -p$(PACKAGE_NAME) debian/templates/image.plain.bug/* usr/share/bug/$(PACKAGE_NAME)
chmod 755 $(PACKAGE_DIR)/usr/share/bug/$(PACKAGE_NAME)/script
echo "RELEASE='$(REAL_VERSION)'" > $(PACKAGE_DIR)/usr/share/bug/$(PACKAGE_NAME)/info
diff --git a/templates/control.image.type-plain.in b/templates/control.image.type-plain.in
index ff3914f..9b55c13 100644
--- a/templates/control.image.type-plain.in
+++ b/templates/control.image.type-plain.in
@@ -6,3 +6,14 @@ Suggests: linux-doc-@version@
Description: Linux @upstreamversion@ image on @class@
This package provides the binary image and pre-built loadable modules for
Linux kernel @upstreamversion@ on @longclass@ machines.
+
+Package: linux-image-@upstreamversion@@abiname@@localversion@-dbg
+Section: admin
+Priority: optional
+Provides: linux-image-dbg, linux-image-@major@-dbg, linux-modules-@upstreamversion@@abiname@@localversion@-dbg
+Pre-Depends: debconf (>= 0.2.17) | debconf-2.0
+Depends: module-init-tools (>= 0.9.13), coreutils (>= 5.2.1)
+Suggests: linux-doc-@version@
+Description: Linux @upstreamversion@ debug on @class@
+ This package provides the binary debug image and pre-built debug loadable
+ modules for Linux kernel @upstreamversion@ on @longclass@ machines.
--
debian.1.6.3.3.1.7.g944a7
>From 57dc5c00bb444beb81ebe3688209c3c045087e1e Mon Sep 17 00:00:00 2001
From: John Wright <john.wright@hp.com>
Date: Tue, 9 Jun 2009 14:30:33 -0600
Subject: [PATCH 2/2] Add support for systemtap
* Add CONFIG_KPROBES=y to the config
* Systemtap looks for the kernel in
/usr/lib/debug/lib/modules/`uname -r`/vmlinux
Put a symlink from there to the actual vmlinux in the debug package.
---
config/config | 2 +-
rules.real | 4 ++++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/config/config b/config/config
index 3c3c0ee..5b30bdc 100644
--- a/config/config
+++ b/config/config
@@ -3685,6 +3685,6 @@ CONFIG_INITRAMFS_SOURCE=""
## file: unknown
##
# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
-# CONFIG_KPROBES is not set
+CONFIG_KPROBES=y
CONFIG_SCHED_OMIT_FRAME_POINTER=y
diff --git a/rules.real b/rules.real
index 4410f54..0dd8ab0 100644
--- a/rules.real
+++ b/rules.real
@@ -323,6 +323,10 @@ ifeq ($(MODULES),True)
# TODO: Move somewhere else
rm $(PACKAGE_DIR)/lib/firmware -rf
rm $(DEBUG_DIR)/lib/firmware -rf
+ # Systemtap (and possibly some other tools) expects the debug kernel to
+ # be here
+ ln -s ../../../vmlinux-$(REAL_VERSION) \
+ $(DEBUG_DIR)/lib/modules/$(REAL_VERSION)/vmlinux
endif
+$(MAKE_SELF) \
install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain_templates \
--
debian.1.6.3.3.1.7.g944a7
Reply to: