Move module tools to separate deb, add armhf support

- Move module building tools to linux-kbuild package: linux-headers
depend on this. Basically the same way how Debian handles these tools.
- Add "fake" armhf support: The kernel image is still an ARM64 binary
inside, but the userspace tools are armhf. This'll allow using a 64-bit
kernel with 32-bit userspace, without resorting to funny multiarch

Change-Id: Idbfebdcd845e65c00b45076c2b7e85048f2af534
diff --git a/debian/control b/debian/control
index f68c316..cba36bb 100644
--- a/debian/control
+++ b/debian/control
@@ -1,19 +1,26 @@
 Source: linux-imx
 Maintainer: AIY Projects <>
-Build-Depends: bc, cpio, debhelper, libssl-dev, python
+Build-Depends: bc, cpio, debhelper, gcc-aarch64-linux-gnu, libssl-dev, python
 Section: misc
 Priority: optional
 Package: linux-image-4.9.51-aiy
 Section: misc
 Priority: required
-Architecture: arm64
+Architecture: arm64 armhf
 Depends: kmod, ${perl:Depends}
-Description: Miscellaneous tools to support the AIY Board
+Description: Linux kernel image for the AIY Board
 Package: linux-headers-4.9.51-aiy
 Section: misc
 Priority: required
-Architecture: arm64
-Depends: ${perl:Depends}
-Description: Miscellaneous tools to support the AIY Board
+Architecture: arm64 armhf
+Depends: ${perl:Depends},
+         linux-kbuild-4.9.51-aiy [${Arch}]
+Description: Linux kernel headers fro the AIY Board
+Package: linux-kbuild-4.9.51-aiy
+Section: misc
+Priority: required
+Architecture: arm64 armhf
+Description: Linux kernel build tools for the AIY Board
diff --git a/debian/rules b/debian/rules
index ba7ba80..2c5bc3d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -19,6 +19,7 @@
 BUILD_DIR := $(CURDIR)/debian/build
 DESTDIR := $(CURDIR)/debian/linux-image-$(VERSION)
 DESTDIR_HEADERS := $(CURDIR)/debian/linux-headers-$(VERSION)
+DESTDIR_KBUILD := $(CURDIR)/debian/linux-kbuild-$(VERSION)
 	dh $@
@@ -71,15 +72,16 @@
 	find $(CURDIR)/scripts -type f | xargs file | grep 'x86-' | awk '{print $$1}' | tr -d ':' | xargs rm -f
 	mkdir -p $(BUILD_DIR)/build-tools/scripts
 		-C $(BUILD_DIR)/build-tools/scripts -f $(CURDIR)/debian/rules.d/scripts/Makefile \
 		top_rulesdir=$(CURDIR)/debian/rules.d \
 		top_srcdir=$(CURDIR) \
 		OUTDIR=scripts \
 		install \
-		prefix=/usr/src/linux-headers-$(VERSION)
-	find $(BUILD_DIR)/build-tools
+		prefix=/usr/lib/linux-kbuild-$(VERSION)
 	# Setup the symlink from the modules directory to the headers
 	install -d $(DESTDIR_HEADERS)/lib/modules/$(VERSION)
 	ln -s /usr/src/linux-headers-$(VERSION) $(DESTDIR_HEADERS)/lib/modules/$(VERSION)/build
+	ln -s /usr/lib/linux-kbuild-$(VERSION)/scripts $(DESTDIR_HEADERS)/usr/src/linux-headers-$(VERSION)/scripts