Linux 4.14.98 packaging

Change-Id: I49e82feab94c941debd2d09b50c060d52aeea074
diff --git a/debian/control b/debian/control
index e369697..923244a 100644
--- a/debian/control
+++ b/debian/control
@@ -4,36 +4,37 @@
                cpio,
                debhelper (>=10),
                gcc-aarch64-linux-gnu,
+               kmod,
                libssl-dev,
                python
 Section: misc
 Priority: optional
 Standards-Version: 3.9.8
 
-Package: linux-image-4.9.51-imx
+Package: linux-image-4.14.98-imx
 Section: misc
 Priority: optional
 Architecture: arm64 armhf
 Provides: linux-image
-Depends: kmod, ${misc:Depends}
+Depends: kmod, imx-firmware (>=3-2), ${misc:Depends}
 Description: Linux kernel image for the Coral EdgeTPU Dev Board
  Linux Image, modules, System map, config, and device tree blobs for
  the Edge TPU Dev board.
 
-Package: linux-headers-4.9.51-imx
+Package: linux-headers-4.14.98-imx
 Section: misc
 Priority: optional
 Architecture: arm64 armhf
 Provides: linux-headers
 Depends: ${misc:Depends},
-         linux-kbuild-4.9.51-imx [${Arch}]
+         linux-kbuild-4.14.98-imx [${Arch}]
 Description: Linux kernel headers fro the Coral EdgeTPU Dev Board
- Kernel and userspace headers for the 4.9.51-imx Linux kernel.
+ Kernel and userspace headers for the 4.14.98-imx Linux kernel.
 
-Package: linux-kbuild-4.9.51-imx
+Package: linux-kbuild-4.14.98-imx
 Section: misc
 Priority: optional
 Architecture: arm64 armhf
 Depends: ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends}
 Description: Linux kernel build tools for the Coral EdgeTPU Dev Board
- Support tools for building modules against the 4.9.51-imx Linux kernel.
+ Support tools for building modules against the 4.14.98-imx Linux kernel.
diff --git a/debian/defconfig b/debian/defconfig
index 0233b19..b3e7e96 100644
--- a/debian/defconfig
+++ b/debian/defconfig
@@ -12,36 +12,6 @@
 CONFIG_WLAN=y
 CONFIG_ATH10K=n
 
-# QCACLD-2.0
-CONFIG_CFG80211_INTERNAL_REGDB=y
-CONFIG_CFG80211_WEXT=y
-CONFIG_WIRELESS=y
-CONFIG_WIRELESS_EXT=y
-CONFIG_WEXT_CORE=y
-CONFIG_WEXT_PROC=y
-CONFIG_WEXT_PRIV=y
-CONFIG_WEXT_SPY=y
-CONFIG_QCA_CLD_WLAN=y
-# CONFIG_CLD_HL_SDIO_CORE is not set
-CONFIG_QCACLD_WLAN_LFR3=y
-CONFIG_PRIMA_WLAN_OKC=y
-CONFIG_PRIMA_WLAN_11AC_HIGH_TP=y
-CONFIG_WLAN_FEATURE_11W=y
-CONFIG_WLAN_FEATURE_LPSS=y
-CONFIG_QCOM_VOWIFI_11R=y
-CONFIG_WLAN_FEATURE_NAN=y
-CONFIG_WLAN_FEATURE_NAN_DATAPATH=y
-CONFIG_QCOM_TDLS=y
-CONFIG_QCOM_LTE_COEX=y
-CONFIG_WLAN_OFFLOAD_PACKETS=y
-CONFIG_WLAN_FEATURE_MEMDUMP=y
-CONFIG_WLAN_SYNC_TSF=y
-# CONFIG_QCA_WIFI_AUTOMOTIVE_CONC is not set
-# CONFIG_WLAN_UDP_RESPONSE_OFFLOAD is not set
-# CONFIG_WLAN_WOW_PULSE is not set
-# CONFIG_DPTRACE_ENABLE is not set
-CONFIG_RFKILL=y
-
 CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_SND_SOC_FSL_ASOC_CARD=n
diff --git a/debian/linux-headers-4.9.51-imx.postinst b/debian/linux-headers-4.14.98-imx.postinst
similarity index 94%
rename from debian/linux-headers-4.9.51-imx.postinst
rename to debian/linux-headers-4.14.98-imx.postinst
index 73484c7..feff4ef 100644
--- a/debian/linux-headers-4.9.51-imx.postinst
+++ b/debian/linux-headers-4.14.98-imx.postinst
@@ -5,7 +5,7 @@
 #         Debian linux-image postinst script.
 
 $|=1;
-my $version  = "4.9.51-imx";
+my $version  = "4.14.98-imx";
 
 if (-d "/etc/kernel/header_postinst.d") {
   system ("run-parts --report --exit-on-error --arg=$version " .
diff --git a/debian/linux-image-4.9.51-imx.postinst b/debian/linux-image-4.14.98-imx.postinst
similarity index 95%
rename from debian/linux-image-4.9.51-imx.postinst
rename to debian/linux-image-4.14.98-imx.postinst
index 9d4ebff..7ef4c99 100644
--- a/debian/linux-image-4.9.51-imx.postinst
+++ b/debian/linux-image-4.14.98-imx.postinst
@@ -1,6 +1,6 @@
 #!/bin/sh -e
 
-version=4.9.51-imx
+version=4.14.98-imx
 image_path=/boot/vmlinuz-$version
 
 if [ "$1" != configure ]; then
diff --git a/debian/linux-image-4.9.51-imx.postrm b/debian/linux-image-4.14.98-imx.postrm
similarity index 97%
rename from debian/linux-image-4.9.51-imx.postrm
rename to debian/linux-image-4.14.98-imx.postrm
index db36631..66553d7 100644
--- a/debian/linux-image-4.9.51-imx.postrm
+++ b/debian/linux-image-4.14.98-imx.postrm
@@ -1,6 +1,6 @@
 #!/bin/sh -e
 
-version=4.9.51-imx
+version=4.14.98-imx
 image_path=/boot/vmlinuz-$version
 
 rm -f /lib/modules/$version/.fresh-install
diff --git a/debian/linux-image-4.9.51-imx.preinst b/debian/linux-image-4.14.98-imx.preinst
similarity index 95%
rename from debian/linux-image-4.9.51-imx.preinst
rename to debian/linux-image-4.14.98-imx.preinst
index d4f59f6..8d2bbf8 100644
--- a/debian/linux-image-4.9.51-imx.preinst
+++ b/debian/linux-image-4.14.98-imx.preinst
@@ -1,6 +1,6 @@
 #!/bin/sh -e
 
-version=4.9.51-imx
+version=4.14.98-imx
 image_path=/boot/vmlinuz-$version
 
 if [ "$1" = abort-upgrade ]; then
diff --git a/debian/linux-image-4.9.51-imx.prerm b/debian/linux-image-4.14.98-imx.prerm
similarity index 93%
rename from debian/linux-image-4.9.51-imx.prerm
rename to debian/linux-image-4.14.98-imx.prerm
index 54cd794..69cda74 100644
--- a/debian/linux-image-4.9.51-imx.prerm
+++ b/debian/linux-image-4.14.98-imx.prerm
@@ -1,6 +1,6 @@
 #!/bin/sh -e
 
-version=4.9.51-imx
+version=4.14.98-imx
 image_path=/boot/vmlinuz-$version
 
 if [ "$1" != remove ]; then
diff --git a/debian/linux-kbuild-4.14.98-imx.lintian-overrides b/debian/linux-kbuild-4.14.98-imx.lintian-overrides
new file mode 100644
index 0000000..813c9d2
--- /dev/null
+++ b/debian/linux-kbuild-4.14.98-imx.lintian-overrides
@@ -0,0 +1 @@
+linux-kbuild-4.14.98-imx: wrong-path-for-interpreter usr/lib/linux-kbuild-4.14.98-imx/scripts/ver_linux (#!/bin/awk != /usr/bin/awk)
diff --git a/debian/linux-kbuild-4.9.51-imx.lintian-overrides b/debian/linux-kbuild-4.9.51-imx.lintian-overrides
deleted file mode 100644
index 29727c2..0000000
--- a/debian/linux-kbuild-4.9.51-imx.lintian-overrides
+++ /dev/null
@@ -1 +0,0 @@
-linux-kbuild-4.9.51-imx: wrong-path-for-interpreter usr/lib/linux-kbuild-4.9.51-imx/scripts/ver_linux (#!/bin/awk != /usr/bin/awk)
diff --git a/debian/rules b/debian/rules
index 2779b26..560f314 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,7 +4,7 @@
 # Uncomment this to turn on verbose mode.
 # export DH_VERBOSE=1
 
-VERSION := 4.9.51-imx
+VERSION := 4.14.98-imx
 
 ARCH := arm64
 
@@ -38,8 +38,8 @@
 
 override_dh_auto_install:
 	+make $(KERNEL_OPTIONS) INSTALL_MOD_PATH=$(DESTDIR) modules_install
-	rm $(DESTDIR)/lib/modules/$(VERSION)/build
-	rm $(DESTDIR)/lib/modules/$(VERSION)/source
+	rm -f $(DESTDIR)/lib/modules/$(VERSION)/build
+	rm -f $(DESTDIR)/lib/modules/$(VERSION)/source
 
 	# Setup contents of /boot
 	install -d $(DESTDIR)/boot
@@ -83,6 +83,8 @@
 		install \
 		DESTDIR=$(DESTDIR_KBUILD) \
 		prefix=/usr/lib/linux-kbuild-$(VERSION)
+	# mkdir -p $(DESTDIR_KBUILD)/usr/lib/linux-kbuild-$(VERSION)
+	# touch $(DESTDIR_KBUILD)/usr/lib/linux-kbuild-$(VERSION)/hello
 
 	# Setup the symlink from the modules directory to the headers
 	install -d $(DESTDIR_HEADERS)/lib/modules/$(VERSION)
diff --git a/debian/rules.d/Makefile b/debian/rules.d/Makefile
new file mode 100644
index 0000000..c7506d3
--- /dev/null
+++ b/debian/rules.d/Makefile
@@ -0,0 +1,17 @@
+DATA = \
+	Kbuild \
+	Makefile \
+
+SUBDIRS = \
+	scripts \
+	tools
+
+include $(top_rulesdir)/Makefile.inc
+
+# Build userland headers first
+unexport VERSION
+all-local:
+	mkdir -p headers-tools
+	$(MAKE) -C $(top_srcdir) ARCH=$(KERNEL_ARCH) O=$(CURDIR)/headers-tools \
+		INSTALL_HDR_PATH=$(CURDIR) headers_install
+all-recursive: all-local
diff --git a/debian/rules.d/scripts/Makefile b/debian/rules.d/scripts/Makefile
index fc8c681..41a642b 100644
--- a/debian/rules.d/scripts/Makefile
+++ b/debian/rules.d/scripts/Makefile
@@ -22,6 +22,7 @@
 	gen_initramfs_list.sh \
 	headers_install.sh \
 	kernel-doc \
+	ld-version.sh \
 	Lindent \
 	makelst \
 	mksysmap \
diff --git a/debian/rules.d/scripts/genksyms/Makefile b/debian/rules.d/scripts/genksyms/Makefile
index 8e416da..2d803c5 100644
--- a/debian/rules.d/scripts/genksyms/Makefile
+++ b/debian/rules.d/scripts/genksyms/Makefile
@@ -4,7 +4,7 @@
 
 genksyms: genksyms.o parse.tab.o lex.lex.o
 
-lex.lex.o: keywords.hash.c parse.tab.h
+lex.lex.o: keywords.c parse.tab.h
 
 %.c: %.c_shipped
 	ln -s $< $@
diff --git a/debian/rules.d/scripts/kconfig/Makefile b/debian/rules.d/scripts/kconfig/Makefile
index b6e2521..01b6367 100644
--- a/debian/rules.d/scripts/kconfig/Makefile
+++ b/debian/rules.d/scripts/kconfig/Makefile
@@ -4,7 +4,7 @@
 
 conf: conf.o zconf.tab.o
 
-zconf.tab.c: zconf.hash.c zconf.lex.c
+zconf.tab.c: kconf_id.c zconf.lex.c
 
 %.c: %.c_shipped
 	ln -sf $< $@
diff --git a/debian/rules.d/scripts/mod/Makefile.real b/debian/rules.d/scripts/mod/Makefile.real
index 489ea4f..8b097f8 100644
--- a/debian/rules.d/scripts/mod/Makefile.real
+++ b/debian/rules.d/scripts/mod/Makefile.real
@@ -17,7 +17,7 @@
 
 real-$(TYPE)/devicetable-offsets.h: real-$(TYPE)/devicetable-offsets.s
 	echo >$@ "#define __DEVICEVTABLE_OFFSETS_H__"
-	sed -ne "/^->/{s:->#\(.*\):/* \1 */:; \
-		s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
-		s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
-		s:->::; p;}" $< >>$@
+	sed -ne "s:^[[:space:]]*\.ascii[[:space:]]*\"\(.*\)\".*:\1:; \
+		 /^->/{s:->#\(.*\):/* \1 */:; \
+		 s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
+		 s:->::; p;}" $< >>$@
diff --git a/debian/rules.d/tools/Makefile b/debian/rules.d/tools/Makefile
new file mode 100644
index 0000000..3c7dba3
--- /dev/null
+++ b/debian/rules.d/tools/Makefile
@@ -0,0 +1,9 @@
+SUBDIRS = \
+	hv \
+	lib/lockdep \
+	objtool \
+	perf \
+	power \
+	usb/usbip
+
+include $(top_rulesdir)/Makefile.inc
diff --git a/debian/rules.d/tools/hv/Makefile b/debian/rules.d/tools/hv/Makefile
new file mode 100644
index 0000000..3393517
--- /dev/null
+++ b/debian/rules.d/tools/hv/Makefile
@@ -0,0 +1,22 @@
+ifeq ($(filter i386 amd64 x32,$(DEB_HOST_ARCH)),)
+
+# Build nothing
+include $(top_rulesdir)/Makefile.inc
+
+else
+
+PROGS = \
+	hv_fcopy_daemon \
+	hv_kvp_daemon \
+	hv_vss_daemon
+
+installdir = /usr/sbin
+
+include $(top_rulesdir)/Makefile.inc
+
+# Handle check-hyperv separately since it's installed in a different directory
+all-local: check-hyperv
+install-local:
+	install -D -m755 check-hyperv '$(DESTDIR)/lib/hyperv-daemons/check-hyperv'
+
+endif
diff --git a/debian/rules.d/tools/hv/check-hyperv.c b/debian/rules.d/tools/hv/check-hyperv.c
new file mode 100644
index 0000000..4d2b6f5
--- /dev/null
+++ b/debian/rules.d/tools/hv/check-hyperv.c
@@ -0,0 +1,103 @@
+/*
+ * This program is derived from systemd.
+ *
+ * Copyright 2011 Lennart Poettering
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <string.h>
+
+#define streq(a, b) (!strcmp(a, b))
+#define ELEMENTSOF(a) (sizeof(a) / sizeof((a)[0]))
+
+enum {
+	VIRTUALIZATION_NONE,
+	VIRTUALIZATION_VM_OTHER,
+	VIRTUALIZATION_MICROSOFT,
+};
+
+static int detect_vm_cpuid(void) {
+
+        static const struct {
+                const char *cpuid;
+                int id;
+        } cpuid_vendor_table[] = {
+                /* http://msdn.microsoft.com/en-us/library/ff542428.aspx */
+                { "Microsoft Hv", VIRTUALIZATION_MICROSOFT },
+        };
+
+        uint32_t eax, ecx;
+        bool hypervisor;
+
+        /* http://lwn.net/Articles/301888/ */
+
+#if defined (__i386__)
+#define REG_a "eax"
+#define REG_b "ebx"
+#elif defined (__amd64__)
+#define REG_a "rax"
+#define REG_b "rbx"
+#endif
+
+        /* First detect whether there is a hypervisor */
+        eax = 1;
+        __asm__ __volatile__ (
+                /* ebx/rbx is being used for PIC! */
+                "  push %%"REG_b"         \n\t"
+                "  cpuid                  \n\t"
+                "  pop %%"REG_b"          \n\t"
+
+                : "=a" (eax), "=c" (ecx)
+                : "0" (eax)
+        );
+
+        hypervisor = !!(ecx & 0x80000000U);
+
+        if (hypervisor) {
+                union {
+                        uint32_t sig32[3];
+                        char text[13];
+                } sig = {};
+                unsigned j;
+
+                /* There is a hypervisor, see what it is */
+                eax = 0x40000000U;
+                __asm__ __volatile__ (
+                        /* ebx/rbx is being used for PIC! */
+                        "  push %%"REG_b"         \n\t"
+                        "  cpuid                  \n\t"
+                        "  mov %%ebx, %1          \n\t"
+                        "  pop %%"REG_b"          \n\t"
+
+                        : "=a" (eax), "=r" (sig.sig32[0]), "=c" (sig.sig32[1]), "=d" (sig.sig32[2])
+                        : "0" (eax)
+                );
+
+                for (j = 0; j < ELEMENTSOF(cpuid_vendor_table); j ++)
+                        if (streq(sig.text, cpuid_vendor_table[j].cpuid))
+                                return cpuid_vendor_table[j].id;
+
+                return VIRTUALIZATION_VM_OTHER;
+        }
+
+        return VIRTUALIZATION_NONE;
+}
+
+int main(void)
+{
+	return detect_vm_cpuid() != VIRTUALIZATION_MICROSOFT;
+}
diff --git a/debian/rules.d/tools/lib/lockdep/Makefile b/debian/rules.d/tools/lib/lockdep/Makefile
new file mode 100644
index 0000000..4740908
--- /dev/null
+++ b/debian/rules.d/tools/lib/lockdep/Makefile
@@ -0,0 +1,23 @@
+include $(top_rulesdir)/Makefile.inc
+
+DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+
+# Catch use of missing kernel APIs early
+CFLAGS += -Werror=implicit-function-declaration
+
+MAKE_LOCKDEP := +$(MAKE) -C $(top_srcdir)/$(OUTDIR) O=$(CURDIR) V=1 \
+	prefix=/usr libdir_relative=lib/$(DEB_HOST_MULTIARCH) \
+	LIBLOCKDEP_VERSION=$(VERSION) \
+	CONFIG_FLAGS='$(CFLAGS) $(filter -D%,$(CPPFLAGS))' LDFLAGS='$(LDFLAGS)'
+
+unexport CFLAGS
+
+all:
+	$(MAKE_LOCKDEP)
+
+install:
+	$(MAKE_LOCKDEP) install
+	mkdir -p $(DESTDIR)/usr/include
+	cp -R $(top_srcdir)/$(OUTDIR)/include/liblockdep $(DESTDIR)/usr/include/
+	ln -s liblockdep.so.$(VERSION) \
+		$(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/liblockdep.so
diff --git a/debian/rules.d/tools/lib/lockdep/lockdep.in b/debian/rules.d/tools/lib/lockdep/lockdep.in
new file mode 100644
index 0000000..4a0d03a
--- /dev/null
+++ b/debian/rules.d/tools/lib/lockdep/lockdep.in
@@ -0,0 +1,2 @@
+#!/bin/sh
+LD_PRELOAD="liblockdep.so.@VERSION@ $LD_PRELOAD" exec "$@"
diff --git a/debian/rules.d/tools/objtool/Makefile b/debian/rules.d/tools/objtool/Makefile
new file mode 100644
index 0000000..532e5b7
--- /dev/null
+++ b/debian/rules.d/tools/objtool/Makefile
@@ -0,0 +1,9 @@
+include $(top_rulesdir)/Makefile.inc
+
+all:
+# For now, only supported target architecture is x86.  Later we'll need to build
+# for multiple targets and add a wrapper, same as for modpost.
+	$(MAKE) -C $(top_srcdir)/tools/objtool O=$(CURDIR) ARCH=x86
+
+install:
+	install -D -m755 objtool $(DESTDIR)/$(installdir)/objtool
diff --git a/debian/rules.d/tools/perf/Makefile b/debian/rules.d/tools/perf/Makefile
new file mode 100644
index 0000000..ec0c9e9
--- /dev/null
+++ b/debian/rules.d/tools/perf/Makefile
@@ -0,0 +1,88 @@
+include $(top_rulesdir)/Makefile.inc
+
+ifeq ($(filter nopython,$(DEB_BUILD_PROFILES)),)
+
+DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
+
+ifeq ($(DEB_HOST_ARCH_CPU),alpha)
+  KERNEL_ARCH_PERF = alpha
+else ifeq ($(DEB_HOST_ARCH_CPU),arm)
+  KERNEL_ARCH_PERF = arm
+else ifeq ($(DEB_HOST_ARCH_CPU),arm64)
+  KERNEL_ARCH_PERF = arm64
+else ifneq ($(filter mips%,$(DEB_HOST_ARCH_CPU)),)
+  KERNEL_ARCH_PERF = mips
+else ifeq ($(DEB_HOST_ARCH_CPU),hppa)
+  KERNEL_ARCH_PERF = parisc
+else ifneq ($(filter powerpc% ppc%,$(DEB_HOST_ARCH_CPU)),)
+  KERNEL_ARCH_PERF = powerpc
+else ifneq ($(filter s390%,$(DEB_HOST_ARCH_CPU)),)
+  KERNEL_ARCH_PERF = s390
+else ifeq ($(DEB_HOST_ARCH_CPU),sh4)
+  KERNEL_ARCH_PERF = sh
+else ifneq ($(filter sparc%,$(DEB_HOST_ARCH_CPU)),)
+  KERNEL_ARCH_PERF = sparc
+else ifneq ($(filter amd64 i386,$(DEB_HOST_ARCH_CPU)),)
+  # But x32 isn't supported yet
+  ifneq ($(shell dpkg-architecture -qDEB_HOST_ARCH),x32)
+    KERNEL_ARCH_PERF = x86
+  endif
+endif
+
+MAKE_PERF := $(MAKE) O=$(CURDIR) prefix=/usr V=1 ARCH=$(KERNEL_ARCH_PERF) EXTRA_WARNINGS=-Wno-error EXTRA_CFLAGS='$(CFLAGS) $(CPPFLAGS)' LDFLAGS='$(LDFLAGS)'
+
+# Disable Gtk UI until it's more usable
+MAKE_PERF += NO_GTK2=1
+
+# Include version in all directory names
+MAKE_PERF += perfexecdir=lib/perf_$(VERSION)-core plugindir=/usr/lib/traceevent_$(VERSION)/plugins STRACE_GROUPS_DIR=share/perf_$(VERSION)-core/strace/groups tipdir=share/doc/linux-perf-$(VERSION)
+
+# perf can link against libbfd if available, but the result is
+# undistributable as they are licenced under GPL v2 and v3+
+# respectively.  Override detection of libbfd and insist that
+# cplus_demangle() can be found in libiberty (LGPL v2.1+).
+MAKE_PERF += feature-libbfd=0 HAVE_CPLUS_DEMANGLE_SUPPORT=1
+
+# perf can link against libcrypto if available, but the result is
+# undistributable as GPL v2 and OpenSSL are not compatible without
+# an explicit exception.  Override detection of libcrypto.
+MAKE_PERF += NO_LIBCRYPTO=1
+
+# Currently babeltrace support for `perf data' is not automatically detected.
+MAKE_PERF += LIBBABELTRACE=1
+
+all:
+ifdef KERNEL_ARCH_PERF
+# perf changes some default directories depending on whether DESTDIR is
+# set.  We must define it even when building to avoid a rebuild when we
+# run 'make install'.
+	+$(MAKE_PERF) -C $(top_srcdir)/tools/perf -f Makefile.perf all VERSION=$(VERSION) DESTDIR=dummy
+ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+	+$(MAKE_PERF) -C $(top_srcdir)/tools/perf/Documentation man VERSION=$(VERSION)
+endif
+# Check that perf didn't get linked against libbfd or libcrypto
+	type ldd
+	! ldd $(CURDIR)/perf | grep -E '\blib(bfd|crypto)'
+# Check that it includes cplus_demangle from libiberty
+	grep cplus_demangle $(CURDIR)/perf
+endif
+
+install:
+ifdef KERNEL_ARCH_PERF
+	+$(MAKE_PERF) -C $(top_srcdir)/tools/perf -f Makefile.perf install VERSION=$(VERSION)
+# Don't install a 'trace' alias yet:
+# - We need a wrapper for it anyway, so there's little point adding a
+#   versioned link
+# - It doesn't work out-of-the-box as non-root (it depends on debugfs),
+#   so it's less widely useful than strace
+# - 'perf trace' doesn't take much more typing
+	rm -f $(DESTDIR)/usr/bin/trace_$(VERSION)
+endif
+	mkdir -p $(DESTDIR)/usr/share/bash-completion/
+	mv $(DESTDIR)/etc/bash_completion.d \
+		$(DESTDIR)/usr/share/bash-completion/completions
+	rmdir --ignore-fail-on-non-empty $(DESTDIR)/etc
+# Check for unversioned files that are likely to result in file conflicts
+	! find $(DESTDIR) -name '*perf*' \! -path '*[_-]$(VERSION)*' | grep .
+
+endif # !nopython
diff --git a/debian/rules.d/tools/power/Makefile b/debian/rules.d/tools/power/Makefile
new file mode 100644
index 0000000..c3fcc42
--- /dev/null
+++ b/debian/rules.d/tools/power/Makefile
@@ -0,0 +1,8 @@
+SUBDIRS = \
+	cpupower
+
+ifneq ($(filter i386 amd64 x32,$(DEB_HOST_ARCH)),)
+SUBDIRS += x86
+endif
+
+include $(top_rulesdir)/Makefile.inc
diff --git a/debian/rules.d/tools/power/cpupower/Makefile b/debian/rules.d/tools/power/cpupower/Makefile
new file mode 100644
index 0000000..23193b5
--- /dev/null
+++ b/debian/rules.d/tools/power/cpupower/Makefile
@@ -0,0 +1,21 @@
+include $(top_rulesdir)/Makefile.inc
+
+MAKE_CPUPOWER := $(shell dpkg-buildflags --export=cmdline) $(MAKE) O=$(CURDIR) CPUFREQ_BENCH=false V=true mandir=/usr/share/man
+
+MAKE_CPUPOWER += DEBUG=$(if $(findstring nostrip,$(DEB_BUILD_OPTIONS)),true,)
+
+MAKE_CPUPOWER += CROSS='$(CROSS_COMPILE)'
+
+MAKE_CPUPOWER += PACKAGE_BUGREPORT='Debian\ \(reportbug\ linux-cpupower\)'
+
+all:
+	$(MAKE_CPUPOWER) -C $(top_srcdir)/tools/power/cpupower
+
+install:
+	$(MAKE_CPUPOWER) -C $(top_srcdir)/tools/power/cpupower install DESTDIR=$(DESTDIR)
+ifneq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+	rm -rf $(DESTDIR)/usr/share/man
+endif
+
+clean:
+	$(MAKE_CPUPOWER) -C $(top_srcdir)/tools/power/cpupower clean
diff --git a/debian/rules.d/tools/power/x86/Makefile b/debian/rules.d/tools/power/x86/Makefile
new file mode 100644
index 0000000..2b9d773
--- /dev/null
+++ b/debian/rules.d/tools/power/x86/Makefile
@@ -0,0 +1,5 @@
+SUBDIRS = \
+	turbostat \
+	x86_energy_perf_policy
+
+include $(top_rulesdir)/Makefile.inc
diff --git a/debian/rules.d/tools/power/x86/turbostat/Makefile b/debian/rules.d/tools/power/x86/turbostat/Makefile
new file mode 100644
index 0000000..0e5a2a0
--- /dev/null
+++ b/debian/rules.d/tools/power/x86/turbostat/Makefile
@@ -0,0 +1,7 @@
+PROGS = turbostat
+
+installdir = /usr/sbin
+
+include $(top_rulesdir)/Makefile.inc
+
+CPPFLAGS += -DMSRHEADER='"$(top_srcdir)/arch/x86/include/asm/msr-index.h"' -DINTEL_FAMILY_HEADER='"$(top_srcdir)/arch/x86/include/asm/intel-family.h"'
diff --git a/debian/rules.d/tools/power/x86/x86_energy_perf_policy/Makefile b/debian/rules.d/tools/power/x86/x86_energy_perf_policy/Makefile
new file mode 100644
index 0000000..0011ca9
--- /dev/null
+++ b/debian/rules.d/tools/power/x86/x86_energy_perf_policy/Makefile
@@ -0,0 +1,7 @@
+PROGS = x86_energy_perf_policy
+
+installdir = /usr/sbin
+
+include $(top_rulesdir)/Makefile.inc
+
+CPPFLAGS += -DMSRHEADER='"$(top_srcdir)/arch/x86/include/asm/msr-index.h"'
diff --git a/debian/rules.d/tools/usb/usbip/Makefile b/debian/rules.d/tools/usb/usbip/Makefile
new file mode 100644
index 0000000..896a814
--- /dev/null
+++ b/debian/rules.d/tools/usb/usbip/Makefile
@@ -0,0 +1,31 @@
+srcdir := $(top_srcdir)/tools/usb/usbip
+
+# Make sure we don't override top_srcdir in the sub-make.  'unexport
+# top_srcdir' is *not* sufficient; nor is adding 'MAKEFLAGS=' to the
+# sub-make command line.
+unexport MAKEFLAGS
+
+all: export CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
+all: export CPPFLAGS := $(shell dpkg-buildflags --get CFLAGS) \
+	-isystem $(top_srcdir)/debian/build/build-tools/include
+all: export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
+all:
+	rsync -a $(srcdir)/ .
+	./autogen.sh
+	./configure \
+		--prefix=/usr \
+		--with-tcp-wrappers \
+		--with-usbids-dir=/usr/share/misc \
+		--disable-shared \
+		--disable-static \
+		--host=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+	$(MAKE)
+
+install:
+	$(MAKE) install
+ifneq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
+	rm -rf $(DESTDIR)/usr/share/man
+endif
+
+clean:
+	rm -rf *
diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides
index 9662eed..6e7907e 100644
--- a/debian/source/lintian-overrides
+++ b/debian/source/lintian-overrides
@@ -1,2 +1,2 @@
 linux-imx source: license-problem-gfdl-invariants Documentation/media/uapi/fdl-appendix.rst invariant part is: with the :ref:`invariant sections <fdl-invariant>` being list their titles, with the :ref:`front-cover texts <fdl-cover-texts>` being list, and with the :ref:`back-cover texts <fdl-cover-texts>` being list
-linux-imx source: maintainer-script-lacks-debhelper-token debian/linux-headers-4.9.51-imx.postinst
+linux-imx source: maintainer-script-lacks-debhelper-token debian/linux-headers-4.14.98-imx.postinst