reset upstream subtrees to HEAD

Reset the following subtrees on HEAD:
  poky: 8217b477a1(master)
  meta-xilinx: 64aa3d35ae(master)
  meta-openembedded: 0435c9e193(master)
  meta-raspberrypi: 490a4441ac(master)
  meta-security: cb6d1c85ee(master)

Squashed patches:
  meta-phosphor: drop systemd 239 patches
  meta-phosphor: mrw-api: use correct install path

Change-Id: I268e2646d9174ad305630c6bbd3fbc1a6105f43d
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-openembedded/meta-initramfs/README b/meta-openembedded/meta-initramfs/README
index ba2ba5f..79244d4 100644
--- a/meta-openembedded/meta-initramfs/README
+++ b/meta-openembedded/meta-initramfs/README
@@ -12,7 +12,7 @@
 This layer depends on:
 
 URI: git://github.com/openembedded/oe-core.git
-branch: thud
+branch: master
 revision: HEAD
 
 
@@ -20,12 +20,12 @@
 -----------
 
 Send patches / pull requests to openembedded-devel@lists.openembedded.org
-with '[meta-initramfs][thud]' in the subject.
+with '[meta-initramfs]' in the subject.
 
 When sending single patches, please using something like:
-'git send-email -M -1 --to openembedded-devel@lists.openembedded.org --subject-prefix=meta-initramfs][thud][PATCH'
+'git send-email -M -1 --to openembedded-devel@lists.openembedded.org --subject-prefix=meta-initramfs][PATCH'
 
-Thud maintainer: Armin Kuster <akuster808@gmail.com>
+Interm layer maintainer: Khem Raj <raj.khem@gmail.com>
 
 
 License
diff --git a/meta-openembedded/meta-initramfs/classes/klibc.bbclass b/meta-openembedded/meta-initramfs/classes/klibc.bbclass
index b7b72b7..bba10f1 100644
--- a/meta-openembedded/meta-initramfs/classes/klibc.bbclass
+++ b/meta-openembedded/meta-initramfs/classes/klibc.bbclass
@@ -8,9 +8,9 @@
 CC_append_armv7ve = " ${@' -mfloat-abi=${TUNE_CCARGS_MFLOAT}' if (d.getVar('TUNE_CCARGS_MFLOAT') != '') else ''}"
 CC_append_armv7a = " ${@' -mfloat-abi=${TUNE_CCARGS_MFLOAT}' if (d.getVar('TUNE_CCARGS_MFLOAT') != '') else ''}"
 
-CPP_forcevariable = "${CC} -E"
-
 # klcc uses own optimizations by default. See klcc(1) man file.
 export CFLAGS="${TUNE_CCARGS}"
 export CPPFLAGS="${TUNE_CCARGS}"
 export LDFLAGS="${TUNE_CCARGS}"
+
+OVERRIDES =. "libc-klibc:"
diff --git a/meta-openembedded/meta-initramfs/conf/layer.conf b/meta-openembedded/meta-initramfs/conf/layer.conf
index bd92ddf..6e0b00d 100644
--- a/meta-openembedded/meta-initramfs/conf/layer.conf
+++ b/meta-openembedded/meta-initramfs/conf/layer.conf
@@ -16,7 +16,7 @@
 BBFILE_PRIORITY_meta-initramfs = "8"
 LAYERDEPENDS_meta-initramfs = "core"
 
-LAYERSERIES_COMPAT_meta-initramfs = "thud"
+LAYERSERIES_COMPAT_meta-initramfs = "thud warrior"
 
 SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS += " \
   dracut->virtual/kernel \
diff --git a/meta-openembedded/meta-initramfs/recipes-bsp/kexecboot/files/0001-kexecboot-Use-new-reboot-API-with-klibc.patch b/meta-openembedded/meta-initramfs/recipes-bsp/kexecboot/files/0001-kexecboot-Use-new-reboot-API-with-klibc.patch
new file mode 100644
index 0000000..52d622a
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-bsp/kexecboot/files/0001-kexecboot-Use-new-reboot-API-with-klibc.patch
@@ -0,0 +1,42 @@
+From a6d1678379df6142a68cc9bb76dae540a31b8fdb Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 14 Mar 2019 23:47:50 -0700
+Subject: [PATCH] kexecboot: Use new reboot() API with klibc
+
+Klibc has changed this API in
+https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=6b621b8705ce5901dcf49607c8a3523c9e521901
+
+therefore adopt the code
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/kexecboot.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/kexecboot.c b/src/kexecboot.c
+index cf49b40..c785fce 100644
+--- a/src/kexecboot.c
++++ b/src/kexecboot.c
+@@ -857,7 +857,7 @@ int process_ctx_menu(struct params_t *params, int action) {
+ #else
+ 		sync();
+ 		/* if ( -1 == reboot(LINUX_REBOOT_CMD_RESTART) ) { */
+-		if ( -1 == reboot(RB_AUTOBOOT) ) {
++		if ( -1 == reboot(RB_AUTOBOOT, NULL) ) {
+ 			log_msg(lg, "Can't initiate reboot: %s", ERRMSG);
+ 		}
+ #endif
+@@ -874,7 +874,7 @@ int process_ctx_menu(struct params_t *params, int action) {
+ #else
+ 		sync();
+ 		/* if ( -1 == reboot(LINUX_REBOOT_CMD_POWER_OFF) ) { */
+-		if ( -1 == reboot(RB_POWER_OFF) ) {
++		if ( -1 == reboot(RB_POWER_OFF, NULL) ) {
+ 			log_msg(lg, "Can't initiate shutdown: %s", ERRMSG);
+ 		}
+ #endif
+-- 
+2.21.0
+
diff --git a/meta-openembedded/meta-initramfs/recipes-bsp/kexecboot/kexecboot_git.bb b/meta-openembedded/meta-initramfs/recipes-bsp/kexecboot/kexecboot_git.bb
index 6d79e8f..4b20e1e 100644
--- a/meta-openembedded/meta-initramfs/recipes-bsp/kexecboot/kexecboot_git.bb
+++ b/meta-openembedded/meta-initramfs/recipes-bsp/kexecboot/kexecboot_git.bb
@@ -6,7 +6,9 @@
 PV = "0.6+git${SRCPV}"
 S = "${WORKDIR}/git"
 SRC_URI = "git://github.com/kexecboot/kexecboot.git"
-SRCREV = "4c01d6960aa6a9d03675605062469ab777fa2b01"
+SRC_URI_append_libc-klibc = " file://0001-kexecboot-Use-new-reboot-API-with-klibc.patch "
+
+SRCREV = "7409a1e0aaea61af87c4eca0149cec18a9f58ab6"
 inherit autotools
 
 EXTRA_OECONF = "--enable-textui --enable-delay=2 --enable-evdev-rate=1000,250"
diff --git a/meta-openembedded/meta-initramfs/recipes-core/images/meta-initramfs-image.bb b/meta-openembedded/meta-initramfs/recipes-core/images/meta-initramfs-image.bb
new file mode 100644
index 0000000..9d70d6d
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-core/images/meta-initramfs-image.bb
@@ -0,0 +1,8 @@
+SUMMARY = "meta-initramfs build test image"
+
+IMAGE_INSTALL = "packagegroup-core-boot \
+                 packagegroup-meta-initramfs"
+
+LICENSE = "MIT"
+
+inherit core-image
diff --git a/meta-openembedded/meta-initramfs/recipes-core/packagegroups/packagegroup-meta-initramfs.bb b/meta-openembedded/meta-initramfs/recipes-core/packagegroups/packagegroup-meta-initramfs.bb
new file mode 100644
index 0000000..bfede5a
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-core/packagegroups/packagegroup-meta-initramfs.bb
@@ -0,0 +1,36 @@
+SUMMARY = "Meta-initramfs packagegroups"
+
+inherit packagegroup
+
+PROVIDES = "${PACKAGES}"
+PACKAGES = ' \
+    packagegroup-meta-initramfs \
+    packagegroup-meta-initramfs-devtools \
+    packagegroup-meta-initramfs-kernel \
+'
+
+RDEPENDS_packagegroup-meta-initramfs = "\
+    packagegroup-meta-initramfs-devtools \
+    packagegroup-meta-initramfs-kernel \
+"
+
+RDEPENDS_packagegroup-meta-initramfs-devtools = "\
+    libklibc  dracut \
+    klibc-utils-cat klibc-utils-losetup klibc-utils-readlink klibc-utils-chroot \
+    klibc-utils-ls klibc-utils-reboot klibc-utils-cpio klibc-utils-minips \
+    klibc-utils-resume klibc-utils-dd klibc-utils-mkdir klibc-utils-run-init \
+    klibc-utils-dmesg klibc-utils-mkfifo klibc-utils-sh.shared klibc-utils-false \
+    klibc-utils-mknod klibc-utils-sleep klibc-utils-fstype klibc-utils-mount \
+    klibc-utils-sync klibc-utils-halt klibc-utils-mv klibc-utils-true klibc-utils-ipconfig \
+    klibc-utils-nfsmount klibc-utils-umount klibc-utils-kill klibc-utils-nuke klibc-utils-uname \
+    mtdinfo-klibc ubiattach-klibc ubiblock-klibc ubicrc32-klibc ubidetach-klibc \
+    ubiformat-klibc ubimkvol-klibc ubinfo-klibc ubinize-klibc ubirename-klibc \
+    ubirmvol-klibc ubirsvol-klibc ubiupdatevol-klibc \
+    ${@bb.utils.contains_any("TRANSLATED_TARGET_ARCH", "i586 x86-64", "grubby", "", d)} \
+    "
+
+RDEPENDS_packagegroup-meta-initramfs-kernel = "\
+    kexec-klibc vmcore-dmesg-klibc \
+    "
+
+EXCLUDE_FROM_WORLD = "1"
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Define-in_-structs-for-non-glibc-system-libs.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-Define-in_-structs-for-non-glibc-system-libs.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Define-in_-structs-for-non-glibc-system-libs.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-Define-in_-structs-for-non-glibc-system-libs.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Define-ulocked_-fgets-fread-fwrite-aliases.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-Define-ulocked_-fgets-fread-fwrite-aliases.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Define-ulocked_-fgets-fread-fwrite-aliases.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-Define-ulocked_-fgets-fread-fwrite-aliases.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-Kbuild.klibc-Add-path-to-compiler-headers-via-isyste.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-Kbuild.klibc-Use-print-libgcc-file-name-instead-of-p.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-always-use-bfd-linker.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-always-use-bfd-linker.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-always-use-bfd-linker.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-always-use-bfd-linker.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-arm-Do-not-set-a-fallback-march-and-mtune.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-arm-Do-not-set-a-fallback-march-and-mtune.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-arm-Do-not-set-a-fallback-march-and-mtune.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-arm-Do-not-set-a-fallback-march-and-mtune.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-dash-Specify-format-string-in-fmtstr.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-dash-Specify-format-string-in-fmtstr.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-dash-Specify-format-string-in-fmtstr.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-dash-Specify-format-string-in-fmtstr.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-include-linux-sysinfo.h-directly.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-include-linux-sysinfo.h-directly.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-include-linux-sysinfo.h-directly.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-include-linux-sysinfo.h-directly.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-klibc-Kbuild-Accept-EXTRA_KLIBCAFLAGS.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-klibc-Kbuild-Accept-EXTRA_KLIBCAFLAGS.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-klibc-Kbuild-Accept-EXTRA_KLIBCAFLAGS.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-klibc-Kbuild-Accept-EXTRA_KLIBCAFLAGS.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-klibc-add-getrandom-syscall.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-klibc-add-getrandom-syscall.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-klibc-add-getrandom-syscall.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-klibc-add-getrandom-syscall.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-klibc_2.0.4-add-kexec_file_load-syscall.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-klibc_2.0.4-add-kexec_file_load-syscall.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-klibc_2.0.4-add-kexec_file_load-syscall.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-klibc_2.0.4-add-kexec_file_load-syscall.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-mkfifo-Implement-mkfifo.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-mkfifo-Implement-mkfifo.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-mkfifo-Implement-mkfifo.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/0001-mkfifo-Implement-mkfifo.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/armv4-fix-v4bx.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/armv4-fix-v4bx.patch
similarity index 84%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/armv4-fix-v4bx.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/armv4-fix-v4bx.patch
index e842353..4a334fa 100644
--- a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/armv4-fix-v4bx.patch
+++ b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/armv4-fix-v4bx.patch
@@ -12,12 +12,10 @@
  usr/klibc/arch/arm/MCONFIG | 1 +
  1 file changed, 1 insertion(+)
 
-diff --git a/usr/klibc/arch/arm/MCONFIG b/usr/klibc/arch/arm/MCONFIG
-index 53bc1dc..303c6ac 100644
 --- a/usr/klibc/arch/arm/MCONFIG
 +++ b/usr/klibc/arch/arm/MCONFIG
 @@ -29,6 +29,7 @@ else
- KLIBCSHAREDFLAGS = -Ttext 0x01800200
+ KLIBCSHAREDFLAGS = -Ttext-segment 0x01800000
  ifeq ($(CONFIG_AEABI),y)
  KLIBCREQFLAGS += -mabi=aapcs-linux -mno-thumb-interwork
 +KLIBCLDFLAGS += $(FIX_ARMV4_EABI_BX)
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/klcc-consider-sysroot.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/klcc-consider-sysroot.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-cross-accept-clang-options.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/klcc-cross-accept-clang-options.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-cross-accept-clang-options.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/klcc-cross-accept-clang-options.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klibc-config-eabi.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/klibc-config-eabi.patch
similarity index 85%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klibc-config-eabi.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/klibc-config-eabi.patch
index f28cd54..a6998f8 100644
--- a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klibc-config-eabi.patch
+++ b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/klibc-config-eabi.patch
@@ -12,13 +12,12 @@
  defconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/defconfig b/defconfig
-index 04b98e9..0cb23d0 100644
 --- a/defconfig
 +++ b/defconfig
-@@ -6,4 +6,4 @@ CONFIG_KLIBC_ZLIB=y
+@@ -6,5 +6,5 @@ CONFIG_KLIBC_ZLIB=y
  CONFIG_REGPARM=y
  # ARM options
  # CONFIG_KLIBC_THUMB is not set
 -# CONFIG_AEABI is not set
 +CONFIG_AEABI=y
+ # CONFIG_DEBUG_INFO is not set
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/use-env-for-perl.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/use-env-for-perl.patch
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/use-env-for-perl.patch
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/files/use-env-for-perl.patch
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klcc-cross_2.0.4.bb b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klcc-cross_2.0.6.bb
similarity index 72%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klcc-cross_2.0.4.bb
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/klcc-cross_2.0.6.bb
index b285b2e..4011aa2 100644
--- a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klcc-cross_2.0.4.bb
+++ b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klcc-cross_2.0.6.bb
@@ -7,8 +7,6 @@
 PACKAGES = ""
 inherit nopackages
 
-FILESPATH =. "${FILE_DIRNAME}/klibc-${PV}:"
-
 SRC_URI += "file://use-env-for-perl.patch"
 
 # disable task already run in klibc recipe
@@ -25,8 +23,8 @@
     # magic by removing all the crazy escaping.
     sed -i -e "2i \$TARGETSYSROOT = '${STAGING_DIR_TARGET}';" \
            -e "2i \$NATIVESYSROOT = '${STAGING_DIR_NATIVE}';" \
-           -e 's#${@d.getVar("STAGING_DIR_NATIVE", True).replace("/", "\\\\/").replace("-", "\\\\-").replace(".", "\\\\.")}#${NATIVESYSROOT}#g;' \
-           -e 's#${@d.getVar("STAGING_DIR_TARGET", True).replace("/", "\\\\/").replace("-", "\\\\-").replace(".", "\\\\.")}#${TARGETSYSROOT}#g' \
+           -e 's#${@d.getVar("STAGING_DIR_NATIVE").replace("/", "\\\\/").replace("-", "\\\\-").replace(".", "\\\\.")}#${NATIVESYSROOT}#g;' \
+           -e 's#${@d.getVar("STAGING_DIR_TARGET").replace("/", "\\\\/").replace("-", "\\\\-").replace(".", "\\\\.")}#${TARGETSYSROOT}#g' \
         ${D}${bindir_crossscripts}/${TARGET_PREFIX}klcc
 }
 
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-klibc-static-utils-do-not-build-shared-binaries.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-klibc-static-utils-do-not-build-shared-binaries.patch
deleted file mode 100644
index 2f7cd35..0000000
--- a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-klibc-static-utils-do-not-build-shared-binaries.patch
+++ /dev/null
@@ -1,213 +0,0 @@
-From c034dceae17b7d8d437871afe5eba55a55434222 Mon Sep 17 00:00:00 2001
-From: Andrea Adami <andrea.adami@gmail.com>
-Date: Wed, 10 Oct 2018 00:48:31 +0200
-Subject: [PATCH] klibc-static-utils: do not build shared binaries
-
-We were building some shared utilities and this was leading to linker errors
-for x86 with security flags enabled.
-
-Fix
- i586-oe-linux-musl-ld.bfd: discarded output section: `.got.plt'
-
-Upstream-Status: Inappropriate [Embedded Specific]
-
-Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
----
- usr/dash/Kbuild           | 6 +-----
- usr/kinit/Kbuild          | 4 +---
- usr/kinit/fstype/Kbuild   | 4 +---
- usr/kinit/ipconfig/Kbuild | 4 +---
- usr/kinit/nfsmount/Kbuild | 4 +---
- usr/kinit/resume/Kbuild   | 5 +----
- usr/kinit/run-init/Kbuild | 5 +----
- usr/utils/Kbuild          | 7 ++-----
- 8 files changed, 9 insertions(+), 30 deletions(-)
-
-diff --git a/usr/dash/Kbuild b/usr/dash/Kbuild
-index 1a6920a..b3a4e64 100644
---- a/usr/dash/Kbuild
-+++ b/usr/dash/Kbuild
-@@ -25,12 +25,8 @@ gen-h-files := builtins.h nodes.h syntax.h token.h
- 
- static-y := sh
- 
--# The shared binary
--shared-y    := sh.shared
--sh.shared-y := $(sh-y)
--
- # For cleaning
--targets := sh sh.g sh.shared sh.shared.g $(gen-o-files)
-+targets := sh sh.g $(gen-o-files)
- 
- # explicit dependency for all generated files
- $(addprefix $(obj)/, $(sh-y)): $(addprefix $(obj)/, $(gen-h-files))
-diff --git a/usr/kinit/Kbuild b/usr/kinit/Kbuild
-index f7fdccd..8db06ab 100644
---- a/usr/kinit/Kbuild
-+++ b/usr/kinit/Kbuild
-@@ -18,8 +18,6 @@ kinit-y  += fstype/
- kinit-y  += resume/
- 
- static-y := kinit
--shared-y := kinit.shared
--kinit.shared-y := $(kinit-y)
- 
- # Additional include paths files
- KLIBCCFLAGS += -I$(srctree)/$(src)/fstype \
-@@ -29,7 +27,7 @@ KLIBCCFLAGS += -I$(srctree)/$(src)/fstype \
-  	       -I$(srctree)/$(src)/run-init
- 
- # Cleaning
--targets += kinit kinit.g kinit.shared kinit.shared.g
-+targets += kinit kinit.g
- subdir- := fstype ipconfig nfsmount resume run-init
- 
- 
-diff --git a/usr/kinit/fstype/Kbuild b/usr/kinit/fstype/Kbuild
-index 367611d..8d453ea 100644
---- a/usr/kinit/fstype/Kbuild
-+++ b/usr/kinit/fstype/Kbuild
-@@ -3,7 +3,6 @@
- #
- 
- static-y := static/fstype
--shared-y := shared/fstype
- 
- # common .o files
- objs := main.o fstype.o
-@@ -16,8 +15,7 @@ lib-y := $(objs)
- 
- # .o files used to built executables
- static/fstype-y := $(objs)
--shared/fstype-y := $(objs)
- 
- # Cleaning
--clean-dirs := static shared
-+clean-dirs := static
- 
-diff --git a/usr/kinit/ipconfig/Kbuild b/usr/kinit/ipconfig/Kbuild
-index eb1d472..ef87e7e 100644
---- a/usr/kinit/ipconfig/Kbuild
-+++ b/usr/kinit/ipconfig/Kbuild
-@@ -3,7 +3,6 @@
- #
- 
- static-y := static/ipconfig
--shared-y := shared/ipconfig
- 
- # common .o files
- objs := main.o netdev.o packet.o
-@@ -22,8 +21,7 @@ lib-y := $(objs)
- 
- # .o files used to built executables
- static/ipconfig-y := $(objs)
--shared/ipconfig-y := $(objs)
- 
- # Cleaning
--clean-dirs := static shared
-+clean-dirs := static
- 
-diff --git a/usr/kinit/nfsmount/Kbuild b/usr/kinit/nfsmount/Kbuild
-index ba31708..01bedce 100644
---- a/usr/kinit/nfsmount/Kbuild
-+++ b/usr/kinit/nfsmount/Kbuild
-@@ -4,7 +4,6 @@
- 
- static-y := static/nfsmount
- #FIXME - build is broken static-y := dummypmap
--shared-y := shared/nfsmount
- 
- objs := main.o mount.o portmap.o dummypmap.o sunrpc.o
- 
-@@ -13,7 +12,6 @@ lib-y := $(objs)
- 
- # .o files used for executables
- static/nfsmount-y := $(objs)
--shared/nfsmount-y := $(objs)
- 
- # dummypmap uses a single .o file (rename src file?)
- dummypmap-y := dummypmap_test.o
-@@ -21,5 +19,5 @@ dummypmap-y := dummypmap_test.o
- # TODO - do we want a stripped version
- # TODO - do we want the static.g + shared.g directories?
- 
--clean-dirs := static shared
-+clean-dirs := static
- 
-diff --git a/usr/kinit/resume/Kbuild b/usr/kinit/resume/Kbuild
-index c1342e1..15b9590 100644
---- a/usr/kinit/resume/Kbuild
-+++ b/usr/kinit/resume/Kbuild
-@@ -3,7 +3,6 @@
- #
- 
- static-y := static/resume
--shared-y := shared/resume
- 
- # common .o files
- objs := resume.o resumelib.o
-@@ -20,9 +19,7 @@ KLIBCCFLAGS += -I$(srctree)/$(src)/..
- # .o files used to built executables
- static/resume-y   := $(objs)
- static/resume-lib := ../lib.a
--shared/resume-y   := $(objs)
--shared/resume-lib := ../lib.a
- 
- # Cleaning
--clean-dirs := static shared
-+clean-dirs := static
- 
-diff --git a/usr/kinit/run-init/Kbuild b/usr/kinit/run-init/Kbuild
-index c153b0a..a1ea834 100644
---- a/usr/kinit/run-init/Kbuild
-+++ b/usr/kinit/run-init/Kbuild
-@@ -3,7 +3,6 @@
- #
- 
- static-y := static/run-init
--shared-y := shared/run-init
- 
- # common .o files
- objs := run-init.o runinitlib.o
-@@ -24,9 +23,7 @@ KLIBCCFLAGS += -I$(srctree)/$(src)/..
- # .o files used to built executables
- static/run-init-y   := $(objs)
- static/run-init-lib := ../lib.a
--shared/run-init-y   := $(objs)
--shared/run-init-lib := ../lib.a
- 
- # Cleaning
--clean-dirs := static shared
-+clean-dirs := static
- 
-diff --git a/usr/utils/Kbuild b/usr/utils/Kbuild
-index 67d9486..1573363 100644
---- a/usr/utils/Kbuild
-+++ b/usr/utils/Kbuild
-@@ -7,7 +7,6 @@ progs += true false sleep ln mv nuke minips cat ls losetup
- progs += uname halt kill readlink cpio sync dmesg
- 
- static-y := $(addprefix static/, $(progs))
--shared-y := $(addprefix shared/, $(progs))
- 
- # The binary is placed in a subdir, so we need to tell kbuild this
- static/chroot-y     := chroot.o
-@@ -62,13 +61,11 @@ static/losetup-y    := losetup.o
- shared/losetup-y    := losetup.o
- 
- # Additionally linked targets
--always := static/reboot static/poweroff shared/reboot shared/poweroff
-+always := static/reboot static/poweroff
- 
- $(obj)/static/reboot $(obj)/static/poweroff: $(obj)/static/halt
- 	$(call cmd,ln)
--$(obj)/shared/reboot $(obj)/shared/poweroff: $(obj)/shared/halt
--	$(call cmd,ln)
- 
- # Clean deletes the static and shared dir
--clean-dirs := static shared
-+clean-dirs := static
- 
--- 
-2.7.4
-
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klibc-linux-libc-dev.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klibc-linux-libc-dev.patch
deleted file mode 100644
index a5563b7..0000000
--- a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klibc-linux-libc-dev.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 1be2bc41f915922102a3ba671b54c2df6f0052e6 Mon Sep 17 00:00:00 2001
-From: Ben Hutchings <ben@decadent.org.uk>
-Date: Sun, 14 Mar 2010 18:41:56 +0000
-Subject: [PATCH] klibc_1.5.26: now build against linux-libc-headers
-
-commit 43adf69062254fb4f8d4d11fb5fe36a60ae25d5a
-
-    Taken from debian "Fix klibc Debian specific build trouble"
-    Adapted for klibc_2.0.2
-
----
- scripts/Kbuild.install | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/scripts/Kbuild.install b/scripts/Kbuild.install
-index 8af5697..d32a8a5 100644
---- a/scripts/Kbuild.install
-+++ b/scripts/Kbuild.install
-@@ -95,7 +95,9 @@ header:
- 	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
- 	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib
- 	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin
--	$(Q)$(MAKE) -C $(KLIBCKERNELSRC) ARCH=$(KLIBCARCH) INSTALL_HDR_PATH=$(INSTALLROOT)$(INSTALLDIR)/$(KCROSS) headers_install
-+	$(Q)for x in ../../../include/asm ../../../include/asm-generic ../../../include/linux ../../../include/mtd; do \
-+		ln -sf $${x} $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/ || exit; \
-+	done
- 	$(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/.
- 	$(Q)chmod -R a+rX,go-w $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
- 	$(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/staging.patch b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/staging.patch
deleted file mode 100644
index 5c7a662..0000000
--- a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/staging.patch
+++ /dev/null
@@ -1,151 +0,0 @@
-From 1892079b827cf8f8316305b6d6e0985db82441a2 Mon Sep 17 00:00:00 2001
-From: Thomas Kunze <thommycheck@gmx.de>
-Date: Sat, 6 Aug 2011 05:30:14 +0000
-Subject: [PATCH] klibc: initial commit of version 1.5.24
-
-Patch was imported from the OpenEmbedded git server
-(git://git.openembedded.org/openembedded)
-as of commit id eefb99a313bbcc8f34c8b32bf0c5aa2dd2580735
-Signed-off-by: Thomas Kunze <thommycheck@gmx.de>
-
-Minor edits following upstream changes
-Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
-
----
- scripts/Kbuild.install    | 4 ----
- usr/dash/Kbuild           | 2 --
- usr/gzip/Kbuild           | 2 --
- usr/kinit/Kbuild          | 2 --
- usr/kinit/fstype/Kbuild   | 2 --
- usr/kinit/ipconfig/Kbuild | 2 --
- usr/kinit/nfsmount/Kbuild | 2 --
- usr/kinit/resume/Kbuild   | 2 --
- usr/kinit/run-init/Kbuild | 2 --
- usr/klibc/Kbuild          | 2 --
- usr/utils/Kbuild          | 2 --
- 11 files changed, 24 deletions(-)
-
-diff --git a/scripts/Kbuild.install b/scripts/Kbuild.install
-index d32a8a5..fda699d 100644
---- a/scripts/Kbuild.install
-+++ b/scripts/Kbuild.install
-@@ -88,19 +88,15 @@ else
- header:
- 	$(Q)echo "  INSTALL headers + man pages to $(INSTALLROOT)$(INSTALLDIR)"
- 	$(Q)mkdir -p $(INSTALLROOT)$(bindir)
--	$(Q)mkdir -p $(INSTALLROOT)$(mandir)/man1
--	$(Q)mkdir -p $(INSTALLROOT)$(SHLIBDIR)
- 	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)
- 	$(Q)-rm -rf $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
- 	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
- 	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib
--	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin
- 	$(Q)for x in ../../../include/asm ../../../include/asm-generic ../../../include/linux ../../../include/mtd; do \
- 		ln -sf $${x} $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/ || exit; \
- 	done
- 	$(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/.
- 	$(Q)chmod -R a+rX,go-w $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
--	$(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1
- 	$(Q)$(install-bin) $(objtree)/klcc/$(KCROSS)klcc $(INSTALLROOT)$(bindir)
- 
- footer: header
-diff --git a/usr/dash/Kbuild b/usr/dash/Kbuild
-index 3a98c1f..1a6920a 100644
---- a/usr/dash/Kbuild
-+++ b/usr/dash/Kbuild
-@@ -92,5 +92,3 @@ $(obj)/syntax.c: $(obj)/mksyntax
- $(obj)/syntax.h: $(obj)/syntax.c
- 	$(Q):
- 
--# Targets to install
--install-y := sh.shared
-diff --git a/usr/gzip/Kbuild b/usr/gzip/Kbuild
-index 9bbf0a4..c497d02 100644
---- a/usr/gzip/Kbuild
-+++ b/usr/gzip/Kbuild
-@@ -21,5 +21,3 @@ $(obj)/gunzip $(obj)/zcat: $(obj)/gzip
- # Cleaning
- targets := gzip gzip.g gunzip zcat
- 
--# Targets to install
--install-y := gzip gunzip zcat
-diff --git a/usr/kinit/Kbuild b/usr/kinit/Kbuild
-index 5320127..f7fdccd 100644
---- a/usr/kinit/Kbuild
-+++ b/usr/kinit/Kbuild
-@@ -33,5 +33,3 @@ targets += kinit kinit.g kinit.shared kinit.shared.g
- subdir- := fstype ipconfig nfsmount resume run-init
- 
- 
--# install binary
--install-y := kinit kinit.shared
-diff --git a/usr/kinit/fstype/Kbuild b/usr/kinit/fstype/Kbuild
-index 9b20db1..367611d 100644
---- a/usr/kinit/fstype/Kbuild
-+++ b/usr/kinit/fstype/Kbuild
-@@ -21,5 +21,3 @@ shared/fstype-y := $(objs)
- # Cleaning
- clean-dirs := static shared
- 
--# install binary
--install-y := $(shared-y)
-diff --git a/usr/kinit/ipconfig/Kbuild b/usr/kinit/ipconfig/Kbuild
-index 7f8d181..eb1d472 100644
---- a/usr/kinit/ipconfig/Kbuild
-+++ b/usr/kinit/ipconfig/Kbuild
-@@ -27,5 +27,3 @@ shared/ipconfig-y := $(objs)
- # Cleaning
- clean-dirs := static shared
- 
--# install binary
--install-y := $(shared-y)
-diff --git a/usr/kinit/nfsmount/Kbuild b/usr/kinit/nfsmount/Kbuild
-index 461e6f3..ba31708 100644
---- a/usr/kinit/nfsmount/Kbuild
-+++ b/usr/kinit/nfsmount/Kbuild
-@@ -23,5 +23,3 @@ dummypmap-y := dummypmap_test.o
- 
- clean-dirs := static shared
- 
--# Install binary
--install-y := $(shared-y)
-diff --git a/usr/kinit/resume/Kbuild b/usr/kinit/resume/Kbuild
-index 034195d..c1342e1 100644
---- a/usr/kinit/resume/Kbuild
-+++ b/usr/kinit/resume/Kbuild
-@@ -26,5 +26,3 @@ shared/resume-lib := ../lib.a
- # Cleaning
- clean-dirs := static shared
- 
--# install binary
--install-y := $(shared-y)
-diff --git a/usr/kinit/run-init/Kbuild b/usr/kinit/run-init/Kbuild
-index f7832b7..c153b0a 100644
---- a/usr/kinit/run-init/Kbuild
-+++ b/usr/kinit/run-init/Kbuild
-@@ -30,5 +30,3 @@ shared/run-init-lib := ../lib.a
- # Cleaning
- clean-dirs := static shared
- 
--# install binary
--install-y := $(shared-y)
-diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild
-index eba6add..98caf2e 100644
---- a/usr/klibc/Kbuild
-+++ b/usr/klibc/Kbuild
-@@ -185,5 +185,3 @@ install-rule:
- 	          $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib))
- 	$(Q)$(install-lib) $(obj)/klibc-$(SOLIBHASH).so \
- 	                      $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib
--	$(Q)$(install-lib) $(obj)/klibc-$(SOLIBHASH).so \
--	                      $(INSTALLROOT)$(SHLIBDIR)
-diff --git a/usr/utils/Kbuild b/usr/utils/Kbuild
-index 05aa794..67d9486 100644
---- a/usr/utils/Kbuild
-+++ b/usr/utils/Kbuild
-@@ -72,5 +72,3 @@ $(obj)/shared/reboot $(obj)/shared/poweroff: $(obj)/shared/halt
- # Clean deletes the static and shared dir
- clean-dirs := static shared
- 
--# install only install the shared binaries
--install-y := $(shared-y) shared/reboot shared/poweroff
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-static-utils_2.0.4.bb b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-static-utils_2.0.6.bb
similarity index 61%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-static-utils_2.0.4.bb
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-static-utils_2.0.6.bb
index 1677863..c835fd6 100644
--- a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-static-utils_2.0.4.bb
+++ b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-static-utils_2.0.6.bb
@@ -10,9 +10,3 @@
 
 require klibc-utils.inc
 require klibc.inc
-
-SRC_URI += "file://0001-klibc-static-utils-do-not-build-shared-binaries.patch"
-
-# avoid textrel if linking with -pie
-SECURITY_CFLAGS = ""
-SECURITY_LDFLAGS = ""
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-utils.inc b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-utils.inc
index 2aac9e6..00cb86d 100644
--- a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-utils.inc
+++ b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-utils.inc
@@ -2,11 +2,11 @@
     install -d ${D}${base_bindir}
     install -d ${D}${base_sbindir}
     if [ "${KLIBC_UTILS_VARIANT}" = "shared" ]; then
-        install -m 755 usr/kinit/kinit.shared ${D}${base_bindir}/kinit.shared
-        install -m 755 usr/dash/sh.shared ${D}${base_bindir}/sh.shared
+        install -m 755 usr/kinit/shared/kinit ${D}${base_bindir}/kinit.shared
+        install -m 755 usr/dash/shared/sh ${D}${base_bindir}/sh.shared
     else
-        install -m 755 usr/dash/sh ${D}${base_bindir}/sh
-        install -m 755 usr/kinit/kinit ${D}${base_bindir}/kinit
+        install -m 755 usr/dash/static/sh ${D}${base_bindir}/sh
+        install -m 755 usr/kinit/static/kinit ${D}${base_bindir}/kinit
         install -m 755 usr/gzip/gzip ${D}${base_bindir}
         ln -s gzip ${D}${base_bindir}/gunzip
         ln -s gzip ${D}${base_bindir}/zcat
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-utils_2.0.4.bb b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-utils_2.0.6.bb
similarity index 100%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-utils_2.0.4.bb
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc-utils_2.0.6.bb
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc.inc b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc.inc
index ec52e97..5805448 100644
--- a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc.inc
+++ b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc.inc
@@ -5,12 +5,10 @@
 LICENSE = "BSD-3-Clause & GPL-2.0 & MIT & Zlib"
 LIC_FILES_CHKSUM = "file://usr/klibc/LICENSE;md5=d75181f10e998c21eb147f6d2e43ce8b"
 DEPENDS = "linux-libc-headers perl-native"
-SRCREV = "4d19974d7020488f63651244e1f9f51727c3f66c"
+SRCREV = "22b36d1ae34416bc48869619cbb0cccb2070f48f"
 
 SRC_URI = "git://git.kernel.org/pub/scm/libs/klibc/klibc.git \
            ${ARMPATCHES} \
-           file://klibc-linux-libc-dev.patch \
-           file://staging.patch \
            file://klcc-consider-sysroot.patch \
            file://klcc-cross-accept-clang-options.patch \
            file://0001-dash-Specify-format-string-in-fmtstr.patch \
@@ -48,8 +46,6 @@
                 'KLIBCOPTFLAGS=${TUNE_CCARGS} -Os' \
                  V=1 \
                 "
-EXTRA_OEMAKE += "'EXTRA_KLIBCAFLAGS=${SECURITY_CFLAGS} -Wa,--noexecstack' \
-                 'EXTRA_KLIBCLDFLAGS=${SECURITY_LDFLAGS} -z noexecstack'"
 
 export FIX_ARMV4_EABI_BX = "${FIX_V4BX}"
 KLIBCTHUMB = "${@['CONFIG_KLIBC_THUMB=n', 'CONFIG_KLIBC_THUMB=y'][(d.getVar('ARM_INSTRUCTION_SET') == 'thumb')]}"
@@ -76,10 +72,3 @@
 KLIBC_ARCH_powerpc = "ppc"
 KLIBC_ARCH_powerpc64 = "ppc64"
 THIS_LIBKLIBC = "libklibc (= ${PV}-${PR})"
-
-GCCPIE ?= ""
-SECURITY_LDFLAGS = "${@'-z relro -z now -pie' if '${GCCPIE}' else ''}"
-SECURITY_LDFLAGS_mips = ""
-SECURITY_LDFLAGS_mipsel = ""
-SECURITY_LDFLAGS_mips64 = ""
-SECURITY_LDFLAGS_mips64el = ""
diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc_2.0.4.bb b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc_2.0.6.bb
similarity index 90%
rename from meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc_2.0.4.bb
rename to meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc_2.0.6.bb
index bc80f38..7df0b0a 100644
--- a/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc_2.0.4.bb
+++ b/meta-openembedded/meta-initramfs/recipes-devtools/klibc/klibc_2.0.6.bb
@@ -10,6 +10,8 @@
     install -d ${D}${libdir}
     install -m 755 usr/klibc/klibc-*.so ${D}${libdir}
     (cd  ${D}${libdir}; ln -s klibc-*.so klibc.so)
+    rm -rf ${D}${exec_prefix}/man
+    rm -rf ${D}${libdir}/klibc/bin
 }
 
 PACKAGES = "libklibc libklibc-staticdev libklibc-dev"
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
new file mode 100644
index 0000000..b3ef3c8
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
@@ -0,0 +1,163 @@
+From 5ea7cd78cd252ffd3a9f3fbc8dc795d6e1596084 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Mon, 17 Dec 2018 11:25:20 +0100
+Subject: [PATCH] kexec-tools: fix non-device tree devices on mips
+
+Add additional argument '--no-dtb' which disables device tree
+search in currently loaded kernel.
+
+Taken from LEDE-DEV:
+https://patchwork.ozlabs.org/patch/852961/
+
+Rebased for kexec-tools 2.0.18
+Removed ppc change (unwanted ?)
+
+Signed-off-by: Konstantin Kuzov <master.nosferatu@gmail.com>
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+---
+ kexec/arch/mips/include/arch/options.h |  4 +-
+ kexec/arch/mips/kexec-elf-mips.c       | 58 ++++++++++++++------------
+ kexec/arch/mips/kexec-mips.c           |  4 ++
+ kexec/arch/mips/kexec-mips.h           |  1 +
+ 4 files changed, 39 insertions(+), 28 deletions(-)
+
+diff --git a/kexec/arch/mips/include/arch/options.h b/kexec/arch/mips/include/arch/options.h
+index 416e224..18d2811 100644
+--- a/kexec/arch/mips/include/arch/options.h
++++ b/kexec/arch/mips/include/arch/options.h
+@@ -5,6 +5,7 @@
+ #define OPT_APPEND	(OPT_ARCH_MAX+0)
+ #define OPT_DTB		(OPT_ARCH_MAX+1)
+ #define OPT_RAMDISK	(OPT_ARCH_MAX+2)
++#define OPT_NO_DTB	(OPT_ARCH_MAX+3)
+ 
+ /* Options relevant to the architecture (excluding loader-specific ones),
+  * in this case none:
+@@ -14,7 +15,8 @@
+ 	{"command-line", 1, 0, OPT_APPEND}, \
+ 	{"append",	 1, 0, OPT_APPEND}, \
+ 	{"dtb",		1, 0, OPT_DTB }, \
+-	{"initrd",	1, 0, OPT_RAMDISK },
++	{"initrd",	1, 0, OPT_RAMDISK }, \
++	{"no-dtb",	0, 0, OPT_NO_DTB },
+ 
+ 
+ #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR ""
+diff --git a/kexec/arch/mips/kexec-elf-mips.c b/kexec/arch/mips/kexec-elf-mips.c
+index 849a7ba..5c0e535 100644
+--- a/kexec/arch/mips/kexec-elf-mips.c
++++ b/kexec/arch/mips/kexec-elf-mips.c
+@@ -141,35 +141,37 @@ int elf_mips_load(int argc, char **argv, const char *buf, off_t len,
+ 	else
+ 		cmdline_addr = 0;
+ 
+-	/* MIPS systems that have been converted to use device tree
+-	 * passed through UHI will use commandline in the DTB and
+-	 * the DTB passed as a separate buffer. Note that
+-	 * CMDLINE_PREFIX is skipped here intentionally, as it is
+-	 * used only in the legacy method */
+-
+-	if (arch_options.dtb_file) {
+-		dtb_buf = slurp_file(arch_options.dtb_file, &dtb_length);
+-	} else {
+-		create_flatten_tree(&dtb_buf, &dtb_length, cmdline_buf + strlen(CMDLINE_PREFIX));
+-	}
+ 
+-	if (arch_options.initrd_file) {
+-		initrd_buf = slurp_file(arch_options.initrd_file, &initrd_size);
++	if (!arch_options.no_dtb) {
++		/* MIPS systems that have been converted to use device tree
++		 * passed through UHI will use commandline in the DTB and
++		 * the DTB passed as a separate buffer. Note that
++		 * CMDLINE_PREFIX is skipped here intentionally, as it is
++		 * used only in the legacy method */
++
++		if (arch_options.dtb_file) {
++			dtb_buf = slurp_file(arch_options.dtb_file, &dtb_length);
++		} else {
++			create_flatten_tree(&dtb_buf, &dtb_length, cmdline_buf + strlen(CMDLINE_PREFIX));
++		}
+ 
+-		/* Create initrd entries in dtb - although at this time
+-		 * they would not point to the correct location */
+-		dtb_set_initrd(&dtb_buf, &dtb_length, initrd_buf, initrd_buf + initrd_size);
++		if (arch_options.initrd_file) {
++			initrd_buf = slurp_file(arch_options.initrd_file, &initrd_size);
+ 
+-		initrd_base = add_buffer(info, initrd_buf, initrd_size,
+-					initrd_size, sizeof(void *),
+-					_ALIGN_UP(kernel_addr + kernel_size + dtb_length,
+-						pagesize), 0x0fffffff, 1);
++			/* Create initrd entries in dtb - although at this time
++			 * they would not point to the correct location */
++			dtb_set_initrd(&dtb_buf, &dtb_length, initrd_buf, initrd_buf + initrd_size);
+ 
+-		/* Now that the buffer for initrd is prepared, update the dtb
+-		 * with an appropriate location */
+-		dtb_set_initrd(&dtb_buf, &dtb_length, initrd_base, initrd_base + initrd_size);
+-	}
++			initrd_base = add_buffer(info, initrd_buf, initrd_size,
++						initrd_size, sizeof(void *),
++						_ALIGN_UP(kernel_addr + kernel_size + dtb_length,
++							pagesize), 0x0fffffff, 1);
+ 
++			/* Now that the buffer for initrd is prepared, update the dtb
++			 * with an appropriate location */
++			dtb_set_initrd(&dtb_buf, &dtb_length, initrd_base, initrd_base + initrd_size);
++		}
++	}
+ 
+ 	/* This is a legacy method for commandline passing used
+ 	 * currently by Octeon CPUs only */
+@@ -177,9 +179,11 @@ int elf_mips_load(int argc, char **argv, const char *buf, off_t len,
+ 			sizeof(cmdline_buf), sizeof(void *),
+ 			cmdline_addr, 0x0fffffff, 1);
+ 
+-	add_buffer(info, dtb_buf, dtb_length, dtb_length, 0,
+-		_ALIGN_UP(kernel_addr + kernel_size, pagesize),
+-		0x0fffffff, 1);
++	if (!arch_options.no_dtb) {
++		add_buffer(info, dtb_buf, dtb_length, dtb_length, 0,
++			_ALIGN_UP(kernel_addr + kernel_size, pagesize),
++			0x0fffffff, 1);
++	}
+ 
+ 	return 0;
+ }
+diff --git a/kexec/arch/mips/kexec-mips.c b/kexec/arch/mips/kexec-mips.c
+index 415c2ed..e557f8b 100644
+--- a/kexec/arch/mips/kexec-mips.c
++++ b/kexec/arch/mips/kexec-mips.c
+@@ -89,6 +89,7 @@ void arch_usage(void)
+ 	"    --append=STRING       Set the kernel command line to STRING.\n"
+ 	"    --dtb=FILE            Use FILE as the device tree blob.\n"
+ 	"    --initrd=FILE         Use FILE as initial ramdisk.\n"
++	"    --no-dtb              Don't try to find device tree\n"
+ 	);
+ }
+ 
+@@ -121,6 +122,9 @@ int arch_process_options(int argc, char **argv)
+ 		case OPT_RAMDISK:
+ 			arch_options.initrd_file = optarg;
+ 			break;
++		case OPT_NO_DTB:
++			arch_options.no_dtb = 1;
++			break;
+ 		default:
+ 			break;
+ 		}
+diff --git a/kexec/arch/mips/kexec-mips.h b/kexec/arch/mips/kexec-mips.h
+index 222c815..90b21c3 100644
+--- a/kexec/arch/mips/kexec-mips.h
++++ b/kexec/arch/mips/kexec-mips.h
+@@ -22,6 +22,7 @@ struct arch_options_t {
+ 	char *dtb_file;
+ 	char *initrd_file;
+ 	int core_header_type;
++	int no_dtb;
+ };
+ 
+ extern struct memory_ranges usablemem_rgns;
+-- 
+2.17.1
+
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/klibc-reboot.patch b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/klibc-reboot.patch
new file mode 100644
index 0000000..be1301d
--- /dev/null
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/klibc-reboot.patch
@@ -0,0 +1,11 @@
+--- a/kexec/kexec.c
++++ b/kexec/kexec.c
+@@ -901,7 +901,7 @@ static int my_exec(void)
+ 	if (xen_present())
+ 		xen_kexec_exec();
+ 	else
+-		reboot(LINUX_REBOOT_CMD_KEXEC);
++		reboot(LINUX_REBOOT_CMD_KEXEC, NULL);
+ 	/* I have failed if I make it here */
+ 	fprintf(stderr, "kexec failed: %s\n", 
+ 		strerror(errno));
diff --git a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb
index cc1c551..7ad55d8 100644
--- a/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb
+++ b/meta-openembedded/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb
@@ -6,14 +6,14 @@
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=ea5bed2f60d357618ca161ad539f7c0a \
                     file://kexec/kexec.c;beginline=1;endline=20;md5=af10f6ae4a8715965e648aa687ad3e09"
-PV = "2.0.17+git${SRCPV}"
+PV = "2.0.18+git${SRCPV}"
 
 DEPENDS = "zlib xz"
 
 inherit klibc autotools
 
 SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git"
-SRCREV = "b9de21ef51a7ceab7122a707c188602eae22c4ee"
+SRCREV = "5750980cdbbc33ef75bfba6660295b932376ce15"
 
 BUILD_PATCHES = "file://0001-force-static-build.patch \
                  file://0002-Adjust-the-order-of-headers-to-fix-build-for-musl.patch"
@@ -31,7 +31,8 @@
             file://0012-purgatory-string.c-avoid-inclusion-of-string.h.patch \
             file://0013-sha256.h-avoid-inclusion-of-sys-types.h.patch \
             file://0014-add-if_nameindex-from-musl.patch \
-            file://0015-vmcore-dmesg-fix-warning.patch"
+            file://0015-vmcore-dmesg-fix-warning.patch \
+            file://klibc-reboot.patch"
 
 WARNING_FIXES = ""
 FROM_OE_CORE = "file://arm_crashdump-fix-buffer-align.patch \
@@ -42,6 +43,9 @@
 
 SRC_URI_append_arm = " file://arm_crashdump.patch"
 
+SRC_URI_append_mips = " file://140-mips_disable_devicetree_support.patch"
+SRC_URI_append_mipsel = " file://140-mips_disable_devicetree_support.patch"
+
 SRC_URI_append_x86 = " file://x86_sys_io.patch file://x86_basename.patch \
                        file://x86_vfscanf.patch file://x86_kexec_test.patch"