Skip to content

Commit

Permalink
sync with Debian's debian-kernel-trunk 3.6.9-1~experimental.1 as of s…
Browse files Browse the repository at this point in the history
…vn r19579
  • Loading branch information
mika committed Dec 6, 2012
1 parent 02e125a commit 031d023
Show file tree
Hide file tree
Showing 350 changed files with 36,060 additions and 1,465 deletions.
9 changes: 5 additions & 4 deletions linux-3/debian/README.Debian
@@ -1,17 +1,17 @@
linux-2.6 for DEBIAN
------------------------
Linux kernel for Debian
-----------------------

Patches
-------
Debian applies small changes to the kernel source. These are split up into
separated patches addressing individual problems. Each of the patch files
contains a description and mentions the author. The patches can be found
at http://svn.debian.org/wsvn/kernel/dists/trunk/linux-2.6/debian/patches/.
at http://svn.debian.org/wsvn/kernel/dists/trunk/linux/debian/patches/.

Config Files
------------
The .config files used to build the various linux-image files are dynamically
generated during the linux-2.6 package build. See the source package for
generated during the linux package build. See the source package for
details. Each linux-image-* package provides the complete .config file that
was used to generate it. This file is installed in /boot.

Expand Down Expand Up @@ -52,4 +52,5 @@ See the patches under debian/patches/debian/dfsg.
Further information
-------------------
Debian Linux Kernel Handbook: http://kernel-handbook.alioth.debian.org
or debian-kernel-handbook package
Debian Wiki: http://wiki.debian.org/DebianKernel
51 changes: 12 additions & 39 deletions linux-3/debian/README.source
Expand Up @@ -3,18 +3,18 @@ Updating the upstream source

1) You can use either:
a) a git repository of the kernel source
b) a kernel tarball from kernel.org (e.g. linux-2.6.25.tar.bz2)
and, optionally, a patch (e.g. patch-2.6.26-rc3.bz2).
b) a kernel tarball from kernel.org (e.g. linux-3.4.tar.bz2)
and, optionally, a patch (e.g. patch-3.5-rc1.bz2).

2) Run ./debian/bin/genorig.py <repository>
or ./debian/bin/genorig.py <tarball> [patch]
This will produce ../orig/linux-2.6_<version>.orig.tar.gz
(e.g. linux-2.6_2.6.26~rc3.orig.tar.gz).
This will produce ../orig/linux_<version>.orig.tar.gz
(e.g. linux_3.5~rc1.orig.tar.gz).

(genorig.py requires the python and unifdef packages to be
installed)

3) Unpack linux-2.6-<version>.orig.tar.gz, cd into the new directory,
3) Unpack linux_<version>.orig.tar.gz, cd into the new directory,
and do a 'svn export' to get the debian/ subdirectory.
Alternatively unpack using "make -f debian/rules orig".

Expand All @@ -23,46 +23,19 @@ Updating the upstream source
Applying patches to the Debian kernel tree
==========================================

The Debian kernel packaging uses a custom patching system:
The Debian kernel packaging uses the quilt patch system, but with
multiple series to allow for featuresets.

Patches are stored below debian/patches, loosely sorted in bugfix/,
features/ and debian/. Patches are in the standard kernel patch
format.

The order and the selection of patches which are applied during build
time are specified in the series/ subdirectory. For each revision
there may be up to one file named REVISION specifying the patches
applied for the standard revision and one file named REVISION-extra
for addon flavours. If, e.g. the patches are specified for 2.6.26-12,
the patch order file is called debian/patches/series/12 for the
standard kernel images and debian/patches/series/12-extra for the
addon flavours.

Let's look at the actual series file for 2.6.26-12:

+ bugfix/all/net-unix-gc-fix-soft-lockups-oom-issues.patch
+ bugfix/all/inotify-watch-removal-umount-races.patch
+ bugfix/all/atm-duplicate-listen-on-socket-corrupts-the-vcc-table.patch
+ bugfix/all/ata-pata_marvell-vs-ahci.patch
+ features/sparc/video-sunxvr500-intergraph.patch

The patches to be applied are specified relative to debian/patches.
"+" indicates that the patch should be added, "-" can be used to
drop a patch in later patch series (e.g. if the patch turned out to
be faulty). The series files may be arbitrarily documented with
comments starting with "#".

Let's now have a look at the series file for the addon kernel flavours
of 2.6.26-12:

+ features/all/xen/dom0-fix-processor-throttling-when-pr-id-is-minus-1.patch featureset=xen

The same syntax applies for specifing the patches, but an additional
argument is needed which specifies the featureset the patch applies to.
format (unified diff to be applied with patch -p1) and generally have
DEP-3 headers.

The series file 'series' is used for all configurations and a series
file 'series-<featureset>' is used for each optional featureset.

If you want to generate a source tree with all patches applied, run
make -f debian/rules source-all
make -f debian/rules source

The resulting source can be found below debian/build.

Expand Down
2 changes: 1 addition & 1 deletion linux-3/debian/bin/check-patches.sh
Expand Up @@ -2,7 +2,7 @@

TMPDIR=$(mktemp -d)
trap "rm -rf $TMPDIR" EXIT
grep -v "^#" debian/patches/series/* | awk '{if (NF >= 2) print "debian/patches/" $2}' | sort -u > $TMPDIR/used
sed '/^#/d; /^[[:space:]]*$/d; s/^[+X] //; s,^,debian/patches/,' debian/patches/series* | sort -u > $TMPDIR/used
find debian/patches ! -path '*/series*' -type f -name "*.diff" -o -name "*.patch" -printf "%p\n" | sort > $TMPDIR/avail
echo "Used patches"
echo "=============="
Expand Down
141 changes: 75 additions & 66 deletions linux-3/debian/bin/gencontrol.py
Expand Up @@ -34,7 +34,6 @@ class Gencontrol(Base):
'relations': {
},
'xen': {
'dom0-support': config.SchemaItemBoolean(),
'flavours': config.SchemaItemList(),
'versions': config.SchemaItemList(),
}
Expand All @@ -60,6 +59,21 @@ def do_main_setup(self, vars, makeflags, extra):
'SOURCEVERSION': self.version.complete,
})

def do_main_makefile(self, makefile, makeflags, extra):
for featureset in iter(self.config['base', ]['featuresets']):
makeflags_featureset = makeflags.copy()
makeflags_featureset['FEATURESET'] = featureset
cmds_source = ["$(MAKE) -f debian/rules.real source-featureset %s"
% makeflags_featureset]
makefile.add('source_%s_real' % featureset, cmds=cmds_source)
makefile.add('source_%s' % featureset,
['source_%s_real' % featureset])
makefile.add('source', ['source_%s' % featureset])

makeflags = makeflags.copy()
makeflags['ALL_FEATURESETS'] = ' '.join(self.config['base', ]['featuresets'])
super(Gencontrol, self).do_main_makefile(makefile, makeflags, extra)

def do_main_packages(self, packages, vars, makeflags, extra):
packages.extend(self.process_packages(self.templates["control.main"], self.vars))

Expand All @@ -72,15 +86,23 @@ def do_arch_setup(self, vars, makeflags, arch, extra):
self._setup_makeflags(self.arch_makeflags, makeflags, config_base)

def do_arch_packages(self, packages, makefile, arch, vars, makeflags, extra):
# Some userland architectures require kernels from another
# (Debian) architecture, e.g. x32/amd64.
foreign_kernel = not self.config['base', arch].get('featuresets')

if self.version.linux_modifier is None:
try:
vars['abiname'] = '-%s' % self.config['abi', arch]['abiname']
except KeyError:
vars['abiname'] = self.abiname
makeflags['ABINAME'] = vars['abiname']

headers_arch = self.templates["control.headers.arch"]
packages_headers_arch = self.process_packages(headers_arch, vars)
if foreign_kernel:
packages_headers_arch = []
makeflags['FOREIGN_KERNEL'] = True
else:
headers_arch = self.templates["control.headers.arch"]
packages_headers_arch = self.process_packages(headers_arch, vars)

libc_dev = self.templates["control.libc-dev"]
packages_headers_arch[0:0] = self.process_packages(libc_dev, {})
Expand All @@ -91,44 +113,49 @@ def do_arch_packages(self, packages, makefile, arch, vars, makeflags, extra):
self.merge_packages(packages, packages_headers_arch, arch)

cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-arch %s" % makeflags]
cmds_source = ["$(MAKE) -f debian/rules.real source-arch %s" % makeflags]
makefile.add('binary-arch_%s_real' % arch, cmds=cmds_binary_arch)
makefile.add('source_%s_real' % arch, cmds=cmds_source)

# Shortcut to aid architecture bootstrapping
makefile.add('binary-libc-dev_%s' % arch,
['source_%s_real' % arch],
['source_none_real'],
["$(MAKE) -f debian/rules.real install-libc-dev_%s %s" %
(arch, makeflags)])

# Add udebs using kernel-wedge
installer_def_dir = 'debian/installer'
installer_arch_dir = os.path.join(installer_def_dir, arch)
if os.path.isdir(installer_arch_dir):
kw_env = os.environ.copy()
kw_env['KW_DEFCONFIG_DIR'] = installer_def_dir
kw_env['KW_CONFIG_DIR'] = installer_arch_dir
kw_proc = subprocess.Popen(
['kernel-wedge', 'gen-control',
self.abiname],
stdout=subprocess.PIPE,
env=kw_env)
udeb_packages = read_control(kw_proc.stdout)
kw_proc.wait()
if kw_proc.returncode != 0:
raise RuntimeError('kernel-wedge exited with code %d' %
kw_proc.returncode)

self.merge_packages(packages, udeb_packages, arch)

# These packages must be built after the per-flavour/
# per-featureset packages.
makefile.add(
'binary-arch_%s' % arch,
cmds=["$(MAKE) -f debian/rules.real install-udeb_%s %s "
"PACKAGE_NAMES='%s'" %
(arch, makeflags,
' '.join(p['Package'] for p in udeb_packages))])
if os.getenv('DEBIAN_KERNEL_DISABLE_INSTALLER'):
if self.changelog[0].distribution == 'UNRELEASED':
import warnings
warnings.warn(u'Disable installer modules on request (DEBIAN_KERNEL_DISABLE_INSTALLER set)')
else:
raise RuntimeError(u'Unable to disable installer modules in release build (DEBIAN_KERNEL_DISABLE_INSTALLER set)')
else:
# Add udebs using kernel-wedge
installer_def_dir = 'debian/installer'
installer_arch_dir = os.path.join(installer_def_dir, arch)
if os.path.isdir(installer_arch_dir):
kw_env = os.environ.copy()
kw_env['KW_DEFCONFIG_DIR'] = installer_def_dir
kw_env['KW_CONFIG_DIR'] = installer_arch_dir
kw_proc = subprocess.Popen(
['kernel-wedge', 'gen-control',
self.abiname],
stdout=subprocess.PIPE,
env=kw_env)
udeb_packages = read_control(kw_proc.stdout)
kw_proc.wait()
if kw_proc.returncode != 0:
raise RuntimeError('kernel-wedge exited with code %d' %
kw_proc.returncode)

self.merge_packages(packages, udeb_packages, arch)

# These packages must be built after the per-flavour/
# per-featureset packages.
makefile.add(
'binary-arch_%s' % arch,
cmds=["$(MAKE) -f debian/rules.real install-udeb_%s %s "
"PACKAGE_NAMES='%s'" %
(arch, makeflags,
' '.join(p['Package'] for p in udeb_packages))])

def do_featureset_setup(self, vars, makeflags, arch, featureset, extra):
config_base = self.config.merge('base', arch, featureset)
Expand All @@ -141,9 +168,7 @@ def do_featureset_packages(self, packages, makefile, arch, featureset, vars, mak
self.merge_packages(packages, (package_headers,), arch)

cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-featureset %s" % makeflags]
cmds_source = ["$(MAKE) -f debian/rules.real source-featureset %s" % makeflags]
makefile.add('binary-arch_%s_%s_real' % (arch, featureset), cmds=cmds_binary_arch)
makefile.add('source_%s_%s_real' % (arch, featureset), cmds=cmds_source)

flavour_makeflags_base = (
('compiler', 'COMPILER', False),
Expand Down Expand Up @@ -241,17 +266,14 @@ def do_flavour_packages(self, packages, makefile, arch, featureset, flavour, var
packages_dummy = []
packages_own = []

if config_entry_image['type'] == 'plain-s390-tape':
image = self.templates["control.image.type-standalone"]
else:
image = self.templates["control.image.type-%s" % config_entry_image['type']]
image = self.templates["control.image.type-%s" % config_entry_image['type']]

config_entry_xen = self.config.merge('xen', arch, featureset, flavour)
if config_entry_xen.get('dom0-support', False):
if config_entry_xen:
p = self.process_packages(self.templates['control.xen-linux-system'], vars)
l = PackageRelationGroup()
for xen_flavour in config_entry_xen['flavours']:
l.append("xen-hypervisor-%s" % xen_flavour)
l.append("xen-system-%s" % xen_flavour)
p[0]['Depends'].append(l)
packages_dummy.extend(p)

Expand All @@ -269,10 +291,13 @@ def do_flavour_packages(self, packages, makefile, arch, featureset, flavour, var

build_debug = config_entry_build.get('debug-info')

if build_debug and self.changelog[0].distribution == 'UNRELEASED' and os.getenv('DEBIAN_KERNEL_DISABLE_DEBUG'):
import warnings
warnings.warn(u'Disable building of debug infos on request (DEBIAN_KERNEL_DISABLE_DEBUG)')
build_debug = False
if os.getenv('DEBIAN_KERNEL_DISABLE_DEBUG'):
if self.changelog[0].distribution == 'UNRELEASED':
import warnings
warnings.warn(u'Disable debug infos on request (DEBIAN_KERNEL_DISABLE_DEBUG set)')
build_debug = False
else:
raise RuntimeError(u'Unable to disable debug infos in release build (DEBIAN_KERNEL_DISABLE_DEBUG set)')

if build_debug:
makeflags['DEBUG'] = True
Expand Down Expand Up @@ -315,6 +340,7 @@ def check_config(default, fail, *entry_name):
return check_config_files(configs)

kconfig = check_config('config', True)
kconfig.extend(check_config("kernelarch-%s/config" % config_entry_base['kernel-arch'], False))
kconfig.extend(check_config("%s/config" % arch, True, arch))
kconfig.extend(check_config("%s/config.%s" % (arch, flavour), False, arch, None, flavour))
kconfig.extend(check_config("featureset-%s/config" % featureset, False, None, featureset))
Expand All @@ -327,26 +353,12 @@ def check_config(default, fail, *entry_name):
cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-flavour %s" % makeflags]
if packages_dummy:
cmds_binary_arch.append("$(MAKE) -f debian/rules.real install-dummy DH_OPTIONS='%s' %s" % (' '.join(["-p%s" % i['Package'] for i in packages_dummy]), makeflags))
cmds_build = ["$(MAKE) -f debian/rules.real build %s" % makeflags]
cmds_build = ["$(MAKE) -f debian/rules.real build-arch %s" % makeflags]
cmds_setup = ["$(MAKE) -f debian/rules.real setup-flavour %s" % makeflags]
makefile.add('binary-arch_%s_%s_%s_real' % (arch, featureset, flavour), cmds=cmds_binary_arch)
makefile.add('build_%s_%s_%s_real' % (arch, featureset, flavour), cmds=cmds_build)
makefile.add('build-arch_%s_%s_%s_real' % (arch, featureset, flavour), cmds=cmds_build)
makefile.add('setup_%s_%s_%s_real' % (arch, featureset, flavour), cmds=cmds_setup)

def do_extra(self, packages, makefile):
apply = self.templates['patch.apply']

vars = {
'revisions': 'orig base ' + ' '.join([i.revision for i in self.versions[::-1]]),
'upstream': self.version.upstream,
'linux_upstream': self.version.linux_upstream,
'abiname': self.abiname,
}

apply = self.substitute(apply, vars)

file('debian/bin/patch.apply', 'w').write(apply)

def merge_packages(self, packages, new, arch):
for new_package in new:
name = new_package['Package']
Expand Down Expand Up @@ -379,10 +391,7 @@ def process_changelog(self):
self.abiname_part = ''
else:
self.abiname_part = '-%s' % self.config['abi', ]['abiname']
# XXX: We need to add another part until after wheezy
self.abiname = (re.sub('^(\d+\.\d+)(?=-|$)', r'\1.0',
self.version.linux_upstream)
+ self.abiname_part)
self.abiname = self.version.linux_upstream + self.abiname_part
self.vars = {
'upstreamversion': self.version.linux_upstream,
'version': self.version.linux_version,
Expand Down
11 changes: 5 additions & 6 deletions linux-3/debian/bin/genorig.py
Expand Up @@ -33,9 +33,8 @@ def __init__(self, input_files, override_version):
self.log('Using source name %s, version %s, dfsg %s\n' % (source, version.upstream, self.version_dfsg))

self.orig = '%s-%s' % (source, version.upstream)
self.orig_tar = '%s_%s.orig.tar.gz' % (source, version.upstream)
self.tag = 'v' + re.sub(r"^(\d+\.\d+)\.0", r"\1",
version.upstream.replace('~', '-'))
self.orig_tar = '%s_%s.orig.tar.xz' % (source, version.upstream)
self.tag = 'v' + version.linux_upstream_full

def __call__(self):
import tempfile
Expand Down Expand Up @@ -100,9 +99,9 @@ def upstream_patch(self, input_patch):
raise RuntimeError("Can't patch source")

def debian_patch(self):
name = "orig-" + self.version_dfsg
name = "orig"
self.log("Patching source with debian patch (series %s)\n" % name)
fp = file("debian/patches/series/" + name)
fp = file("debian/patches/series-" + name)
series = PatchSeries(name, "debian/patches", fp)
series(dir=os.path.join(self.dir, self.orig))

Expand All @@ -118,7 +117,7 @@ def tar(self):
except OSError:
pass
self.log("Generate tarball %s\n" % out)
cmdline = ['tar -czf', out, '-C', self.dir, self.orig]
cmdline = ['tar -caf', out, '-C', self.dir, self.orig]
try:
if os.spawnv(os.P_WAIT, '/bin/sh', ['sh', '-c', ' '.join(cmdline)]):
raise RuntimeError("Can't patch source")
Expand Down

0 comments on commit 031d023

Please sign in to comment.