Merge debugging package support.

svn path=/dists/sid/linux-2.6/; revision=15651
This commit is contained in:
Bastian Blank 2010-05-09 16:50:27 +00:00
commit 5f54dc434f
6 changed files with 79 additions and 13 deletions

View File

@ -110,6 +110,7 @@ class Gencontrol(Base):
config_entry_base = self.config.merge('base', arch, featureset, flavour)
config_entry_description = self.config.merge('description', arch, featureset, flavour)
config_entry_image = self.config.merge('image', arch, featureset, flavour)
config_entry_image_dbg = self.config.merge('image-dbg', arch, featureset, flavour)
config_entry_relations = self.config.merge('relations', arch, featureset, flavour)
compiler = config_entry_base.get('compiler', 'gcc')
@ -197,6 +198,11 @@ class Gencontrol(Base):
packages_own.append(package_headers)
extra['headers_arch_depends'].append('%s (= ${binary:Version})' % packages_own[-1]['Package'])
build_debug = config_entry_image_dbg.get('enabled')
if build_debug:
makeflags['DEBUG'] = True
packages_own.extend(self.process_packages(self.templates['control.image-dbg'], vars))
self.merge_packages(packages, packages_own + packages_dummy, arch)
if config_entry_image['type'] == 'plain-xen':
@ -245,6 +251,8 @@ class Gencontrol(Base):
kconfig.extend(check_config("%s/%s/config" % (arch, featureset), False, arch, featureset))
kconfig.extend(check_config("%s/%s/config.%s" % (arch, featureset, flavour), False, arch, featureset, flavour))
makeflags['KCONFIG'] = ' '.join(kconfig)
if build_debug:
makeflags['KCONFIG_OPTIONS'] = '-o DEBUG_INFO=y'
cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-flavour %s" % makeflags]
if packages_dummy:

32
debian/bin/kconfig.py vendored
View File

@ -1,13 +1,37 @@
#!/usr/bin/env python
import optparse, os.path, sys
import optparse
import os.path
import re
import sys
from debian_linux.kconfig import *
def merge(output, *config):
def merge(output, configs, overrides):
kconfig = KconfigFile()
for c in config:
for c in configs:
kconfig.read(file(c))
for key, value in overrides.iteritems():
kconfig.set(key, value)
file(output, "w").write(str(kconfig))
def opt_callback_dict(option, opt, value, parser):
match = re.match('^\s*(\S+)=(\S+)\s*$', value)
if not match:
raise optparse.OptionValueError('not key=value')
dest = option.dest
data = getattr(parser.values, dest)
data[match.group(1)] = match.group(2)
if __name__ == '__main__':
sys.exit(merge(*sys.argv[1:]))
parser = optparse.OptionParser(usage = "%prog [OPTION]... FILE...")
parser.add_option('-o', '--override',
action='callback',
callback=opt_callback_dict,
default={},
dest='overrides',
help="Override option",
type='string')
options, args = parser.parse_args()
merge(args[0], args[1:], options.overrides)

View File

@ -121,6 +121,9 @@ class ConfigCoreHierarchy(ConfigCore):
'initramfs': SchemaItemBoolean(),
'initramfs-generators': SchemaItemList(),
},
'image-dbg': {
'enabled': SchemaItemBoolean(),
},
'relations': {
},
'xen': {

View File

@ -55,19 +55,22 @@ class KconfigFile(SortedDict):
i = line.find('=')
option = line[7:i]
value = line[i+1:]
if value in ('y', 'm'):
entry = EntryTristate(option, value)
else:
entry = EntryString(option, value)
self[option] = entry
self.set(option, value)
elif line.startswith("# CONFIG_"):
option = line[9:-11]
self[option] = EntryTristate(option)
self.set(option, 'n')
elif line.startswith("#") or not line:
pass
else:
raise RuntimeError, "Can't recognize %s" % line
def set(self, key, value):
if value in ('y', 'm', 'n'):
entry = EntryTristate(key, value)
else:
entry = EntryString(key, value)
self[key] = entry
def str_iter(self):
for key, value in self.iteritems():
yield str(value)

28
debian/rules.real vendored
View File

@ -40,6 +40,9 @@ binary-arch-arch: install-headers_$(ARCH)
binary-arch-arch: install-libc-dev_$(ARCH)
binary-arch-featureset: install-headers_$(ARCH)_$(FEATURESET)
binary-arch-flavour: install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE)
ifeq ($(DEBUG),True)
binary-arch-flavour: install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
endif
ifeq ($(MODULES),True)
binary-arch-flavour: install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
endif
@ -60,7 +63,7 @@ source-arch: $(STAMPS_DIR)/source
source-featureset: $(STAMPS_DIR)/source_$(ARCH)_$(FEATURESET)
$(BUILD_DIR)/config.$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(KCONFIG)
python debian/bin/kconfig.py '$@' $(KCONFIG)
python debian/bin/kconfig.py '$@' $(KCONFIG) $(KCONFIG_OPTIONS)
$(BUILD_DIR)/linux-source-$(UPSTREAMVERSION).tar.bz2: SOURCE_DIR=$(BUILD_DIR)/source
$(BUILD_DIR)/linux-source-$(UPSTREAMVERSION).tar.bz2: DIR = $(BUILD_DIR)/linux-source-$(UPSTREAMVERSION)
@ -150,7 +153,7 @@ install-base:
dh_shlibdeps
dh_gencontrol -- $(GENCONTROL_ARGS)
dh_md5sums
dh_builddeb
dh_builddeb -- $(BUILDDEB_ARGS)
install-dummy:
dh_testdir
@ -326,7 +329,7 @@ install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain:
install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain_image \
DIR='$(DIR)' PACKAGE_DIR='$(PACKAGE_DIR)' INSTALL_DIR='$(INSTALL_DIR)' REAL_VERSION='$(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
cp $(DIR)/.config $(PACKAGE_DIR)/boot/config-$(REAL_VERSION)
cp $(DIR)/System.map $(PACKAGE_DIR)/boot/System.map-$(REAL_VERSION)
rm $(PACKAGE_DIR)/lib/modules/$(REAL_VERSION)/{build,source,modules.*}
@ -440,6 +443,25 @@ install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain-xen:
echo /var/lib/$(PACKAGE_NAME)/xen-versions >> $(PACKAGE_DIR)/DEBIAN/conffiles
+$(MAKE_SELF) install-base DH_OPTIONS='-p$(PACKAGE_NAME) -p$(MODULES_PACKAGE_NAME)'
install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): REAL_VERSION = $(UPSTREAMVERSION)$(ABINAME)$(LOCALVERSION)
install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_NAME = linux-image-$(REAL_VERSION)-dbg
install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_DIR = debian/$(PACKAGE_NAME)
install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DEBUG_DIR = $(PACKAGE_DIR)/usr/lib/debug
install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DIR = $(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DH_OPTIONS = -p$(PACKAGE_NAME)
install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE)
dh_testdir
dh_testroot
dh_prep
dh_installdirs usr/lib/debug
install -m644 $(DIR)/vmlinux $(DEBUG_DIR)/vmlinux-$(REAL_VERSION)
ifeq ($(MODULES),True)
+$(MAKE_CLEAN) -C $(DIR) modules_install INSTALL_MOD_PATH='$(CURDIR)'/$(DEBUG_DIR)
rm $(DEBUG_DIR)/lib/modules/*/{build,source,modules.*}
rm $(DEBUG_DIR)/lib/firmware -rf
endif
+$(MAKE_SELF) install-base BUILDDEB_ARGS="-Zbzip2"
install-patch: PACKAGE = linux-patch-debian-$(VERSION)
install-patch: pbase := /usr/src/kernel-patches/all/$(UPSTREAMVERSION)
install-patch: pfull := debian/$(PACKAGE)$(pbase)

6
debian/templates/control.image-dbg.in vendored Normal file
View File

@ -0,0 +1,6 @@
Package: linux-image-@upstreamversion@@abiname@@localversion@-dbg
Section: debug
Priority: extra
Description: Debugging infos for Linux @upstreamversion@@abiname@@localversion@
This package provides the binary debug image and pre-built debug loadable
modules for Linux kernel @upstreamversion@ on @longclass@ machines.