* Use generated rules, effectively remove second flavour resolver.

* Implement generic support for cross compilation.
* Install generated files in the correct headers packages.

r3745: waldi | 2005-08-08 15:40:20 +0000
* debian/bin/gencontrol.py
  - Rename some variables.
  - Write debian/rules.gen.
* debian/rules: Use debian/rules.gen.

r3746: waldi | 2005-08-08 15:51:26 +0000
debian/bin/gencontrol.py: Simplify rules.

r3747: waldi | 2005-08-08 16:22:29 +0000
Use generated rules for unpack, effectively remove second flavour resolver.

* debian/Makefile: Updates.
* debian/bin/gencontrol.py: Generate unpack rules.
* debian/rules: Use new rules.

r3748: waldi | 2005-08-08 17:03:32 +0000
Use generated rules for build.

* debian/Makefile
  - Updates.
  - Generate bin/touch.orig.
* debian/bin/gencontrol.py: Generate build rules.
* debian/rules: Remove bin/touch.orig creation.

r3752: waldi | 2005-08-08 18:13:27 +0000
Use generated rules for binary target.

* debian/Makefile: Updates.
* debian/bin/gencontrol.py: Generate binary rules.

r3753: waldi | 2005-08-08 19:00:05 +0000
* debian/Makefile
  - Overwrite env.
  - Split binary target.
* debian/bin/gencontrol.py: Update.
* debian/rules: Call correct targets.

r3756: waldi | 2005-08-08 20:07:31 +0000
* debian/Makefile
  - Split unpack target.
  - Don't generate stamp files for install targets.
  - Update dir names.
* debian/bin/gencontrol.py: Split unpack target.
* debian/rules: Remove new stamp files.

r3793: waldi | 2005-08-09 19:57:44 +0000
* debian/Makefile
  - Fix directories.
  - Build anything in one subdir.
* debian/bin/gencontrol.py: Call debian/Makefile from package root.
* debian/rules: Updates.

r3794: waldi | 2005-08-09 21:43:07 +0000
debian/bin/gencontrol.py: Updates.

r3795: waldi | 2005-08-09 22:26:53 +0000
* debian/Makefile
  - Include debian/rules.defs.
  - Simplify kpkg command specs.
* debian/rules
  - Move directory definitions to debian/rules.defs.
  - Include debian/rules.defs.
* debian/rules.defs: Add.

r3796: waldi | 2005-08-09 22:30:23 +0000
* debian/bin/gencontrol.py: Use debian/rules.real.
* debian/rules.real: Move from debian/Makefile.

r3797: waldi | 2005-08-09 22:39:24 +0000
debian/bin/gencontrol.py, debian/rules, debian/rules.real:
Rename unpack to setup.

r3798: waldi | 2005-08-09 22:52:43 +0000
debian/bin/gencontrol.py, debian/rules.real: Use DH_OPTIONS.

r3799: waldi | 2005-08-09 22:53:37 +0000
debian/rules: Use host, not build architecture.

r3815: waldi | 2005-08-10 11:53:38 +0000
debian/rules.real: Update targets.

r3816: waldi | 2005-08-10 12:06:13 +0000
debian/rules.real: Move patch rules from debian/rules.

r3817: waldi | 2005-08-10 12:22:26 +0000
debian/bin/gencontrol.py, debian/rules.real: Small fixes.

r3818: waldi | 2005-08-10 12:29:17 +0000
debian/rules.real: Add seperate setup step for headers package.

r3819: waldi | 2005-08-10 12:36:57 +0000
debian/bin/gencontrol.py, debian/rules, debian/rules.real: Add binary-indep.

r3820: waldi | 2005-08-10 12:40:10 +0000
debian/bin/gencontrol.py: Fix typo.

r3821: waldi | 2005-08-10 12:56:58 +0000
* debian/bin/gencontrol.py: Use binary-indep.
* debian/rules.real: Move source package rules from debian/rules.

r3822: waldi | 2005-08-10 13:11:24 +0000
* debian/bin/gencontrol.py: Use install-dummy.
* debian/rules.real: Move tree package rules from debian/rules.

r3823: waldi | 2005-08-10 13:41:30 +0000
* debian/bin/gencontrol.py: Fix typos.
* debian/rules.real
  - Move doc package rules from debian/rules.
  - Fix some installation rules.

r3824: waldi | 2005-08-10 13:55:41 +0000
debian/rules.real: Move patch package rules from debian/rules.

r3825: waldi | 2005-08-10 14:17:33 +0000
debian/rules: Cleanup.

r3826: waldi | 2005-08-10 14:37:03 +0000
debian/rules.real: Fix typos.

r3827: waldi | 2005-08-10 14:57:07 +0000
debian: Update svn:ignore property.

r3828: waldi | 2005-08-10 15:07:29 +0000
debian/rules.real
- Move some install rules.
- Support cross compilation.

r3829: waldi | 2005-08-10 15:39:14 +0000
debian/rules.real: Realy rename the rules.

r3830: waldi | 2005-08-10 17:35:54 +0000
debian/rules.real
- Move one rule.
- Fix permissions of source tar ball.
Closes: 322409

r3832: waldi | 2005-08-10 18:57:51 +0000
debian/templates/control.headers.main.in: Fix command to install headers.

r3833: waldi | 2005-08-10 20:30:48 +0000
* debian/bin/gencontrol.py: Remove dash from ABINAME.
* debian/rules.real
  - Use abiname without dash.
  - Install patches with correct permissions.

r3847: waldi | 2005-08-13 09:11:40 +0000
debian/templates/post-install.in:
Install any executable file and files which matches *.sh and *.pl in the
scripts directory.
Closes: 322612

r3848: waldi | 2005-08-13 09:32:54 +0000
* arch/powerpc/defines: Add pseries definitions.
* arch/powerpc/config.pseries: Move from arch/powerpc/noconfig.pseries.
* bin/gencontrol.py
  - Export KPKG_SUBARCH.
  - Updates.
* rules.real: Use KPKG_SUBARCH.

r3853: waldi | 2005-08-14 10:01:06 +0000
debian/rules.real
- Fix cross compile options for make-kpkg.
- Fix architecture patches.
- Remove asm-offsets.s workaround, pending real fix.

r3854: waldi | 2005-08-14 12:07:36 +0000
debian/rules.real: Export version informations.

r3855: waldi | 2005-08-14 12:39:57 +0000
debian/templates/post-install.in: Always install generated files.

r3858: waldi | 2005-08-14 14:51:28 +0000
debian/rules.real: Integrate headers install fix.

r3859: waldi | 2005-08-14 15:29:21 +0000
* debian/arch/powerpc/config.powerpc64
  - Fix wrong formated entries.
  - Enable vscsi client.
* debian/arch/powerpc/defines: Fix flavour name.
* debian/README.PPC64: Remove.

svn path=/trunk/kernel/source/linux-2.6/; revision=3860
This commit is contained in:
Bastian Blank 2005-08-14 19:59:43 +00:00
parent 787ccc2f6f
commit 9499f6b605
10 changed files with 453 additions and 558 deletions

258
debian/Makefile vendored
View File

@ -1,258 +0,0 @@
#
# This Makefile executes the unpack/build/binary targets for a single
# subarch, which is passed in the subarch variable. Empty subarch
# variable means that we are building for an arch without the subarch.
# Additionally, variables version, abiname and ltver are
# expected to be available (need to be exported from the parent process).
# It is possible to override the flavours by setting the flavours
# variable. It will also be passed a list of source files
#
# This Makefile is run from the debian subdir.
#
SHELL := sh -e
debver := $(version)-$(abiname)
debnum := -$(abiname)
#
# These variables control the behaviour of make-kpkg
#
# enable cross-compiling for m68k
#DEB_HOST_ARCH := m68k
#
DEBIAN_UPSTREAM_VERSION := $(version)
ifeq (,$(DEB_HOST_ARCH))
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
endif
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
cross_compile := $(DEB_HOST_ARCH)
endif
export version debnum DEBIAN_UPSTREAM_VERSION DEBIAN_STEM
karch := $(DEB_HOST_ARCH)
#
# Build the list of common config files to be included
#
ifeq ($(subarch),none)
basedir := arch/$(karch)
append :=
else
basedir := arch/$(karch)/$(subarch)
append := $(subarch)-
endif
configs := $(notdir $(wildcard $(basedir)/config.*))
configs := $(filter-out config, $(configs))
tkdir := linux-source-$(version)
kdir := linux-source-$(version)-$(subarch)
ifndef flavours
flavours := $(patsubst config.%,%,$(configs))
endif
controls := templates/control.source.in templates/control.headers.in
controls += $(basedir)/control.in
-include $(basedir)/Makefile.inc
#
# Here we construct the command lines for different make-kpkg
# calls (build, linux-image, linux-headers) based on the values
# of variables defined so far and provided by the arch/subarch
# in Makefile.inc. @flavour@ in the expressions is going to be
# replaced by the flavour for which the command is run.
#
kpkg_headers_cmd := HEADER_CLEAN_HOOK='$(CURDIR)/header-install-$(subarch)'
kpkg_headers_cmd += make-kpkg --append-to-version $(append)$(debnum)
kpkg_headers_cmd += --stem linux --config defconfig
kpkg_build_cmd := make-kpkg --append-to-version $(debnum)-@flavour@
kpkg_build_cmd += --stem linux
ifdef build_subarch
kpkg_build_cmd += --subarch $(build_subarch)
endif
# XXX: Instead of special-casing m68k here, we could make --arch and
# --cross_compile options supported in Makefile.inc, and use them if
# DEB_HOST_ARCH != DEB_BUILD_ARCH.. -dil
ifeq ($(cross_compile),m68k)
kpkg_headers_cmd += --arch m68k --cross_compile m68k-linux
kpkg_build_cmd += --arch m68k --cross_compile m68k-linux
endif
ifdef headers_subarch
kpkg_headers_cmd += --subarch $(headers_subarch)
endif
ifdef build_makeflags
export_makeflags := export MAKEFLAGS=$(build_makeflags)
else
export_makeflags := true
endif
#
# Note that next variable (kpkg_image_pre) is not going to be evaluated
# immediately. When referenced, the variable $* will have the current
# flavour for which the command is executed. So if this flavour will
# happen to be in the image_prefix_flavours list, the call to make-kpkg
# will be prepended with contents if image_prefix.
#
kpkg_image_pre = $(if $(filter $*,$(image_prefix_flavours)),$(image_prefix))
kpkg_image_cmd := $(kpkg_build_cmd) --initrd kernel_image
kpkg_build_cmd += build
kpkg_headers_cmd += kernel-headers
ifndef headers_dirs
headers_dirs = $(karch)
endif
ccommon = arch/config arch/$(karch)/config arch/$(karch)/$(subarch)/config
#
# Here we build lists of directories and stamps which we will depend on.
# For each class of such targets there is a pattern rule which will catch
# it and do the right thing.
#
bdirs := $(addprefix build-$(subarch)-, $(flavours))
bstamps := $(addprefix build-stamp-$(subarch)-, $(flavours))
istamps := $(addprefix install-stamp-$(subarch)-, $(flavours))
#
# Targets
#
unpack: unpack-stamp-$(subarch)
unpack-stamp-$(subarch): $(configs) header-install-$(subarch) $(bdirs)
touch unpack-stamp-$(subarch)
build: build-stamp-$(subarch)
build-stamp-$(subarch): unpack-stamp-$(subarch) $(bstamps)
touch build-stamp-$(subarch)
binary-indep: build
binary-arch: build headers-stamp $(istamps)
mv *.deb ../..
install-stamp-$(subarch)-%: build-$(subarch)-% build-stamp-$(subarch)-%
cp -al $< install-$*;
cd install-$*; \
$(export_makeflags); \
$(strip $(kpkg_image_pre) $(subst @flavour@,$*,$(kpkg_image_cmd)))
cat install-$*/debian/files >> files;
rm -rf install-$*;
touch install-stamp-$(subarch)-$*
headers-stamp: $(kdir)
# The headers config is now automatically generated via the kernel's
# defconfig target. Woo!
cd $(kdir); $(kpkg_headers_cmd)
cat $(kdir)/debian/files >> files
touch headers-stamp
binary: binary-indep binary-arch
header-install-$(subarch): templates/header-install.in
sed -e 's,@kbpkg@,$(kbpkg),g' \
-e 's,@ksource_dir@,$(CURDIR)/$(kdir),g' \
-e 's,@flavours@,$(flavours),g' \
-e 's,@headers_dirs@,$(headers_dirs),g' \
templates/header-install.in > header-install-$(subarch)
chmod u+x header-install-$(subarch)
#
# The way to make the correct package names is to make a
# subarch-specific post-install script...
#
ifdef extra_postinstall_command
extra_command := $(extra_postinstall_command)
else
extra_command := true
endif
post-install-$(subarch): templates/post-install.in
sed -e 's,@initrd_modules@,$(initrd_modules),' \
-e 's,@append_subarch@,$(append),' \
-e 's,@extra_postinstall_command@,$(extra_command),' \
-e 's,@headers_dirs@,$(headers_dirs),' \
templates/post-install.in > post-install-$(subarch)
#
# Generates the kernel config file for a subarch by merging
# the arch-independent config file (arch/config),
# arch-specific config file (arch/$(karch)/config),
# and subarch specific one (arch/$(karch)/$(subarch)/config).
# It is possible to avoid the inclusion of the arch-indep
# config file by setting include_common_config = no in the
# arch/$(karch)/Makefile.inc.
#
config.%:
@echo "configs=$(configs)"
@echo "Generating configuration file $@:"
rm -f $@
for i in $(ccommon); do \
if [ -f $${i} ]; then \
cat $${i} >> $@; \
fi; \
done
# Flavour config file must be present
cat $(basedir)/$@ >> $@
srcfiles := $(filter-out ../debian ../linux-source-$(version), $(shell echo ../*))
patches := $(wildcard patches-arch/$(subarch).*)
patches += $(wildcard patches-arch/$(subarch)_*)
patches += $(wildcard patches-arch/$(karch).*)
patches += $(wildcard patches-arch/$(karch)_*)
patches := $(strip $(patches))
# substitute() and friends is duplicated in debian/rules; this should
# be cleaned up in the long term. watch out for relative paths, as
# debian/rules runs in the top level directory, while debian/Makefile
# runs from the debian directory!
$(kdir): post-install-$(subarch) $(wildcard templates/control.*.in)
mkdir -p $(tkdir)
cp -al $(srcfiles) $(tkdir)
mkdir -p $(tkdir)/debian
cp changelog $(tkdir)/debian
cp copyright $(tkdir)/debian
cp control $(tkdir)/debian/control
touch $(tkdir)/debian/official
if [ -n '$(patches)' ]; then \
cd $(tkdir); \
cat $(addprefix ../,$(patches)) | patch -p1; \
fi
install post-install-$(subarch) $(tkdir)/debian/post-install
mv $(tkdir) $@
#
# This target performs a build for a particular flavour. Note
# that in this file it should be always placed *before* the
# build-$(subarch)-% target, which creates the build directory.
#
# Some arches have extra arch/${ARCH}/kernel/asm-offsets.s files
# which have to be included in linux-headers. The problem is that
# they are only generated during build and we never performed a
# full build in the directory $(kdir) where linux-headers are
# built. So, after build we check whether current build arch has
# such a file and symlink it into the $(kdir) if necessary. It will
# then be picked up and included into the linux-headers package
# by the headers-install script.
#
build-stamp-$(subarch)-%: build-$(subarch)-%
PATH=$$PWD/bin:$$PATH; \
cd $<; \
$(export_makeflags); \
$(subst @flavour@,$*,$(kpkg_build_cmd)); \
$(if $(image_postproc),$(image_postproc),true); \
arch=$$(basename $$(readlink include/asm)); \
arch="$${arch#asm-}"; \
src="arch/$${arch}/kernel/asm-offsets.s"; \
dst="../$(kdir)/$${src}"; \
if [ -f "$${src}" ] && [ ! -e "$${dst}" ]; then \
cp -a "$$(pwd)/$${src}" "$${dst}"; \
fi
touch build-stamp-$(subarch)-$*
#
# Creates a build directory for a particular flavour
#
build-$(subarch)-%: $(kdir) config.%
if [ ! -d $@ ]; then \
cp -al $(kdir) $@; \
cp config.$* $@/.config; \
fi
binary-dummy:
dh_testdir
dh_testroot
dh_installchangelogs $(PACKAGES_ARG)
dh_installdocs $(PACKAGES_ARG)
dh_compress $(PACKAGES_ARG)
dh_fixperms $(PACKAGES_ARG)
dh_installdeb $(PACKAGES_ARG)
dh_gencontrol $(PACKAGES_ARG) -- $(GENCONTROL_ARGS)
dh_md5sums $(PACKAGES_ARG)
dh_builddeb $(PACKAGES_ARG)
.PHONY: build unpack binary-indep binary-arch binary

36
debian/README.PPC64 vendored
View File

@ -1,36 +0,0 @@
Where did the power3/power4 ppc64 flavours go ?
===============================================
As of 2.6.12, and anticipating the inclusion of a powerpc biarch
toolchain in debian sid and then etch, we have dropped the 32bit
ppc64 flavours. I will provide unofficial -pseries (replace all
previous 64bit flavours) at :
http://people.debian.org/~luther/ppc64
until we are able to build them inside of debian, which will
hopefully be only a couple of weeks now.
But if you feel impatient, here are the instructions on how to build
those arches yourselves :
1) install the ubuntu/breezy glibc and gcc-4.0 packages (preferably
in a sid chroot)
2) go into debian/arch/powerpc
3) rename the 32bit flavours to noconfig.powerpc[-smp]
4) rename the 64bit flavours to config.pseries
5) edit Makefile.inc, and change the last three lines to :
headers_subarch = powerpc
build_subarch = powerpc64
6) go into the toplevel, and launch :
dpkg-buildpackage -rfakeroot -us -uc -B
This should build you a couple of packages, where you would be interested
in the linux-image-2.6.12-1-pseries and linux-headers-2.6.12-1-pseries ones.
Enjoy,
Sven Luther

View File

@ -1,5 +1,5 @@
CONFIG_64BIT=y
CONFIG_ADB is not set
# CONFIG_ADB is not set
CONFIG_AUDITSYSCALL=y
CONFIG_COMPAT=y
CONFIG_CPUSETS=y
@ -53,6 +53,7 @@ CONFIG_SCANLOG=m
CONFIG_SCHED_SMT=y
CONFIG_SCSI_QLOGIC_1280_1040=y
CONFIG_SCSI_QLOGIC_1280=m
CONFIG_SCSI_IBMVSCSI=m
CONFIG_SECCOMP=y
# CONFIG_SERIAL_ICOM is not set
CONFIG_SMP=y

View File

@ -1,2 +1,10 @@
[DEFAULT]
[powerpc]
depends: mkvmlinuz (>= 13)
[powerpc-smp]
depends: mkvmlinuz (>= 13)
[powerpc64]
kpkg-subarch: powerpc64

View File

@ -143,8 +143,8 @@ def read_template(name):
return read_rfc822(file("debian/templates/control.%s.in" % name))
def parse_version(version):
match = re.match("^((\d+\.\d+)\..+?)-([^-]+)$", version)
return (match.group(0), match.group(1), match.group(2), match.group(3))
match = re.match("^(?P<source>(?P<version>(?P<major>\d+\.\d+)\..+?)-(?P<debian>[^-]+))$", version)
return match.groupdict()
def process_depends(key, e, in_e, vars):
in_dep = in_e[key].split(',')
@ -188,6 +188,9 @@ def process_packages(in_entries, vars):
return entries
def process_real_image(in_entry, vars):
in_entry = in_entry.copy()
if vars.has_key('desc'):
in_entry['Description'] += "\n.\n" + vars['desc']
entry = process_package(in_entry, vars)
for i in (('Depends', 'Provides', 'Suggests')):
value = []
@ -209,8 +212,6 @@ def process_real_image(in_entry, vars):
if t is not None:
value.append(t)
entry[i] = ', '.join(value)
if vars.has_key('desc'):
entry['Description'] += "\n.\n" + vars['desc']
return entry
def process_real_tree(in_entry, changelog, vars):
@ -225,19 +226,11 @@ def process_real_tree(in_entry, changelog, vars):
value = []
tmp = entry.get(i, None)
if tmp:
tmp = tmp.split(',')
for t in tmp:
value.append(t.strip())
value.extend([j.strip() for j in tmp.split(',')])
if i == 'Depends':
tmp = []
for v in versions:
v = parse_version(v)
tmp.append("linux-source-%s (= %s)" % (v[1], v[0]))
value.append(' | '.join(tmp))
value.append(' | '.join(["linux-source-%(version)s (= %(source)s)" % parse_version(v) for v in versions]))
elif i == 'Provides':
for v in versions:
v = parse_version(v)
value.append("linux-tree-%s" % v[0])
value.extend(["linux-tree-%(source)s" % parse_version(v) for v in versions])
entry[i] = ', '.join(value)
return entry
@ -248,16 +241,16 @@ def substitute(s, vars):
def vars_changelog(vars, changelog):
version = parse_version(changelog[0]['Version'])
vars['srcver'] = version[0]
vars['version'] = version[1]
vars['major'] = version[2]
vars['srcver'] = version['source']
vars['version'] = version['version']
vars['major'] = version['major']
return vars
def write_control(list):
write_rfc822(file("debian/control", 'w'), list)
def write_makefile(list):
f = file("debian/Makefile.inc", 'w')
f = file("debian/rules.gen", 'w')
for i in list:
f.write("%s\n" % i[0])
if i[1] is not None:
@ -281,6 +274,7 @@ if __name__ == '__main__':
vars = {}
vars = vars_changelog(vars, changelog)
version = vars['version']
source_version = vars['srcver']
vars.update(config().defaults())
@ -323,16 +317,30 @@ if __name__ == '__main__':
image = read_template("image")
image_latest = read_template("image.latest")
i1 = arches.keys()
i1.sort()
for arch in i1:
makeflags = ["VERSION='%s'" % version, "SOURCE_VERSION='%s'" % source_version]
cmds_binary_indep = []
cmds_binary_indep.append(("$(MAKE) -f debian/rules.real binary-indep %s" % ' '.join(makeflags),))
makefile.append(("binary-indep:", cmds_binary_indep))
arch_list = arches.keys()
arch_list.sort()
for arch in arch_list:
arch_vars = vars.copy()
arch_vars['arch'] = arch
arch_vars.update(config_arch(arch).defaults())
i2 = arches[arch].keys()
i2.sort()
for subarch in i2:
for i in (('setup',)):
makefile.append(("%s-%s:: %s-%s-real" % (i, arch, i, arch), None))
arch_makeflags = makeflags[:]
arch_makeflags.append("ARCH='%s'" % arch)
cmds_setup = []
cmds_setup.append(("$(MAKE) -f debian/rules.real setup-arch %s" % ' '.join(arch_makeflags),))
makefile.append(("setup-%s-real:" % arch, cmds_setup))
subarch_list = arches[arch].keys()
subarch_list.sort()
for subarch in subarch_list:
subarch_config = config_subarch(arch, subarch)
subarch_vars = arch_vars.copy()
subarch_vars.update(subarch_config.defaults())
@ -344,12 +352,24 @@ if __name__ == '__main__':
subarch_text = 'none'
subarch_vars['subarch'] = ''
for i in ('binary', 'build', 'unpack'):
for i in ('binary-arch', 'build', 'setup'):
makefile.append(("%s-%s:: %s-%s-%s" % (i, arch, i, arch, subarch_text), None))
makefile.append(("%s-%s-%s::" % (i, arch, subarch_text), None))
for i in ('binary-arch', 'setup'):
makefile.append(("%s-%s-%s:: %s-%s-%s-real" % (i, arch, subarch_text, i, arch, subarch_text), None))
i3 = arches[arch][subarch].keys()
i3.sort()
for flavour in i3:
subarch_makeflags = arch_makeflags[:]
subarch_makeflags.extend(["SUBARCH='%s'" % subarch_text, "ABINAME='%s'" % subarch_vars['abiname']])
cmds_binary_arch = []
cmds_binary_arch.append(("$(MAKE) -f debian/rules.real binary-arch-subarch %s" % ' '.join(subarch_makeflags),))
cmds_setup = []
cmds_setup.append(("$(MAKE) -f debian/rules.real setup-subarch %s" % ' '.join(subarch_makeflags),))
makefile.append(("binary-arch-%s-%s-real:" % (arch, subarch_text), cmds_binary_arch))
makefile.append(("setup-%s-%s-real:" % (arch, subarch_text), cmds_setup))
flavour_list = arches[arch][subarch].keys()
flavour_list.sort()
for flavour in flavour_list:
flavour_vars = subarch_vars.copy()
flavour_vars['flavour'] = flavour
try:
@ -367,9 +387,24 @@ if __name__ == '__main__':
packages.append(process_package(headers[0], flavour_vars))
packages.extend(dummy_packages)
for i in ('binary', 'build', 'unpack'):
for i in ('binary-arch', 'build', 'setup'):
makefile.append(("%s-%s-%s:: %s-%s-%s-%s" % (i, arch, subarch_text, i, arch, subarch_text, flavour), None))
makefile.append(("binary-%s-%s-%s:" % (arch, subarch_text, flavour), ("$(MAKE) -f debian/Makefile binary-dummy PACKAGES_ARG='%s'" % ' '.join(["-p%s" % i['Package'] for i in dummy_packages]),)))
makefile.append(("%s-%s-%s-%s:: %s-%s-%s-%s-real" % (i, arch, subarch_text, flavour, i, arch, subarch_text, flavour), None))
flavour_makeflags = subarch_makeflags[:]
flavour_makeflags.append("FLAVOUR='%s'" % flavour)
if flavour_vars.has_key('kpkg-subarch'):
flavour_makeflags.append("KPKG_SUBARCH='%s'" % flavour_vars['kpkg-subarch'])
cmds_binary_arch = []
cmds_binary_arch.append(("$(MAKE) -f debian/rules.real binary-arch-flavour %s" % ' '.join(flavour_makeflags),))
cmds_binary_arch.append(("$(MAKE) -f debian/rules.real install-dummy DH_OPTIONS='%s'" % ' '.join(["-p%s" % i['Package'] for i in dummy_packages]),))
cmds_build = []
cmds_build.append(("$(MAKE) -f debian/rules.real build %s" % ' '.join(flavour_makeflags),))
cmds_setup = []
cmds_setup.append(("$(MAKE) -f debian/rules.real setup-flavour %s" % ' '.join(flavour_makeflags),))
makefile.append(("binary-arch-%s-%s-%s-real:" % (arch, subarch_text, flavour), cmds_binary_arch))
makefile.append(("build-%s-%s-%s-real:" % (arch, subarch_text, flavour), cmds_build))
makefile.append(("setup-%s-%s-%s-real:" % (arch, subarch_text, flavour), cmds_setup))
extra = read_template("extra")
packages.extend(process_packages(extra, vars))
@ -387,12 +422,12 @@ if __name__ == '__main__':
cmds = []
for i in extra_pn[arch]:
makeflags = ""
tmp = []
if i.has_key('X-Version-Overwrite-Epoch'):
makeflags = "GENCONTROL_ARGS='-v1:%s'" % source_version
cmds.append("$(MAKE) -f debian/Makefile binary-dummy PACKAGES_ARG='-p%s' %s" % (i['Package'], makeflags))
makefile.append(("binary-%s:: binary-%s-extra" % (arch, arch), None))
makefile.append(("binary-%s-extra:" % arch, cmds))
tmp.append("-v1:%s" % source_version)
cmds.append("$(MAKE) -f debian/rules.real install-dummy DH_OPTIONS='-p%s' GENCONTROL_ARGS='%s'" % (i['Package'], ' '.join(tmp)))
makefile.append(("binary-arch-%s:: binary-arch-%s-extra" % (arch, arch), None))
makefile.append(("binary-arch-%s-extra:" % arch, cmds))
write_control(packages)
write_makefile(makefile)

226
debian/rules vendored
View File

@ -1,204 +1,38 @@
#!/usr/bin/make -f
#
# Required variables. See README for a description of all the variables.
#
abiname := 1
#
# Generally nothing needs to be modified below this line
#
SHELL := sh -e
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
karch := $(DEB_BUILD_ARCH)
srcver := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')
version := $(word 1,$(subst -, ,$(srcver)))
ltver := $(word 2,$(subst -, ,$(srcver)))
major_v := $(word 1,$(subst ., ,$(version)))
minor_v := $(word 2,$(subst ., ,$(version)))
major := $(major_v).$(minor_v)
release := $(version)-$(ltver)
uver := $(subst .,_,$(version))
#
# If we are not passed a subarchs variable, we obtain the complete
# subarch list as a list of subdirectories in arch/$(karch). We
# also export the flavours variables, which allows to control which
# flavours are built.
#
ifndef subarchs
subarchs := $(shell find debian/arch/$(karch) \
-mindepth 1 -maxdepth 1 -type d \
! -name '.svn' -printf '%f\n')
endif
ifeq (,$(subarchs))
subarchs := none
endif
#
# The following definition gets the list of relevant files in the top-level
# directory. At this point we cannot verify that we are in top-level dir
# (we probably are), so it should be referenced only in the targets which
# run dh_testdir in the beginning.
#
source_files = $(filter-out debian linux-source-$(version), $(shell echo *))
VERSION := $(word 1,$(subst -, ,$(srcver)))
MAJOR := $(word 1,$(subst ., ,$(VERSION))).$(word 2,$(subst ., ,$(VERSION)))
export version abiname ltver kbuildver flavours major uver
include debian/rules.defs
patch: debian/patch-stamp
debian/patch-stamp: debian/bin/apply
setup: debian/setup-stamp
debian/setup-stamp: $(BUILD_DIR) $(STAMPS_DIR)
dh_testdir
chmod +x debian/bin/apply
override_version=$(release) home=debian/patches-debian debian/bin/apply
# make-kpkg does this when building kernel-source.
mv scripts/package/Makefile scripts/package/Makefile.dist
mv scripts/package/builddeb scripts/package/builddeb.dist
echo "# Dummy Makefile" > scripts/package/Makefile
echo "all:" >> scripts/package/Makefile
touch debian/patch-stamp
unpatch:
dh_testdir
if [ -e debian/patch-stamp ]; then \
override_version=$(release) home=debian/patches-debian \
debian/bin/apply $(version); \
cd scripts/package; \
mv Makefile.dist Makefile; \
mv builddeb.dist builddeb; \
fi
rm -f debian/patch-stamp
#
# linux-source package
#
spkg := linux-source-$(version)
sdir := debian/$(spkg)/usr/src
source: debian/source-stamp
debian/source-stamp: debian/patch-stamp
dh_testdir
dh_testroot
dh_installdirs -p$(spkg) /usr/src
# Link the files and create a tarball in correct location
mkdir $(spkg)
cp -al $(source_files) $(spkg)
chmod -R u+rw,go=rX $(spkg)
tar -cjf $(sdir)/$(spkg).tar.bz2 $(spkg)
rm -rf $(spkg)
dh_installdocs -p$(spkg) README
dh_installchangelogs -p$(spkg)
dh_compress -p$(spkg)
dh_fixperms -p$(spkg)
dh_installdeb -p$(spkg)
dh_gencontrol -p$(spkg)
dh_md5sums -p$(spkg)
dh_builddeb -p$(spkg)
touch debian/source-stamp
#
# linux-tree package
#
tpkg := linux-tree-$(version)
tree: debian/tree-stamp
debian/tree-stamp:
dh_testdir
dh_testroot
dh_installdirs -p$(tpkg)
dh_installdocs -p$(tpkg)
dh_installchangelogs -p$(tpkg)
dh_compress -p$(tpkg)
dh_fixperms -p$(tpkg)
dh_installdeb -p$(tpkg)
dh_gencontrol -p$(tpkg)
dh_md5sums -p$(tpkg)
dh_builddeb -p$(tpkg)
touch debian/tree-stamp
#
# linux-patch-debian
#
ppkg := linux-patch-debian-$(version)
pbase := /usr/src/kernel-patches/all/$(version)
pfull := debian/$(ppkg)$(pbase)
pdirs := $(pbase) $(pbase)/apply $(pbase)/debian $(pbase)/unpatch
ptchs := $(notdir $(wildcard debian/patches-arch/*))
kptch := debian/$(ppkg).kpatches.arch
pcdir := debian/patches-arch
patch-debian: debian/patch-debian-stamp
debian/patch-debian-stamp: debian/bin/apply debian/bin/unpatch
dh_testdir
dh_testroot
dh_installdirs -p$(ppkg) $(pdirs)
dh_install -p$(ppkg) debian/patches-debian/* $(pbase)/debian
# Install the debian patches
sed 's/@version@/$(release)/g' debian/bin/apply > $(pfull)/apply/debian
sed 's/@upstream@/$(version)/g' debian/bin/unpatch > $(pfull)/unpatch/debian
chmod a+x $(pfull)/apply/debian $(pfull)/unpatch/debian
chmod -x $(pfull)/debian/*.patch
bzip2 -9 $(pfull)/debian/*.patch
# Now the arch/subarch-specific patches
for i in $(ptchs); do \
rm -f $(kptch); \
arch=$${i%%.*}; \
echo "Patch-name: $${arch}" >> $(kptch); \
echo "Patch-id: $${arch}_$(uver)" >> $(kptch); \
echo "Path-strip-level: 1" >> $(kptch); \
echo >> $(kptch); \
echo "Patch-file: $(pcdir)/$${i}" >> $(kptch); \
echo "Architecture: $${arch}" >> $(kptch); \
echo "Kernel-version: $(version)" >> $(kptch); \
dh_installkpatches -p$(ppkg); \
done
dh_fixperms -p$(ppkg)
dh_installdocs -p$(ppkg)
dh_installchangelogs -p$(ppkg)
dh_compress -p$(ppkg)
dh_installdeb -p$(ppkg)
dh_gencontrol -p$(ppkg)
dh_md5sums -p$(ppkg)
dh_builddeb -p$(ppkg)
touch debian/patch-debian-stamp
#
# linux-doc package
#
dbdir := debian/build-doc
dbddir := $(dbdir)/debian
doc: debian/doc-stamp
debian/doc-stamp: debian/patch-stamp
dh_testdir
dh_testroot
# Create a build tree
mkdir -p $(dbdir)
cp -al $(source_files) $(dbdir)
mkdir -p $(dbddir)
cp debian/changelog $(dbddir)
cp debian/control $(dbddir)
cp debian/copyright $(dbddir)
touch $(dbddir)/official
cd $(dbdir) && make-kpkg --stem linux kernel-doc
cat $(dbddir)/files >> debian/files
mv debian/*.deb ..
touch debian/doc-stamp
unpack: debian/unpack-stamp
debian/unpack-stamp: debian/patch-stamp
dh_testdir
cd debian; \
for i in $(subarchs); do \
$(MAKE) subarch=$${i} unpack; \
done
ln -s $$(command -v touch) debian/bin/touch.orig
touch debian/unpack-stamp
$(MAKE) -f debian/rules.gen setup-$(DEB_HOST_ARCH)
touch $@
build: debian/control debian/build-stamp
debian/build-stamp: debian/unpack-stamp
debian/build-stamp: $(BUILD_DIR) $(STAMPS_DIR) debian/setup-stamp
dh_testdir
cd debian; \
for i in $(subarchs); do \
$(MAKE) subarch=$${i} build; \
done
touch debian/build-stamp
$(MAKE) -f debian/rules.gen build-$(DEB_HOST_ARCH)
touch $@
orig: ../orig/linux-$(major)-$(version)
rsync --delete --exclude debian --exclude .svn -av ../orig/linux-$(major)-$(version)/ .
$(BUILD_DIR) $(STAMPS_DIR):
@[ -d $@ ] || mkdir $@
../orig/linux-$(major)-$(version):
if [ -f "../linux-$(major)_$(version).orig.tar.gz" ]; then \
orig: ../orig/linux-$(MAJOR)-$(VERSION)
rsync --delete --exclude debian --exclude .svn -av ../orig/linux-$(MAJOR)-$(VERSION)/ .
../orig/linux-$(MAJOR)-$(VERSION):
if [ -f "../linux-$(MAJOR)_$(VERSION).orig.tar.gz" ]; then \
mkdir -p ../orig; \
tar -C ../orig -xzf ../linux-$(major)_$(version).orig.tar.gz; \
tar -C ../orig -xzf ../linux-$(MAJOR)_$(VERSION).orig.tar.gz; \
else \
echo "Can't find orig tarball." >&2; \
exit 1; \
@ -207,21 +41,17 @@ orig: ../orig/linux-$(major)-$(version)
clean: unpatch
dh_testdir
rm -f version.Debian
rm -rf linux-source-$(version)
cd debian; \
rm -f *-stamp-* *-stamp config.* *.kpatches.arch; \
rm -f header-install-* post-install-* bin/touch.orig; \
rm -rf linux-source-* build-* install-*
cd debian; rm -f *.kpatches.arch
rm -rf $(BUILD_DIR) $(STAMPS_DIR)
dh_clean
binary-indep: source tree patch-debian doc
binary-arch: build
binary-indep:
dh_testdir
cd debian; \
for i in $(subarchs); do \
$(MAKE) subarch=$${i} binary; \
done
$(MAKE) -f debian/Makefile.inc binary-$(DEB_BUILD_ARCH)
$(MAKE) -f debian/rules.gen binary-indep
binary-arch:
dh_testdir
$(MAKE) -f debian/rules.gen binary-arch-$(DEB_HOST_ARCH)
binary: binary-indep binary-arch
@ -229,7 +59,7 @@ binary: binary-indep binary-arch
# Makes the master debian/control file by substituting
# variable values into the template.
#
debian/control: debian/bin/gencontrol.py debian/changelog $(wildcard debian/templates/control.*.in)
debian/control debian/rules.gen: debian/bin/gencontrol.py debian/changelog $(wildcard debian/templates/control.*.in)
if [ -f debian/control.md5sum ]; then \
if md5sum $^ | diff - debian/control.md5sum > /dev/null; then true; else \
$(MAKE) -f debian/rules debian/control-real; \
@ -249,4 +79,4 @@ debian/control-real: debian/bin/gencontrol.py debian/changelog $(wildcard debian
@echo
exit 1
.PHONY: clean build unpack binary-indep binary-arch binary patch unpatch source tree
.PHONY: clean build setup binary-indep binary-arch binary patch unpatch source tree

4
debian/rules.defs vendored Normal file
View File

@ -0,0 +1,4 @@
BUILD_DIR = debian/build
STAMPS_DIR = debian/stamps
TEMPLATES_DIR = debian/templates

302
debian/rules.real vendored Normal file
View File

@ -0,0 +1,302 @@
#
# This Makefile executes the unpack/build/binary targets for a single
# subarch, which is passed in the subarch variable. Empty subarch
# variable means that we are building for an arch without the subarch.
# Additionally, variables version, abiname and ltver are
# expected to be available (need to be exported from the parent process).
# It is possible to override the flavours by setting the flavours
# variable. It will also be passed a list of source files
#
SHELL := sh -e
DEB_HOST_ARCH := $(shell dpkg-architecture -a$(ARCH) -qDEB_HOST_ARCH)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -a$(ARCH) -qDEB_HOST_GNU_TYPE)
DEB_BUILD_ARCH := $(shell dpkg-architecture -a$(ARCH) -qDEB_BUILD_ARCH)
#
# Build the list of common config files to be included
#
ifeq ($(SUBARCH),none)
basedir := debian/arch/$(ARCH)
append :=
else
basedir := debian/arch/$(ARCH)/$(SUBARCH)
append := $(SUBARCH)-
endif
configs := $(notdir $(wildcard $(basedir)/config.*))
configs := $(filter-out config, $(configs))
ifndef flavours
flavours := $(patsubst config.%,%,$(configs))
endif
-include $(basedir)/Makefile.inc
include debian/rules.defs
#
# Here we construct the command lines for different make-kpkg
# calls (build, linux-image, linux-headers) based on the values
# of variables defined so far and provided by the arch/subarch
# in Makefile.inc. @flavour@ in the expressions is going to be
# replaced by the flavour for which the command is run.
#
kpkg_header := HEADER_CLEAN_HOOK='$(CURDIR)/$(BUILD_DIR)/header-install-$(ARCH)-$(SUBARCH)'
kpkg_header += make-kpkg --append-to-version $(append)-$(ABINAME)
kpkg_header += --arch $(ARCH)
kpkg_header += --stem linux
kpkg_header += --config defconfig
kpkg_image := make-kpkg --append-to-version -$(ABINAME)-$(FLAVOUR)
kpkg_image += --arch $(ARCH)
kpkg_image += --stem linux
kpkg_image += --initrd
ifdef KPKG_SUBARCH
kpkg_image += --subarch $(KPKG_SUBARCH)
endif
ifdef headers_subarch
kpkg_header += --subarch $(headers_subarch)
endif
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
kpkg_image += --cross-compile=$(DEB_HOST_GNU_TYPE)
endif
setup_env := env -i
setup_env += HOME=$(HOME) LOGNAME=$(LOGNAME) PATH=$(PATH)
setup_env += DEBIAN_ABINAME=$(ABINAME) DEBIAN_FLAVOUR=$(FLAVOUR) DEBIAN_VERSION=$(VERSION)
ifdef build_makeflags
setup_env += MAKEFLAGS=$(build_makeflags)
endif
ifndef headers_dirs
headers_dirs = $(DEB_HOST_ARCH)
endif
ccommon = debian/arch/config debian/arch/$(ARCH)/config debian/arch/$(ARCH)/$(SUBARCH)/config
#
# Targets
#
binary-arch-subarch: install-header-$(ARCH)-$(SUBARCH)
binary-arch-flavour: install-image-$(ARCH)-$(SUBARCH)-$(FLAVOUR)
binary-indep: install-doc install-patch install-source install-tree
build: $(STAMPS_DIR)/build-$(ARCH)-$(SUBARCH)-$(FLAVOUR)
setup-arch: $(STAMPS_DIR)/source
setup-subarch: $(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH)
setup-flavour: $(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH)-$(FLAVOUR)
$(BUILD_DIR)/header-install-$(ARCH)-$(SUBARCH): $(TEMPLATES_DIR)/header-install.in
sed -e 's,@kbpkg@,$(kbpkg),g' \
-e 's,@ksource_dir@,$(CURDIR)/$(kdir),g' \
-e 's,@flavours@,$(flavours),g' \
-e 's,@headers_dirs@,$(headers_dirs),g' \
$< > $@
chmod u+x $@
#
# The way to make the correct package names is to make a
# subarch-specific post-install script...
#
ifdef extra_postinstall_command
extra_command := $(extra_postinstall_command)
else
extra_command := true
endif
$(BUILD_DIR)/post-install-$(ARCH)-$(SUBARCH): $(TEMPLATES_DIR)/post-install.in
sed -e 's,@initrd_modules@,$(initrd_modules),' \
-e 's,@append_subarch@,$(append),' \
-e 's,@extra_postinstall_command@,$(extra_command),' \
-e 's,@headers_dirs@,$(headers_dirs),g' \
$< > $@
#
# Generates the kernel config file for a subarch by merging
# the arch-independent config file (arch/config),
# arch-specific config file (arch/$(karch)/config),
# and subarch specific one (arch/$(karch)/$(subarch)/config).
# It is possible to avoid the inclusion of the arch-indep
# config file by setting include_common_config = no in the
# arch/$(karch)/Makefile.inc.
#
$(BUILD_DIR)/config.$(ARCH)-$(SUBARCH)-$(FLAVOUR): $(basedir)/config.$(FLAVOUR)
@echo "configs=$(configs)"
@echo "Generating configuration file $@:"
rm -f $@
for i in $(ccommon); do \
if [ -f $${i} ]; then \
cat $${i} >> $@; \
fi; \
done
# Flavour config file must be present
cat $(basedir)/config.$(FLAVOUR) >> $@
$(BUILD_DIR)/linux-source-$(VERSION).tar.bz2: SOURCE_DIR=$(BUILD_DIR)/source
$(BUILD_DIR)/linux-source-$(VERSION).tar.bz2: DIR = $(BUILD_DIR)/linux-source-$(VERSION)
$(BUILD_DIR)/linux-source-$(VERSION).tar.bz2: $(STAMPS_DIR)/source
rm -rf $@ $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
chmod -R u+rw,go=rX $(DIR)
cd $(BUILD_DIR); tar -cjf linux-source-$(VERSION).tar.bz2 linux-source-$(VERSION)
rm -rf $(DIR)
srcfiles := $(filter-out debian, $(wildcard *))
$(STAMPS_DIR)/source: DIR=$(BUILD_DIR)/source
$(STAMPS_DIR)/source: debian/bin/apply
rm -rf $(DIR)
mkdir -p $(DIR)
cp -al $(srcfiles) $(DIR)
cd $(DIR); override_version=$(SOURCE_VERSION) home=$(CURDIR)/debian/patches-debian $(CURDIR)/debian/bin/apply
#make-kpkg does this when building kernel-source.
mv $(DIR)/scripts/package/Makefile $(DIR)/scripts/package/Makefile.dist
mv $(DIR)/scripts/package/builddeb $(DIR)/scripts/package/builddeb.dist
echo "# Dummy Makefile" > $(DIR)/scripts/package/Makefile
echo "all:" >> $(DIR)/scripts/package/Makefile
touch $@
patches := $(wildcard debian/patches-arch/$(SUBARCH).*)
patches += $(wildcard debian/patches-arch/$(SUBARCH)_*)
patches += $(wildcard debian/patches-arch/$(ARCH).*)
patches += $(wildcard debian/patches-arch/$(ARCH)_*)
patches := $(strip $(patches))
$(STAMPS_DIR)/source-$(ARCH)-$(SUBARCH): SOURCE_DIR=$(BUILD_DIR)/source
$(STAMPS_DIR)/source-$(ARCH)-$(SUBARCH): DIR=$(BUILD_DIR)/source-$(ARCH)-$(SUBARCH)
$(STAMPS_DIR)/source-$(ARCH)-$(SUBARCH): $(BUILD_DIR)/post-install-$(ARCH)-$(SUBARCH) $(STAMPS_DIR)/source
rm -rf $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
mkdir -p $(DIR)/debian
cp debian/changelog $(DIR)/debian
cp debian/copyright $(DIR)/debian
cp debian/control $(DIR)/debian/control
touch $(DIR)/debian/official
if [ -n '$(patches)' ]; then \
cd $(DIR); \
cat $(addprefix $(CURDIR)/,$(patches)) | patch -p1; \
fi
install $< $(DIR)/debian/post-install
touch $@
#
# This target performs a build for a particular flavour. Note
# that in this file it should be always placed *before* the
# build-$(subarch)-% target, which creates the build directory.
#
$(STAMPS_DIR)/build-$(ARCH)-$(SUBARCH)-$(FLAVOUR): DIR=$(BUILD_DIR)/build-$(ARCH)-$(SUBARCH)-$(FLAVOUR)
$(STAMPS_DIR)/build-$(ARCH)-$(SUBARCH)-$(FLAVOUR): $(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH)-$(FLAVOUR)
ln -fs $$(command -v touch) debian/build/touch.orig
cd $(DIR); $(setup_env) PATH=$(CURDIR)/build:$(CURDIR)/bin:$(PATH) $(kpkg_image) build
ifdef image_postproc
cd $(DIR); $(image_postproc)
endif
touch $@
$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH)-$(FLAVOUR): SOURCE_DIR=$(BUILD_DIR)/source-$(ARCH)-$(SUBARCH)
$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH)-$(FLAVOUR): DIR=$(BUILD_DIR)/build-$(ARCH)-$(SUBARCH)-$(FLAVOUR)
$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH)-$(FLAVOUR): $(BUILD_DIR)/config.$(ARCH)-$(SUBARCH)-$(FLAVOUR) $(STAMPS_DIR)/source-$(ARCH)-$(SUBARCH)
rm -rf $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
cp $< $(DIR)/.config
cd $(DIR); $(setup_env) $(kpkg_image) configure
touch $@
$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH): SOURCE_DIR=$(BUILD_DIR)/source-$(ARCH)-$(SUBARCH)
$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH): DIR=$(BUILD_DIR)/build-$(ARCH)-$(SUBARCH)
$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH): $(STAMPS_DIR)/source-$(ARCH)-$(SUBARCH)
rm -rf $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
cd $(DIR); $(setup_env) $(kpkg_header) configure
touch $@
install-base:
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol -- $(GENCONTROL_ARGS)
dh_md5sums
dh_builddeb
install-doc: SOURCE_DIR=$(BUILD_DIR)/source
install-doc: DIR=$(BUILD_DIR)/$@
install-doc: $(STAMPS_DIR)/source
rm -rf $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
mkdir -p $(DIR)/debian
cp debian/changelog $(DIR)/debian
cp debian/copyright $(DIR)/debian
cp debian/control $(DIR)/debian/control
touch $(DIR)/debian/official
cd $(DIR) && $(setup_env) make-kpkg --stem linux kernel-doc
cat $(DIR)/debian/files >> debian/files
@for i in $$(awk '{ print $$1; }' $(DIR)/debian/files); do echo mv $(BUILD_DIR)/$$i ..; mv $(BUILD_DIR)/$$i ..; done
rm -rf $(DIR)
install-dummy:
dh_testdir
dh_testroot
dh_clean -d -k
dh_installchangelogs
dh_installdocs
$(MAKE) -f debian/rules.real install-base
install-image-$(ARCH)-$(SUBARCH)-$(FLAVOUR): SOURCE_DIR=$(BUILD_DIR)/build-$(ARCH)-$(SUBARCH)-$(FLAVOUR)
install-image-$(ARCH)-$(SUBARCH)-$(FLAVOUR): DIR=$(BUILD_DIR)/$@
install-image-$(ARCH)-$(SUBARCH)-$(FLAVOUR): $(STAMPS_DIR)/build-$(ARCH)-$(SUBARCH)-$(FLAVOUR)
rm -rf $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
cd $(DIR); $(setup_env) $(kpkg_image) kernel-image
cat $(DIR)/debian/files >> debian/files
@for i in $$(awk '{ print $$1; }' $(DIR)/debian/files); do echo mv $(BUILD_DIR)/$$i ..; mv $(BUILD_DIR)/$$i ..; done
rm -rf $(DIR)
install-header-$(ARCH)-$(SUBARCH): SOURCE_DIR=$(BUILD_DIR)/build-$(ARCH)-$(SUBARCH)
install-header-$(ARCH)-$(SUBARCH): DIR=$(BUILD_DIR)/$@
install-header-$(ARCH)-$(SUBARCH): $(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH) $(BUILD_DIR)/header-install-$(ARCH)-$(SUBARCH)
rm -rf $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
cd $(DIR); $(setup_env) $(kpkg_header) kernel-headers
cat $(DIR)/debian/files >> debian/files
@for i in $$(awk '{ print $$1; }' $(DIR)/debian/files); do echo mv $(BUILD_DIR)/$$i ..; mv $(BUILD_DIR)/$$i ..; done
rm -rf $(DIR)
install-patch: PACKAGE = linux-patch-debian-$(VERSION)
install-patch: pbase := /usr/src/kernel-patches/all/$(VERSION)
install-patch: pfull := debian/$(PACKAGE)$(pbase)
install-patch: ptchs := $(notdir $(wildcard debian/patches-arch/*))
install-patch: DH_OPTIONS = -p$(PACKAGE)
install-patch:
dh_testdir
dh_testroot
dh_clean -d -k $(DH_OPTIONS)
dh_installdirs $(DH_OPTIONS) $(pbase)/apply $(pbase)/debian $(pbase)/unpatch
dh_install $(DH_OPTIONS) debian/patches-debian/* $(pbase)/debian
# Install the debian patches
sed 's/@version@/$(release)/g' debian/bin/apply > $(pfull)/apply/debian
sed 's/@upstream@/$(version)/g' debian/bin/unpatch > $(pfull)/unpatch/debian
chmod 755 $(pfull)/apply/debian $(pfull)/unpatch/debian
chmod 644 $(pfull)/debian/*.patch
bzip2 -9 $(pfull)/debian/*.patch
# Now the arch/subarch-specific patches
for i in $(ptchs); do \
arch=$${i%%.*}; \
( \
echo "Patch-name: $${arch}"; \
echo "Patch-id: $${arch}_$(subst .,_,$(VERSION))"; \
echo "Path-strip-level: 1"; \
echo; \
echo "Patch-file: debian/patches-arch/$${i}"; \
echo "Architecture: $${arch}"; \
echo "Kernel-version: $(VERSION)"; \
echo; \
) > debian/$(PACKAGE).kpatches.arch; \
dh_installkpatches $(DH_OPTIONS); \
done
dh_installdocs $(DH_OPTIONS)
dh_installchangelogs $(DH_OPTIONS)
$(MAKE) -f debian/rules.real install-base DH_OPTIONS=$(DH_OPTIONS)
install-source: DH_OPTIONS = -plinux-source-$(VERSION)
install-source: $(BUILD_DIR)/linux-source-$(VERSION).tar.bz2
dh_testdir
dh_testroot
dh_install $(DH_OPTIONS) $< /usr/src
dh_installdocs $(DH_OPTIONS) README
dh_installchangelogs $(DH_OPTIONS)
$(MAKE) -f debian/rules.real install-base DH_OPTIONS=$(DH_OPTIONS)
install-tree: DH_OPTIONS = -plinux-tree-$(VERSION)
install-tree:
$(MAKE) -f debian/rules.real install-dummy DH_OPTIONS=$(DH_OPTIONS)

View File

@ -12,6 +12,6 @@ Description: Common architecture-specific header files for Linux kernel @version
flavour of the kernel you intend the build for. To obtain such a set for the
currently running kernel it is sufficient to run a command
.
apt-get install linux-headers-@version@-@abiname@-$(uname -r)
apt-get install linux-headers-$(uname -r)
.
and it will be unpacked in /usr/src/linux-headers-@version@-@abiname@-(flavour).

View File

@ -35,11 +35,10 @@ debhelper_post() {
# trailing dash, if it is non-empty.
#
append='@append_subarch@'
suffix=${version#*$debnum-}
prefix=${append}${version%%-*}${debnum}
pkg=linux-headers-$version
prefix=$DEBIAN_VERSION-$DEBIAN_ABINAME
pkg=linux-headers-$prefix-$DEBIAN_FLAVOUR
top=$PWD/debian/$pkg
dir=$top/usr/src/linux-headers-$version
dir=$top/usr/src/$pkg
#
# Here we need to find the kernel architecture which
# is appropriate for the current flavour. It is available
@ -59,6 +58,8 @@ debhelper_pre $pkg
# Stuff below is ugly as hell, but does the trick so I'm not
# touching it until we can invent something better.
#
mkdir -p $dir/arch/$arch/kernel
mkdir -p $dir/include/asm-$arch
mkdir -p $dir/include/linux
cp -a .config $dir
echo $debnum-$suffix > $dir/.extraversion
@ -66,41 +67,49 @@ cp -a Module.symvers $dir
find . -mindepth 1 -maxdepth 1 \
! -name debian -a ! -name Documentation -a ! -name include -a \
! -name DEBIAN -a ! -name scripts -a ! -name '.*' -a \( \
! -name DEBIAN -a ! -name scripts -a ! -name arch -a ! -name '.*' -a \( \
-name Makefile -o -type d \) \
-printf "../linux-headers-$prefix/%f\n" |
xargs ln -s --target-directory="$dir"
cd include
find . -mindepth 1 -maxdepth 1 \
! -name config -a ! -name linux -a \( \
! -name 'asm-*' -o -name asm-generic -o -name asm-${arch} \) \
-printf "../../linux-headers-$prefix/include/%f\n" |
find arch/$arch -mindepth 1 -maxdepth 1 \( \
-type d -a ! -name kernel -o \
-type f -a \( -name 'Makefile*' -o -name 'Kconfig*' \) \) \
-printf "../../../linux-headers-$prefix/%p\n" |
xargs ln -s --target-directory=$dir/arch/$arch
[ -f arch/$arch/kernel/asm-offsets.s ] && ln -f arch/$arch/kernel/asm-offsets.s $dir/arch/$arch/kernel
ln -s ../../../../linux-headers-$prefix/arch/$arch/kernel/Makefile $dir/arch/$arch/kernel
find include -mindepth 1 -maxdepth 1 \
! -name config -a ! -name linux -a ! -name 'asm-*' \
-printf "../../linux-headers-$prefix/%p\n" |
xargs ln -s --target-directory=$dir/include
cp -a config $dir/include
cp -a include/config $dir/include
ln -sf asm-${arch} $dir/include/asm
# Link in the additional header directories,
# specified in header_dirs
for i in asm-*
find include/asm-$arch -mindepth 1 -maxdepth 1 \
\( -type f -a ! -links 2 -o ! -type f \) \
-printf "../../../linux-headers-$prefix/%p\n" |
xargs ln -s --target-directory=$dir/include/asm-$arch
find include/asm-$arch -mindepth 1 -maxdepth 1 \
-type f -links 2 |
xargs ln -f --target-directory=$dir/include/asm-$arch
for i in include/asm-*
do
case ${i#asm-} in
generic | @headers_dirs@)
if [ ! -L $dir/include/${i} ]; then
ln -sf ../../linux-headers-$prefix/include/${i} $dir/include/${i}
fi
;;
*)
;;
case ${i#include/asm-} in
$arch)
;;
generic | @headers_dirs@)
ln -s ../../linux-headers-$prefix/$i $dir/$i
;;
*)
;;
esac
done
find linux -mindepth 1 -maxdepth 1 \
find include/linux -mindepth 1 -maxdepth 1 \
! -name autoconf.h -a ! -name compile.h -a ! -name version.h \
-printf "../../../linux-headers-$prefix/include/linux/%f\n" |
-printf "../../../linux-headers-$prefix/%p\n" |
xargs ln -s --target-directory=$dir/include/linux
cp -a linux/autoconf.h linux/compile.h \
linux/version.h $dir/include/linux
cd ..
cp -a include/linux/autoconf.h include/linux/compile.h \
include/linux/version.h $dir/include/linux
mkdir -p $top/lib/modules/$version
ln -s /usr/src/linux-headers-$version $top/lib/modules/$version/build