Yocto 2.3

Move OpenBMC to Yocto 2.3(pyro).

Tested: Built and verified Witherspoon and Palmetto images
Change-Id: I50744030e771f4850afc2a93a10d3507e76d36bc
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Resolves: openbmc/openbmc#2461
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/cryptodev/cryptodev.inc b/import-layers/yocto-poky/meta/recipes-kernel/cryptodev/cryptodev.inc
index 22c6977..4ae0a2b 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/cryptodev/cryptodev.inc
+++ b/import-layers/yocto-poky/meta/recipes-kernel/cryptodev/cryptodev.inc
@@ -5,7 +5,9 @@
 
 SRC_URI = "http://nwl.cc/pub/cryptodev-linux/cryptodev-linux-${PV}.tar.gz \
            file://06d6b560c6e45dc317dae47c74706fa43f4a31d8.patch \
-           file://cb186f682679383e8b5806240927903730ce85d9.patch"
+           file://cb186f682679383e8b5806240927903730ce85d9.patch \
+           file://0001-Adjust-to-another-change-in-the-user-page-API.patch \
+           file://kernel-4-10-changes.patch"
 
 SRC_URI[md5sum] = "02644cc4cd02301e0b503a332eb2f0b5"
 SRC_URI[sha256sum] = "67fabde9fb67b286a96c4f45b594b0eccd0f761b495705c18f2ae9461b831376"
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/cryptodev/files/0001-Adjust-to-another-change-in-the-user-page-API.patch b/import-layers/yocto-poky/meta/recipes-kernel/cryptodev/files/0001-Adjust-to-another-change-in-the-user-page-API.patch
new file mode 100644
index 0000000..fb75278
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/cryptodev/files/0001-Adjust-to-another-change-in-the-user-page-API.patch
@@ -0,0 +1,40 @@
+From f126e4837e6334d0464540995df7426fedf6b175 Mon Sep 17 00:00:00 2001
+From: Michael Weiser <michael.weiser@gmx.de>
+Date: Fri, 11 Nov 2016 18:09:32 +0100
+Subject: [PATCH] Adjust to another change in the user page API
+
+4.9.0 will replace the write and force flags of get_user_pages_remote()
+with a gup_flags parameter[1]. Distinguish the two APIs based on kernel
+version we're compiling for.
+
+[1] https://github.com/torvalds/linux/commit/9beae1ea89305a9667ceaab6d0bf46a045ad71e7
+
+Upstream-Status: Backport
+
+Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
+---
+ zc.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/zc.c b/zc.c
+index a97b49f..e766ee3 100644
+--- a/zc.c
++++ b/zc.c
+@@ -65,7 +65,13 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write,
+ 	ret = get_user_pages(
+ #endif
+ 			task, mm,
+-			(unsigned long)addr, pgcount, write, 0, pg, NULL);
++			(unsigned long)addr, pgcount,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
++			write ? FOLL_WRITE : 0,
++#else
++			write, 0,
++#endif
++			pg, NULL);
+ 	up_read(&mm->mmap_sem);
+ 	if (ret != pgcount)
+ 		return -EINVAL;
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/cryptodev/files/kernel-4-10-changes.patch b/import-layers/yocto-poky/meta/recipes-kernel/cryptodev/files/kernel-4-10-changes.patch
new file mode 100644
index 0000000..93d608b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/cryptodev/files/kernel-4-10-changes.patch
@@ -0,0 +1,57 @@
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From 2b29be8ac41414ed19cb4f5d5626d9bd0d7b11a8 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica@nxp.com>
+Date: Wed, 8 Feb 2017 12:11:04 +0200
+Subject: [PATCH] adjust to API changes in kernel >=4.10
+
+There are many changes related to get_user_pages and the code is rewritten
+for clarity.
+
+Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
+---
+ zc.c | 28 +++++++++++++++++-----------
+ 1 file changed, 17 insertions(+), 11 deletions(-)
+
+diff --git a/zc.c b/zc.c
+index e766ee3..2f4ea99 100644
+--- a/zc.c
++++ b/zc.c
+@@ -59,19 +59,25 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write,
+ 	}
+ 
+ 	down_read(&mm->mmap_sem);
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0))
+-	ret = get_user_pages_remote(
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0))
++	ret = get_user_pages(task, mm,
++			(unsigned long)addr, pgcount, write, 0, pg, NULL);
+ #else
+-	ret = get_user_pages(
+-#endif
+-			task, mm,
+-			(unsigned long)addr, pgcount,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
+-			write ? FOLL_WRITE : 0,
+-#else
+-			write, 0,
+-#endif
++#  if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0))
++	ret = get_user_pages_remote(task, mm,
++			(unsigned long)addr, pgcount, write, 0, pg, NULL);
++#  else
++#    if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0))
++	ret = get_user_pages_remote(task, mm,
++			(unsigned long)addr, pgcount, write ? FOLL_WRITE : 0,
+ 			pg, NULL);
++#    else
++	ret = get_user_pages_remote(task, mm,
++			(unsigned long)addr, pgcount, write ? FOLL_WRITE : 0,
++			pg, NULL, NULL);
++#    endif
++#  endif
++#endif
+ 	up_read(&mm->mmap_sem);
+ 	if (ret != pgcount)
+ 		return -EINVAL;
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/dtc/dtc_git.bb b/import-layers/yocto-poky/meta/recipes-kernel/dtc/dtc_1.4.2.bb
similarity index 75%
rename from import-layers/yocto-poky/meta/recipes-kernel/dtc/dtc_git.bb
rename to import-layers/yocto-poky/meta/recipes-kernel/dtc/dtc_1.4.2.bb
index 4446142..cc72adc 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/dtc/dtc_git.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/dtc/dtc_1.4.2.bb
@@ -3,8 +3,7 @@
 LIC_FILES_CHKSUM = "file://GPL;md5=94d55d512a9ba36caa9b7df079bae19f \
 		    file://libfdt/libfdt.h;beginline=3;endline=52;md5=fb360963151f8ec2d6c06b055bcbb68c"
 
-SRCREV = "302fca9f4c283e1994cf0a5a9ce1cf43ca15e6d2"
-PV = "1.4.1+git${SRCPV}"
+SRCREV = "ec02b34c05be04f249ffaaca4b666f5246877dea"
 
 S = "${WORKDIR}/git"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb b/import-layers/yocto-poky/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
index 8af0155..5e65469 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
@@ -4,7 +4,7 @@
 
 DEPENDS = "git-native"
 
-SRCREV = "85564e69555b713c2759d58ec5ade54424d051d8"
+SRCREV = "bd7447cd6274d764a129dcdc246cdbfd8c47b991"
 PR = "r12"
 PV = "0.2+git${SRCPV}"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0001-kexec-exntend-the-semantics-of-kexec_iomem_for_each_.patch b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0001-kexec-exntend-the-semantics-of-kexec_iomem_for_each_.patch
new file mode 100644
index 0000000..822f28c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0001-kexec-exntend-the-semantics-of-kexec_iomem_for_each_.patch
@@ -0,0 +1,78 @@
+From 02eed0f8f2748fd7579f69e5373445b52b2b8754 Mon Sep 17 00:00:00 2001
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Mon, 17 Oct 2016 13:56:58 +0900
+Subject: [PATCH 1/9] kexec: exntend the semantics of kexec_iomem_for_each_line
+
+The current kexec_iomem_for_each_line() counts up all the lines for which
+a callback function returns zero(0) or positive, and otherwise it stops
+further scanning.
+This behavior is incovenient in some cases. For instance, on arm64, we want
+to count up "System RAM" entries, but need to skip "reserved" entries.
+
+So this patch extends the semantics so that we will continue to scan
+succeeding entries but not count lines for which a callback function
+returns positive.
+
+The current users of kexec_iomem_for_each_line(), arm, sh and x86, will not
+be affected by this change because
+* arm
+  The callback function only returns -1 or 0, and the return value of
+  kexec_iomem_for_each_line() will never be used.
+* sh, x86
+  The callback function may return (-1 for sh,) 0 or 1, but always returns
+  1 once we have reached the maximum number of entries allowed.
+  Even so the current kexec_iomem_for_each_line() counts them up.
+  This change actually fixes this bug.
+
+Upstream-Status: Backport [https://git.linaro.org/people/takahiro.akashi/kexec-tools.git]
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/kexec-iomem.c | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/kexec/kexec-iomem.c b/kexec/kexec-iomem.c
+index 485a2e8..0a0277a 100644
+--- a/kexec/kexec-iomem.c
++++ b/kexec/kexec-iomem.c
+@@ -18,6 +18,9 @@
+  * Iterate over each line in the file returned by proc_iomem(). If match is
+  * NULL or if the line matches with our match-pattern then call the
+  * callback if non-NULL.
++ * If match is NULL, callback should return a negative if error.
++ * Otherwise the interation goes on, incrementing nr but only if callback
++ * returns 0 (matched).
+  *
+  * Return the number of lines matched.
+  */
+@@ -37,7 +40,7 @@ int kexec_iomem_for_each_line(char *match,
+ 	char *str;
+ 	int consumed;
+ 	int count;
+-	int nr = 0;
++	int nr = 0, ret;
+ 
+ 	fp = fopen(iomem, "r");
+ 	if (!fp)
+@@ -50,11 +53,13 @@ int kexec_iomem_for_each_line(char *match,
+ 		str = line + consumed;
+ 		size = end - start + 1;
+ 		if (!match || memcmp(str, match, strlen(match)) == 0) {
+-			if (callback
+-			    && callback(data, nr, str, start, size) < 0) {
+-				break;
++			if (callback) {
++				ret = callback(data, nr, str, start, size);
++				if (ret < 0)
++					break;
++				else if (ret == 0)
++					nr++;
+ 			}
+-			nr++;
+ 		}
+ 	}
+ 
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0001-x86-x86_64-Fix-format-warning-with-die.patch b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0001-x86-x86_64-Fix-format-warning-with-die.patch
new file mode 100644
index 0000000..e601f52
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0001-x86-x86_64-Fix-format-warning-with-die.patch
@@ -0,0 +1,78 @@
+Upstream-Status: Backport
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+
+
+From 1550f81bf1886aa0520da0b6181cd61c1a75d4ad Mon Sep 17 00:00:00 2001
+From: Pratyush Anand <panand@redhat.com>
+Date: Tue, 14 Mar 2017 17:59:22 +0530
+Subject: [PATCH 1/2] x86/x86_64: Fix format warning with die()
+
+Fedora koji uses gcc version 7.0.1-0.12.fc27, and it generates a build
+warning
+
+   kexec/arch/i386/kexec-elf-x86.c:299:3: error: format not a string
+   literal and no format arguments [-Werror=format-security]
+       die(error_msg);
+       ^~~
+    cc1: some warnings being treated as errors
+
+error_msg can have a format specifier as well in string. In such cases,
+if there is no other arguments for the format variable then code will
+try to access a non existing argument. Therefore, use 1st argument as
+format specifier for string print and pass error_msg as the string to be
+printed.
+
+While doing that,also use const qualifier before "char *error_msg".
+
+Signed-off-by: Pratyush Anand <panand@redhat.com>
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ kexec/arch/i386/kexec-elf-x86.c      | 4 ++--
+ kexec/arch/x86_64/kexec-elf-x86_64.c | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/kexec/arch/i386/kexec-elf-x86.c b/kexec/arch/i386/kexec-elf-x86.c
+index de00dcb..fedf031 100644
+--- a/kexec/arch/i386/kexec-elf-x86.c
++++ b/kexec/arch/i386/kexec-elf-x86.c
+@@ -91,7 +91,7 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len,
+ 	char *command_line = NULL, *modified_cmdline = NULL;
+ 	const char *append = NULL;
+ 	char *tmp_cmdline = NULL;
+-	char *error_msg = NULL;
++	const char *error_msg = NULL;
+ 	int result;
+ 	int command_line_len;
+ 	const char *ramdisk;
+@@ -296,6 +296,6 @@ out:
+ 	free(command_line);
+ 	free(modified_cmdline);
+ 	if (error_msg)
+-		die(error_msg);
++		die("%s", error_msg);
+ 	return result;
+ }
+diff --git a/kexec/arch/x86_64/kexec-elf-x86_64.c b/kexec/arch/x86_64/kexec-elf-x86_64.c
+index ae65692..ad22311 100644
+--- a/kexec/arch/x86_64/kexec-elf-x86_64.c
++++ b/kexec/arch/x86_64/kexec-elf-x86_64.c
+@@ -99,7 +99,7 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len,
+ #define ARG_STYLE_NONE  2
+ 	int opt;
+ 	int result = 0;
+-	char *error_msg = NULL;
++	const char *error_msg = NULL;
+ 
+ 	/* See options.h and add any new options there too! */
+ 	static const struct option options[] = {
+@@ -276,6 +276,6 @@ out:
+ 	free(command_line);
+ 	free(modified_cmdline);
+ 	if (error_msg)
+-		die(error_msg);
++		die("%s", error_msg);
+ 	return result;
+ }
+-- 
+2.11.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0002-kexec-generalize-and-rename-get_kernel_stext_sym.patch b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0002-kexec-generalize-and-rename-get_kernel_stext_sym.patch
new file mode 100644
index 0000000..953f13b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0002-kexec-generalize-and-rename-get_kernel_stext_sym.patch
@@ -0,0 +1,194 @@
+From d29f37bb6e9114aba96c606103b110f511bee9a1 Mon Sep 17 00:00:00 2001
+From: Pratyush Anand <panand@redhat.com>
+Date: Wed, 2 Nov 2016 15:05:25 +0530
+Subject: [PATCH 2/9] kexec: generalize and rename get_kernel_stext_sym()
+
+get_kernel_stext_sym() has been defined for both arm and i386. Other
+architecture might need some other kernel symbol address. Therefore rewrite
+this function as generic function to get any kernel symbol address.
+
+More over, kallsyms is not arch specific representation, therefore have
+common function for all arches.
+
+Upstream-Status: Backport [https://git.linaro.org/people/takahiro.akashi/kexec-tools.git]
+
+Signed-off-by: Pratyush Anand <panand@redhat.com>
+[created symbols.c]
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/Makefile                  |  1 +
+ kexec/arch/arm/crashdump-arm.c  | 40 +---------------------------------------
+ kexec/arch/i386/crashdump-x86.c | 29 -----------------------------
+ kexec/kexec.h                   |  2 ++
+ kexec/symbols.c                 | 41 +++++++++++++++++++++++++++++++++++++++++
+ 5 files changed, 45 insertions(+), 68 deletions(-)
+ create mode 100644 kexec/symbols.c
+
+diff --git a/kexec/Makefile b/kexec/Makefile
+index 39f365f..2b4fb3d 100644
+--- a/kexec/Makefile
++++ b/kexec/Makefile
+@@ -26,6 +26,7 @@ KEXEC_SRCS_base += kexec/kernel_version.c
+ KEXEC_SRCS_base += kexec/lzma.c
+ KEXEC_SRCS_base += kexec/zlib.c
+ KEXEC_SRCS_base += kexec/kexec-xen.c
++KEXEC_SRCS_base += kexec/symbols.c
+ 
+ KEXEC_GENERATED_SRCS += $(PURGATORY_HEX_C)
+ 
+diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c
+index 4a89b5e..245c21a 100644
+--- a/kexec/arch/arm/crashdump-arm.c
++++ b/kexec/arch/arm/crashdump-arm.c
+@@ -73,48 +73,10 @@ static struct crash_elf_info elf_info = {
+ 
+ extern unsigned long long user_page_offset;
+ 
+-/* Retrieve kernel _stext symbol virtual address from /proc/kallsyms */
+-static unsigned long long get_kernel_stext_sym(void)
+-{
+-	const char *kallsyms = "/proc/kallsyms";
+-	const char *stext = "_stext";
+-	char sym[128];
+-	char line[128];
+-	FILE *fp;
+-	unsigned long long vaddr = 0;
+-	char type;
+-
+-	fp = fopen(kallsyms, "r");
+-	if (!fp) {
+-		fprintf(stderr, "Cannot open %s\n", kallsyms);
+-		return 0;
+-	}
+-
+-	while(fgets(line, sizeof(line), fp) != NULL) {
+-		unsigned long long addr;
+-
+-		if (sscanf(line, "%Lx %c %s", &addr, &type, sym) != 3)
+-			continue;
+-
+-		if (strcmp(sym, stext) == 0) {
+-			dbgprintf("kernel symbol %s vaddr = %#llx\n", stext, addr);
+-			vaddr = addr;
+-			break;
+-		}
+-	}
+-
+-	fclose(fp);
+-
+-	if (vaddr == 0)
+-		fprintf(stderr, "Cannot get kernel %s symbol address\n", stext);
+-
+-	return vaddr;
+-}
+-
+ static int get_kernel_page_offset(struct kexec_info *info,
+ 		struct crash_elf_info *elf_info)
+ {
+-	unsigned long long stext_sym_addr = get_kernel_stext_sym();
++	unsigned long long stext_sym_addr = get_kernel_sym("_stext");
+ 	if (stext_sym_addr == 0) {
+ 		if (user_page_offset != (-1ULL)) {
+ 			elf_info->page_offset = user_page_offset;
+diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
+index ab833d4..abf82a5 100644
+--- a/kexec/arch/i386/crashdump-x86.c
++++ b/kexec/arch/i386/crashdump-x86.c
+@@ -102,35 +102,6 @@ static int get_kernel_paddr(struct kexec_info *UNUSED(info),
+ 	return -1;
+ }
+ 
+-/* Retrieve kernel symbol virtual address from /proc/kallsyms */
+-static unsigned long long get_kernel_sym(const char *symbol)
+-{
+-	const char *kallsyms = "/proc/kallsyms";
+-	char sym[128];
+-	char line[128];
+-	FILE *fp;
+-	unsigned long long vaddr;
+-	char type;
+-
+-	fp = fopen(kallsyms, "r");
+-	if (!fp) {
+-		fprintf(stderr, "Cannot open %s\n", kallsyms);
+-		return 0;
+-	}
+-
+-	while(fgets(line, sizeof(line), fp) != NULL) {
+-		if (sscanf(line, "%Lx %c %s", &vaddr, &type, sym) != 3)
+-			continue;
+-		if (strcmp(sym, symbol) == 0) {
+-			dbgprintf("kernel symbol %s vaddr = %16llx\n", symbol, vaddr);
+-			return vaddr;
+-		}
+-	}
+-
+-	fprintf(stderr, "Cannot get kernel %s symbol address\n", symbol);
+-	return 0;
+-}
+-
+ /* Retrieve info regarding virtual address kernel has been compiled for and
+  * size of the kernel from /proc/kcore. Current /proc/kcore parsing from
+  * from kexec-tools fails because of malformed elf notes. A kernel patch has
+diff --git a/kexec/kexec.h b/kexec/kexec.h
+index 9194f1c..b4fafad 100644
+--- a/kexec/kexec.h
++++ b/kexec/kexec.h
+@@ -312,4 +312,6 @@ int xen_kexec_load(struct kexec_info *info);
+ int xen_kexec_unload(uint64_t kexec_flags);
+ void xen_kexec_exec(void);
+ 
++extern unsigned long long get_kernel_sym(const char *text);
++
+ #endif /* KEXEC_H */
+diff --git a/kexec/symbols.c b/kexec/symbols.c
+new file mode 100644
+index 0000000..ea6e327
+--- /dev/null
++++ b/kexec/symbols.c
+@@ -0,0 +1,41 @@
++#include <stdio.h>
++#include <string.h>
++#include "kexec.h"
++
++/* Retrieve kernel symbol virtual address from /proc/kallsyms */
++unsigned long long get_kernel_sym(const char *text)
++{
++	const char *kallsyms = "/proc/kallsyms";
++	char sym[128];
++	char line[128];
++	FILE *fp;
++	unsigned long long vaddr = 0;
++	char type;
++
++	fp = fopen(kallsyms, "r");
++	if (!fp) {
++		fprintf(stderr, "Cannot open %s\n", kallsyms);
++		return 0;
++	}
++
++	while (fgets(line, sizeof(line), fp) != NULL) {
++		unsigned long long addr;
++
++		if (sscanf(line, "%Lx %c %s", &addr, &type, sym) != 3)
++			continue;
++
++		if (strcmp(sym, text) == 0) {
++			dbgprintf("kernel symbol %s vaddr = %#llx\n",
++								text, addr);
++			vaddr = addr;
++			break;
++		}
++	}
++
++	fclose(fp);
++
++	if (vaddr == 0)
++		fprintf(stderr, "Cannot get kernel %s symbol address\n", text);
++
++	return vaddr;
++}
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0002-ppc-Fix-format-warning-with-die.patch b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0002-ppc-Fix-format-warning-with-die.patch
new file mode 100644
index 0000000..6a1c06d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0002-ppc-Fix-format-warning-with-die.patch
@@ -0,0 +1,43 @@
+From 1c956fc8c6b6324d8d38bba5f9e60a018051c6f5 Mon Sep 17 00:00:00 2001
+From: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date: Thu, 16 Mar 2017 15:39:06 +0200
+Subject: [PATCH 2/2] ppc: Fix format warning with die()
+
+Enable compiling kexec-tools for ppc with -Werror=format-security.
+
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Upstream-Status: Submitted [Mailing list]
+---
+ kexec/arch/ppc/kexec-elf-ppc.c    | 2 +-
+ kexec/arch/ppc/kexec-uImage-ppc.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/kexec/arch/ppc/kexec-elf-ppc.c b/kexec/arch/ppc/kexec-elf-ppc.c
+index 291f06d..ad43ad1 100644
+--- a/kexec/arch/ppc/kexec-elf-ppc.c
++++ b/kexec/arch/ppc/kexec-elf-ppc.c
+@@ -453,7 +453,7 @@ out:
+ 	if (!tmp_cmdline)
+ 		free(command_line);
+ 	if (error_msg)
+-		die(error_msg);
++		die("%s", error_msg);
+ 
+ 	return result;
+ }
+diff --git a/kexec/arch/ppc/kexec-uImage-ppc.c b/kexec/arch/ppc/kexec-uImage-ppc.c
+index 5eec6e4..e8f7adc 100644
+--- a/kexec/arch/ppc/kexec-uImage-ppc.c
++++ b/kexec/arch/ppc/kexec-uImage-ppc.c
+@@ -306,7 +306,7 @@ out:
+ 	if (!tmp_cmdline)
+ 		free(command_line);
+ 	if (error_msg)
+-		die(error_msg);
++		die("%s", error_msg);
+ 	return ret;
+ }
+ 
+-- 
+2.11.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0003-arm64-identify-PHYS_OFFSET-correctly.patch b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0003-arm64-identify-PHYS_OFFSET-correctly.patch
new file mode 100644
index 0000000..1a1c317
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0003-arm64-identify-PHYS_OFFSET-correctly.patch
@@ -0,0 +1,76 @@
+From 16df170ad4808d12acd5e919ac4f6e7f33a247b3 Mon Sep 17 00:00:00 2001
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Thu, 1 Sep 2016 10:57:42 +0900
+Subject: [PATCH 3/9] arm64: identify PHYS_OFFSET correctly
+
+Due to the kernel patch, commit e7cd190385d1 ("arm64: mark reserved
+memblock regions explicitly in iomem"), the current code will not be able
+to identify the correct value of PHYS_OFFSET if some "reserved" memory
+region, which is likely to be UEFI runtime services code/data, exists at
+an address below the first "System RAM" regions.
+
+This patch fixes this issue.
+
+Upstream-Status: Backport [https://git.linaro.org/people/takahiro.akashi/kexec-tools.git]
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/arch/arm64/iomem.h       |  7 +++++++
+ kexec/arch/arm64/kexec-arm64.c | 12 ++++++++++--
+ 2 files changed, 17 insertions(+), 2 deletions(-)
+ create mode 100644 kexec/arch/arm64/iomem.h
+
+diff --git a/kexec/arch/arm64/iomem.h b/kexec/arch/arm64/iomem.h
+new file mode 100644
+index 0000000..7fd66eb
+--- /dev/null
++++ b/kexec/arch/arm64/iomem.h
+@@ -0,0 +1,7 @@
++#ifndef IOMEM_H
++#define IOMEM_H
++
++#define SYSTEM_RAM		"System RAM\n"
++#define IOMEM_RESERVED		"reserved\n"
++
++#endif
+diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
+index 2e8839a..8ac811d 100644
+--- a/kexec/arch/arm64/kexec-arm64.c
++++ b/kexec/arch/arm64/kexec-arm64.c
+@@ -21,6 +21,7 @@
+ #include "crashdump-arm64.h"
+ #include "dt-ops.h"
+ #include "fs2dt.h"
++#include "iomem.h"
+ #include "kexec-syscall.h"
+ #include "arch/options.h"
+ 
+@@ -475,7 +476,14 @@ static int get_memory_ranges_iomem_cb(void *data, int nr, char *str,
+ 		return -1;
+ 
+ 	r = (struct memory_range *)data + nr;
+-	r->type = RANGE_RAM;
++
++	if (!strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)))
++		r->type = RANGE_RAM;
++	else if (!strncmp(str, IOMEM_RESERVED, strlen(IOMEM_RESERVED)))
++		r->type = RANGE_RESERVED;
++	else
++		return 1;
++
+ 	r->start = base;
+ 	r->end = base + length - 1;
+ 
+@@ -494,7 +502,7 @@ static int get_memory_ranges_iomem_cb(void *data, int nr, char *str,
+ static int get_memory_ranges_iomem(struct memory_range *array,
+ 	unsigned int *count)
+ {
+-	*count = kexec_iomem_for_each_line("System RAM\n",
++	*count = kexec_iomem_for_each_line(NULL,
+ 		get_memory_ranges_iomem_cb, array);
+ 
+ 	if (!*count) {
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0004-arm64-kdump-identify-memory-regions.patch b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0004-arm64-kdump-identify-memory-regions.patch
new file mode 100644
index 0000000..66600f3
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0004-arm64-kdump-identify-memory-regions.patch
@@ -0,0 +1,202 @@
+From 48a4c7874d8264ddbfaec2e9858d7866a2d2eb60 Mon Sep 17 00:00:00 2001
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Wed, 5 Aug 2015 13:16:30 +0900
+Subject: [PATCH 4/9] arm64: kdump: identify memory regions
+
+The following regions need to be identified for later use:
+ a) memory regions which belong to the 1st kernel
+ b) usable memory reserved for crash dump kernel
+
+We go through /proc/iomem to find out a) and b) which are marked
+as "System RAM" and "Crash kernel", respectively.
+
+Upstream-Status: Backport [https://git.linaro.org/people/takahiro.akashi/kexec-tools.git]
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/arch/arm64/Makefile          |   2 +
+ kexec/arch/arm64/crashdump-arm64.c | 100 ++++++++++++++++++++++++++++++++++++-
+ kexec/arch/arm64/crashdump-arm64.h |  14 +++++-
+ kexec/arch/arm64/iomem.h           |   1 +
+ 4 files changed, 114 insertions(+), 3 deletions(-)
+
+diff --git a/kexec/arch/arm64/Makefile b/kexec/arch/arm64/Makefile
+index 74b677f..2d4ae0e 100644
+--- a/kexec/arch/arm64/Makefile
++++ b/kexec/arch/arm64/Makefile
+@@ -6,6 +6,8 @@ arm64_FS2DT_INCLUDE += \
+ 
+ arm64_DT_OPS += kexec/dt-ops.c
+ 
++arm64_MEM_REGIONS = kexec/mem_regions.c
++
+ arm64_CPPFLAGS += -I $(srcdir)/kexec/
+ 
+ arm64_KEXEC_SRCS += \
+diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
+index d2272c8..dcaca43 100644
+--- a/kexec/arch/arm64/crashdump-arm64.c
++++ b/kexec/arch/arm64/crashdump-arm64.c
+@@ -1,5 +1,13 @@
+ /*
+  * ARM64 crashdump.
++ *     partly derived from arm implementation
++ *
++ * Copyright (c) 2014-2016 Linaro Limited
++ * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
+  */
+ 
+ #define _GNU_SOURCE
+@@ -10,12 +18,102 @@
+ #include "kexec.h"
+ #include "crashdump.h"
+ #include "crashdump-arm64.h"
++#include "iomem.h"
+ #include "kexec-arm64.h"
+ #include "kexec-elf.h"
++#include "mem_regions.h"
+ 
+-struct memory_ranges usablemem_rgns = {};
++/* memory ranges on crashed kernel */
++static struct memory_range crash_memory_ranges[CRASH_MAX_MEMORY_RANGES];
++static struct memory_ranges crash_memory_rgns = {
++	.size = 0,
++	.max_size = CRASH_MAX_MEMORY_RANGES,
++	.ranges = crash_memory_ranges,
++};
++
++/* memory range reserved for crashkernel */
++struct memory_range crash_reserved_mem;
++struct memory_ranges usablemem_rgns = {
++	.size = 0,
++	.max_size = 1,
++	.ranges = &crash_reserved_mem,
++};
++
++/*
++ * iomem_range_callback() - callback called for each iomem region
++ * @data: not used
++ * @nr: not used
++ * @str: name of the memory region
++ * @base: start address of the memory region
++ * @length: size of the memory region
++ *
++ * This function is called once for each memory region found in /proc/iomem.
++ * It locates system RAM and crashkernel reserved memory and places these to
++ * variables, respectively, crash_memory_ranges and crash_reserved_mem.
++ */
++
++static int iomem_range_callback(void *UNUSED(data), int UNUSED(nr),
++				char *str, unsigned long long base,
++				unsigned long long length)
++{
++	if (strncmp(str, CRASH_KERNEL, strlen(CRASH_KERNEL)) == 0)
++		return mem_regions_add(&usablemem_rgns,
++				       base, length, RANGE_RAM);
++	else if (strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)) == 0)
++		return mem_regions_add(&crash_memory_rgns,
++				       base, length, RANGE_RAM);
++
++	return 0;
++}
+ 
+ int is_crashkernel_mem_reserved(void)
+ {
++	if (!crash_reserved_mem.end)
++		kexec_iomem_for_each_line(NULL, iomem_range_callback, NULL);
++
++	return crash_reserved_mem.start != crash_reserved_mem.end;
++}
++
++/*
++ * crash_get_memory_ranges() - read system physical memory
++ *
++ * Function reads through system physical memory and stores found memory
++ * regions in crash_memory_ranges.
++ * Regions are sorted in ascending order.
++ *
++ * Returns 0 in case of success and -1 otherwise (errno is set).
++ */
++static int crash_get_memory_ranges(void)
++{
++	/*
++	 * First read all memory regions that can be considered as
++	 * system memory including the crash area.
++	 */
++	if (!usablemem_rgns.size)
++		kexec_iomem_for_each_line(NULL, iomem_range_callback, NULL);
++
++	/* allow only a single region for crash dump kernel */
++	if (usablemem_rgns.size != 1) {
++		errno = EINVAL;
++		return -1;
++	}
++
++	dbgprint_mem_range("Reserved memory range", &crash_reserved_mem, 1);
++
++	if (mem_regions_exclude(&crash_memory_rgns, &crash_reserved_mem)) {
++		fprintf(stderr,
++			"Error: Number of crash memory ranges excedeed the max limit\n");
++		errno = ENOMEM;
++		return -1;
++	}
++
++	/*
++	 * Make sure that the memory regions are sorted.
++	 */
++	mem_regions_sort(&crash_memory_rgns);
++
++	dbgprint_mem_range("Coredump memory ranges",
++			   crash_memory_rgns.ranges, crash_memory_rgns.size);
++
+ 	return 0;
+ }
+diff --git a/kexec/arch/arm64/crashdump-arm64.h b/kexec/arch/arm64/crashdump-arm64.h
+index f33c7a2..07a0ed0 100644
+--- a/kexec/arch/arm64/crashdump-arm64.h
++++ b/kexec/arch/arm64/crashdump-arm64.h
+@@ -1,12 +1,22 @@
+ /*
+  * ARM64 crashdump.
++ *
++ * Copyright (c) 2014-2016 Linaro Limited
++ * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
+  */
+ 
+-#if !defined(CRASHDUMP_ARM64_H)
++#ifndef CRASHDUMP_ARM64_H
+ #define CRASHDUMP_ARM64_H
+ 
+ #include "kexec.h"
+ 
++#define CRASH_MAX_MEMORY_RANGES	32
++
+ extern struct memory_ranges usablemem_rgns;
++extern struct memory_range crash_reserved_mem;
+ 
+-#endif
++#endif /* CRASHDUMP_ARM64_H */
+diff --git a/kexec/arch/arm64/iomem.h b/kexec/arch/arm64/iomem.h
+index 7fd66eb..20cda87 100644
+--- a/kexec/arch/arm64/iomem.h
++++ b/kexec/arch/arm64/iomem.h
+@@ -2,6 +2,7 @@
+ #define IOMEM_H
+ 
+ #define SYSTEM_RAM		"System RAM\n"
++#define CRASH_KERNEL		"Crash kernel\n"
+ #define IOMEM_RESERVED		"reserved\n"
+ 
+ #endif
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0005-arm64-kdump-add-elf-core-header-segment.patch b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0005-arm64-kdump-add-elf-core-header-segment.patch
new file mode 100644
index 0000000..fe535b6
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0005-arm64-kdump-add-elf-core-header-segment.patch
@@ -0,0 +1,191 @@
+From 769da25627cebb2a53caee5d5be78a32d376adc1 Mon Sep 17 00:00:00 2001
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Wed, 5 Aug 2015 13:45:15 +0900
+Subject: [PATCH 5/9] arm64: kdump: add elf core header segment
+
+Elf core header contains the information necessary for the coredump of
+the 1st kernel, including its physcal memory layout as well as cpu register
+states at the panic.
+The segment is allocated inside the reserved memory of crash dump kernel.
+
+Upstream-Status: Backport [https://git.linaro.org/people/takahiro.akashi/kexec-tools.git]
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/arch/arm64/crashdump-arm64.c | 96 ++++++++++++++++++++++++++++++++++++++
+ kexec/arch/arm64/crashdump-arm64.h |  3 ++
+ kexec/arch/arm64/iomem.h           |  2 +
+ kexec/arch/arm64/kexec-elf-arm64.c | 10 ++++
+ 4 files changed, 111 insertions(+)
+
+diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
+index dcaca43..8346131 100644
+--- a/kexec/arch/arm64/crashdump-arm64.c
++++ b/kexec/arch/arm64/crashdump-arm64.c
+@@ -39,6 +39,39 @@ struct memory_ranges usablemem_rgns = {
+ 	.ranges = &crash_reserved_mem,
+ };
+ 
++struct memory_range elfcorehdr_mem;
++
++static struct crash_elf_info elf_info = {
++	.class		= ELFCLASS64,
++#if (__BYTE_ORDER == __LITTLE_ENDIAN)
++	.data		= ELFDATA2LSB,
++#else
++	.data		= ELFDATA2MSB,
++#endif
++	.machine	= EM_AARCH64,
++};
++
++/*
++ * Note: The returned value is correct only if !CONFIG_RANDOMIZE_BASE.
++ */
++static uint64_t get_kernel_page_offset(void)
++{
++	int i;
++
++	if (elf_info.kern_vaddr_start == UINT64_MAX)
++		return UINT64_MAX;
++
++	/* Current max virtual memory range is 48-bits. */
++	for (i = 48; i > 0; i--)
++		if (!(elf_info.kern_vaddr_start & (1UL << i)))
++			break;
++
++	if (i <= 0)
++		return UINT64_MAX;
++	else
++		return UINT64_MAX << i;
++}
++
+ /*
+  * iomem_range_callback() - callback called for each iomem region
+  * @data: not used
+@@ -62,6 +95,10 @@ static int iomem_range_callback(void *UNUSED(data), int UNUSED(nr),
+ 	else if (strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)) == 0)
+ 		return mem_regions_add(&crash_memory_rgns,
+ 				       base, length, RANGE_RAM);
++	else if (strncmp(str, KERNEL_CODE, strlen(KERNEL_CODE)) == 0)
++		elf_info.kern_paddr_start = base;
++	else if (strncmp(str, KERNEL_DATA, strlen(KERNEL_DATA)) == 0)
++		elf_info.kern_size = base + length - elf_info.kern_paddr_start;
+ 
+ 	return 0;
+ }
+@@ -115,5 +152,64 @@ static int crash_get_memory_ranges(void)
+ 	dbgprint_mem_range("Coredump memory ranges",
+ 			   crash_memory_rgns.ranges, crash_memory_rgns.size);
+ 
++	/*
++	 * For additional kernel code/data segment.
++	 * kern_paddr_start/kern_size are determined in iomem_range_callback
++	 */
++	elf_info.kern_vaddr_start = get_kernel_sym("_text");
++	if (!elf_info.kern_vaddr_start)
++		elf_info.kern_vaddr_start = UINT64_MAX;
++
++	return 0;
++}
++
++/*
++ * load_crashdump_segments() - load the elf core header
++ * @info: kexec info structure
++ *
++ * This function creates and loads an additional segment of elf core header
++ : which is used to construct /proc/vmcore on crash dump kernel.
++ *
++ * Return 0 in case of success and -1 in case of error.
++ */
++
++int load_crashdump_segments(struct kexec_info *info)
++{
++	unsigned long elfcorehdr;
++	unsigned long bufsz;
++	void *buf;
++	int err;
++
++	/*
++	 * First fetch all the memory (RAM) ranges that we are going to
++	 * pass to the crash dump kernel during panic.
++	 */
++
++	err = crash_get_memory_ranges();
++
++	if (err)
++		return err;
++
++	elf_info.page_offset = get_kernel_page_offset();
++	dbgprintf("%s: page_offset:   %016llx\n", __func__,
++			elf_info.page_offset);
++
++	err = crash_create_elf64_headers(info, &elf_info,
++			crash_memory_rgns.ranges, crash_memory_rgns.size,
++			&buf, &bufsz, ELF_CORE_HEADER_ALIGN);
++
++	if (err)
++		return err;
++
++	elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 0,
++		crash_reserved_mem.start, crash_reserved_mem.end,
++		-1, 0);
++
++	elfcorehdr_mem.start = elfcorehdr;
++	elfcorehdr_mem.end = elfcorehdr + bufsz - 1;
++
++	dbgprintf("%s: elfcorehdr 0x%llx-0x%llx\n", __func__,
++			elfcorehdr_mem.start, elfcorehdr_mem.end);
++
+ 	return 0;
+ }
+diff --git a/kexec/arch/arm64/crashdump-arm64.h b/kexec/arch/arm64/crashdump-arm64.h
+index 07a0ed0..da75a2d 100644
+--- a/kexec/arch/arm64/crashdump-arm64.h
++++ b/kexec/arch/arm64/crashdump-arm64.h
+@@ -18,5 +18,8 @@
+ 
+ extern struct memory_ranges usablemem_rgns;
+ extern struct memory_range crash_reserved_mem;
++extern struct memory_range elfcorehdr_mem;
++
++extern int load_crashdump_segments(struct kexec_info *info);
+ 
+ #endif /* CRASHDUMP_ARM64_H */
+diff --git a/kexec/arch/arm64/iomem.h b/kexec/arch/arm64/iomem.h
+index 20cda87..d4864bb 100644
+--- a/kexec/arch/arm64/iomem.h
++++ b/kexec/arch/arm64/iomem.h
+@@ -2,6 +2,8 @@
+ #define IOMEM_H
+ 
+ #define SYSTEM_RAM		"System RAM\n"
++#define KERNEL_CODE		"Kernel code\n"
++#define KERNEL_DATA		"Kernel data\n"
+ #define CRASH_KERNEL		"Crash kernel\n"
+ #define IOMEM_RESERVED		"reserved\n"
+ 
+diff --git a/kexec/arch/arm64/kexec-elf-arm64.c b/kexec/arch/arm64/kexec-elf-arm64.c
+index daf8bf0..c70a37a 100644
+--- a/kexec/arch/arm64/kexec-elf-arm64.c
++++ b/kexec/arch/arm64/kexec-elf-arm64.c
+@@ -119,6 +119,16 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
+ 	dbgprintf("%s: PE format:      %s\n", __func__,
+ 		(arm64_header_check_pe_sig(header) ? "yes" : "no"));
+ 
++	if (info->kexec_flags & KEXEC_ON_CRASH) {
++		/* create and initialize elf core header segment */
++		result = load_crashdump_segments(info);
++		if (result) {
++			dbgprintf("%s: Creating eflcorehdr failed.\n",
++								__func__);
++			goto exit;
++		}
++	}
++
+ 	/* load the kernel */
+ 	result = elf_exec_load(&ehdr, info);
+ 
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0006-arm64-kdump-set-up-kernel-image-segment.patch b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0006-arm64-kdump-set-up-kernel-image-segment.patch
new file mode 100644
index 0000000..4149551
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0006-arm64-kdump-set-up-kernel-image-segment.patch
@@ -0,0 +1,137 @@
+From 4079c93ac5453ef5f7889ab64920c1e9427690ef Mon Sep 17 00:00:00 2001
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Tue, 17 Feb 2015 16:06:55 +0900
+Subject: [PATCH 6/9] arm64: kdump: set up kernel image segment
+
+On arm64, we can use the same kernel image as 1st kernel, but
+we have to modify the entry point as well as segments' addresses
+in the kernel's elf header in order to load them into correct places.
+
+Upstream-Status: Backport [https://git.linaro.org/people/takahiro.akashi/kexec-tools.git]
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/arch/arm64/crashdump-arm64.c | 23 +++++++++++++++++++++++
+ kexec/arch/arm64/crashdump-arm64.h |  1 +
+ kexec/arch/arm64/kexec-arm64.c     | 25 ++++++++++++++++++++-----
+ kexec/arch/arm64/kexec-elf-arm64.c | 10 +++++++++-
+ 4 files changed, 53 insertions(+), 6 deletions(-)
+
+diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
+index 8346131..9517329 100644
+--- a/kexec/arch/arm64/crashdump-arm64.c
++++ b/kexec/arch/arm64/crashdump-arm64.c
+@@ -213,3 +213,26 @@ int load_crashdump_segments(struct kexec_info *info)
+ 
+ 	return 0;
+ }
++
++/*
++ * e_entry and p_paddr are actually in virtual address space.
++ * Those values will be translated to physcal addresses by
++ * using virt_to_phys().
++ * So let's get ready for later use so the memory base (phys_offset)
++ * will be correctly replaced with crash_reserved_mem.start.
++ */
++void modify_ehdr_for_crashdump(struct mem_ehdr *ehdr)
++{
++	struct mem_phdr *phdr;
++	int i;
++
++	ehdr->e_entry += - arm64_mem.phys_offset + crash_reserved_mem.start;
++
++	for (i = 0; i < ehdr->e_phnum; i++) {
++		phdr = &ehdr->e_phdr[i];
++		if (phdr->p_type != PT_LOAD)
++			continue;
++		phdr->p_paddr +=
++			(-arm64_mem.phys_offset + crash_reserved_mem.start);
++	}
++}
+diff --git a/kexec/arch/arm64/crashdump-arm64.h b/kexec/arch/arm64/crashdump-arm64.h
+index da75a2d..382f571 100644
+--- a/kexec/arch/arm64/crashdump-arm64.h
++++ b/kexec/arch/arm64/crashdump-arm64.h
+@@ -21,5 +21,6 @@ extern struct memory_range crash_reserved_mem;
+ extern struct memory_range elfcorehdr_mem;
+ 
+ extern int load_crashdump_segments(struct kexec_info *info);
++extern void modify_ehdr_for_crashdump(struct mem_ehdr *ehdr);
+ 
+ #endif /* CRASHDUMP_ARM64_H */
+diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
+index 8ac811d..cec4e41 100644
+--- a/kexec/arch/arm64/kexec-arm64.c
++++ b/kexec/arch/arm64/kexec-arm64.c
+@@ -307,12 +307,27 @@ unsigned long arm64_locate_kernel_segment(struct kexec_info *info)
+ {
+ 	unsigned long hole;
+ 
+-	hole = locate_hole(info,
+-		arm64_mem.text_offset + arm64_mem.image_size,
+-		MiB(2), 0, ULONG_MAX, 1);
++	if (info->kexec_flags & KEXEC_ON_CRASH) {
++		unsigned long hole_end;
++
++		hole = (crash_reserved_mem.start < mem_min ?
++				mem_min : crash_reserved_mem.start);
++		hole = _ALIGN_UP(hole, MiB(2));
++		hole_end = hole + arm64_mem.text_offset + arm64_mem.image_size;
++
++		if ((hole_end > mem_max) ||
++		    (hole_end > crash_reserved_mem.end)) {
++			dbgprintf("%s: Crash kernel out of range\n", __func__);
++			hole = ULONG_MAX;
++		}
++	} else {
++		hole = locate_hole(info,
++			arm64_mem.text_offset + arm64_mem.image_size,
++			MiB(2), 0, ULONG_MAX, 1);
+ 
+-	if (hole == ULONG_MAX)
+-		dbgprintf("%s: locate_hole failed\n", __func__);
++		if (hole == ULONG_MAX)
++			dbgprintf("%s: locate_hole failed\n", __func__);
++	}
+ 
+ 	return hole;
+ }
+diff --git a/kexec/arch/arm64/kexec-elf-arm64.c b/kexec/arch/arm64/kexec-elf-arm64.c
+index c70a37a..842ce21 100644
+--- a/kexec/arch/arm64/kexec-elf-arm64.c
++++ b/kexec/arch/arm64/kexec-elf-arm64.c
+@@ -9,6 +9,7 @@
+ #include <stdlib.h>
+ #include <linux/elf.h>
+ 
++#include "crashdump-arm64.h"
+ #include "kexec-arm64.h"
+ #include "kexec-elf.h"
+ #include "kexec-syscall.h"
+@@ -105,7 +106,8 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
+ 	}
+ 
+ 	arm64_mem.vp_offset = _ALIGN_DOWN(ehdr.e_entry, MiB(2));
+-	arm64_mem.vp_offset -= kernel_segment - get_phys_offset();
++	if (!(info->kexec_flags & KEXEC_ON_CRASH))
++		arm64_mem.vp_offset -= kernel_segment - get_phys_offset();
+ 
+ 	dbgprintf("%s: kernel_segment: %016lx\n", __func__, kernel_segment);
+ 	dbgprintf("%s: text_offset:    %016lx\n", __func__,
+@@ -127,6 +129,12 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
+ 								__func__);
+ 			goto exit;
+ 		}
++
++		/*
++		 * offset addresses in order to fit vmlinux
++		 * (elf_exec) into crash kernel's memory
++		 */
++		modify_ehdr_for_crashdump(&ehdr);
+ 	}
+ 
+ 	/* load the kernel */
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0007-arm64-kdump-set-up-other-segments.patch b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0007-arm64-kdump-set-up-other-segments.patch
new file mode 100644
index 0000000..2745466
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0007-arm64-kdump-set-up-other-segments.patch
@@ -0,0 +1,35 @@
+From 07ad14e12665221d754fde8e47c32ac18c24586a Mon Sep 17 00:00:00 2001
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Fri, 31 Jul 2015 20:01:39 +0900
+Subject: [PATCH 7/9] arm64: kdump: set up other segments
+
+We make sure that all the other segments, initrd and device-tree blob,
+also be loaded into the reserved memory of crash dump kernel.
+
+Upstream-Status: Backport [https://git.linaro.org/people/takahiro.akashi/kexec-tools.git]
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/arch/arm64/kexec-arm64.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
+index cec4e41..78a0035 100644
+--- a/kexec/arch/arm64/kexec-arm64.c
++++ b/kexec/arch/arm64/kexec-arm64.c
+@@ -374,7 +374,10 @@ int arm64_load_other_segments(struct kexec_info *info,
+ 	/* Put the other segments after the image. */
+ 
+ 	hole_min = image_base + arm64_mem.image_size;
+-	hole_max = ULONG_MAX;
++	if (info->kexec_flags & KEXEC_ON_CRASH)
++		hole_max = crash_reserved_mem.end;
++	else
++		hole_max = ULONG_MAX;
+ 
+ 	if (arm64_opts.initrd) {
+ 		initrd_buf = slurp_file(arm64_opts.initrd, &initrd_size);
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch
new file mode 100644
index 0000000..31c3d85
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch
@@ -0,0 +1,150 @@
+From 23bf7ac189cc3b87ceb9d1d3b69b5c4815354add Mon Sep 17 00:00:00 2001
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Wed, 27 Jan 2016 13:38:39 +0900
+Subject: [PATCH 8/9] arm64: kdump: add DT properties to crash dump kernel's
+ dtb
+
+We pass the following properties to crash dump kernel:
+linux,elfcorehdr: elf core header segment,
+		  same as "elfcorehdr=" kernel parameter on other archs
+linux,usable-memory-range: usable memory reserved for crash dump kernel
+
+Upstream-Status: Backport [https://git.linaro.org/people/takahiro.akashi/kexec-tools.git]
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/arch/arm64/kexec-arm64.c     | 76 +++++++++++++++++++++++++++++++++++---
+ kexec/arch/arm64/kexec-elf-arm64.c |  5 ---
+ 2 files changed, 71 insertions(+), 10 deletions(-)
+
+diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
+index 78a0035..a8fb64f 100644
+--- a/kexec/arch/arm64/kexec-arm64.c
++++ b/kexec/arch/arm64/kexec-arm64.c
+@@ -128,9 +128,6 @@ int arch_process_options(int argc, char **argv)
+ 		case OPT_INITRD:
+ 			arm64_opts.initrd = optarg;
+ 			break;
+-		case OPT_PANIC:
+-			die("load-panic (-p) not supported");
+-			break;
+ 		default:
+ 			break; /* Ignore core and unknown options. */
+ 		}
+@@ -285,8 +282,12 @@ on_success:
+  * setup_2nd_dtb - Setup the 2nd stage kernel's dtb.
+  */
+ 
+-static int setup_2nd_dtb(struct dtb *dtb, char *command_line)
++static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash)
+ {
++	char *new_buf;
++	int new_size;
++	int nodeoffset;
++	uint64_t range[2];
+ 	int result;
+ 
+ 	result = fdt_check_header(dtb->buf);
+@@ -298,8 +299,72 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line)
+ 
+ 	result = set_bootargs(dtb, command_line);
+ 
++	/* remove those anyway */
++	nodeoffset = fdt_path_offset(dtb->buf, "/chosen");
++	fdt_delprop(dtb->buf, nodeoffset, "linux,crashkernel-base");
++	fdt_delprop(dtb->buf, nodeoffset, "linux,crashkernel-size");
++
++	if (on_crash) {
++		nodeoffset = fdt_path_offset(dtb->buf, "/chosen");
++		fdt_delprop(dtb->buf, nodeoffset, "linux,elfcorehdr");
++		fdt_delprop(dtb->buf, nodeoffset, "linux,usable-memory-range");
++		new_size = fdt_totalsize(dtb->buf)
++			+ 2 * (sizeof(struct fdt_property)
++					+ FDT_TAGALIGN(sizeof(range)))
++			+ strlen("linux,elfcorehdr") + 1
++			+ strlen("linux,usable-memory-range") + 1;
++
++		new_buf = xmalloc(new_size);
++		result = fdt_open_into(dtb->buf, new_buf, new_size);
++		if (result) {
++			dbgprintf("%s: fdt_open_into failed: %s\n", __func__,
++				fdt_strerror(result));
++			result = -ENOSPC;
++			goto on_error;
++		}
++
++		range[0] = cpu_to_be64(elfcorehdr_mem.start);
++		range[1] = cpu_to_be64(elfcorehdr_mem.end
++				- elfcorehdr_mem.start + 1);
++		nodeoffset = fdt_path_offset(new_buf, "/chosen");
++		result = fdt_setprop(new_buf, nodeoffset, "linux,elfcorehdr",
++				(void *)range, sizeof(range));
++		if (result) {
++			dbgprintf("%s: fdt_setprop failed: %s\n", __func__,
++				fdt_strerror(result));
++			result = -EINVAL;
++			goto on_error;
++		}
++
++		range[0] = cpu_to_be64(crash_reserved_mem.start);
++		range[1] = cpu_to_be64(crash_reserved_mem.end
++				- crash_reserved_mem.start + 1);
++		nodeoffset = fdt_path_offset(new_buf, "/chosen");
++		result = fdt_setprop(new_buf, nodeoffset,
++				"linux,usable-memory-range",
++				(void *)range, sizeof(range));
++		if (result) {
++			dbgprintf("%s: fdt_setprop failed: %s\n", __func__,
++				fdt_strerror(result));
++			result = -EINVAL;
++			goto on_error;
++		}
++
++		fdt_pack(new_buf);
++		dtb->buf = new_buf;
++		dtb->size = fdt_totalsize(new_buf);
++	}
++
+ 	dump_reservemap(dtb);
+ 
++
++	return result;
++
++on_error:
++	fprintf(stderr, "kexec: %s failed.\n", __func__);
++	if (new_buf)
++		free(new_buf);
++
+ 	return result;
+ }
+ 
+@@ -366,7 +431,8 @@ int arm64_load_other_segments(struct kexec_info *info,
+ 		}
+ 	}
+ 
+-	result = setup_2nd_dtb(&dtb, command_line);
++	result = setup_2nd_dtb(&dtb, command_line,
++			info->kexec_flags & KEXEC_ON_CRASH);
+ 
+ 	if (result)
+ 		return -EFAILED;
+diff --git a/kexec/arch/arm64/kexec-elf-arm64.c b/kexec/arch/arm64/kexec-elf-arm64.c
+index 842ce21..b17a31a 100644
+--- a/kexec/arch/arm64/kexec-elf-arm64.c
++++ b/kexec/arch/arm64/kexec-elf-arm64.c
+@@ -47,11 +47,6 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
+ 	int result;
+ 	int i;
+ 
+-	if (info->kexec_flags & KEXEC_ON_CRASH) {
+-		fprintf(stderr, "kexec: kdump not yet supported on arm64\n");
+-		return -EFAILED;
+-	}
+-
+ 	result = build_elf_exec_info(kernel_buf, kernel_size, &ehdr, 0);
+ 
+ 	if (result < 0) {
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0009-arm64-kdump-Add-support-for-binary-image-files.patch b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0009-arm64-kdump-Add-support-for-binary-image-files.patch
new file mode 100644
index 0000000..8b1c018
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0009-arm64-kdump-Add-support-for-binary-image-files.patch
@@ -0,0 +1,52 @@
+From 5a4958f01a793c3e7f440f5bae75666a4349cc50 Mon Sep 17 00:00:00 2001
+From: Pratyush Anand <panand@redhat.com>
+Date: Thu, 14 May 2015 11:25:37 +0530
+Subject: [PATCH 9/9] arm64: kdump: Add support for binary image files
+
+This patch adds support to use binary image ie arch/arm64/boot/Image with
+kdump.
+
+Upstream-Status: Backport [https://git.linaro.org/people/takahiro.akashi/kexec-tools.git]
+
+Signed-off-by: Pratyush Anand <panand@redhat.com>
+[takahiro.akashi@linaro.org: a bit reworked]
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/arch/arm64/kexec-image-arm64.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/kexec/arch/arm64/kexec-image-arm64.c b/kexec/arch/arm64/kexec-image-arm64.c
+index 960ed96..982e431 100644
+--- a/kexec/arch/arm64/kexec-image-arm64.c
++++ b/kexec/arch/arm64/kexec-image-arm64.c
+@@ -4,7 +4,9 @@
+ 
+ #define _GNU_SOURCE
+ 
++#include "crashdump-arm64.h"
+ #include "kexec-arm64.h"
++#include "kexec-syscall.h"
+ #include <limits.h>
+ 
+ int image_arm64_probe(const char *kernel_buf, off_t kernel_size)
+@@ -58,6 +60,16 @@ int image_arm64_load(int argc, char **argv, const char *kernel_buf,
+ 	dbgprintf("%s: PE format:      %s\n", __func__,
+ 		(arm64_header_check_pe_sig(header) ? "yes" : "no"));
+ 
++	if (info->kexec_flags & KEXEC_ON_CRASH) {
++		/* create and initialize elf core header segment */
++		result = load_crashdump_segments(info);
++		if (result) {
++			dbgprintf("%s: Creating eflcorehdr failed.\n",
++								__func__);
++			goto exit;
++		}
++	}
++
+ 	/* load the kernel */
+ 	add_segment_phys_virt(info, kernel_buf, kernel_size,
+ 			kernel_segment + arm64_mem.text_offset,
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0010-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0010-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch
new file mode 100644
index 0000000..6c6c66d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/0010-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch
@@ -0,0 +1,52 @@
+From 78e497fb69950665e639cfab8f4fb50cc404a1eb Mon Sep 17 00:00:00 2001
+From: Haiqing Bai <Haiqing.Bai@windriver.com>
+Date: Mon, 9 Jan 2017 15:26:29 +0800
+Subject: [PATCH] kexec: ARM: Fix add_buffer_phys_virt() align issue
+
+When "CONFIG_ARM_LPAE" is enabled,3 level page table
+is used by MMU, the "SECTION_SIZE" is defined with
+(1 << 21), but 'add_buffer_phys_virt()' hardcode this
+to (1 << 20).
+
+Upstream-Status: Pending
+
+Suggested-By:fredrik.markstrom@gmail.com
+Signed-off-by: Haiqing Bai <Haiqing.Bai@windriver.com>
+---
+ kexec/arch/arm/crashdump-arm.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c
+index 245c21a..12139c3 100644
+--- a/kexec/arch/arm/crashdump-arm.c
++++ b/kexec/arch/arm/crashdump-arm.c
+@@ -240,6 +240,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
+ 	void *buf;
+ 	int err;
+ 	int last_ranges;
++	unsigned short align_bit_shift = 20;
+ 
+ 	/*
+ 	 * First fetch all the memory (RAM) ranges that we are going to pass to
+@@ -281,6 +282,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
+ 
+ 		/* for support LPAE enabled kernel*/
+ 		elf_info.class = ELFCLASS64;
++		align_bit_shift = 21;
+ 
+ 		err = crash_create_elf64_headers(info, &elf_info,
+ 					 usablemem_rgns.ranges,
+@@ -302,8 +304,9 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
+ 	 * 1MB) so that available memory passed in kernel command line will be
+ 	 * aligned to 1MB. This is because kernel create_mapping() wants memory
+ 	 * regions to be aligned to SECTION_SIZE.
++	 * The SECTION_SIZE of LPAE kernel is '1UL << 21' defined in pgtable-3level.h
+ 	 */
+-	elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << 20,
++	elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << align_bit_shift,
+ 					  crash_kernel_mem.start,
+ 					  crash_kernel_mem.end, -1, 0);
+ 
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/kdump b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/kdump
index 2347205..69e3caf 100755
--- a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/kdump
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools/kdump
@@ -89,7 +89,7 @@
 		return 0
 	fi
 
-	#check the running kernel cmdline option,insure "crashkenrel=" always set.
+	#check the running kernel cmdline option,insure "crashkernel=" always set.
 	grep -q crashkernel= /proc/cmdline
 	if [ $? != 0 ]; then
 		echo "Kdump isn't supported on the running kernel,please check boot option!!!"
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools_2.0.12.bb b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools_2.0.12.bb
deleted file mode 100644
index 59376c8..0000000
--- a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools_2.0.12.bb
+++ /dev/null
@@ -1,37 +0,0 @@
-require kexec-tools.inc
-export LDFLAGS = "-L${STAGING_LIBDIR}"
-EXTRA_OECONF = " --with-zlib=yes"
-
-SRC_URI += " \
-            file://kexec-aarch64.patch \
-            file://kexec-x32.patch \
-            file://0002-powerpc-change-the-memory-size-limit.patch \
-            file://0001-purgatory-Pass-r-directly-to-linker.patch \
-            file://0001-vmcore-dmesg-Define-_GNU_SOURCE.patch \
-         "
-
-SRC_URI[md5sum] = "10ddaae0e86af54407b164a1f5a39cc3"
-SRC_URI[sha256sum] = "cc7b60dad0da202004048a6179d8a53606943062dd627a2edba45a8ea3a85135"
-
-PACKAGES =+ "kexec kdump vmcore-dmesg"
-
-ALLOW_EMPTY_${PN} = "1"
-RRECOMMENDS_${PN} = "kexec kdump vmcore-dmesg"
-
-FILES_kexec = "${sbindir}/kexec"
-FILES_kdump = "${sbindir}/kdump ${sysconfdir}/init.d/kdump \
-               ${sysconfdir}/sysconfig/kdump.conf"
-FILES_vmcore-dmesg = "${sbindir}/vmcore-dmesg"
-
-inherit update-rc.d
-
-INITSCRIPT_PACKAGES = "kdump"
-INITSCRIPT_NAME_kdump = "kdump"
-INITSCRIPT_PARAMS_kdump = "start 56 2 3 4 5 . stop 56 0 1 6 ."
-
-do_install_append () {
-        install -d ${D}${sysconfdir}/init.d
-        install -m 0755 ${WORKDIR}/kdump ${D}${sysconfdir}/init.d/kdump
-        install -d ${D}${sysconfdir}/sysconfig
-        install -m 0644 ${WORKDIR}/kdump.conf ${D}${sysconfdir}/sysconfig
-}
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools_2.0.14.bb b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools_2.0.14.bb
new file mode 100644
index 0000000..90d5985
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kexec/kexec-tools_2.0.14.bb
@@ -0,0 +1,48 @@
+require kexec-tools.inc
+export LDFLAGS = "-L${STAGING_LIBDIR}"
+EXTRA_OECONF = " --with-zlib=yes"
+
+SRC_URI += "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz \
+            file://0002-powerpc-change-the-memory-size-limit.patch \
+            file://0001-purgatory-Pass-r-directly-to-linker.patch \
+            file://0001-vmcore-dmesg-Define-_GNU_SOURCE.patch \
+            file://0001-kexec-exntend-the-semantics-of-kexec_iomem_for_each_.patch \
+            file://0002-kexec-generalize-and-rename-get_kernel_stext_sym.patch \
+            file://0003-arm64-identify-PHYS_OFFSET-correctly.patch \
+            file://0004-arm64-kdump-identify-memory-regions.patch \
+            file://0005-arm64-kdump-add-elf-core-header-segment.patch \
+            file://0006-arm64-kdump-set-up-kernel-image-segment.patch \
+            file://0007-arm64-kdump-set-up-other-segments.patch \
+            file://0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch \
+            file://0009-arm64-kdump-Add-support-for-binary-image-files.patch \
+            file://0010-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch \
+            file://0001-x86-x86_64-Fix-format-warning-with-die.patch \
+            file://0002-ppc-Fix-format-warning-with-die.patch \
+            file://kexec-x32.patch \
+         "
+
+SRC_URI[md5sum] = "b2b2c5e6b29d467d6e99d587fb6b7cf5"
+SRC_URI[sha256sum] = "b3e69519d2acced256843b1e8f1ecfa00d9b54fa07449ed78f05b9193f239370"
+
+PACKAGES =+ "kexec kdump vmcore-dmesg"
+
+ALLOW_EMPTY_${PN} = "1"
+RRECOMMENDS_${PN} = "kexec kdump vmcore-dmesg"
+
+FILES_kexec = "${sbindir}/kexec"
+FILES_kdump = "${sbindir}/kdump ${sysconfdir}/init.d/kdump \
+               ${sysconfdir}/sysconfig/kdump.conf"
+FILES_vmcore-dmesg = "${sbindir}/vmcore-dmesg"
+
+inherit update-rc.d
+
+INITSCRIPT_PACKAGES = "kdump"
+INITSCRIPT_NAME_kdump = "kdump"
+INITSCRIPT_PARAMS_kdump = "start 56 2 3 4 5 . stop 56 0 1 6 ."
+
+do_install_append () {
+        install -d ${D}${sysconfdir}/init.d
+        install -m 0755 ${WORKDIR}/kdump ${D}${sysconfdir}/init.d/kdump
+        install -d ${D}${sysconfdir}/sysconfig
+        install -m 0644 ${WORKDIR}/kdump.conf ${D}${sysconfdir}/sysconfig
+}
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb b/import-layers/yocto-poky/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
index 5c7dd52..44d013f 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
@@ -1,6 +1,5 @@
 SUMMARY = "Wrapper script for the Linux kernel module dependency indexer"
 LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
 S = "${WORKDIR}"
 
@@ -10,6 +9,9 @@
 
 # We need the following for the sstate code to process the wrapper
 SSTATE_SCAN_FILES += "depmodwrapper"
+EXTRA_STAGING_FIXMES += "PKGDATA_DIR"
+
+do_populate_sysroot[depends] = ""
 
 do_install() {
 	install -d ${D}${bindir_crossscripts}/
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kmod/kmod.inc b/import-layers/yocto-poky/meta/recipes-kernel/kmod/kmod.inc
index 166b3f0..ba80fc5 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/kmod/kmod.inc
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kmod/kmod.inc
@@ -12,7 +12,7 @@
 LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \
                     file://libkmod/COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \
                    "
-inherit autotools gtk-doc pkgconfig
+inherit autotools gtk-doc pkgconfig manpages
 
 SRCREV = "65a885df5f6f15222b44fd695c5eaca17e837a14"
 # Lookout for PV bump too when SRCREV is changed
@@ -22,15 +22,19 @@
            file://depmod-search.conf \
            file://avoid_parallel_tests.patch \
            file://fix-O_CLOEXEC.patch \
+           file://kcmdline_quotes.patch \
           "
 
 S = "${WORKDIR}/git"
 
 EXTRA_AUTORECONF += "--install --symlink"
-EXTRA_OECONF +=" --enable-tools --disable-manpages --with-zlib"
+EXTRA_OECONF +=" --enable-tools --with-zlib"
+
+CACHED_CONFIGUREVARS += "ac_cv_path_DOLT_BASH='/usr/bin/env bash'"
 
 PACKAGECONFIG[debug] = "--enable-debug,--disable-debug"
 PACKAGECONFIG[logging] = " --enable-logging,--disable-logging"
+PACKAGECONFIG[manpages] = "--enable-manpages, --disable-manpages, libxslt-native xmlto-native"
 
 do_configure_prepend () {
         gtkdocize --docdir ${S}/libkmod/docs --srcdir ${S}
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/kmod/kmod/kcmdline_quotes.patch b/import-layers/yocto-poky/meta/recipes-kernel/kmod/kmod/kcmdline_quotes.patch
new file mode 100644
index 0000000..46bdec5
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/kmod/kmod/kcmdline_quotes.patch
@@ -0,0 +1,44 @@
+From 4a6f92a10680e7e36807f5e2ae8e497e8d73a048 Mon Sep 17 00:00:00 2001
+From: James Minor <james.minor@ni.com>
+Date: Fri, 20 Jan 2017 17:15:50 -0600
+Subject: [PATCH] libkmod: Fix handling of quotes in kernel command line
+
+If a module parameter on the command line contains quotes, any
+spaces inside those quotes should be included as part of the
+parameter.
+
+Signed-off-by: James Minor <james.minor@ni.com>
+
+Upstream-Status: Accepted
+---
+ libkmod/libkmod-config.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
+index 57fbe37..ea40d19 100644
+--- a/libkmod/libkmod-config.c
++++ b/libkmod/libkmod-config.c
+@@ -497,6 +497,7 @@ static int kmod_config_parse_kcmdline(struct kmod_config *config)
+ 	char buf[KCMD_LINE_SIZE];
+ 	int fd, err;
+ 	char *p, *modname,  *param = NULL, *value = NULL, is_module = 1;
++	bool is_quoted = false;
+ 
+ 	fd = open("/proc/cmdline", O_RDONLY|O_CLOEXEC);
+ 	if (fd < 0) {
+@@ -514,6 +515,12 @@ static int kmod_config_parse_kcmdline(struct kmod_config *config)
+ 	}
+ 
+ 	for (p = buf, modname = buf; *p != '\0' && *p != '\n'; p++) {
++		if (*p == '"') {
++			is_quoted = !is_quoted;
++			continue;
++		}
++		if (is_quoted)
++			continue;
+ 		switch (*p) {
+ 		case ' ':
+ 			*p = '\0';
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/latencytop/latencytop_0.5.bb b/import-layers/yocto-poky/meta/recipes-kernel/latencytop/latencytop_0.5.bb
index f31f1bb..eb19471 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/latencytop/latencytop_0.5.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/latencytop/latencytop_0.5.bb
@@ -4,6 +4,8 @@
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://latencytop.c;endline=23;md5=ee9ea9b1415356e5734adad4a87dc7fa"
 
+inherit pkgconfig
+
 DEPENDS = "virtual/libintl ncurses glib-2.0"
 
 PR = "r3"
@@ -17,7 +19,7 @@
 SRC_URI[md5sum] = "73bb3371c6ee0b0e68e25289027e865c"
 SRC_URI[sha256sum] = "9e7f72fbea7bd918e71212a1eabaad8488d2c602205d2e3c95d62cd57e9203ef"
 
-PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
 
 PACKAGECONFIG[x11] = ",,gtk+"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux-firmware/linux-firmware_git.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux-firmware/linux-firmware_git.bb
index 8e68ae8..ff60d30 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux-firmware/linux-firmware_git.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux-firmware/linux-firmware_git.bb
@@ -19,6 +19,7 @@
     & Firmware-ene_firmware \
     & Firmware-fw_sst_0f28 \
     & Firmware-go7007 \
+    & Firmware-GPLv2 \
     & Firmware-hfi1_firmware \
     & Firmware-i2400m \
     & Firmware-i915 \
@@ -29,8 +30,8 @@
     & Firmware-kaweth \
     & Firmware-Marvell \
     & Firmware-moxa \
-    & Firmware-mwl8335 \
     & Firmware-myri10ge_firmware \
+    & Firmware-netronome \
     & Firmware-nvidia \
     & Firmware-OLPC \
     & Firmware-ath9k-htc \
@@ -45,6 +46,7 @@
     & Firmware-ralink_a_mediatek_company_firmware \
     & Firmware-ralink-firmware \
     & Firmware-rtlwifi_firmware \
+    & Firmware-imx-sdma_firmware \
     & Firmware-siano \
     & Firmware-tda7706-firmware \
     & Firmware-ti-connectivity \
@@ -62,7 +64,7 @@
     file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
     file://LICENCE.adsp_sst;md5=615c45b91a5a4a9fe046d6ab9a2df728 \
     file://LICENCE.agere;md5=af0133de6b4a9b2522defd5f188afd31 \
-    file://LICENSE.amdgpu;md5=3fe8a3430700a518990c3b3d75297209 \
+    file://LICENSE.amdgpu;md5=0aa3c2f3e736af320a08a3aeeccecf29 \
     file://LICENSE.amd-ucode;md5=3a0de451253cc1edbf30a3c621effee3 \
     file://LICENCE.atheros_firmware;md5=30a14c7823beedac9fa39c64fdd01a13 \
     file://LICENSE.atmel;md5=aa74ac0c60595dee4d4e239107ea77a3 \
@@ -76,6 +78,7 @@
     file://LICENCE.ene_firmware;md5=ed67f0f62f8f798130c296720b7d3921 \
     file://LICENCE.fw_sst_0f28;md5=6353931c988ad52818ae733ac61cd293 \
     file://LICENCE.go7007;md5=c0bb9f6aaaba55b0529ee9b30aa66beb \
+    file://GPL-2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
     file://LICENSE.hfi1_firmware;md5=5e7b6e586ce7339d12689e49931ad444 \
     file://LICENCE.i2400m;md5=14b901969e23c41881327c0d9e4b7d36 \
     file://LICENSE.i915;md5=2b0b2e0d20984affd4490ba2cba02570 \
@@ -86,23 +89,24 @@
     file://LICENCE.kaweth;md5=b1d876e562f4b3b8d391ad8395dfe03f \
     file://LICENCE.Marvell;md5=9ddea1734a4baf3c78d845151f42a37a \
     file://LICENCE.moxa;md5=1086614767d8ccf744a923289d3d4261 \
-    file://LICENCE.mwl8335;md5=9a6271ee0e644404b2ff3c61fd070983 \
     file://LICENCE.myri10ge_firmware;md5=42e32fb89f6b959ca222e25ac8df8fed \
+    file://LICENCE.Netronome;md5=cd2a3e6effe3cdf42731575b8e9477ed \
     file://LICENCE.nvidia;md5=4428a922ed3ba2ceec95f076a488ce07 \
     file://LICENCE.OLPC;md5=5b917f9d8c061991be4f6f5f108719cd \
     file://LICENCE.open-ath9k-htc-firmware;md5=1b33c9f4d17bc4d457bdb23727046837 \
     file://LICENCE.phanfw;md5=954dcec0e051f9409812b561ea743bfa \
     file://LICENCE.qat_firmware;md5=9e7d8bea77612d7cc7d9e9b54b623062 \
     file://LICENCE.qla1280;md5=d6895732e622d950609093223a2c4f5d \
-    file://LICENCE.qla2xxx;md5=f5ce8529ec5c17cb7f911d2721d90e91 \
+    file://LICENCE.qla2xxx;md5=505855e921b75f1be4a437ad9b79dff0 \
     file://LICENSE.QualcommAtheros_ar3k;md5=b5fe244fb2b532311de1472a3bc06da5 \
-    file://LICENSE.QualcommAtheros_ath10k;md5=b5fe244fb2b532311de1472a3bc06da5 \
+    file://LICENSE.QualcommAtheros_ath10k;md5=cb42b686ee5f5cb890275e4321db60a8 \
     file://LICENCE.r8a779x_usb3;md5=4c1671656153025d7076105a5da7e498 \
-    file://LICENSE.radeon;md5=69612f4f7b141a97659cb1d609a1bde2 \
+    file://LICENSE.radeon;md5=68ec28bacb3613200bca44f404c69b16 \
     file://LICENCE.ralink_a_mediatek_company_firmware;md5=728f1a85fd53fd67fa8d7afb080bc435 \
     file://LICENCE.ralink-firmware.txt;md5=ab2c269277c45476fb449673911a2dfd \
     file://LICENCE.rtlwifi_firmware.txt;md5=00d06cfd3eddd5a2698948ead2ad54a5 \
-    file://LICENCE.siano;md5=602c79ae3f98f1e73d880fd9f940a418 \
+    file://LICENSE.sdma_firmware;md5=51e8c19ecc2270f4b8ea30341ad63ce9 \
+    file://LICENCE.siano;md5=4556c1bf830067f12ca151ad953ec2a5 \
     file://LICENCE.tda7706-firmware.txt;md5=835997cf5e3c131d0dddd695c7d9103e \
     file://LICENCE.ti-connectivity;md5=c5e02be633f1499c109d1652514d85ec \
     file://LICENCE.ti-keystone;md5=3a86335d32864b0bef996bee26cc0f2c \
@@ -112,7 +116,7 @@
     file://LICENCE.xc4000;md5=0ff51d2dc49fce04814c9155081092f0 \
     file://LICENCE.xc5000;md5=1e170c13175323c32c7f4d0998d53f66 \
     file://LICENCE.xc5000c;md5=12b02efa3049db65d524aeb418dd87ca \
-    file://WHENCE;md5=f514a0c53c5d73c2fe98d5861103f0c6 \
+    file://WHENCE;md5=038edbc9e744171d8b6235e0224028ba \
 "
 
 # These are not common licenses, set NO_GENERIC_LICENSE for them
@@ -134,6 +138,7 @@
 NO_GENERIC_LICENSE[Firmware-ene_firmware] = "LICENCE.ene_firmware"
 NO_GENERIC_LICENSE[Firmware-fw_sst_0f28] = "LICENCE.fw_sst_0f28"
 NO_GENERIC_LICENSE[Firmware-go7007] = "LICENCE.go7007"
+NO_GENERIC_LICENSE[Firmware-GPLv2] = "GPL-2"
 NO_GENERIC_LICENSE[Firmware-hfi1_firmware] = "LICENSE.hfi1_firmware"
 NO_GENERIC_LICENSE[Firmware-i2400m] = "LICENCE.i2400m"
 NO_GENERIC_LICENSE[Firmware-i915] = "LICENSE.i915"
@@ -144,8 +149,8 @@
 NO_GENERIC_LICENSE[Firmware-kaweth] = "LICENCE.kaweth"
 NO_GENERIC_LICENSE[Firmware-Marvell] = "LICENCE.Marvell"
 NO_GENERIC_LICENSE[Firmware-moxa] = "LICENCE.moxa"
-NO_GENERIC_LICENSE[Firmware-mwl8335] = "LICENCE.mwl8335"
 NO_GENERIC_LICENSE[Firmware-myri10ge_firmware] = "LICENCE.myri10ge_firmware"
+NO_GENERIC_LICENSE[Firmware-netronome] = "LICENCE.Netronome"
 NO_GENERIC_LICENSE[Firmware-nvidia] = "LICENCE.nvidia"
 NO_GENERIC_LICENSE[Firmware-OLPC] = "LICENCE.OLPC"
 NO_GENERIC_LICENSE[Firmware-ath9k-htc] = "LICENCE.open-ath9k-htc-firmware"
@@ -161,6 +166,7 @@
 NO_GENERIC_LICENSE[Firmware-ralink-firmware] = "LICENCE.ralink-firmware.txt"
 NO_GENERIC_LICENSE[Firmware-rtlwifi_firmware] = "LICENCE.rtlwifi_firmware.txt"
 NO_GENERIC_LICENSE[Firmware-siano] = "LICENCE.siano"
+NO_GENERIC_LICENSE[Firmware-imx-sdma_firmware] = "LICENSE.sdma_firmware"
 NO_GENERIC_LICENSE[Firmware-tda7706-firmware] = "LICENCE.tda7706-firmware.txt"
 NO_GENERIC_LICENSE[Firmware-ti-connectivity] = "LICENCE.ti-connectivity"
 NO_GENERIC_LICENSE[Firmware-ti-keystone] = "LICENCE.ti-keystone"
@@ -172,21 +178,15 @@
 NO_GENERIC_LICENSE[Firmware-xc5000c] = "LICENCE.xc5000c"
 NO_GENERIC_LICENSE[WHENCE] = "WHENCE"
 
-SRCREV = "42ad5367dd38371b2a1bb263b6efa85f9b92fc93"
+SRCREV = "bf04291309d3169c0ad3b8db52564235bbd08e30"
 PE = "1"
 PV = "0.0+git${SRCPV}"
 
 SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"
 
-# Some devices need a specific version, not the latest
-SRC_URI += "https://git.kernel.org/cgit/linux/kernel/git/iwlwifi/linux-firmware.git/plain/iwlwifi-8000C-19.ucode;name=iwlwifi-19"
-
-SRC_URI[iwlwifi-19.md5sum] = "132fbaee36beec5e98714f0bd66f7a1d"
-SRC_URI[iwlwifi-19.sha256sum] = "2034470df64d323b827c4f2d4d0d55be2846b7360179b5574aa28ff77b6c9471"
-
 S = "${WORKDIR}/git"
 
-inherit allarch update-alternatives
+inherit allarch
 
 CLEANBROKEN = "1"
 
@@ -195,53 +195,67 @@
 }
 
 do_install() {
-	install -d  ${D}/lib/firmware/
-	cp -r * ${D}/lib/firmware/
+	install -d  ${D}${nonarch_base_libdir}/firmware/
+	cp -r * ${D}${nonarch_base_libdir}/firmware/
 
 	# Avoid Makefile to be deployed
-	rm ${D}/lib/firmware/Makefile
+	rm ${D}${nonarch_base_libdir}/firmware/Makefile
 
 	# Remove unbuild firmware which needs cmake and bash
-	rm ${D}/lib/firmware/carl9170fw -rf
+	rm ${D}${nonarch_base_libdir}/firmware/carl9170fw -rf
 
 	# Remove pointless bash script
-	rm ${D}/lib/firmware/configure
+	rm ${D}${nonarch_base_libdir}/firmware/configure
+
+	# Remove python script used to check the WHENCE file
+	rm ${D}${nonarch_base_libdir}/firmware/check_whence.py
 
 	# Libertas sd8686
-	ln -sf libertas/sd8686_v9.bin ${D}/lib/firmware/sd8686.bin
-	ln -sf libertas/sd8686_v9_helper.bin ${D}/lib/firmware/sd8686_helper.bin
+	ln -sf libertas/sd8686_v9.bin ${D}${nonarch_base_libdir}/firmware/sd8686.bin
+	ln -sf libertas/sd8686_v9_helper.bin ${D}${nonarch_base_libdir}/firmware/sd8686_helper.bin
 
 	# fixup wl12xx location, after 2.6.37 the kernel searches a different location for it
-	( cd ${D}/lib/firmware ; ln -sf ti-connectivity/* . )
+	( cd ${D}${nonarch_base_libdir}/firmware ; ln -sf ti-connectivity/* . )
 
-        # Copy the iwlwifi ucode
-        cp ${WORKDIR}/iwlwifi-8000C-19.ucode ${D}/lib/firmware/
 }
 
 
 PACKAGES =+ "${PN}-ralink-license ${PN}-ralink \
+             ${PN}-mt7601u-license ${PN}-mt7601u \
              ${PN}-radeon-license ${PN}-radeon \
-             ${PN}-marvell-license ${PN}-sd8686 ${PN}-sd8688 ${PN}-sd8787 ${PN}-sd8797 \
+             ${PN}-marvell-license ${PN}-pcie8897 ${PN}-pcie8997 \
+             ${PN}-sd8686 ${PN}-sd8688 ${PN}-sd8787 ${PN}-sd8797 ${PN}-sd8801 ${PN}-sd8887 ${PN}-sd8897 \
              ${PN}-ti-connectivity-license ${PN}-wl12xx ${PN}-wl18xx \
              ${PN}-vt6656-license ${PN}-vt6656 \
-             ${PN}-rtl-license ${PN}-rtl8192cu ${PN}-rtl8192ce ${PN}-rtl8192su \
-             ${PN}-broadcom-license ${PN}-bcm4329 ${PN}-bcm4330 ${PN}-bcm4334 ${PN}-bcm43340 ${PN}-bcm4339 ${PN}-bcm43430 ${PN}-bcm4354 \
-             ${PN}-atheros-license ${PN}-ar9170 ${PN}-carl9170 ${PN}-ath6k ${PN}-ath9k \
-             ${PN}-ar3k-license  ${PN}-ar3k  ${PN}-ath10k-license  ${PN}-ath10k  \
+             ${PN}-rtl-license ${PN}-rtl8188 ${PN}-rtl8192cu ${PN}-rtl8192ce ${PN}-rtl8192su ${PN}-rtl8723 ${PN}-rtl8821 \
+             ${PN}-broadcom-license \
+             ${PN}-bcm4329 ${PN}-bcm4330 ${PN}-bcm4334 ${PN}-bcm43340 \
+             ${PN}-bcm43362 ${PN}-bcm4339 ${PN}-bcm43430 ${PN}-bcm4354 \
+             ${PN}-atheros-license ${PN}-ar9170 ${PN}-ath6k ${PN}-ath9k \
+             ${PN}-gplv2-license ${PN}-carl9170 \
+             ${PN}-ar3k-license ${PN}-ar3k ${PN}-ath10k-license ${PN}-ath10k ${PN}-qca \
+             \
+             ${PN}-imx-sdma-license ${PN}-imx-sdma-imx6q ${PN}-imx-sdma-imx7d \
              \
              ${PN}-iwlwifi-license ${PN}-iwlwifi \
              ${PN}-iwlwifi-135-6 \
              ${PN}-iwlwifi-3160-7 ${PN}-iwlwifi-3160-8 ${PN}-iwlwifi-3160-9 \
+             ${PN}-iwlwifi-3160-10 ${PN}-iwlwifi-3160-12 ${PN}-iwlwifi-3160-13 \
+             ${PN}-iwlwifi-3160-16 ${PN}-iwlwifi-3160-17 \
              ${PN}-iwlwifi-6000-4 ${PN}-iwlwifi-6000g2a-5 ${PN}-iwlwifi-6000g2a-6 \
              ${PN}-iwlwifi-6000g2b-5 ${PN}-iwlwifi-6000g2b-6 \
              ${PN}-iwlwifi-6050-4 ${PN}-iwlwifi-6050-5 \
              ${PN}-iwlwifi-7260 \
              ${PN}-iwlwifi-7265 \
-             ${PN}-iwlwifi-7265d ${PN}-iwlwifi-8000c ${PN}-iwlwifi-8265 \
+             ${PN}-iwlwifi-7265d ${PN}-iwlwifi-8265 \
              ${PN}-iwlwifi-misc \
+             ${PN}-ibt-license ${PN}-ibt ${PN}-ibt-misc \
+             ${PN}-ibt-11-5 ${PN}-ibt-12-16 ${PN}-ibt-hw-37-7 ${PN}-ibt-hw-37-8 \
              ${PN}-i915-license ${PN}-i915 \
              ${PN}-adsp-sst-license ${PN}-adsp-sst \
              ${PN}-bnx2-mips \
+             ${PN}-netronome-license ${PN}-netronome \
+             ${PN}-qat ${PN}-qat-license \
              ${PN}-whence-license \
              ${PN}-license \
              "
@@ -252,135 +266,216 @@
 LICENSE_${PN}-ath9k = "Firmware-atheros_firmware"
 LICENSE_${PN}-atheros-license = "Firmware-atheros_firmware"
 
-FILES_${PN}-atheros-license = "/lib/firmware/LICENCE.atheros_firmware"
+FILES_${PN}-atheros-license = "${nonarch_base_libdir}/firmware/LICENCE.atheros_firmware"
 FILES_${PN}-ar9170 = " \
-  /lib/firmware/ar9170*.fw \
-"
-FILES_${PN}-carl9170 = " \
-  /lib/firmware/carl9170*.fw \
+  ${nonarch_base_libdir}/firmware/ar9170*.fw \
 "
 FILES_${PN}-ath6k = " \
-  /lib/firmware/ath6k \
+  ${nonarch_base_libdir}/firmware/ath6k \
 "
 FILES_${PN}-ath9k = " \
-  /lib/firmware/ar9271.fw \
-  /lib/firmware/ar7010*.fw \
-  /lib/firmware/htc_9271.fw \
-  /lib/firmware/htc_7010.fw \
+  ${nonarch_base_libdir}/firmware/ar9271.fw \
+  ${nonarch_base_libdir}/firmware/ar7010*.fw \
+  ${nonarch_base_libdir}/firmware/htc_9271.fw \
+  ${nonarch_base_libdir}/firmware/htc_7010.fw \
+  ${nonarch_base_libdir}/firmware/ath9k_htc/htc_7010-1.4.0.fw \
+  ${nonarch_base_libdir}/firmware/ath9k_htc/htc_9271-1.4.0.fw \
 "
 
 RDEPENDS_${PN}-ar9170 += "${PN}-atheros-license"
-RDEPENDS_${PN}-carl9170 += "${PN}-atheros-license"
 RDEPENDS_${PN}-ath6k += "${PN}-atheros-license"
 RDEPENDS_${PN}-ath9k += "${PN}-atheros-license"
 
+# For carl9170
+LICENSE_${PN}-carl9170 = "Firmware-GPLv2"
+LICENSE_${PN}-gplv2-license = "Firmware-GPLv2"
+
+FILES_${PN}-gplv2-license = "${nonarch_base_libdir}/firmware/GPL-2"
+FILES_${PN}-carl9170 = " \
+  ${nonarch_base_libdir}/firmware/carl9170*.fw \
+"
+
+RDEPENDS_${PN}-carl9170 += "${PN}-gplv2-license"
+
 # For QualCommAthos
 LICENSE_${PN}-ar3k = "Firmware-qualcommAthos_ar3k"
 LICENSE_${PN}-ar3k-license = "Firmware-qualcommAthos_ar3k"
 LICENSE_${PN}-ath10k = "Firmware-qualcommAthos_ath10k"
 LICENSE_${PN}-ath10k-license = "Firmware-qualcommAthos_ath10k"
+LICENSE_${PN}-qca = "Firmware-qualcommAthos_ath10k"
 
-FILES_${PN}-ar3k-license = "/lib/firmware/LICENSE.QualcommAtheros_ar3k"
+FILES_${PN}-ar3k-license = "${nonarch_base_libdir}/firmware/LICENSE.QualcommAtheros_ar3k"
 FILES_${PN}-ar3k = " \
-  /lib/firmware/ar3k \
+  ${nonarch_base_libdir}/firmware/ar3k \
 "
 
-FILES_${PN}-ath10k-license = "/lib/firmware/LICENSE.QualcommAtheros_ath10k"
+FILES_${PN}-ath10k-license = "${nonarch_base_libdir}/firmware/LICENSE.QualcommAtheros_ath10k"
 FILES_${PN}-ath10k = " \
-  /lib/firmware/ath10k \
+  ${nonarch_base_libdir}/firmware/ath10k \
+"
+
+FILES_${PN}-qca = " \
+  ${nonarch_base_libdir}/firmware/qca \
 "
 
 RDEPENDS_${PN}-ar3k += "${PN}-ar3k-license"
 RDEPENDS_${PN}-ath10k += "${PN}-ath10k-license"
+RDEPENDS_${PN}-qca += "${PN}-ath10k-license"
 
 # For ralink
 LICENSE_${PN}-ralink = "Firmware-ralink-firmware"
 LICENSE_${PN}-ralink-license = "Firmware-ralink-firmware"
 
-FILES_${PN}-ralink-license = "/lib/firmware/LICENCE.ralink-firmware.txt"
+FILES_${PN}-ralink-license = "${nonarch_base_libdir}/firmware/LICENCE.ralink-firmware.txt"
 FILES_${PN}-ralink = " \
-  /lib/firmware/rt*.bin \
+  ${nonarch_base_libdir}/firmware/rt*.bin \
 "
 
 RDEPENDS_${PN}-ralink += "${PN}-ralink-license"
 
+# For mediatek MT7601U
+LICENSE_${PN}-mt7601u = "Firmware-ralink_a_mediatek_company_firmware"
+LICENSE_${PN}-mt7601u-license = "Firmware-ralink_a_mediatek_company_firmware"
+
+FILES_${PN}-mt7601u-license = "${nonarch_base_libdir}/firmware/LICENCE.ralink_a_mediatek_company_firmware"
+FILES_${PN}-mt7601u = " \
+  ${nonarch_base_libdir}/firmware/mt7601u.bin \
+"
+
+RDEPENDS_${PN}-mt7601u += "${PN}-mt7601u-license"
+
 # For radeon
 LICENSE_${PN}-radeon = "Firmware-radeon"
 LICENSE_${PN}-radeon-license = "Firmware-radeon"
 
-FILES_${PN}-radeon-license = "/lib/firmware/LICENSE.radeon"
+FILES_${PN}-radeon-license = "${nonarch_base_libdir}/firmware/LICENSE.radeon"
 FILES_${PN}-radeon = " \
-  /lib/firmware/radeon \
+  ${nonarch_base_libdir}/firmware/radeon \
 "
 
 RDEPENDS_${PN}-radeon += "${PN}-radeon-license"
 
 # For marvell
+LICENSE_${PN}-pcie8897 = "Firmware-Marvell"
+LICENSE_${PN}-pcie8997 = "Firmware-Marvell"
 LICENSE_${PN}-sd8686 = "Firmware-Marvell"
 LICENSE_${PN}-sd8688 = "Firmware-Marvell"
 LICENSE_${PN}-sd8787 = "Firmware-Marvell"
 LICENSE_${PN}-sd8797 = "Firmware-Marvell"
+LICENSE_${PN}-sd8801 = "Firmware-Marvell"
+LICENSE_${PN}-sd8887 = "Firmware-Marvell"
+LICENSE_${PN}-sd8897 = "Firmware-Marvell"
 LICENSE_${PN}-marvell-license = "Firmware-Marvell"
 
-FILES_${PN}-marvell-license = "/lib/firmware/LICENCE.Marvell"
+FILES_${PN}-marvell-license = "${nonarch_base_libdir}/firmware/LICENCE.Marvell"
+FILES_${PN}-pcie8897 = " \
+  ${nonarch_base_libdir}/firmware/mrvl/pcie8897_uapsta.bin \
+"
+FILES_${PN}-pcie8997 = " \
+  ${nonarch_base_libdir}/firmware/mrvl/pcie8997_wlan_v4.bin \
+  ${nonarch_base_libdir}/firmware/mrvl/pcieuart8997_combo_v4.bin \
+  ${nonarch_base_libdir}/firmware/mrvl/pcieusb8997_combo_v4.bin \
+"
 FILES_${PN}-sd8686 = " \
-  /lib/firmware/libertas/sd8686_v9* \
-  /lib/firmware/sd8686* \
+  ${nonarch_base_libdir}/firmware/libertas/sd8686_v9* \
+  ${nonarch_base_libdir}/firmware/sd8686* \
 "
 FILES_${PN}-sd8688 = " \
-  /lib/firmware/libertas/sd8688* \
-  /lib/firmware/mrvl/sd8688* \
+  ${nonarch_base_libdir}/firmware/libertas/sd8688* \
+  ${nonarch_base_libdir}/firmware/mrvl/sd8688* \
 "
 FILES_${PN}-sd8787 = " \
-  /lib/firmware/mrvl/sd8787_uapsta.bin \
+  ${nonarch_base_libdir}/firmware/mrvl/sd8787_uapsta.bin \
 "
 FILES_${PN}-sd8797 = " \
-  /lib/firmware/mrvl/sd8797_uapsta.bin \
+  ${nonarch_base_libdir}/firmware/mrvl/sd8797_uapsta.bin \
+"
+FILES_${PN}-sd8801 = " \
+  ${nonarch_base_libdir}/firmware/mrvl/sd8801_uapsta.bin \
+"
+FILES_${PN}-sd8887 = " \
+  ${nonarch_base_libdir}/firmware/mrvl/sd8887_uapsta.bin \
+"
+FILES_${PN}-sd8897 = " \
+  ${nonarch_base_libdir}/firmware/mrvl/sd8897_uapsta.bin \
 "
 
 RDEPENDS_${PN}-sd8686 += "${PN}-marvell-license"
 RDEPENDS_${PN}-sd8688 += "${PN}-marvell-license"
 RDEPENDS_${PN}-sd8787 += "${PN}-marvell-license"
 RDEPENDS_${PN}-sd8797 += "${PN}-marvell-license"
+RDEPENDS_${PN}-sd8801 += "${PN}-marvell-license"
+RDEPENDS_${PN}-sd8887 += "${PN}-marvell-license"
+RDEPENDS_${PN}-sd8897 += "${PN}-marvell-license"
+
+# For netronome
+LICENSE_${PN}-netronome = "Firmware-netronome"
+
+FILES_${PN}-netronome-license = " \
+  ${nonarch_base_libdir}/firmware/LICENCE.Netronome \
+"
+FILES_${PN}-netronome = " \
+  ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0081*.nffw \
+  ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0096*.nffw \
+  ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0097*.nffw \
+  ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0099*.nffw \
+"
+
+RDEPENDS_${PN}-netronome += "${PN}-netronome-license"
 
 # For rtl
+LICENSE_${PN}-rtl8188 = "Firmware-rtlwifi_firmware"
 LICENSE_${PN}-rtl8192cu = "Firmware-rtlwifi_firmware"
 LICENSE_${PN}-rtl8192ce = "Firmware-rtlwifi_firmware"
 LICENSE_${PN}-rtl8192su = "Firmware-rtlwifi_firmware"
+LICENSE_${PN}-rtl8723 = "Firmware-rtlwifi_firmware"
+LICENSE_${PN}-rtl8821 = "Firmware-rtlwifi_firmware"
 LICENSE_${PN}-rtl-license = "Firmware-rtlwifi_firmware"
 
 FILES_${PN}-rtl-license = " \
-  /lib/firmware/LICENCE.rtlwifi_firmware.txt \
+  ${nonarch_base_libdir}/firmware/LICENCE.rtlwifi_firmware.txt \
+"
+FILES_${PN}-rtl8188 = " \
+  ${nonarch_base_libdir}/firmware/rtlwifi/rtl8188*.bin \
 "
 FILES_${PN}-rtl8192cu = " \
-  /lib/firmware/rtlwifi/rtl8192cufw*.bin \
+  ${nonarch_base_libdir}/firmware/rtlwifi/rtl8192cufw*.bin \
 "
 FILES_${PN}-rtl8192ce = " \
-  /lib/firmware/rtlwifi/rtl8192cfw*.bin \
+  ${nonarch_base_libdir}/firmware/rtlwifi/rtl8192cfw*.bin \
 "
 FILES_${PN}-rtl8192su = " \
-  /lib/firmware/rtlwifi/rtl8712u.bin \
+  ${nonarch_base_libdir}/firmware/rtlwifi/rtl8712u.bin \
+"
+FILES_${PN}-rtl8723 = " \
+  ${nonarch_base_libdir}/firmware/rtlwifi/rtl8723*.bin \
+"
+FILES_${PN}-rtl8821 = " \
+  ${nonarch_base_libdir}/firmware/rtlwifi/rtl8821*.bin \
 "
 
+RDEPENDS_${PN}-rtl8188 += "${PN}-rtl-license"
 RDEPENDS_${PN}-rtl8192ce += "${PN}-rtl-license"
 RDEPENDS_${PN}-rtl8192cu += "${PN}-rtl-license"
 RDEPENDS_${PN}-rtl8192su = "${PN}-rtl-license"
+RDEPENDS_${PN}-rtl8723 += "${PN}-rtl-license"
+RDEPENDS_${PN}-rtl8821 += "${PN}-rtl-license"
 
 # For ti-connectivity
 LICENSE_${PN}-wl12xx = "Firmware-ti-connectivity"
 LICENSE_${PN}-wl18xx = "Firmware-ti-connectivity"
 LICENSE_${PN}-ti-connectivity-license = "Firmware-ti-connectivity"
 
-FILES_${PN}-ti-connectivity-license = "/lib/firmware/LICENCE.ti-connectivity"
+FILES_${PN}-ti-connectivity-license = "${nonarch_base_libdir}/firmware/LICENCE.ti-connectivity"
 FILES_${PN}-wl12xx = " \
-  /lib/firmware/wl12* \
-  /lib/firmware/TI* \
-  /lib/firmware/ti-connectivity \
+  ${nonarch_base_libdir}/firmware/wl12* \
+  ${nonarch_base_libdir}/firmware/TI* \
+  ${nonarch_base_libdir}/firmware/ti-connectivity \
 "
 FILES_${PN}-wl18xx = " \
-  /lib/firmware/wl18* \
-  /lib/firmware/TI* \
-  /lib/firmware/ti-connectivity \
+  ${nonarch_base_libdir}/firmware/wl18* \
+  ${nonarch_base_libdir}/firmware/TI* \
+  ${nonarch_base_libdir}/firmware/ti-connectivity \
 "
 
 RDEPENDS_${PN}-wl12xx = "${PN}-ti-connectivity-license"
@@ -390,75 +485,58 @@
 LICENSE_${PN}-vt6656 = "Firmware-via_vt6656"
 LICENSE_${PN}-vt6656-license = "Firmware-via_vt6656"
 
-FILES_${PN}-vt6656-license = "/lib/firmware/LICENCE.via_vt6656"
+FILES_${PN}-vt6656-license = "${nonarch_base_libdir}/firmware/LICENCE.via_vt6656"
 FILES_${PN}-vt6656 = " \
-  /lib/firmware/vntwusb.fw \
+  ${nonarch_base_libdir}/firmware/vntwusb.fw \
 "
 
 RDEPENDS_${PN}-vt6656 = "${PN}-vt6656-license"
 
 # For broadcom
-#
-# WARNING: The ALTERNATIVE_* variables are not using ${PN} because of
-# a bug in bitbake; when this is fixed and bitbake learns how to proper
-# pass variable flags with expansion we can rework this patch.
 
 LICENSE_${PN}-bcm4329 = "Firmware-broadcom_bcm43xx"
 LICENSE_${PN}-bcm4330 = "Firmware-broadcom_bcm43xx"
 LICENSE_${PN}-bcm4334 = "Firmware-broadcom_bcm43xx"
 LICENSE_${PN}-bcm43340 = "Firmware-broadcom_bcm43xx"
+LICENSE_${PN}-bcm43362 = "Firmware-broadcom_bcm43xx"
 LICENSE_${PN}-bcm4339 = "Firmware-broadcom_bcm43xx"
 LICENSE_${PN}-bcm43430 = "Firmware-broadcom_bcm43xx"
 LICENSE_${PN}-bcm4354 = "Firmware-broadcom_bcm43xx"
 LICENSE_${PN}-broadcom-license = "Firmware-broadcom_bcm43xx"
 
 FILES_${PN}-broadcom-license = " \
-  /lib/firmware/LICENCE.broadcom_bcm43xx \
+  ${nonarch_base_libdir}/firmware/LICENCE.broadcom_bcm43xx \
 "
 FILES_${PN}-bcm4329 = " \
-  /lib/firmware/brcm/brcmfmac4329-sdio.bin \
+  ${nonarch_base_libdir}/firmware/brcm/brcmfmac4329-sdio.bin \
 "
 FILES_${PN}-bcm4330 = " \
-  /lib/firmware/brcm/brcmfmac4330-sdio.bin \
+  ${nonarch_base_libdir}/firmware/brcm/brcmfmac4330-sdio.bin \
 "
 FILES_${PN}-bcm4334 = " \
-  /lib/firmware/brcm/brcmfmac4334-sdio.bin \
+  ${nonarch_base_libdir}/firmware/brcm/brcmfmac4334-sdio.bin \
 "
 FILES_${PN}-bcm43340 = " \
-  /lib/firmware/brcm/brcmfmac43340-sdio.bin \
+  ${nonarch_base_libdir}/firmware/brcm/brcmfmac43340-sdio.bin \
+"
+FILES_${PN}-bcm43362 = " \
+  ${nonarch_base_libdir}/firmware/brcm/brcmfmac43362-sdio.bin \
 "
 FILES_${PN}-bcm4339 = " \
-  /lib/firmware/brcm/brcmfmac4339-sdio.bin \
+  ${nonarch_base_libdir}/firmware/brcm/brcmfmac4339-sdio.bin \
 "
 FILES_${PN}-bcm43430 = " \
-  /lib/firmware/brcm/brcmfmac43430-sdio.bin \
+  ${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.bin \
 "
 FILES_${PN}-bcm4354 = " \
-  /lib/firmware/brcm/brcmfmac4354-sdio.bin \
+  ${nonarch_base_libdir}/firmware/brcm/brcmfmac4354-sdio.bin \
 "
 
-ALTERNATIVE_LINK_NAME[brcmfmac-sdio.bin] = "/lib/firmware/brcm/brcmfmac-sdio.bin"
-
-ALTERNATIVE_linux-firmware-bcm4334 = "brcmfmac-sdio.bin"
-ALTERNATIVE_TARGET_linux-firmware-bcm4334[brcmfmac-sdio.bin] = "/lib/firmware/brcm/brcmfmac4334-sdio.bin"
-ALTERNATIVE_linux-firmware-bcm43340 = "brcmfmac-sdio.bin"
-ALTERNATIVE_TARGET_linux-firmware-bcm43340[brcmfmac-sdio.bin] = "/lib/firmware/brcm/brcmfmac43340-sdio.bin"
-ALTERNATIVE_linux_firmware-bcm4354 = "brcmfmac-sdio.bin"
-ALTERNATIVE_TARGET_linux-firmware-bcm4354[brcmfmac-sdio.bin] = "/lib/firmware/brcm/brcmfmac4354-sdio.bin"
-ALTERNATIVE_linux-firmware-bcm4329 = "brcmfmac-sdio.bin"
-ALTERNATIVE_TARGET_linux-firmware-bcm4329[brcmfmac-sdio.bin] = "/lib/firmware/brcm/brcmfmac4329-sdio.bin"
-ALTERNATIVE_linux-firmware-bcm4330 = "brcmfmac-sdio.bin"
-ALTERNATIVE_TARGET_linux-firmware-bcm4330[brcmfmac-sdio.bin] = "/lib/firmware/brcm/brcmfmac4330-sdio.bin"
-ALTERNATIVE_linux-firmware-bcm4339 = "brcmfmac-sdio.bin"
-ALTERNATIVE_TARGET_linux-firmware-bcm4339[brcmfmac-sdio.bin] = "/lib/firmware/brcm/brcmfmac4339-sdio.bin"
-ALTERNATIVE_PRIORITY_linux-firmware-bcm4339[brcmfmac-sdio.bin] = "20"
-ALTERNATIVE_linux-firmware-bcm43430 = "brcmfmac-sdio.bin"
-ALTERNATIVE_TARGET_linux-firmware-bcm43430[brcmfmac-sdio.bin] = "/lib/firmware/brcm/brcmfmac43430-sdio.bin"
-
 RDEPENDS_${PN}-bcm4329 += "${PN}-broadcom-license"
 RDEPENDS_${PN}-bcm4330 += "${PN}-broadcom-license"
 RDEPENDS_${PN}-bcm4334 += "${PN}-broadcom-license"
 RDEPENDS_${PN}-bcm43340 += "${PN}-broadcom-license"
+RDEPENDS_${PN}-bcm43362 += "${PN}-broadcom-license"
 RDEPENDS_${PN}-bcm4339 += "${PN}-broadcom-license"
 RDEPENDS_${PN}-bcm43430 += "${PN}-broadcom-license"
 RDEPENDS_${PN}-bcm4354 += "${PN}-broadcom-license"
@@ -471,17 +549,40 @@
 LICENSE_${PN}-bnx2-mips = "WHENCE"
 LICENSE_${PN}-whence-license = "WHENCE"
 
-FILES_${PN}-bnx2-mips = "/lib/firmware/bnx2/bnx2-mips-09-6.2.1b.fw"
-FILES_${PN}-whence-license = "/lib/firmware/WHENCE"
+FILES_${PN}-bnx2-mips = "${nonarch_base_libdir}/firmware/bnx2/bnx2-mips-09-6.2.1b.fw"
+FILES_${PN}-whence-license = "${nonarch_base_libdir}/firmware/WHENCE"
 
 RDEPENDS_${PN}-bnx2-mips += "${PN}-whence-license"
 
+# For imx-sdma
+LICENSE_${PN}-imx-sdma-imx6q       = "Firmware-imx-sdma_firmware"
+LICENSE_${PN}-imx-sdma-imx7d       = "Firmware-imx-sdma_firmware"
+LICENSE_${PN}-imx-sdma-license       = "Firmware-imx-sdma_firmware"
+
+FILES_${PN}-imx-sdma-imx6q = "${nonarch_base_libdir}/firmware/imx/sdma/sdma-imx6q.bin"
+
+RPROVIDES_${PN}-imx-sdma-imx6q = "firmware-imx-sdma-imx6q"
+RREPLACES_${PN}-imx-sdma-imx6q = "firmware-imx-sdma-imx6q"
+RCONFLICTS_${PN}-imx-sdma-imx6q = "firmware-imx-sdma-imx6q"
+
+FILES_${PN}-imx-sdma-imx7d = "${nonarch_base_libdir}/firmware/imx/sdma/sdma-imx7d.bin"
+
+FILES_${PN}-imx-sdma-license = "${nonarch_base_libdir}/firmware/LICENSE.sdma_firmware"
+
+RDEPENDS_${PN}-imx-sdma-imx6q += "${PN}-imx-sdma-license"
+RDEPENDS_${PN}-imx-sdma-imx7d += "${PN}-imx-sdma-license"
+
 # For iwlwifi
 LICENSE_${PN}-iwlwifi           = "Firmware-iwlwifi_firmware"
 LICENSE_${PN}-iwlwifi-135-6     = "Firmware-iwlwifi_firmware"
 LICENSE_${PN}-iwlwifi-3160-7    = "Firmware-iwlwifi_firmware"
 LICENSE_${PN}-iwlwifi-3160-8    = "Firmware-iwlwifi_firmware"
 LICENSE_${PN}-iwlwifi-3160-9    = "Firmware-iwlwifi_firmware"
+LICENSE_${PN}-iwlwifi-3160-10   = "Firmware-iwlwifi_firmware"
+LICENSE_${PN}-iwlwifi-3160-12   = "Firmware-iwlwifi_firmware"
+LICENSE_${PN}-iwlwifi-3160-13   = "Firmware-iwlwifi_firmware"
+LICENSE_${PN}-iwlwifi-3160-16   = "Firmware-iwlwifi_firmware"
+LICENSE_${PN}-iwlwifi-3160-17   = "Firmware-iwlwifi_firmware"
 LICENSE_${PN}-iwlwifi-6000-4    = "Firmware-iwlwifi_firmware"
 LICENSE_${PN}-iwlwifi-6000g2a-5 = "Firmware-iwlwifi_firmware"
 LICENSE_${PN}-iwlwifi-6000g2a-6 = "Firmware-iwlwifi_firmware"
@@ -498,29 +599,38 @@
 LICENSE_${PN}-iwlwifi-license   = "Firmware-iwlwifi_firmware"
 
 
-FILES_${PN}-iwlwifi-license = "/lib/firmware/LICENCE.iwlwifi_firmware"
-FILES_${PN}-iwlwifi-135-6 = "/lib/firmware/iwlwifi-135-6.ucode"
-FILES_${PN}-iwlwifi-3160-7 = "/lib/firmware/iwlwifi-3160-7.ucode"
-FILES_${PN}-iwlwifi-3160-8 = "/lib/firmware/iwlwifi-3160-8.ucode"
-FILES_${PN}-iwlwifi-3160-9 = "/lib/firmware/iwlwifi-3160-9.ucode"
-FILES_${PN}-iwlwifi-6000-4 = "/lib/firmware/iwlwifi-6000-4.ucode"
-FILES_${PN}-iwlwifi-6000g2a-5 = "/lib/firmware/iwlwifi-6000g2a-5.ucode"
-FILES_${PN}-iwlwifi-6000g2a-6 = "/lib/firmware/iwlwifi-6000g2a-6.ucode"
-FILES_${PN}-iwlwifi-6000g2b-5 = "/lib/firmware/iwlwifi-6000g2b-5.ucode"
-FILES_${PN}-iwlwifi-6000g2b-6 = "/lib/firmware/iwlwifi-6000g2b-6.ucode"
-FILES_${PN}-iwlwifi-6050-4 = "/lib/firmware/iwlwifi-6050-4.ucode"
-FILES_${PN}-iwlwifi-6050-5 = "/lib/firmware/iwlwifi-6050-5.ucode"
-FILES_${PN}-iwlwifi-7260   = "/lib/firmware/iwlwifi-7260-*.ucode"
-FILES_${PN}-iwlwifi-7265   = "/lib/firmware/iwlwifi-7265-*.ucode"
-FILES_${PN}-iwlwifi-7265d   = "/lib/firmware/iwlwifi-7265D-*.ucode"
-FILES_${PN}-iwlwifi-8000c   = "/lib/firmware/iwlwifi-8000C-*.ucode"
-FILES_${PN}-iwlwifi-8265   = "/lib/firmware/iwlwifi-8265-*.ucode"
-FILES_${PN}-iwlwifi-misc   = "/lib/firmware/iwlwifi-*.ucode"
+FILES_${PN}-iwlwifi-license = "${nonarch_base_libdir}/firmware/LICENCE.iwlwifi_firmware"
+FILES_${PN}-iwlwifi-135-6 = "${nonarch_base_libdir}/firmware/iwlwifi-135-6.ucode"
+FILES_${PN}-iwlwifi-3160-7 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-7.ucode"
+FILES_${PN}-iwlwifi-3160-8 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-8.ucode"
+FILES_${PN}-iwlwifi-3160-9 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-9.ucode"
+FILES_${PN}-iwlwifi-3160-10 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-10.ucode"
+FILES_${PN}-iwlwifi-3160-12 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-12.ucode"
+FILES_${PN}-iwlwifi-3160-13 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-13.ucode"
+FILES_${PN}-iwlwifi-3160-16 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-16.ucode"
+FILES_${PN}-iwlwifi-3160-17 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-17.ucode"
+FILES_${PN}-iwlwifi-6000-4 = "${nonarch_base_libdir}/firmware/iwlwifi-6000-4.ucode"
+FILES_${PN}-iwlwifi-6000g2a-5 = "${nonarch_base_libdir}/firmware/iwlwifi-6000g2a-5.ucode"
+FILES_${PN}-iwlwifi-6000g2a-6 = "${nonarch_base_libdir}/firmware/iwlwifi-6000g2a-6.ucode"
+FILES_${PN}-iwlwifi-6000g2b-5 = "${nonarch_base_libdir}/firmware/iwlwifi-6000g2b-5.ucode"
+FILES_${PN}-iwlwifi-6000g2b-6 = "${nonarch_base_libdir}/firmware/iwlwifi-6000g2b-6.ucode"
+FILES_${PN}-iwlwifi-6050-4 = "${nonarch_base_libdir}/firmware/iwlwifi-6050-4.ucode"
+FILES_${PN}-iwlwifi-6050-5 = "${nonarch_base_libdir}/firmware/iwlwifi-6050-5.ucode"
+FILES_${PN}-iwlwifi-7260   = "${nonarch_base_libdir}/firmware/iwlwifi-7260-*.ucode"
+FILES_${PN}-iwlwifi-7265   = "${nonarch_base_libdir}/firmware/iwlwifi-7265-*.ucode"
+FILES_${PN}-iwlwifi-7265d   = "${nonarch_base_libdir}/firmware/iwlwifi-7265D-*.ucode"
+FILES_${PN}-iwlwifi-8265   = "${nonarch_base_libdir}/firmware/iwlwifi-8265-*.ucode"
+FILES_${PN}-iwlwifi-misc   = "${nonarch_base_libdir}/firmware/iwlwifi-*.ucode"
 
 RDEPENDS_${PN}-iwlwifi-135-6     = "${PN}-iwlwifi-license"
 RDEPENDS_${PN}-iwlwifi-3160-7    = "${PN}-iwlwifi-license"
 RDEPENDS_${PN}-iwlwifi-3160-8    = "${PN}-iwlwifi-license"
 RDEPENDS_${PN}-iwlwifi-3160-9    = "${PN}-iwlwifi-license"
+RDEPENDS_${PN}-iwlwifi-3160-10   = "${PN}-iwlwifi-license"
+RDEPENDS_${PN}-iwlwifi-3160-12   = "${PN}-iwlwifi-license"
+RDEPENDS_${PN}-iwlwifi-3160-13   = "${PN}-iwlwifi-license"
+RDEPENDS_${PN}-iwlwifi-3160-16   = "${PN}-iwlwifi-license"
+RDEPENDS_${PN}-iwlwifi-3160-17   = "${PN}-iwlwifi-license"
 RDEPENDS_${PN}-iwlwifi-6000-4    = "${PN}-iwlwifi-license"
 RDEPENDS_${PN}-iwlwifi-6000g2a-5 = "${PN}-iwlwifi-license"
 RDEPENDS_${PN}-iwlwifi-6000g2a-6 = "${PN}-iwlwifi-license"
@@ -552,18 +662,49 @@
 RREPLACES_${PN}-iwlwifi-7260 = "${PN}-iwlwifi-7260-7 ${PN}-iwlwifi-7260-8 ${PN}-iwlwifi-7260-9"
 RCONFLICTS_${PN}-iwlwifi-7260 = "${PN}-iwlwifi-7260-7 ${PN}-iwlwifi-7260-8 ${PN}-iwlwifi-7260-9"
 
+# For ibt
+LICENSE_${PN}-ibt-license = "Firmware-ibt_firmware"
+LICENSE_${PN}-ibt-hw-37-7 = "Firmware-ibt_firmware"
+LICENSE_${PN}-ibt-hw-37-8 = "Firmware-ibt_firmware"
+LICENSE_${PN}-ibt-11-5    = "Firmware-ibt_firmware"
+LICENSE_${PN}-ibt-12-16   = "Firmware-ibt_firmware"
+LICENSE_${PN}-ibt-misc    = "Firmware-ibt_firmware"
+
+FILES_${PN}-ibt-license = "${nonarch_base_libdir}/firmware/LICENCE.ibt_firmware"
+FILES_${PN}-ibt-hw-37-7 = "${nonarch_base_libdir}/firmware/intel/ibt-hw-37.7*.bseq"
+FILES_${PN}-ibt-hw-37-8 = "${nonarch_base_libdir}/firmware/intel/ibt-hw-37.8*.bseq"
+FILES_${PN}-ibt-11-5    = "${nonarch_base_libdir}/firmware/intel/ibt-11-5.sfi /lib/firmware/intel/ibt-11-5.ddc"
+FILES_${PN}-ibt-12-16   = "${nonarch_base_libdir}/firmware/intel/ibt-12-16.sfi /lib/firmware/intel/ibt-12-16.ddc"
+FILES_${PN}-ibt-misc    = "${nonarch_base_libdir}/firmware/ibt-*"
+
+RDEPENDS_${PN}-ibt-hw-37-7 = "${PN}-ibt-license"
+RDEPENDS_${PN}-ibt-hw-37.8 = "${PN}-ibt-license"
+RDEPENDS_${PN}-ibt-11-5    = "${PN}-ibt-license"
+RDEPENDS_${PN}-ibt-12-16   = "${PN}-ibt-license"
+RDEPENDS_${PN}-ibt-misc    = "${PN}-ibt-license"
+
+ALLOW_EMPTY_${PN}-ibt= "1"
+ALLOW_EMPTY_${PN}-ibt-misc = "1"
+
 LICENSE_${PN}-i915       = "Firmware-i915"
 LICENSE_${PN}-i915-license = "Firmware-i915"
-FILES_${PN}-i915-license = "/lib/firmware/LICENSE.i915"
-FILES_${PN}-i915         = "/lib/firmware/i915"
+FILES_${PN}-i915-license = "${nonarch_base_libdir}/firmware/LICENSE.i915"
+FILES_${PN}-i915         = "${nonarch_base_libdir}/firmware/i915"
 RDEPENDS_${PN}-i915      = "${PN}-i915-license"
 
-FILES_${PN}-adsp-sst-license      = "/lib/firmware/LICENCE.adsp_sst"
+FILES_${PN}-adsp-sst-license      = "${nonarch_base_libdir}/firmware/LICENCE.adsp_sst"
 LICENSE_${PN}-adsp-sst            = "Firmware-adsp_sst"
 LICENSE_${PN}-adsp-sst-license    = "Firmware-adsp_sst"
-FILES_${PN}-adsp-sst              = "/lib/firmware/intel/dsp_fw*"
+FILES_${PN}-adsp-sst              = "${nonarch_base_libdir}/firmware/intel/dsp_fw*"
 RDEPENDS_${PN}-adsp-sst           = "${PN}-adsp-sst-license"
 
+# For QAT
+LICENSE_${PN}-qat         = "Firmware-qat"
+LICENSE_${PN}-qat-license = "Firmware-qat"
+FILES_${PN}-qat-license   = "${nonarch_base_libdir}/firmware/LICENCE.qat_firmware"
+FILES_${PN}-qat           = "${nonarch_base_libdir}/firmware/qat*.bin"
+RDEPENDS_${PN}-qat        = "${PN}-qat-license"
+
 # For other firmwares
 # Maybe split out to separate packages when needed.
 LICENSE_${PN} = "\
@@ -588,7 +729,6 @@
     & Firmware-IntcSST2 \
     & Firmware-kaweth \
     & Firmware-moxa \
-    & Firmware-mwl8335 \
     & Firmware-myri10ge_firmware \
     & Firmware-nvidia \
     & Firmware-OLPC \
@@ -601,6 +741,7 @@
     & Firmware-radeon \
     & Firmware-ralink_a_mediatek_company_firmware \
     & Firmware-ralink-firmware \
+    & Firmware-imx-sdma_firmware \
     & Firmware-siano \
     & Firmware-tda7706-firmware \
     & Firmware-ti-connectivity \
@@ -613,17 +754,25 @@
     & WHENCE \
 "
 
-FILES_${PN}-license += "/lib/firmware/LICEN*"
-FILES_${PN} += "/lib/firmware/*"
+FILES_${PN}-license += "${nonarch_base_libdir}/firmware/LICEN*"
+FILES_${PN} += "${nonarch_base_libdir}/firmware/*"
 RDEPENDS_${PN} += "${PN}-license"
 RDEPENDS_${PN} += "${PN}-whence-license"
 
 # Make linux-firmware depend on all of the split-out packages.
 # Make linux-firmware-iwlwifi depend on all of the split-out iwlwifi packages.
+# Make linux-firmware-ibt depend on all of the split-out ibt packages.
 python populate_packages_prepend () {
     firmware_pkgs = oe.utils.packages_filter_out_system(d)
     d.appendVar('RDEPENDS_linux-firmware', ' ' + ' '.join(firmware_pkgs))
 
     iwlwifi_pkgs = filter(lambda x: x.find('-iwlwifi-') != -1, firmware_pkgs)
     d.appendVar('RDEPENDS_linux-firmware-iwlwifi', ' ' + ' '.join(iwlwifi_pkgs))
+
+    ibt_pkgs = filter(lambda x: x.find('-ibt-') != -1, firmware_pkgs)
+    d.appendVar('RDEPENDS_linux-firmware-ibt', ' ' + ' '.join(ibt_pkgs))
 }
+
+# Firmware files are generally not ran on the CPU, so they can be
+# allarch despite being architecture specific
+INSANE_SKIP = "arch"
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc b/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc
index 078d752..1657df6 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc
@@ -33,7 +33,7 @@
 LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
 
 python __anonymous () {
-    major = d.getVar("PV",True).split('.')[0]
+    major = d.getVar("PV").split('.')[0]
     if major == "3":
         d.setVar("HEADER_FETCH_VER", "3.0")
     elif major == "4":
@@ -42,11 +42,12 @@
         d.setVar("HEADER_FETCH_VER", "2.6")
 }
 
-inherit kernel-arch
+inherit kernel-arch pkgconfig multilib_header
 
 KORG_ARCHIVE_COMPRESSION ?= "xz"
 
 SRC_URI = "${KERNELORG_MIRROR}/linux/kernel/v${HEADER_FETCH_VER}/linux-${PV}.tar.${KORG_ARCHIVE_COMPRESSION}"
+UPSTREAM_CHECK_URI = "https://www.kernel.org/"
 
 S = "${WORKDIR}/linux-${PV}"
 
@@ -68,9 +69,21 @@
 	find ${D}${includedir} -name ..install.cmd | xargs rm -f
 }
 
+do_install_append_aarch64 () {
+        do_install_armmultilib
+}
+
+do_install_append_arm () {
+	do_install_armmultilib
+}
+
+do_install_armmultilib () {
+	oe_multilib_header asm/auxvec.h asm/bitsperlong.h asm/byteorder.h asm/fcntl.h asm/hwcap.h asm/ioctls.h asm/kvm.h asm/mman.h asm/param.h asm/perf_regs.h
+	oe_multilib_header asm/posix_types.h asm/ptrace.h  asm/setup.h  asm/sigcontext.h asm/siginfo.h asm/signal.h asm/stat.h  asm/statfs.h asm/swab.h  asm/types.h asm/unistd.h
+}
+
 BBCLASSEXTEND = "nativesdk"
 
-#DEPENDS = "cross-linkage"
 RDEPENDS_${PN}-dev = ""
 RRECOMMENDS_${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-musl-_does_-define-IFF_LOWER_UP-DORMAN.patch b/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-musl-_does_-define-IFF_LOWER_UP-DORMAN.patch
new file mode 100644
index 0000000..bde2132
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-musl-_does_-define-IFF_LOWER_UP-DORMAN.patch
@@ -0,0 +1,46 @@
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [v2,2/3] uapi glibc compat: fix build if libc defines IFF_ECHO
+From: Hauke Mehrtens <hauke@hauke-m.de>
+X-Patchwork-Id: 9686293
+Message-Id: <20170418210036.26039-3-hauke@hauke-m.de>
+To: davem@davemloft.net, netdev@vger.kernel.org
+Cc: linux-kernel@vger.kernel.org, jarod@redhat.com, jogo@openwrt.org,
+ david.heidelberger@ixit.cz, maillist-linux@barfooze.de,
+ mikko.rapeli@iki.fi, dwmw2@infradead.org, Hauke Mehrtens <hauke@hauke-m.de>
+Date: Tue, 18 Apr 2017 23:00:35 +0200
+
+musl 1.1.15 defines IFF_ECHO and the other net_device_flags options.
+When a user application includes linux/if.h and net/if.h the compile
+will fail.
+
+Activate __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO only when
+it is needed. This should also make this work in case glibc will add
+these defines.
+
+Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi>
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+Upstream-Status: Submitted [https://patchwork.kernel.org/patch/9686293/]
+Signed-off-by: André Draszik <adraszik@tycoint.com>
+Acked-by: Stephane Ayotte <sayotte@tycoint.com>
+ include/uapi/linux/libc-compat.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
+index 43a81136ea6e..ce2fa8a4ced6 100644
+--- a/include/uapi/linux/libc-compat.h
++++ b/include/uapi/linux/libc-compat.h
+@@ -64,9 +64,11 @@
+ /* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */
+ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0
+ /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
++#ifndef IFF_ECHO
+ #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
+ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
++#endif /* IFF_ECHO */
+ 
+ #else /* _NET_IF_H */
+ 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.10.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.10.bb
new file mode 100644
index 0000000..2926278
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.10.bb
@@ -0,0 +1,11 @@
+require linux-libc-headers.inc
+
+SRC_URI_append_libc-musl = "\
+    file://0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch \
+    file://0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch \
+    file://0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch \
+    file://0001-libc-compat.h-musl-_does_-define-IFF_LOWER_UP-DORMAN.patch \
+   "
+
+SRC_URI[md5sum] = "b5e7f6b9b2fe1b6cc7bc56a3a0bfc090"
+SRC_URI[sha256sum] = "3c95d9f049bd085e5c346d2c77f063b8425f191460fcd3ae9fe7e94e0477dc4b"
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4.bb
deleted file mode 100644
index 3763dc0..0000000
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.4.bb
+++ /dev/null
@@ -1,9 +0,0 @@
-require linux-libc-headers.inc
-
-SRC_URI_append_libc-musl = "\
-    file://0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch \
-    file://0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch \
-    file://0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch \
-   "
-SRC_URI[md5sum] = "9a78fa2eb6c68ca5a40ed5af08142599"
-SRC_URI[sha256sum] = "401d7c8fef594999a460d10c72c5a94e9c2e1022f16795ec51746b0d165418b2"
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.8.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.8.bb
deleted file mode 100644
index 77e0870..0000000
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.8.bb
+++ /dev/null
@@ -1,12 +0,0 @@
-require linux-libc-headers.inc
-
-PV = "4.8"
-
-SRC_URI_append_libc-musl = "\
-    file://0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch \
-    file://0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch \
-    file://0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch \
-   "
-
-SRC_URI[md5sum] = "c1af0afbd3df35c1ccdc7a5118cd2d07"
-SRC_URI[sha256sum] = "3e9150065f193d3d94bcf46a1fe9f033c7ef7122ab71d75a7fb5a2f0c9a7e11a"
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/kernel-devsrc.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux/kernel-devsrc.bb
index 0fdd0ad..7004261 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -6,7 +6,6 @@
 SECTION = "kernel"
 
 LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
 
 inherit linux-kernel-base
 
@@ -54,6 +53,13 @@
         # architecture (since scripts and helpers are native format).
         KBUILD_OUTPUT="$kerneldir"
         oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean _mrproper_scripts
+        # make clean generates an absolute path symlink called "source"
+        # in $kerneldir points to $kerneldir, which doesn't make any
+        # sense, so remove it.
+        if [ -L $kerneldir/source ]; then
+            bbnote "Removing $kerneldir/source symlink"
+            rm -f $kerneldir/source
+        fi
 
         # As of Linux kernel version 3.0.1, the clean target removes
         # arch/powerpc/lib/crtsavres.o which is present in
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-dtb.inc b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-dtb.inc
index 2f378a1..0174c80 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-dtb.inc
@@ -1,6 +1,8 @@
 # Support for device tree generation
 FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
 
+PACKAGE_WRITE_DEPS += "virtual/update-alternatives-native"
+
 python __anonymous () {
     d.appendVar("PACKAGES", " kernel-devicetree")
 }
@@ -70,7 +72,7 @@
 			DTB_EXT=${DTB##*.}
 			DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
 			DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
-			update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} ${DTB_BASE_NAME}.${DTB_EXT} /boot/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
+			update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} ${DTB_BASE_NAME}.${DTB_EXT} devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
 		done
 	done
 }
@@ -83,7 +85,7 @@
 			DTB_EXT=${DTB##*.}
 			DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
 			DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
-			update-alternatives --remove ${DTB_BASE_NAME}.${DTB_EXT} /boot/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
+			update-alternatives --remove ${DTB_BASE_NAME}.${DTB_EXT} devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT} ${KERNEL_PRIORITY} || true
 		done
 	done
 }
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-dev.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-dev.bb
index 0cda553..bf67f81 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-dev.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-dev.bb
@@ -28,7 +28,7 @@
 SRCREV_machine ?= '${@oe.utils.conditional("PREFERRED_PROVIDER_virtual/kernel", "linux-yocto-dev", "${AUTOREV}", "29594404d7fe73cd80eaa4ee8c43dcc53970c60e", d)}'
 SRCREV_meta ?= '${@oe.utils.conditional("PREFERRED_PROVIDER_virtual/kernel", "linux-yocto-dev", "${AUTOREV}", "29594404d7fe73cd80eaa4ee8c43dcc53970c60e", d)}'
 
-LINUX_VERSION ?= "4.9-rc+"
+LINUX_VERSION ?= "4.11-rc+"
 LINUX_VERSION_EXTENSION ?= "-yoctodev-${LINUX_KERNEL_TYPE}"
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
@@ -39,7 +39,9 @@
 # Functionality flags
 KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/taskstats/taskstats.scc"
 KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}"
+KERNEL_FEATURES_append_qemuall=" cfg/virtio.scc"
 KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
 KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc"
 KERNEL_FEATURES_append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "" ,d)}"
 
+KERNEL_VERSION_SANITY_SKIP = "1"
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.1.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.1.bb
index 0e413f0..c82468a 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.1.bb
@@ -7,17 +7,17 @@
 # to build multiple virtual/kernel providers, e.g. as dependency of
 # core-image-rt-sdk, core-image-rt.
 python () {
-    if d.getVar("PREFERRED_PROVIDER_virtual/kernel", True) != "linux-yocto-rt":
+    if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt":
         raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
 }
 
-SRCREV_machine ?= "f793c71d51277bdb14d6854c8cbcc09b4f5936b4"
-SRCREV_meta ?= "7140ddb86e4b01529185e6d4a606001ad152b8f3"
+SRCREV_machine ?= "8cc62ac3f26bd6dde68ad2d86026a252fe7add44"
+SRCREV_meta ?= "9f9c9a66ef3452343586adf150137967e955d71a"
 
 SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.1.git;branch=${KBRANCH};name=machine \
            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.1;destsuffix=${KMETA}"
 
-LINUX_VERSION ?= "4.1.38"
+LINUX_VERSION ?= "4.1.43"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.10.bb
similarity index 74%
copy from import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb
copy to import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.10.bb
index e65bc18..f93d953 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.10.bb
@@ -7,17 +7,17 @@
 # to build multiple virtual/kernel providers, e.g. as dependency of
 # core-image-rt-sdk, core-image-rt.
 python () {
-    if d.getVar("PREFERRED_PROVIDER_virtual/kernel", True) != "linux-yocto-rt":
+    if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt":
         raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
 }
 
-SRCREV_machine ?= "7f56c6365d0d677d5fe6ca73f1b2ab6640b523a3"
-SRCREV_meta ?= "c84532b6475fd78b878507a481e2c04714341c07"
+SRCREV_machine ?= "c1d8c4408b8aedd88eeb6ccc89ce834dd41b3f09"
+SRCREV_meta ?= "40ee48ac099c04f60d2c132031d9625a4e0c4c9e"
 
-SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.8.git;branch=${KBRANCH};name=machine \
-           git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.8;destsuffix=${KMETA}"
+SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.10.git;branch=${KBRANCH};name=machine \
+           git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.10;destsuffix=${KMETA}"
 
-LINUX_VERSION ?= "4.8.24"
+LINUX_VERSION ?= "4.10.17"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb
index 1f73f0c..25d8883 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb
@@ -7,17 +7,17 @@
 # to build multiple virtual/kernel providers, e.g. as dependency of
 # core-image-rt-sdk, core-image-rt.
 python () {
-    if d.getVar("PREFERRED_PROVIDER_virtual/kernel", True) != "linux-yocto-rt":
+    if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt":
         raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
 }
 
-SRCREV_machine ?= "1af95315c6ab3672c8c7191873ef041a6c29ad70"
-SRCREV_meta ?= "d6733af2080f8c0775569adc0826eb0c8954fc5e"
+SRCREV_machine ?= "1e691db7af642fff0222a1f1d1e9043c172699d5"
+SRCREV_meta ?= "804d2b3164ec25ed519fd695de9aa0908460c92e"
 
 SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.4.git;branch=${KBRANCH};name=machine \
            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.4;destsuffix=${KMETA}"
 
-LINUX_VERSION ?= "4.4.60"
+LINUX_VERSION ?= "4.4.87"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.9.bb
similarity index 76%
rename from import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb
rename to import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.9.bb
index e65bc18..6734dc0 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-rt_4.9.bb
@@ -7,17 +7,17 @@
 # to build multiple virtual/kernel providers, e.g. as dependency of
 # core-image-rt-sdk, core-image-rt.
 python () {
-    if d.getVar("PREFERRED_PROVIDER_virtual/kernel", True) != "linux-yocto-rt":
+    if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt":
         raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
 }
 
-SRCREV_machine ?= "7f56c6365d0d677d5fe6ca73f1b2ab6640b523a3"
-SRCREV_meta ?= "c84532b6475fd78b878507a481e2c04714341c07"
+SRCREV_machine ?= "0817a7b3a853d1bdd3b87a2654ed2ee62f624806"
+SRCREV_meta ?= "6acae6f7200af17b3c2be5ecab2cffdc59a02b35"
 
-SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.8.git;branch=${KBRANCH};name=machine \
-           git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.8;destsuffix=${KMETA}"
+SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.9.git;branch=${KBRANCH};name=machine \
+           git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.9;destsuffix=${KMETA}"
 
-LINUX_VERSION ?= "4.8.24"
+LINUX_VERSION ?= "4.9.49"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.1.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.1.bb
index ce8aea6..537efb1 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.1.bb
@@ -4,13 +4,13 @@
 
 require recipes-kernel/linux/linux-yocto.inc
 
-LINUX_VERSION ?= "4.1.38"
+LINUX_VERSION ?= "4.1.43"
 
 KMETA = "kernel-meta"
 KCONF_BSP_AUDIT_LEVEL = "2"
 
-SRCREV_machine ?= "2ce56d130ddff67f43ec857cc51cd347666a0078"
-SRCREV_meta ?= "7140ddb86e4b01529185e6d4a606001ad152b8f3"
+SRCREV_machine ?= "782133d8166ac71ef1ffaba58b7cf81ec9e532a1"
+SRCREV_meta ?= "9f9c9a66ef3452343586adf150137967e955d71a"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.10.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.10.bb
new file mode 100644
index 0000000..31396ab
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.10.bb
@@ -0,0 +1,25 @@
+KBRANCH ?= "standard/tiny/common-pc"
+LINUX_KERNEL_TYPE = "tiny"
+KCONFIG_MODE = "--allnoconfig"
+
+require recipes-kernel/linux/linux-yocto.inc
+
+LINUX_VERSION ?= "4.10.17"
+
+KMETA = "kernel-meta"
+KCONF_BSP_AUDIT_LEVEL = "2"
+
+SRCREV_machine ?= "c1d8c4408b8aedd88eeb6ccc89ce834dd41b3f09"
+SRCREV_meta ?= "40ee48ac099c04f60d2c132031d9625a4e0c4c9e"
+
+PV = "${LINUX_VERSION}+git${SRCPV}"
+
+SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.10.git;branch=${KBRANCH};name=machine \
+           git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.10;destsuffix=${KMETA}"
+
+COMPATIBLE_MACHINE = "(qemux86$)"
+
+# Functionality flags
+KERNEL_FEATURES = ""
+
+KERNEL_DEVICETREE_qemuarm = "versatile-pb.dtb"
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb
index 04f719c..50b9a56 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb
@@ -4,13 +4,13 @@
 
 require recipes-kernel/linux/linux-yocto.inc
 
-LINUX_VERSION ?= "4.4.60"
+LINUX_VERSION ?= "4.4.87"
 
 KMETA = "kernel-meta"
 KCONF_BSP_AUDIT_LEVEL = "2"
 
-SRCREV_machine ?= "0298d3765a5c474ff5776284d49111276510d4b4"
-SRCREV_meta ?= "d6733af2080f8c0775569adc0826eb0c8954fc5e"
+SRCREV_machine ?= "b71c7b786aed26c0a1e4eca66f1d874ec017d699"
+SRCREV_meta ?= "804d2b3164ec25ed519fd695de9aa0908460c92e"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.9.bb
similarity index 63%
rename from import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb
rename to import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.9.bb
index a0aa085..e0c5236 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto-tiny_4.9.bb
@@ -4,18 +4,18 @@
 
 require recipes-kernel/linux/linux-yocto.inc
 
-LINUX_VERSION ?= "4.8.24"
+LINUX_VERSION ?= "4.9.49"
 
 KMETA = "kernel-meta"
 KCONF_BSP_AUDIT_LEVEL = "2"
 
-SRCREV_machine ?= "6a134d2553b9c25ce8acb67b807fe0feb1b01430"
-SRCREV_meta ?= "c84532b6475fd78b878507a481e2c04714341c07"
+SRCREV_machine ?= "480ee599fb8df712c10dcf4b7aa6398b79f7d404"
+SRCREV_meta ?= "6acae6f7200af17b3c2be5ecab2cffdc59a02b35"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
-SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.8.git;branch=${KBRANCH};name=machine \
-           git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.8;destsuffix=${KMETA}"
+SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.9.git;branch=${KBRANCH};name=machine \
+           git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.9;destsuffix=${KMETA}"
 
 COMPATIBLE_MACHINE = "(qemux86$)"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto.inc b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto.inc
index 09cd1f1..637506a 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto.inc
@@ -12,9 +12,9 @@
 # PREFERRED_PROVIDER for virtual/kernel. This avoids network access required
 # by the use of AUTOREV SRCREVs, which are the default for this recipe.
 python () {
-    if d.getVar("PREFERRED_PROVIDER_virtual/kernel", True) != d.getVar("PN", True):
+    if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != d.getVar("PN"):
         d.delVar("BB_DONT_CACHE")
-        raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to %s to enable it" % (d.getVar("PN", True)))
+        raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to %s to enable it" % (d.getVar("PN")))
 }
 
 DEPENDS += "xz-native bc-native"
@@ -65,6 +65,5 @@
 
 # extra tasks
 addtask kernel_version_sanity_check after do_kernel_metadata do_kernel_checkout before do_compile
-addtask kernel_link_images after do_compile before do_strip
 addtask validate_branches before do_patch after do_kernel_checkout
 addtask kernel_configcheck after do_configure before do_compile
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.1.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.1.bb
index bf7f266..316bc32 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.1.bb
@@ -11,20 +11,20 @@
 KBRANCH_qemux86-64 ?= "standard/base"
 KBRANCH_qemumips64 ?= "standard/mti-malta64"
 
-SRCREV_machine_qemuarm ?= "4d2c95e78cdc7d312b7ab231ce90dce317f45df9"
-SRCREV_machine_qemuarm64 ?= "2ce56d130ddff67f43ec857cc51cd347666a0078"
-SRCREV_machine_qemumips ?= "81454f95166056a253c8950980e025ee243d8074"
-SRCREV_machine_qemuppc ?= "42c41e606b70fd73a202f4146c0480f5624b0a0e"
-SRCREV_machine_qemux86 ?= "2ce56d130ddff67f43ec857cc51cd347666a0078"
-SRCREV_machine_qemux86-64 ?= "2ce56d130ddff67f43ec857cc51cd347666a0078"
-SRCREV_machine_qemumips64 ?= "8a481005da41f82d2a40bf8cb40334547160ab5b"
-SRCREV_machine ?= "2ce56d130ddff67f43ec857cc51cd347666a0078"
-SRCREV_meta ?= "7140ddb86e4b01529185e6d4a606001ad152b8f3"
+SRCREV_machine_qemuarm ?= "642e9b95f97f8e00ef819bbfb2f281c1079bfbb1"
+SRCREV_machine_qemuarm64 ?= "782133d8166ac71ef1ffaba58b7cf81ec9e532a1"
+SRCREV_machine_qemumips ?= "54d4575d0df1805e127c5fa59201cd978849fb3f"
+SRCREV_machine_qemuppc ?= "58906f2737c644e67a7c9754b7e36630005a0011"
+SRCREV_machine_qemux86 ?= "782133d8166ac71ef1ffaba58b7cf81ec9e532a1"
+SRCREV_machine_qemux86-64 ?= "782133d8166ac71ef1ffaba58b7cf81ec9e532a1"
+SRCREV_machine_qemumips64 ?= "03f0c0293abfe5226c2fdd22328476854fa0127f"
+SRCREV_machine ?= "782133d8166ac71ef1ffaba58b7cf81ec9e532a1"
+SRCREV_meta ?= "9f9c9a66ef3452343586adf150137967e955d71a"
 
 SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.1.git;name=machine;branch=${KBRANCH}; \
            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.1;destsuffix=${KMETA}"
 
-LINUX_VERSION ?= "4.1.38"
+LINUX_VERSION ?= "4.1.43"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.10.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.10.bb
new file mode 100644
index 0000000..7fcc753
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.10.bb
@@ -0,0 +1,44 @@
+KBRANCH ?= "standard/base"
+
+require recipes-kernel/linux/linux-yocto.inc
+
+# board specific branches
+KBRANCH_qemuarm  ?= "standard/arm-versatile-926ejs"
+KBRANCH_qemuarm64 ?= "standard/qemuarm64"
+KBRANCH_qemumips ?= "standard/mti-malta32"
+KBRANCH_qemuppc  ?= "standard/qemuppc"
+KBRANCH_qemux86  ?= "standard/base"
+KBRANCH_qemux86-64 ?= "standard/base"
+KBRANCH_qemumips64 ?= "standard/mti-malta64"
+
+SRCREV_machine_qemuarm ?= "ae12e19cecc19af66f64a50538909cb1cad185f9"
+SRCREV_machine_qemuarm64 ?= "c1d8c4408b8aedd88eeb6ccc89ce834dd41b3f09"
+SRCREV_machine_qemumips ?= "b71b80fd679a17dfb4f73b352263c49273f721d4"
+SRCREV_machine_qemuppc ?= "c1d8c4408b8aedd88eeb6ccc89ce834dd41b3f09"
+SRCREV_machine_qemux86 ?= "c1d8c4408b8aedd88eeb6ccc89ce834dd41b3f09"
+SRCREV_machine_qemux86-64 ?= "c1d8c4408b8aedd88eeb6ccc89ce834dd41b3f09"
+SRCREV_machine_qemumips64 ?= "8bb135e71037c46175bbcc7acf387309b2e17133"
+SRCREV_machine ?= "c1d8c4408b8aedd88eeb6ccc89ce834dd41b3f09"
+SRCREV_meta ?= "40ee48ac099c04f60d2c132031d9625a4e0c4c9e"
+
+SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.10.git;name=machine;branch=${KBRANCH}; \
+           git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.10;destsuffix=${KMETA}"
+
+LINUX_VERSION ?= "4.10.17"
+
+PV = "${LINUX_VERSION}+git${SRCPV}"
+
+KMETA = "kernel-meta"
+KCONF_BSP_AUDIT_LEVEL = "2"
+
+KERNEL_DEVICETREE_qemuarm = "versatile-pb.dtb"
+
+COMPATIBLE_MACHINE = "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
+
+# Functionality flags
+KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc"
+KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}"
+KERNEL_FEATURES_append_qemuall=" cfg/virtio.scc"
+KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
+KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
+KERNEL_FEATURES_append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "" ,d)}"
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.4.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.4.bb
index d0eed65..d300e69 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.4.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.4.bb
@@ -11,20 +11,20 @@
 KBRANCH_qemux86-64 ?= "standard/base"
 KBRANCH_qemumips64 ?= "standard/mti-malta64"
 
-SRCREV_machine_qemuarm ?= "7d2a3c70d62f1e7f4eba571c49ff299db2bb3829"
-SRCREV_machine_qemuarm64 ?= "0298d3765a5c474ff5776284d49111276510d4b4"
-SRCREV_machine_qemumips ?= "6100965a51cf6b99f57cf8234aa982beb79455c9"
-SRCREV_machine_qemuppc ?= "0298d3765a5c474ff5776284d49111276510d4b4"
-SRCREV_machine_qemux86 ?= "0298d3765a5c474ff5776284d49111276510d4b4"
-SRCREV_machine_qemux86-64 ?= "0298d3765a5c474ff5776284d49111276510d4b4"
-SRCREV_machine_qemumips64 ?= "522e709fd7088e1a55e7a4708b1a07caa2ca4336"
-SRCREV_machine ?= "0298d3765a5c474ff5776284d49111276510d4b4"
-SRCREV_meta ?= "d6733af2080f8c0775569adc0826eb0c8954fc5e"
+SRCREV_machine_qemuarm ?= "840e2c02dde98ee9c584cacdd5bb0812e9dcd016"
+SRCREV_machine_qemuarm64 ?= "b71c7b786aed26c0a1e4eca66f1d874ec017d699"
+SRCREV_machine_qemumips ?= "27a547fe77b05ae63c3b973a029c3933ef62c164"
+SRCREV_machine_qemuppc ?= "b71c7b786aed26c0a1e4eca66f1d874ec017d699"
+SRCREV_machine_qemux86 ?= "b71c7b786aed26c0a1e4eca66f1d874ec017d699"
+SRCREV_machine_qemux86-64 ?= "b71c7b786aed26c0a1e4eca66f1d874ec017d699"
+SRCREV_machine_qemumips64 ?= "7e333c223b568704cc3303b2e922ff85a2a8f7ef"
+SRCREV_machine ?= "b71c7b786aed26c0a1e4eca66f1d874ec017d699"
+SRCREV_meta ?= "804d2b3164ec25ed519fd695de9aa0908460c92e"
 
 SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.4.git;name=machine;branch=${KBRANCH}; \
            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.4;destsuffix=${KMETA}"
 
-LINUX_VERSION ?= "4.4.60"
+LINUX_VERSION ?= "4.4.87"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.8.bb b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.9.bb
similarity index 60%
rename from import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.8.bb
rename to import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.9.bb
index bfd52d2..dbe40a3 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.8.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/linux/linux-yocto_4.9.bb
@@ -11,20 +11,20 @@
 KBRANCH_qemux86-64 ?= "standard/base"
 KBRANCH_qemumips64 ?= "standard/mti-malta64"
 
-SRCREV_machine_qemuarm ?= "f25e3a184bf0ac7b12ec9c98d71439f4ac911974"
-SRCREV_machine_qemuarm64 ?= "b9c5f19c82c717b014eab5dc404b9489badbfc8f"
-SRCREV_machine_qemumips ?= "79e11192ca2c1acc714214c2125a8c0296c00413"
-SRCREV_machine_qemuppc ?= "7a688297cc810a614f0329371d1389e550a98504"
-SRCREV_machine_qemux86 ?= "f6329fd2875778192c03e08be02730180cb0dc71"
-SRCREV_machine_qemux86-64 ?= "f6329fd2875778192c03e08be02730180cb0dc71"
-SRCREV_machine_qemumips64 ?= "d619311dd8ea9ee95d80d937f08fb2c70c1dc50c"
-SRCREV_machine ?= "f6329fd2875778192c03e08be02730180cb0dc71"
-SRCREV_meta ?= "c84532b6475fd78b878507a481e2c04714341c07"
+SRCREV_machine_qemuarm ?= "8caa35a74753d45178720933f03d8d5150a8ff17"
+SRCREV_machine_qemuarm64 ?= "480ee599fb8df712c10dcf4b7aa6398b79f7d404"
+SRCREV_machine_qemumips ?= "fc2a3b9f932779fdf053675a5a73e8f9917507a5"
+SRCREV_machine_qemuppc ?= "480ee599fb8df712c10dcf4b7aa6398b79f7d404"
+SRCREV_machine_qemux86 ?= "480ee599fb8df712c10dcf4b7aa6398b79f7d404"
+SRCREV_machine_qemux86-64 ?= "480ee599fb8df712c10dcf4b7aa6398b79f7d404"
+SRCREV_machine_qemumips64 ?= "aee63978005c04ea853099764acaa08130e65554"
+SRCREV_machine ?= "480ee599fb8df712c10dcf4b7aa6398b79f7d404"
+SRCREV_meta ?= "6acae6f7200af17b3c2be5ecab2cffdc59a02b35"
 
-SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.8.git;name=machine;branch=${KBRANCH}; \
-           git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.8;destsuffix=${KMETA}"
+SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.9.git;name=machine;branch=${KBRANCH}; \
+           git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.9;destsuffix=${KMETA}"
 
-LINUX_VERSION ?= "4.8.24"
+LINUX_VERSION ?= "4.9.49"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/lttng/babeltrace_1.4.0.bb b/import-layers/yocto-poky/meta/recipes-kernel/lttng/babeltrace_1.5.2.bb
similarity index 81%
rename from import-layers/yocto-poky/meta/recipes-kernel/lttng/babeltrace_1.4.0.bb
rename to import-layers/yocto-poky/meta/recipes-kernel/lttng/babeltrace_1.5.2.bb
index 0fadeb0..c7ea5c1 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/lttng/babeltrace_1.4.0.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/lttng/babeltrace_1.5.2.bb
@@ -15,6 +15,5 @@
 
 EXTRA_OECONF = "--disable-debug-info"
 
-SRC_URI[md5sum] = "fa99064048af5c9c6ff00e489ac809c2"
-SRC_URI[sha256sum] = "9469eeb22617cd12668683b04c27003e5337e9ac66ade914988df3642fc0d0e4"
-
+SRC_URI[md5sum] = "1176e7f69e128112d5f29fefec39c6ce"
+SRC_URI[sha256sum] = "696ee46e5750ab57a258663e73915d2901b7cd4fc53b06eb3f7a0d7b1012fa56"
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-modules_git.bb b/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-modules_2.9.1.bb
similarity index 70%
rename from import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-modules_git.bb
rename to import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-modules_2.9.1.bb
index 7014541..abff79d 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-modules_git.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-modules_2.9.1.bb
@@ -8,27 +8,25 @@
 
 inherit module
 
-SRCREV = "6e4fc6f36d68fb3c8d40113f8670eb6e9c8ffd76"
-PV = "2.8.0+git${SRCPV}"
-
 COMPATIBLE_HOST = '(x86_64|i.86|powerpc|aarch64|mips|nios2|arm).*-linux'
 
-SRC_URI = "git://git.lttng.org/lttng-modules.git;branch=stable-2.8 \
+SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
            file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch"
 
+SRC_URI[md5sum] = "5a16bca52233cc2bdff572b1120a88f6"
+SRC_URI[sha256sum] = "62078fe3254ca65969db4b72e59042cd797dbf2740848f8f82384877ae460d54"
+
 export INSTALL_MOD_DIR="kernel/lttng-modules"
 
 EXTRA_OEMAKE += "KERNELDIR='${STAGING_KERNEL_DIR}'"
 
-S = "${WORKDIR}/git"
-
 do_install_append() {
 	# Delete empty directories to avoid QA failures if no modules were built
-	find ${D}/lib -depth -type d -empty -exec rmdir {} \;
+	find ${D}/${nonarch_base_libdir} -depth -type d -empty -exec rmdir {} \;
 }
 
 python do_package_prepend() {
-    if not os.path.exists(os.path.join(d.getVar('D', True), 'lib/modules')):
-        bb.warn("%s: no modules were created; this may be due to CONFIG_TRACEPOINTS not being enabled in your kernel." % d.getVar('PN', True))
+    if not os.path.exists(os.path.join(d.getVar('D'), d.getVar('nonarch_base_libdir')[1:], 'modules')):
+        bb.warn("%s: no modules were created; this may be due to CONFIG_TRACEPOINTS not being enabled in your kernel." % d.getVar('PN'))
 }
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-error.h-common-error.h.patch b/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-error.h-common-error.h.patch
deleted file mode 100644
index 6c8a9b2..0000000
--- a/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-error.h-common-error.h.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 6712db617fe9155ea236f6840c2bd18dbec4c871 Mon Sep 17 00:00:00 2001
-From: Michael Jeanson <mjeanson@efficios.com>
-Date: Wed, 15 Jun 2016 17:18:03 -0400
-Subject: [PATCH] Fix: error.h -> common/error.h
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Upstream-Status: Backport
-
-Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
-Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
-Signed-off-by: Peter Liu <peter.x.liu@external.atlascopco.com>
----
- src/bin/lttng-sessiond/agent.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/bin/lttng-sessiond/agent.c b/src/bin/lttng-sessiond/agent.c
-index 7cbbbde..310a7e8 100644
---- a/src/bin/lttng-sessiond/agent.c
-+++ b/src/bin/lttng-sessiond/agent.c
-@@ -29,7 +29,7 @@
- #include "agent.h"
- #include "ust-app.h"
- #include "utils.h"
--#include "error.h"
-+#include "common/error.h"
- 
- #define AGENT_RET_CODE_INDEX(code) (code - AGENT_RET_CODE_SUCCESS)
- 
--- 
-1.9.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools/run-ptest b/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools/run-ptest
index 6230063..705030e 100755
--- a/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools/run-ptest
+++ b/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools/run-ptest
@@ -1,5 +1,6 @@
 #!/bin/sh
 # Without --ignore-exit, the tap harness causes any FAILs within a
 # test plan to raise ERRORs; this is just noise.
-makeargs="LOG_DRIVER_FLAGS=--ignore-exit"
-make -t all >/dev/null 2>&1 && exec make -s $makeargs check 2>/dev/null
+makeargs="LOG_DRIVER_FLAGS=--ignore-exit top_srcdir=$PWD top_builddir=$PWD"
+make -k -t all >/dev/null 2>&1
+exec make -s $makeargs check 2>/dev/null
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools/x32.patch b/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools/x32.patch
new file mode 100644
index 0000000..b1bb8e4
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools/x32.patch
@@ -0,0 +1,16 @@
+Fix build for x32
+
+Upstream-Status: Pending
+Signed-off-by: Christopher Larson <chris_larson@mentor.com>
+
+--- lttng-tools-2.6.0/src/bin/lttng/utils.c~	2015-01-26 18:17:15.000000000 +0100
++++ lttng-tools-2.6.0/src/bin/lttng/utils.c	2015-07-30 19:45:25.632045712 +0200
+@@ -130,7 +130,7 @@
+ #define HAS_FLS_U32
+ #endif
+ 
+-#if defined(__x86_64)
++#if defined(__x86_64) && !defined(__ILP32__)
+ static inline
+ unsigned int fls_u64(uint64_t x)
+ {
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools_2.9.4.bb b/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools_2.9.4.bb
new file mode 100644
index 0000000..fbf3ae9
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools_2.9.4.bb
@@ -0,0 +1,122 @@
+SECTION = "devel"
+SUMMARY = "Linux Trace Toolkit Control"
+DESCRIPTION = "The Linux trace toolkit is a suite of tools designed \
+to extract program execution details from the Linux operating system \
+and interpret them."
+
+LICENSE = "GPLv2 & LGPLv2.1"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=01d7fc4496aacf37d90df90b90b0cac1 \
+                    file://gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+                    file://lgpl-2.1.txt;md5=0f0d71500e6a57fd24d825f33242b9ca"
+
+DEPENDS = "liburcu popt libxml2 util-linux"
+RDEPENDS_${PN} = "libgcc"
+RDEPENDS_${PN}-ptest += "make perl bash gawk ${PN} babeltrace procps"
+# babelstats.pl wants getopt-long
+RDEPENDS_${PN}-ptest += "perl-module-getopt-long"
+
+PYTHON_OPTION = "am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \
+                 am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \
+                 PYTHON_INCLUDE='-I${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}' \
+"
+PACKAGECONFIG ??= "lttng-ust"
+PACKAGECONFIG[python] = "--enable-python-bindings ${PYTHON_OPTION},,python3 swig-native"
+PACKAGECONFIG[lttng-ust] = "--with-lttng-ust, --without-lttng-ust, lttng-ust"
+PACKAGECONFIG[kmod] = "--enable-kmod, --disable-kmod, kmod"
+PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages, asciidoc-native xmlto-native libxslt-native"
+PACKAGECONFIG_remove_libc-musl = "lttng-ust"
+
+SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \
+           file://x32.patch \
+           file://run-ptest \
+           "
+
+SRC_URI[md5sum] = "10f47abfa214b167580358388428770d"
+SRC_URI[sha256sum] = "3c72456bceef961fad1d0861f07478db16b7659efa69099ba36645da89ca2cc5"
+
+inherit autotools ptest pkgconfig useradd python3-dir manpages
+
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "tracing"
+
+FILES_${PN} += "${libdir}/lttng/libexec/* ${datadir}/xml/lttng \
+                ${PYTHON_SITEPACKAGES_DIR}/*"
+FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
+FILES_${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la"
+
+# Since files are installed into ${libdir}/lttng/libexec we match 
+# the libexec insane test so skip it.
+# Python module needs to keep _lttng.so
+INSANE_SKIP_${PN} = "libexec dev-so"
+INSANE_SKIP_${PN}-dbg = "libexec"
+
+do_install_ptest () {
+    for f in Makefile tests/Makefile tests/utils/utils.sh ; do
+        install -D "${B}/$f" "${D}${PTEST_PATH}/$f"
+    done
+
+    for f in config/tap-driver.sh config/test-driver ; do
+        install -D "${S}/$f" "${D}${PTEST_PATH}/$f"
+    done
+
+    # Prevent 'make check' from recursing into non-test subdirectories.
+    sed -i -e 's!^SUBDIRS = .*!SUBDIRS = tests!' "${D}${PTEST_PATH}/Makefile"
+
+    # We don't need these
+    sed -i -e '/dist_noinst_SCRIPTS = /,/^$/d' "${D}${PTEST_PATH}/tests/Makefile"
+
+    # We shouldn't need to build anything in tests/utils
+    sed -i -e 's!am__append_1 = . utils!am__append_1 = . !' \
+        "${D}${PTEST_PATH}/tests/Makefile"
+
+    # Copy the tests directory tree and the executables and
+    # Makefiles found within.
+    for d in $(find "${B}/tests" -type d -not -name .libs -printf '%P ') ; do
+        install -d "${D}${PTEST_PATH}/tests/$d"
+        find "${B}/tests/$d" -maxdepth 1 -executable -type f \
+            -exec install -t "${D}${PTEST_PATH}/tests/$d" {} +
+        test -r "${B}/tests/$d/Makefile" && \
+            install -t "${D}${PTEST_PATH}/tests/$d" "${B}/tests/$d/Makefile"
+    done
+
+    # We shouldn't need to build anything in tests/regression/tools
+    sed -i -e 's!^SUBDIRS = tools !SUBDIRS = !' \
+        "${D}${PTEST_PATH}/tests/regression/Makefile"
+
+    # Prevent attempts to update Makefiles during test runs, and
+    # silence "Making check in $SUBDIR" messages.
+    find "${D}${PTEST_PATH}" -name Makefile -type f -exec \
+        sed -i -e '/Makefile:/,/^$/d' -e '/%: %.in/,/^$/d' \
+        -e '/echo "Making $$target in $$subdir"; \\/d' \
+        -e 's/^srcdir = \(.*\)/srcdir = ./' \
+        -e 's/^builddir = \(.*\)/builddir = ./' \
+        -e 's/^all-am:.*/all-am:/' \
+        {} +
+
+    # These objects trigger [rpaths] QA checks; the test harness
+    # skips the associated tests if they're missing, so delete
+    # them.
+    objs=""
+    objs="$objs regression/ust/ust-dl/libbar.so"
+    objs="$objs regression/ust/ust-dl/libfoo.so"
+    for obj in $objs ; do
+        rm -f "${D}${PTEST_PATH}/tests/${obj}"
+    done
+
+    find "${D}${PTEST_PATH}" -name Makefile -type f -exec \
+        touch -r "${B}/Makefile" {} +
+
+    # Substitute links to installed binaries.
+    for prog in lttng lttng-relayd lttng-sessiond lttng-consumerd ; do
+        exedir="${D}${PTEST_PATH}/src/bin/${prog}"
+        install -d "$exedir"
+        case "$prog" in
+            lttng-consumerd)
+                ln -s "${libdir}/lttng/libexec/$prog" "$exedir"
+                ;;
+            *)
+                ln -s "${bindir}/$prog" "$exedir"
+                ;;
+        esac
+    done
+}
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools_git.bb b/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools_git.bb
deleted file mode 100644
index b00ce8d..0000000
--- a/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-tools_git.bb
+++ /dev/null
@@ -1,119 +0,0 @@
-SECTION = "devel"
-SUMMARY = "Linux Trace Toolkit Control"
-DESCRIPTION = "The Linux trace toolkit is a suite of tools designed \
-to extract program execution details from the Linux operating system \
-and interpret them."
-
-LICENSE = "GPLv2 & LGPLv2.1"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=01d7fc4496aacf37d90df90b90b0cac1 \
-                    file://gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
-                    file://lgpl-2.1.txt;md5=0f0d71500e6a57fd24d825f33242b9ca"
-
-DEPENDS = "liburcu popt libxml2 util-linux"
-RDEPENDS_${PN} = "libgcc"
-RDEPENDS_${PN}-ptest += "make perl bash gawk ${PN} babeltrace procps"
-# babelstats.pl wants getopt-long
-RDEPENDS_${PN}-ptest += "perl-module-getopt-long"
-
-SRCREV = "d11e0dba0df9024b8613c51e167a379b91e8b20b"
-PV = "2.8.1+git${SRCPV}"
-
-PYTHON_OPTION = "am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \
-                 am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \
-                 PYTHON_INCLUDE='-I${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}' \
-"
-PACKAGECONFIG ??= "lttng-ust"
-PACKAGECONFIG[python] = "--enable-python-bindings ${PYTHON_OPTION},,python3 swig-native"
-PACKAGECONFIG[lttng-ust] = "--with-lttng-ust, --without-lttng-ust, lttng-ust"
-PACKAGECONFIG[kmod] = "--enable-kmod, --disable-kmod, kmod"
-PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages, asciidoc-native"
-PACKAGECONFIG_remove_libc-musl = "lttng-ust"
-
-SRC_URI = "git://git.lttng.org/lttng-tools.git;branch=stable-2.8 \
-           file://0001-Fix-error.h-common-error.h.patch \
-           file://run-ptest"
-
-S = "${WORKDIR}/git"
-
-inherit autotools-brokensep ptest pkgconfig useradd python3-dir
-
-USERADD_PACKAGES = "${PN}"
-GROUPADD_PARAM_${PN} = "tracing"
-
-FILES_${PN} += "${libdir}/lttng/libexec/* ${datadir}/xml/lttng \
-                ${PYTHON_SITEPACKAGES_DIR}/*"
-FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
-FILES_${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la"
-
-# Since files are installed into ${libdir}/lttng/libexec we match 
-# the libexec insane test so skip it.
-# Python module needs to keep _lttng.so
-INSANE_SKIP_${PN} = "libexec dev-so"
-INSANE_SKIP_${PN}-dbg = "libexec"
-
-do_configure_prepend () {
-	# Delete a shipped m4 file that overrides our patched one
-	rm -f ${S}/m4/libxml.m4
-}
-
-do_install_ptest () {
-	mkdir -p ${D}${PTEST_PATH}
-
-	cp -a -T ${B} ${D}${PTEST_PATH}
-
-	# Prevent attempts to update Makefiles during test runs, and
-	# silence "Making check in $SUBDIR" messages.
-	find ${D}${PTEST_PATH} -name Makefile -type f -exec \
-		sed -i -e 's!^Makefile:!_Makefile:!' \
-		-e '/echo "Making $$target in $$subdir"; \\/d' {} +
-
-	# Prevent attempts to update version.h during test runs.
-	sed -i -e '/^\.PHONY: version\.h$/d' ${D}${PTEST_PATH}/include/Makefile
-
-	# Silence "Making check in $SUBDIR" messages.
-	find ${D}${PTEST_PATH} -name Makefile -type f -exec \
-		sed -i -e '/echo "Making $$target in $$subdir"; \\/d' {} +
-
-	# Substitute links to installed binaries.
-	for prog in lttng lttng-relayd lttng-sessiond lttng-consumerd ; do
-		orig="${D}${PTEST_PATH}/src/bin/${prog}/${prog}"
-		rm "$orig"
-		case "$prog" in
-			lttng-consumerd)
-				ln -s "${libdir}/lttng/libexec/$prog" "$orig"
-				;;
-			*)
-				ln -s "${bindir}/$prog" "$orig"
-				;;
-		esac
-	done
-
-	# Remove libtool artifacts.
-	find ${D}${PTEST_PATH} \( -name '*.l[ao]' -o -name '*.lai' \) -delete
-
-	# Remove object files and archives.
-	find ${D}${PTEST_PATH} -name '*.[oa]' -type f -delete
-
-	# Remove Makefile.am and Makefile.in.
-	find ${D}${PTEST_PATH} -name 'Makefile.*' -type f -delete
-
-	# Remove autom4te.cache.
-	rm -rf ${D}${PTEST_PATH}/autom4te.cache
-
-	# Replace libtool wrapper scripts (which won't work on the
-	# target) with their corresponding binaries.
-	for prog in unit/ini_config/ini_config \
-		regression/tools/live/live_test \
-		regression/tools/health/health_check ; do
-		basename=${prog##*/}
-		ldir=${D}${PTEST_PATH}/tests/${prog%/*}
-		mv -f ${ldir}/.libs/${basename} ${ldir}
-	done
-
-	# checkpatch.pl is unneeded on target and causes file-rdeps QA
-	# warnings.
-	rm -f ${D}${PTEST_PATH}/extras/checkpatch.pl
-
-        # Remove built libraries as they confuse the packages' runtime dependency resolution
-        rm -rf ${D}${PTEST_PATH}/src/lib/lttng-ctl/.libs/
-}
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-ust/lttng-ust-doc-examples-disable.patch b/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-ust/lttng-ust-doc-examples-disable.patch
index caf0b8b..0f18c5d 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-ust/lttng-ust-doc-examples-disable.patch
+++ b/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-ust/lttng-ust-doc-examples-disable.patch
@@ -12,7 +12,7 @@
 +++ b/doc/Makefile.am
 @@ -1,4 +1,4 @@
 -SUBDIRS = . man examples
-+SUBDIRS = .
++SUBDIRS = . man
  
  dist_man_MANS = man/lttng-gen-tp.1 \
  	man/lttng-ust.3 \
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-ust_git.bb b/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-ust_2.9.0.bb
similarity index 73%
rename from import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-ust_git.bb
rename to import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-ust_2.9.0.bb
index baff71f..288b5ee 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-ust_git.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/lttng/lttng-ust_2.9.0.bb
@@ -8,7 +8,7 @@
                     file://snprintf/snprintf.c;endline=32;md5=d3d544959d8a3782b2e07451be0a903c \
                     file://snprintf/various.h;endline=31;md5=89f2509b6b4682c4fc95255eec4abe44"
 
-inherit autotools lib_package
+inherit autotools lib_package manpages
 
 DEPENDS = "liburcu util-linux"
 RDEPENDS_${PN}-bin = "python3-core"
@@ -18,25 +18,20 @@
 RREPLACES_${PN} = "lttng2-ust"
 RCONFLICTS_${PN} = "lttng2-ust"
 
-SRCREV = "514a87f3b64181e384399935a5708a8f85b0cc83"
 PE = "2"
-PV = "2.8.1+git${SRCPV}"
 
-SRC_URI = "git://git.lttng.org/lttng-ust.git;branch=stable-2.8 \
+SRC_URI = "https://lttng.org/files/lttng-ust/lttng-ust-${PV}.tar.bz2 \
            file://lttng-ust-doc-examples-disable.patch \
           "
+SRC_URI[md5sum] = "77f3378ba37a36801420bce87b702e9c"
+SRC_URI[sha256sum] = "4d541a863f42dfc685ca05024027a442c70d03594c154a43e62bc109b1ea5daf"
 
-EXTRA_OECONF += "--disable-man-pages"
+CVE_PRODUCT = "ust"
+
+PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages, asciidoc-native xmlto-native libxslt-native"
 
 do_install_append() {
         # Patch python tools to use Python 3; they should be source compatible, but
         # still refer to Python 2 in the shebang
         sed -i -e '1s,#!.*python.*,#!${bindir}/python3,' ${D}${bindir}/lttng-gen-tp
 }
-
-
-S = "${WORKDIR}/git"
-
-do_configure_prepend () {
-	( cd ${S}; ${S}/bootstrap )
-}
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/modutils-initscripts/modutils-initscripts.bb b/import-layers/yocto-poky/meta/recipes-kernel/modutils-initscripts/modutils-initscripts.bb
index db670cf..0f3df55 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/modutils-initscripts/modutils-initscripts.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/modutils-initscripts/modutils-initscripts.bb
@@ -22,7 +22,7 @@
 	install -m 0755 ${WORKDIR}/modutils.sh ${D}${sysconfdir}/init.d/
 }
 
-DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
+PACKAGE_WRITE_DEPS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
 pkg_postinst_${PN} () {
 	if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
 		if [ -n "$D" ]; then
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/perf/perf-features.inc b/import-layers/yocto-poky/meta/recipes-kernel/perf/perf-features.inc
deleted file mode 100644
index b8859ab..0000000
--- a/import-layers/yocto-poky/meta/recipes-kernel/perf/perf-features.inc
+++ /dev/null
@@ -1,22 +0,0 @@
-PERF_FEATURES_ENABLE ?= "perf-scripting perf-tui"
-
-def perf_feature_enabled(feature, trueval, falseval, d):
-    """
-    Check which perf features are enabled.
-
-    The PERF_FEATURES_ENABLE variable lists the perf features to
-    enable.  Override it if you want something different from what's
-    listed above, which is the default.  If empty, the build won't
-    enable any features (which may be exactly what you want, just a
-    barebones perf without any extra baggage, what you get if you
-    specify an empty feature list).
-
-    Available perf features:
-      perf-scripting: enable support for Perl and Python bindings
-      perf-tui: enable support for the perf TUI (via libnewt)
-
-    """
-    enabled_features = d.getVar("PERF_FEATURES_ENABLE", True) or ""
-    if feature in enabled_features:
-        return trueval
-    return falseval
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/perf/perf.bb b/import-layers/yocto-poky/meta/recipes-kernel/perf/perf.bb
index 8cf0f51..1bad6f4 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/perf/perf.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/perf/perf.bb
@@ -205,7 +205,7 @@
 }
 
 python do_package_prepend() {
-    d.setVar('PKGV', d.getVar("KERNEL_VERSION", True).split("-")[0])
+    d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
 }
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/sysprof/files/0001-Forward-port-mips-arm-memory-barrier-patches.patch b/import-layers/yocto-poky/meta/recipes-kernel/sysprof/files/0001-Forward-port-mips-arm-memory-barrier-patches.patch
deleted file mode 100644
index 92e804f..0000000
--- a/import-layers/yocto-poky/meta/recipes-kernel/sysprof/files/0001-Forward-port-mips-arm-memory-barrier-patches.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From a2d385e504323641b1127821833c61e77301c90b Mon Sep 17 00:00:00 2001
-From: Jussi Kukkonen <jussi.kukkonen@intel.com>
-Date: Sat, 11 Jun 2016 22:45:37 +0300
-Subject: [PATCH] Forward port mips & arm memory barrier patches
-
-Upstream-Status: Pending
-Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
----
- lib/util/util.h | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
-
-diff --git a/lib/util/util.h b/lib/util/util.h
-index 591722d..0768056 100644
---- a/lib/util/util.h
-+++ b/lib/util/util.h
-@@ -29,4 +29,19 @@
- #define read_barrier()           asm volatile("" ::: "memory")
- #endif
- 
-+#ifdef __arm__
-+/*
-+ * Use the __kuser_memory_barrier helper in the CPU helper page. See
-+ * arch/arm/kernel/entry-armv.S in the kernel source for details.
-+ */
-+#define read_barrier()         ((void(*)(void))0xffff0fa0)()
-+#endif
-+
-+#ifdef __mips__
-+#define read_barrier()         asm volatile(".set   mips2\n\t" \
-+                                            "sync\n\t" \
-+                                            ".set   mips0" ::: "memory")
-+#endif
-+
-+
- #endif /* SP_UTIL_H */
--- 
-2.1.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/sysprof/files/0001-callgraph-Use-U64_TO_POINTER.patch b/import-layers/yocto-poky/meta/recipes-kernel/sysprof/files/0001-callgraph-Use-U64_TO_POINTER.patch
deleted file mode 100644
index ac1384c..0000000
--- a/import-layers/yocto-poky/meta/recipes-kernel/sysprof/files/0001-callgraph-Use-U64_TO_POINTER.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 05816e6f9cd65b2624bb04de65fdf61031c7017f Mon Sep 17 00:00:00 2001
-From: Jussi Kukkonen <jussi.kukkonen@intel.com>
-Date: Fri, 10 Jun 2016 14:01:54 +0300
-Subject: [PATCH] callgraph: Use U64_TO_POINTER
-
-This fixes a "cast to pointer from integer of different size" on i586.
-
-Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
-Upstream-Status: Pending
----
- lib/sp-callgraph-view.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/sp-callgraph-view.c b/lib/sp-callgraph-view.c
-index 02cc17b..58315b0 100644
---- a/lib/sp-callgraph-view.c
-+++ b/lib/sp-callgraph-view.c
-@@ -135,7 +135,7 @@ build_functions_store (StackNode *node,
- 
-   gtk_list_store_append (state->store, &iter);
-   gtk_list_store_set (state->store, &iter,
--                      COLUMN_NAME, (const gchar *)node->data,
-+                      COLUMN_NAME, U64_TO_POINTER(node->data),
-                       COLUMN_SELF, 100.0 * size / state->profile_size,
-                       COLUMN_TOTAL, 100.0 * total / state->profile_size,
-                       COLUMN_POINTER, node,
--- 
-2.1.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/sysprof/sysprof_git.bb b/import-layers/yocto-poky/meta/recipes-kernel/sysprof/sysprof_3.22.3.bb
similarity index 68%
rename from import-layers/yocto-poky/meta/recipes-kernel/sysprof/sysprof_git.bb
rename to import-layers/yocto-poky/meta/recipes-kernel/sysprof/sysprof_3.22.3.bb
index 8d8b626..2631063 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/sysprof/sysprof_git.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/sysprof/sysprof_3.22.3.bb
@@ -3,24 +3,18 @@
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
                     file://src/sp-application.c;endline=17;md5=40e55577ef122c88fe20052acda64875"
 
-inherit gnomebase gettext systemd
+inherit gnomebase gettext systemd upstream-version-is-even
 
-DEPENDS = "glib-2.0"
+DEPENDS = "glib-2.0 libxml2-native glib-2.0-native"
 
-S = "${WORKDIR}/git"
-SRCREV = "9c6cec9b49766bf77c1713bc5a7c6d651e628068"
-PV = "3.20.0+git${SRCPV}"
-
-SRC_URI = "git://git.gnome.org/sysprof \
+SRC_URI += " \
            file://define-NT_GNU_BUILD_ID.patch \
            file://0001-configure-Add-option-to-enable-disable-polkit.patch \
            file://0001-Disable-check-for-polkit-for-UI.patch \
            file://0001-Avoid-building-docs.patch \
-           file://0001-callgraph-Use-U64_TO_POINTER.patch \
-           file://0001-Forward-port-mips-arm-memory-barrier-patches.patch \
           "
-SRC_URI[archive.md5sum] = "d56e8492033b60e247634731e7f760b9"
-SRC_URI[archive.sha256sum] = "4a338ad41bfffae87ef281f6e75c9660b3e0c6671bf5233be0c3f55a5e5b1ce5"
+SRC_URI[archive.sha256sum] = "e6dca325b3014440f457a92db18ffe342a35888db3f0756694a99b9652796367"
+SRC_URI[archive.md5sum] = "9514065dc752105240e5567c13708af4"
 
 AUTOTOOLS_AUXDIR = "${S}/build-aux"
 
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/systemtap/systemtap-native_git.bb b/import-layers/yocto-poky/meta/recipes-kernel/systemtap/systemtap-native_git.bb
new file mode 100644
index 0000000..c3da77c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-kernel/systemtap/systemtap-native_git.bb
@@ -0,0 +1,7 @@
+
+require systemtap_git.bb
+
+inherit native
+
+RM_WORK_EXCLUDE_ITEMS += "recipe-sysroot-native"
+addtask addto_recipe_sysroot after do_populate_sysroot before do_build
diff --git a/import-layers/yocto-poky/meta/recipes-kernel/systemtap/systemtap_git.bb b/import-layers/yocto-poky/meta/recipes-kernel/systemtap/systemtap_git.bb
index fed368a..b3fd973 100644
--- a/import-layers/yocto-poky/meta/recipes-kernel/systemtap/systemtap_git.bb
+++ b/import-layers/yocto-poky/meta/recipes-kernel/systemtap/systemtap_git.bb
@@ -25,4 +25,4 @@
 
 inherit autotools gettext pkgconfig distutils3-base
 
-BBCLASSEXTEND = "native nativesdk"
+BBCLASSEXTEND = "nativesdk"