diff mbox

[1/2] UBUNTU: perf -- build the kernel carried tools

Message ID 1267709705-30716-2-git-send-email-apw@canonical.com
State Accepted
Delegated to: Andy Whitcroft
Headers show

Commit Message

Andy Whitcroft March 4, 2010, 1:35 p.m. UTC
The kernel source now carries the source for tools which are very closly
tied to the kernel version, initially the perf tool.  These tools are
included because they are tightly tied to the kernel internal ABIs.

Build these tools as part of the kernel build process and package them
up with the binary kernel packages.  As we can have more than one
version of the kernel available and because you need to use the version
which matches the version of the kernel that you are booted from,
install them using the kernel version number and flavour:

	/usr/bin/perf-2.6.32-15-generic

Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 debian.master/control.d/flavour-control.stub |    2 +-
 debian.master/control.stub.in                |    2 +-
 debian/rules.d/0-common-vars.mk              |    6 ++++++
 debian/rules.d/1-maintainer.mk               |    1 +
 debian/rules.d/2-binary-arch.mk              |   17 +++++++++++++++++
 5 files changed, 26 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/debian.master/control.d/flavour-control.stub b/debian.master/control.d/flavour-control.stub
index 0c5b924..ebd57c6 100644
--- a/debian.master/control.d/flavour-control.stub
+++ b/debian.master/control.d/flavour-control.stub
@@ -27,7 +27,7 @@  Section: admin
 Priority: optional
 Pre-Depends: dpkg (>= 1.10.24)
 Provides: linux-image, linux-image-2.6, fuse-module, =PROVIDES=
-Depends: ${misc:Depends}, initramfs-tools (>= 0.36ubuntu6), coreutils | fileutils (>= 4.0), module-init-tools (>= 3.3-pre11-4ubuntu3), wireless-crda
+Depends: ${misc:Depends}, ${shlibs:Depends}, initramfs-tools (>= 0.36ubuntu6), coreutils | fileutils (>= 4.0), module-init-tools (>= 3.3-pre11-4ubuntu3), wireless-crda
 Conflicts: hotplug (<< 0.0.20040105-1)
 Recommends: BOOTLOADER
 Suggests: fdutils, SRCPKGNAME-doc-PKGVER | SRCPKGNAME-source-PKGVER
diff --git a/debian.master/control.stub.in b/debian.master/control.stub.in
index bcc1c66..c6a8404 100644
--- a/debian.master/control.stub.in
+++ b/debian.master/control.stub.in
@@ -3,7 +3,7 @@  Section: devel
 Priority: optional
 Maintainer: Ubuntu Kernel Team <kernel-team@lists.ubuntu.com>
 Standards-Version: 3.8.4.0
-Build-Depends: debhelper (>= 5), cpio, module-init-tools, kernel-wedge (>= 2.24ubuntu1), makedumpfile [amd64 i386 lpia], device-tree-compiler [powerpc]
+Build-Depends: debhelper (>= 5), cpio, module-init-tools, kernel-wedge (>= 2.24ubuntu1), makedumpfile [amd64 i386 lpia], device-tree-compiler [powerpc], libelf-dev, binutils-dev
 Build-Depends-Indep: xmlto, docbook-utils, ghostscript, transfig, bzip2, sharutils
 Build-Conflicts: findutils (= 4.4.1-1ubuntu1)
 Vcs-Git: http://kernel.ubuntu.com/git-repos/ubuntu/ubuntu-lucid.git
diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index de33105..335879f 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -119,6 +119,12 @@  do_common_headers_indep=true
 # add a 'full source' mode
 do_full_source=false
 
+# build tools
+do_tools=false
+ifneq ($(wildcard $(CURDIR)/tools),)
+do_tools=true
+endif
+
 # Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
 #
 # These 2 environment variables set the -j value of the kernel build. For example,
diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index ff25d1d..ea8e158 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -99,6 +99,7 @@  endif
 	@echo "do_libc_dev_package       = $(do_libc_dev_package)"
 	@echo "do_common_headers_indep   = $(do_common_headers_indep)"
 	@echo "do_full_source            = $(do_full_source)"
+	@echo "do_tools                  = $(do_tools)"
 
 printchanges:
 	@baseCommit=$$(git log --pretty=format:'%H %s' | \
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 200a746..9d36928 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -24,6 +24,12 @@  $(stampdir)/stamp-prepare-tree-%: $(commonconfdir)/config.common.$(family) $(arc
 	cat $^ | sed -e 's/.*CONFIG_VERSION_SIGNATURE.*/CONFIG_VERSION_SIGNATURE="Ubuntu $(release)-$(revision)-$*"/' > $(builddir)/build-$*/.config
 	find $(builddir)/build-$* -name "*.ko" | xargs rm -f
 	$(build_cd) $(kmake) $(build_O) silentoldconfig prepare scripts
+ifeq ($(do_tools),true)
+	install -d $(builddir)/tools-$*
+	for i in *; do ln -s $(CURDIR)/$$i $(builddir)/tools-$*/; done
+	rm $(builddir)/tools-$*/tools
+	rsync -a tools/ $(builddir)/tools-$*/tools/
+endif
 	touch $@
 
 
@@ -35,6 +41,9 @@  $(stampdir)/stamp-build-%: prepare-%
 	@echo "Building $*..."
 	$(build_cd) $(kmake) $(build_O) $(conc_level) $(build_image)
 	$(build_cd) $(kmake) $(build_O) $(conc_level) modules
+ifeq ($(do_tools),true)
+	cd $(builddir)/tools-$*/tools/perf && make
+endif
 	@touch $@
 
 # Install the finished build
@@ -93,6 +102,13 @@  endif
 		$(pkgdir)/lib/modules/$(abi_release)-$*/initrd/; \
 	fi
 
+	# Add the tools.
+ifeq ($(do_tools),true)
+	install -d $(pkgdir)/usr/bin
+	install -s -m755 $(builddir)/tools-$*/tools/perf/perf \
+		$(pkgdir)/usr/bin/perf_$(abi_release)-$*
+endif
+
 	# Now the image scripts
 	install -d $(pkgdir)/DEBIAN
 	for script in postinst postrm preinst prerm; do				\
@@ -258,6 +274,7 @@  binary-%: install-%
 	dh_compress -p$(pkgimg)
 	dh_fixperms -p$(pkgimg)
 	dh_installdeb -p$(pkgimg)
+	dh_shlibdeps -p$(pkgimg)
 	dh_gencontrol -p$(pkgimg)
 	dh_md5sums -p$(pkgimg)
 	dh_builddeb -p$(pkgimg) -- -Zbzip2 -z9