diff mbox

[1/2] UBUNTU: add support for generating binary device trees and install them in /lib/firmware

Message ID 1343666528-6505-2-git-send-email-apw@canonical.com
State New
Headers show

Commit Message

Andy Whitcroft July 30, 2012, 4:42 p.m. UTC
Add support for generating a device tree binary for this flavour and
installing it in /lib/firmware.  This is useful for QEMU for some flavours
and likely will be useful later for systems which need to include a device
tree when flashing the kernel (this is the overall vision for device tree
with generic ARM kernels).

Adds flavour specific configuration for the name of the dtb_file.
Currently this only supports one dtb file per flavour but it is possible
there could be more than one when flavours can support more than one SOC,
so futureproof by including the hardware name in the dtb path.

Based on a patch by Dann Frazier.

BugLink: http://bugs.launchpad.net/bugs/1030600
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 debian/rules.d/2-binary-arch.mk |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 75caf91..b665191 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -33,9 +33,10 @@  build-%: $(stampdir)/stamp-build-%
 
 # Do the actual build, including image and modules
 $(stampdir)/stamp-build-%: target_flavour = $*
+$(stampdir)/stamp-build-%: dtb_target = $(notdir $(dtb_file_$*))
 $(stampdir)/stamp-build-%: $(stampdir)/stamp-prepare-%
 	@echo "Building $*..."
-	$(build_cd) $(kmake) $(build_O) $(conc_level) $(build_image) modules
+	$(build_cd) $(kmake) $(build_O) $(conc_level) $(build_image) modules $(dtb_target)
 	@touch $@
 
 # Install the finished build
@@ -46,6 +47,8 @@  install-%: dbgpkgdir = $(CURDIR)/debian/$(bin_pkg_name)-$*-dbgsym
 install-%: basepkg = $(hdrs_pkg_name)
 install-%: hdrdir = $(CURDIR)/debian/$(basepkg)-$*/usr/src/$(basepkg)-$*
 install-%: target_flavour = $*
+install-%: dtb_file=$(dtb_file_$*)
+install-%: dtb_target=$(notdir $(dtb_file_$*))
 install-%: checks-%
 	dh_testdir
 	dh_testroot
@@ -72,6 +75,11 @@  endif
 		$(pkgdir)/boot/abi-$(abi_release)-$*
 	install -m600 $(builddir)/build-$*/System.map \
 		$(pkgdir)/boot/System.map-$(abi_release)-$*
+	if [ "$(dtb_target)" ]; then \
+		install -d $(pkgdir)/lib/firmware/$(abi_release)-$*/device-tree; \
+		install -m644 $(builddir)/build-$*/$(dtb_file) \
+			$(pkgdir)/lib/firmware/$(abi_release)-$*/device-tree/$(dtb_target); \
+	fi
 ifeq ($(no_dumpfile),)
 	makedumpfile -g $(pkgdir)/boot/vmcoreinfo-$(abi_release)-$* \
 		-x $(builddir)/build-$*/vmlinux