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-extended/acpica/acpica_20150515.bb b/import-layers/yocto-poky/meta/recipes-extended/acpica/acpica_20150515.bb
new file mode 100644
index 0000000..1326ebd
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/acpica/acpica_20150515.bb
@@ -0,0 +1,49 @@
+SUMMARY = "ACPICA tools for the development and debug of ACPI tables"
+DESCRIPTION = "The ACPI Component Architecture (ACPICA) project provides an \
+OS-independent reference implementation of the Advanced Configuration and \
+Power Interface Specification (ACPI). ACPICA code contains those portions of \
+ACPI meant to be directly integrated into the host OS as a kernel-resident \
+subsystem, and a small set of tools to assist in developing and debugging \
+ACPI tables."
+
+HOMEPAGE = "http://www.acpica.org/"
+SECTION = "console/tools"
+
+LICENSE = "BSD | GPLv2"
+LIC_FILES_CHKSUM = "file://generate/unix/readme.txt;md5=204407e197c1a01154a48f6c6280c3aa"
+
+COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux"
+
+DEPENDS = "bison flex"
+
+SRC_URI = "https://acpica.org/sites/acpica/files/acpica-unix2-${PV}.tar.gz \
+    file://no-werror.patch \
+    file://rename-yy_scan_string-manually.patch \
+    file://manipulate-fds-instead-of-FILE.patch \
+    "
+SRC_URI[md5sum] = "2bc4a7ccc82de9df9fa964f784ecb29c"
+SRC_URI[sha256sum] = "61204ec56d71bc9bfa2ee2ade4c66f7e8541772ac72ef8ccc20b3f339cc96374"
+UPSTREAM_CHECK_URI = "https://acpica.org/downloads"
+
+S = "${WORKDIR}/acpica-unix2-${PV}"
+
+EXTRA_OEMAKE = "CC='${CC}' 'OPT_CFLAGS=-Wall'"
+
+do_install() {
+    install -D -p -m0755 generate/unix/bin*/iasl ${D}${bindir}/iasl
+    install -D -p -m0755 generate/unix/bin*/acpibin ${D}${bindir}/acpibin
+    install -D -p -m0755 generate/unix/bin*/acpiexec ${D}${bindir}/acpiexec
+    install -D -p -m0755 generate/unix/bin*/acpihelp ${D}${bindir}/acpihelp
+    install -D -p -m0755 generate/unix/bin*/acpinames ${D}${bindir}/acpinames
+    install -D -p -m0755 generate/unix/bin*/acpisrc ${D}${bindir}/acpisrc
+    install -D -p -m0755 generate/unix/bin*/acpixtract ${D}${bindir}/acpixtract
+}
+
+# iasl*.bb is a subset of this recipe, so RREPLACE it
+PROVIDES = "iasl"
+RPROVIDES_${PN} += "iasl"
+RREPLACES_${PN} += "iasl"
+RCONFLIGHTS_${PN} += "iasl"
+
+NATIVE_INSTALL_WORKS = "1"
+BBCLASSEXTEND = "native"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/acpica/acpitests/aapits-linux.patch b/import-layers/yocto-poky/meta/recipes-extended/acpica/acpitests/aapits-linux.patch
new file mode 100644
index 0000000..7c5d6b0
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/acpica/acpitests/aapits-linux.patch
@@ -0,0 +1,336 @@
+From: Al Stone <ahs3@ahs3.net>
+Date: Mon, 7 Apr 2014 19:09:37 +0000
+Subject: [PATCH 1/2] Fixup aapits build
+
+From http://git.linaro.org/people/al.stone/acpica-tools.git
+Upstream-status: Unknown
+
+diff -urN acpica-unix2-20130626/tests/aapits/atexec.c acpica-unix2-20130626-aapits/tests/aapits/atexec.c
+--- acpica-unix2-20130626/tests/aapits/atexec.c	2013-01-17 12:48:28.000000000 -0700
++++ acpica-unix2-20130626-aapits/tests/aapits/atexec.c	2013-07-25 13:44:23.023894441 -0600
+@@ -639,6 +639,7 @@
+ }
+ 
+ 
++#if ACPI_MACHINE_WIDTH == 32
+ /*******************************************************************************
+  *
+  * FUNCTION:    AtBuildLocalRSDT
+@@ -757,8 +758,9 @@
+         LocalRSDT->Header.Checksum = (UINT8)~LocalRSDT->Header.Checksum;
+     }
+ }
++#endif
+ 
+ 
+ /*******************************************************************************
+  *
+  * FUNCTION:    AtBuildLocalXSDT
+@@ -1424,7 +1426,7 @@
+         ACPI_WARNING ((AE_INFO,
+             "Request on [%4.4s] is beyond region limit Req-%X+%X, Base=%X, Len-%X\n",
+             (RegionObject->Region.Node)->Name.Ascii, (UINT32) Address,
+-            ByteWidth, (UINT32) BufferAddress, Length));
++            ByteWidth, (UINT32) BufferAddress, (UINT32) Length));
+ 
+         return (AE_AML_REGION_LIMIT);
+     }
+@@ -1792,7 +1796,9 @@
+             Path, Obj.Integer.Value, Value);
+ #else
+         printf ("API Error: Value of %s is 0x%llx instead of expected 0x%llx\n",
+-            Path, Obj.Integer.Value, Value);
++            Path,
++	    (long long unsigned int) Obj.Integer.Value,
++	    (long long unsigned int) Value);
+ #endif
+         Status = AE_ERROR;
+     }
+@@ -1871,7 +1877,7 @@
+     {
+         TestErrors++;
+         printf ("Test Error: cannot allocate buffer of %d bytes\n",
+-            Results.Length);
++                (int) Results.Length);
+         return (AE_NO_MEMORY);
+     }
+     Results.Pointer = Object;
+@@ -1952,7 +1956,8 @@
+     {
+         printf ("AtCheckBuffer: unexpected length %d of Buffer vs"
+             " calculated %d bytes\n",
+-            Results.Length, ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof (ACPI_OBJECT) + Length));
++            (int)Results.Length,
++	    (int)(ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof (ACPI_OBJECT) + Length)));
+     }
+ 
+     /* Initialize the return buffer structure */
+@@ -1961,7 +1968,7 @@
+     {
+         TestErrors++;
+         printf ("Test Error: cannot allocate buffer of %d bytes\n",
+-            Results.Length);
++            (int) Results.Length);
+         return (AE_NO_MEMORY);
+     }
+     Results.Pointer = Object;
+diff -urN acpica-unix2-20130626/tests/aapits/atinit.c acpica-unix2-20130626-aapits/tests/aapits/atinit.c
+--- acpica-unix2-20130626/tests/aapits/atinit.c	2013-01-17 12:48:28.000000000 -0700
++++ acpica-unix2-20130626-aapits/tests/aapits/atinit.c	2013-07-25 13:20:19.706705960 -0600
+@@ -3024,7 +3024,7 @@
+             AapiErrors++;
+             printf ("API Error: AcpiGetSystemInfo() returned"
+                 " Length %d, expected %d\n",
+-                OutBuffer.Length, sizeof (Info));
++                (int) OutBuffer.Length, (int) sizeof (Info));
+             return (AE_ERROR);
+         }
+ 
+@@ -3046,7 +3046,7 @@
+             AapiErrors++;
+             printf ("API Error: AcpiGetSystemInfo() returned"
+                 " Length %d, expected %d\n",
+-                OutBuffer.Length, sizeof (Info));
++                (int) OutBuffer.Length, (int) sizeof (Info));
+             return (AE_ERROR);
+         }
+ 
+@@ -3066,7 +3066,7 @@
+             AapiErrors++;
+             printf ("API Error: AcpiGetSystemInfo() returned"
+                 " Length %d, expected %d\n",
+-                OutBuffer.Length, sizeof (Info));
++                (int) OutBuffer.Length, (int) sizeof (Info));
+             return (AE_ERROR);
+         }
+         else if (OutBuffer.Pointer != &Info)
+@@ -3149,7 +3149,7 @@
+             AapiErrors++;
+             printf ("API Error: AcpiGetSystemInfo() returned"
+                 " Length %d, expected %d\n",
+-                OutBuffer.Length, sizeof (Info));
++                (int) OutBuffer.Length, (int) sizeof (Info));
+             return (AE_ERROR);
+         }
+         else if (OutBuffer.Pointer != &Info)
+@@ -3214,7 +3214,7 @@
+             AapiErrors++;
+             printf ("API Error: AcpiGetSystemInfo() returned"
+                 " Length %d, expected %d\n",
+-                OutBuffer.Length, sizeof (ACPI_SYSTEM_INFO));
++                (int) OutBuffer.Length, (int) sizeof (ACPI_SYSTEM_INFO));
+             return (AE_ERROR);
+         }
+         else
+diff -urN acpica-unix2-20130626/tests/aapits/atmain.c acpica-unix2-20130626-aapits/tests/aapits/atmain.c
+--- acpica-unix2-20130626/tests/aapits/atmain.c	2013-01-17 12:48:28.000000000 -0700
++++ acpica-unix2-20130626-aapits/tests/aapits/atmain.c	2013-07-25 13:18:22.083323948 -0600
+@@ -315,7 +315,7 @@
+     {
+         printf ("ACPICA API TS err: test num %ld of test case %ld"
+             " is not implemented\n",
+-            test_num, test_case);
++            (long int) test_num, (long int) test_case);
+         return (AtRetNotImpl);
+     }
+ 
+@@ -430,7 +432,7 @@
+     if (test_case < 1 || test_case > AT_TEST_CASE_NUM)
+     {
+         printf ("ACPICA API TS err: test case %ld is out of range 1 - %d\n",
+-            test_case, AT_TEST_CASE_NUM);
++            (long int) test_case, (int) AT_TEST_CASE_NUM);
+         return (AtRetBadParam);
+     }
+ 
+@@ -438,7 +440,7 @@
+     if (test_num < 0 || test_num > AtTestCase[test_case].TestsNum)
+     {
+         printf ("ACPICA API TS err: test num %ld is out of range 0 - %d\n",
+-            test_num, AtTestCase[test_case].TestsNum);
++            (long int) test_num, AtTestCase[test_case].TestsNum);
+         return (AtRetBadParam);
+     }
+
+diff -urN acpica-unix2-20130626/tests/aapits/atnamespace.c acpica-unix2-20130626-aapits/tests/aapits/atnamespace.c
+--- acpica-unix2-20130626/tests/aapits/atnamespace.c	2013-01-17 12:48:28.000000000 -0700
++++ acpica-unix2-20130626-aapits/tests/aapits/atnamespace.c	2013-07-25 13:24:15.366466707 -0600
+@@ -2535,7 +2535,8 @@
+ #else
+                 printf ("API Error: Address of %s (0x%llX) != (0x%llX)\n",
+                     PathNames[2 * i + 1],
+-                    Info->Address, ExpectedInfo[i].Address);
++                    (long long unsigned int) Info->Address,
++		    (long long unsigned int) ExpectedInfo[i].Address);
+ #endif
+ #else
+                 printf ("API Error: Address of %s (0x%X) != (0x%X)\n",
+@@ -2908,7 +2909,8 @@
+         TestErrors++;
+         printf ("AtGetNextObjectTypeCommon: different numbers of entities"
+             "in TypesNames (%d) and LevelTypes0000 (%d)\n",
+-            TypesCount, sizeof (LevelTypes0000) / sizeof (ACPI_OBJECT_TYPE));
++            TypesCount,
++	    (int) (sizeof (LevelTypes0000) / sizeof (ACPI_OBJECT_TYPE)));
+         return (AE_ERROR);
+     }
+ 
+@@ -4192,7 +4194,9 @@
+             Pathname, Obj.Integer.Value, Value);
+ #else
+         printf ("API Error: Value of %s is 0x%llx instead of expected 0x%llx\n",
+-            Pathname, Obj.Integer.Value, Value);
++            Pathname,
++	    (long long unsigned int) Obj.Integer.Value,
++	    (long long unsigned int) Value);
+ #endif
+         Status = AE_ERROR;
+     }
+@@ -5199,7 +5203,7 @@
+             {
+                 AapiErrors++;
+                 printf ("API Error: AcpiOsAllocate(%d) returned NULL\n",
+-                    OutName.Length);
++                    (int) OutName.Length);
+                 return (AE_ERROR);
+             }
+         }
+diff -urN acpica-unix2-20130626/tests/aapits/atosxfctrl.c acpica-unix2-20130626-aapits/tests/aapits/atosxfctrl.c
+--- acpica-unix2-20130626/tests/aapits/atosxfctrl.c	2013-01-17 12:48:28.000000000 -0700
++++ acpica-unix2-20130626-aapits/tests/aapits/atosxfctrl.c	2013-07-25 13:30:00.375492751 -0600
+@@ -737,13 +737,15 @@
+ #if ACPI_MACHINE_WIDTH == 64
+ #ifdef    _MSC_VER
+         printf("OsxfCtrlFingReg: unexpected Width %d of Reg 0x%I64x\n",
++            Width, Address);
+ #else
+         printf("OsxfCtrlFingReg: unexpected Width %d of Reg 0x%llx\n",
++            Width, (long long unsigned int) Address);
+ #endif
+ #else
+         printf("OsxfCtrlFingReg: unexpected Width %d of Reg 0x%x\n",
+-#endif
+             Width, Address);
++#endif
+         return (NULL);
+     }
+ 
+@@ -764,15 +766,19 @@
+ #ifdef    _MSC_VER
+                 printf("OsxfCtrlFingReg: intersection Regs (0x%I64x: 0x%x)"
+                     " and (0x%I64x: 0x%x)\n",
++                    Reg->Address, Reg->Width, Address, Width);
+ #else
+                 printf("OsxfCtrlFingReg: intersection Regs (0x%llx: 0x%x)"
+                     " and (0x%llx: 0x%x)\n",
++                    (long long unsigned int) Reg->Address,
++		    Reg->Width,
++		    (long long unsigned int) Address, Width);
+ #endif
+ #else
+                 printf("OsxfCtrlFingReg: intersection Regs (0x%x: 0x%x)"
+                     " and (0x%x: 0x%x)\n",
+-#endif
+                     Reg->Address, Reg->Width, Address, Width);
++#endif
+                 return (NULL);
+             }
+         }
+@@ -786,13 +792,15 @@
+ #if ACPI_MACHINE_WIDTH == 64
+ #ifdef    _MSC_VER
+             printf("OsxfCtrlFingReg: no memory for Reg (0x%I64x: 0x%x)\n",
++                Reg->Address, Reg->Width);
+ #else
+             printf("OsxfCtrlFingReg: no memory for Reg (0x%llx: 0x%x)\n",
++                (long long unsigned int) Reg->Address, Reg->Width);
+ #endif
+ #else
+             printf("OsxfCtrlFingReg: no memory for Reg (0x%x: 0x%x)\n",
+-#endif
+                 Reg->Address, Reg->Width);
++#endif
+             return (NULL);
+         }
+         Reg->Type = Type;
+@@ -932,14 +940,19 @@
+ #if ACPI_MACHINE_WIDTH == 64
+ #ifdef    _MSC_VER
+             printf("%.2u (%s Address 0x%I64x: Width %.2u) r/w counts: %u/%u\n",
++                i, (Reg->Type == EMUL_REG_SYS)? "SYS": "IO",
++                Reg->Address, Reg->Width, Reg->ReadCount, Reg->WriteCount);
+ #else
+             printf("%.2u (%s Address 0x%llx: Width %.2u) r/w counts: %u/%u\n",
++                i, (Reg->Type == EMUL_REG_SYS)? "SYS": "IO",
++                (long long unsigned int) Reg->Address,
++		Reg->Width, Reg->ReadCount, Reg->WriteCount);
+ #endif
+ #else
+             printf("%.2u (%s Address 0x%.4x: Width %.2u) r/w counts: %u/%u\n",
+-#endif
+                 i, (Reg->Type == EMUL_REG_SYS)? "SYS": "IO",
+                 Reg->Address, Reg->Width, Reg->ReadCount, Reg->WriteCount);
++#endif
+             Reg = Reg->Next;
+             i++;
+         }
+diff -urN acpica-unix2-20130626/tests/aapits/atresource.c acpica-unix2-20130626-aapits/tests/aapits/atresource.c
+--- acpica-unix2-20130626/tests/aapits/atresource.c	2013-01-17 12:48:29.000000000 -0700
++++ acpica-unix2-20130626-aapits/tests/aapits/atresource.c	2013-07-25 13:25:49.423565947 -0600
+@@ -174,7 +174,7 @@
+         AapiErrors++;
+         printf ("API Error: AcpiGetCurrentResources(%s) returned Length %d,"
+             " expected %d\n",
+-            Pathname, OutBuffer.Length, RT0000_DEV0_CRS_LEN);
++            Pathname, (int) OutBuffer.Length, RT0000_DEV0_CRS_LEN);
+         return (AE_ERROR);
+     }
+ 
+@@ -490,7 +490,7 @@
+         AapiErrors++;
+         printf ("API Error: AcpiGetCurrentResources(%s) returned Length %d,"
+             " expected %d\n",
+-            Pathname, OutBuffer.Length, RT0000_DEV0_CRS_LEN);
++            Pathname, (int) OutBuffer.Length, RT0000_DEV0_CRS_LEN);
+         return (AE_ERROR);
+     }
+ 
+@@ -689,7 +689,7 @@
+         AapiErrors++;
+         printf ("Api Error: Resource->Length (%d) != %d\n",
+             CurrentResource->Length,
+-            ACPI_ROUND_UP_TO_NATIVE_WORD (ACPI_RS_SIZE (ACPI_RESOURCE_IRQ)));
++            (int) (ACPI_ROUND_UP_TO_NATIVE_WORD (ACPI_RS_SIZE (ACPI_RESOURCE_IRQ))));
+     }
+ 
+     if (CurrentResource->Data.Irq.Triggering != 0) /* Level-Triggered */
+@@ -981,7 +981,7 @@
+         AapiErrors++;
+         printf ("API Error: AcpiGetPossibleResources(%s) returned Length %d,"
+             " expected %d\n",
+-            Pathname, OutBuffer.Length, RT0000_DEV0_CRS_LEN);
++            Pathname, (int) OutBuffer.Length, RT0000_DEV0_CRS_LEN);
+         return (AE_ERROR);
+     }
+ 
+@@ -1923,7 +1923,7 @@
+         AapiErrors++;
+         printf ("API Error: AcpiGetIrqRoutingTable(%s) returned Length %d,"
+             " expected %d\n",
+-            Pathname, OutBuffer.Length, 0xA48);
++            Pathname, (int) OutBuffer.Length, 0xA48);
+         return (AE_ERROR);
+     }
+
+diff -urN acpica-unix2-20130626/tests/aapits/Makefile acpica-unix2-20130626-aapits/tests/aapits/Makefile
+--- acpica-unix2-20130626/tests/aapits/Makefile	2013-01-17 12:48:29.000000000 -0700
++++ acpica-unix2-20130626-aapits/tests/aapits/Makefile	2013-07-25 15:17:09.309236422 -0600
+@@ -194,7 +194,7 @@
+ CFLAGS+= -Wall -g -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_APITS -DACPI_EXEC_APP -D_MULTI_THREADED -Wstrict-prototypes -I../../source/include
+
+ 
+-acpiexec : $(patsubst %.c,%.o, $(SRCS))
++$(PROG) : $(patsubst %.c,%.o, $(SRCS))
+ 	$(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) -o $(PROG)
+ 
+ CLEANFILES= $(PROG)
diff --git a/import-layers/yocto-poky/meta/recipes-extended/acpica/acpitests/aapits-makefile.patch b/import-layers/yocto-poky/meta/recipes-extended/acpica/acpitests/aapits-makefile.patch
new file mode 100644
index 0000000..4d9e997
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/acpica/acpitests/aapits-makefile.patch
@@ -0,0 +1,34 @@
+From: Al Stone <ahs3@ahs3.net>
+Date: Mon, 7 Apr 2014 19:09:37 +0000
+Subject: [PATCH 1/2] Fixup aapits build
+
+From http://git.linaro.org/people/al.stone/acpica-tools.git
+Upstream-status: Unknown
+
+diff -urN acpica-unix2-20140325/tests/aapits/Makefile acpica-unix2-20140325/tests/aapits/Makefile
+--- acpica-unix2-20140325/tests/aapits/Makefile	2014-04-05 14:23:14.683636794 -0600
++++ acpica-unix2-20140325-aapits/tests/aapits/Makefile	2014-04-05 15:10:57.879184598 -0600
+@@ -16,6 +16,7 @@
+ 	atosxfwrap.c \
+ 	osunixxf.c \
+ 	../../source/common/ahids.c \
++	../../source/common/ahuuids.c \
+ 	../../source/common/cmfsize.c \
+ 	../../source/common/getopt.c \
+ 	../../source/components/hardware/hwtimer.c \
+@@ -174,6 +175,7 @@
+ 	../../source/components/utilities/utexcep.c \
+ 	../../source/components/utilities/utfileio.c \
+ 	../../source/components/utilities/utglobal.c \
++	../../source/components/utilities/uthex.c \
+ 	../../source/components/utilities/utids.c \
+ 	../../source/components/utilities/utinit.c \
+ 	../../source/components/utilities/utlock.c \
+@@ -189,6 +191,7 @@
+ 	../../source/components/utilities/utstate.c \
+ 	../../source/components/utilities/utstring.c \
+ 	../../source/components/utilities/uttrack.c \
++	../../source/components/utilities/utuuid.c \
+ 	../../source/components/utilities/utxface.c \
+ 	../../source/components/utilities/utxferror.c \
+ 	../../source/components/utilities/utxfinit.c \
diff --git a/import-layers/yocto-poky/meta/recipes-extended/acpica/acpitests_20140828.bb b/import-layers/yocto-poky/meta/recipes-extended/acpica/acpitests_20140828.bb
new file mode 100644
index 0000000..45ac157
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/acpica/acpitests_20140828.bb
@@ -0,0 +1,36 @@
+SUMMARY = "Test suite used to validate ACPICA"
+HOMEPAGE = "http://www.acpica.org/"
+
+LICENSE = "Intel"
+LIC_FILES_CHKSUM = "file://tests/aapits/atexec.c;beginline=1;endline=115;md5=e92bcdfcd01d117d1bda3e814bb2030a"
+
+DEPENDS = "bison flex"
+
+SRC_URI = "https://acpica.org/sites/acpica/files/acpitests-unix-${PV}.tar.gz;name=acpitests \
+           https://acpica.org/sites/acpica/files/acpica-unix2-${PV}.tar.gz;name=acpica \
+           file://aapits-linux.patch \
+           file://aapits-makefile.patch \
+"
+SRC_URI[acpitests.md5sum] = "db9d6fdaa8e3eb101d700ee5ba4938ed"
+SRC_URI[acpitests.sha256sum] = "e576c74bf1bf1c9f7348bf9419e05c8acfece7105abcdc052e66670c7af2cf00"
+SRC_URI[acpica.md5sum] = "6f05f0d10166a1b1ff6107f3d1cdf1e5"
+SRC_URI[acpica.sha256sum] = "01d8867656c5ba41dec307c4383ce676196ad4281ac2c9dec9f5be5fac6d888e"
+UPSTREAM_CHECK_URI = "https://acpica.org/downloads"
+
+S = "${WORKDIR}/acpitests-unix-${PV}"
+
+EXTRA_OEMAKE = "'CC=${CC}' 'OPT_CFLAGS=-Wall'"
+
+# The Makefiles expect a specific layout
+do_compile() {
+    cp -af ${WORKDIR}/acpica-unix2-${PV}/source ${S}
+    cd tests/aapits
+    oe_runmake
+}
+
+do_install() {
+    install -d ${D}${bindir}
+    install -m0755 tests/aapits/bin/aapits ${D}${bindir}
+}
+
+COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/acpica/files/manipulate-fds-instead-of-FILE.patch b/import-layers/yocto-poky/meta/recipes-extended/acpica/files/manipulate-fds-instead-of-FILE.patch
new file mode 100644
index 0000000..6944bb7
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/acpica/files/manipulate-fds-instead-of-FILE.patch
@@ -0,0 +1,71 @@
+From 33a57979738e5ab13950ec1c0e7298e41ef50929 Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Thu, 23 Feb 2017 18:10:47 +0100
+Subject: [PATCH] aslfiles.c: manipulate fds instead of FILE
+
+Copying what stdout/stderr point to is not portable and fails with
+musl because FILE is an undefined struct.
+
+Instead, use lower-level Unix functions to modify the file that stderr
+writes into. This works on the platforms that Yocto targets.
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
+---
+ source/compiler/aslfiles.c | 20 +++++++++++---------
+ 1 file changed, 11 insertions(+), 9 deletions(-)
+
+diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c
+index 947e465..7a352b4 100644
+--- a/source/compiler/aslfiles.c
++++ b/source/compiler/aslfiles.c
+@@ -44,6 +44,11 @@
+ #include "aslcompiler.h"
+ #include "acapps.h"
+ 
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
++#include <unistd.h>
++
+ #define _COMPONENT          ACPI_COMPILER
+         ACPI_MODULE_NAME    ("aslfiles")
+ 
+@@ -569,6 +574,8 @@ FlOpenMiscOutputFiles (
+ 
+     if (Gbl_DebugFlag)
+     {
++        int fd;
++
+         Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG);
+         if (!Filename)
+         {
+@@ -582,20 +589,15 @@ FlOpenMiscOutputFiles (
+         /* TBD: hide this behind a FlReopenFile function */
+ 
+         Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename;
+-        Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle =
+-            freopen (Filename, "w+t", stderr);
+-
+-        if (!Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle)
++        fd = open(Filename, O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
++        if (fd < 0 ||
++            dup2(fd, fileno(stderr)))
+         {
+-            /*
+-             * A problem with freopen is that on error,
+-             * we no longer have stderr.
+-             */
+             Gbl_DebugFlag = FALSE;
+-            memcpy (stderr, stdout, sizeof (FILE));
+             FlFileError (ASL_FILE_DEBUG_OUTPUT, ASL_MSG_DEBUG_FILENAME);
+             AslAbort ();
+         }
++        Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = stderr;
+ 
+         AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT);
+         AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT);
+-- 
+2.1.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/acpica/files/no-werror.patch b/import-layers/yocto-poky/meta/recipes-extended/acpica/files/no-werror.patch
new file mode 100644
index 0000000..5d28f47
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/acpica/files/no-werror.patch
@@ -0,0 +1,32 @@
+Description: remove -Werror flag
+Forwarded: not-needed
+Author: Fathi Boudra <fathi.boudra@linaro.org>
+
+---
+ generate/unix/iasl/Makefile |   12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/generate/unix/iasl/Makefile
++++ b/generate/unix/iasl/Makefile
+@@ -266,19 +266,19 @@ $(OBJDIR)/prparser.y.h: $(OBJDIR)/prpars
+ # by the utilities above and they are not necessarily ANSI C, etc.
+ #
+ $(OBJDIR)/aslcompilerlex.o :   $(OBJDIR)/aslcompilerlex.c
+-	$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
++	$(CC) -c $(CFLAGS) -Wall -o$@ $<
+ 
+ $(OBJDIR)/aslcompilerparse.o : $(OBJDIR)/aslcompilerparse.c
+-	$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
++	$(CC) -c $(CFLAGS) -Wall -o$@ $<
+ 
+ $(OBJDIR)/dtparserlex.o :      $(OBJDIR)/dtparserlex.c
+-	$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
++	$(CC) -c $(CFLAGS) -Wall -o$@ $<
+ 
+ $(OBJDIR)/dtparserparse.o :    $(OBJDIR)/dtparserparse.c
+-	$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
++	$(CC) -c $(CFLAGS) -Wall -o$@ $<
+ 
+ $(OBJDIR)/prparserlex.o :      $(OBJDIR)/prparserlex.c
+-	$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
++	$(CC) -c $(CFLAGS) -Wall -o$@ $<
diff --git a/import-layers/yocto-poky/meta/recipes-extended/acpica/files/rename-yy_scan_string-manually.patch b/import-layers/yocto-poky/meta/recipes-extended/acpica/files/rename-yy_scan_string-manually.patch
new file mode 100644
index 0000000..b62ca25
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/acpica/files/rename-yy_scan_string-manually.patch
@@ -0,0 +1,64 @@
+From 2ab61e6ad5a9cfcde838379bc36babfaaa61afb8 Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Fri, 20 Jan 2017 13:50:17 +0100
+Subject: [PATCH] rename yy_scan_string manually
+
+flex 2.6.0 used to generate code where yy_scan_string was mapped
+to <custom prefix>_scan_string directly in the generated .c code.
+
+For example, generate/unix/iasl/obj/prparserlex.c:
+
+int
+PrInitLexer (
+    char                    *String)
+{
+
+    LexBuffer = PrParser_scan_string (String);
+    return (LexBuffer == NULL);
+}
+
+flex 2.6.3 no longer does that, leading to a compiler warning
+and link error about yy_scan_string().
+
+Both versions generate a preamble in the beginning of prparserlex.c
+that maps several yy_* names, but yy_scan_string is not among those:
+
+...
+...
+
+Upstream-Status: Inappropriate [workaround for https://github.com/westes/flex/issues/164]
+Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
+---
+ source/compiler/dtparser.l | 2 +-
+ source/compiler/prparser.l | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/source/compiler/dtparser.l b/source/compiler/dtparser.l
+index 3f4c2f3..eaa43ff 100644
+--- a/source/compiler/dtparser.l
++++ b/source/compiler/dtparser.l
+@@ -120,7 +120,7 @@ DtInitLexer (
+     char                    *String)
+ {
+ 
+-    LexBuffer = yy_scan_string (String);
++    LexBuffer = DtParser_scan_string (String);
+     return (LexBuffer == NULL);
+ }
+ 
+diff --git a/source/compiler/prparser.l b/source/compiler/prparser.l
+index 10bd130..9cb3573 100644
+--- a/source/compiler/prparser.l
++++ b/source/compiler/prparser.l
+@@ -127,7 +127,7 @@ PrInitLexer (
+     char                    *String)
+ {
+ 
+-    LexBuffer = yy_scan_string (String);
++    LexBuffer = PrParser_scan_string (String);
+     return (LexBuffer == NULL);
+ }
+ 
+-- 
+2.11.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/at/at_3.1.20.bb b/import-layers/yocto-poky/meta/recipes-extended/at/at_3.1.20.bb
index 85459b6..904899f 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/at/at_3.1.20.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/at/at_3.1.20.bb
@@ -65,7 +65,7 @@
 	install -m 0644 ${WORKDIR}/atd.service ${D}${systemd_unitdir}/system
 	sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/atd.service
 
-	if [ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" = "pam" ]; then
+	if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
 		install -D -m 0644 ${WORKDIR}/${BP}/pam.conf ${D}${sysconfdir}/pam.d/atd
 	fi
 }
diff --git a/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/build-tests.patch b/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/build-tests.patch
deleted file mode 100644
index e63457c..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/build-tests.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-Add 'ptest' target to Makefile, to run tests without checking dependencies.
-
-Signed-off-by: Anders Roxell <anders.roxell@enea.com>
-Upstream-Status: Pending
----
-diff -dNaur bash-3.2.48/Makefile.in.orig bash-3.2.48/Makefile.in
---- bash-3.2.48/Makefile.in.orig	2006-08-17 23:03:35.000000000 +0500
-+++ bash-3.2.48/Makefile.in	2013-07-02 20:20:07.512709327 +0500
-@@ -803,17 +803,31 @@
- 	fi
- 
- recho$(EXEEXT):		$(SUPPORT_SRC)recho.c
--	@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)recho.c ${LIBS_FOR_BUILD}
-+	@$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $<
- 
- zecho$(EXEEXT):		$(SUPPORT_SRC)zecho.c
--	@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)zecho.c ${LIBS_FOR_BUILD}
-+	@$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $<
- 
- printenv$(EXEEXT):	$(SUPPORT_SRC)printenv.c
--	@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)printenv.c ${LIBS_FOR_BUILD}
-+	@$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $<
- 
--test tests check:	force $(Program) $(TESTS_SUPPORT)
-+test tests check:
-+	@$(MAKE) install-test
-+	@$(MAKE) runtest
-+
-+install-test: buildtest
-+ifeq ($(origin INSTALL_TEST_DIR), undefined)
- 	@-test -d tests || mkdir tests
- 	@cp $(TESTS_SUPPORT) tests
-+else
-+	@-test -d $(INSTALL_TEST_DIR) || mkdir -p $(INSTALL_TEST_DIR)
-+	@cp -r $(srcdir)/tests/* $(INSTALL_TEST_DIR)/
-+	@cp $(TESTS_SUPPORT) $(INSTALL_TEST_DIR)
-+endif
-+
-+buildtest: force $(Program) $(TESTS_SUPPORT)
-+
-+runtest:
- 	@( cd $(srcdir)/tests && \
- 		PATH=$(BUILD_DIR)/tests:$$PATH THIS_SH=$(THIS_SH) $(SHELL) ${TESTSCRIPT} )
- 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/dont-include-target-CFLAGS-in-host-LDFLAGS.patch b/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/dont-include-target-CFLAGS-in-host-LDFLAGS.patch
deleted file mode 100644
index ee756dc..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/dont-include-target-CFLAGS-in-host-LDFLAGS.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 933bd886af49667e88e2385409449ab598813dab Mon Sep 17 00:00:00 2001
-From: Andre McCurdy <armccurdy@gmail.com>
-Date: Wed, 15 Jul 2015 00:54:33 -0700
-Subject: [PATCH] dont include target CFLAGS in host LDFLAGS
-
-Building the host tool 'mkbuiltins' will fail if the target CFLAGS
-contains an option which isn't supported by the host's gcc. To prevent
-the issue, define LDFLAGS_FOR_BUILD based on CFLAGS_FOR_BUILD instead
-of CFLAGS.
-
-Upstream-Status: Inappropriate [required for bash 3.2.57 (GPLv2) recipe only]
-
-Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
----
- builtins/Makefile.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/builtins/Makefile.in b/builtins/Makefile.in
-index e027f7a..ebfddf3 100644
---- a/builtins/Makefile.in
-+++ b/builtins/Makefile.in
-@@ -63,7 +63,7 @@ LOCAL_DEFS = @LOCAL_DEFS@
- 
- LIBS = @LIBS@
- LDFLAGS = @LDFLAGS@ $(LOCAL_LDFLAGS) $(CFLAGS)
--LDFLAGS_FOR_BUILD = $(LDFLAGS)
-+LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
- LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
- #LIBS_FOR_BUILD = @LIBS_FOR_BUILD@
- LIBS_FOR_BUILD = $(LIBS)
--- 
-1.9.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/mkbuiltins_have_stringize.patch b/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/mkbuiltins_have_stringize.patch
deleted file mode 100644
index c4229a7..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/mkbuiltins_have_stringize.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-On hosts with FORTIFY_SOURCES, stringize support is required, as it's used by
-the macros to wrap functions (e.g. read and open in unistd.h). Those wrappers
-use the STRING() macro from unistd.h. A header in the bash sources overrides
-the unistd.h macro to 'x' when HAVE_STRINGIZE is not defined, causing the
-wrappers to generate calls to 'xread' and 'xopen', which do not exist,
-resulting in a failure to link.
-
-Assume we have stringize support when cross-compiling, which works around the
-issue.
-
-It may be best for upstream to either give up on supporting compilers without
-stringize support, or to not define STRING() at all when FORTIFY_SOURCES is
-defined, letting the unistd.h one be used, instead.
-
-Upstream-Status: Pending
-
-Signed-off-by: Christopher Larson <chris_larson@mentor.com>
-Signed-off-by: Saul Wold <sgw@linux.intel.com>
-
---- bash-4.2.orig/builtins/mkbuiltins.c
-+++ bash-4.2/builtins/mkbuiltins.c
-@@ -28,6 +28,7 @@
- #  define HAVE_STDLIB_H
-
- #  define HAVE_RENAME
-+#  define HAVE_STRINGIZE
- #endif /* CROSS_COMPILING */
-
- #if defined (HAVE_UNISTD_H)
diff --git a/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/run-ptest b/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/run-ptest
deleted file mode 100644
index 8dd3b99..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/run-ptest
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-make -k THIS_SH=/bin/bash BUILD_DIR=. runtest
diff --git a/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/string-format.patch b/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/string-format.patch
deleted file mode 100644
index eda3964..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/string-format.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-Fix a string format warning when using security flags:
-
-| ../bash-3.2.48/print_cmd.c:1152:3: error: format not a string literal and no format arguments [-Werror=format-security]
-|    cprintf (indentation_string);
-
-Upstream-Status: Backport
-Signed-off-by: Ross Burton <ross.burton@intel.com>
-
-diff --git a/print_cmd.c b/print_cmd.c
-index d1dfd1a..956db53 100644
---- a/print_cmd.c
-+++ b/print_cmd.c
-@@ -1149,7 +1149,7 @@ indent (amount)
-   for (i = 0; amount > 0; amount--)
-     indentation_string[i++] = ' ';
-   indentation_string[i] = '\0';
--  cprintf (indentation_string);
-+  cprintf ("%s", indentation_string);
- }
- 
- static void
diff --git a/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/test-output.patch b/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/test-output.patch
deleted file mode 100644
index 2b09b7d..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/bash/bash-3.2.57/test-output.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Add FAIL/PASS output to test output.
-
-Signed-off-by: Björn Stenberg <bjst@enea.com>
-Upstream-Status: Pending
----
-diff -uNr a/tests/run-all b/tests/run-all
---- a/tests/run-all	1999-10-08 17:07:46.000000000 +0200
-+++ b/tests/run-all	2012-10-27 21:04:18.663331887 +0200
-@@ -22,7 +22,15 @@
- 	case $x in
- 	$0|run-minimal|run-gprof)	;;
- 	*.orig|*~) ;;
--	*)	echo $x ; sh $x ;;
-+    *)  echo $x
-+         output=`sh $x`
-+         if [ -n "$output" ]; then
-+             echo "$output"
-+             echo "FAIL: $x"
-+         else
-+             echo "PASS: $x"
-+         fi
-+         ;;
- 	esac
- done
- 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/bash/bash.inc b/import-layers/yocto-poky/meta/recipes-extended/bash/bash.inc
index 1d08526..3e9c662 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/bash/bash.inc
+++ b/import-layers/yocto-poky/meta/recipes-extended/bash/bash.inc
@@ -14,9 +14,11 @@
 # This is what other major distros do. And this is what we wanted. See bug#5359 and bug#7137.
 CFLAGS += "-DNON_INTERACTIVE_LOGIN_SHELLS"
 
-ALTERNATIVE_${PN} = "sh"
+ALTERNATIVE_${PN} = "bash sh"
+ALTERNATIVE_LINK_NAME[bash] = "${base_bindir}/bash"
+ALTERNATIVE_TARGET[bash] = "${base_bindir}/bash"
 ALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh"
-ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash"
+ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash.${BPN}"
 ALTERNATIVE_PRIORITY = "100"
 
 RDEPENDS_${PN} += "base-files"
@@ -63,3 +65,7 @@
 pkg_postrm_${PN} () {
 	printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
 }
+
+PACKAGES += "${PN}-bashbug"
+FILES_${PN} = "${bindir}/bash ${base_bindir}/bash.bash"
+FILES_${PN}-bashbug = "${bindir}/bashbug"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/bash/bash/bash-memleak-bug-fix-for-builtin-command-read.patch b/import-layers/yocto-poky/meta/recipes-extended/bash/bash/bash-memleak-bug-fix-for-builtin-command-read.patch
new file mode 100644
index 0000000..9fb6ba9
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/bash/bash/bash-memleak-bug-fix-for-builtin-command-read.patch
@@ -0,0 +1,35 @@
+From d3b6303a6853f612a56848ee4e59eaa0b0ab9489 Mon Sep 17 00:00:00 2001
+From: Zhang Xiao <xiao.zhang@windriver.com>
+Date: Tue, 21 Feb 2017 11:30:14 +0800
+Subject: [PATCH] bash: memleak bug fix for builtin command read
+
+Built in command "read" with "-e" use Readline to obtain the line
+in an interactive shell. In this process, a string "rlbuf" is
+just allocated without free operation thus cause memory leak. Fix it.
+
+Upstream-Status: Submitted [http://lists.gnu.org/archive/html/bug-bash/2017-02/msg00061.html]
+
+Signed-off-by: Zhang Xiao <xiao.zhang@windriver.com>
+---
+ builtins/read.def | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/builtins/read.def b/builtins/read.def
+index 4397154..ee0c5a6 100644
+--- a/builtins/read.def
++++ b/builtins/read.def
+@@ -674,6 +674,11 @@ add_char:
+   input_string[i] = '\0';
+   CHECK_ALRM;
+ 
++#if defined (READLINE)
++  if (edit)
++    xfree (rlbuf);
++#endif
++
+   if (retval < 0)
+     {
+       t_errno = errno;
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/bash/bash_3.2.57.bb b/import-layers/yocto-poky/meta/recipes-extended/bash/bash_3.2.57.bb
deleted file mode 100644
index 5c288b3..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/bash/bash_3.2.57.bb
+++ /dev/null
@@ -1,18 +0,0 @@
-require bash.inc
-
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=fd5d9bcabd8ed5a54a01ce8d183d592a"
-
-SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \
-           file://mkbuiltins_have_stringize.patch \
-           file://build-tests.patch \
-           file://test-output.patch \
-           file://run-ptest \
-           file://dont-include-target-CFLAGS-in-host-LDFLAGS.patch \
-           file://string-format.patch \
-          "
-
-SRC_URI[md5sum] = "237a8767c990b43ae2c89895c2dbc062"
-SRC_URI[sha256sum] = "3fa9daf85ebf35068f090ce51283ddeeb3c75eb5bc70b1a4a7cb05868bfe06a4"
-
-PARALLEL_MAKE = ""
diff --git a/import-layers/yocto-poky/meta/recipes-extended/bash/bash_4.3.30.bb b/import-layers/yocto-poky/meta/recipes-extended/bash/bash_4.3.30.bb
index b40059f..2648faf 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/bash/bash_4.3.30.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/bash/bash_4.3.30.bb
@@ -32,6 +32,7 @@
            file://0001-help-fix-printf-format-security-warning.patch \
            file://fix-run-intl.patch \
            file://CVE-2016-9401.patch \
+           file://bash-memleak-bug-fix-for-builtin-command-read.patch \
            "
 
 SRC_URI[tarball.md5sum] = "a27b3ee9be83bd3ba448c0ff52b28447"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/byacc/byacc.inc b/import-layers/yocto-poky/meta/recipes-extended/byacc/byacc.inc
index f9f8d6b..adb0719 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/byacc/byacc.inc
+++ b/import-layers/yocto-poky/meta/recipes-extended/byacc/byacc.inc
@@ -6,7 +6,8 @@
 LICENSE = "PD"
 
 SRC_URI = "ftp://invisible-island.net/byacc/byacc-${PV}.tgz \
-           file://byacc-open.patch"
+           file://byacc-open.patch \
+           file://0001-byacc-do-not-reorder-CC-and-CFLAGS.patch"
 
 EXTRA_OECONF += "--program-transform-name='s,^,b,'"
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/byacc/byacc/0001-byacc-do-not-reorder-CC-and-CFLAGS.patch b/import-layers/yocto-poky/meta/recipes-extended/byacc/byacc/0001-byacc-do-not-reorder-CC-and-CFLAGS.patch
new file mode 100644
index 0000000..7cd2510
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/byacc/byacc/0001-byacc-do-not-reorder-CC-and-CFLAGS.patch
@@ -0,0 +1,161 @@
+Subject: byacc: do not reorder $CC and $CFLAGS
+
+byacc tries to process $CC and decide which part should belong to CC and which
+part should below to CFLAGS and then do reordering. It doesn't make much sense
+for OE. And it doesn't do its work correctly. Some options are dropped.
+
+Delete all these stuff so that we could have all options we need.
+
+Upstream-Status: Inappropriate [OE Specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ aclocal.m4 |   1 -
+ configure  | 119 -------------------------------------------------------------
+ 2 files changed, 120 deletions(-)
+
+diff --git a/aclocal.m4 b/aclocal.m4
+index 917a848..62ef241 100644
+--- a/aclocal.m4
++++ b/aclocal.m4
+@@ -1021,7 +1021,6 @@ CF_GCC_VERSION
+ CF_ACVERSION_CHECK(2.52,
+ 	[AC_PROG_CC_STDC],
+ 	[CF_ANSI_CC_REQD])
+-CF_CC_ENV_FLAGS
+ ])dnl
+ dnl ---------------------------------------------------------------------------
+ dnl CF_PROG_GROFF version: 2 updated: 2015/07/04 11:16:27
+diff --git a/configure b/configure
+index 9707e50..4f0497c 100755
+--- a/configure
++++ b/configure
+@@ -1946,125 +1946,6 @@ esac
+ # This should have been defined by AC_PROG_CC
+ : ${CC:=cc}
+ 
+-echo "$as_me:1949: checking \$CC variable" >&5
+-echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6
+-case "$CC" in
+-(*[\ \	]-*)
+-	echo "$as_me:1953: result: broken" >&5
+-echo "${ECHO_T}broken" >&6
+-	{ echo "$as_me:1955: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&5
+-echo "$as_me: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;}
+-	# humor him...
+-	cf_flags=`echo "$CC" | sed -e 's/^.*[ 	]\(-[^ 	]\)/\1/'`
+-	CC=`echo "$CC " | sed -e 's/[ 	]-[^ 	].*$//' -e 's/[ 	]*$//'`
+-	for cf_arg in $cf_flags
+-	do
+-		case "x$cf_arg" in
+-		(x-[IUDfgOW]*)
+-
+-cf_fix_cppflags=no
+-cf_new_cflags=
+-cf_new_cppflags=
+-cf_new_extra_cppflags=
+-
+-for cf_add_cflags in $cf_flags
+-do
+-case $cf_fix_cppflags in
+-(no)
+-	case $cf_add_cflags in
+-	(-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C)
+-		case $cf_add_cflags in
+-		(-D*)
+-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+-
+-			test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
+-				&& test -z "${cf_tst_cflags}" \
+-				&& cf_fix_cppflags=yes
+-
+-			if test $cf_fix_cppflags = yes ; then
+-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+-				continue
+-			elif test "${cf_tst_cflags}" = "\"'" ; then
+-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+-				continue
+-			fi
+-			;;
+-		esac
+-		case "$CPPFLAGS" in
+-		(*$cf_add_cflags)
+-			;;
+-		(*)
+-			case $cf_add_cflags in
+-			(-D*)
+-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+-
+-CPPFLAGS=`echo "$CPPFLAGS" | \
+-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+-
+-				;;
+-			esac
+-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+-			;;
+-		esac
+-		;;
+-	(*)
+-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+-		;;
+-	esac
+-	;;
+-(yes)
+-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+-
+-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+-
+-	test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
+-		&& test -z "${cf_tst_cflags}" \
+-		&& cf_fix_cppflags=no
+-	;;
+-esac
+-done
+-
+-if test -n "$cf_new_cflags" ; then
+-
+-	CFLAGS="$CFLAGS $cf_new_cflags"
+-fi
+-
+-if test -n "$cf_new_cppflags" ; then
+-
+-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+-fi
+-
+-if test -n "$cf_new_extra_cppflags" ; then
+-
+-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+-fi
+-
+-			;;
+-		(*)
+-			CC="$CC $cf_arg"
+-			;;
+-		esac
+-	done
+-	test -n "$verbose" && echo "	resulting CC: '$CC'" 1>&6
+-
+-echo "${as_me:-configure}:2051: testing resulting CC: '$CC' ..." 1>&5
+-
+-	test -n "$verbose" && echo "	resulting CFLAGS: '$CFLAGS'" 1>&6
+-
+-echo "${as_me:-configure}:2055: testing resulting CFLAGS: '$CFLAGS' ..." 1>&5
+-
+-	test -n "$verbose" && echo "	resulting CPPFLAGS: '$CPPFLAGS'" 1>&6
+-
+-echo "${as_me:-configure}:2059: testing resulting CPPFLAGS: '$CPPFLAGS' ..." 1>&5
+-
+-	;;
+-(*)
+-	echo "$as_me:2063: result: ok" >&5
+-echo "${ECHO_T}ok" >&6
+-	;;
+-esac
+-
+ echo "$as_me:2068: checking whether ${MAKE-make} sets \${MAKE}" >&5
+ echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6
+ set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
+-- 
+2.8.3
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/byacc/byacc_20160606.bb b/import-layers/yocto-poky/meta/recipes-extended/byacc/byacc_20161202.bb
similarity index 74%
rename from import-layers/yocto-poky/meta/recipes-extended/byacc/byacc_20160606.bb
rename to import-layers/yocto-poky/meta/recipes-extended/byacc/byacc_20161202.bb
index 98129d0..755f8ab 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/byacc/byacc_20160606.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/byacc/byacc_20161202.bb
@@ -8,5 +8,5 @@
 require byacc.inc
 
 
-SRC_URI[md5sum] = "d527c811b360f04a8c5f5a0a90625966"
-SRC_URI[sha256sum] = "cc8fdced486cb70cec7a7c9358de836bfd267d19d6456760bb4721ccfea5ac91"
+SRC_URI[md5sum] = "48ef38447f2cc864c70ef864b26cf817"
+SRC_URI[sha256sum] = "30dc58cfcdb708eea7ba022db29b41d2d392f20727491b956954366f2f2117f0"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/bzip2/bzip2_1.0.6.bb b/import-layers/yocto-poky/meta/recipes-extended/bzip2/bzip2_1.0.6.bb
index ef7bc89..0512a75 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/bzip2/bzip2_1.0.6.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/bzip2/bzip2_1.0.6.bb
@@ -25,7 +25,7 @@
 
 CFLAGS_append = " -fPIC -fpic -Winline -fno-strength-reduce -D_FILE_OFFSET_BITS=64"
 
-inherit autotools update-alternatives ptest
+inherit autotools update-alternatives ptest relative_symlinks
 
 ALTERNATIVE_PRIORITY = "100"
 ALTERNATIVE_${PN} = "bunzip2 bzcat"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/chkconfig/chkconfig-alternatives-native_1.3.59.bb b/import-layers/yocto-poky/meta/recipes-extended/chkconfig/chkconfig-alternatives-native_1.3.59.bb
index c0f7f16..87fa8eb 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/chkconfig/chkconfig-alternatives-native_1.3.59.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/chkconfig/chkconfig-alternatives-native_1.3.59.bb
@@ -21,7 +21,7 @@
 # into the sysroot, as we may use them to construct the rootfs. As such, we
 # only adjust the paths to match the metadata for the target, not native.
 obey_variables () {
-	sed -i 's,ALTERNATIVES_ROOT,OPKG_OFFLINE_ROOT,' alternatives.c
+	sed -i 's,ALTERNATIVES_ROOT,OPKG_OFFLINE_ROOT,' ${S}/alternatives.c
 }
 
 do_compile () {
diff --git a/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio-2.8/avoid_heap_overflow.patch b/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio-2.8/avoid_heap_overflow.patch
deleted file mode 100644
index a315735..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio-2.8/avoid_heap_overflow.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-Upstream-Status: Inappropriate [bugfix: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-0624]
-CVE: CVE-2010-0624
-
-This patch avoids heap overflow reported by :
-http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-0624
-
-This is a clean patch for the GPLv2 tar recipe.
-
-the GPLv2 tar recipe patch is also applicable to this GPLv2 cpio 
-recipe, as they share code.
-
-Nitin A Kamble <nitin.a.kamble@intel.com> 2011/04/25
-
-Index: tar-1.17/lib/rtapelib.c
-===================================================================
---- tar-1.17.orig/lib/rtapelib.c
-+++ tar-1.17/lib/rtapelib.c
-@@ -570,7 +570,7 @@ rmt_read__ (int handle, char *buffer, si
- 
-   sprintf (command_buffer, "R%lu\n", (unsigned long) length);
-   if (do_command (handle, command_buffer) == -1
--      || (status = get_status (handle)) == SAFE_READ_ERROR)
-+      || ((status = get_status (handle)) == SAFE_READ_ERROR) || (status > length))
-     return SAFE_READ_ERROR;
- 
-   for (counter = 0; counter < status; counter += rlen, buffer += rlen)
diff --git a/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio-2.8/fix-memory-overrun.patch b/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio-2.8/fix-memory-overrun.patch
deleted file mode 100644
index 0148e70..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio-2.8/fix-memory-overrun.patch
+++ /dev/null
@@ -1,217 +0,0 @@
-cpio: Fix memory overrun on reading improperly created link records
-
-Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
-
-http://git.savannah.gnu.org/cgit/cpio.git/commit/?id=746f3ff670dcfcdd28fcc990e79cd6fccc7ae48d
-
-  * src/copyin.c (get_link_name): New function.
-  (list_file, copyin_link): use get_link_name
-
-  * tests/symlink-bad-length.at: New file.
-  * tests/symlink-long.at: New file.
-  * tests/Makefile.am: Add new files.
-  * tests/testsuite.at: Likewise.
-
-  See http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
-
-Upstream-Status: Backport
-
-Signed-off-by: Sergey Poznyakoff <gray@gnu.org.ua>
-
-diff -Nurp cpio-2.8.orig/src/copyin.c cpio-2.8/src/copyin.c
---- cpio-2.8.orig/src/copyin.c	2007-06-07 19:58:03.000000000 +0800
-+++ cpio-2.8/src/copyin.c	2014-12-08 11:30:01.159791484 +0800
-@@ -126,6 +126,28 @@ tape_skip_padding (int in_file_des, int
- }
- 
- 
-+static char *
-+get_link_name (struct cpio_file_stat *file_hdr, int in_file_des)
-+{
-+  off_t n = file_hdr->c_filesize + 1;
-+  char *link_name;
-+
-+  if (n == 0 || n > SIZE_MAX)
-+    {
-+      error (0, 0, _("%s: stored filename length too big"), file_hdr->c_name);
-+      link_name = NULL;
-+    }
-+  else
-+    {
-+      link_name = xmalloc (n);
-+      tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
-+      link_name[file_hdr->c_filesize] = '\0';
-+      tape_skip_padding (in_file_des, file_hdr->c_filesize);
-+    }
-+  return link_name;
-+}
-+
-+
- static void
- list_file(struct cpio_file_stat* file_hdr, int in_file_des)
- {
-@@ -136,21 +158,16 @@ list_file(struct cpio_file_stat* file_hd
- 	{
- 	  if (archive_format != arf_tar && archive_format != arf_ustar)
- 	    {
--	      char *link_name = NULL;	/* Name of hard and symbolic links.  */
--
--	      link_name = (char *) xmalloc ((unsigned int) file_hdr->c_filesize + 1);
--	      link_name[file_hdr->c_filesize] = '\0';
--	      tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
--	      long_format (file_hdr, link_name);
--	      free (link_name);
--	      tape_skip_padding (in_file_des, file_hdr->c_filesize);
--	      return;
-+	      char *link_name = get_link_name (file_hdr, in_file_des);
-+	      if (link_name)
-+		{
-+		  long_format (file_hdr, link_name);
-+		  free (link_name);
-+		}
- 	    }
- 	  else
--	    {
- 	      long_format (file_hdr, file_hdr->c_tar_linkname);
--	      return;
--	    }
-+	  return;
- 	}
-       else
- #endif
-@@ -732,10 +749,7 @@ copyin_link(struct cpio_file_stat *file_
- 
-   if (archive_format != arf_tar && archive_format != arf_ustar)
-     {
--      link_name = (char *) xmalloc ((unsigned int) file_hdr->c_filesize + 1);
--      link_name[file_hdr->c_filesize] = '\0';
--      tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
--      tape_skip_padding (in_file_des, file_hdr->c_filesize);
-+      link_name = get_link_name (file_hdr, in_file_des);
-     }
-   else
-     {
-diff -Nurp cpio-2.8.orig/tests/Makefile.am cpio-2.8/tests/Makefile.am
---- cpio-2.8.orig/tests/Makefile.am	2006-10-24 18:32:13.000000000 +0800
-+++ cpio-2.8/tests/Makefile.am	2014-12-08 11:30:52.387789482 +0800
-@@ -45,6 +45,8 @@ TESTSUITE_AT = \
-  testsuite.at\
-  inout.at\
-  symlink.at\
-+ symlink-bad-length.at\
-+ symlink-long.at\
-  version.at
- 
- TESTSUITE = $(srcdir)/testsuite
-diff -Nurp cpio-2.8.orig/tests/symlink-bad-length.at cpio-2.8/tests/symlink-bad-length.at
---- cpio-2.8.orig/tests/symlink-bad-length.at	1970-01-01 08:00:00.000000000 +0800
-+++ cpio-2.8/tests/symlink-bad-length.at	2014-12-08 11:33:25.283783507 +0800
-@@ -0,0 +1,49 @@
-+# Process this file with autom4te to create testsuite.  -*- Autotest -*-
-+# Copyright (C) 2014 Free Software Foundation, Inc.
-+
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3, or (at your option)
-+# any later version.
-+
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-+# 02110-1301 USA.
-+
-+# Cpio v2.11 did segfault with badly set symlink length.
-+# References:
-+# http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
-+
-+AT_SETUP([symlink-bad-length])
-+AT_KEYWORDS([symlink-long copyout])
-+
-+AT_DATA([ARCHIVE.base64],
-+[x3EjAIBAtIEtJy8nAQAAAHRUYW0FAAAADQBGSUxFAABzb21lIGNvbnRlbnQKAMdxIwBgQ/+hLScv
-+JwEAAAB0VEhuBQD/////TElOSwAARklMRcdxAAAAAAAAAAAAAAEAAAAAAAAACwAAAAAAVFJBSUxF
-+UiEhIQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
-+])
-+
-+AT_CHECK([
-+base64 -d ARCHIVE.base64 > ARCHIVE || AT_SKIP_TEST
-+cpio -ntv < ARCHIVE
-+test $? -eq 2
-+],
-+[0],
-+[-rw-rw-r--   1 10029    10031          13 Nov 25 13:52 FILE
-+],[cpio: LINK: stored filename length too big
-+cpio: premature end of file
-+])
-+
-+AT_CLEANUP
-diff -Nurp cpio-2.8.orig/tests/symlink-long.at cpio-2.8/tests/symlink-long.at
---- cpio-2.8.orig/tests/symlink-long.at	1970-01-01 08:00:00.000000000 +0800
-+++ cpio-2.8/tests/symlink-long.at	2014-12-08 11:34:28.807781024 +0800
-@@ -0,0 +1,46 @@
-+# Process this file with autom4te to create testsuite.  -*- Autotest -*-
-+# Copyright (C) 2014 Free Software Foundation, Inc.
-+
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3, or (at your option)
-+# any later version.
-+
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-+# 02110-1301 USA.
-+
-+# Cpio v2.11.90 changed the way symlink name is read from archive.
-+# References:
-+# http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
-+
-+AT_SETUP([symlink-long])
-+AT_KEYWORDS([symlink-long copyout])
-+
-+AT_CHECK([
-+
-+# len(dirname) > READBUFSIZE
-+dirname=
-+for i in {1..52}; do
-+    dirname="xxxxxxxxx/$dirname"
-+    mkdir "$dirname"
-+done
-+ln -s "$dirname" x || AT_SKIP_TEST
-+
-+echo x | cpio -o > ar
-+list=`cpio -tv < ar | sed 's|.*-> ||'`
-+test "$list" = "$dirname" && echo success || echo fail
-+],
-+[0],
-+[success
-+],[2 blocks
-+2 blocks
-+])
-+
-+AT_CLEANUP
-diff -Nurp cpio-2.8.orig/tests/testsuite.at cpio-2.8/tests/testsuite.at
---- cpio-2.8.orig/tests/testsuite.at	2006-10-24 18:32:13.000000000 +0800
-+++ cpio-2.8/tests/testsuite.at	2014-12-08 11:34:56.515779942 +0800
-@@ -31,3 +31,5 @@ m4_include([version.at])
- 
- m4_include([inout.at])
- m4_include([symlink.at])
-+m4_include([symlink-bad-length.at])
-+m4_include([symlink-long.at])
diff --git a/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio-2.8/m4extensions.patch b/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio-2.8/m4extensions.patch
deleted file mode 100644
index e16585d..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio-2.8/m4extensions.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Upstream-Status: Inappropriate [licensing]
-
-# Define AC_USE_SYSTEM_EXTENSIONS only if it was previously undefined.
-# This is needed to configure correctly with newer versions of autoconf.
-
-diff -urN cpio-2.8.orig/m4/extensions.m4 cpio-2.8/m4/extensions.m4
---- cpio-2.8.orig/m4/extensions.m4	2006-10-12 04:34:45.000000000 -0700
-+++ cpio-2.8/m4/extensions.m4	2010-07-23 14:37:36.000000000 -0700
-@@ -1,4 +1,4 @@
--# serial 4  -*- Autoconf -*-
-+# serial 5  -*- Autoconf -*-
- # Enable extensions on systems that normally disable them.
- 
- # Copyright (C) 2003, 2006 Free Software Foundation, Inc.
-@@ -16,6 +16,7 @@
- # ------------------------
- # Enable extensions on systems that normally disable them,
- # typically due to standards-conformance issues.
-+m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [], [
- AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
- [
-   AC_BEFORE([$0], [AC_COMPILE_IFELSE])
-@@ -48,7 +49,7 @@
-     AC_DEFINE([__EXTENSIONS__])
-   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-   AC_DEFINE([_TANDEM_SOURCE])
--])
-+])])
- 
- # gl_USE_SYSTEM_EXTENSIONS
- # ------------------------
diff --git a/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio-2.8/statdef.patch b/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio-2.8/statdef.patch
deleted file mode 100644
index a00799f..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio-2.8/statdef.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Upstream-Status: Inappropriate [licensing]
-
-# Avoid multiple stat definitions
-# Patch taken from cpio mailing list posting 2010-03-19
-
-diff -urN cpio-2.11.orig/src/filetypes.h cpio-2.11/src/filetypes.h
---- cpio-2.11.orig/src/filetypes.h	2010-02-12 02:19:23.000000000 -0800
-+++ cpio-2.11/src/filetypes.h	2010-07-23 13:17:25.000000000 -0700
-@@ -82,4 +82,6 @@
- #define lstat stat
- #endif
- int lstat ();
-+#ifndef stat
- int stat ();
-+#endif
diff --git a/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio_2.12.bb b/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio_2.12.bb
index e743999..405a90e 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio_2.12.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio_2.12.bb
@@ -1,4 +1,4 @@
-include cpio_v2.inc
+require cpio_v2.inc
 
 LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio_2.8.bb b/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio_2.8.bb
deleted file mode 100644
index 624906b..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/cpio/cpio_2.8.bb
+++ /dev/null
@@ -1,19 +0,0 @@
-require cpio_v2.inc
-
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://COPYING;md5=b7f772ea3a2489231cb4872656cac34b"
-
-PR = "r4"
-
-SRC_URI += " \
-	    file://statdef.patch \
-	    file://m4extensions.patch \
-	    file://avoid_heap_overflow.patch \
-	    file://fix-memory-overrun.patch \
-	   "
-
-SRC_URI[md5sum] = "0caa356e69e149fb49b76bacc64615a1"
-SRC_URI[sha256sum] = "1b203248874c3b5a728b351f06513e5282f73e0170b7f207fbf8c39f28f6b4ad"
-
-# Required to build with gcc 4.3 and later:
-CFLAGS += "-fgnu89-inline"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/cronie/cronie_1.5.1.bb b/import-layers/yocto-poky/meta/recipes-extended/cronie/cronie_1.5.1.bb
index 6d46629..cfb8c21 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/cronie/cronie_1.5.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/cronie/cronie_1.5.1.bb
@@ -30,7 +30,7 @@
 
 inherit autotools update-rc.d useradd systemd
 
-PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
+PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
 
 PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit,"
 PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam,${PAM_DEPS}"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/cups/cups.inc b/import-layers/yocto-poky/meta/recipes-extended/cups/cups.inc
index 02b6358..c3fa459 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/cups/cups.inc
+++ b/import-layers/yocto-poky/meta/recipes-extended/cups/cups.inc
@@ -3,7 +3,7 @@
 LICENSE = "GPLv2 & LGPLv2"
 DEPENDS = "gnutls libpng jpeg dbus dbus-glib zlib libusb"
 
-SRC_URI = "https://github.com/apple/cups/releases/download/release-${PV}/${BP}-source.tar.gz \
+SRC_URI = "https://github.com/apple/cups/releases/download/v${PV}/${BP}-source.tar.gz \
            file://use_echo_only_in_init.patch \
            file://0001-don-t-try-to-run-generated-binaries.patch \
            file://cups_serverbin.patch \
@@ -16,7 +16,7 @@
 
 CLEANBROKEN = "1"
 
-inherit autotools-brokensep binconfig useradd systemd
+inherit autotools-brokensep binconfig useradd systemd pkgconfig
 
 USERADD_PACKAGES = "${PN}"
 GROUPADD_PARAM_${PN} = "--system lpadmin"
@@ -24,8 +24,7 @@
 SYSTEMD_SERVICE_${PN} = "org.cups.cupsd.socket org.cups.cupsd.path org.cups.cupsd.service org.cups.cups-lpd.socket org.cups.cups-lpd@.service"
 
 PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \
-                   ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
-                   ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
+                   ${@bb.utils.filter('DISTRO_FEATURES', 'pam systemd', d)}"
 PACKAGECONFIG[avahi] = "--enable-avahi,--disable-avahi,avahi"
 PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl"
 PACKAGECONFIG[pam] = "--enable-pam, --disable-pam, libpam"
@@ -83,7 +82,7 @@
 python do_package_append() {
     import subprocess
     # Change permissions back the way they were, they probably had a reason...
-    workdir = d.getVar('WORKDIR', True)
+    workdir = d.getVar('WORKDIR')
     subprocess.call('chmod 0511 %s/install/cups/var/run/cups/certs' % workdir, shell=True)
 }
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/cups/cups_2.1.4.bb b/import-layers/yocto-poky/meta/recipes-extended/cups/cups_2.1.4.bb
deleted file mode 100644
index 0fab806..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/cups/cups_2.1.4.bb
+++ /dev/null
@@ -1,6 +0,0 @@
-require cups.inc
-
-LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=6c5a350596fba02754bd96eb6df3afd0"
-
-SRC_URI[md5sum] = "9f9bf6e3b9c20a3519b4dc409666d6e7"
-SRC_URI[sha256sum] = "4b14fd833180ac529ebebea766a09094c2568bf8426e219cb3a1715304ef728d"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/cups/cups_2.2.2.bb b/import-layers/yocto-poky/meta/recipes-extended/cups/cups_2.2.2.bb
new file mode 100644
index 0000000..5174c30
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/cups/cups_2.2.2.bb
@@ -0,0 +1,6 @@
+require cups.inc
+
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=f212b4338db0da8cb892e94bf2949460"
+
+SRC_URI[md5sum] = "036f6bda6202ae3e280ac00c710b5ca4"
+SRC_URI[sha256sum] = "f589bb7d5d1dc3aa0915d7cf2b808571ef2e1530cd1a6ebe76ae8f9f4994e4f6"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils-2.8.1/diffutils_fix_for_automake-1.12.patch b/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils-2.8.1/diffutils_fix_for_automake-1.12.patch
deleted file mode 100644
index f8638bb..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils-2.8.1/diffutils_fix_for_automake-1.12.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Upstream-Status: Pending
-
-automake 1.12 has depricated automatic de-ANSI-fication support
-
-this patch avoids these kinds of errors:
-
-| configure.ac:90: error: automatic de-ANSI-fication support has been removed
-| /srv/home/nitin/builds/build-gcc47/tmp/sysroots/x86_64-linux/usr/share/aclocal-1.12/protos.m4:12: AM_C_PROTOTYPES is expanded from...
-| /srv/home/nitin/builds/build-gcc47/tmp/work/i586-poky-linux/diffutils-2.8.1-r4/diffutils-2.8.1/m4/prereq.m4:110: jm_PREREQ_QUOTEARG is expanded from...
-| configure.ac:90: the top level
-| autom4te: m4 failed with exit status: 1
-
-Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
-2012/05/04
-
-Index: diffutils-2.8.1/m4/prereq.m4
-===================================================================
---- diffutils-2.8.1.orig/m4/prereq.m4
-+++ diffutils-2.8.1/m4/prereq.m4
-@@ -115,7 +115,6 @@ AC_DEFUN([jm_PREREQ_QUOTEARG],
-   AC_HEADER_STDC
-   AC_C_BACKSLASH_A
-   AC_MBSTATE_T
--  AM_C_PROTOTYPES
- ])
- 
- AC_DEFUN([jm_PREREQ_REGEX],
diff --git a/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils-2.8.1/fix_gcc6.patch b/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils-2.8.1/fix_gcc6.patch
deleted file mode 100644
index f915287..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils-2.8.1/fix_gcc6.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Fixes to allow diffutils to build with gcc v6.
-
-RP
-2016/5/25
-
-Index: diffutils-2.8.1/lib/posix/regex.h
-===================================================================
---- diffutils-2.8.1.orig/lib/posix/regex.h
-+++ diffutils-2.8.1/lib/posix/regex.h
-@@ -529,7 +529,9 @@ extern int re_exec _RE_ARGS ((const char
- /* For now unconditionally define __restrict_arr to expand to nothing.
-    Ideally we would have a test for the compiler which allows defining
-    it to restrict.  */
-+#ifndef __restrict_arr
- #define __restrict_arr
-+#endif
- 
- /* POSIX compatibility.  */
- extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,
-Index: diffutils-2.8.1/src/diff.c
-===================================================================
---- diffutils-2.8.1.orig/src/diff.c
-+++ diffutils-2.8.1/src/diff.c
-@@ -71,6 +71,7 @@ static void usage (void);
- static bool recursive;
- 
- /* In context diffs, show previous lines that match these regexps.  */
-+struct re_pattern_buffer function_regexp;
- static struct regexp_list function_regexp_list;
- 
- /* Ignore changes affecting only lines that match these regexps.  */
diff --git a/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils-3.4/0001-Unset-need_charset_alias-when-building-for-musl.patch b/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils-3.5/0001-Unset-need_charset_alias-when-building-for-musl.patch
similarity index 100%
rename from import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils-3.4/0001-Unset-need_charset_alias-when-building-for-musl.patch
rename to import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils-3.5/0001-Unset-need_charset_alias-when-building-for-musl.patch
diff --git a/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils-3.4/run-ptest b/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils-3.5/run-ptest
similarity index 100%
rename from import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils-3.4/run-ptest
rename to import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils-3.5/run-ptest
diff --git a/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils_2.8.1.bb b/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils_2.8.1.bb
deleted file mode 100644
index fe56f9c..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils_2.8.1.bb
+++ /dev/null
@@ -1,17 +0,0 @@
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
-
-require diffutils.inc
-
-PR = "r7.0"
-
-SRC_URI = "${GNU_MIRROR}/diffutils/diffutils-${PV}.tar.gz \
-           file://diffutils_fix_for_automake-1.12.patch \
-           file://fix_gcc6.patch"
-
-SRC_URI[md5sum] = "71f9c5ae19b60608f6c7f162da86a428"
-SRC_URI[sha256sum] = "c5001748b069224dd98bf1bb9ee877321c7de8b332c8aad5af3e2a7372d23f5a"
-
-do_configure_prepend () {
-	chmod u+w ${S}/po/Makefile.in.in
-}
diff --git a/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils_3.4.bb b/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils_3.5.bb
similarity index 88%
rename from import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils_3.4.bb
rename to import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils_3.5.bb
index be280ec..243584b 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils_3.4.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/diffutils/diffutils_3.5.bb
@@ -20,8 +20,8 @@
 	done
 }
 
-SRC_URI[md5sum] = "df9ca465f30307cffd03da176a43a5d4"
-SRC_URI[sha256sum] = "db53c025f2ac3d217bcf753dad6dee7b410b33d0948495ff015aaf8b91189ce2"
+SRC_URI[md5sum] = "569354697ff1cfc9a9de3781361015fa"
+SRC_URI[sha256sum] = "dad398ccd5b9faca6b0ab219a036453f62a602a56203ac659b43e889bec35533"
 
 inherit ptest
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ed/ed_0.5.bb b/import-layers/yocto-poky/meta/recipes-extended/ed/ed_0.5.bb
deleted file mode 100644
index e2df13f..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ed/ed_0.5.bb
+++ /dev/null
@@ -1,20 +0,0 @@
-SUMMARY = "Line-oriented text editor"
-HOMEPAGE = "http://www.gnu.org/software/ed/"
-SECTION = "base"
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=6ddd5335ef96fb858a138230af773710 \
-                    file://main.c;beginline=1;endline=17;md5=36d4b85e5ae9028e918d1cc775c2475e"
-
-PR = "r2"
-SRC_URI = "${SAVANNAH_GNU_MIRROR}/ed/ed-${PV}.tar.bz2"
-
-SRC_URI[md5sum] = "4ee21e9dcc9b5b6012c23038734e1632"
-SRC_URI[sha256sum] = "edef2bbde0fbf0d88232782a0eded323f483a0519d6fde9a3b1809056fd35f3e"
-
-inherit autotools texinfo
-
-EXTRA_OECONF = "'CC=${CC}' 'CXX=${CXX}' 'CFLAGS=${CFLAGS}' 'CXXFLAGS=${CXXFLAGS}' 'CPPFLAGS=${CPPFLAGS}' 'LDFLAGS=${LDFLAGS}'"
-
-CONFIGUREOPTS_remove = "--disable-dependency-tracking"
-CONFIGUREOPTS_remove = "--disable-silent-rules"
-EXTRA_OECONF_remove = "--disable-static"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ed/ed_1.14.1.bb b/import-layers/yocto-poky/meta/recipes-extended/ed/ed_1.14.1.bb
new file mode 100644
index 0000000..7e6bde4
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ed/ed_1.14.1.bb
@@ -0,0 +1,35 @@
+SUMMARY = "Line-oriented text editor"
+HOMEPAGE = "http://www.gnu.org/software/ed/"
+
+LICENSE = "GPLv3+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=0c7051aef9219dc7237f206c5c4179a7 \
+                    file://ed.h;endline=20;md5=4e36b7a40e137f42aee718165590d125 \
+                    file://main.c;endline=17;md5=c5b8f78f115df187af76868a2aead16a"
+
+SECTION = "base"
+
+# LSB states that ed should be in /bin/
+bindir = "${base_bindir}"
+
+# Upstream regularly removes previous releases from https://ftp.gnu.org/gnu/ed/
+SRC_URI = "http://downloads.yoctoproject.org/mirror/sources/${BP}.tar.lz"
+UPSTREAM_CHECK_URI = "${GNU_MIRROR}/ed/"
+
+SRC_URI[md5sum] = "7f4a54fa7f366479f03654b8af645fd0"
+SRC_URI[sha256sum] = "ffb97eb8f2a2b5a71a9b97e3872adce953aa1b8958e04c5b7bf11d556f32552a"
+
+EXTRA_OEMAKE = "-e MAKEFLAGS="
+
+inherit texinfo
+
+do_configure() {
+	${S}/configure
+}
+
+do_install() {
+	oe_runmake 'DESTDIR=${D}' install
+	# Info dir listing isn't interesting at this point so remove it if it exists.
+	if [ -e "${D}${infodir}/dir" ]; then
+		rm -f ${D}${infodir}/dir
+	fi
+}
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ed/ed_1.9.bb b/import-layers/yocto-poky/meta/recipes-extended/ed/ed_1.9.bb
deleted file mode 100644
index d128de3..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ed/ed_1.9.bb
+++ /dev/null
@@ -1,33 +0,0 @@
-SUMMARY = "Line-oriented text editor"
-HOMEPAGE = "http://www.gnu.org/software/ed/"
-
-LICENSE = "GPLv3+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949 \
-                    file://ed.h;endline=20;md5=375a20cc2545ac1115eeb7b323c60ae3 \
-                    file://main.c;endline=17;md5=14dbb325c1f2d4daf50e0aa5c5038e96"
-
-SECTION = "base"
-
-# LSB states that ed should be in /bin/
-bindir = "${base_bindir}"
-
-SRC_URI = "https://ftp.osuosl.org/pub/blfs/conglomeration/ed/ed-${PV}.tar.gz"
-
-SRC_URI[md5sum] = "565b6d1d5a9a8816b9b304fc4ed9405d"
-SRC_URI[sha256sum] = "d5b372cfadf073001823772272fceac2cfa87552c5cd5a8efc1c8aae61f45a88"
-
-EXTRA_OEMAKE = "-e MAKEFLAGS="
-
-inherit texinfo
-
-do_configure() {
-	${S}/configure
-}
-
-do_install() {
-	oe_runmake 'DESTDIR=${D}' install
-	# Info dir listing isn't interesting at this point so remove it if it exists.
-	if [ -e "${D}${infodir}/dir" ]; then
-		rm -f ${D}${infodir}/dir
-	fi
-}
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ethtool/ethtool_4.6.bb b/import-layers/yocto-poky/meta/recipes-extended/ethtool/ethtool_4.8.bb
similarity index 80%
rename from import-layers/yocto-poky/meta/recipes-extended/ethtool/ethtool_4.6.bb
rename to import-layers/yocto-poky/meta/recipes-extended/ethtool/ethtool_4.8.bb
index 788d4ea..afaf2e2 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/ethtool/ethtool_4.6.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/ethtool/ethtool_4.8.bb
@@ -6,13 +6,13 @@
 LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
                     file://ethtool.c;beginline=4;endline=17;md5=c19b30548c582577fc6b443626fc1216"
 
-SRC_URI = "${KERNELORG_MIRROR}/software/network/ethtool/ethtool-${PV}.tar.gz \
+SRC_URI = "https://downloads.yoctoproject.org/mirror/sources/ethtool-${PV}.tar.gz \
            file://run-ptest \
            file://avoid_parallel_tests.patch \
            "
 
-SRC_URI[md5sum] = "1186dd83a0384109b92c6cd40a7bb0e5"
-SRC_URI[sha256sum] = "ad45620887f7e61312fc2f9ca3fd50d49ac7737ed874b0b02845d07e0fa3ca49"
+SRC_URI[md5sum] = "28c4a4d85c33f573c49ff6d81ec094fd"
+SRC_URI[sha256sum] = "1bd82ebe3d41de1b7b0d8f4fb18a8e8466fba934c952bc5c5002836ffa8bb606"
 
 inherit autotools ptest
 RDEPENDS_${PN}-ptest += "make"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/findutils/findutils-4.2.31/findutils-fix-doc-build-error.patch b/import-layers/yocto-poky/meta/recipes-extended/findutils/findutils-4.2.31/findutils-fix-doc-build-error.patch
deleted file mode 100644
index 2076e44..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/findutils/findutils-4.2.31/findutils-fix-doc-build-error.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 33cba24cba7b0973a702e9627bd5b93962948ae4 Mon Sep 17 00:00:00 2001
-From: Jackie Huang <jackie.huang@windriver.com>
-Date: Tue, 17 Sep 2013 16:11:16 +0800
-Subject: [PATCH] findutils: fix doc build error
-
-Upstream-Status: Backport
-
-Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
----
- doc/find.texi |    6 +++---
- 1 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/doc/find.texi b/doc/find.texi
-index 5b5f0cf..b3d9c6b 100644
---- a/doc/find.texi
-+++ b/doc/find.texi
-@@ -63,7 +63,7 @@ translation approved by the Foundation.
-
- @page
- @vskip 0pt plus 1filll
--@insertcopying{}
-+@insertcopying
- @end titlepage
-
- @contents
-@@ -1466,6 +1466,7 @@ no output is ever sent to it.
- * Escapes::
- * Format Directives::
- * Time Formats::
-+* Formatting Flags::
- @end menu
-
- @node Escapes
-@@ -1534,7 +1535,6 @@ from the novel you are reading.
- * Size Directives::
- * Location Directives::
- * Time Directives::
--* Formatting Flags::
- @end menu
-
- @node Name Directives
-@@ -1780,7 +1780,7 @@ setting the TZ environment variable).  This is a GNU extension.
- @end table
-
- @node Formatting Flags
--@subsubsection Formatting Flags
-+@subsection Formatting Flags
-
- The @samp{%m} and @samp{%d} directives support the @samp{#}, @samp{0}
- and @samp{+} flags, but the other directives do not, even if they
---
-1.7.4.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/findutils/findutils-4.2.31/findutils_fix_for_automake-1.12.patch b/import-layers/yocto-poky/meta/recipes-extended/findutils/findutils-4.2.31/findutils_fix_for_automake-1.12.patch
deleted file mode 100644
index 1b7f8cf..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/findutils/findutils-4.2.31/findutils_fix_for_automake-1.12.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Upstream-Status: Pending
-
-automake 1.12 has depricated automatic de-ANSI-fication support
-
-this patch avoids these kinds of errors:
-
-| configure.in:75: error: automatic de-ANSI-fication support has been removed
-
-Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
-2012/05/04
-
-Index: findutils-4.2.31/configure.in
-===================================================================
---- findutils-4.2.31.orig/configure.in
-+++ findutils-4.2.31/configure.in
-@@ -72,7 +72,6 @@ dnl gl_EARLY calls AC_GNU_SOURCE anyway.
- 
- 
- AC_ISC_POSIX
--AM_C_PROTOTYPES
- 
- AC_PROG_INSTALL
- AC_PROG_RANLIB
diff --git a/import-layers/yocto-poky/meta/recipes-extended/findutils/findutils-4.2.31/gnulib-extension.patch b/import-layers/yocto-poky/meta/recipes-extended/findutils/findutils-4.2.31/gnulib-extension.patch
deleted file mode 100644
index 65bd642..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/findutils/findutils-4.2.31/gnulib-extension.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-the old AC_USE_SYSTEM_EXTENSIONS won't work with AC_GNU_SOURCE
-
-against 4.2.31
-07/08/2010 - qhe
-
-diff --git a/gnulib/m4/extensions.m4 b/gnulib/m4/extensions.m4
-index 143a9e5..0f27ceb 100644
---- a/gnulib/m4/extensions.m4
-+++ b/gnulib/m4/extensions.m4
-@@ -12,44 +12,6 @@
- # enough in this area it's likely we'll need to redefine
- # AC_USE_SYSTEM_EXTENSIONS for quite some time.
- 
--# AC_USE_SYSTEM_EXTENSIONS
--# ------------------------
--# Enable extensions on systems that normally disable them,
--# typically due to standards-conformance issues.
--AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
--[
--  AC_BEFORE([$0], [AC_COMPILE_IFELSE])
--  AC_BEFORE([$0], [AC_RUN_IFELSE])
--
--  AC_REQUIRE([AC_GNU_SOURCE])
--  AC_REQUIRE([AC_AIX])
--  AC_REQUIRE([AC_MINIX])
--
--  AH_VERBATIM([__EXTENSIONS__],
--[/* Enable extensions on Solaris.  */
--#ifndef __EXTENSIONS__
--# undef __EXTENSIONS__
--#endif
--#ifndef _POSIX_PTHREAD_SEMANTICS
--# undef _POSIX_PTHREAD_SEMANTICS
--#endif
--#ifndef _TANDEM_SOURCE
--# undef _TANDEM_SOURCE
--#endif])
--  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
--    [ac_cv_safe_to_define___extensions__],
--    [AC_COMPILE_IFELSE(
--       [AC_LANG_PROGRAM([
--#	  define __EXTENSIONS__ 1
--	  AC_INCLUDES_DEFAULT])],
--       [ac_cv_safe_to_define___extensions__=yes],
--       [ac_cv_safe_to_define___extensions__=no])])
--  test $ac_cv_safe_to_define___extensions__ = yes &&
--    AC_DEFINE([__EXTENSIONS__])
--  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
--  AC_DEFINE([_TANDEM_SOURCE])
--])
--
- # gl_USE_SYSTEM_EXTENSIONS
- # ------------------------
- # Enable extensions on systems that normally disable them,
diff --git a/import-layers/yocto-poky/meta/recipes-extended/findutils/findutils_4.2.31.bb b/import-layers/yocto-poky/meta/recipes-extended/findutils/findutils_4.2.31.bb
deleted file mode 100644
index 7dee018..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/findutils/findutils_4.2.31.bb
+++ /dev/null
@@ -1,14 +0,0 @@
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
-PR = "r4"
-
-require findutils.inc
-
-SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \
-           file://gnulib-extension.patch \
-           file://findutils_fix_for_automake-1.12.patch \
-           file://findutils-fix-doc-build-error.patch \
-           "
-
-SRC_URI[md5sum] = "a0e31a0f18a49709bf5a449867c8049a"
-SRC_URI[sha256sum] = "e0d34b8faca0b3cca0703f6c6b498afbe72f0ba16c35980c10ec9ef7724d6204"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk-3.1.5/0001-gawk-fix-non-glibc-gcc-4-compilation.patch b/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk-3.1.5/0001-gawk-fix-non-glibc-gcc-4-compilation.patch
deleted file mode 100644
index bc9201b..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk-3.1.5/0001-gawk-fix-non-glibc-gcc-4-compilation.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From 53496e2e306b16ac59801553f775bcca164e6a39 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <git@andred.net>
-Date: Wed, 14 Sep 2016 16:20:37 +0100
-Subject: [PATCH] fix gcc >= 4 compilation
-
-| ../gawk-3.1.5/hard-locale.h: In function 'hard_locale':
-| ../gawk-3.1.5/hard-locale.h:43:20: error: invalid storage class for function 'xmalloc'
-|        static ptr_t xmalloc PARAMS ((size_t n));
-|                     ^~~~~~~
-
-| ../gawk-3.1.5/hard-locale.h:45:22: warning: implicit declaration of function 'xmalloc' [-Wimplicit-function-declaration]
-|        char *locale = xmalloc (strlen (p) + 1);
-|                       ^~~~~~~
-| ../gawk-3.1.5/hard-locale.h:45:22: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
-| ../gawk-3.1.5/dfa.c: At top level:
-| ../gawk-3.1.5/dfa.c:125:14: error: conflicting types for 'xmalloc'
-|  static ptr_t xmalloc PARAMS ((size_t n));
-|               ^~~~~~~
-| In file included from ../gawk-3.1.5/dfa.c:112:0:
-| ../gawk-3.1.5/hard-locale.h:45:22: note: previous implicit declaration of 'xmalloc' was here
-|        char *locale = xmalloc (strlen (p) + 1);
-|                       ^~~~~~~
-
-Upstream-Status: Inappropriate [required for gawk 3.1.5 (GPLv2) recipe only]
-
-Signed-off-by: André Draszik <git@andred.net>
----
- dfa.c         | 2 +-
- hard-locale.h | 2 --
- 2 files changed, 1 insertion(+), 3 deletions(-)
-
-diff --git a/dfa.c b/dfa.c
-index 71e3736..97f6045 100644
---- a/dfa.c
-+++ b/dfa.c
-@@ -109,6 +109,7 @@ extern void free();
- 
- #include "regex.h"
- #include "dfa.h"
-+static ptr_t xmalloc PARAMS ((size_t n));
- #include "hard-locale.h"
- 
- /* HPUX, define those as macros in sys/param.h */
-@@ -122,7 +123,6 @@ extern void free();
- static void dfamust PARAMS ((struct dfa *dfa));
- 
- static ptr_t xcalloc PARAMS ((size_t n, size_t s));
--static ptr_t xmalloc PARAMS ((size_t n));
- static ptr_t xrealloc PARAMS ((ptr_t p, size_t n));
- #ifdef DEBUG
- static void prtok PARAMS ((token t));
-diff --git a/hard-locale.h b/hard-locale.h
-index 0f4986b..9ee57e0 100644
---- a/hard-locale.h
-+++ b/hard-locale.h
-@@ -40,8 +40,6 @@ hard_locale (int category)
-       if (strcmp (p, "C") == 0 || strcmp (p, "POSIX") == 0)
- 	hard = 0;
- # else
--      static ptr_t xmalloc PARAMS ((size_t n));
--
-       char *locale = xmalloc (strlen (p) + 1);
-       strcpy (locale, p);
- 
--- 
-2.9.3
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk-3.1.5/gawk-3.1.5_fix_for_automake-1.12.patch b/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk-3.1.5/gawk-3.1.5_fix_for_automake-1.12.patch
deleted file mode 100644
index c42c33c..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk-3.1.5/gawk-3.1.5_fix_for_automake-1.12.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-Upstream-Status: Pending
-
-automake 1.12 has depricated automatic de-ANSI-fication support
-
-this patch avoids these kinds of errors:
-
-| configure.ac:127: error: automatic de-ANSI-fication support has been removed
-| /srv/home/nitin/builds/build-gcc47/tmp/sysroots/x86_64-linux/usr/share/aclocal-1.12/protos.m4:12: AM_C_PROTOTYPES is expanded from...
-| configure.ac:127: the top level
-| autom4te: m4 failed with exit status: 1
-...
-| Makefile.am:27: error: automatic de-ANSI-fication support has been removed
-
-Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
-2012/05/04
-
-Index: gawk-3.1.5/configure.ac
-===================================================================
---- gawk-3.1.5.orig/configure.ac
-+++ gawk-3.1.5/configure.ac
-@@ -124,7 +124,6 @@ fi
- 
- dnl check for C compiler for automake
- AM_PROG_CC_STDC
--AM_C_PROTOTYPES
- 
- dnl Cygwin doesn't like to get libs with full paths
- dnl since that overrides linking against DLLs.
-Index: gawk-3.1.5/Makefile.am
-===================================================================
---- gawk-3.1.5.orig/Makefile.am
-+++ gawk-3.1.5/Makefile.am
-@@ -24,7 +24,7 @@
- ## process this file with automake to produce Makefile.in
- 
- # Automatic de-ANSI-fication if needed, make .bz2 files also.
--AUTOMAKE_OPTIONS = ansi2knr dist-bzip2
-+AUTOMAKE_OPTIONS = dist-bzip2
- 
- # This undocumented variable insures that aclocal runs
- # correctly after changing configure.ac
diff --git a/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk-4.1.3/run-ptest b/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk-4.1.4/run-ptest
similarity index 100%
rename from import-layers/yocto-poky/meta/recipes-extended/gawk/gawk-4.1.3/run-ptest
rename to import-layers/yocto-poky/meta/recipes-extended/gawk/gawk-4.1.4/run-ptest
diff --git a/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk-4.1.4/test-arrayind1-Remove-hashbang-line.patch b/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk-4.1.4/test-arrayind1-Remove-hashbang-line.patch
new file mode 100644
index 0000000..d4262ed
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk-4.1.4/test-arrayind1-Remove-hashbang-line.patch
@@ -0,0 +1,30 @@
+From a3a3f26078223c47871c7b53e5c015ad163ae045 Mon Sep 17 00:00:00 2001
+From: Fabio Berton <fabio.berton@ossystems.com.br>
+Date: Thu, 3 Nov 2016 14:50:52 -0200
+Subject: [PATCH] test/arrayind1: Remove hashbang line
+Organization: O.S. Systems Software LTDA.
+
+Remove "#!/usr/local/bin/awk -f" as none of the other awk scripts in the
+test suite have a hashbang.
+
+Upstream-Status: Submitted [1]
+
+[1] https://lists.gnu.org/archive/html/bug-gawk/2016-11/msg00003.html
+
+Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
+---
+ test/arrayind1.awk | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/test/arrayind1.awk b/test/arrayind1.awk
+index 5d4a6f3..59e8b4e 100755
+--- a/test/arrayind1.awk
++++ b/test/arrayind1.awk
+@@ -1,4 +1,3 @@
+-#!/usr/local/bin/awk -f
+ # this script renums pedigrees with metafounders
+ # so that they are added *before*regular animals
+ # mf are ascertained because they are not in the 1st column
+-- 
+2.1.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk_3.1.5.bb b/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk_3.1.5.bb
deleted file mode 100644
index 63fd32f..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk_3.1.5.bb
+++ /dev/null
@@ -1,44 +0,0 @@
-SUMMARY = "GNU awk text processing utility"
-DESCRIPTION = "The GNU version of awk, a text processing utility. \
-Awk interprets a special-purpose programming language to do \
-quick and easy text pattern matching and reformatting jobs."
-HOMEPAGE = "www.gnu.org/software/gawk"
-BUGTRACKER  = "bug-gawk@gnu.org"
-SECTION = "console/utils"
-
-# gawk <= 3.1.5: GPLv2
-# gawk >= 3.1.6: GPLv3
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
-
-RDEPENDS_gawk += "gawk-common"
-RDEPENDS_pgawk += "gawk-common"
-PR = "r2"
-
-SRC_URI = "\
-    ${GNU_MIRROR}/gawk/gawk-${PV}.tar.gz \
-    file://gawk-3.1.5_fix_for_automake-1.12.patch \
-    file://0001-gawk-fix-non-glibc-gcc-4-compilation.patch \
-"
-
-SRC_URI[md5sum] = "4760325489479cac17fe0114b8f62f30"
-SRC_URI[sha256sum] = "463dcb9d0ca398b1d4f5a332f6cd9cec56441265fca616f2ea1b44d459e9f0f8"
-
-inherit autotools gettext texinfo update-alternatives
-
-PACKAGES += "gawk-common pgawk"
-
-FILES_${PN} = "${bindir}/gawk* ${bindir}/igawk"
-FILES_gawk-common += "${datadir}/awk/* ${libexecdir}/awk/*"
-FILES_pgawk = "${bindir}/pgawk*"
-
-ALTERNATIVE_${PN} = "awk"
-ALTERNATIVE_TARGET[awk] = "${bindir}/gawk"
-ALTERNATIVE_PRIORITY = "100"
-
-CFLAGS += "-D PROTOTYPES"
-
-do_install_append() {
-	# remove the link since we don't package it
-	rm ${D}${bindir}/awk
-}
diff --git a/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk_4.1.3.bb b/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk_4.1.4.bb
similarity index 83%
rename from import-layers/yocto-poky/meta/recipes-extended/gawk/gawk_4.1.3.bb
rename to import-layers/yocto-poky/meta/recipes-extended/gawk/gawk_4.1.4.bb
index 6ca7f3e..dda38ef 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk_4.1.3.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/gawk/gawk_4.1.4.bb
@@ -17,10 +17,11 @@
 
 SRC_URI = "${GNU_MIRROR}/gawk/gawk-${PV}.tar.gz \
            file://run-ptest \
+           file://test-arrayind1-Remove-hashbang-line.patch \
 "
 
-SRC_URI[md5sum] = "55d37f4069502677f25d1340df8eec97"
-SRC_URI[sha256sum] = "524effa5b9ecd4ed940f2581c5d3c1df4e4bd7e6f768aa033c1916f47dfc6e29"
+SRC_URI[md5sum] = "f20c94ca51b6ebfc9bffb90f95c8ffbb"
+SRC_URI[sha256sum] = "8c03080e2b5a56263e8783f6f1f306398d4591be18254041f3f547efef944d35"
 
 inherit autotools gettext texinfo update-alternatives
 
@@ -44,3 +45,5 @@
 	  do cp ${S}/test/$i* ${D}${PTEST_PATH}/test; \
 	done
 }
+
+BBCLASSEXTEND = "nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-7977.patch b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-7977.patch
new file mode 100644
index 0000000..b7eed12
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-7977.patch
@@ -0,0 +1,33 @@
+From 8abd22010eb4db0fb1b10e430d5f5d83e015ef70 Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Mon, 3 Oct 2016 01:46:28 +0100
+Subject: [PATCH] Bug 697169: Be rigorous with SAFER permissions
+
+Once we've opened our input file from the command line, enforce the SAFER
+rules.
+
+Upstream-Status: Backport
+CVE: CVE-2016-7977
+
+Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
+---
+ psi/zfile.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/psi/zfile.c b/psi/zfile.c
+index b6caea2..2c6c958 100644
+--- a/psi/zfile.c
++++ b/psi/zfile.c
+@@ -1081,6 +1081,9 @@ lib_file_open(gs_file_path_ptr  lib_path, const gs_memory_t *mem, i_ctx_t *i_ctx
+     gs_main_instance *minst = get_minst_from_memory(mem);
+     int code;
+ 
++    if (i_ctx_p && starting_arg_file)
++        i_ctx_p->starting_arg_file = false;
++
+     /* when starting arg files (@ files) iodev_default is not yet set */
+     if (iodev == 0)
+         iodev = (gx_io_device *)gx_io_device_table[0];
+-- 
+2.10.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-7978.patch b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-7978.patch
new file mode 100644
index 0000000..668f205
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-7978.patch
@@ -0,0 +1,30 @@
+From 6f749c0c44e7b9e09737b9f29edf29925a34f0cf Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Wed, 5 Oct 2016 09:59:25 +0100
+Subject: [PATCH] Bug 697179: Reference count device icc profile
+
+when copying a device
+
+Upstream-Status: Backport
+CVE: CVE-2016-7978
+
+Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
+---
+ base/gsdevice.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/base/gsdevice.c b/base/gsdevice.c
+index 778106f..aea986a 100644
+--- a/base/gsdevice.c
++++ b/base/gsdevice.c
+@@ -614,6 +614,7 @@ gx_device_init(gx_device * dev, const gx_device * proto, gs_memory_t * mem,
+     dev->memory = mem;
+     dev->retained = !internal;
+     rc_init(dev, mem, (internal ? 0 : 1));
++    rc_increment(dev->icc_struct);
+ }
+ 
+ void
+-- 
+2.10.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-7979.patch b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-7979.patch
new file mode 100644
index 0000000..9e930d3
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-7979.patch
@@ -0,0 +1,48 @@
+From 875a0095f37626a721c7ff57d606a0f95af03913 Mon Sep 17 00:00:00 2001
+From: Ken Sharp <ken.sharp@artifex.com>
+Date: Wed, 5 Oct 2016 10:10:58 +0100
+Subject: [PATCH] DSC parser - validate parameters
+
+Bug #697190 ".initialize_dsc_parser doesn't validate the parameter is a dict type before using it."
+
+Regardless of any security implications, its simply wrong for a PostScript
+operator not to validate its parameter(s).
+
+No differences expected.
+
+Upstream-Status: Backport
+CVE: CVE-2016-7979
+
+Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
+---
+ psi/zdscpars.c | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/psi/zdscpars.c b/psi/zdscpars.c
+index c05e154..9b4b605 100644
+--- a/psi/zdscpars.c
++++ b/psi/zdscpars.c
+@@ -150,11 +150,16 @@ zinitialize_dsc_parser(i_ctx_t *i_ctx_p)
+     ref local_ref;
+     int code;
+     os_ptr const op = osp;
+-    dict * const pdict = op->value.pdict;
+-    gs_memory_t * const mem = (gs_memory_t *)dict_memory(pdict);
+-    dsc_data_t * const data =
+-        gs_alloc_struct(mem, dsc_data_t, &st_dsc_data_t, "DSC parser init");
++    dict *pdict;
++    gs_memory_t *mem;
++    dsc_data_t *data;
+ 
++    check_read_type(*op, t_dictionary);
++
++    pdict = op->value.pdict;
++    mem = (gs_memory_t *)dict_memory(pdict);
++
++    data = gs_alloc_struct(mem, dsc_data_t, &st_dsc_data_t, "DSC parser init");
+     if (!data)
+         return_error(gs_error_VMerror);
+     data->document_level = 0;
+-- 
+2.10.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-8602.patch b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-8602.patch
new file mode 100644
index 0000000..e58567c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-8602.patch
@@ -0,0 +1,47 @@
+From f5c7555c30393e64ec1f5ab0dfae5b55b3b3fc78 Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Sat, 8 Oct 2016 16:10:27 +0100
+Subject: [PATCH] Bug 697203: check for sufficient params in .sethalftone5
+
+and param types
+
+Upstream-Status: Backport
+CVE: CVE-2016-8602
+
+Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
+---
+ psi/zht2.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/psi/zht2.c b/psi/zht2.c
+index fb4a264..dfa27a4 100644
+--- a/psi/zht2.c
++++ b/psi/zht2.c
+@@ -82,14 +82,22 @@ zsethalftone5(i_ctx_t *i_ctx_p)
+     gs_memory_t *mem;
+     uint edepth = ref_stack_count(&e_stack);
+     int npop = 2;
+-    int dict_enum = dict_first(op);
++    int dict_enum;
+     ref rvalue[2];
+     int cname, colorant_number;
+     byte * pname;
+     uint name_size;
+     int halftonetype, type = 0;
+     gs_gstate *pgs = igs;
+-    int space_index = r_space_index(op - 1);
++    int space_index;
++
++    if (ref_stack_count(&o_stack) < 2)
++        return_error(gs_error_stackunderflow);
++    check_type(*op, t_dictionary);
++    check_type(*(op - 1), t_dictionary);
++
++    dict_enum = dict_first(op);
++    space_index = r_space_index(op - 1);
+ 
+     mem = (gs_memory_t *) idmemory->spaces_indexed[space_index];
+ 
+-- 
+2.10.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-11714.patch b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-11714.patch
new file mode 100644
index 0000000..84983c5
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-11714.patch
@@ -0,0 +1,61 @@
+From 671fd59eb657743aa86fbc1895cb15872a317caa Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Thu, 6 Jul 2017 14:54:02 +0100
+Subject: [PATCH] Bug 698158: prevent trying to reloc a freed object
+
+In the token reader, we pass the scanner state structure around as a
+t_struct ref on the Postscript operand stack.
+
+But we explicitly free the scanner state when we're done, which leaves a
+dangling reference on the operand stack and, unless that reference gets
+overwritten before the next garbager run, we can end up with the garbager
+trying to deal with an already freed object - that can cause a crash, or
+memory corruption.
+---
+ psi/ztoken.c |   14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
+--- end of original header
+
+CVE: CVE-2017-11714
+
+Upstream-Status: Backport [git://git.ghostscript.com/ghostpdl.git]
+
+Signed-off-by: Joe Slater <joe.slater@windriver.com>
+
+diff --git a/psi/ztoken.c b/psi/ztoken.c
+index 4dba7c5..af1ceeb 100644
+--- a/psi/ztoken.c
++++ b/psi/ztoken.c
+@@ -107,6 +107,12 @@ token_continue(i_ctx_t *i_ctx_p, scanner_state * pstate, bool save)
+     int code;
+     ref token;
+ 
++    /* Since we might free pstate below, and we're dealing with
++     * gc memory referenced by the stack, we need to explicitly
++     * remove the reference to pstate from the stack, otherwise
++     * the garbager will fall over
++     */
++    make_null(osp);
+     /* Note that gs_scan_token may change osp! */
+     pop(1);                     /* remove the file or scanner state */
+ again:
+@@ -183,8 +189,14 @@ ztokenexec_continue(i_ctx_t *i_ctx_p)
+ static int
+ tokenexec_continue(i_ctx_t *i_ctx_p, scanner_state * pstate, bool save)
+ {
+-    os_ptr op;
++    os_ptr op = osp;
+     int code;
++    /* Since we might free pstate below, and we're dealing with
++     * gc memory referenced by the stack, we need to explicitly
++     * remove the reference to pstate from the stack, otherwise
++     * the garbager will fall over
++     */
++    make_null(osp);
+     /* Note that gs_scan_token may change osp! */
+     pop(1);
+ again:
+-- 
+1.7.9.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-7975.patch b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-7975.patch
new file mode 100644
index 0000000..d0886c9
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-7975.patch
@@ -0,0 +1,36 @@
+From 5e57e483298dae8b8d4ec9aab37a526736ac2e97 Mon Sep 17 00:00:00 2001
+From: Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
+Date: Wed, 26 Apr 2017 22:12:14 +0100
+Subject: [PATCH] Bug 697693: Prevent SEGV due to integer overflow.
+
+While building a Huffman table, the start and end points were susceptible
+to integer overflow.
+
+Thank you to Jiaqi for finding this issue and suggesting a patch.
+
+Upstream-Status: Backport
+CVE: CVE-2017-7975
+
+Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
+---
+ jbig2dec/jbig2_huffman.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/jbig2dec/jbig2_huffman.c b/jbig2dec/jbig2_huffman.c
+index 511e461..b4189a1 100644
+--- a/jbig2dec/jbig2_huffman.c
++++ b/jbig2dec/jbig2_huffman.c
+@@ -421,8 +421,8 @@ jbig2_build_huffman_table(Jbig2Ctx *ctx, const Jbig2HuffmanParams *params)
+ 
+             if (PREFLEN == CURLEN) {
+                 int RANGELEN = lines[CURTEMP].RANGELEN;
+-                int start_j = CURCODE << shift;
+-                int end_j = (CURCODE + 1) << shift;
++                uint32_t start_j = CURCODE << shift;
++                uint32_t end_j = (CURCODE + 1) << shift;
+                 byte eflags = 0;
+ 
+                 if (end_j > max_j) {
+-- 
+2.10.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9216.patch b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9216.patch
new file mode 100644
index 0000000..1caeb3e
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9216.patch
@@ -0,0 +1,36 @@
+From 3ebffb1d96ba0cacec23016eccb4047dab365853 Mon Sep 17 00:00:00 2001
+From: Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
+Date: Wed, 24 May 2017 19:29:57 +0100
+Subject: [PATCH] Bug 697934: Fix SEGV due to error code being ignored.
+
+The return code from jbig2_decode_text_region was being ignored so the
+code continued to try and parse the invalid file using incomplete/empty
+structures.
+
+Upstream-Status: Backport
+CVE: CVE-2017-9216
+
+Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
+---
+ jbig2dec/jbig2_symbol_dict.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/jbig2dec/jbig2_symbol_dict.c b/jbig2dec/jbig2_symbol_dict.c
+index 3cc1731..672425d 100644
+--- a/jbig2dec/jbig2_symbol_dict.c
++++ b/jbig2dec/jbig2_symbol_dict.c
+@@ -493,8 +493,10 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx,
+                         }
+ 
+                         /* multiple symbols are handled as a text region */
+-                        jbig2_decode_text_region(ctx, segment, tparams, (const Jbig2SymbolDict * const *)refagg_dicts,
++                        code = jbig2_decode_text_region(ctx, segment, tparams, (const Jbig2SymbolDict * const *)refagg_dicts,
+                                                  n_refagg_dicts, image, data, size, GR_stats, as, ws);
++                        if (code < 0)
++                            goto cleanup4;
+ 
+                         SDNEWSYMS->glyphs[NSYMSDECODED] = image;
+                         refagg_dicts[0]->glyphs[params->SDNUMINSYMS + NSYMSDECODED] = jbig2_image_clone(ctx, SDNEWSYMS->glyphs[NSYMSDECODED]);
+-- 
+2.10.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9611.patch b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9611.patch
new file mode 100644
index 0000000..58ef04d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9611.patch
@@ -0,0 +1,34 @@
+From c7c55972758a93350882c32147801a3485b010fe Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Mon, 12 Jun 2017 13:08:40 +0100
+Subject: [PATCH] Bug 698024: bounds check zone pointer in Ins_MIRP()
+
+---
+ base/ttinterp.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- end of original header
+
+CVE: CVE-2017-9611
+
+Upstream-Status: Backport [git://git.ghostscript.com/ghostpdl.git]
+
+Signed-off-by: Joe Slater <joe.slater@windriver.com>
+
+diff --git a/base/ttinterp.c b/base/ttinterp.c
+index e56aec6..f6a6d95 100644
+--- a/base/ttinterp.c
++++ b/base/ttinterp.c
+@@ -3858,7 +3858,8 @@ static int nInstrCount=0;
+     /* XXX: UNDOCUMENTED! cvt[-1] = 0 always */
+ 
+     if ( BOUNDS( args[0],   CUR.zp1.n_points ) ||
+-         BOUNDS( args[1]+1, CUR.cvtSize+1 )    )
++         BOUNDS( args[1]+1, CUR.cvtSize+1 )    ||
++         BOUNDS(CUR.GS.rp0,  CUR.zp0.n_points) )
+     {
+       CUR.error = TT_Err_Invalid_Reference;
+       return;
+-- 
+1.7.9.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9612.patch b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9612.patch
new file mode 100644
index 0000000..b737cc5
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9612.patch
@@ -0,0 +1,35 @@
+From 98f6da60b9d463c617e631fc254cf6d66f2e8e3c Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Mon, 12 Jun 2017 13:15:17 +0100
+Subject: [PATCH] Bug 698026: bounds check zone pointers in Ins_IP()
+
+---
+ base/ttinterp.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- end of original header
+
+CVE: CVE-2017-9612
+
+Upstream-Status: Backport [git://git.ghostscript.com/ghostpdl.git]
+
+Signed-off-by: Joe Slater <joe.slater@windriver.com>
+
+diff --git a/base/ttinterp.c b/base/ttinterp.c
+index f6a6d95..e7c9d68 100644
+--- a/base/ttinterp.c
++++ b/base/ttinterp.c
+@@ -4129,7 +4129,9 @@ static int nInstrCount=0;
+     Int         point;
+     (void)args;
+ 
+-    if ( CUR.top < CUR.GS.loop )
++    if ( CUR.top < CUR.GS.loop ||
++         BOUNDS(CUR.GS.rp1, CUR.zp0.n_points) ||
++         BOUNDS(CUR.GS.rp2, CUR.zp1.n_points))
+     {
+       CUR.error = TT_Err_Invalid_Reference;
+       return;
+-- 
+1.7.9.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9726.patch b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9726.patch
new file mode 100644
index 0000000..3e6c656
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9726.patch
@@ -0,0 +1,33 @@
+From 7755e67116e8973ee0e3b22d653df026a84fa01b Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Thu, 15 Jun 2017 08:58:31 +0100
+Subject: [PATCH] Bug 698055: bounds check zone pointer in Ins_MDRP
+
+---
+ base/ttinterp.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- end of original header
+
+CVE: CVE-2017-9726
+
+Upstream-Status: Backport [git://git.ghostscript.com/ghostpdl.git]
+
+Signed-off-by: Joe Slater <joe.slater@windriver.com>
+diff --git a/base/ttinterp.c b/base/ttinterp.c
+index e7c9d68..af457e8 100644
+--- a/base/ttinterp.c
++++ b/base/ttinterp.c
+@@ -3770,7 +3770,8 @@ static int nInstrCount=0;
+ 
+     point = (Int)args[0];
+ 
+-    if ( BOUNDS( args[0], CUR.zp1.n_points ) )
++    if ( BOUNDS( args[0], CUR.zp1.n_points ) ||
++         BOUNDS( CUR.GS.rp0, CUR.zp0.n_points) )
+     {
+         /* Current version of FreeType silently ignores this out of bounds error
+          * and drops the instruction, see bug #691121
+-- 
+1.7.9.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9727.patch b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9727.patch
new file mode 100644
index 0000000..a2f7bfa
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9727.patch
@@ -0,0 +1,35 @@
+From 937ccd17ac65935633b2ebc06cb7089b91e17e6b Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Thu, 15 Jun 2017 09:05:20 +0100
+Subject: [PATCH] Bug 698056: make bounds check in gx_ttfReader__Read more
+ robust
+
+---
+ base/gxttfb.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- end of original header
+
+CVE: CVE-2017-9727
+
+Upstream-Status: Backport [git://git.ghostscript.com/ghostpdl.git]
+
+Signed-off-by: Joe Slater <joe.slater@windriver.com>
+
+diff --git a/base/gxttfb.c b/base/gxttfb.c
+index 0e9a444..e1561af 100644
+--- a/base/gxttfb.c
++++ b/base/gxttfb.c
+@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
+     if (!r->error) {
+         if (r->extra_glyph_index != -1) {
+             q = r->glyph_data.bits.data + r->pos;
+-            r->error = (r->glyph_data.bits.size - r->pos < n ?
++            r->error = ((r->pos >= r->glyph_data.bits.size ||
++                        r->glyph_data.bits.size - r->pos < n) ?
+                             gs_note_error(gs_error_invalidfont) : 0);
+             if (r->error == 0)
+                 memcpy(p, q, n);
+-- 
+1.7.9.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9739.patch b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9739.patch
new file mode 100644
index 0000000..69a94df
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9739.patch
@@ -0,0 +1,37 @@
+From c501a58f8d5650c8ba21d447c0d6f07eafcb0f15 Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Fri, 16 Jun 2017 08:29:25 +0100
+Subject: [PATCH] Bug 698063: Bounds check Ins_JMPR
+
+---
+ base/ttinterp.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- end of original header
+
+CVE: CVE-2017-9739
+
+Upstream-Status: Backport [git://git.ghostscript.com/ghostpdl.git]
+
+Signed-off-by: Joe Slater <joe.slater@windriver.com>
+
+diff --git a/base/ttinterp.c b/base/ttinterp.c
+index af457e8..adf3f0c 100644
+--- a/base/ttinterp.c
++++ b/base/ttinterp.c
+@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
+ 
+   static void  Ins_JMPR( INS_ARG )
+   {
++    if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
++    {
++      CUR.error = TT_Err_Invalid_Reference;
++      return;
++    }
++
+     CUR.IP      += (Int)(args[0]);
+     CUR.step_ins = FALSE;
+ 
+-- 
+1.7.9.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9835.patch b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9835.patch
new file mode 100644
index 0000000..7c65690
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-9835.patch
@@ -0,0 +1,125 @@
+From cfde94be1d4286bc47633c6e6eaf4e659bd78066 Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Wed, 7 Jun 2017 14:55:12 +0100
+Subject: [PATCH] Bug 697985: bounds check the array allocations methods
+
+The clump allocator has four allocation functions that use 'number of elements'
+and 'size of elements' parameters (rather than a simple 'number of bytes').
+
+Those need specific bounds checking.
+---
+ base/gsalloc.c |   42 ++++++++++++++++++++++++++++--------------
+ 1 file changed, 28 insertions(+), 14 deletions(-)
+
+--- end of original header
+
+CVE: CVE-2017-9835
+
+Upstream-Status: Backport [git://git.ghostscript.com/ghostpdl.git]
+
+Signed-off-by: Joe Slater <joe.slater@windriver.com>
+
+diff --git a/base/gsalloc.c b/base/gsalloc.c
+index 741ba00..10c04dd 100644
+--- a/base/gsalloc.c
++++ b/base/gsalloc.c
+@@ -1248,19 +1248,32 @@ i_alloc_struct_immovable(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
+     alloc_trace("|+<.", imem, cname, pstype, size, obj);
+     return obj;
+ }
++
++static inline bool
++alloc_array_check_size(ulong num_elements, ulong elt_size, ulong *lsize)
++{
++    int64_t s = (int64_t)num_elements * elt_size;
++    if (s > max_uint) {
++        return false;
++    }
++    *lsize = (ulong)s;
++    return true;
++}
++
+ static byte *
+ i_alloc_byte_array(gs_memory_t * mem, uint num_elements, uint elt_size,
+                    client_name_t cname)
+ {
+     gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
+     obj_header_t *obj;
+-
++    ulong lsize;
+ #ifdef MEMENTO
+     if (Memento_failThisEvent())
+         return NULL;
+ #endif
+-
+-    obj = alloc_obj(imem, (ulong) num_elements * elt_size,
++    if (alloc_array_check_size(num_elements, elt_size, &lsize) == false)
++        return NULL;
++    obj = alloc_obj(imem, lsize,
+                     &st_bytes, ALLOC_DIRECT, cname);
+ 
+     if_debug6m('A', mem, "[a%d:+b.]%s -bytes-*(%lu=%u*%u) = 0x%lx\n",
+@@ -1275,13 +1288,14 @@ i_alloc_byte_array_immovable(gs_memory_t * mem, uint num_elements,
+ {
+     gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
+     obj_header_t *obj;
+-
++    ulong lsize;
+ #ifdef MEMENTO
+     if (Memento_failThisEvent())
+         return NULL;
+ #endif
+-
+-    obj = alloc_obj(imem, (ulong) num_elements * elt_size,
++    if (alloc_array_check_size(num_elements, elt_size, &lsize) == false)
++        return NULL;
++    obj = alloc_obj(imem, lsize,
+                     &st_bytes, ALLOC_IMMOVABLE | ALLOC_DIRECT,
+                     cname);
+ 
+@@ -1297,7 +1311,7 @@ i_alloc_struct_array(gs_memory_t * mem, uint num_elements,
+ {
+     gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
+     obj_header_t *obj;
+-
++    ulong lsize;
+ #ifdef MEMENTO
+     if (Memento_failThisEvent())
+         return NULL;
+@@ -1311,9 +1325,9 @@ i_alloc_struct_array(gs_memory_t * mem, uint num_elements,
+         return NULL;		/* fail */
+     }
+ #endif
+-    obj = alloc_obj(imem,
+-                    (ulong) num_elements * pstype->ssize,
+-                    pstype, ALLOC_DIRECT, cname);
++    if (alloc_array_check_size(num_elements, pstype->ssize, &lsize) == false)
++        return NULL;
++    obj = alloc_obj(imem, lsize, pstype, ALLOC_DIRECT, cname);
+     if_debug7m('A', mem, "[a%d:+<.]%s %s*(%lu=%u*%u) = 0x%lx\n",
+                alloc_trace_space(imem), client_name_string(cname),
+                struct_type_name_string(pstype),
+@@ -1327,16 +1341,16 @@ i_alloc_struct_array_immovable(gs_memory_t * mem, uint num_elements,
+ {
+     gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
+     obj_header_t *obj;
+-
++    ulong lsize;
+ #ifdef MEMENTO
+     if (Memento_failThisEvent())
+         return NULL;
+ #endif
+ 
+     ALLOC_CHECK_SIZE(mem,pstype);
+-    obj = alloc_obj(imem,
+-                    (ulong) num_elements * pstype->ssize,
+-                    pstype, ALLOC_IMMOVABLE | ALLOC_DIRECT, cname);
++    if (alloc_array_check_size(num_elements, pstype->ssize, &lsize) == false)
++        return NULL;
++    obj = alloc_obj(imem, lsize, pstype, ALLOC_IMMOVABLE | ALLOC_DIRECT, cname);
+     if_debug7m('A', mem, "[a%d|+<.]%s %s*(%lu=%u*%u) = 0x%lx\n",
+                alloc_trace_space(imem), client_name_string(cname),
+                struct_type_name_string(pstype),
+-- 
+1.7.9.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/ghostscript-9.15-parallel-make.patch b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/ghostscript-9.15-parallel-make.patch
index 797b894..8fa2c40 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/ghostscript-9.15-parallel-make.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/ghostscript-9.15-parallel-make.patch
@@ -1,40 +1,39 @@
-From be1e1b33191afdcfe3c2ecc4ff3e361a5859e9c6 Mon Sep 17 00:00:00 2001
-From: Robert Yang <liezhi.yang@windriver.com>
-Date: Fri, 30 Jan 2015 00:40:22 -0800
-Subject: [PATCH] contrib.mak: fix for parallel build
+From 14937d9247330065359ca0fb648c28dfa5c3b224 Mon Sep 17 00:00:00 2001
+From: Huang Qiyu <huangqy.fnst@cn.fujitsu.com>
+Date: Tue, 13 Dec 2016 18:16:41 +0900
+Subject: [PATCH] ghostscript-9.15-parallel-make
 
-Fixed:
-rm: cannot remove `/usr/share/ghostscript/9.15/lib': Is a directory
+From 767bdf8a412b0cce2b734998e9b7e55abeaf932c Mon Sep 17 00:00:00 2001
+From: Huang Qiyu <huangqy.fnst@cn.fujitsu.com>
+Date: Tue, 13 Dec 2016 17:55:54 +0900
+Subject: [PATCH] Robert Yang <liezhi.yang@windriver.com> Date: Fri, 30 Jan
+2015 00:40:22 -0800  Subject: [PATCH] contrib.mak: fix for parallel build
 
-Create lib before install to fix the race issue.
-
-Upstream-Status: Pending
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+Signed-off-by: Huang Qiyu <huangqy.fnst@cn.fujitsu.com>
 ---
- contrib/contrib.mak |    2 ++
+ contrib/contrib.mak | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/contrib/contrib.mak b/contrib/contrib.mak
-index 08a80d1..de2e20d 100644
+index 55415b3..0b6b5ae 100644
 --- a/contrib/contrib.mak
 +++ b/contrib/contrib.mak
-@@ -947,6 +947,7 @@ $(DEVOBJ)dviprlib.$(OBJ) : $(JAPSRC)dviprlib.c $(JAPSRC)dviprlib.h
+@@ -1099,6 +1099,7 @@ $(DEVOBJ)dviprlib.$(OBJ) : $(JAPSRC)dviprlib.c $(JAPSRC)dviprlib.h \
  	$(DEVCC) $(O_)$@ $(C_) $(JAPSRC)dviprlib.c
  
- extra-dmprt-install:
+ extra-dmprt-install: install-libdata
 +	mkdir -p $(DESTDIR)$(gsdatadir)$(D)lib
  	$(INSTALL_DATA) $(JAPSRC)dmp_init.ps $(DESTDIR)$(gsdatadir)$(D)lib || exit 1
  	$(INSTALL_DATA) $(JAPSRC)dmp_site.ps $(DESTDIR)$(gsdatadir)$(D)lib || exit 1
  	$(INSTALL_DATA) $(JAPSRC)escp_24.src $(DESTDIR)$(gsdatadir)$(D)lib || exit 1
-@@ -1088,6 +1089,7 @@ $(DEVOBJ)gdevalps.$(OBJ) : $(JAPSRC)gdevalps.c $(PDEVH)
+@@ -1267,6 +1268,7 @@ $(DEVOBJ)gdevalps.$(OBJ) : $(JAPSRC)gdevalps.c $(PDEVH) \
  ### ----------------- Additional .upp files ---------------- ###
  
- extra-upp-install:
+ extra-upp-install: install-libdata
 +	mkdir -p $(DESTDIR)$(gsdatadir)$(D)lib
  	for f in $(CONTRIBSRC)uniprint$(D)*.upp; do \
  	    $(INSTALL_DATA) $$f $(DESTDIR)$(gsdatadir)$(D)lib || exit 1; \
  	done
 -- 
-1.7.9.5
+2.7.4
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips64eln32/objarch.h b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips64eln32/objarch.h
deleted file mode 100644
index a05de29..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips64eln32/objarch.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Parameters derived from machine and compiler architecture. */
-/* This file is generated mechanically by genarch.c. */
-
-	 /* ---------------- Scalar alignments ---------------- */
-
-#define ARCH_ALIGN_SHORT_MOD 2
-#define ARCH_ALIGN_INT_MOD 4
-#define ARCH_ALIGN_LONG_MOD 8
-#define ARCH_ALIGN_PTR_MOD 8
-#define ARCH_ALIGN_FLOAT_MOD 4
-#define ARCH_ALIGN_DOUBLE_MOD 8
-
-	 /* ---------------- Scalar sizes ---------------- */
-
-#define ARCH_LOG2_SIZEOF_CHAR 0
-#define ARCH_LOG2_SIZEOF_SHORT 1
-#define ARCH_LOG2_SIZEOF_INT 2
-#define ARCH_LOG2_SIZEOF_LONG 3
-#define ARCH_LOG2_SIZEOF_LONG_LONG 3
-#define ARCH_SIZEOF_GX_COLOR_INDEX 8
-#define ARCH_SIZEOF_PTR 8
-#define ARCH_SIZEOF_FLOAT 4
-#define ARCH_SIZEOF_DOUBLE 8
-#define ARCH_FLOAT_MANTISSA_BITS 24
-#define ARCH_DOUBLE_MANTISSA_BITS 53
-
-	 /* ---------------- Unsigned max values ---------------- */
-
-#define ARCH_MAX_UCHAR ((unsigned char)0xff + (unsigned char)0)
-#define ARCH_MAX_USHORT ((unsigned short)0xffff + (unsigned short)0)
-#define ARCH_MAX_UINT ((unsigned int)~0 + (unsigned int)0)
-#define ARCH_MAX_ULONG ((unsigned long)~0L + (unsigned long)0)
-
-	 /* ---------------- Miscellaneous ---------------- */
-
-#define ARCH_IS_BIG_ENDIAN 0
-#define ARCH_PTRS_ARE_SIGNED 0
-#define ARCH_FLOATS_ARE_IEEE 1
-#define ARCH_ARITH_RSHIFT 2
-#define ARCH_DIV_NEG_POS_TRUNCATES 1
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips64n32/objarch.h b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips64n32/objarch.h
deleted file mode 100644
index 0d0a16b..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips64n32/objarch.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Parameters derived from machine and compiler architecture. */
-/* This file is generated mechanically by genarch.c. */
-
-	 /* ---------------- Scalar alignments ---------------- */
-
-#define ARCH_ALIGN_SHORT_MOD 2
-#define ARCH_ALIGN_INT_MOD 4
-#define ARCH_ALIGN_LONG_MOD 8
-#define ARCH_ALIGN_PTR_MOD 8
-#define ARCH_ALIGN_FLOAT_MOD 4
-#define ARCH_ALIGN_DOUBLE_MOD 8
-
-	 /* ---------------- Scalar sizes ---------------- */
-
-#define ARCH_LOG2_SIZEOF_CHAR 0
-#define ARCH_LOG2_SIZEOF_SHORT 1
-#define ARCH_LOG2_SIZEOF_INT 2
-#define ARCH_LOG2_SIZEOF_LONG 3
-#define ARCH_LOG2_SIZEOF_LONG_LONG 3
-#define ARCH_SIZEOF_GX_COLOR_INDEX 8
-#define ARCH_SIZEOF_PTR 8
-#define ARCH_SIZEOF_FLOAT 4
-#define ARCH_SIZEOF_DOUBLE 8
-#define ARCH_FLOAT_MANTISSA_BITS 24
-#define ARCH_DOUBLE_MANTISSA_BITS 53
-
-	 /* ---------------- Unsigned max values ---------------- */
-
-#define ARCH_MAX_UCHAR ((unsigned char)0xff + (unsigned char)0)
-#define ARCH_MAX_USHORT ((unsigned short)0xffff + (unsigned short)0)
-#define ARCH_MAX_UINT ((unsigned int)~0 + (unsigned int)0)
-#define ARCH_MAX_ULONG ((unsigned long)~0L + (unsigned long)0)
-
-	 /* ---------------- Miscellaneous ---------------- */
-
-#define ARCH_IS_BIG_ENDIAN 1
-#define ARCH_PTRS_ARE_SIGNED 0
-#define ARCH_FLOATS_ARE_IEEE 1
-#define ARCH_ARITH_RSHIFT 2
-#define ARCH_DIV_NEG_POS_TRUNCATES 1
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips64/objarch.h b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mipsarchn32eb/objarch.h
similarity index 100%
rename from import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips64/objarch.h
rename to import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mipsarchn32eb/objarch.h
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips64el/objarch.h b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mipsarchn32el/objarch.h
similarity index 100%
copy from import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips64el/objarch.h
copy to import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mipsarchn32el/objarch.h
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips64/objarch.h b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mipsarchn64eb/objarch.h
similarity index 100%
copy from import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips64/objarch.h
copy to import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mipsarchn64eb/objarch.h
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips64el/objarch.h b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mipsarchn64el/objarch.h
similarity index 100%
rename from import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips64el/objarch.h
rename to import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mipsarchn64el/objarch.h
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips/objarch.h b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mipsarcho32eb/objarch.h
similarity index 100%
rename from import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mips/objarch.h
rename to import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mipsarcho32eb/objarch.h
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mipsel/objarch.h b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mipsarcho32el/objarch.h
similarity index 100%
rename from import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mipsel/objarch.h
rename to import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript/mipsarcho32el/objarch.h
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript_9.19.bb b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript_9.20.bb
similarity index 79%
rename from import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript_9.19.bb
rename to import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript_9.20.bb
index ab58157..e1d9700 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript_9.19.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/ghostscript/ghostscript_9.20.bb
@@ -11,14 +11,15 @@
 SECTION = "console/utils"
 
 LICENSE = "GPLv3"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=b17cea54743435ab2a581c237bea294a"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=70dc2bac4d0ce4448da873cd86b123fc"
 
 DEPENDS = "ghostscript-native tiff jpeg fontconfig cups libpng"
 DEPENDS_class-native = "libpng-native"
 
 UPSTREAM_CHECK_URI = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases"
+UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.tar"
 
-SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs919/${BPN}-${PV}.tar.gz \
+SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs920/${BPN}-${PV}.tar.gz \
                 file://ghostscript-9.15-parallel-make.patch \
                 file://ghostscript-9.16-Werror-return-type.patch \
                 file://png_mak.patch \
@@ -34,6 +35,19 @@
            file://CVE-2016-10219.patch \
            file://CVE-2016-10220.patch \
            file://CVE-2017-5951.patch \
+           file://CVE-2016-8602.patch \
+           file://CVE-2017-7975.patch \
+           file://CVE-2016-7977.patch \
+           file://CVE-2016-7978.patch \
+           file://CVE-2016-7979.patch \
+           file://CVE-2017-9216.patch \
+           file://CVE-2017-9611.patch \
+           file://CVE-2017-9612.patch \
+           file://CVE-2017-9739.patch \
+           file://CVE-2017-9726.patch \
+           file://CVE-2017-9727.patch \
+           file://CVE-2017-9835.patch \
+           file://CVE-2017-11714.patch \
            "
 
 SRC_URI_class-native = "${SRC_URI_BASE} \
@@ -41,8 +55,8 @@
                         file://base-genht.c-add-a-preprocessor-define-to-allow-fope.patch \
                         "
 
-SRC_URI[md5sum] = "c9682ce6b852f9197c69905a43928907"
-SRC_URI[sha256sum] = "cf3c0dce67db1557a87366969945f9c5235887989c0b585e037af366dc035989"
+SRC_URI[md5sum] = "93c5987cd3ab341108be1ebbaadc24fe"
+SRC_URI[sha256sum] = "949b64b46ecf8906db54a94ecf83ab97534ebf946f770d3c3f283cb469cb6e14"
 
 EXTRA_OECONF = "--without-x --with-system-libtiff --without-jbig2dec \
                 --with-fontpath=${datadir}/fonts \
@@ -50,8 +64,7 @@
                 --with-cups-datadir=${datadir}/cups \
                 "
 
-EXTRA_OECONF_append_mips = " --with-large_color_index=0"
-EXTRA_OECONF_append_mipsel = " --with-large_color_index=0"
+EXTRA_OECONF_append_mipsarcho32 = " --with-large_color_index=0"
 
 # Explicity disable libtiff, fontconfig,
 # freetype, cups for ghostscript-native
diff --git a/import-layers/yocto-poky/meta/recipes-extended/go-examples/files/helloworld.go b/import-layers/yocto-poky/meta/recipes-extended/go-examples/files/helloworld.go
new file mode 100644
index 0000000..0253c40
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/go-examples/files/helloworld.go
@@ -0,0 +1,10 @@
+// You can edit this code!
+// Click here and start typing.
+// taken from https://golang.org/
+package main
+
+import "fmt"
+
+func main() {
+	fmt.Println("Hello, 世界")
+}
diff --git a/import-layers/yocto-poky/meta/recipes-extended/go-examples/go-examples.inc b/import-layers/yocto-poky/meta/recipes-extended/go-examples/go-examples.inc
new file mode 100644
index 0000000..c63268116
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/go-examples/go-examples.inc
@@ -0,0 +1,10 @@
+DESCRIPTION = "This is a simple example recipe that cross-compiles a Go program."
+SECTION = "examples"
+HOMEPAGE = "https://golang.org/"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+S = "${WORKDIR}"
+
+inherit go
diff --git a/import-layers/yocto-poky/meta/recipes-extended/go-examples/go-helloworld_0.1.bb b/import-layers/yocto-poky/meta/recipes-extended/go-examples/go-helloworld_0.1.bb
new file mode 100644
index 0000000..930c57d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/go-examples/go-helloworld_0.1.bb
@@ -0,0 +1,13 @@
+require go-examples.inc
+
+SRC_URI += " \
+  file://helloworld.go \
+"
+
+do_compile() {
+	go build helloworld.go
+}
+
+do_install() {
+	install -D -m 0755 ${S}/helloworld ${D}${bindir}/helloworld
+}
diff --git a/import-layers/yocto-poky/meta/recipes-extended/gperf/gperf_3.0.3.bb b/import-layers/yocto-poky/meta/recipes-extended/gperf/gperf_3.0.3.bb
deleted file mode 100644
index 7728861..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/gperf/gperf_3.0.3.bb
+++ /dev/null
@@ -1,10 +0,0 @@
-require gperf.inc
-
-LICENSE  = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=a5f84abb0070adf8a0925d7d534b6e0a \
-                    file://src/main.cc;beginline=8;endline=19;md5=72a3034a19e72f08ee48ef8244a121fd"
-
-PR = "r1"
-
-SRC_URI[md5sum] = "cc20e58975a38075440423c8fb85fd00"
-SRC_URI[sha256sum] = "63287527c8d9e27e801cf0804436f3494bd569db05d49dcdd2a942ae72fa9055"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/Makevars b/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/Makevars
deleted file mode 100644
index 8b09f53..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/Makevars
+++ /dev/null
@@ -1,25 +0,0 @@
-# Makefile variables for PO directory in any package using GNU gettext.
-
-# Usually the message domain is the same as the package name.
-DOMAIN = $(PACKAGE)
-
-# These two variables depend on the location of this directory.
-subdir = po
-top_builddir = ..
-
-# These options get passed to xgettext.
-XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
-
-# This is the copyright holder that gets inserted into the header of the
-# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
-# package.  (Note that the msgstr strings, extracted from the package's
-# sources, belong to the copyright holder of the package.)  Translators are
-# expected to transfer the copyright for their translations to this person
-# or entity, or to disclaim their copyright.  The empty string stands for
-# the public domain; in this case the translators are expected to disclaim
-# their copyright.
-COPYRIGHT_HOLDER = Free Software Foundation, Inc.
-
-# This is the list of locale categories, beyond LC_MESSAGES, for which the
-# message catalogs shall be used.  It is usually empty.
-EXTRA_LOCALE_CATEGORIES =
diff --git a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/fix-for-texinfo-5.1.patch b/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/fix-for-texinfo-5.1.patch
deleted file mode 100644
index ce59509..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/fix-for-texinfo-5.1.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Upstream-Status: Inappropriate [Poky Specific this is gplv2 version]
-
-Signed-off-by: Saul Wold <sgw@linux.intel.com>
-
-Index: grep-2.5.1a/doc/grep.texi
-===================================================================
---- grep-2.5.1a.orig/doc/grep.texi
-+++ grep-2.5.1a/doc/grep.texi
-@@ -288,7 +288,7 @@ This version number should be included i
- Print a usage message briefly summarizing these command-line options
- and the bug-reporting address, then exit.
- 
--@itemx --binary-files=@var{type}
-+@item --binary-files=@var{type}
- @opindex --binary-files
- @cindex binary files
- If the first few bytes of a file indicate that the file contains binary
diff --git a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/fix64-int-to-pointer.patch b/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/fix64-int-to-pointer.patch
deleted file mode 100644
index 3b91520..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/fix64-int-to-pointer.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Always use locale.h as HAVE_LOCALE_H is no longer handled by ./configure
-Upstream-Status: Inappropriate [ old version that will not be maintained ]
-Signed-off-by: Alex DAMIAN <alexandru.damian@intel.com>
-
-diff --recursive --unified grep-2.5.1a-orig/lib/hard-locale.c grep-2.5.1a/lib/hard-locale.c
---- grep-2.5.1a-orig/lib/hard-locale.c	2001-03-04 07:33:12.000000000 +0200
-+++ grep-2.5.1a/lib/hard-locale.c	2013-03-11 17:05:52.086444891 +0200
-@@ -38,9 +38,7 @@
- # endif
- #endif
- 
--#if HAVE_LOCALE_H
- # include <locale.h>
--#endif
- 
- #if HAVE_STRING_H
- # include <string.h>
diff --git a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/gettext.patch b/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/gettext.patch
deleted file mode 100644
index 5746335..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/gettext.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Enable operation with later versions of gettext.
-
-Upstream-Status: Inappropriate
-RP 2012/10/19
-
-Index: grep-2.5.1a/configure.in
-===================================================================
---- grep-2.5.1a.orig/configure.in	2012-10-19 12:57:51.646970204 +0000
-+++ grep-2.5.1a/configure.in	2012-10-19 12:59:49.946968803 +0000
-@@ -140,4 +140,4 @@
- 	AC_CHECK_LIB(pcre, pcre_exec)
- fi
- 
--AC_OUTPUT(Makefile lib/Makefile lib/posix/Makefile src/Makefile tests/Makefile po/Makefile.in intl/Makefile doc/Makefile m4/Makefile vms/Makefile bootstrap/Makefile, [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile; echo timestamp > stamp-h])
-+AC_OUTPUT(Makefile lib/Makefile lib/posix/Makefile src/Makefile tests/Makefile po/Makefile.in intl/Makefile doc/Makefile m4/Makefile vms/Makefile bootstrap/Makefile, [echo timestamp > stamp-h])
diff --git a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/grep-CVE-2012-5667.patch b/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/grep-CVE-2012-5667.patch
deleted file mode 100644
index a40a9f3..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/grep-CVE-2012-5667.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-The patch to fix CVE-2012-5667
-Reference: https://bugzilla.redhat.com/attachment.cgi?id=686605&action=diff
-
-Multiple integer overflows in GNU Grep before 2.11 might allow
-context-dependent attackers to execute arbitrary code via vectors
-involving a long input line that triggers a heap-based buffer overflow.
-
-http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-5667
-
-Upstream-Status: Inappropriate [other]
-This version of GNU Grep has been abandoned upstream and they are no longer
-accepting patches.  This is not a backport.
-CVE: CVE-2012-5667
-
-Signed-off-by: Ming Liu <ming.liu@windriver.com>
----
- grep.c |    7 +++----
- 1 file changed, 3 insertions(+), 4 deletions(-)
-
---- a/src/grep.c	2013-05-15 13:39:33.359191769 +0800
-+++ a/src/grep.c	2013-05-15 13:50:22.609191882 +0800
-@@ -306,6 +306,11 @@ fillbuf (size_t save, struct stats const
-   int cc = 1;
-   char *readbuf;
-   size_t readsize;
-+  const size_t max_save = INT_MAX / 2;
-+
-+  /* Limit the amount of saved data to INT_MAX to fix CVE-2012-5667 */
-+  if (save > max_save)
-+     error (2, 0, _("line too long"));
- 
-   /* Offset from start of buffer to start of old stuff
-      that we want to save.  */
diff --git a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/grep-egrep-fgrep-Fix-LSB-NG-cases.patch b/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/grep-egrep-fgrep-Fix-LSB-NG-cases.patch
deleted file mode 100644
index 327ee56..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/grep-egrep-fgrep-Fix-LSB-NG-cases.patch
+++ /dev/null
@@ -1,1342 +0,0 @@
-From c884dd12ec062569335702848fc5f29f436c28fa Mon Sep 17 00:00:00 2001
-From: Li xin <lixin.fnst@cn.fujitsu.com>
-Date: Mon, 25 May 2015 10:15:57 +0900
-Subject: [PATCH] grep egrep fgrep: Fix LSB NG cases.
-
-The LSB core test requires grep egrep and fgrep can
-perform pattern matching in searches without regard
-to case if -i option is specified.
-
-Upstream-Status: backport.
-
-Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
----
- lib/posix/regex.h |   4 +
- src/dfa.c         |  22 +-
- src/grep.c        |  96 ++++---
- src/search.c      | 833 +++++++++++++++++++++++++++++++++++++++++++++---------
- 4 files changed, 768 insertions(+), 187 deletions(-)
-
-diff --git a/lib/posix/regex.h b/lib/posix/regex.h
-index 63c2fef..7bb2b0e 100644
---- a/lib/posix/regex.h
-+++ b/lib/posix/regex.h
-@@ -109,6 +109,10 @@ typedef unsigned long int reg_syntax_t;
-    If not set, \{, \}, {, and } are literals.  */
- #define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
- 
-+/* If this bit is set, then ignore case when matching.
-+   If not set, then case is significant.  */
-+#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
-+
- /* If this bit is set, +, ? and | aren't recognized as operators.
-    If not set, they are.  */
- #define RE_LIMITED_OPS (RE_INTERVALS << 1)
-diff --git a/src/dfa.c b/src/dfa.c
-index 590bfa7..27c876a 100644
---- a/src/dfa.c
-+++ b/src/dfa.c
-@@ -414,7 +414,7 @@ update_mb_len_index (unsigned char const *p, int len)
- 
- /* This function fetch a wide character, and update cur_mb_len,
-    used only if the current locale is a multibyte environment.  */
--static wchar_t
-+static wint_t
- fetch_wc (char const *eoferr)
- {
-   wchar_t wc;
-@@ -423,7 +423,7 @@ fetch_wc (char const *eoferr)
-       if (eoferr != 0)
- 	dfaerror (eoferr);
-       else
--	return -1;
-+	return WEOF;
-     }
- 
-   cur_mb_len = mbrtowc(&wc, lexptr, lexleft, &mbs);
-@@ -459,7 +459,7 @@ fetch_wc (char const *eoferr)
- static void
- parse_bracket_exp_mb ()
- {
--  wchar_t wc, wc1, wc2;
-+  wint_t wc, wc1, wc2;
- 
-   /* Work area to build a mb_char_classes.  */
-   struct mb_char_classes *work_mbc;
-@@ -496,7 +496,7 @@ parse_bracket_exp_mb ()
-     work_mbc->invert = 0;
-   do
-     {
--      wc1 = -1; /* mark wc1 is not initialized".  */
-+      wc1 = WEOF; /* mark wc1 is not initialized".  */
- 
-       /* Note that if we're looking at some other [:...:] construct,
- 	 we just treat it as a bunch of ordinary characters.  We can do
-@@ -586,7 +586,7 @@ parse_bracket_exp_mb ()
- 		      work_mbc->coll_elems[work_mbc->ncoll_elems++] = elem;
- 		    }
-  		}
--	      wc = -1;
-+	      wc1 = wc = WEOF;
- 	    }
- 	  else
- 	    /* We treat '[' as a normal character here.  */
-@@ -600,7 +600,7 @@ parse_bracket_exp_mb ()
- 	    wc = fetch_wc(("Unbalanced ["));
- 	}
- 
--      if (wc1 == -1)
-+      if (wc1 == WEOF)
- 	wc1 = fetch_wc(_("Unbalanced ["));
- 
-       if (wc1 == L'-')
-@@ -630,17 +630,17 @@ parse_bracket_exp_mb ()
- 	    }
- 	  REALLOC_IF_NECESSARY(work_mbc->range_sts, wchar_t,
- 			       range_sts_al, work_mbc->nranges + 1);
--	  work_mbc->range_sts[work_mbc->nranges] = wc;
-+	  work_mbc->range_sts[work_mbc->nranges] = (wchar_t)wc;
- 	  REALLOC_IF_NECESSARY(work_mbc->range_ends, wchar_t,
- 			       range_ends_al, work_mbc->nranges + 1);
--	  work_mbc->range_ends[work_mbc->nranges++] = wc2;
-+	  work_mbc->range_ends[work_mbc->nranges++] = (wchar_t)wc2;
- 	}
--      else if (wc != -1)
-+      else if (wc != WEOF)
- 	/* build normal characters.  */
- 	{
- 	  REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al,
- 			       work_mbc->nchars + 1);
--	  work_mbc->chars[work_mbc->nchars++] = wc;
-+	  work_mbc->chars[work_mbc->nchars++] = (wchar_t)wc;
- 	}
-     }
-   while ((wc = wc1) != L']');
-@@ -2552,6 +2552,8 @@ match_mb_charset (struct dfa *d, int s, position pos, int index)
-     }
- 
-   /* match with a character?  */
-+  if (case_fold)
-+    wc = towlower (wc);
-   for (i = 0; i<work_mbc->nchars; i++)
-     {
-       if (wc == work_mbc->chars[i])
-diff --git a/src/grep.c b/src/grep.c
-index 2fb2fac..3fd4b47 100644
---- a/src/grep.c
-+++ b/src/grep.c
-@@ -30,6 +30,12 @@
- # include <sys/time.h>
- # include <sys/resource.h>
- #endif
-+#if defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_MBRTOWC
-+/* We can handle multibyte string.  */
-+# define MBS_SUPPORT
-+# include <wchar.h>
-+# include <wctype.h>
-+#endif
- #include <stdio.h>
- #include "system.h"
- #include "getopt.h"
-@@ -255,19 +261,6 @@ reset (int fd, char const *file, struct stats *stats)
-   bufbeg[-1] = eolbyte;
-   bufdesc = fd;
- 
--  if (fstat (fd, &stats->stat) != 0)
--    {
--      error (0, errno, "fstat");
--      return 0;
--    }
--  if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
--    return 0;
--#ifndef DJGPP
--  if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode)))
--#else
--  if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode)))
--#endif
--    return 0;
-   if (S_ISREG (stats->stat.st_mode))
-     {
-       if (file)
-@@ -558,33 +551,6 @@ prline (char const *beg, char const *lim, int sep)
-     {
-       size_t match_size;
-       size_t match_offset;
--      if(match_icase)
--        {
--	  /* Yuck, this is tricky */
--          char *buf = (char*) xmalloc (lim - beg);
--	  char *ibeg = buf;
--	  char *ilim = ibeg + (lim - beg);
--	  int i;
--	  for (i = 0; i < lim - beg; i++)
--	    ibeg[i] = tolower (beg[i]);
--	  while ((match_offset = (*execute) (ibeg, ilim-ibeg, &match_size, 1))
--		 != (size_t) -1)
--	    {
--	      char const *b = beg + match_offset;
--	      if (b == lim)
--		break;
--	      fwrite (beg, sizeof (char), match_offset, stdout);
--	      printf ("\33[%sm", grep_color);
--	      fwrite (b, sizeof (char), match_size, stdout);
--	      fputs ("\33[00m", stdout);
--	      beg = b + match_size;
--	      ibeg = ibeg + match_offset + match_size;
--	    }
--	  fwrite (beg, 1, lim - beg, stdout);
--	  free (buf);
--	  lastout = lim;
--	  return;
--	}
-       while (lim-beg && (match_offset = (*execute) (beg, lim - beg, &match_size, 1))
- 	     != (size_t) -1)
- 	{
-@@ -601,6 +567,7 @@ prline (char const *beg, char const *lim, int sep)
- 	  fputs ("\33[00m", stdout);
- 	  beg = b + match_size;
- 	}
-+      fputs ("\33[K", stdout);
-     }
-   fwrite (beg, 1, lim - beg, stdout);
-   if (ferror (stdout))
-@@ -623,7 +590,7 @@ prpending (char const *lim)
-       size_t match_size;
-       --pending;
-       if (outleft
--	  || (((*execute) (lastout, nl - lastout, &match_size, 0) == (size_t) -1)
-+	  || (((*execute) (lastout, nl + 1 - lastout, &match_size, 0) == (size_t) -1)
- 	      == !out_invert))
- 	prline (lastout, nl + 1, '-');
-       else
-@@ -895,6 +862,19 @@ grepfile (char const *file, struct stats *stats)
-     }
-   else
-     {
-+      if (stat (file, &stats->stat) != 0)
-+        {
-+          suppressible_error (file, errno);
-+          return 1;
-+        }
-+      if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
-+        return 1;
-+#ifndef DJGPP
-+      if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode) || S_ISFIFO(stats->stat.st_mode)))
-+#else
-+      if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode)))
-+#endif
-+        return 1;
-       while ((desc = open (file, O_RDONLY)) < 0 && errno == EINTR)
- 	continue;
- 
-@@ -1681,9 +1661,6 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"))
- 	  out_invert ^= 1;
- 	  match_lines = match_words = 0;
- 	}
--      else
--	/* Strip trailing newline. */
--        --keycc;
-     }
-   else
-     if (optind < argc)
-@@ -1697,6 +1674,37 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"))
-   if (!install_matcher (matcher) && !install_matcher ("default"))
-     abort ();
- 
-+#ifdef MBS_SUPPORT
-+  if (MB_CUR_MAX != 1 && match_icase)
-+    {
-+      wchar_t wc;
-+      mbstate_t cur_state, prev_state;
-+      int i, len = strlen(keys);
-+
-+      memset(&cur_state, 0, sizeof(mbstate_t));
-+      for (i = 0; i <= len ;)
-+	{
-+	  size_t mbclen;
-+	  mbclen = mbrtowc(&wc, keys + i, len - i, &cur_state);
-+	  if (mbclen == (size_t) -1 || mbclen == (size_t) -2 || mbclen == 0)
-+	    {
-+	      /* An invalid sequence, or a truncated multibyte character.
-+		 We treat it as a singlebyte character.  */
-+	      mbclen = 1;
-+	    }
-+	  else
-+	    {
-+	      if (iswupper((wint_t)wc))
-+		{
-+		  wc = towlower((wint_t)wc);
-+		  wcrtomb(keys + i, wc, &cur_state);
-+		}
-+	    }
-+	  i += mbclen;
-+	}
-+    }
-+#endif /* MBS_SUPPORT */
-+
-   (*compile)(keys, keycc);
- 
-   if ((argc - optind > 1 && !no_filenames) || with_filenames)
-diff --git a/src/search.c b/src/search.c
-index 7bd233f..3c6a485 100644
---- a/src/search.c
-+++ b/src/search.c
-@@ -18,9 +18,13 @@
- 
- /* Written August 1992 by Mike Haertel. */
- 
-+#ifndef _GNU_SOURCE
-+# define _GNU_SOURCE 1
-+#endif
- #ifdef HAVE_CONFIG_H
- # include <config.h>
- #endif
-+#include <assert.h>
- #include <sys/types.h>
- #if defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_MBRTOWC
- /* We can handle multibyte string.  */
-@@ -31,7 +35,7 @@
- 
- #include "system.h"
- #include "grep.h"
--#include "regex.h"
-+#include <regex.h>
- #include "dfa.h"
- #include "kwset.h"
- #include "error.h"
-@@ -39,6 +43,9 @@
- #ifdef HAVE_LIBPCRE
- # include <pcre.h>
- #endif
-+#ifdef HAVE_LANGINFO_CODESET
-+# include <langinfo.h>
-+#endif
- 
- #define NCHAR (UCHAR_MAX + 1)
- 
-@@ -70,9 +77,10 @@ static kwset_t kwset;
-    call the regexp matcher at all. */
- static int kwset_exact_matches;
- 
--#if defined(MBS_SUPPORT)
--static char* check_multibyte_string PARAMS ((char const *buf, size_t size));
--#endif
-+/* UTF-8 encoding allows some optimizations that we can't otherwise
-+   assume in a multibyte encoding. */
-+static int using_utf8;
-+
- static void kwsinit PARAMS ((void));
- static void kwsmusts PARAMS ((void));
- static void Gcompile PARAMS ((char const *, size_t));
-@@ -84,6 +92,15 @@ static void Pcompile PARAMS ((char const *, size_t ));
- static size_t Pexecute PARAMS ((char const *, size_t, size_t *, int));
- 
- void
-+check_utf8 (void)
-+{
-+#ifdef HAVE_LANGINFO_CODESET
-+  if (strcmp (nl_langinfo (CODESET), "UTF-8") == 0)
-+    using_utf8 = 1;
-+#endif
-+}
-+
-+void
- dfaerror (char const *mesg)
- {
-   error (2, 0, mesg);
-@@ -141,38 +158,6 @@ kwsmusts (void)
-     }
- }
- 
--#ifdef MBS_SUPPORT
--/* This function allocate the array which correspond to "buf".
--   Then this check multibyte string and mark on the positions which
--   are not singlebyte character nor the first byte of a multibyte
--   character.  Caller must free the array.  */
--static char*
--check_multibyte_string(char const *buf, size_t size)
--{
--  char *mb_properties = malloc(size);
--  mbstate_t cur_state;
--  int i;
--  memset(&cur_state, 0, sizeof(mbstate_t));
--  memset(mb_properties, 0, sizeof(char)*size);
--  for (i = 0; i < size ;)
--    {
--      size_t mbclen;
--      mbclen = mbrlen(buf + i, size - i, &cur_state);
--
--      if (mbclen == (size_t) -1 || mbclen == (size_t) -2 || mbclen == 0)
--	{
--	  /* An invalid sequence, or a truncated multibyte character.
--	     We treat it as a singlebyte character.  */
--	  mbclen = 1;
--	}
--      mb_properties[i] = mbclen;
--      i += mbclen;
--    }
--
--  return mb_properties;
--}
--#endif
--
- static void
- Gcompile (char const *pattern, size_t size)
- {
-@@ -181,7 +166,8 @@ Gcompile (char const *pattern, size_t size)
-   size_t total = size;
-   char const *motif = pattern;
- 
--  re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE);
-+  check_utf8 ();
-+  re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE | (match_icase ? RE_ICASE : 0));
-   dfasyntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE, match_icase, eolbyte);
- 
-   /* For GNU regex compiler we have to pass the patterns separately to detect
-@@ -218,6 +204,10 @@ Gcompile (char const *pattern, size_t size)
-       motif = sep;
-     } while (sep && total != 0);
- 
-+  /* Strip trailing newline. */
-+  if (size && pattern[size - 1] == '\n')
-+    size--;
-+
-   /* In the match_words and match_lines cases, we use a different pattern
-      for the DFA matcher that will quickly throw out cases that won't work.
-      Then if DFA succeeds we do some hairy stuff using the regex matcher
-@@ -233,7 +223,7 @@ Gcompile (char const *pattern, size_t size)
-       static char const line_end[] = "\\)$";
-       static char const word_beg[] = "\\(^\\|[^[:alnum:]_]\\)\\(";
-       static char const word_end[] = "\\)\\([^[:alnum:]_]\\|$\\)";
--      char *n = malloc (sizeof word_beg - 1 + size + sizeof word_end);
-+      char *n = xmalloc (sizeof word_beg - 1 + size + sizeof word_end);
-       size_t i;
-       strcpy (n, match_lines ? line_beg : word_beg);
-       i = strlen (n);
-@@ -257,14 +247,15 @@ Ecompile (char const *pattern, size_t size)
-   size_t total = size;
-   char const *motif = pattern;
- 
-+  check_utf8 ();
-   if (strcmp (matcher, "awk") == 0)
-     {
--      re_set_syntax (RE_SYNTAX_AWK);
-+      re_set_syntax (RE_SYNTAX_AWK | (match_icase ? RE_ICASE : 0));
-       dfasyntax (RE_SYNTAX_AWK, match_icase, eolbyte);
-     }
-   else
-     {
--      re_set_syntax (RE_SYNTAX_POSIX_EGREP);
-+      re_set_syntax (RE_SYNTAX_POSIX_EGREP | (match_icase ? RE_ICASE : 0));
-       dfasyntax (RE_SYNTAX_POSIX_EGREP, match_icase, eolbyte);
-     }
- 
-@@ -301,6 +292,10 @@ Ecompile (char const *pattern, size_t size)
-       motif = sep;
-     } while (sep && total != 0);
- 
-+  /* Strip trailing newline. */
-+  if (size && pattern[size - 1] == '\n')
-+    size--;
-+
-   /* In the match_words and match_lines cases, we use a different pattern
-      for the DFA matcher that will quickly throw out cases that won't work.
-      Then if DFA succeeds we do some hairy stuff using the regex matcher
-@@ -316,7 +311,7 @@ Ecompile (char const *pattern, size_t size)
-       static char const line_end[] = ")$";
-       static char const word_beg[] = "(^|[^[:alnum:]_])(";
-       static char const word_end[] = ")([^[:alnum:]_]|$)";
--      char *n = malloc (sizeof word_beg - 1 + size + sizeof word_end);
-+      char *n = xmalloc (sizeof word_beg - 1 + size + sizeof word_end);
-       size_t i;
-       strcpy (n, match_lines ? line_beg : word_beg);
-       i = strlen(n);
-@@ -339,15 +334,34 @@ EGexecute (char const *buf, size_t size, size_t *match_size, int exact)
-   char eol = eolbyte;
-   int backref, start, len;
-   struct kwsmatch kwsm;
--  size_t i;
-+  size_t i, ret_val;
-+  static int use_dfa;
-+  static int use_dfa_checked = 0;
- #ifdef MBS_SUPPORT
--  char *mb_properties = NULL;
-+  int mb_cur_max = MB_CUR_MAX;
-+  mbstate_t mbs;
-+  memset (&mbs, '\0', sizeof (mbstate_t));
- #endif /* MBS_SUPPORT */
- 
-+  if (!use_dfa_checked)
-+    {
-+      char *grep_use_dfa = getenv ("GREP_USE_DFA");
-+      if (!grep_use_dfa)
-+	{
- #ifdef MBS_SUPPORT
--  if (MB_CUR_MAX > 1 && kwset)
--    mb_properties = check_multibyte_string(buf, size);
-+	  /* Turn off DFA when processing multibyte input. */
-+	  use_dfa = (MB_CUR_MAX == 1);
-+#else
-+	  use_dfa = 1;
- #endif /* MBS_SUPPORT */
-+	}
-+      else
-+	{
-+	  use_dfa = atoi (grep_use_dfa);
-+	}
-+
-+      use_dfa_checked = 1;
-+    }
- 
-   buflim = buf + size;
- 
-@@ -358,47 +372,120 @@ EGexecute (char const *buf, size_t size, size_t *match_size, int exact)
- 	  if (kwset)
- 	    {
- 	      /* Find a possible match using the KWset matcher. */
--	      size_t offset = kwsexec (kwset, beg, buflim - beg, &kwsm);
-+#ifdef MBS_SUPPORT
-+	      size_t bytes_left = 0;
-+#endif /* MBS_SUPPORT */
-+	      size_t offset;
-+#ifdef MBS_SUPPORT
-+	      /* kwsexec doesn't work with match_icase and multibyte input. */
-+	      if (match_icase && mb_cur_max > 1)
-+		/* Avoid kwset */
-+		offset = 0;
-+	      else
-+#endif /* MBS_SUPPORT */
-+	      offset = kwsexec (kwset, beg, buflim - beg, &kwsm);
- 	      if (offset == (size_t) -1)
--		{
-+	        goto failure;
- #ifdef MBS_SUPPORT
--		  if (MB_CUR_MAX > 1)
--		    free(mb_properties);
--#endif
--		  return (size_t)-1;
-+	      if (mb_cur_max > 1 && !using_utf8)
-+		{
-+		  bytes_left = offset;
-+		  while (bytes_left)
-+		    {
-+		      size_t mlen = mbrlen (beg, bytes_left, &mbs);
-+		      if (mlen == (size_t) -1 || mlen == 0)
-+			{
-+			  /* Incomplete character: treat as single-byte. */
-+			  memset (&mbs, '\0', sizeof (mbstate_t));
-+			  beg++;
-+			  bytes_left--;
-+			  continue;
-+			}
-+
-+		      if (mlen == (size_t) -2)
-+			/* Offset points inside multibyte character:
-+			 * no good. */
-+			break;
-+
-+		      beg += mlen;
-+		      bytes_left -= mlen;
-+		    }
- 		}
-+	      else
-+#endif /* MBS_SUPPORT */
- 	      beg += offset;
- 	      /* Narrow down to the line containing the candidate, and
- 		 run it through DFA. */
- 	      end = memchr(beg, eol, buflim - beg);
- 	      end++;
- #ifdef MBS_SUPPORT
--	      if (MB_CUR_MAX > 1 && mb_properties[beg - buf] == 0)
-+	      if (mb_cur_max > 1 && bytes_left)
- 		continue;
--#endif
-+#endif /* MBS_SUPPORT */
- 	      while (beg > buf && beg[-1] != eol)
- 		--beg;
--	      if (kwsm.index < kwset_exact_matches)
--		goto success;
--	      if (dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1)
-+	      if (
-+#ifdef MBS_SUPPORT
-+		  !(match_icase && mb_cur_max > 1) &&
-+#endif /* MBS_SUPPORT */
-+		  (kwsm.index < kwset_exact_matches))
-+		goto success_in_beg_and_end;
-+	      if (use_dfa &&
-+		  dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1)
- 		continue;
- 	    }
- 	  else
- 	    {
- 	      /* No good fixed strings; start with DFA. */
--	      size_t offset = dfaexec (&dfa, beg, buflim - beg, &backref);
-+#ifdef MBS_SUPPORT
-+	      size_t bytes_left = 0;
-+#endif /* MBS_SUPPORT */
-+	      size_t offset = 0;
-+	      if (use_dfa)
-+		offset = dfaexec (&dfa, beg, buflim - beg, &backref);
- 	      if (offset == (size_t) -1)
- 		break;
- 	      /* Narrow down to the line we've found. */
-+#ifdef MBS_SUPPORT
-+	      if (mb_cur_max > 1 && !using_utf8)
-+		{
-+		  bytes_left = offset;
-+		  while (bytes_left)
-+		    {
-+		      size_t mlen = mbrlen (beg, bytes_left, &mbs);
-+		      if (mlen == (size_t) -1 || mlen == 0)
-+			{
-+			  /* Incomplete character: treat as single-byte. */
-+			  memset (&mbs, '\0', sizeof (mbstate_t));
-+			  beg++;
-+			  bytes_left--;
-+			  continue;
-+			}
-+
-+		      if (mlen == (size_t) -2)
-+			/* Offset points inside multibyte character:
-+			 * no good. */
-+			break;
-+
-+		      beg += mlen;
-+		      bytes_left -= mlen;
-+		    }
-+		}
-+	      else
-+#endif /* MBS_SUPPORT */
- 	      beg += offset;
- 	      end = memchr (beg, eol, buflim - beg);
- 	      end++;
-+#ifdef MBS_SUPPORT
-+	      if (mb_cur_max > 1 && bytes_left)
-+		continue;
-+#endif /* MBS_SUPPORT */
- 	      while (beg > buf && beg[-1] != eol)
- 		--beg;
- 	    }
- 	  /* Successful, no backreferences encountered! */
--	  if (!backref)
--	    goto success;
-+	  if (use_dfa && !backref)
-+	    goto success_in_beg_and_end;
- 	}
-       else
- 	end = beg + size;
-@@ -413,14 +500,11 @@ EGexecute (char const *buf, size_t size, size_t *match_size, int exact)
- 				       end - beg - 1, &(patterns[i].regs))))
- 	    {
- 	      len = patterns[i].regs.end[0] - start;
--	      if (exact)
--		{
--		  *match_size = len;
--		  return start;
--		}
-+	      if (exact && !match_words)
-+	        goto success_in_start_and_len;
- 	      if ((!match_lines && !match_words)
- 		  || (match_lines && len == end - beg - 1))
--		goto success;
-+		goto success_in_beg_and_end;
- 	      /* If -w, check if the match aligns with word boundaries.
- 		 We do this iteratively because:
- 		 (a) the line may contain more than one occurence of the
-@@ -431,10 +515,114 @@ EGexecute (char const *buf, size_t size, size_t *match_size, int exact)
- 	      if (match_words)
- 		while (start >= 0)
- 		  {
--		    if ((start == 0 || !WCHAR ((unsigned char) beg[start - 1]))
--			&& (len == end - beg - 1
--			    || !WCHAR ((unsigned char) beg[start + len])))
--		      goto success;
-+		    int lword_match = 0;
-+		    if (start == 0)
-+		      lword_match = 1;
-+		    else
-+		      {
-+			assert (start > 0);
-+#ifdef MBS_SUPPORT
-+			if (mb_cur_max > 1)
-+			  {
-+			    const char *s;
-+			    size_t mr;
-+			    wchar_t pwc;
-+
-+			    /* Locate the start of the multibyte character
-+			       before the match position (== beg + start). */
-+			    if (using_utf8)
-+			      {
-+				/* UTF-8 is a special case: scan backwards
-+				   until we find a 7-bit character or a
-+				   lead byte. */
-+				s = beg + start - 1;
-+				while (s > buf
-+				       && (unsigned char) *s >= 0x80
-+				       && (unsigned char) *s <= 0xbf)
-+				  --s;
-+			      }
-+			    else
-+			      {
-+				/* Scan forwards to find the start of the
-+				   last complete character before the
-+				   match position.  */
-+				size_t bytes_left = start - 1;
-+				s = beg;
-+				while (bytes_left > 0)
-+				  {
-+				    mr = mbrlen (s, bytes_left, &mbs);
-+				    if (mr == (size_t) -1 || mr == 0)
-+				      {
-+					memset (&mbs, '\0', sizeof (mbs));
-+					s++;
-+					bytes_left--;
-+					continue;
-+				      }
-+				    if (mr == (size_t) -2)
-+				      {
-+					memset (&mbs, '\0', sizeof (mbs));
-+					break;
-+				      }
-+				    s += mr;
-+				    bytes_left -= mr;
-+				  }
-+			      }
-+			    mr = mbrtowc (&pwc, s, beg + start - s, &mbs);
-+			    if (mr == (size_t) -2 || mr == (size_t) -1 ||
-+				mr == 0)
-+			      {
-+				memset (&mbs, '\0', sizeof (mbstate_t));
-+				lword_match = 1;
-+			      }
-+			    else if (!(iswalnum (pwc) || pwc == L'_')
-+				     && mr == beg + start - s)
-+			      lword_match = 1;
-+			  }
-+			else
-+#endif /* MBS_SUPPORT */
-+			if (!WCHAR ((unsigned char) beg[start - 1]))
-+			  lword_match = 1;
-+		      }
-+
-+		    if (lword_match)
-+		      {
-+			int rword_match = 0;
-+			if (start + len == end - beg - 1)
-+			  rword_match = 1;
-+			else
-+			  {
-+#ifdef MBS_SUPPORT
-+			    if (mb_cur_max > 1)
-+			      {
-+				wchar_t nwc;
-+				int mr;
-+
-+				mr = mbtowc (&nwc, beg + start + len,
-+					     end - beg - start - len - 1);
-+				if (mr <= 0)
-+				  {
-+				    memset (&mbs, '\0', sizeof (mbstate_t));
-+				    rword_match = 1;
-+				  }
-+				else if (!iswalnum (nwc) && nwc != L'_')
-+				  rword_match = 1;
-+			      }
-+			    else
-+#endif /* MBS_SUPPORT */
-+			    if (!WCHAR ((unsigned char) beg[start + len]))
-+			      rword_match = 1;
-+			  }
-+
-+			if (rword_match)
-+			  {
-+			    if (!exact)
-+			      /* Returns the whole line. */
-+			      goto success_in_beg_and_end;
-+			    else
-+			      /* Returns just this word match. */
-+			      goto success_in_start_and_len;
-+			  }
-+		      }
- 		    if (len > 0)
- 		      {
- 			/* Try a shorter length anchored at the same place. */
-@@ -461,26 +649,154 @@ EGexecute (char const *buf, size_t size, size_t *match_size, int exact)
- 	    }
- 	} /* for Regex patterns.  */
-     } /* for (beg = end ..) */
--#ifdef MBS_SUPPORT
--  if (MB_CUR_MAX > 1 && mb_properties)
--    free (mb_properties);
--#endif /* MBS_SUPPORT */
-+
-+ failure:
-   return (size_t) -1;
- 
-- success:
--#ifdef MBS_SUPPORT
--  if (MB_CUR_MAX > 1 && mb_properties)
--    free (mb_properties);
--#endif /* MBS_SUPPORT */
--  *match_size = end - beg;
--  return beg - buf;
-+ success_in_beg_and_end:
-+  len = end - beg;
-+  start = beg - buf;
-+  /* FALLTHROUGH */
-+
-+ success_in_start_and_len:
-+  *match_size = len;
-+  return start;
- }
- 
-+#ifdef MBS_SUPPORT
-+static int f_i_multibyte; /* whether we're using the new -Fi MB method */
-+static struct
-+{
-+  wchar_t **patterns;
-+  size_t count, maxlen;
-+  unsigned char *match;
-+} Fimb;
-+#endif
-+
- static void
- Fcompile (char const *pattern, size_t size)
- {
-+  int mb_cur_max = MB_CUR_MAX;
-   char const *beg, *lim, *err;
- 
-+  check_utf8 ();
-+#ifdef MBS_SUPPORT
-+  /* Support -F -i for UTF-8 input. */
-+  if (match_icase && mb_cur_max > 1)
-+    {
-+      mbstate_t mbs;
-+      wchar_t *wcpattern = xmalloc ((size + 1) * sizeof (wchar_t));
-+      const char *patternend = pattern;
-+      size_t wcsize;
-+      kwset_t fimb_kwset = NULL;
-+      char *starts = NULL;
-+      wchar_t *wcbeg, *wclim;
-+      size_t allocated = 0;
-+
-+      memset (&mbs, '\0', sizeof (mbs));
-+# ifdef __GNU_LIBRARY__
-+      wcsize = mbsnrtowcs (wcpattern, &patternend, size, size, &mbs);
-+      if (patternend != pattern + size)
-+	wcsize = (size_t) -1;
-+# else
-+      {
-+	char *patterncopy = xmalloc (size + 1);
-+
-+	memcpy (patterncopy, pattern, size);
-+	patterncopy[size] = '\0';
-+	patternend = patterncopy;
-+	wcsize = mbsrtowcs (wcpattern, &patternend, size, &mbs);
-+	if (patternend != patterncopy + size)
-+	  wcsize = (size_t) -1;
-+	free (patterncopy);
-+      }
-+# endif
-+      if (wcsize + 2 <= 2)
-+	{
-+fimb_fail:
-+	  free (wcpattern);
-+	  free (starts);
-+	  if (fimb_kwset)
-+	    kwsfree (fimb_kwset);
-+	  free (Fimb.patterns);
-+	  Fimb.patterns = NULL;
-+	}
-+      else
-+	{
-+	  if (!(fimb_kwset = kwsalloc (NULL)))
-+	    error (2, 0, _("memory exhausted"));
-+
-+	  starts = xmalloc (mb_cur_max * 3);
-+	  wcbeg = wcpattern;
-+	  do
-+	    {
-+	      int i;
-+	      size_t wclen;
-+
-+	      if (Fimb.count >= allocated)
-+		{
-+		  if (allocated == 0)
-+		    allocated = 128;
-+		  else
-+		    allocated *= 2;
-+		  Fimb.patterns = xrealloc (Fimb.patterns,
-+					    sizeof (wchar_t *) * allocated);
-+		}
-+	      Fimb.patterns[Fimb.count++] = wcbeg;
-+	      for (wclim = wcbeg;
-+		   wclim < wcpattern + wcsize && *wclim != L'\n'; ++wclim)
-+		*wclim = towlower (*wclim);
-+	      *wclim = L'\0';
-+	      wclen = wclim - wcbeg;
-+	      if (wclen > Fimb.maxlen)
-+		Fimb.maxlen = wclen;
-+	      if (wclen > 3)
-+		wclen = 3;
-+	      if (wclen == 0)
-+		{
-+		  if ((err = kwsincr (fimb_kwset, "", 0)) != 0)
-+		    error (2, 0, err);
-+		}
-+	      else
-+		for (i = 0; i < (1 << wclen); i++)
-+		  {
-+		    char *p = starts;
-+		    int j, k;
-+
-+		    for (j = 0; j < wclen; ++j)
-+		      {
-+			wchar_t wc = wcbeg[j];
-+			if (i & (1 << j))
-+			  {
-+			    wc = towupper (wc);
-+			    if (wc == wcbeg[j])
-+			      continue;
-+			  }
-+			k = wctomb (p, wc);
-+			if (k <= 0)
-+			  goto fimb_fail;
-+			p += k;
-+		      }
-+		    if ((err = kwsincr (fimb_kwset, starts, p - starts)) != 0)
-+		      error (2, 0, err);
-+		  }
-+	      if (wclim < wcpattern + wcsize)
-+		++wclim;
-+	      wcbeg = wclim;
-+	    }
-+	  while (wcbeg < wcpattern + wcsize);
-+	  f_i_multibyte = 1;
-+	  kwset = fimb_kwset;
-+	  free (starts);
-+	  Fimb.match = xmalloc (Fimb.count);
-+	  if ((err = kwsprep (kwset)) != 0)
-+	    error (2, 0, err);
-+	  return;
-+	}
-+    }
-+#endif /* MBS_SUPPORT */
-+
-+
-   kwsinit ();
-   beg = pattern;
-   do
-@@ -499,6 +815,76 @@ Fcompile (char const *pattern, size_t size)
-     error (2, 0, err);
- }
- 
-+#ifdef MBS_SUPPORT
-+static int
-+Fimbexec (const char *buf, size_t size, size_t *plen, int exact)
-+{
-+  size_t len, letter, i;
-+  int ret = -1;
-+  mbstate_t mbs;
-+  wchar_t wc;
-+  int patterns_left;
-+
-+  assert (match_icase && f_i_multibyte == 1);
-+  assert (MB_CUR_MAX > 1);
-+
-+  memset (&mbs, '\0', sizeof (mbs));
-+  memset (Fimb.match, '\1', Fimb.count);
-+  letter = len = 0;
-+  patterns_left = 1;
-+  while (patterns_left && len <= size)
-+    {
-+      size_t c;
-+
-+      patterns_left = 0;
-+      if (len < size)
-+	{
-+	  c = mbrtowc (&wc, buf + len, size - len, &mbs);
-+	  if (c + 2 <= 2)
-+	    return ret;
-+
-+	  wc = towlower (wc);
-+	}
-+      else
-+	{
-+	  c = 1;
-+	  wc = L'\0';
-+	}
-+
-+      for (i = 0; i < Fimb.count; i++)
-+	{
-+	  if (Fimb.match[i])
-+	    {
-+	      if (Fimb.patterns[i][letter] == L'\0')
-+		{
-+		  /* Found a match. */
-+		  *plen = len;
-+		  if (!exact && !match_words)
-+		    return 0;
-+		  else
-+		    {
-+		      /* For -w or exact look for longest match.  */
-+		      ret = 0;
-+		      Fimb.match[i] = '\0';
-+		      continue;
-+		    }
-+		}
-+
-+	      if (Fimb.patterns[i][letter] == wc)
-+		patterns_left = 1;
-+	      else
-+		Fimb.match[i] = '\0';
-+	    }
-+	}
-+
-+      len += c;
-+      letter++;
-+    }
-+
-+  return ret;
-+}
-+#endif /* MBS_SUPPORT */
-+
- static size_t
- Fexecute (char const *buf, size_t size, size_t *match_size, int exact)
- {
-@@ -506,88 +892,268 @@ Fexecute (char const *buf, size_t size, size_t *match_size, int exact)
-   register size_t len;
-   char eol = eolbyte;
-   struct kwsmatch kwsmatch;
-+  size_t ret_val;
- #ifdef MBS_SUPPORT
--  char *mb_properties;
--  if (MB_CUR_MAX > 1)
--    mb_properties = check_multibyte_string (buf, size);
-+  int mb_cur_max = MB_CUR_MAX;
-+  mbstate_t mbs;
-+  memset (&mbs, '\0', sizeof (mbstate_t));
-+  const char *last_char = NULL;
- #endif /* MBS_SUPPORT */
- 
--  for (beg = buf; beg <= buf + size; ++beg)
-+  for (beg = buf; beg < buf + size; ++beg)
-     {
--      size_t offset = kwsexec (kwset, beg, buf + size - beg, &kwsmatch);
-+      size_t offset;
-+      offset = kwsexec (kwset, beg, buf + size - beg, &kwsmatch);
-+
-       if (offset == (size_t) -1)
--	{
-+	goto failure;
- #ifdef MBS_SUPPORT
--	  if (MB_CUR_MAX > 1)
--	    free(mb_properties);
--#endif /* MBS_SUPPORT */
--	  return offset;
-+      if (mb_cur_max > 1 && !using_utf8)
-+	{
-+	  size_t bytes_left = offset;
-+	  while (bytes_left)
-+	    {
-+	      size_t mlen = mbrlen (beg, bytes_left, &mbs);
-+
-+	      last_char = beg;
-+	      if (mlen == (size_t) -1 || mlen == 0)
-+		{
-+		  /* Incomplete character: treat as single-byte. */
-+		  memset (&mbs, '\0', sizeof (mbstate_t));
-+		  beg++;
-+		  bytes_left--;
-+		  continue;
-+		}
-+
-+	      if (mlen == (size_t) -2)
-+		/* Offset points inside multibyte character: no good. */
-+		break;
-+
-+	      beg += mlen;
-+	      bytes_left -= mlen;
-+	    }
-+
-+	  if (bytes_left)
-+	    continue;
- 	}
--#ifdef MBS_SUPPORT
--      if (MB_CUR_MAX > 1 && mb_properties[offset+beg-buf] == 0)
--	continue; /* It is a part of multibyte character.  */
-+      else
- #endif /* MBS_SUPPORT */
-       beg += offset;
--      len = kwsmatch.size[0];
--      if (exact)
--	{
--	  *match_size = len;
- #ifdef MBS_SUPPORT
--	  if (MB_CUR_MAX > 1)
--	    free (mb_properties);
-+      /* For f_i_multibyte, the string at beg now matches first 3 chars of
-+	 one of the search strings (less if there are shorter search strings).
-+	 See if this is a real match.  */
-+      if (f_i_multibyte
-+	  && Fimbexec (beg, buf + size - beg, &kwsmatch.size[0], exact))
-+	goto next_char;
- #endif /* MBS_SUPPORT */
--	  return beg - buf;
--	}
-+      len = kwsmatch.size[0];
-+      if (exact && !match_words)
-+	goto success_in_beg_and_len;
-       if (match_lines)
- 	{
- 	  if (beg > buf && beg[-1] != eol)
--	    continue;
-+	    goto next_char;
- 	  if (beg + len < buf + size && beg[len] != eol)
--	    continue;
-+	    goto next_char;
- 	  goto success;
- 	}
-       else if (match_words)
--	for (try = beg; len; )
--	  {
--	    if (try > buf && WCHAR((unsigned char) try[-1]))
--	      break;
--	    if (try + len < buf + size && WCHAR((unsigned char) try[len]))
--	      {
--		offset = kwsexec (kwset, beg, --len, &kwsmatch);
--		if (offset == (size_t) -1)
--		  {
-+	{
-+	  while (len)
-+	    {
-+	      int word_match = 0;
-+	      if (beg > buf)
-+		{
- #ifdef MBS_SUPPORT
--		    if (MB_CUR_MAX > 1)
--		      free (mb_properties);
-+		  if (mb_cur_max > 1)
-+		    {
-+		      const char *s;
-+		      int mr;
-+		      wchar_t pwc;
-+
-+		      if (using_utf8)
-+			{
-+			  s = beg - 1;
-+			  while (s > buf
-+				 && (unsigned char) *s >= 0x80
-+				 && (unsigned char) *s <= 0xbf)
-+			    --s;
-+			}
-+		      else
-+			s = last_char;
-+		      mr = mbtowc (&pwc, s, beg - s);
-+		      if (mr <= 0)
-+			memset (&mbs, '\0', sizeof (mbstate_t));
-+		      else if ((iswalnum (pwc) || pwc == L'_')
-+			       && mr == (int) (beg - s))
-+			goto next_char;
-+		    }
-+		  else
- #endif /* MBS_SUPPORT */
--		    return offset;
--		  }
--		try = beg + offset;
--		len = kwsmatch.size[0];
--	      }
--	    else
--	      goto success;
--	  }
-+		  if (WCHAR ((unsigned char) beg[-1]))
-+		    goto next_char;
-+		}
-+#ifdef MBS_SUPPORT
-+	      if (mb_cur_max > 1)
-+		{
-+		  wchar_t nwc;
-+		  int mr;
-+
-+		  mr = mbtowc (&nwc, beg + len, buf + size - beg - len);
-+		  if (mr <= 0)
-+		    {
-+		      memset (&mbs, '\0', sizeof (mbstate_t));
-+		      word_match = 1;
-+		    }
-+		  else if (!iswalnum (nwc) && nwc != L'_')
-+		    word_match = 1;
-+		}
-+	      else
-+#endif /* MBS_SUPPORT */
-+		if (beg + len >= buf + size || !WCHAR ((unsigned char) beg[len]))
-+		  word_match = 1;
-+	      if (word_match)
-+		{
-+		  if (!exact)
-+		    /* Returns the whole line now we know there's a word match. */
-+		    goto success;
-+		  else
-+		    /* Returns just this word match. */
-+		    goto success_in_beg_and_len;
-+		}
-+	      if (len > 0)
-+		{
-+		  /* Try a shorter length anchored at the same place. */
-+		  --len;
-+		  offset = kwsexec (kwset, beg, len, &kwsmatch);
-+
-+		  if (offset == -1)
-+		    goto next_char; /* Try a different anchor. */
-+#ifdef MBS_SUPPORT
-+		  if (mb_cur_max > 1 && !using_utf8)
-+		    {
-+		      size_t bytes_left = offset;
-+		      while (bytes_left)
-+			{
-+			  size_t mlen = mbrlen (beg, bytes_left, &mbs);
-+
-+			  last_char = beg;
-+			  if (mlen == (size_t) -1 || mlen == 0)
-+			    {
-+			      /* Incomplete character: treat as single-byte. */
-+			      memset (&mbs, '\0', sizeof (mbstate_t));
-+			      beg++;
-+			      bytes_left--;
-+			      continue;
-+			    }
-+
-+			  if (mlen == (size_t) -2)
-+			    {
-+			      /* Offset points inside multibyte character:
-+			       * no good. */
-+			      break;
-+			    }
-+
-+			  beg += mlen;
-+			  bytes_left -= mlen;
-+			}
-+
-+		      if (bytes_left)
-+			{
-+			  memset (&mbs, '\0', sizeof (mbstate_t));
-+			  goto next_char; /* Try a different anchor. */
-+			}
-+		    }
-+		  else
-+#endif /* MBS_SUPPORT */
-+		  beg += offset;
-+#ifdef MBS_SUPPORT
-+		  /* The string at beg now matches first 3 chars of one of
-+		     the search strings (less if there are shorter search
-+		     strings).  See if this is a real match.  */
-+		  if (f_i_multibyte
-+		      && Fimbexec (beg, len - offset, &kwsmatch.size[0],
-+				   exact))
-+		    goto next_char;
-+#endif /* MBS_SUPPORT */
-+		  len = kwsmatch.size[0];
-+		}
-+	    }
-+	}
-       else
- 	goto success;
--    }
--
-+next_char:;
- #ifdef MBS_SUPPORT
--  if (MB_CUR_MAX > 1)
--    free (mb_properties);
-+      /* Advance to next character.  For MB_CUR_MAX == 1 case this is handled
-+	 by ++beg above.  */
-+      if (mb_cur_max > 1)
-+	{
-+	  if (using_utf8)
-+	    {
-+	      unsigned char c = *beg;
-+	      if (c >= 0xc2)
-+		{
-+		  if (c < 0xe0)
-+		    ++beg;
-+		  else if (c < 0xf0)
-+		    beg += 2;
-+		  else if (c < 0xf8)
-+		    beg += 3;
-+		  else if (c < 0xfc)
-+		    beg += 4;
-+		  else if (c < 0xfe)
-+		    beg += 5;
-+		}
-+	    }
-+	  else
-+	    {
-+	      size_t l = mbrlen (beg, buf + size - beg, &mbs);
-+
-+	      last_char = beg;
-+	      if (l + 2 >= 2)
-+		beg += l - 1;
-+	      else
-+		memset (&mbs, '\0', sizeof (mbstate_t));
-+	    }
-+	}
- #endif /* MBS_SUPPORT */
-+    }
-+
-+ failure:
-   return -1;
- 
-  success:
-+#ifdef MBS_SUPPORT
-+  if (mb_cur_max > 1 && !using_utf8)
-+    {
-+      end = beg + len;
-+      while (end < buf + size)
-+	{
-+	  size_t mlen = mbrlen (end, buf + size - end, &mbs);
-+	  if (mlen == (size_t) -1 || mlen == (size_t) -2 || mlen == 0)
-+	    {
-+	      memset (&mbs, '\0', sizeof (mbstate_t));
-+	      mlen = 1;
-+	    }
-+	  if (mlen == 1 && *end == eol)
-+	    break;
-+
-+	  end += mlen;
-+	}
-+    }
-+  else
-+#endif /* MBS_SUPPORT */
-   end = memchr (beg + len, eol, (buf + size) - (beg + len));
-+
-   end++;
-   while (buf < beg && beg[-1] != eol)
-     --beg;
--  *match_size = end - beg;
--#ifdef MBS_SUPPORT
--  if (MB_CUR_MAX > 1)
--    free (mb_properties);
--#endif /* MBS_SUPPORT */
-+  len = end - beg;
-+  /* FALLTHROUGH */
-+
-+ success_in_beg_and_len:
-+  *match_size = len;
-   return beg - buf;
- }
- 
-@@ -701,8 +1267,9 @@ Pexecute (char const *buf, size_t size, size_t *match_size, int exact)
-       char eol = eolbyte;
-       if (!exact)
- 	{
--	  end = memchr (end, eol, buflim - end);
--	  end++;
-+	  while (end < buflim)
-+	    if (*end++ == eol)
-+	      break;
- 	  while (buf < beg && beg[-1] != eol)
- 	    --beg;
- 	}
--- 
-1.8.4.2
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/grep_fix_for_automake-1.12.patch b/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/grep_fix_for_automake-1.12.patch
deleted file mode 100644
index d9b1e35..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/grep_fix_for_automake-1.12.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-Upstream-Status: Pending
-
-automake 1.12 has depricated automatic de-ANSI-fication support
-
-this patch avoids these kinds of errors:
-
-| configure.in:33: error: automatic de-ANSI-fication support has been removed
-| /srv/home/nitin/builds/build-gcc47/tmp/sysroots/x86_64-linux/usr/share/aclocal-1.12/protos.m4:12: AM_C_PROTOTYPES is expanded from...
-| configure.in:33: the top level
-| autom4te: m4 failed with exit status: 1
-...
-| lib/Makefile.am:2: error: automatic de-ANSI-fication support has been removed
-| src/Makefile.am:2: error: automatic de-ANSI-fication support has been removed
-| autoreconf: automake failed with exit status: 1
-
-Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
-2012/05/04
-
-Index: grep-2.5.1a/configure.in
-===================================================================
---- grep-2.5.1a.orig/configure.in
-+++ grep-2.5.1a/configure.in
-@@ -30,7 +30,6 @@ AC_PROG_RANLIB
- 
- dnl Checks for typedefs, structures, and compiler characteristics.
- AC_SYS_LARGEFILE
--AM_C_PROTOTYPES
- AC_TYPE_SIZE_T
- AC_CHECK_TYPE(ssize_t, int)
- AC_C_CONST
-Index: grep-2.5.1a/lib/Makefile.am
-===================================================================
---- grep-2.5.1a.orig/lib/Makefile.am
-+++ grep-2.5.1a/lib/Makefile.am
-@@ -1,5 +1,5 @@
- #
--AUTOMAKE_OPTIONS = ../src/ansi2knr
-+AUTOMAKE_OPTIONS = 
- 
- SUBDIRS = posix
- 
-Index: grep-2.5.1a/src/Makefile.am
-===================================================================
---- grep-2.5.1a.orig/src/Makefile.am
-+++ grep-2.5.1a/src/Makefile.am
-@@ -1,5 +1,5 @@
- ## Process this file with automake to create Makefile.in
--AUTOMAKE_OPTIONS = ansi2knr no-dependencies
-+AUTOMAKE_OPTIONS = no-dependencies
- 
- LN = ln
- 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/uclibc-fix.patch b/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/uclibc-fix.patch
deleted file mode 100644
index de054fc..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/grep/grep-2.5.1a/uclibc-fix.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-Upstream-Status: Inappropriate [licensing]
-
-# Fix to use mempcpy instead of __mempcpy. This is needed for uclibc which
-# doesn't define __mempcpy, only mempcpy. Since both uclibc and glibc have
-# mempcpy, we'll just use that instead.
-# Patch source: OpenEmbedded
-
-Index: grep-2.5.1/intl/localealias.c
-===================================================================
---- grep-2.5.1.orig/intl/localealias.c	2002-03-14 00:39:06.000000000 +1100
-+++ grep-2.5.1/intl/localealias.c	2007-05-17 13:53:58.000000000 +1000
-@@ -65,7 +65,7 @@
- # define strcasecmp __strcasecmp
- 
- # ifndef mempcpy
--#  define mempcpy __mempcpy
-+#  error "mempcpy not detected"
- # endif
- # define HAVE_MEMPCPY	1
- # define HAVE___FSETLOCKING	1
-Index: grep-2.5.1/lib/getopt.c
-===================================================================
---- grep-2.5.1.orig/lib/getopt.c	2001-03-04 16:33:12.000000000 +1100
-+++ grep-2.5.1/lib/getopt.c	2007-05-17 13:51:44.000000000 +1000
-@@ -326,7 +326,7 @@
- 	nonoption_flags_len = nonoption_flags_max_len = 0;
-       else
- 	{
--	  memset (__mempcpy (new_str, __getopt_nonoption_flags,
-+	  memset (mempcpy (new_str, __getopt_nonoption_flags,
- 			     nonoption_flags_max_len),
- 		  '\0', top + 1 - nonoption_flags_max_len);
- 	  nonoption_flags_max_len = top + 1;
-@@ -437,7 +437,7 @@
- 	      if (__getopt_nonoption_flags == NULL)
- 		nonoption_flags_max_len = -1;
- 	      else
--		memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
-+		memset (mempcpy (__getopt_nonoption_flags, orig_str, len),
- 			'\0', nonoption_flags_max_len - len);
- 	    }
- 	}
-Index: grep-2.5.1/lib/regex.c
-===================================================================
---- grep-2.5.1.orig/lib/regex.c	2001-04-03 04:04:45.000000000 +1000
-+++ grep-2.5.1/lib/regex.c	2007-05-17 13:51:48.000000000 +1000
-@@ -7842,7 +7842,7 @@
-       if (msg_size > errbuf_size)
-         {
- #if defined HAVE_MEMPCPY || defined _LIBC
--	  *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
-+	  *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
- #else
-           memcpy (errbuf, msg, errbuf_size - 1);
-           errbuf[errbuf_size - 1] = 0;
diff --git a/import-layers/yocto-poky/meta/recipes-extended/grep/grep_2.5.1a.bb b/import-layers/yocto-poky/meta/recipes-extended/grep/grep_2.5.1a.bb
deleted file mode 100644
index 5a2da28..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/grep/grep_2.5.1a.bb
+++ /dev/null
@@ -1,56 +0,0 @@
-SUMMARY = "Pattern matching utilities"
-DESCRIPTION = "The GNU versions of commonly used grep utilities.  The grep command searches one or more input \
-files for lines containing a match to a specified pattern."
-SECTION = "console/utils"
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3"
-
-PR = "r2"
-
-SRC_URI = "${GNU_MIRROR}/grep/grep-${PV}.tar.bz2 \
-           file://uclibc-fix.patch \
-           file://grep_fix_for_automake-1.12.patch \
-           file://gettext.patch \
-           file://fix64-int-to-pointer.patch \
-           file://Makevars \
-           file://grep-CVE-2012-5667.patch \
-           file://fix-for-texinfo-5.1.patch \
-           file://grep-egrep-fgrep-Fix-LSB-NG-cases.patch \
-          "
-
-SRC_URI[md5sum] = "52202fe462770fa6be1bb667bd6cf30c"
-SRC_URI[sha256sum] = "38c8a2bb9223d1fb1b10bdd607cf44830afc92fd451ac4cd07619bf92bdd3132"
-
-inherit autotools gettext texinfo
-
-EXTRA_OECONF_INCLUDED_REGEX = "--without-included-regex"
-EXTRA_OECONF_INCLUDED_REGEX_libc-musl = "--with-included-regex"
-
-EXTRA_OECONF = "--disable-perl-regexp \
-                ${EXTRA_OECONF_INCLUDED_REGEX}"
-
-CFLAGS += "-D PROTOTYPES"
-do_configure_prepend () {
-	rm -f ${S}/m4/init.m4
-	cp -f ${WORKDIR}/Makevars ${S}/po/
-}
-
-do_install () {
-	autotools_do_install
-	install -d ${D}${base_bindir}
-	mv ${D}${bindir}/grep ${D}${base_bindir}/grep
-	mv ${D}${bindir}/egrep ${D}${base_bindir}/egrep
-	mv ${D}${bindir}/fgrep ${D}${base_bindir}/fgrep
-	rmdir ${D}${bindir}/
-}
-
-inherit update-alternatives
-
-ALTERNATIVE_PRIORITY = "100"
-
-ALTERNATIVE_${PN} = "grep egrep fgrep"
-ALTERNATIVE_LINK_NAME[grep] = "${base_bindir}/grep"
-ALTERNATIVE_LINK_NAME[egrep] = "${base_bindir}/egrep"
-ALTERNATIVE_LINK_NAME[fgrep] = "${base_bindir}/fgrep"
-
-export CONFIG_SHELL="/bin/sh"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/grep/grep_2.25.bb b/import-layers/yocto-poky/meta/recipes-extended/grep/grep_3.0.bb
similarity index 79%
rename from import-layers/yocto-poky/meta/recipes-extended/grep/grep_2.25.bb
rename to import-layers/yocto-poky/meta/recipes-extended/grep/grep_3.0.bb
index 9720d9f..b2940d5 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/grep/grep_2.25.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/grep/grep_3.0.bb
@@ -9,13 +9,16 @@
            file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
           "
 
-SRC_URI[md5sum] = "04e96b0e6f0fe6a180ae62c88fcd0af6"
-SRC_URI[sha256sum] = "e21e83bac50450e0d0d61a42c154ee0dceaacdbf4f604ef6e79071cb8e596830"
+SRC_URI[md5sum] = "fa07c1616adeb9c3262be5177d10ad4a"
+SRC_URI[sha256sum] = "e2c81db5056e3e8c5995f0bb5d0d0e1cad1f6f45c3b2fc77b6e81435aed48ab5"
 
-inherit autotools gettext texinfo
+inherit autotools gettext texinfo pkgconfig
 
 EXTRA_OECONF = "--disable-perl-regexp"
 
+# Fix "Argument list too long" error when len(TMPDIR) = 410
+acpaths = "-I ./m4"
+
 do_configure_prepend () {
 	rm -f ${S}/m4/init.m4
 }
diff --git a/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/fix-narrowing-conversion-error.patch b/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/fix-narrowing-conversion-error.patch
deleted file mode 100644
index 4b0176f..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/fix-narrowing-conversion-error.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From fc289ab69c6d7e4ad489172509a85f68afec43ea Mon Sep 17 00:00:00 2001
-From: Hongxu Jia <hongxu.jia@windriver.com>
-Date: Fri, 29 Jul 2016 03:19:39 -0400
-Subject: [PATCH] fix narrowing conversion error
-
-While gcc6 used, build old groff (for anti-GPLv3 reasons) failed:
-.....
-|groff-1.18.1.4/src/devices/grolbp/charset.h:69:1: error: narrowing
-conversion of '130' from 'int' to 'char' inside { } [-Wnarrowing]
-......
-
-In upstream git://git.savannah.gnu.org/groff.git,
-the following commit fix the issue, but the license is GPLV3,
-we could not backport it to the old groff which license is GPLV2.
-...
-commit d180038ae0da19655bc2760ae2043efa0550a76c
-Author: Werner LEMBERG <wl@gnu.org>
-Date:   Wed Apr 16 21:11:07 2003 +0000
-    * src/devices/grolbp/charset.h (symset): Use `unsigned char'.
-...
-
-We use another different way to fix the issue.
-
-Upstream-Status: Pending
-
-Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
----
- src/devices/grolbp/charset.h | 2 +-
- src/devices/grolbp/lbp.cc    | 4 ++--
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/src/devices/grolbp/charset.h b/src/devices/grolbp/charset.h
-index adc76f4..e9c6c5b 100644
---- a/src/devices/grolbp/charset.h
-+++ b/src/devices/grolbp/charset.h
-@@ -1,6 +1,6 @@
- // Definition of the WP54 character set
- 
--char symset[] = {
-+int symset[] = {
- 0x57,0x50,0x35,0x34,0x00,0x41,0x76,0x61,0x6e,0x74,0x47,0x61,
- 0x72,0x64,0x65,0x2d,0x42,0x6f,0x6f,0x6b,0x00,0x41,0x76,
- 0x61,0x6e,0x74,0x47,0x61,0x72,0x64,0x65,0x2d,0x44,0x65,
-diff --git a/src/devices/grolbp/lbp.cc b/src/devices/grolbp/lbp.cc
-index 76db32a..00d4ca7 100644
---- a/src/devices/grolbp/lbp.cc
-+++ b/src/devices/grolbp/lbp.cc
-@@ -152,8 +152,8 @@ static void wp54charset()
- {
-   unsigned int i;
-   lbpputs("\033[714;100;29;0;32;120.}");
--  for (i = 0; i < sizeof(symset); i++)
--    lbpputc(symset[i]);
-+  for (i = 0; i < sizeof(symset)/sizeof(symset[0]); i++)
-+    lbpputc((char)symset[i]&0xFF);
-   lbpputs("\033[100;0 D");
-   return;
- }
--- 
-2.8.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/groff-1.18.1.4-fix-bindir.patch b/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/groff-1.18.1.4-fix-bindir.patch
deleted file mode 100644
index 559ae72..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/groff-1.18.1.4-fix-bindir.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Upstream-Status: Inappropriate [embedded]
-
-Signed-off-by: Ming Liu <ming.liu@windriver.com>
----
- Makefile.sub |   10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
---- a/contrib/groffer/Makefile.sub
-+++ b/contrib/groffer/Makefile.sub
-@@ -38,16 +38,16 @@ groffer: groffer.sh groffer2.sh version.
- 	$(RM) $@;
- 	sed \
-             -e "s|@g@|$(g)|g" \
--	    -e "s|@BINDIR@|$(DESTDIR)$(bindir)|g" \
-+	    -e "s|@BINDIR@|$(bindir)|g" \
- 	    -e "s|@libdir@|$(DESTDIR)$(libdir)|g" \
- 	    -e "s|@VERSION@|$(version)$(revision)|g" \
- 	    $(srcdir)/groffer.sh >$@;
- 	chmod +x $@
- 
- install_data: groffer
--	-test -d $(DESTDIR)$(bindir) || $(mkinstalldirs) $(DESTDIR)$(bindir)
--	-$(RM) $(DESTDIR)$(bindir)/groffer
--	$(INSTALL_SCRIPT) groffer $(DESTDIR)$(bindir)/groffer
-+	-test -d $(bindir) || $(mkinstalldirs) $(bindir)
-+	-$(RM) $(bindir)/groffer
-+	$(INSTALL_SCRIPT) groffer $(bindir)/groffer
- 	-test -d $(DESTDIR)$(libdir)/groff/groffer || \
-           $(mkinstalldirs) $(DESTDIR)$(libdir)/groff/groffer
- 	-$(RM) $(DESTDIR)$(libdir)/groff/groffer/groffer2.sh
-@@ -58,7 +58,7 @@ install_data: groffer
- 	$(DESTDIR)$(libdir)/groff/groffer/version.sh
- 
- uninstall_sub:
--	-$(RM) $(DESTDIR)$(bindir)/groffer
-+	-$(RM) $(bindir)/groffer
- 	-$(RM) $(DESTDIR)$(libdir)/groff/groffer/groffer2.sh
- 	-$(RM) $(DESTDIR)$(libdir)/groff/groffer/version.sh
- 	-rmdir $(DESTDIR)$(libdir)/groff/groffer
diff --git a/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/groff-1.18.1.4-remove-mom.patch b/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/groff-1.18.1.4-remove-mom.patch
deleted file mode 100644
index c24eff9..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/groff-1.18.1.4-remove-mom.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-
-Upstream-Status: Inappropriate [embedded]
-
-Signed-off-by: Saul Wold <sgw@linux.intel.com>
----
- groff-1.18.1.4/Makefile.in |    7 +------
- 1 file changed, 1 insertion(+), 6 deletions(-)
-
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -460,27 +460,22 @@ OTHERDIRS=\
-   src/roff/grog \
-   src/roff/nroff \
-   contrib/mm \
-   contrib/pic2graph \
-   contrib/eqn2graph \
--  contrib/groffer \
--  contrib/mom \
--  doc
-+  contrib/groffer
- ALLDIRS=$(INCDIRS) $(LIBDIRS) $(PROGDIRS) \
-   $(DEVDIRS) $(OTHERDEVDIRS) $(TTYDEVDIRS) $(OTHERDIRS)
- EXTRADIRS=\
-   font/devps/generate \
-   font/devdvi/generate \
-   font/devlj4/generate \
--  src/xditview \
-   doc
- NOMAKEDIRS=\
-   arch/djgpp \
-   contrib/mm/examples \
-   contrib/mm/mm \
--  contrib/mom/examples \
--  contrib/mom/momdoc \
-   src/libs/snprintf
- DISTDIRS=\
-   $(INCDIRS) $(LIBDIRS) $(PROGDIRS) $(DEVDIRS) $(OTHERDEVDIRS) \
-   $(ALLTTYDEVDIRS) $(OTHERDIRS) $(EXTRADIRS) $(NOMAKEDIRS)
- TARGETS=all install install_bin install_data clean distclean mostlyclean \
diff --git a/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/man-local.patch b/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/man-local.patch
deleted file mode 100644
index e3f1aa6..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/man-local.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Upstream-Status: Inappropriate [embedded]
-
-Signed-off-by: Saul Wold <sgw@linux.intel.com>
-
-Index: groff-1.18.1.4/tmac/man.local
-===================================================================
---- groff-1.18.1.4.orig/tmac/man.local	2000-10-26 22:15:17.000000000 +0800
-+++ groff-1.18.1.4/tmac/man.local	2010-08-24 14:17:52.070006664 +0800
-@@ -1,2 +1,27 @@
- .\" This file is loaded after an-old.tmac.
- .\" Put any local modifications to an-old.tmac here.
-+.
-+.if n \{\
-+.  \" Debian: Map \(oq to ' rather than ` in nroff mode for devices other
-+.  \" than utf8.
-+.  if !'\*[.T]'utf8' \
-+.    tr \[oq]'
-+.
-+.  \" Debian: Disable the use of SGR (ANSI colour) escape sequences by
-+.  \" grotty.
-+.  if '\V[GROFF_SGR]'' \
-+.    output x X tty: sgr 0
-+.
-+.  \" Debian: Map \- to the Unicode HYPHEN-MINUS character, to make
-+.  \" searching in man pages easier.
-+.  if '\*[.T]'utf8' \
-+.    char \- \N'45'
-+.
-+.  \" Debian: Many UTF-8 man pages use "-" instead of "\-" for dashes such
-+.  \" as those in command-line options. This is a bug in those pages, but
-+.  \" too many fonts are missing the Unicode HYPHEN character, so we render
-+.  \" this as the ASCII-compatible HYPHEN-MINUS instead.
-+.  if '\*[.T]'utf8' \
-+.    char - \N'45'
-+.\}
-+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/mdoc-local.patch b/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/mdoc-local.patch
deleted file mode 100644
index 409c1a5..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.18.1.4/mdoc-local.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-
-Upstream-Status: Inappropriate [embedded]
-
-Signed-off-by: Saul Wold <sgw@linux.intel.com>
-
-Index: groff-1.18.1.4/tmac/mdoc.local
-===================================================================
---- groff-1.18.1.4.orig/tmac/mdoc.local	2001-03-23 08:17:51.000000000 +0800
-+++ groff-1.18.1.4/tmac/mdoc.local	2010-08-24 14:20:22.014006846 +0800
-@@ -1,2 +1,26 @@
- .\" This file is loaded after doc.tmac.
- .\" Put any local modifications to doc.tmac here.
-+.
-+.if n \{\
-+.  \" Debian: Map \(oq to ' rather than ` in nroff mode for devices other
-+.  \" than utf8.
-+.  if !'\*[.T]'utf8' \
-+.    tr \[oq]'
-+.
-+.  \" Debian: Disable the use of SGR (ANSI colour) escape sequences by
-+.  \" grotty.
-+.  if '\V[GROFF_SGR]'' \
-+.    output x X tty: sgr 0
-+.
-+.  \" Debian: Map \- to the Unicode HYPHEN-MINUS character, to make
-+.  \" searching in man pages easier.
-+.  if '\*[.T]'utf8' \
-+.    char \- \N'45'
-+.
-+.  \" Debian: Many UTF-8 man pages use "-" instead of "\-" for dashes such
-+.  \" as those in command-line options. This is a bug in those pages, but
-+.  \" too many fonts are missing the Unicode HYPHEN character, so we render
-+.  \" this as the ASCII-compatible HYPHEN-MINUS instead.
-+.  if '\*[.T]'utf8' \
-+.    char - \N'45'
-+.\}
diff --git a/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.22.3/0001-replace-perl-w-with-use-warnings.patch b/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.22.3/0001-replace-perl-w-with-use-warnings.patch
new file mode 100644
index 0000000..f1db5b0
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/groff/groff-1.22.3/0001-replace-perl-w-with-use-warnings.patch
@@ -0,0 +1,102 @@
+From 5b574542070db286c89b3827e8f15ed4b3b39034 Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Thu, 6 Apr 2017 01:46:00 -0700
+Subject: [PATCH] replace "perl -w" with "use warnings"
+
+The shebang's max length is usually 128 as defined in
+/usr/include/linux/binfmts.h:
+  #define BINPRM_BUF_SIZE 128
+
+There would be errors when @PERL@ is longer than 128, use
+'/usr/bin/env perl' can fix the problem, but '/usr/bin/env perl -w'
+doesn't work:
+
+/usr/bin/env: perl -w: No such file or directory
+
+So replace "perl -w" with "use warnings" to make it work.
+
+Upstream-Status: Pending
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ font/devpdf/util/BuildFoundries.pl | 3 ++-
+ src/devices/gropdf/gropdf.pl       | 3 ++-
+ src/devices/gropdf/pdfmom.pl       | 3 ++-
+ src/utils/afmtodit/afmtodit.pl     | 3 ++-
+ 4 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/font/devpdf/util/BuildFoundries.pl b/font/devpdf/util/BuildFoundries.pl
+index 39f2f0d..a2bfd8e 100644
+--- a/font/devpdf/util/BuildFoundries.pl
++++ b/font/devpdf/util/BuildFoundries.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl -w
++#!/usr/bin/perl
+ #
+ #   BuildFoundries   : Given a Foundry file generate groff and download files
+ #   Deri James       : Monday 07 Feb 2011
+@@ -22,6 +22,7 @@
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
+ 
+ use strict;
++use warnings;
+ 
+ my $where=shift||'';
+ my $devps=shift||'../devps';
+diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
+index 035d123..b933b32 100644
+--- a/src/devices/gropdf/gropdf.pl
++++ b/src/devices/gropdf/gropdf.pl
+@@ -1,4 +1,4 @@
+-#!@PERL@ -w
++#!@PERL@
+ #
+ #	gropdf		: PDF post processor for groff
+ #
+@@ -21,6 +21,7 @@
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
+ 
+ use strict;
++use warnings;
+ use Getopt::Long qw(:config bundling);
+ use Compress::Zlib;
+ 
+diff --git a/src/devices/gropdf/pdfmom.pl b/src/devices/gropdf/pdfmom.pl
+index beec820..4b46ea4 100644
+--- a/src/devices/gropdf/pdfmom.pl
++++ b/src/devices/gropdf/pdfmom.pl
+@@ -1,4 +1,4 @@
+-#!@PERL@ -w
++#!@PERL@
+ #
+ #	pdfmom		: Frontend to run groff -mom to produce PDFs
+ #	Deri James	: Friday 16 Mar 2012
+@@ -24,6 +24,7 @@
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
+ 
+ use strict;
++use warnings;
+ use File::Temp qw/tempfile/;
+ my @cmd;
+ my $dev='pdf';
+diff --git a/src/utils/afmtodit/afmtodit.pl b/src/utils/afmtodit/afmtodit.pl
+index 4f2ce83..5c078ff 100644
+--- a/src/utils/afmtodit/afmtodit.pl
++++ b/src/utils/afmtodit/afmtodit.pl
+@@ -1,4 +1,4 @@
+-#! /usr/bin/perl -w
++#! /usr/bin/perl
+ # -*- Perl -*-
+ # Copyright (C) 1989-2014  Free Software Foundation, Inc.
+ #      Written by James Clark (jjc@jclark.com)
+@@ -19,6 +19,7 @@
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
+ 
+ use strict;
++use warnings;
+ 
+ @afmtodit.tables@
+ 
+-- 
+2.10.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/groff/groff_1.18.1.4.bb b/import-layers/yocto-poky/meta/recipes-extended/groff/groff_1.18.1.4.bb
deleted file mode 100644
index fc7eb44..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/groff/groff_1.18.1.4.bb
+++ /dev/null
@@ -1,50 +0,0 @@
-SUMMARY = "GNU Troff software"
-DESCRIPTION = "The groff (GNU troff) software is a typesetting package which reads plain text mixed with \
-formatting commands and produces formatted output."
-SECTION = "console/utils"
-HOMEPAGE = "http://www.gnu.org/software/groff/"
-LICENSE = "GPLv2"
-PR = "r1"
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=e43fc16fccd8519fba405f0a0ff6e8a3"
-
-SRC_URI = "${GNU_MIRROR}/${BPN}/old/${BP}.tar.gz \
-          file://groff-1.18.1.4-remove-mom.patch;striplevel=1 \
-          file://man-local.patch \
-          file://mdoc-local.patch \
-          file://groff-1.18.1.4-fix-bindir.patch \
-          file://fix-narrowing-conversion-error.patch \
-" 
-
-inherit autotools texinfo
-
-EXTRA_OECONF="--without-x --prefix=${D} --exec-prefix=${D} --bindir=${D}${bindir} --datadir=${D}${datadir} --mandir=${D}${datadir}/man --infodir=${D}${datadir}info --with-appresdir=${D}${datadir}"
-
-SRC_URI[md5sum] = "ceecb81533936d251ed015f40e5f7287"
-SRC_URI[sha256sum] = "ff3c7c3b6cae5e8cc5062a144de5eff0022e8e970e1774529cc2d5dde46ce50d"
-PARALLEL_MAKE = ""
-
-do_configure (){
-    oe_runconf
-}
-
-do_install_append() {
-	# Some distros have both /bin/perl and /usr/bin/perl, but we set perl location
-	# for target as /usr/bin/perl, so fix it to /usr/bin/perl.
-	for i in afmtodit mmroff; do
-		if [ -f ${D}${bindir}/$i ]; then
-			sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' ${D}${bindir}/$i
-		fi
-	done
-
-	mkdir -p ${D}${sysconfdir}/groff
-	cp -rf ${D}${datadir}/groff/site-tmac/* ${D}${sysconfdir}/groff/
-	cp -rf ${D}${datadir}/groff/site-tmac/* ${D}${datadir}/groff/${PV}/tmac/
-}
-
-pkg_postinst_${PN}() {
-	ln -s tbl $D${bindir}/gtbl
-	echo "export GROFF_FONT_PATH=/usr/share/groff/${PV}/font" >> $D${sysconfdir}/profile
-	echo "export GROFF_TMAC_PATH=/usr/share/groff/${PV}/tmac" >> $D${sysconfdir}/profile
-}
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/groff/groff_1.22.3.bb b/import-layers/yocto-poky/meta/recipes-extended/groff/groff_1.22.3.bb
index dd241f3..7472f59 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/groff/groff_1.22.3.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/groff/groff_1.22.3.bb
@@ -10,6 +10,7 @@
 SRC_URI = "${GNU_MIRROR}/groff/groff-${PV}.tar.gz \
 	file://groff-1.22.2-correct-man.local-install-path.patch \
 	file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
+	file://0001-replace-perl-w-with-use-warnings.patch \
 "
 
 SRC_URI[md5sum] = "cc825fa64bc7306a885f2fb2268d3ec5"
@@ -24,6 +25,8 @@
 EXTRA_OECONF = "--without-x"
 PARALLEL_MAKE = ""
 
+CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'"
+
 do_configure_prepend() {
 	if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
 		sed -i \
diff --git a/import-layers/yocto-poky/meta/recipes-extended/gzip/gzip-1.3.12/dup-def-fix.patch b/import-layers/yocto-poky/meta/recipes-extended/gzip/gzip-1.3.12/dup-def-fix.patch
deleted file mode 100644
index d9e8d21..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/gzip/gzip-1.3.12/dup-def-fix.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-gzip uses gnulib, whose header conflict with glibc. This patch rename some function to avoid conflict.
-
-Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
-
-Upstream-Status: Inappropriate [licensing]
-
-Index: gzip-1.3.12/gzip.c
-===================================================================
---- gzip-1.3.12.orig/gzip.c	2010-08-13 10:29:38.000000000 +0800
-+++ gzip-1.3.12/gzip.c	2010-08-13 10:29:44.000000000 +0800
-@@ -1637,7 +1637,7 @@
- 	}
-       }
- 
--    if (futimens (ofd, ofname, timespec) != 0)
-+    if (futimens_gnulib (ofd, ofname, timespec) != 0)
-       {
- 	int e = errno;
- 	WARN ((stderr, "%s: ", program_name));
-Index: gzip-1.3.12/lib/utimens.c
-===================================================================
---- gzip-1.3.12.orig/lib/utimens.c	2010-08-13 10:33:47.000000000 +0800
-+++ gzip-1.3.12/lib/utimens.c	2010-08-13 10:34:02.000000000 +0800
-@@ -75,7 +75,7 @@
-    Return 0 on success, -1 (setting errno) on failure.  */
- 
- int
--futimens (int fd ATTRIBUTE_UNUSED,
-+futimens_gnulib (int fd ATTRIBUTE_UNUSED,
- 	  char const *file, struct timespec const timespec[2])
- {
-   /* Some Linux-based NFS clients are buggy, and mishandle time stamps
-@@ -185,5 +185,5 @@
- int
- utimens (char const *file, struct timespec const timespec[2])
- {
--  return futimens (-1, file, timespec);
-+  return futimens_gnulib (-1, file, timespec);
- }
-Index: gzip-1.3.12/lib/utimens.h
-===================================================================
---- gzip-1.3.12.orig/lib/utimens.h	2010-08-13 10:14:57.000000000 +0800
-+++ gzip-1.3.12/lib/utimens.h	2010-08-13 10:21:45.000000000 +0800
-@@ -1,3 +1,3 @@
- #include <time.h>
--int futimens (int, char const *, struct timespec const [2]);
-+int futimens_gnulib (int, char const *, struct timespec const [2]);
- int utimens (char const *, struct timespec const [2]);
diff --git a/import-layers/yocto-poky/meta/recipes-extended/gzip/gzip-1.3.12/m4-extensions-fix.patch b/import-layers/yocto-poky/meta/recipes-extended/gzip/gzip-1.3.12/m4-extensions-fix.patch
deleted file mode 100644
index 6b2f698..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/gzip/gzip-1.3.12/m4-extensions-fix.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-remove AC_USE_SYSTEM_EXTENSIONS to fix the autoconf error "AC_REQUIRE: circular
-dependency of AC_GNU_SOURCE"
-
-Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
-
-Upstream-Status: Inappropriate [licensing]
-
-Index: gzip-1.3.12/m4/extensions.m4
-===================================================================
---- gzip-1.3.12.orig/m4/extensions.m4	2010-08-16 14:18:16.000000000 +0800
-+++ gzip-1.3.12/m4/extensions.m4	2010-08-16 14:21:54.000000000 +0800
-@@ -12,44 +12,6 @@
- # enough in this area it's likely we'll need to redefine
- # AC_USE_SYSTEM_EXTENSIONS for quite some time.
- 
--# AC_USE_SYSTEM_EXTENSIONS
--# ------------------------
--# Enable extensions on systems that normally disable them,
--# typically due to standards-conformance issues.
--AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
--[
--  AC_BEFORE([$0], [AC_COMPILE_IFELSE])
--  AC_BEFORE([$0], [AC_RUN_IFELSE])
--
--  AC_REQUIRE([AC_GNU_SOURCE])
--  AC_REQUIRE([AC_AIX])
--  AC_REQUIRE([AC_MINIX])
--
--  AH_VERBATIM([__EXTENSIONS__],
--[/* Enable extensions on Solaris.  */
--#ifndef __EXTENSIONS__
--# undef __EXTENSIONS__
--#endif
--#ifndef _POSIX_PTHREAD_SEMANTICS
--# undef _POSIX_PTHREAD_SEMANTICS
--#endif
--#ifndef _TANDEM_SOURCE
--# undef _TANDEM_SOURCE
--#endif])
--  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
--    [ac_cv_safe_to_define___extensions__],
--    [AC_COMPILE_IFELSE(
--       [AC_LANG_PROGRAM([
--#	  define __EXTENSIONS__ 1
--	  AC_INCLUDES_DEFAULT])],
--       [ac_cv_safe_to_define___extensions__=yes],
--       [ac_cv_safe_to_define___extensions__=no])])
--  test $ac_cv_safe_to_define___extensions__ = yes &&
--    AC_DEFINE([__EXTENSIONS__])
--  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
--  AC_DEFINE([_TANDEM_SOURCE])
--])
--
- # gl_USE_SYSTEM_EXTENSIONS
- # ------------------------
- # Enable extensions on systems that normally disable them,
diff --git a/import-layers/yocto-poky/meta/recipes-extended/gzip/gzip_1.3.12.bb b/import-layers/yocto-poky/meta/recipes-extended/gzip/gzip_1.3.12.bb
deleted file mode 100644
index e406282..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/gzip/gzip_1.3.12.bb
+++ /dev/null
@@ -1,15 +0,0 @@
-require gzip.inc
-
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
-                    file://gzip.h;endline=22;md5=c0934ad1900d927f86556153d4c76d23 \
-                    file://lzw.h;endline=19;md5=c273e09a02edd9801cc74d39683049e9 "
-
-SRC_URI = "${GNU_MIRROR}/gzip/gzip-${PV}.tar.gz \
-           file://m4-extensions-fix.patch \
-           file://dup-def-fix.patch"
-
-SRC_URI[md5sum] = "b5bac2d21840ae077e0217bc5e4845b1"
-SRC_URI[sha256sum] = "3f565be05f7f3d1aff117c030eb7c738300510b7d098cedea796ca8e4cd587af"
-
-PR = "r2"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/gzip/gzip_1.8.bb b/import-layers/yocto-poky/meta/recipes-extended/gzip/gzip_1.8.bb
index a19b965..11be846 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/gzip/gzip_1.8.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/gzip/gzip_1.8.bb
@@ -9,7 +9,6 @@
                     file://gzip.h;beginline=8;endline=20;md5=6e47caaa630e0c8bf9f1bc8d94a8ed0e"
 
 PROVIDES_append_class-native = " gzip-replacement-native"
-NATIVE_PACKAGE_PATH_SUFFIX = "/${PN}"
 
 BBCLASSEXTEND = "native"
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/hdparm/hdparm_9.48.bb b/import-layers/yocto-poky/meta/recipes-extended/hdparm/hdparm_9.51.bb
similarity index 81%
rename from import-layers/yocto-poky/meta/recipes-extended/hdparm/hdparm_9.48.bb
rename to import-layers/yocto-poky/meta/recipes-extended/hdparm/hdparm_9.51.bb
index cd85776..fa00927 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/hdparm/hdparm_9.48.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/hdparm/hdparm_9.51.bb
@@ -20,12 +20,12 @@
 
 RDEPENDS_wiper = "bash gawk stat"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/hdparm/${BP}.tar.gz "
+SRC_URI = "${SOURCEFORGE_MIRROR}/hdparm/${BP}.tar.gz"
 
-SRC_URI[md5sum] = "213efdbe7471fad3408198918e164354"
-SRC_URI[sha256sum] = "ce97b4a71cb04146f54cf6f69787e7f97ddfda9836dc803b459d3b3df3a4fbee"
+SRC_URI[md5sum] = "8fe0a71db02f7ffc602d14a69f766cff"
+SRC_URI[sha256sum] = "1afad8891ecbe644c283f7d725157660ebf8bd5b4d9d67232afd45f83d2d5d91"
 
-EXTRA_OEMAKE = '-e MAKEFLAGS= STRIP="echo"'
+EXTRA_OEMAKE = 'STRIP="echo" LDFLAGS="${LDFLAGS}"'
 
 inherit update-alternatives
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/images/core-image-lsb-sdk.bb b/import-layers/yocto-poky/meta/recipes-extended/images/core-image-lsb-sdk.bb
index c3b6e7c..a3d602e 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/images/core-image-lsb-sdk.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/images/core-image-lsb-sdk.bb
@@ -7,3 +7,6 @@
 IMAGE_FEATURES += "tools-sdk dev-pkgs tools-debug eclipse-debug tools-profile tools-testapps debug-tweaks"
 
 IMAGE_INSTALL += "kernel-devsrc"
+
+# Reduce this to try and keep below the 4GB image size for now
+IMAGE_OVERHEAD_FACTOR = "1.2"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/iptables/iptables/0001-configure-Add-option-to-enable-disable-libnfnetlink.patch b/import-layers/yocto-poky/meta/recipes-extended/iptables/iptables/0001-configure-Add-option-to-enable-disable-libnfnetlink.patch
index b711b7a..03c36cc 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/iptables/iptables/0001-configure-Add-option-to-enable-disable-libnfnetlink.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/iptables/iptables/0001-configure-Add-option-to-enable-disable-libnfnetlink.patch
@@ -1,4 +1,7 @@
-[PATCH] configure: Add option to enable/disable libnfnetlink
+From c46db7c2e1f63ec525835553587e70c635565310 Mon Sep 17 00:00:00 2001
+From: "Maxin B. John" <maxin.john@intel.com>
+Date: Tue, 21 Feb 2017 11:16:31 +0200
+Subject: [PATCH] configure: Add option to enable/disable libnfnetlink
 
 This changes the configure behaviour from autodetecting
 for libnfnetlink to having an option to disable it explicitly
@@ -8,20 +11,24 @@
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 Signed-off-by: Maxin B. John <maxin.john@intel.com>
 ---
-diff -Naur iptables-1.6.0-old/configure.ac iptables-1.6.0/configure.ac
---- iptables-1.6.0-old/configure.ac	2015-12-28 18:40:35.255417976 +0200
-+++ iptables-1.6.0/configure.ac	2015-12-29 13:01:12.388840200 +0200
-@@ -63,6 +63,9 @@
+ configure.ac | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index eda7871..03ddc50 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -63,6 +63,9 @@ AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
  AC_ARG_ENABLE([nftables],
  	AS_HELP_STRING([--disable-nftables], [Do not build nftables compat]),
  	[enable_nftables="$enableval"], [enable_nftables="yes"])
 +AC_ARG_ENABLE([libnfnetlink],
 +    AS_HELP_STRING([--disable-libnfnetlink], [Do not use netfilter netlink library]),
 +    [enable_libnfnetlink="$enableval"], [enable_libnfnetlink="yes"])
- 
- libiptc_LDFLAGS2="";
- AX_CHECK_LINKER_FLAGS([-Wl,--no-as-needed],
-@@ -123,9 +126,10 @@
+ AC_ARG_ENABLE([connlabel],
+ 	AS_HELP_STRING([--disable-connlabel],
+ 	[Do not build libnetfilter_conntrack]),
+@@ -115,9 +118,10 @@ if test "x$enable_bpfc" = "xyes" || test "x$enable_nfsynproxy" = "xyes"; then
  	AC_CHECK_LIB(pcap, pcap_compile,, AC_MSG_ERROR(missing libpcap library required by bpf compiler or nfsynproxy tool))
  fi
  
@@ -35,3 +42,6 @@
  
  if test "x$enable_nftables" = "xyes"; then
  	PKG_CHECK_MODULES([libmnl], [libmnl >= 1.0], [mnl=1], [mnl=0])
+-- 
+2.4.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/iptables/iptables/0002-configure.ac-only-check-conntrack-when-libnfnetlink-enabled.patch b/import-layers/yocto-poky/meta/recipes-extended/iptables/iptables/0002-configure.ac-only-check-conntrack-when-libnfnetlink-enabled.patch
index 89ad8f6..7842c64 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/iptables/iptables/0002-configure.ac-only-check-conntrack-when-libnfnetlink-enabled.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/iptables/iptables/0002-configure.ac-only-check-conntrack-when-libnfnetlink-enabled.patch
@@ -1,34 +1,51 @@
+From 26090b3dbcdf6a11e60535da949b726a6e86426d Mon Sep 17 00:00:00 2001
+From: "Maxin B. John" <maxin.john@intel.com>
+Date: Tue, 21 Feb 2017 11:49:07 +0200
+Subject: [PATCH] configure.ac:
+ only-check-conntrack-when-libnfnetlink-enabled.patch
+
 Package libnetfilter-conntrack depends on package libnfnetlink. iptables
 checks package libnetfilter-conntrack whatever its package config
 libnfnetlink is enabled or not. When libnfnetlink is disabled but
 package libnetfilter-conntrack exists, it fails randomly with:
 
-| In file included from .../iptables/1.4.21-r0/iptables-1.4.21/extensions/libxt_connlabel.c:8:0:
-| .../tmp/sysroots/qemumips/usr/include/libnetfilter_conntrack/libnetfilter_conntrack.h:14:42: fatal error: libnfnetlink/linux_nfnetlink.h: No such file or directory
-| compilation terminated.
-| GNUmakefile:96: recipe for target 'libxt_connlabel.oo' failed
+In file included from
+.../iptables/1.4.21-r0/iptables-1.4.21/extensions/libxt_connlabel.c:8:0:
 
+.../tmp/sysroots/qemumips/usr/include/libnetfilter_conntrack/libnetfilter_conntrack.h:14:42:
+fatal error: libnfnetlink/linux_nfnetlink.h: No such file or directory
+
+compilation terminated.
+GNUmakefile:96: recipe for target 'libxt_connlabel.oo' failed
 Only check libnetfilter-conntrack when libnfnetlink is enabled to fix it.
 
 Upstream-Status: Pending
 
 Signed-off-by: Kai Kang <kai.kang@windriver.com>
+Signed-off-by: Maxin B. John <maxin.john@intel.com>
+---
+ configure.ac | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/configure.ac b/configure.ac
-index 5d7e62b..e331ee7 100644
+index 03ddc50..523caea 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -88,8 +88,12 @@ if test "$ac_cv_header_linux_ip_vs_h" != "yes"; then
- 	blacklist_modules="$blacklist_modules ipvs";
- fi;
+@@ -172,10 +172,12 @@ if test "$nftables" != 1; then
+ fi
  
--PKG_CHECK_MODULES([libnetfilter_conntrack], [libnetfilter_conntrack >= 1.0.4],
-+nfconntrack=0
-+AS_IF([test "x$enable_libnfnetlink" = "xyes"], [
-+  PKG_CHECK_MODULES([libnetfilter_conntrack], [libnetfilter_conntrack >= 1.0.4],
- 	[nfconntrack=1], [nfconntrack=0])
-+  ])
-+
- AM_CONDITIONAL([HAVE_LIBNETFILTER_CONNTRACK], [test "$nfconntrack" = 1])
- 
- if test "$nfconntrack" -ne 1; then
+ if test "x$enable_connlabel" = "xyes"; then
+-	PKG_CHECK_MODULES([libnetfilter_conntrack],
++    nfconntrack=0
++    AS_IF([test "x$enable_libnfnetlink" = "xyes"], [
++    PKG_CHECK_MODULES([libnetfilter_conntrack],
+ 		[libnetfilter_conntrack >= 1.0.6],
+ 		[nfconntrack=1], [nfconntrack=0])
+-
++    ])
+ 	if test "$nfconntrack" -ne 1; then
+ 		blacklist_modules="$blacklist_modules connlabel";
+ 		echo "WARNING: libnetfilter_conntrack not found, connlabel match will not be built";
+-- 
+2.4.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/iptables/iptables_1.6.0.bb b/import-layers/yocto-poky/meta/recipes-extended/iptables/iptables_1.6.1.bb
similarity index 85%
rename from import-layers/yocto-poky/meta/recipes-extended/iptables/iptables_1.6.0.bb
rename to import-layers/yocto-poky/meta/recipes-extended/iptables/iptables_1.6.1.bb
index fbbe418..b37c55a 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/iptables/iptables_1.6.0.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/iptables/iptables_1.6.1.bb
@@ -22,18 +22,17 @@
            file://types.h-add-defines-that-are-required-for-if_packet.patch \
            file://0001-configure-Add-option-to-enable-disable-libnfnetlink.patch \
            file://0002-configure.ac-only-check-conntrack-when-libnfnetlink-enabled.patch \
-          "
-SRC_URI_append_libc-musl = " file://0001-fix-build-with-musl.patch"
+           file://0001-fix-build-with-musl.patch \
+"
 
-SRC_URI[md5sum] = "27ba3451cb622467fc9267a176f19a31"
-SRC_URI[sha256sum] = "4bb72a0a0b18b5a9e79e87631ddc4084528e5df236bc7624472dcaa8480f1c60"
+SRC_URI[md5sum] = "ab38a33806b6182c6f53d6afb4619add"
+SRC_URI[sha256sum] = "0fc2d7bd5d7be11311726466789d4c65fb4c8e096c9182b56ce97440864f0cf5"
 
 inherit autotools pkgconfig
 
 EXTRA_OECONF = "--with-kernel=${STAGING_INCDIR} \
                "
-PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'ipv6', '', d)} \
-                 "
+PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
 
 PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/iputils/iputils_s20151218.bb b/import-layers/yocto-poky/meta/recipes-extended/iputils/iputils_s20151218.bb
index 7150454..0d4dd1b 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/iputils/iputils_s20151218.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/iputils/iputils_s20151218.bb
@@ -11,7 +11,7 @@
                     file://arping.c;beginline=1;endline=11;md5=fe84301b5c2655c950f8b92a057fafa6 \
                     file://tftpd.c;beginline=1;endline=32;md5=28834bf8a91a5b8a92755dbee709ef96 "
 
-DEPENDS = "gnutls docbook-utils-native sgmlspl-native libcap libgcrypt"
+DEPENDS = "gnutls libcap libgcrypt"
 
 
 SRC_URI = "http://www.skbuff.net/iputils/${BPN}-${PV}.tar.bz2 \
@@ -30,11 +30,11 @@
 EXTRA_OEMAKE = "-e MAKEFLAGS="
 
 do_compile () {
-	oe_runmake 'CC=${CC} -D_GNU_SOURCE' VPATH="${STAGING_LIBDIR}:${STAGING_DIR_HOST}/${base_libdir}" all man
+	oe_runmake 'CC=${CC} -D_GNU_SOURCE' VPATH="${STAGING_LIBDIR}:${STAGING_DIR_HOST}/${base_libdir}" all
 }
 
 do_install () {
-	install -m 0755 -d ${D}${base_bindir} ${D}${mandir}/man8
+	install -m 0755 -d ${D}${base_bindir}
 	# SUID root programs
 	install -m 4555 ping ${D}${base_bindir}/ping
 	install -m 4555 ping6 ${D}${base_bindir}/ping6
@@ -44,10 +44,6 @@
 	for i in arping tracepath tracepath6; do
 	  install -m 0755 $i ${D}${base_bindir}/
 	done
-	# Manual pages for things we build packages for
-	for i in tracepath.8 traceroute6.8 ping.8 arping.8; do
-	  install -m 0644 doc/$i ${D}${mandir}/man8/ || true
-	done
 }
 
 inherit update-alternatives
@@ -73,4 +69,3 @@
 FILES_${PN}-tracepath6 = "${base_bindir}/tracepath6"
 FILES_${PN}-traceroute6	= "${base_bindir}/traceroute6"
 FILES_${PN}-clockdiff = "${base_bindir}/clockdiff"
-FILES_${PN}-doc	= "${mandir}/man8"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/less/less_481.bb b/import-layers/yocto-poky/meta/recipes-extended/less/less_487.bb
similarity index 83%
rename from import-layers/yocto-poky/meta/recipes-extended/less/less_481.bb
rename to import-layers/yocto-poky/meta/recipes-extended/less/less_487.bb
index 0fcd819..23ae484 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/less/less_481.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/less/less_487.bb
@@ -21,14 +21,14 @@
 
 LICENSE = "GPLv3+ | BSD-2-Clause"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
-                    file://LICENSE;md5=48c26a307f91af700e1f00585f215aaf"
+                    file://LICENSE;md5=2ef3e4b8dafc85612bc5254b8081e234"
 DEPENDS = "ncurses"
 
 SRC_URI = "http://www.greenwoodsoftware.com/${BPN}/${BPN}-${PV}.tar.gz \
 	  "
 
-SRC_URI[md5sum] = "50ef46065c65257141a7340123527767"
-SRC_URI[sha256sum] = "3fa38f2cf5e9e040bb44fffaa6c76a84506e379e47f5a04686ab78102090dda5"
+SRC_URI[md5sum] = "dcc8bf183a83b362d37fe9ef8df1fb60"
+SRC_URI[sha256sum] = "f3dc8455cb0b2b66e0c6b816c00197a71bf6d1787078adeee0bcf2aea4b12706"
 
 UPSTREAM_CHECK_URI = "http://www.greenwoodsoftware.com/less/download.html"
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/libarchive/files/0001-archive_write_disk_posix.c-make-_fsobj-functions-mor.patch b/import-layers/yocto-poky/meta/recipes-extended/libarchive/files/0001-archive_write_disk_posix.c-make-_fsobj-functions-mor.patch
new file mode 100644
index 0000000..e911a7c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/libarchive/files/0001-archive_write_disk_posix.c-make-_fsobj-functions-mor.patch
@@ -0,0 +1,245 @@
+From 90881d24d3f6d5fb207e97df3b91bbea8598e84e Mon Sep 17 00:00:00 2001
+From: Martin Matuska <martin@matuska.org>
+Date: Tue, 29 Nov 2016 16:47:37 +0100
+Subject: [PATCH 1/2] archive_write_disk_posix.c: make *_fsobj functions more
+ readable
+
+Upstream-Status: Backported
+
+Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
+---
+ libarchive/archive_write_disk_posix.c | 121 +++++++++++++++++-----------------
+ 1 file changed, 61 insertions(+), 60 deletions(-)
+
+diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c
+index 17c23b0..d786bc2 100644
+--- a/libarchive/archive_write_disk_posix.c
++++ b/libarchive/archive_write_disk_posix.c
+@@ -336,6 +336,8 @@ struct archive_write_disk {
+ 
+ #define HFS_BLOCKS(s)	((s) >> 12)
+ 
++static void	fsobj_error(int *, struct archive_string *, int, const char *,
++		    const char *);
+ static int	check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags);
+ static int	check_symlinks(struct archive_write_disk *);
+ static int	create_filesystem_object(struct archive_write_disk *);
+@@ -2005,8 +2007,9 @@ restore_entry(struct archive_write_disk *a)
+ 
+ 	if (en) {
+ 		/* Everything failed; give up here. */
+-		archive_set_error(&a->archive, en, "Can't create '%s'",
+-		    a->name);
++		if ((&a->archive)->error == NULL)
++			archive_set_error(&a->archive, en, "Can't create '%s'",
++			    a->name);
+ 		return (ARCHIVE_FAILED);
+ 	}
+ 
+@@ -2388,6 +2391,17 @@ current_fixup(struct archive_write_disk *a, const char *pathname)
+ 	return (a->current_fixup);
+ }
+ 
++/* Error helper for new *_fsobj functions */
++static void
++fsobj_error(int *a_eno, struct archive_string *a_estr,
++    int err, const char *errstr, const char *path)
++{
++	if (a_eno)
++		*a_eno = err;
++	if (a_estr)
++		archive_string_sprintf(a_estr, errstr, path);
++}
++
+ /*
+  * TODO: Someday, integrate this with the deep dir support; they both
+  * scan the path and both can be optimized by comparing against other
+@@ -2400,7 +2414,7 @@ current_fixup(struct archive_write_disk *a, const char *pathname)
+  * ARCHIVE_OK if there are none, otherwise puts an error in errmsg.
+  */
+ static int
+-check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags)
++check_symlinks_fsobj(char *path, int *a_eno, struct archive_string *a_estr, int flags)
+ {
+ #if !defined(HAVE_LSTAT)
+ 	/* Platform doesn't have lstat, so we can't look for symlinks. */
+@@ -2474,19 +2488,20 @@ check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error
+ 			if (errno == ENOENT) {
+ 				break;
+ 			} else {
+-				/* Treat any other error as fatal - best to be paranoid here
+-				 * Note: This effectively disables deep directory
+-				 * support when security checks are enabled.
+-				 * Otherwise, very long pathnames that trigger
+-				 * an error here could evade the sandbox.
+-				 * TODO: We could do better, but it would probably
+-				 * require merging the symlink checks with the
+-				 * deep-directory editing. */
+-				if (error_number) *error_number = errno;
+-				if (error_string)
+-					archive_string_sprintf(error_string,
+-							"Could not stat %s",
+-							path);
++				/*
++				 * Treat any other error as fatal - best to be
++				 * paranoid here.
++				 * Note: This effectively disables deep
++				 * directory support when security checks are
++				 * enabled. Otherwise, very long pathnames that
++				 * trigger an error here could evade the
++				 * sandbox.
++				 * TODO: We could do better, but it would
++				 * probably require merging the symlink checks
++				 * with the deep-directory editing.
++				 */
++				fsobj_error(a_eno, a_estr, errno,
++				    "Could not stat %s", path);
+ 				res = ARCHIVE_FAILED;
+ 				break;
+ 			}
+@@ -2494,11 +2509,8 @@ check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error
+ 			if (!last) {
+ 				if (chdir(head) != 0) {
+ 					tail[0] = c;
+-					if (error_number) *error_number = errno;
+-					if (error_string)
+-						archive_string_sprintf(error_string,
+-								"Could not chdir %s",
+-								path);
++					fsobj_error(a_eno, a_estr, errno,
++					    "Could not chdir %s", path);
+ 					res = (ARCHIVE_FATAL);
+ 					break;
+ 				}
+@@ -2514,11 +2526,9 @@ check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error
+ 				 */
+ 				if (unlink(head)) {
+ 					tail[0] = c;
+-					if (error_number) *error_number = errno;
+-					if (error_string)
+-						archive_string_sprintf(error_string,
+-								"Could not remove symlink %s",
+-								path);
++					fsobj_error(a_eno, a_estr, errno,
++					    "Could not remove symlink %s",
++					    path);
+ 					res = ARCHIVE_FAILED;
+ 					break;
+ 				}
+@@ -2529,13 +2539,14 @@ check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error
+ 				 * symlink with another symlink.
+ 				 */
+ 				tail[0] = c;
+-				/* FIXME:  not sure how important this is to restore
++				/*
++				 * FIXME:  not sure how important this is to
++				 * restore
++				 */
++				/*
+ 				if (!S_ISLNK(path)) {
+-					if (error_number) *error_number = 0;
+-					if (error_string)
+-						archive_string_sprintf(error_string,
+-								"Removing symlink %s",
+-								path);
++					fsobj_error(a_eno, a_estr, 0,
++					    "Removing symlink %s", path);
+ 				}
+ 				*/
+ 				/* Symlink gone.  No more problem! */
+@@ -2545,22 +2556,17 @@ check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error
+ 				/* User asked us to remove problems. */
+ 				if (unlink(head) != 0) {
+ 					tail[0] = c;
+-					if (error_number) *error_number = 0;
+-					if (error_string)
+-						archive_string_sprintf(error_string,
+-								"Cannot remove intervening symlink %s",
+-								path);
++					fsobj_error(a_eno, a_estr, 0,
++					    "Cannot remove intervening "
++					    "symlink %s", path);
+ 					res = ARCHIVE_FAILED;
+ 					break;
+ 				}
+ 				tail[0] = c;
+ 			} else {
+ 				tail[0] = c;
+-				if (error_number) *error_number = 0;
+-				if (error_string)
+-					archive_string_sprintf(error_string,
+-							"Cannot extract through symlink %s",
+-							path);
++				fsobj_error(a_eno, a_estr, 0,
++				    "Cannot extract through symlink %s", path);
+ 				res = ARCHIVE_FAILED;
+ 				break;
+ 			}
+@@ -2577,10 +2583,8 @@ check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error
+ 	if (restore_pwd >= 0) {
+ 		r = fchdir(restore_pwd);
+ 		if (r != 0) {
+-			if(error_number) *error_number = errno;
+-			if(error_string)
+-				archive_string_sprintf(error_string,
+-						"chdir() failure");
++			fsobj_error(a_eno, a_estr, errno,
++			    "chdir() failure", "");
+ 		}
+ 		close(restore_pwd);
+ 		restore_pwd = -1;
+@@ -2688,17 +2692,16 @@ cleanup_pathname_win(struct archive_write_disk *a)
+  * is set) if the path is absolute.
+  */
+ static int
+-cleanup_pathname_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags)
++cleanup_pathname_fsobj(char *path, int *a_eno, struct archive_string *a_estr,
++    int flags)
+ {
+ 	char *dest, *src;
+ 	char separator = '\0';
+ 
+ 	dest = src = path;
+ 	if (*src == '\0') {
+-		if (error_number) *error_number = ARCHIVE_ERRNO_MISC;
+-		if (error_string)
+-		    archive_string_sprintf(error_string,
+-			    "Invalid empty pathname");
++		fsobj_error(a_eno, a_estr, ARCHIVE_ERRNO_MISC,
++		    "Invalid empty ", "pathname");
+ 		return (ARCHIVE_FAILED);
+ 	}
+ 
+@@ -2708,10 +2711,8 @@ cleanup_pathname_fsobj(char *path, int *error_number, struct archive_string *err
+ 	/* Skip leading '/'. */
+ 	if (*src == '/') {
+ 		if (flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) {
+-			if (error_number) *error_number = ARCHIVE_ERRNO_MISC;
+-			if (error_string)
+-			    archive_string_sprintf(error_string,
+-				    "Path is absolute");
++			fsobj_error(a_eno, a_estr, ARCHIVE_ERRNO_MISC,
++			    "Path is ", "absolute");
+ 			return (ARCHIVE_FAILED);
+ 		}
+ 
+@@ -2738,11 +2739,11 @@ cleanup_pathname_fsobj(char *path, int *error_number, struct archive_string *err
+ 			} else if (src[1] == '.') {
+ 				if (src[2] == '/' || src[2] == '\0') {
+ 					/* Conditionally warn about '..' */
+-					if (flags & ARCHIVE_EXTRACT_SECURE_NODOTDOT) {
+-						if (error_number) *error_number = ARCHIVE_ERRNO_MISC;
+-						if (error_string)
+-						    archive_string_sprintf(error_string,
+-							    "Path contains '..'");
++					if (flags
++					    & ARCHIVE_EXTRACT_SECURE_NODOTDOT) {
++						fsobj_error(a_eno, a_estr,
++						    ARCHIVE_ERRNO_MISC,
++						    "Path contains ", "'..'");
+ 						return (ARCHIVE_FAILED);
+ 					}
+ 				}
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/libarchive/files/0002-Fix-extracting-hardlinks-over-symlinks.patch b/import-layers/yocto-poky/meta/recipes-extended/libarchive/files/0002-Fix-extracting-hardlinks-over-symlinks.patch
new file mode 100644
index 0000000..3741863
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/libarchive/files/0002-Fix-extracting-hardlinks-over-symlinks.patch
@@ -0,0 +1,120 @@
+From ece28103885a079a129a23c5001252a1648517af Mon Sep 17 00:00:00 2001
+From: Martin Matuska <martin@matuska.org>
+Date: Tue, 29 Nov 2016 16:55:41 +0100
+Subject: [PATCH 2/2] Fix extracting hardlinks over symlinks
+
+Closes #821
+
+Upstream-Status: Backported
+
+Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
+---
+ libarchive/archive_write_disk_posix.c | 43 +++++++++++++++++++++++++++++++++++
+ tar/test/test_symlink_dir.c           | 18 ++++++++++++++-
+ 2 files changed, 60 insertions(+), 1 deletion(-)
+
+diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c
+index d786bc2..80b03cd 100644
+--- a/libarchive/archive_write_disk_posix.c
++++ b/libarchive/archive_write_disk_posix.c
+@@ -2563,6 +2563,49 @@ check_symlinks_fsobj(char *path, int *a_eno, struct archive_string *a_estr, int
+ 					break;
+ 				}
+ 				tail[0] = c;
++			} else if ((flags &
++			    ARCHIVE_EXTRACT_SECURE_SYMLINKS) == 0) {
++				/*
++				 * We are not the last element and we want to
++				 * follow symlinks if they are a directory.
++				 * 
++				 * This is needed to extract hardlinks over
++				 * symlinks.
++				 */
++				r = stat(head, &st);
++				if (r != 0) {
++					tail[0] = c;
++					if (errno == ENOENT) {
++						break;
++					} else {
++						fsobj_error(a_eno, a_estr,
++						    errno,
++						    "Could not stat %s", path);
++						res = (ARCHIVE_FAILED);
++						break;
++					}
++				} else if (S_ISDIR(st.st_mode)) {
++					if (chdir(head) != 0) {
++						tail[0] = c;
++						fsobj_error(a_eno, a_estr,
++						    errno,
++						    "Could not chdir %s", path);
++						res = (ARCHIVE_FATAL);
++						break;
++					}
++					/*
++					 * Our view is now from inside
++					 * this dir:
++					 */
++					head = tail + 1;
++				} else {
++					tail[0] = c;
++					fsobj_error(a_eno, a_estr, 0,
++					    "Cannot extract through "
++					    "symlink %s", path);
++					res = ARCHIVE_FAILED;
++					break;
++				}
+ 			} else {
+ 				tail[0] = c;
+ 				fsobj_error(a_eno, a_estr, 0,
+diff --git a/tar/test/test_symlink_dir.c b/tar/test/test_symlink_dir.c
+index 25bd8b1..852e00b 100644
+--- a/tar/test/test_symlink_dir.c
++++ b/tar/test/test_symlink_dir.c
+@@ -47,11 +47,18 @@ DEFINE_TEST(test_symlink_dir)
+ 	assertMakeDir("source/dir3", 0755);
+ 	assertMakeDir("source/dir3/d3", 0755);
+ 	assertMakeFile("source/dir3/f3", 0755, "abcde");
++	assertMakeDir("source/dir4", 0755);
++	assertMakeFile("source/dir4/file3", 0755, "abcdef");
++	assertMakeHardlink("source/dir4/file4", "source/dir4/file3");
+ 
+ 	assertEqualInt(0,
+ 	    systemf("%s -cf test.tar -C source dir dir2 dir3 file file2",
+ 		testprog));
+ 
++	/* Second archive with hardlinks */
++	assertEqualInt(0,
++	    systemf("%s -cf test2.tar -C source dir4", testprog));
++
+ 	/*
+ 	 * Extract with -x and without -P.
+ 	 */
+@@ -118,9 +125,15 @@ DEFINE_TEST(test_symlink_dir)
+ 		assertMakeSymlink("dest2/file2", "real_file2");
+ 	assertEqualInt(0, systemf("%s -xPf test.tar -C dest2", testprog));
+ 
+-	/* dest2/dir symlink should be followed */
++	/* "dir4" is a symlink to existing "real_dir" */
++	if (canSymlink())
++		assertMakeSymlink("dest2/dir4", "real_dir");
++	assertEqualInt(0, systemf("%s -xPf test2.tar -C dest2", testprog));
++
++	/* dest2/dir and dest2/dir4 symlinks should be followed */
+ 	if (canSymlink()) {
+ 		assertIsSymlink("dest2/dir", "real_dir");
++		assertIsSymlink("dest2/dir4", "real_dir");
+ 		assertIsDir("dest2/real_dir", -1);
+ 	}
+ 
+@@ -141,4 +154,7 @@ DEFINE_TEST(test_symlink_dir)
+ 	/* dest2/file2 symlink should be removed */
+ 	failure("Symlink to non-existing file should be removed");
+ 	assertIsReg("dest2/file2", -1);
++
++	/* dest2/dir4/file3 and dest2/dir4/file4 should be hard links */
++	assertIsHardlink("dest2/dir4/file3", "dest2/dir4/file4");
+ }
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/libarchive/files/non-recursive-extract-and-list.patch b/import-layers/yocto-poky/meta/recipes-extended/libarchive/files/non-recursive-extract-and-list.patch
new file mode 100644
index 0000000..61f8f3e
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/libarchive/files/non-recursive-extract-and-list.patch
@@ -0,0 +1,153 @@
+From d6271709d2deb980804f92e75f9b5cb600dc42ed Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Mon, 24 Oct 2016 12:54:48 +0200
+Subject: [PATCH 1/2] non-recursive extract and list
+
+Sometimes it makes sense to extract or list a directory contained in
+an archive without also doing the same for the content of the
+directory, i.e. allowing -n (= --no-recursion) in combination with the
+x and t modes.
+
+bsdtar uses the match functionality in libarchive to track include
+matches. A new libarchive API call
+archive_match_include_directories_recursively() gets introduced to
+influence the matching behavior, with the default behavior as before.
+
+Non-recursive matching can be achieved by anchoring the path match at
+both start and end. Asking for a directory which itself isn't in the
+archive when in non-recursive mode is an error and handled by the
+existing mechanism for tracking unused inclusion entries.
+
+Upstream-Status: Submitted [https://github.com/libarchive/libarchive/pull/812]
+
+Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
+
+---
+ libarchive/archive.h       |  2 ++
+ libarchive/archive_match.c | 30 +++++++++++++++++++++++++++++-
+ tar/bsdtar.1               |  3 +--
+ tar/bsdtar.c               | 12 ++++++++++--
+ 4 files changed, 42 insertions(+), 5 deletions(-)
+
+diff --git a/libarchive/archive.h b/libarchive/archive.h
+index ff401e9..38d8746 100644
+--- a/libarchive/archive.h
++++ b/libarchive/archive.h
+@@ -1085,6 +1085,8 @@ __LA_DECL int	archive_match_excluded(struct archive *,
+  */
+ __LA_DECL int	archive_match_path_excluded(struct archive *,
+ 		    struct archive_entry *);
++/* Control recursive inclusion of directory content when directory is included. Default on. */
++__LA_DECL int	archive_match_include_directories_recursively(struct archive *, int _enabled);
+ /* Add exclusion pathname pattern. */
+ __LA_DECL int	archive_match_exclude_pattern(struct archive *, const char *);
+ __LA_DECL int	archive_match_exclude_pattern_w(struct archive *,
+diff --git a/libarchive/archive_match.c b/libarchive/archive_match.c
+index 0719cbd..6d03a65 100644
+--- a/libarchive/archive_match.c
++++ b/libarchive/archive_match.c
+@@ -93,6 +93,9 @@ struct archive_match {
+ 	/* exclusion/inclusion set flag. */
+ 	int			 setflag;
+ 
++	/* Recursively include directory content? */
++	int			 recursive_include;
++
+ 	/*
+ 	 * Matching filename patterns.
+ 	 */
+@@ -223,6 +226,7 @@ archive_match_new(void)
+ 		return (NULL);
+ 	a->archive.magic = ARCHIVE_MATCH_MAGIC;
+ 	a->archive.state = ARCHIVE_STATE_NEW;
++	a->recursive_include = 1;
+ 	match_list_init(&(a->inclusions));
+ 	match_list_init(&(a->exclusions));
+ 	__archive_rb_tree_init(&(a->exclusion_tree), &rb_ops_mbs);
+@@ -471,6 +475,28 @@ archive_match_path_excluded(struct archive *_a,
+ }
+ 
+ /*
++ * When recursive inclusion of directory content is enabled,
++ * an inclusion pattern that matches a directory will also
++ * include everything beneath that directory. Enabled by default.
++ *
++ * For compatibility with GNU tar, exclusion patterns always
++ * match if a subset of the full patch matches (i.e., they are
++ * are not rooted at the beginning of the path) and thus there
++ * is no corresponding non-recursive exclusion mode.
++ */
++int
++archive_match_include_directories_recursively(struct archive *_a, int _enabled)
++{
++	struct archive_match *a;
++
++	archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
++	    ARCHIVE_STATE_NEW, "archive_match_include_directories_recursively");
++	a = (struct archive_match *)_a;
++	a->recursive_include = _enabled;
++	return (ARCHIVE_OK);
++}
++
++/*
+  * Utilty functions to get statistic information for inclusion patterns.
+  */
+ int
+@@ -781,7 +807,9 @@ static int
+ match_path_inclusion(struct archive_match *a, struct match *m,
+     int mbs, const void *pn)
+ {
+-	int flag = PATHMATCH_NO_ANCHOR_END;
++	int flag = a->recursive_include ?
++		PATHMATCH_NO_ANCHOR_END : /* Prefix match is good enough. */
++		0; /* Full match required. */
+ 	int r;
+ 
+ 	if (mbs) {
+diff --git a/tar/bsdtar.1 b/tar/bsdtar.1
+index 9eadaaf..f5d6457 100644
+--- a/tar/bsdtar.1
++++ b/tar/bsdtar.1
+@@ -346,8 +346,7 @@ In extract or list modes, this option is ignored.
+ Do not extract modification time.
+ By default, the modification time is set to the time stored in the archive.
+ .It Fl n , Fl Fl norecurse , Fl Fl no-recursion
+-(c, r, u modes only)
+-Do not recursively archive the contents of directories.
++Do not recursively archive (c, r, u), extract (x) or list (t) the contents of directories.
+ .It Fl Fl newer Ar date
+ (c, r, u modes only)
+ Only include files and directories newer than the specified date.
+diff --git a/tar/bsdtar.c b/tar/bsdtar.c
+index 93bf60a..001d5ed 100644
+--- a/tar/bsdtar.c
++++ b/tar/bsdtar.c
+@@ -738,8 +738,6 @@ main(int argc, char **argv)
+ 			break;
+ 		}
+ 	}
+-	if (bsdtar->option_no_subdirs)
+-		only_mode(bsdtar, "-n", "cru");
+ 	if (bsdtar->option_stdout)
+ 		only_mode(bsdtar, "-O", "xt");
+ 	if (bsdtar->option_unlink_first)
+@@ -788,6 +786,16 @@ main(int argc, char **argv)
+ 		only_mode(bsdtar, buff, "cru");
+ 	}
+ 
++	/*
++	 * When creating an archive from a directory tree, the directory
++	 * walking code will already avoid entering directories when
++	 * recursive inclusion of directory content is disabled, therefore
++	 * changing the matching behavior has no effect for creation modes.
++	 * It is relevant for extraction or listing.
++	 */
++	archive_match_include_directories_recursively(bsdtar->matching,
++						      !bsdtar->option_no_subdirs);
++
+ 	/* Filename "-" implies stdio. */
+ 	if (strcmp(bsdtar->filename, "-") == 0)
+ 		bsdtar->filename = NULL;
+-- 
+2.1.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/libarchive/libarchive_3.2.2.bb b/import-layers/yocto-poky/meta/recipes-extended/libarchive/libarchive_3.2.2.bb
index 7917ce7..da959a2 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/libarchive/libarchive_3.2.2.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/libarchive/libarchive_3.2.2.bb
@@ -11,18 +11,16 @@
 
 PACKAGECONFIG_append_class-target = "\
 	libxml2 \
-	${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)} \
-	${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'xattr', '', d)} \
-	${@bb.utils.contains('DISTRO_FEATURES', 'largefile', 'largefile', '', d)} \
+	${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)} \
 "
 
-PACKAGECONFIG_append_class-nativesdk = " largefile"
+DEPENDS_BZIP2 = "bzip2-replacement-native"
+DEPENDS_BZIP2_class-target = "bzip2"
 
 PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl,"
 PACKAGECONFIG[xattr] = "--enable-xattr,--disable-xattr,attr,"
-PACKAGECONFIG[largefile] = "--enable-largefile,--disable-largefile,,"
 PACKAGECONFIG[zlib] = "--with-zlib,--without-zlib,zlib,"
-PACKAGECONFIG[bz2] = "--with-bz2lib,--without-bz2lib,bzip2,"
+PACKAGECONFIG[bz2] = "--with-bz2lib,--without-bz2lib,${DEPENDS_BZIP2},"
 PACKAGECONFIG[xz] = "--with-lzmadec --with-lzma,--without-lzmadec --without-lzma,xz,"
 PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl,"
 PACKAGECONFIG[libxml2] = "--with-xml2,--without-xml2,libxml2,"
@@ -31,7 +29,12 @@
 PACKAGECONFIG[nettle] = "--with-nettle,--without-nettle,nettle,"
 PACKAGECONFIG[lz4] = "--with-lz4,--without-lz4,lz4,"
 
+EXTRA_OECONF += "--enable-largefile"
+
 SRC_URI = "http://libarchive.org/downloads/libarchive-${PV}.tar.gz \
+           file://non-recursive-extract-and-list.patch \
+	   file://0001-archive_write_disk_posix.c-make-_fsobj-functions-mor.patch \
+	   file://0002-Fix-extracting-hardlinks-over-symlinks.patch \
            "
 
 SRC_URI[md5sum] = "1ec00b7dcaf969dd2a5712f85f23c764"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/libidn/libidn_0.6.14.bb b/import-layers/yocto-poky/meta/recipes-extended/libidn/libidn_0.6.14.bb
deleted file mode 100644
index c681560..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/libidn/libidn_0.6.14.bb
+++ /dev/null
@@ -1,36 +0,0 @@
-SUMMARY = "Internationalized Domain Name support library"
-DESCRIPTION = "Implementation of the Stringprep, Punycode and IDNA specifications defined by the IETF Internationalized Domain Names (IDN) working group."
-HOMEPAGE = "http://www.gnu.org/software/libidn/"
-SECTION = "libs"
-LICENSE = "LGPLv2.1+ & GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a \
-                    file://COPYING.LIB;md5=a6f89e2100d9b6cdffcea4f398e37343 \
-                    file://lib/idna.h;beginline=6;endline=18;md5=1336e848ca7b8e25767c3c7e8fa38a89 \
-                    file://src/idn.c;beginline=6;endline=18;md5=56c89e359652a71cda128d75f0ffdac4"
-PR = "r1"
-
-inherit pkgconfig autotools gettext texinfo
-
-SRC_URI = "http://alpha.gnu.org/gnu/libidn/${BPN}-${PV}.tar.gz"
-
-SRC_URI[md5sum] = "040f012a45feb56168853998bb87ad4d"
-SRC_URI[sha256sum] = "98910c2ad664bdf4eed2c2fff88e24f8882636ec9d26669366ff03b469c05ae3"
-
-do_configure_prepend() {
-	# this version of libidn copies AC_USE_SYSTEM_EXTENSIONS from 
-	# autoconf CVS because atm the autoconf it uses is a bit old
-	# now with cross autotool, that macro is already there and this
-	# local definition causes circular dependency. Actually AC_GNU_SOURCE
-	# is identical to AC_USE_SYSTEM_EXTENSIONS. So remove all local
-	# references to the latter here.
-	sed -i -e "/AC_REQUIRE(\[gl_USE_SYSTEM_EXTENSIONS/d" ${S}/lib/gl/m4/gnulib-comp.m4
-	rm -f ${S}/lib/gl/m4/extensions.m4
-}
-
-do_install_append() {
-	rm -rf ${D}${libdir}/Libidn.dll
-	rm -rf ${D}${datadir}/emacs
-}
-
-BBCLASSEXTEND = "native nativesdk"
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch b/import-layers/yocto-poky/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch
index 24e2228..a575d0e 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch
@@ -1,32 +1,29 @@
-From 5b6e113f548bd8a2b100267bc5d54cee861a4b98 Mon Sep 17 00:00:00 2001
+From 4d9b6ec30b78d00ead0a22eb5d047dcdba37e99c Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Neal=20Gompa=20=28=E3=83=8B=E3=83=BC=E3=83=AB=E3=83=BB?=
  =?UTF-8?q?=E3=82=B3=E3=82=99=E3=83=B3=E3=83=8F=E3=82=9A=29?=
  <ngompa13@gmail.com>
 Date: Wed, 11 Nov 2015 20:32:17 -0500
-Subject: [PATCH] Add fallback fopencookie() implementation
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
+Subject: [PATCH 1/2] Add fallback fopencookie() implementation
 
 In environments where neither fopencookie() nor funopen()
 are implemented, we need to provide a suitable implementation
 of fopencookie() that we can use.
 
-Upstream-Status: Submitted [ https://github.com/openSUSE/libsolv/pull/112 ]
+Alex Kanavin: rebased CMakeLists.txt change to apply to latest upstream code.
 
-Signed-off-by: Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>com>
-Signed-off-by: Maxin B. John <maxin.john@intel.com>
+Upstream-Status: Denied [https://github.com/openSUSE/libsolv/pull/112]
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
 ---
  ext/CMakeLists.txt                     |   7 ++
  ext/solv_xfopen.c                      |  10 +--
- ext/solv_xfopen_fallback_fopencookie.c | 124 +++++++++++++++++++++++++++++++++
+ ext/solv_xfopen_fallback_fopencookie.c | 123 +++++++++++++++++++++++++++++++++
  ext/solv_xfopen_fallback_fopencookie.h |  28 ++++++++
- 4 files changed, 165 insertions(+), 4 deletions(-)
+ 4 files changed, 164 insertions(+), 4 deletions(-)
  create mode 100644 ext/solv_xfopen_fallback_fopencookie.c
  create mode 100644 ext/solv_xfopen_fallback_fopencookie.h
 
 diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt
-index ad52495..4f282ce 100644
+index 586eda8..477a2ef 100644
 --- a/ext/CMakeLists.txt
 +++ b/ext/CMakeLists.txt
 @@ -4,6 +4,13 @@ SET (libsolvext_SRCS
@@ -40,7 +37,7 @@
 +        solv_xfopen_fallback_fopencookie.h)
 +ENDIF (NOT HAVE_FOPENCOOKIE AND NOT HAVE_FUNOPEN)
 +
- IF (ENABLE_RPMDB)
+ IF (ENABLE_RPMDB OR ENABLE_RPMPKG)
      SET (libsolvext_SRCS ${libsolvext_SRCS}
          pool_fileconflicts.c repo_rpmdb.c)
 diff --git a/ext/solv_xfopen.c b/ext/solv_xfopen.c
@@ -87,17 +84,17 @@
  
 diff --git a/ext/solv_xfopen_fallback_fopencookie.c b/ext/solv_xfopen_fallback_fopencookie.c
 new file mode 100644
-index 0000000..89426a9
+index 0000000..0ce2571
 --- /dev/null
 +++ b/ext/solv_xfopen_fallback_fopencookie.c
-@@ -0,0 +1,124 @@
-+/*
+@@ -0,0 +1,123 @@
++/* 
 + *	Provides a very limited fopencookie() for environments with a libc
 + *	that lacks it.
-+ *
-+ *	Authors: zhasha & nsz
++ *	
++ *	Author: zhasha
 + *	Modified for libsolv by Neal Gompa
-+ *
++ *	
 + *	This program is licensed under the BSD license, read LICENSE.BSD
 + *	for further information.
 + *
@@ -126,7 +123,7 @@
 +{
 +    struct ctx *ctx = arg;
 +    ssize_t r;
-+    size_t n, k;
++    size_t n;
 +
 +    pthread_detach(pthread_self());
 +
@@ -140,18 +137,17 @@
 +        }
 +        if (r == 0) { break; }
 +
-+        n = r, k = 0;
 +        while (n > 0) {
 +            r = ctx->io.write ?
-+                (ctx->io.write)(ctx->cookie, ctx->buf + k, n) :
-+                write(ctx->fd, ctx->buf + k, n);
++                (ctx->io.write)(ctx->cookie, ctx->buf + ((size_t)r - n), n) :
++                write(ctx->fd, ctx->buf + ((size_t)r - n), n);
 +            if (r < 0) {
 +                if (errno != EINTR) { break; }
 +                continue;
 +            }
 +            if (r == 0) { break; }
 +
-+            n -= r, k += r;
++            n -= (size_t)r;
 +        }
 +        if (n > 0) { break; }
 +    }
@@ -171,8 +167,8 @@
 +
 +    switch (mode[0]) {
 +        case 'a':
-+        case 'w': wr = 1; break;
 +        case 'r': rd = 1; break;
++        case 'w': wr = 1; break;
 +        default:
 +            errno = EINVAL;
 +            return NULL;
@@ -217,20 +213,20 @@
 +}
 diff --git a/ext/solv_xfopen_fallback_fopencookie.h b/ext/solv_xfopen_fallback_fopencookie.h
 new file mode 100644
-index 0000000..7223e3f
+index 0000000..6a7bfee
 --- /dev/null
 +++ b/ext/solv_xfopen_fallback_fopencookie.h
 @@ -0,0 +1,28 @@
-+/*
++/* 
 + *	Provides a very limited fopencookie() for environments with a libc
 + *	that lacks it.
-+ *
-+ *	Authors: zhasha & nsz
++ *	
++ *	Author: zhasha
 + *	Modified for libsolv by Neal Gompa
-+ *
++ *	
 + *	This program is licensed under the BSD license, read LICENSE.BSD
 + *	for further information.
-+ *
++ *	
 + */
 +
 +#ifndef SOLV_XFOPEN_FALLBACK_FOPENCOOKIE_H
@@ -250,5 +246,5 @@
 +
 +#endif
 -- 
-2.4.0
+2.11.0
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch b/import-layers/yocto-poky/meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch
new file mode 100644
index 0000000..efb4e3a
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch
@@ -0,0 +1,104 @@
+From 99b10cdf6a0f8a24e1670c1813b1d9563ae3f5b5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Neal=20Gompa=20=28=E3=83=8B=E3=83=BC=E3=83=AB=E3=83=BB?=
+ =?UTF-8?q?=E3=82=B3=E3=82=99=E3=83=B3=E3=83=8F=E3=82=9A=29?=
+ <ngompa13@gmail.com>
+Date: Mon, 23 Nov 2015 18:19:41 -0500
+Subject: [PATCH 2/2] Fixes to internal fopencookie() implementation
+
+Credits to the fixes go to nsz on #musl on Freenode,
+who gloriously fixed the implementation such that
+the tests all pass.
+
+Upstream-Status: Denied [https://github.com/openSUSE/libsolv/pull/112]
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ ext/solv_xfopen_fallback_fopencookie.c | 19 ++++++++++---------
+ ext/solv_xfopen_fallback_fopencookie.h | 10 +++++-----
+ 2 files changed, 15 insertions(+), 14 deletions(-)
+
+diff --git a/ext/solv_xfopen_fallback_fopencookie.c b/ext/solv_xfopen_fallback_fopencookie.c
+index 0ce2571..89426a9 100644
+--- a/ext/solv_xfopen_fallback_fopencookie.c
++++ b/ext/solv_xfopen_fallback_fopencookie.c
+@@ -1,10 +1,10 @@
+-/* 
++/*
+  *	Provides a very limited fopencookie() for environments with a libc
+  *	that lacks it.
+- *	
+- *	Author: zhasha
++ *
++ *	Authors: zhasha & nsz
+  *	Modified for libsolv by Neal Gompa
+- *	
++ *
+  *	This program is licensed under the BSD license, read LICENSE.BSD
+  *	for further information.
+  *
+@@ -33,7 +33,7 @@ static void *proxy(void *arg)
+ {
+     struct ctx *ctx = arg;
+     ssize_t r;
+-    size_t n;
++    size_t n, k;
+ 
+     pthread_detach(pthread_self());
+ 
+@@ -47,17 +47,18 @@ static void *proxy(void *arg)
+         }
+         if (r == 0) { break; }
+ 
++        n = r, k = 0;
+         while (n > 0) {
+             r = ctx->io.write ?
+-                (ctx->io.write)(ctx->cookie, ctx->buf + ((size_t)r - n), n) :
+-                write(ctx->fd, ctx->buf + ((size_t)r - n), n);
++                (ctx->io.write)(ctx->cookie, ctx->buf + k, n) :
++                write(ctx->fd, ctx->buf + k, n);
+             if (r < 0) {
+                 if (errno != EINTR) { break; }
+                 continue;
+             }
+             if (r == 0) { break; }
+ 
+-            n -= (size_t)r;
++            n -= r, k += r;
+         }
+         if (n > 0) { break; }
+     }
+@@ -77,8 +78,8 @@ FILE *fopencookie(void *cookie, const char *mode, struct cookie_io_functions_t i
+ 
+     switch (mode[0]) {
+         case 'a':
+-        case 'r': rd = 1; break;
+         case 'w': wr = 1; break;
++        case 'r': rd = 1; break;
+         default:
+             errno = EINVAL;
+             return NULL;
+diff --git a/ext/solv_xfopen_fallback_fopencookie.h b/ext/solv_xfopen_fallback_fopencookie.h
+index 6a7bfee..7223e3f 100644
+--- a/ext/solv_xfopen_fallback_fopencookie.h
++++ b/ext/solv_xfopen_fallback_fopencookie.h
+@@ -1,13 +1,13 @@
+-/* 
++/*
+  *	Provides a very limited fopencookie() for environments with a libc
+  *	that lacks it.
+- *	
+- *	Author: zhasha
++ *
++ *	Authors: zhasha & nsz
+  *	Modified for libsolv by Neal Gompa
+- *	
++ *
+  *	This program is licensed under the BSD license, read LICENSE.BSD
+  *	for further information.
+- *	
++ *
+  */
+ 
+ #ifndef SOLV_XFOPEN_FALLBACK_FOPENCOOKIE_H
+-- 
+2.11.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/libsolv/libsolv_0.6.23.bb b/import-layers/yocto-poky/meta/recipes-extended/libsolv/libsolv_0.6.26.bb
similarity index 64%
rename from import-layers/yocto-poky/meta/recipes-extended/libsolv/libsolv_0.6.23.bb
rename to import-layers/yocto-poky/meta/recipes-extended/libsolv/libsolv_0.6.26.bb
index f3f3d6e..42d63ae 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/libsolv/libsolv_0.6.23.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/libsolv/libsolv_0.6.26.bb
@@ -5,20 +5,22 @@
 LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE.BSD;md5=62272bd11c97396d4aaf1c41bc11f7d8"
 
-DEPENDS = "expat zlib"
+DEPENDS = "expat zlib rpm"
 
 SRC_URI = "git://github.com/openSUSE/libsolv.git \
-          "
-SRC_URI_append_libc-musl = " file://0001-Add-fallback-fopencookie-implementation.patch"
+           "
+SRC_URI_append_libc-musl = " file://0001-Add-fallback-fopencookie-implementation.patch \
+                             file://0002-Fixes-to-internal-fopencookie-implementation.patch \
+                           "
 
-SRCREV = "f654c8cfa52427ed42d7142e58452dae08c0c2d0"
+SRCREV = "ba32f8286d3deec6faaabc79762a4760e9af0a07"
 UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)"
 
 S = "${WORKDIR}/git"
 
 inherit cmake
 
-EXTRA_OECMAKE = "-DLIB=${baselib} -DMULTI_SEMANTICS=ON"
+EXTRA_OECMAKE = "-DLIB=${baselib} -DMULTI_SEMANTICS=ON -DENABLE_RPMMD=ON -DENABLE_RPMDB=ON"
 
 PACKAGES =+ "${PN}-tools ${PN}ext"
 
@@ -26,4 +28,4 @@
 FILES_${PN}-tools = "${bindir}/*"
 FILES_${PN}ext = "${libdir}/${PN}ext.so.*"
 
-BBCLASSEXTEND =+ "native nativesdk"
+BBCLASSEXTEND = "native nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/libuser/libuser_0.62.bb b/import-layers/yocto-poky/meta/recipes-extended/libuser/libuser_0.62.bb
index 07028d5..1765346 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/libuser/libuser_0.62.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/libuser/libuser_0.62.bb
@@ -20,7 +20,7 @@
 SRC_URI[md5sum] = "63e5e5c551e99dc5302b40b80bd6d4f2"
 SRC_URI[sha256sum] = "a58ff4fabb01a25043b142185a33eeea961109dd60d4b40b6a9df4fa3cace20b"
 
-DEPENDS = "popt libpam glib-2.0 docbook-utils-native linuxdoc-tools-native python3"
+DEPENDS = "popt libpam glib-2.0 python3"
 
 inherit autotools gettext python3native python3-dir pkgconfig gtk-doc
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/lighttpd/lighttpd_1.4.41.bb b/import-layers/yocto-poky/meta/recipes-extended/lighttpd/lighttpd_1.4.41.bb
deleted file mode 100644
index 1a3f323..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/lighttpd/lighttpd_1.4.41.bb
+++ /dev/null
@@ -1,79 +0,0 @@
-SUMMARY = "Lightweight high-performance web server"
-HOMEPAGE = "http://www.lighttpd.net/"
-BUGTRACKER = "http://redmine.lighttpd.net/projects/lighttpd/issues"
-
-LICENSE = "BSD"
-LIC_FILES_CHKSUM = "file://COPYING;md5=e4dac5c6ab169aa212feb5028853a579"
-
-SECTION = "net"
-DEPENDS = "zlib libpcre"
-RDEPENDS_${PN} += " \
-               lighttpd-module-access \
-               lighttpd-module-accesslog \
-               lighttpd-module-indexfile \
-               lighttpd-module-dirlisting \
-               lighttpd-module-staticfile \
-"
-
-SRC_URI = "http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${PV}.tar.xz \
-        file://index.html.lighttpd \
-        file://lighttpd.conf \
-        file://lighttpd \
-        file://lighttpd.service \
-        file://0001-Use-pkg-config-for-pcre-dependency-instead-of-config.patch \
-        "
-
-SRC_URI[md5sum] = "1df2e4dbc965cfe6f99f008ac3db4d8d"
-SRC_URI[sha256sum] = "4bcc383ef6d6dc7b284f68882d71a178e2986c83c4e85eeb3c8f3b882e346b6c"
-
-PACKAGECONFIG ??= "openssl \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'ipv6', '', d)} \
-"
-PACKAGECONFIG[openssl] = "--with-openssl, --without-openssl, openssl"
-PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
-
-EXTRA_OECONF = " \
-             --without-bzip2 \
-             --without-ldap \
-             --without-lua \
-             --without-memcached \
-             --with-pcre \
-             --without-webdav-props \
-             --without-webdav-locks \
-             --disable-static \
-"
-
-inherit autotools pkgconfig update-rc.d gettext systemd
-
-INITSCRIPT_NAME = "lighttpd"
-INITSCRIPT_PARAMS = "defaults 70"
-
-SYSTEMD_SERVICE_${PN} = "lighttpd.service"
-
-do_install_append() {
-	install -d ${D}${sysconfdir}/init.d ${D}${sysconfdir}/lighttpd.d ${D}/www/pages/dav
-	install -m 0755 ${WORKDIR}/lighttpd ${D}${sysconfdir}/init.d
-	install -m 0644 ${WORKDIR}/lighttpd.conf ${D}${sysconfdir}
-	install -m 0644 ${WORKDIR}/index.html.lighttpd ${D}/www/pages/index.html
-
-	install -d ${D}${systemd_unitdir}/system
-	install -m 0644 ${WORKDIR}/lighttpd.service ${D}${systemd_unitdir}/system
-	sed -i -e 's,@SBINDIR@,${sbindir},g' \
-		-e 's,@SYSCONFDIR@,${sysconfdir},g' \
-		-e 's,@BASE_BINDIR@,${base_bindir},g' \
-		${D}${systemd_unitdir}/system/lighttpd.service
-	#For FHS compliance, create symbolic links to /var/log and /var/tmp for logs and temporary data
-	ln -sf ${localstatedir}/log ${D}/www/logs
-	ln -sf ${localstatedir}/tmp ${D}/www/var
-}
-
-FILES_${PN} += "${sysconfdir} /www"
-
-CONFFILES_${PN} = "${sysconfdir}/lighttpd.conf"
-
-PACKAGES_DYNAMIC += "^lighttpd-module-.*"
-
-python populate_packages_prepend () {
-    lighttpd_libdir = d.expand('${libdir}')
-    do_split_packages(d, lighttpd_libdir, '^mod_(.*)\.so$', 'lighttpd-module-%s', 'Lighttpd module for %s', extra_depends='')
-}
diff --git a/import-layers/yocto-poky/meta/recipes-extended/lighttpd/lighttpd_1.4.45.bb b/import-layers/yocto-poky/meta/recipes-extended/lighttpd/lighttpd_1.4.45.bb
new file mode 100644
index 0000000..08dda33
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/lighttpd/lighttpd_1.4.45.bb
@@ -0,0 +1,85 @@
+SUMMARY = "Lightweight high-performance web server"
+HOMEPAGE = "http://www.lighttpd.net/"
+BUGTRACKER = "http://redmine.lighttpd.net/projects/lighttpd/issues"
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://COPYING;md5=e4dac5c6ab169aa212feb5028853a579"
+
+SECTION = "net"
+RDEPENDS_${PN} = "lighttpd-module-dirlisting \
+                  lighttpd-module-indexfile \
+                  lighttpd-module-staticfile"
+RRECOMMENDS_${PN} = "lighttpd-module-access \
+                     lighttpd-module-accesslog"
+
+SRC_URI = "http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${PV}.tar.xz \
+        file://index.html.lighttpd \
+        file://lighttpd.conf \
+        file://lighttpd \
+        file://lighttpd.service \
+        file://0001-Use-pkg-config-for-pcre-dependency-instead-of-config.patch \
+        "
+
+SRC_URI[md5sum] = "a128e1eda76899ce3fd115efae5fe631"
+SRC_URI[sha256sum] = "1c97225deea33eefba6d4158c2cef27913d47553263516bbe9d2e2760fc43a3f"
+
+PACKAGECONFIG ??= "openssl pcre zlib \
+    ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} \
+"
+
+PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6"
+PACKAGECONFIG[mmap] = "--enable-mmap,--disable-mmap"
+PACKAGECONFIG[libev] = "--with-libev,--without-libev,libev"
+PACKAGECONFIG[mysql] = "--with-mysql,--without-mysql,mariadb"
+PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap"
+PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr"
+PACKAGECONFIG[valgrind] = "--with-valgrind,--without-valgrind,valgrind"
+PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl"
+PACKAGECONFIG[krb5] = "--with-krb5,--without-krb5,krb5"
+PACKAGECONFIG[pcre] = "--with-pcre,--without-pcre,libpcre"
+PACKAGECONFIG[zlib] = "--with-zlib,--without-zlib,zlib"
+PACKAGECONFIG[bzip2] = "--with-bzip2,--without-bzip2,bzip2"
+PACKAGECONFIG[fam] = "--with-fam,--without-fam,gamin"
+PACKAGECONFIG[webdav-props] = "--with-webdav-props,--without-webdav-props,libxml2 sqlite3"
+PACKAGECONFIG[webdav-locks] = "--with-webdav-locks,--without-webdav-locks,util-linux"
+PACKAGECONFIG[gdbm] = "--with-gdbm,--without-gdbm,gdbm"
+PACKAGECONFIG[memcache] = "--with-memcached,--without-memcached,libmemcached"
+PACKAGECONFIG[lua] = "--with-lua,--without-lua,lua5.1"
+
+EXTRA_OECONF += "--enable-lfs"
+
+inherit autotools pkgconfig update-rc.d gettext systemd
+
+INITSCRIPT_NAME = "lighttpd"
+INITSCRIPT_PARAMS = "defaults 70"
+
+SYSTEMD_SERVICE_${PN} = "lighttpd.service"
+
+do_install_append() {
+	install -d ${D}${sysconfdir}/init.d ${D}${sysconfdir}/lighttpd.d ${D}/www/pages/dav
+	install -m 0755 ${WORKDIR}/lighttpd ${D}${sysconfdir}/init.d
+	install -m 0644 ${WORKDIR}/lighttpd.conf ${D}${sysconfdir}
+	install -m 0644 ${WORKDIR}/index.html.lighttpd ${D}/www/pages/index.html
+
+	install -d ${D}${systemd_unitdir}/system
+	install -m 0644 ${WORKDIR}/lighttpd.service ${D}${systemd_unitdir}/system
+	sed -i -e 's,@SBINDIR@,${sbindir},g' \
+		-e 's,@SYSCONFDIR@,${sysconfdir},g' \
+		-e 's,@BASE_BINDIR@,${base_bindir},g' \
+		${D}${systemd_unitdir}/system/lighttpd.service
+	#For FHS compliance, create symbolic links to /var/log and /var/tmp for logs and temporary data
+	ln -sf ${localstatedir}/log ${D}/www/logs
+	ln -sf ${localstatedir}/tmp ${D}/www/var
+}
+
+FILES_${PN} += "${sysconfdir} /www"
+
+CONFFILES_${PN} = "${sysconfdir}/lighttpd.conf"
+
+PACKAGES_DYNAMIC += "^lighttpd-module-.*"
+
+python populate_packages_prepend () {
+    lighttpd_libdir = d.expand('${libdir}')
+    do_split_packages(d, lighttpd_libdir, '^mod_(.*)\.so$', 'lighttpd-module-%s', 'Lighttpd module for %s', extra_depends='')
+}
diff --git a/import-layers/yocto-poky/meta/recipes-extended/logrotate/logrotate_3.9.1.bb b/import-layers/yocto-poky/meta/recipes-extended/logrotate/logrotate_3.9.1.bb
index 5bd3381..c938d9f 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/logrotate/logrotate_3.9.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/logrotate/logrotate_3.9.1.bb
@@ -28,10 +28,7 @@
 SRC_URI[md5sum] = "8572b7c2cf9ade09a8a8e10098500fb3"
 SRC_URI[sha256sum] = "5bf8e478c428e7744fefa465118f8296e7e771c981fb6dffb7527856a0ea3617"
 
-PACKAGECONFIG ?= "\
-    ${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)} \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \
-"
+PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'acl selinux', d)}"
 
 PACKAGECONFIG[acl] = ",,acl"
 PACKAGECONFIG[selinux] = ",,libselinux"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/lsb/lsb/0001-fix-lsb_release-to-work-with-busybox-head-and-find.patch b/import-layers/yocto-poky/meta/recipes-extended/lsb/lsb/0001-fix-lsb_release-to-work-with-busybox-head-and-find.patch
new file mode 100644
index 0000000..0175752
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/lsb/lsb/0001-fix-lsb_release-to-work-with-busybox-head-and-find.patch
@@ -0,0 +1,38 @@
+From cba901945c5a6da9586550498f8e3787c57c3098 Mon Sep 17 00:00:00 2001
+From: Athanasios Oikonomou <athoik@gmail.com>
+Date: Fri, 17 Feb 2017 21:04:04 +0200
+Subject: [PATCH] fix lsb_release to work with busybox head and find
+
+Upstream-Status: Inappropriate [oe-core specific]
+Signed-off-by: Athanasios Oikonomou <athoik@gmail.com>
+
+diff --git a/lsb_release b/lsb_release
+index e7d6024..233b8c1 100755
+--- a/lsb_release
++++ b/lsb_release
+@@ -209,7 +209,7 @@ EASE ($DISTRIB_CODENAME)"
+             || [ -n "$(echo $DISTRIB_DESCRIPTION |                            \
+                        sed -e "s/.*$DESCSTR_DELI.*//")" ]
+         then
+-            TMP_DISTRIB_DESC=$(head -1 $FILENAME 2>/dev/null)
++            TMP_DISTRIB_DESC=$(head -n 1 $FILENAME 2>/dev/null)
+             [ -z "$DISTRIB_DESCRIPTION" ]                                     \
+                 && DISTRIB_DESCRIPTION=$TMP_DISTRIB_DESC
+         else
+@@ -249,10 +249,10 @@ GetDistribInfo() {
+         then
+             CHECKFIRST=$(find $INFO_ROOT/ -maxdepth 1                         \
+                    -name \*$INFO_DISTRIB_SUFFIX                               \
+-                   -and ! -name $INFO_LSB_FILE                                \
+-                   -and -type f                                               \
++                   -type f                                                    \
+                    2>/dev/null                                                \
+-                   | head -1 ) # keep one of the files found (if many)
++                   | grep -v $INFO_LSB_FILE                                   \
++                   | head -n 1 ) # keep one of the files found (if many)
+         fi
+         InitDistribInfo $CHECKFIRST
+     fi
+-- 
+2.1.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/lsb/lsb_4.1.bb b/import-layers/yocto-poky/meta/recipes-extended/lsb/lsb_4.1.bb
index ece0eab..cedf39e 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/lsb/lsb_4.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/lsb/lsb_4.1.bb
@@ -15,6 +15,7 @@
 LIC_FILES_CHKSUM = "file://README;md5=12da544b1a3a5a1795a21160b49471cf"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/project/lsb/lsb_release/1.4/lsb-release-1.4.tar.gz \
+           file://0001-fix-lsb_release-to-work-with-busybox-head-and-find.patch \
            file://init-functions \
            file://lsb_killproc \
            file://lsb_log_message \
@@ -32,19 +33,18 @@
 
 CLEANBROKEN = "1"
 
-do_install(){
-	oe_runmake install prefix=${D}  mandir=${D}/${datadir}/man/ DESTDIR=${D}
+do_install() {
+	oe_runmake install prefix=${D}${base_prefix} mandir=${D}${datadir}/man/ DESTDIR=${D}
 
-	# this 2 dirs are needed by package lsb-dist-checker
+	# these two dirs are needed by package lsb-dist-checker
 	mkdir -p ${D}${sysconfdir}/opt
 	mkdir -p ${D}${localstatedir}/opt
 
-	mkdir -p ${D}${base_bindir}
-	mkdir -p ${D}/${baselib}
+	mkdir -p ${D}${base_libdir}
 	mkdir -p ${D}${sysconfdir}/lsb-release.d
 	printf "LSB_VERSION=\"core-4.1-noarch:" > ${D}${sysconfdir}/lsb-release
 
-	if [ "${TARGET_ARCH}" = "i586" ] || [ "${TARGET_ARCH}" = "i686" ];then
+	if [ "${TARGET_ARCH}" = "i586" ] || [ "${TARGET_ARCH}" = "i686" ]; then
 		printf "core-4.1-ia32" >>  ${D}${sysconfdir}/lsb-release
 	else
 		printf "core-4.1-${TARGET_ARCH}" >>  ${D}${sysconfdir}/lsb-release
@@ -57,76 +57,76 @@
 	fi
 	echo "DISTRIB_DESCRIPTION=\"${DISTRO_NAME} ${DISTRO_VERSION}\"" >> ${D}${sysconfdir}/lsb-release
 
-	if [ "${TARGET_ARCH}" = "i586" ] || [ "${TARGET_ARCH}" = "i686" ];then
+	if [ "${TARGET_ARCH}" = "i586" ] || [ "${TARGET_ARCH}" = "i686" ]; then
 		mkdir -p ${D}${sysconfdir}/lsb-release.d
 		touch ${D}${sysconfdir}/lsb-release.d/graphics-${PV}-noarch
 		touch ${D}${sysconfdir}/lsb-release.d/desktop-${PV}-noarch
 		touch ${D}${sysconfdir}/lsb-release.d/graphics-${PV}-ia32
 		touch ${D}${sysconfdir}/lsb-release.d/desktop-${PV}-ia32
-	elif [ "${TARGET_ARCH}" = "x86_64" ];then
+	elif [ "${TARGET_ARCH}" = "x86_64" ]; then
 		touch ${D}${sysconfdir}/lsb-release.d/graphics-${PV}-noarch
 		touch ${D}${sysconfdir}/lsb-release.d/graphics-${PV}-amd64
 		touch ${D}${sysconfdir}/lsb-release.d/desktop-${PV}-amd64
 	fi
-	if [ "${TARGET_ARCH}" = "powerpc" ];then
+	if [ "${TARGET_ARCH}" = "powerpc" ]; then
 		touch ${D}${sysconfdir}/lsb-release.d/graphics-${PV}-noarch
 		touch ${D}${sysconfdir}/lsb-release.d/graphics-${PV}-ppc32
 		touch ${D}${sysconfdir}/lsb-release.d/desktop-${PV}-ppc32
-	elif [ "${TARGET_ARCH}" = "powerpc64" ];then
+	elif [ "${TARGET_ARCH}" = "powerpc64" ]; then
 		touch ${D}${sysconfdir}/lsb-release.d/graphics-${PV}-noarch
 		touch ${D}${sysconfdir}/lsb-release.d/graphics-${PV}-ppc64
 		touch ${D}${sysconfdir}/lsb-release.d/desktop-${PV}-ppc64
 	fi
 }
 
-do_install_append(){
+do_install_append() {
        install -d ${D}${sysconfdir}/core-lsb
        for i in lsb_killproc lsb_log_message lsb_pidofproc lsb_start_daemon
        do
-           install -m 0755 ${WORKDIR}/${i} ${D}${sysconfdir}/core-lsb
+           install -m 0755 ${WORKDIR}/$i ${D}${sysconfdir}/core-lsb
        done
 
-       install -d ${D}/lib/lsb
-       install -m 0755 ${WORKDIR}/init-functions ${D}/lib/lsb
+       install -d ${D}${nonarch_base_libdir}/lsb
+       install -m 0755 ${WORKDIR}/init-functions ${D}${nonarch_base_libdir}/lsb
 
-       # creat links for LSB test
-       install -d ${D}/usr/lib/lsb
-       ln -sf ${sbindir}/chkconfig ${D}/usr/lib/lsb/install_initd
-       ln -sf ${sbindir}/chkconfig ${D}/usr/lib/lsb/remove_initd
+       # create links for LSB test
+       if [ "${nonarch_base_libdir}" != "${nonarch_libdir}" ] ; then
+               install -d ${D}${nonarch_libdir}/lsb
+       fi
+       ln -sf ${sbindir}/chkconfig ${D}${nonarch_libdir}/lsb/install_initd
+       ln -sf ${sbindir}/chkconfig ${D}${nonarch_libdir}/lsb/remove_initd
 
-       if [ "${TARGET_ARCH}" = "x86_64" ];then
-	       cd ${D}
-               if [ "${baselib}" != "lib64" ]; then
-                   ln -sf ${baselib} lib64
+       if [ "${TARGET_ARCH}" = "x86_64" ]; then
+               if [ "${base_libdir}" != "${base_prefix}/lib64" ]; then
+                   lnr ${D}${base_libdir} ${D}${base_prefix}/lib64
                fi
-	       cd ${D}/${baselib}
+	       cd ${D}${base_libdir}
                ln -sf ld-linux-x86-64.so.2 ld-lsb-x86-64.so.2
                ln -sf ld-linux-x86-64.so.2 ld-lsb-x86-64.so.3
        fi
-       if [ "${TARGET_ARCH}" = "i586" ] || [ "${TARGET_ARCH}" = "i686" ];then
-	       cd ${D}/${baselib}
+       if [ "${TARGET_ARCH}" = "i586" ] || [ "${TARGET_ARCH}" = "i686" ]; then
+	       cd ${D}${base_libdir}
                ln -sf ld-linux.so.2 ld-lsb.so.2
                ln -sf ld-linux.so.2 ld-lsb.so.3
        fi
 
-       if [ "${TARGET_ARCH}" = "powerpc64" ];then
-               cd ${D}
-               if [ "${baselib}" != "lib64" ]; then
-                   ln -sf ${baselib} lib64
+       if [ "${TARGET_ARCH}" = "powerpc64" ]; then
+               if [ "${base_libdir}" != "${base_prefix}/lib64" ]; then
+                   lnr ${D}${base_libdir} ${D}${base_prefix}/lib64
                fi
-               cd ${D}/${baselib}
+               cd ${D}${base_libdir}
                ln -sf ld64.so.1 ld-lsb-ppc64.so.2
                ln -sf ld64.so.1 ld-lsb-ppc64.so.3
        fi
-       if [ "${TARGET_ARCH}" = "powerpc" ];then
-	       cd ${D}/${baselib}
+       if [ "${TARGET_ARCH}" = "powerpc" ]; then
+	       cd ${D}${base_libdir}
                ln -sf ld.so.1 ld-lsb-ppc32.so.2
                ln -sf ld.so.1 ld-lsb-ppc32.so.3
        fi
 }
-FILES_${PN} += "/lib64 \
+
+FILES_${PN} += "${@'${base_prefix}/lib64' if d.getVar('TARGET_ARCH') == ('x86_64' or 'powerpc64') and '${base_libdir}' != '${base_prefix}/lib64' else ''} \
                 ${base_libdir} \
-                /usr/lib/lsb \
-                ${base_libdir}/lsb/* \
-                /lib/lsb/* \
-               "
+                ${nonarch_libdir}/lsb \
+                ${nonarch_base_libdir}/lsb/* \
+                "
diff --git a/import-layers/yocto-poky/meta/recipes-extended/lsb/lsbtest/LSB_Test.sh b/import-layers/yocto-poky/meta/recipes-extended/lsb/lsbtest/LSB_Test.sh
index c31a3eb..0eb2793 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/lsb/lsbtest/LSB_Test.sh
+++ b/import-layers/yocto-poky/meta/recipes-extended/lsb/lsbtest/LSB_Test.sh
@@ -252,8 +252,8 @@
 
 PLATFORM_FILE="/etc/rpm/platform"
 
-RPM_INSTALL_CMD="rpm --quiet --nodeps --replacepkgs --nosignature -i"
-RPM_INSTALL_CMD_NOSCRIPTS="rpm --quiet --nodeps --replacepkgs --noscripts --nosignature -i"
+RPM_INSTALL_CMD="rpm --quiet --nodeps --replacepkgs --nosignature -i --ignoreos"
+RPM_INSTALL_CMD_NOSCRIPTS="rpm --quiet --nodeps --replacepkgs --noscripts --nosignature -i --ignoreos"
 
 # If the lsb has been started, stop it first.
 if [ -x ${LSB_STOP_CMD} ]
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0001-add-_GNU_SOURCE-to-pec_listener.c.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0001-add-_GNU_SOURCE-to-pec_listener.c.patch
new file mode 100644
index 0000000..7ec66f8
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0001-add-_GNU_SOURCE-to-pec_listener.c.patch
@@ -0,0 +1,39 @@
+From ae10245c15a617bd57337981bb42eb36629f9b59 Mon Sep 17 00:00:00 2001
+From: Dengke Du <dengke.du@windriver.com>
+Date: Wed, 8 Feb 2017 15:53:31 +0800
+Subject: [PATCH 01/26] add _GNU_SOURCE to pec_listener.c
+
+In previous patch 0007-replace-SIGCLD-with-SIGCHLD.patch made by Khem Raj
+contains two aspects:
+
+	1. replace SIGCLD with SIGCHLD
+	2. add _GNU_SOURCE to pec_listener.c
+
+The replace SIGCLD with SIGCHLD have been integrated upstream, so make a
+another patch to add _GNU_SOURCE to pec_listener.c comply with Khem Raj's
+previous patch.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Dengke Du <dengke.du@windriver.com>
+Upstream-Status: Pending
+
+%% original patch: 0001-add-_GNU_SOURCE-to-pec_listener.c.patch
+---
+ testcases/kernel/connectors/pec/pec_listener.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/testcases/kernel/connectors/pec/pec_listener.c b/testcases/kernel/connectors/pec/pec_listener.c
+index d11e4dc..b8b5e0d 100644
+--- a/testcases/kernel/connectors/pec/pec_listener.c
++++ b/testcases/kernel/connectors/pec/pec_listener.c
+@@ -20,6 +20,7 @@
+ /*                                                                            */
+ /******************************************************************************/
+ 
++#define _GNU_SOURCE
+ #include <sys/socket.h>
+ #include <sys/poll.h>
+ #include <sys/types.h>
+-- 
+2.8.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0001-ltp-Don-t-link-against-libfl.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0001-ltp-Don-t-link-against-libfl.patch
deleted file mode 100644
index 585b7cb..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0001-ltp-Don-t-link-against-libfl.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 14985fccf7428eaa0b45decc22bfd20fd780f621 Mon Sep 17 00:00:00 2001
-From: Chong Lu <Chong.Lu@windriver.com>
-Date: Tue, 11 Mar 2014 14:47:22 +0800
-Subject: [PATCH 01/32] ltp: Don't link against libfl
-
-We have already defined yywrap function in scan.l file. After this, we no longer need to
-link against libfl and so no longer get errors about undefined references to yylex.
-
-Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- pan/Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/pan/Makefile b/pan/Makefile
-index 4cc6466..a4b575b 100644
---- a/pan/Makefile
-+++ b/pan/Makefile
-@@ -31,7 +31,7 @@ CPPFLAGS		+= -Wno-error
- 
- CPPFLAGS		+= -I$(abs_srcdir)
- 
--LDLIBS			+= -lm $(LEXLIB)
-+LDLIBS			+= -lm
- 
- LFLAGS			+= -l
- 
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0006-fix-PATH_MAX-undeclared-when-building-with-musl.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0006-fix-PATH_MAX-undeclared-when-building-with-musl.patch
new file mode 100644
index 0000000..8874b95
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0006-fix-PATH_MAX-undeclared-when-building-with-musl.patch
@@ -0,0 +1,30 @@
+From 32644bde4d33b677614534ec37030e57883b8e15 Mon Sep 17 00:00:00 2001
+From: Dengke Du <dengke.du@windriver.com>
+Date: Thu, 9 Feb 2017 16:41:12 +0800
+Subject: [PATCH 1/3] fix PATH_MAX undeclared when building with musl
+
+fix PATH_MAX undeclared when building with musl.
+
+Signed-off-by: Dengke Du <dengke.du@windriver.com>
+Upstream-Status: Pending
+---
+ include/tst_test.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/include/tst_test.h b/include/tst_test.h
+index 7ff33b2..9779c0e 100644
+--- a/include/tst_test.h
++++ b/include/tst_test.h
+@@ -19,6 +19,9 @@
+ #define TST_TEST_H__
+ 
+ #include <unistd.h>
++#ifndef __GLIBC__
++#include <limits.h>
++#endif
+ 
+ #include "tst_common.h"
+ #include "tst_res_flags.h"
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0006-sendfile-Use-off64_t-instead-of-__off64_t.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0006-sendfile-Use-off64_t-instead-of-__off64_t.patch
deleted file mode 100644
index 56a48ab..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0006-sendfile-Use-off64_t-instead-of-__off64_t.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From fb8b895385a641d74f2186fe5f20a872209692ed Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 7 Jan 2016 18:24:20 +0000
-Subject: [PATCH 06/32] sendfile: Use off64_t instead of __off64_t
-
-__off64_t is specific to glibc where as off64_t is widely available
-Add _GNU_SOURCE for off64_t defines from sys/types.h
-Fixes
-<command-line>:0:7: error: unknown type name 'off64_t'
-sendfile02.c:97:18: note: in expansion of macro 'OFF_T'
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- testcases/kernel/syscalls/sendfile/Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/testcases/kernel/syscalls/sendfile/Makefile b/testcases/kernel/syscalls/sendfile/Makefile
-index df7b63f..1bd1b57 100644
---- a/testcases/kernel/syscalls/sendfile/Makefile
-+++ b/testcases/kernel/syscalls/sendfile/Makefile
-@@ -21,6 +21,6 @@ top_srcdir		?= ../../../..
- include $(top_srcdir)/include/mk/testcases.mk
- include $(abs_srcdir)/../utils/newer_64.mk
- 
--%_64: CPPFLAGS += -D_FILE_OFFSET_BITS=64 -DOFF_T=__off64_t
-+%_64: CPPFLAGS += -D_FILE_OFFSET_BITS=64 -DOFF_T=off64_t -D_GNU_SOURCE
- 
- include $(top_srcdir)/include/mk/generic_leaf_target.mk
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0007-fix-__WORDSIZE-undeclared-when-building-with-musl.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0007-fix-__WORDSIZE-undeclared-when-building-with-musl.patch
new file mode 100644
index 0000000..8d0e739
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0007-fix-__WORDSIZE-undeclared-when-building-with-musl.patch
@@ -0,0 +1,30 @@
+From a2639bd0f0d3f9f3049ee33e6710fed06225f54f Mon Sep 17 00:00:00 2001
+From: Dengke Du <dengke.du@windriver.com>
+Date: Thu, 9 Feb 2017 18:20:58 +0800
+Subject: [PATCH 1/2] fix __WORDSIZE undeclared when building with musl
+
+fix __WORDSIZE undeclared when building with musl.
+
+Signed-off-by: Dengke Du <dengke.du@windriver.com>
+Upstream-Status: Pending
+---
+ include/old/test.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/include/old/test.h b/include/old/test.h
+index d492560..263e92e 100644
+--- a/include/old/test.h
++++ b/include/old/test.h
+@@ -58,6 +58,9 @@
+ #include "tst_clone.h"
+ #include "old_device.h"
+ #include "old_tmpdir.h"
++#ifndef __GLIBC__
++#include <bits/reg.h>
++#endif
+ 
+ /*
+  * Ensure that NUMSIGS is defined.
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0007-replace-SIGCLD-with-SIGCHLD.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0007-replace-SIGCLD-with-SIGCHLD.patch
deleted file mode 100644
index 4be906e..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0007-replace-SIGCLD-with-SIGCHLD.patch
+++ /dev/null
@@ -1,394 +0,0 @@
-From 405c03171e4bf0edd698cb602cf7bd7fe1d0401a Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 7 Jan 2016 19:33:53 +0000
-Subject: [PATCH 07/32] replace SIGCLD with SIGCHLD
-
-its defined to use SIGCHLD anyway in
-
-bits/signum.h:#define     SIGCLD          SIGCHLD /* Same as SIGCHLD
-(System V).  */
-
-plus it helps these tests compile with musl which adheres to posix
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- lib/tst_sig.c                                   |  8 ++++----
- testcases/kernel/connectors/pec/pec_listener.c  |  1 +
- testcases/kernel/fs/doio/doio.c                 |  4 ++--
- testcases/kernel/fs/doio/growfiles.c            |  2 +-
- testcases/kernel/syscalls/fcntl/fcntl11.c       |  8 ++++----
- testcases/kernel/syscalls/fcntl/fcntl17.c       |  8 ++++----
- testcases/kernel/syscalls/fcntl/fcntl19.c       |  8 ++++----
- testcases/kernel/syscalls/fcntl/fcntl20.c       |  8 ++++----
- testcases/kernel/syscalls/fcntl/fcntl21.c       |  8 ++++----
- testcases/kernel/syscalls/kill/kill02.c         |  6 +++---
- testcases/kernel/syscalls/kill/kill12.c         |  8 ++++----
- testcases/kernel/syscalls/mkdir/mkdir09.c       | 12 ++++++------
- testcases/kernel/syscalls/sighold/sighold02.c   |  2 +-
- testcases/network/tcp_cmds/perf_lan/pingpong.c  |  2 +-
- testcases/network/tcp_cmds/perf_lan/pingpong6.c |  2 +-
- 15 files changed, 44 insertions(+), 43 deletions(-)
-
-diff --git a/lib/tst_sig.c b/lib/tst_sig.c
-index 3af5ffd..36565e1 100644
---- a/lib/tst_sig.c
-+++ b/lib/tst_sig.c
-@@ -49,7 +49,7 @@
- 		fork_flag - set to FORK or NOFORK depending upon whether the
- 			calling program executes a fork() system call.  It
- 			is normally the case that the calling program treats
--			SIGCLD as an expected signal if fork() is being used.
-+			SIGCHLD as an expected signal if fork() is being used.
- 
- 		handler - a pointer to the unexpected signal handler to
- 			be executed after an unexpected signal has been
-@@ -82,7 +82,7 @@ static void (*tst_setup_signal(int, void (*)(int))) (int);
- 
- /****************************************************************************
-  * tst_sig() : set-up to catch unexpected signals.  fork_flag is set to NOFORK
-- *    if SIGCLD is to be an "unexpected signal", otherwise it is set to
-+ *    if SIGCHLD is to be an "unexpected signal", otherwise it is set to
-  *    FORK.  cleanup points to a cleanup routine to be executed before
-  *    tst_exit is called (cleanup is set to NULL if no cleanup is desired).
-  *    handler is a pointer to the signal handling routine (if handler is
-@@ -117,7 +117,7 @@ void tst_sig(int fork_flag, void (*handler) (), void (*cleanup) ())
- 	for (sig = 1; sig < NSIG; sig++) {
- 		/*
- 		 * SIGKILL is never unexpected.
--		 * SIGCLD is only unexpected when
-+		 * SIGCHLD is only unexpected when
- 		 *    no forking is being done.
- 		 * SIGINFO is used for file quotas and should be expected
- 		 */
-@@ -205,7 +205,7 @@ void tst_sig(int fork_flag, void (*handler) (), void (*cleanup) ())
- #endif
- 			break;
- 
--		case SIGCLD:
-+		case SIGCHLD:
- 			if (fork_flag == FORK)
- 				continue;
- 
-diff --git a/testcases/kernel/connectors/pec/pec_listener.c b/testcases/kernel/connectors/pec/pec_listener.c
-index a1beb13..002750a 100644
---- a/testcases/kernel/connectors/pec/pec_listener.c
-+++ b/testcases/kernel/connectors/pec/pec_listener.c
-@@ -20,6 +20,7 @@
- /*                                                                            */
- /******************************************************************************/
- 
-+#define _GNU_SOURCE
- #include <sys/socket.h>
- #include <sys/poll.h>
- #include <sys/types.h>
-diff --git a/testcases/kernel/fs/doio/doio.c b/testcases/kernel/fs/doio/doio.c
-index 4b0dec5..5f65ef9 100644
---- a/testcases/kernel/fs/doio/doio.c
-+++ b/testcases/kernel/fs/doio/doio.c
-@@ -573,7 +573,7 @@ int main(int argc, char **argv)
- 		case SIGTSTP:
- 		case SIGSTOP:
- 		case SIGCONT:
--		case SIGCLD:
-+		case SIGCHLD:
- 		case SIGBUS:
- 		case SIGSEGV:
- 		case SIGQUIT:
-@@ -615,7 +615,7 @@ int main(int argc, char **argv)
- 	}
- 
- 	sigemptyset(&block_mask);
--	sigaddset(&block_mask, SIGCLD);
-+	sigaddset(&block_mask, SIGCHLD);
- 	sigprocmask(SIG_BLOCK, &block_mask, &omask);
- 
- 	/*
-diff --git a/testcases/kernel/fs/doio/growfiles.c b/testcases/kernel/fs/doio/growfiles.c
-index 09e7f35..bbad230 100644
---- a/testcases/kernel/fs/doio/growfiles.c
-+++ b/testcases/kernel/fs/doio/growfiles.c
-@@ -1640,7 +1640,7 @@ int set_sig(void)
- #ifdef SIGRESTART
- 		case SIGRESTART:
- #endif /* SIGRESTART */
--		case SIGCLD:
-+		case SIGCHLD:
- 			break;
- 
- 		default:
-diff --git a/testcases/kernel/syscalls/fcntl/fcntl11.c b/testcases/kernel/syscalls/fcntl/fcntl11.c
-index fa6ce53..2de2b6c 100644
---- a/testcases/kernel/syscalls/fcntl/fcntl11.c
-+++ b/testcases/kernel/syscalls/fcntl/fcntl11.c
-@@ -105,10 +105,10 @@ void setup(void)
- 	memset(&act, 0, sizeof(act));
- 	act.sa_handler = catch_child;
- 	sigemptyset(&act.sa_mask);
--	sigaddset(&act.sa_mask, SIGCLD);
--	if ((sigaction(SIGCLD, &act, NULL)) < 0)
-+	sigaddset(&act.sa_mask, SIGCHLD);
-+	if ((sigaction(SIGCHLD, &act, NULL)) < 0)
- 		tst_brkm(TBROK | TERRNO, cleanup,
--			 "sigaction(SIGCLD, ..) failed");
-+			 "sigaction(SIGCHLD, ..) failed");
- }
- 
- void do_child(void)
-@@ -227,7 +227,7 @@ void stop_child(void)
- {
- 	struct flock fl;
- 
--	signal(SIGCLD, SIG_DFL);
-+	signal(SIGCHLD, SIG_DFL);
- 	fl.l_type = STOP;
- 	parent_put(&fl);
- 	wait(0);
-diff --git a/testcases/kernel/syscalls/fcntl/fcntl17.c b/testcases/kernel/syscalls/fcntl/fcntl17.c
-index 5b03e39..6598b20 100644
---- a/testcases/kernel/syscalls/fcntl/fcntl17.c
-+++ b/testcases/kernel/syscalls/fcntl/fcntl17.c
-@@ -150,9 +150,9 @@ int setup(void)
- 	memset(&act, 0, sizeof(act));
- 	act.sa_handler = catch_child;
- 	sigemptyset(&act.sa_mask);
--	sigaddset(&act.sa_mask, SIGCLD);
--	if (sigaction(SIGCLD, &act, NULL) < 0) {
--		tst_resm(TFAIL, "SIGCLD signal setup failed, errno: %d", errno);
-+	sigaddset(&act.sa_mask, SIGCHLD);
-+	if (sigaction(SIGCHLD, &act, NULL) < 0) {
-+		tst_resm(TFAIL, "SIGCHLD signal setup failed, errno: %d", errno);
- 		return 1;
- 	}
- 	return 0;
-@@ -381,7 +381,7 @@ void stop_children(void)
- {
- 	int arg;
- 
--	signal(SIGCLD, SIG_DFL);
-+	signal(SIGCHLD, SIG_DFL);
- 	arg = STOP;
- 	child_free(child_pipe1[1], arg);
- 	child_free(child_pipe2[1], arg);
-diff --git a/testcases/kernel/syscalls/fcntl/fcntl19.c b/testcases/kernel/syscalls/fcntl/fcntl19.c
-index a542cfc..88c91d6 100644
---- a/testcases/kernel/syscalls/fcntl/fcntl19.c
-+++ b/testcases/kernel/syscalls/fcntl/fcntl19.c
-@@ -112,9 +112,9 @@ void setup(void)
- 	memset(&act, 0, sizeof(act));
- 	act.sa_handler = catch_child;
- 	sigemptyset(&act.sa_mask);
--	sigaddset(&act.sa_mask, SIGCLD);
--	if ((sigaction(SIGCLD, &act, NULL)) < 0) {
--		tst_resm(TFAIL, "SIGCLD signal setup failed, errno: %d", errno);
-+	sigaddset(&act.sa_mask, SIGCHLD);
-+	if ((sigaction(SIGCHLD, &act, NULL)) < 0) {
-+		tst_resm(TFAIL, "SIGCHLD signal setup failed, errno: %d", errno);
- 		fail = 1;
- 	}
- }
-@@ -265,7 +265,7 @@ void stop_child(void)
- {
- 	struct flock fl;
- 
--	signal(SIGCLD, SIG_DFL);
-+	signal(SIGCHLD, SIG_DFL);
- 	fl.l_type = STOP;
- 	parent_put(&fl);
- 	wait(0);
-diff --git a/testcases/kernel/syscalls/fcntl/fcntl20.c b/testcases/kernel/syscalls/fcntl/fcntl20.c
-index aa06bab..99fd783 100644
---- a/testcases/kernel/syscalls/fcntl/fcntl20.c
-+++ b/testcases/kernel/syscalls/fcntl/fcntl20.c
-@@ -109,9 +109,9 @@ void setup(void)
- 	memset(&act, 0, sizeof(act));
- 	act.sa_handler = catch_child;
- 	sigemptyset(&act.sa_mask);
--	sigaddset(&act.sa_mask, SIGCLD);
--	if (sigaction(SIGCLD, &act, NULL) == -1)
--		tst_brkm(TFAIL | TERRNO, cleanup, "SIGCLD signal setup failed");
-+	sigaddset(&act.sa_mask, SIGCHLD);
-+	if (sigaction(SIGCHLD, &act, NULL) == -1)
-+		tst_brkm(TFAIL | TERRNO, cleanup, "SIGCHLD signal setup failed");
- }
- 
- void cleanup(void)
-@@ -264,7 +264,7 @@ void stop_child(void)
- {
- 	struct flock fl;
- 
--	signal(SIGCLD, SIG_DFL);
-+	signal(SIGCHLD, SIG_DFL);
- 	fl.l_type = STOP;
- 	parent_put(&fl);
- 	wait(0);
-diff --git a/testcases/kernel/syscalls/fcntl/fcntl21.c b/testcases/kernel/syscalls/fcntl/fcntl21.c
-index 5307021..8f1a67c 100644
---- a/testcases/kernel/syscalls/fcntl/fcntl21.c
-+++ b/testcases/kernel/syscalls/fcntl/fcntl21.c
-@@ -110,9 +110,9 @@ void setup(void)
- 	memset(&act, 0, sizeof(act));
- 	act.sa_handler = catch_child;
- 	sigemptyset(&act.sa_mask);
--	sigaddset(&act.sa_mask, SIGCLD);
--	if ((sigaction(SIGCLD, &act, NULL)) < 0) {
--		tst_resm(TFAIL, "SIGCLD signal setup failed, errno: %d", errno);
-+	sigaddset(&act.sa_mask, SIGCHLD);
-+	if ((sigaction(SIGCHLD, &act, NULL)) < 0) {
-+		tst_resm(TFAIL, "SIGCHLD signal setup failed, errno: %d", errno);
- 		fail = 1;
- 	}
- }
-@@ -272,7 +272,7 @@ void stop_child(void)
- {
- 	struct flock fl;
- 
--	signal(SIGCLD, SIG_DFL);
-+	signal(SIGCHLD, SIG_DFL);
- 	fl.l_type = STOP;
- 	parent_put(&fl);
- 	wait(0);
-diff --git a/testcases/kernel/syscalls/kill/kill02.c b/testcases/kernel/syscalls/kill/kill02.c
-index 9d6cc68..08360dd 100644
---- a/testcases/kernel/syscalls/kill/kill02.c
-+++ b/testcases/kernel/syscalls/kill/kill02.c
-@@ -701,7 +701,7 @@ void setup(void)
- 
- 	/*
- 	 *  Set to catch unexpected signals.
--	 *  SIGCLD is set to be ignored because we do not wait for termination status.
-+	 *  SIGCHLD is set to be ignored because we do not wait for termination status.
- 	 *  SIGUSR1 is set to be ignored because this is the signal we are using for
- 	 *  the test and we are not concerned with the parent getting it.
- 	 */
-@@ -713,9 +713,9 @@ void setup(void)
- 			 "signal(SIGUSR1, SIG_IGN) failed");
- 	}
- 
--	if (signal(SIGCLD, SIG_IGN) == SIG_ERR) {
-+	if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) {
- 		tst_brkm(TBROK | TERRNO, NULL,
--			 "signal(SIGCLD, SIG_IGN) failed");
-+			 "signal(SIGCHLD, SIG_IGN) failed");
- 	}
- 
- 	TEST_PAUSE;
-diff --git a/testcases/kernel/syscalls/kill/kill12.c b/testcases/kernel/syscalls/kill/kill12.c
-index 7a47a4a..d7c4147 100644
---- a/testcases/kernel/syscalls/kill/kill12.c
-+++ b/testcases/kernel/syscalls/kill/kill12.c
-@@ -98,7 +98,7 @@ int main(int argc, char **argv)
- 
- 	exno = 1;
- 
--	if (sigset(SIGCLD, chsig) == SIG_ERR) {
-+	if (sigset(SIGCHLD, chsig) == SIG_ERR) {
- 		fprintf(temp, "\tsigset failed, errno = %d\n", errno);
- 		fail_exit();
- 	}
-@@ -128,7 +128,7 @@ int main(int argc, char **argv)
- 				sleep(1);
- 
- 			kill(pid, sig);	/* child should ignroe this sig */
--			kill(pid, SIGCLD);	/* child should exit */
-+			kill(pid, SIGCHLD);	/* child should exit */
- 
- #ifdef BCS
- 			while ((npid = wait(&status)) != pid
-@@ -222,14 +222,14 @@ void do_child(void)
- 	int exno = 1;
- 
- #ifdef UCLINUX
--	if (sigset(SIGCLD, chsig) == SIG_ERR) {
-+	if (sigset(SIGCHLD, chsig) == SIG_ERR) {
- 		fprintf(temp, "\tsigset failed, errno = %d\n", errno);
- 		fail_exit();
- 	}
- #endif
- 
- 	sigset(sig, SIG_IGN);	/* set to ignore signal */
--	kill(getppid(), SIGCLD);	/* tell parent we are ready */
-+	kill(getppid(), SIGCHLD);	/* tell parent we are ready */
- 	while (!chflag)
- 		sleep(1);	/* wait for parent */
- 
-diff --git a/testcases/kernel/syscalls/mkdir/mkdir09.c b/testcases/kernel/syscalls/mkdir/mkdir09.c
-index 41c20e9..07b4fb8 100644
---- a/testcases/kernel/syscalls/mkdir/mkdir09.c
-+++ b/testcases/kernel/syscalls/mkdir/mkdir09.c
-@@ -122,10 +122,10 @@ int main(int argc, char *argv[])
- 
- 	}
- 
--	/* Set up to catch SIGCLD signal */
--	if (signal(SIGCLD, chld) == SIG_ERR) {
-+	/* Set up to catch SIGCHLD signal */
-+	if (signal(SIGCHLD, chld) == SIG_ERR) {
- 		tst_brkm(TFAIL, cleanup,
--			 "Error setting up SIGCLD signal, ERRNO = %d", errno);
-+			 "Error setting up SIGCHLD signal, ERRNO = %d", errno);
- 
- 	}
- 
-@@ -236,9 +236,9 @@ int runtest(void)
- 		tst_brkm(TFAIL, cleanup,
- 			 "Error resetting SIGTERM signal, ERRNO = %d", errno);
- 	}
--	if (signal(SIGCLD, SIG_DFL) == SIG_ERR) {
-+	if (signal(SIGCHLD, SIG_DFL) == SIG_ERR) {
- 		tst_brkm(TFAIL, cleanup,
--			 "Error resetting SIGCLD signal, ERRNO = %d", errno);
-+			 "Error resetting SIGCHLD signal, ERRNO = %d", errno);
- 	}
- 
- 	if (test_time) {
-@@ -372,7 +372,7 @@ void term(int sig)
- 
- void chld(int sig)
- {
--	/* Routine to handle SIGCLD signal. */
-+	/* Routine to handle SIGCHLD signal. */
- 
- 	sigchld++;
- 	if (jump) {
-diff --git a/testcases/kernel/syscalls/sighold/sighold02.c b/testcases/kernel/syscalls/sighold/sighold02.c
-index e3076fb..be01874 100644
---- a/testcases/kernel/syscalls/sighold/sighold02.c
-+++ b/testcases/kernel/syscalls/sighold/sighold02.c
-@@ -77,7 +77,7 @@ static int sigs_map[NUMSIGS];
- static int skip_sig(int sig)
- {
- 	switch (sig) {
--	case SIGCLD:
-+	case SIGCHLD:
- 	case SIGKILL:
- 	case SIGALRM:
- 	case SIGSTOP:
-diff --git a/testcases/network/tcp_cmds/perf_lan/pingpong.c b/testcases/network/tcp_cmds/perf_lan/pingpong.c
-index 1196312..5b06798 100644
---- a/testcases/network/tcp_cmds/perf_lan/pingpong.c
-+++ b/testcases/network/tcp_cmds/perf_lan/pingpong.c
-@@ -182,7 +182,7 @@ int main(int argc, char *argv[])
- 
- 	/* Setup traps */
- 	signal(SIGINT, finish);
--	signal(SIGCLD, finish);
-+	signal(SIGCHLD, finish);
- 
- 	/* Fork a child process to continue sending packets */
- 	tst_resm(TINFO, "Create a child process to continue to send packets");
-diff --git a/testcases/network/tcp_cmds/perf_lan/pingpong6.c b/testcases/network/tcp_cmds/perf_lan/pingpong6.c
-index 9747f58..0a0fb1d 100644
---- a/testcases/network/tcp_cmds/perf_lan/pingpong6.c
-+++ b/testcases/network/tcp_cmds/perf_lan/pingpong6.c
-@@ -153,7 +153,7 @@ char *argv[];
- 
- 	/* Setup traps */
- 	signal(SIGINT, finish);
--	signal(SIGCLD, finish);
-+	signal(SIGCHLD, finish);
- 
- 	/* Fork a child process to continue sending packets */
- 	printf("Create a child process to continue to send packets \n");
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch
index d123074..41f2623 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch
@@ -88,22 +88,19 @@
  
  void cleanup(void);
  void setup(void);
-@@ -164,9 +172,14 @@ static inline int getcpu(unsigned *cpu_id, unsigned *node_id,
+@@ -164,7 +172,11 @@ static inline int getcpu(unsigned *cpu_id, unsigned *node_id,
  {
  #if defined(__i386__)
  	return syscall(318, cpu_id, node_id, cache_struct);
 -#elif __GLIBC_PREREQ(2,6)
-+#if defined(__GLIBC__)
++#elif defined(__GLIBC__)
 +#if __GLIBC_PREREQ(2,6)
 +	*cpu_id = sched_getcpu();
 +#endif
 +#else
  	*cpu_id = sched_getcpu();
  #endif
-+#endif
  	return 0;
- }
- 
 @@ -191,15 +204,20 @@ unsigned int set_cpu_affinity(void)
  	cpu_set_t *set;
  	size_t size;
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0009-Guard-error.h-with-__GLIBC__.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0009-Guard-error.h-with-__GLIBC__.patch
deleted file mode 100644
index e58e5a9..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0009-Guard-error.h-with-__GLIBC__.patch
+++ /dev/null
@@ -1,270 +0,0 @@
-From 4ba19d64e95a874995d0b554b891b5ec35bd9495 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 7 Jan 2016 19:45:35 +0000
-Subject: [PATCH 09/32] Guard error.h with __GLIBC__
-
-error API is specific to glibc so use the guard to make it conditional
-on glibc
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- testcases/kernel/syscalls/faccessat/faccessat01.c   | 2 ++
- testcases/kernel/syscalls/fallocate/fallocate01.c   | 2 ++
- testcases/kernel/syscalls/fchmodat/fchmodat01.c     | 2 ++
- testcases/kernel/syscalls/fchownat/fchownat01.c     | 2 ++
- testcases/kernel/syscalls/fchownat/fchownat02.c     | 2 ++
- testcases/kernel/syscalls/fstatat/fstatat01.c       | 2 ++
- testcases/kernel/syscalls/futimesat/futimesat01.c   | 2 ++
- testcases/kernel/syscalls/linkat/linkat01.c         | 2 ++
- testcases/kernel/syscalls/linkat/linkat02.c         | 2 ++
- testcases/kernel/syscalls/mkdirat/mkdirat01.c       | 2 ++
- testcases/kernel/syscalls/mknodat/mknodat01.c       | 2 ++
- testcases/kernel/syscalls/mknodat/mknodat02.c       | 2 ++
- testcases/kernel/syscalls/openat/openat01.c         | 2 ++
- testcases/kernel/syscalls/readlinkat/readlinkat01.c | 2 ++
- testcases/kernel/syscalls/renameat/renameat01.c     | 2 ++
- testcases/kernel/syscalls/symlinkat/symlinkat01.c   | 2 ++
- testcases/kernel/syscalls/unlinkat/unlinkat01.c     | 2 ++
- 17 files changed, 34 insertions(+)
-
-diff --git a/testcases/kernel/syscalls/faccessat/faccessat01.c b/testcases/kernel/syscalls/faccessat/faccessat01.c
-index 7f0e87a..c72dcf0 100644
---- a/testcases/kernel/syscalls/faccessat/faccessat01.c
-+++ b/testcases/kernel/syscalls/faccessat/faccessat01.c
-@@ -37,7 +37,9 @@
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <unistd.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/fallocate/fallocate01.c b/testcases/kernel/syscalls/fallocate/fallocate01.c
-index e72b123..643c0e2 100644
---- a/testcases/kernel/syscalls/fallocate/fallocate01.c
-+++ b/testcases/kernel/syscalls/fallocate/fallocate01.c
-@@ -96,7 +96,9 @@
- #include <fcntl.h>
- #include <sys/syscall.h>
- #include <unistd.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <inttypes.h>
- #include <sys/utsname.h>
- 
-diff --git a/testcases/kernel/syscalls/fchmodat/fchmodat01.c b/testcases/kernel/syscalls/fchmodat/fchmodat01.c
-index 19e9ad5..ae6d807 100644
---- a/testcases/kernel/syscalls/fchmodat/fchmodat01.c
-+++ b/testcases/kernel/syscalls/fchmodat/fchmodat01.c
-@@ -37,7 +37,9 @@
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <unistd.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/fchownat/fchownat01.c b/testcases/kernel/syscalls/fchownat/fchownat01.c
-index b361253..a5218af 100644
---- a/testcases/kernel/syscalls/fchownat/fchownat01.c
-+++ b/testcases/kernel/syscalls/fchownat/fchownat01.c
-@@ -28,7 +28,9 @@
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <unistd.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/fchownat/fchownat02.c b/testcases/kernel/syscalls/fchownat/fchownat02.c
-index 6b0304c..8d2863f 100644
---- a/testcases/kernel/syscalls/fchownat/fchownat02.c
-+++ b/testcases/kernel/syscalls/fchownat/fchownat02.c
-@@ -26,7 +26,9 @@
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <unistd.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/fstatat/fstatat01.c b/testcases/kernel/syscalls/fstatat/fstatat01.c
-index 61531c6..e99fbd2 100644
---- a/testcases/kernel/syscalls/fstatat/fstatat01.c
-+++ b/testcases/kernel/syscalls/fstatat/fstatat01.c
-@@ -48,7 +48,9 @@
- #include <sys/stat.h>
- #include <sys/time.h>
- #include <fcntl.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/futimesat/futimesat01.c b/testcases/kernel/syscalls/futimesat/futimesat01.c
-index ae8d4fe..316dd78 100644
---- a/testcases/kernel/syscalls/futimesat/futimesat01.c
-+++ b/testcases/kernel/syscalls/futimesat/futimesat01.c
-@@ -37,7 +37,9 @@
- #include <sys/stat.h>
- #include <sys/time.h>
- #include <fcntl.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/linkat/linkat01.c b/testcases/kernel/syscalls/linkat/linkat01.c
-index fc0687b..83cbfe7 100644
---- a/testcases/kernel/syscalls/linkat/linkat01.c
-+++ b/testcases/kernel/syscalls/linkat/linkat01.c
-@@ -49,7 +49,9 @@
- #include <sys/time.h>
- #include <fcntl.h>
- #include <unistd.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/linkat/linkat02.c b/testcases/kernel/syscalls/linkat/linkat02.c
-index e9a752a..8d7e431 100644
---- a/testcases/kernel/syscalls/linkat/linkat02.c
-+++ b/testcases/kernel/syscalls/linkat/linkat02.c
-@@ -23,7 +23,9 @@
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <unistd.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/mkdirat/mkdirat01.c b/testcases/kernel/syscalls/mkdirat/mkdirat01.c
-index 7e15947..1dbc038 100644
---- a/testcases/kernel/syscalls/mkdirat/mkdirat01.c
-+++ b/testcases/kernel/syscalls/mkdirat/mkdirat01.c
-@@ -30,7 +30,9 @@
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/mknodat/mknodat01.c b/testcases/kernel/syscalls/mknodat/mknodat01.c
-index 26e5538..f034f05 100644
---- a/testcases/kernel/syscalls/mknodat/mknodat01.c
-+++ b/testcases/kernel/syscalls/mknodat/mknodat01.c
-@@ -29,7 +29,9 @@
- #include <sys/types.h>
- #include <fcntl.h>
- #include <sys/stat.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/mknodat/mknodat02.c b/testcases/kernel/syscalls/mknodat/mknodat02.c
-index f6368fa..7d0f7c0 100644
---- a/testcases/kernel/syscalls/mknodat/mknodat02.c
-+++ b/testcases/kernel/syscalls/mknodat/mknodat02.c
-@@ -29,7 +29,9 @@
- #include <sys/types.h>
- #include <fcntl.h>
- #include <sys/stat.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/openat/openat01.c b/testcases/kernel/syscalls/openat/openat01.c
-index 85f9a91..4ee0117 100644
---- a/testcases/kernel/syscalls/openat/openat01.c
-+++ b/testcases/kernel/syscalls/openat/openat01.c
-@@ -29,7 +29,9 @@
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/readlinkat/readlinkat01.c b/testcases/kernel/syscalls/readlinkat/readlinkat01.c
-index 97a49e8..b162853 100644
---- a/testcases/kernel/syscalls/readlinkat/readlinkat01.c
-+++ b/testcases/kernel/syscalls/readlinkat/readlinkat01.c
-@@ -29,7 +29,9 @@
- #include <sys/stat.h>
- #include <sys/time.h>
- #include <fcntl.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/renameat/renameat01.c b/testcases/kernel/syscalls/renameat/renameat01.c
-index f4cd51b..105a05b 100644
---- a/testcases/kernel/syscalls/renameat/renameat01.c
-+++ b/testcases/kernel/syscalls/renameat/renameat01.c
-@@ -42,7 +42,9 @@
- #include <sys/stat.h>
- #include <sys/time.h>
- #include <fcntl.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/symlinkat/symlinkat01.c b/testcases/kernel/syscalls/symlinkat/symlinkat01.c
-index 5c238d8..cb7a7e8 100644
---- a/testcases/kernel/syscalls/symlinkat/symlinkat01.c
-+++ b/testcases/kernel/syscalls/symlinkat/symlinkat01.c
-@@ -37,7 +37,9 @@
- #include <sys/stat.h>
- #include <sys/time.h>
- #include <fcntl.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
-diff --git a/testcases/kernel/syscalls/unlinkat/unlinkat01.c b/testcases/kernel/syscalls/unlinkat/unlinkat01.c
-index 31fe4e7..26f6d9a 100644
---- a/testcases/kernel/syscalls/unlinkat/unlinkat01.c
-+++ b/testcases/kernel/syscalls/unlinkat/unlinkat01.c
-@@ -37,7 +37,9 @@
- #include <sys/stat.h>
- #include <sys/time.h>
- #include <fcntl.h>
-+#ifdef __GLIBC__
- #include <error.h>
-+#endif
- #include <stdlib.h>
- #include <errno.h>
- #include <string.h>
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0009-fix-redefinition-of-struct-msgbuf-error-building-wit.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0009-fix-redefinition-of-struct-msgbuf-error-building-wit.patch
new file mode 100644
index 0000000..6886c55
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0009-fix-redefinition-of-struct-msgbuf-error-building-wit.patch
@@ -0,0 +1,35 @@
+From 2d7ea67e8eaa41cbd6816f7ab654254b40b530a1 Mon Sep 17 00:00:00 2001
+From: Dengke Du <dengke.du@windriver.com>
+Date: Thu, 9 Feb 2017 17:17:37 +0800
+Subject: [PATCH] fix redefinition of 'struct msgbuf' error building with musl
+
+When building with musl the file "sys/msg.h" already contain 'struct msgbuf'
+
+Signed-off-by: Dengke Du <dengke.du@windriver.com>
+Upstream-Status: Pending
+---
+ testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c
+index a757c0d..e023114 100644
+--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c
++++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c
+@@ -47,11 +47,13 @@ const char *TCID = "msgrcv08";
+ const int TST_TOTAL = 1;
+ 
+ #if __WORDSIZE == 32
+-
++#ifdef __GLIBC__
+ struct msgbuf {
+ 	long mtype;     /* message type, must be > 0 */
+ 	char mtext[16]; /* message data */
+ };
++#else
++#endif
+ 
+ static void msr(int msqid)
+ {
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0011-Rename-sigset-variable-to-sigset1.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0011-Rename-sigset-variable-to-sigset1.patch
index 945280c..4ac14dc 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0011-Rename-sigset-variable-to-sigset1.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0011-Rename-sigset-variable-to-sigset1.patch
@@ -1,11 +1,12 @@
-From aff0e2a8f011fa80b472355355a7e8cdacd50189 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 7 Jan 2016 19:53:30 +0000
-Subject: [PATCH 11/32] Rename sigset variable to sigset1
+From dc1905b6d972f9176b40da270c83d8fb4d1751b5 Mon Sep 17 00:00:00 2001
+From: Dengke Du <dengke.du@windriver.com>
+Date: Wed, 8 Feb 2017 16:12:34 +0800
+Subject: [PATCH 2/5] Rename sigset variable to sigset1
 
 sigset API from signal.h is shadowed by this name conflict
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Dengke Du <dengke.du@windriver.com>
 ---
  testcases/kernel/mem/shmt/shmt04.c                    | 10 +++++-----
  testcases/kernel/mem/shmt/shmt06.c                    | 10 +++++-----
@@ -13,15 +14,15 @@
  3 files changed, 15 insertions(+), 15 deletions(-)
 
 diff --git a/testcases/kernel/mem/shmt/shmt04.c b/testcases/kernel/mem/shmt/shmt04.c
-index 7203e9e..fce87d6 100644
+index b2682da..3f35fad 100644
 --- a/testcases/kernel/mem/shmt/shmt04.c
 +++ b/testcases/kernel/mem/shmt/shmt04.c
 @@ -56,7 +56,7 @@ int TST_TOTAL = 2;		/* Total number of test cases. */
  /**************/
  
  key_t key;
--sigset_t sigset;
-+sigset_t sigset1;
+-sigset_t set;
++sigset_t set1;
  
  #define  SIZE  16*1024
  
@@ -29,12 +30,12 @@
  
  	key = (key_t) getpid();
  
--	sigemptyset(&sigset);
--	sigaddset(&sigset, SIGUSR1);
--	sigprocmask(SIG_BLOCK, &sigset, NULL);
-+	sigemptyset(&sigset1);
-+	sigaddset(&sigset1, SIGUSR1);
-+	sigprocmask(SIG_BLOCK, &sigset1, NULL);
+-	sigemptyset(&set);
+-	sigaddset(&set, SIGUSR1);
+-	sigprocmask(SIG_BLOCK, &set, NULL);
++	sigemptyset(&set1);
++	sigaddset(&set1, SIGUSR1);
++	sigprocmask(SIG_BLOCK, &set1, NULL);
  
  	pid = fork();
  	switch (pid) {
@@ -42,21 +43,21 @@
  	char *cp;
  	int sig;
  
--	sigwait(&sigset, &sig);
-+	sigwait(&sigset1, &sig);
+-	sigwait(&set, &sig);
++	sigwait(&set1, &sig);
  	chld_pid = getpid();
  /*--------------------------------------------------------*/
  
 diff --git a/testcases/kernel/mem/shmt/shmt06.c b/testcases/kernel/mem/shmt/shmt06.c
-index a3c9ca3..77b0fc9 100644
+index dd69de7..56fb1da 100644
 --- a/testcases/kernel/mem/shmt/shmt06.c
 +++ b/testcases/kernel/mem/shmt/shmt06.c
 @@ -57,7 +57,7 @@ int TST_TOTAL = 2;		/* Total number of test cases. */
  /**************/
  
  key_t key;
--sigset_t sigset;
-+sigset_t sigset1;
+-sigset_t set;
++sigset_t set1;
  
  int child();
  static int rm_shm(int);
@@ -64,12 +65,12 @@
  
  	key = (key_t) getpid();
  
--	sigemptyset(&sigset);
--	sigaddset(&sigset, SIGUSR1);
--	sigprocmask(SIG_BLOCK, &sigset, NULL);
-+	sigemptyset(&sigset1);
-+	sigaddset(&sigset1, SIGUSR1);
-+	sigprocmask(SIG_BLOCK, &sigset1, NULL);
+-	sigemptyset(&set);
+-	sigaddset(&set, SIGUSR1);
+-	sigprocmask(SIG_BLOCK, &set, NULL);
++	sigemptyset(&set1);
++	sigaddset(&set1, SIGUSR1);
++	sigprocmask(SIG_BLOCK, &set1, NULL);
  
  	pid = fork();
  	switch (pid) {
@@ -77,21 +78,21 @@
  	char *cp;
  	int sig;
  
--	sigwait(&sigset, &sig);
-+	sigwait(&sigset1, &sig);
+-	sigwait(&set, &sig);
++	sigwait(&set1, &sig);
  	chld_pid = getpid();
  
  	if ((shmid = shmget(key, SIZE, 0)) < 0) {
 diff --git a/testcases/kernel/syscalls/sigprocmask/sigprocmask01.c b/testcases/kernel/syscalls/sigprocmask/sigprocmask01.c
-index 20fca52..6fb1d57 100644
+index 232d25a..06d902f 100644
 --- a/testcases/kernel/syscalls/sigprocmask/sigprocmask01.c
 +++ b/testcases/kernel/syscalls/sigprocmask/sigprocmask01.c
 @@ -91,7 +91,7 @@ int TST_TOTAL = 1;
  int sig_catch = 0;		/* variable to blocked/unblocked signals */
  
  struct sigaction sa_new;	/* struct to hold signal info */
--sigset_t sigset;		/* signal set to hold signal lists */
-+sigset_t sigset1;		/* signal set to hold signal lists */
+-sigset_t set;		/* signal set to hold signal lists */
++sigset_t set1;		/* signal set to hold signal lists */
  sigset_t sigset2;
  
  int main(int ac, char **av)
@@ -99,8 +100,8 @@
  		 * so that, signal will not be delivered to
  		 * the test process.
  		 */
--		TEST(sigprocmask(SIG_BLOCK, &sigset, 0));
-+		TEST(sigprocmask(SIG_BLOCK, &sigset1, 0));
+-		TEST(sigprocmask(SIG_BLOCK, &set, 0));
++		TEST(sigprocmask(SIG_BLOCK, &set1, 0));
  
  		/* Get the process id of test process */
  		my_pid = getpid();
@@ -108,8 +109,8 @@
  				 */
  				errno = 0;
  				if (sigprocmask(SIG_UNBLOCK,
--						&sigset, 0) == -1) {
-+						&sigset1, 0) == -1) {
+-						&set, 0) == -1) {
++						&set1, 0) == -1) {
  					tst_brkm(TFAIL, cleanup,
  						 "sigprocmask() failed "
  						 "to unblock signal, "
@@ -117,8 +118,8 @@
  	 * Initialise the signal sets with the list that
  	 * excludes/includes  all system-defined signals.
  	 */
--	if (sigemptyset(&sigset) == -1) {
-+	if (sigemptyset(&sigset1) == -1) {
+-	if (sigemptyset(&set) == -1) {
++	if (sigemptyset(&set1) == -1) {
  		tst_brkm(TFAIL, cleanup,
  			 "sigemptyset() failed, errno=%d : %s",
  			 errno, strerror(errno));
@@ -126,11 +127,11 @@
  	 * Add specified signal (SIGINT) to the signal set
  	 * which excludes system-defined signals.
  	 */
--	if (sigaddset(&sigset, SIGINT) == -1) {
-+	if (sigaddset(&sigset1, SIGINT) == -1) {
+-	if (sigaddset(&set, SIGINT) == -1) {
++	if (sigaddset(&set1, SIGINT) == -1) {
  		tst_brkm(TFAIL, cleanup,
  			 "sigaddset() failed, errno=%d : %s",
  			 errno, strerror(errno));
 -- 
-2.7.0
+2.7.4
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0012-fix-faccessat01.c-build-fails-with-security-flags.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0012-fix-faccessat01.c-build-fails-with-security-flags.patch
new file mode 100644
index 0000000..2600bd6
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0012-fix-faccessat01.c-build-fails-with-security-flags.patch
@@ -0,0 +1,70 @@
+From 32f563008f95975d26d1c4fcb266c72c56f934be Mon Sep 17 00:00:00 2001
+From: Dengke Du <dengke.du@windriver.com>
+Date: Wed, 22 Feb 2017 01:21:55 -0500
+Subject: [PATCH] fix faccessat01.c build fails with security flags
+
+When the distro is poky-lsb, fix the following error:
+
+| In file included from ../../../../include/old/test.h:47:0,
+|                  from faccessat01.c:44:
+| faccessat01.c: In function 'setup':
+| ../../../../include/old/old_safe_file_ops.h:55:27: error: format not a string literal and no format arguments [-Werror=format-security]
+|                    (path), (fmt), ## __VA_ARGS__)
+|                            ^
+| faccessat01.c:132:2: note: in expansion of macro 'SAFE_FILE_PRINTF'
+|   SAFE_FILE_PRINTF(cleanup, testfile, testfile);
+|   ^~~~~~~~~~~~~~~~
+| ../../../../include/old/old_safe_file_ops.h:55:27: error: format not a string literal and no format arguments [-Werror=format-security]
+|                    (path), (fmt), ## __VA_ARGS__)
+|                            ^
+| faccessat01.c:133:2: note: in expansion of macro 'SAFE_FILE_PRINTF'
+|   SAFE_FILE_PRINTF(cleanup, testfile2, testfile2);
+|   ^~~~~~~~~~~~~~~~
+
+This is because in macro "SAFE_FILE_PRINTF", its third argument should be a
+format arguments, but in file faccessat01.c, it passed the same argument to
+macro "SAFE_FILE_PRINTF", so it results in the fails. It should pass the format
+string to the third argument.
+
+The same for file fchmodat01.c.
+
+Signed-off-by: Dengke Du <dengke.du@windriver.com>
+Upstream-Status: Pending
+---
+ testcases/kernel/syscalls/faccessat/faccessat01.c | 4 ++--
+ testcases/kernel/syscalls/fchmodat/fchmodat01.c   | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/testcases/kernel/syscalls/faccessat/faccessat01.c b/testcases/kernel/syscalls/faccessat/faccessat01.c
+index 622dfd3..1ca90e9 100644
+--- a/testcases/kernel/syscalls/faccessat/faccessat01.c
++++ b/testcases/kernel/syscalls/faccessat/faccessat01.c
+@@ -129,8 +129,8 @@ void setup(void)
+ 	fds[0] = SAFE_OPEN(cleanup, pathname, O_DIRECTORY);
+ 	fds[1] = fds[4] = fds[0];
+ 
+-	SAFE_FILE_PRINTF(cleanup, testfile, testfile);
+-	SAFE_FILE_PRINTF(cleanup, testfile2, testfile2);
++	SAFE_FILE_PRINTF(cleanup, testfile, "faccessattestfile%d.txt");
++	SAFE_FILE_PRINTF(cleanup, testfile2, "%s/faccessattestfile%d.txt");
+ 
+ 	fds[2] = SAFE_OPEN(cleanup, testfile3, O_CREAT | O_RDWR, 0600);
+ 
+diff --git a/testcases/kernel/syscalls/fchmodat/fchmodat01.c b/testcases/kernel/syscalls/fchmodat/fchmodat01.c
+index 6bf66d8..89d072a 100644
+--- a/testcases/kernel/syscalls/fchmodat/fchmodat01.c
++++ b/testcases/kernel/syscalls/fchmodat/fchmodat01.c
+@@ -127,8 +127,8 @@ void setup(void)
+ 	fds[0] = SAFE_OPEN(cleanup, pathname, O_DIRECTORY);
+ 	fds[1] = fds[4] = fds[0];
+ 
+-	SAFE_FILE_PRINTF(cleanup, testfile, testfile);
+-	SAFE_FILE_PRINTF(cleanup, testfile2, testfile2);
++	SAFE_FILE_PRINTF(cleanup, testfile, "fchmodattest%d.txt");
++	SAFE_FILE_PRINTF(cleanup, testfile2, "%s/fchmodattest%d.txt");
+ 
+ 	fds[2] = SAFE_OPEN(cleanup, testfile3, O_CREAT | O_RDWR, 0600);
+ 	fds[3] = 100;
+-- 
+2.8.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0012-fsstress.c-Replace-__int64_t-with-int64_t.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0012-fsstress.c-Replace-__int64_t-with-int64_t.patch
deleted file mode 100644
index e1532c1..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0012-fsstress.c-Replace-__int64_t-with-int64_t.patch
+++ /dev/null
@@ -1,351 +0,0 @@
-From 54e098a366a1d773c4d7d4124f2f5aab976681c3 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 7 Jan 2016 19:58:08 +0000
-Subject: [PATCH 12/32] fsstress.c: Replace __int64_t with int64_t
-
-int64_t is defined in ISO C99
-include limits.h to get defintions of PATH_MAX
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- testcases/kernel/fs/fsstress/fsstress.c       | 31 +++++++++---------
- testcases/network/nfs/nfs_fsstress/fsstress.c | 47 ++++++++++++++-------------
- 2 files changed, 40 insertions(+), 38 deletions(-)
-
-diff --git a/testcases/kernel/fs/fsstress/fsstress.c b/testcases/kernel/fs/fsstress/fsstress.c
-index 2f89903..89f0b19 100644
---- a/testcases/kernel/fs/fsstress/fsstress.c
-+++ b/testcases/kernel/fs/fsstress/fsstress.c
-@@ -36,6 +36,7 @@
- #ifdef HAVE_SYS_PRCTL_H
- # include <sys/prctl.h>
- #endif
-+#include <limits.h>
- 
- #define XFS_ERRTAG_MAX		17
- 
-@@ -1572,7 +1573,7 @@ void bulkstat_f(int opno, long r)
- 	__u64 last;
- 	__s32 nent;
- 	xfs_bstat_t *t;
--	__int64_t total;
-+	int64_t total;
- 	xfs_fsop_bulkreq_t bsr;
- 
- 	last = 0;
-@@ -1764,14 +1765,14 @@ int setdirect(int fd)
- 
- void dread_f(int opno, long r)
- {
--	__int64_t align;
-+	int64_t align;
- 	char *buf = NULL;
- 	struct dioattr diob;
- 	int e;
- 	pathname_t f;
- 	int fd;
- 	size_t len;
--	__int64_t lr;
-+	int64_t lr;
- 	off64_t off;
- 	struct stat64 stb;
- 	int v;
-@@ -1835,8 +1836,8 @@ void dread_f(int opno, long r)
- 		return;
- 	}
- #endif
--	align = (__int64_t) diob.d_miniosz;
--	lr = ((__int64_t) random() << 32) + random();
-+	align = (int64_t) diob.d_miniosz;
-+	lr = ((int64_t) random() << 32) + random();
- 	off = (off64_t) (lr % stb.st_size);
- 	off -= (off % align);
- 	lseek64(fd, off, SEEK_SET);
-@@ -1865,14 +1866,14 @@ void dread_f(int opno, long r)
- 
- void dwrite_f(int opno, long r)
- {
--	__int64_t align;
-+	int64_t align;
- 	char *buf = NULL;
- 	struct dioattr diob;
- 	int e;
- 	pathname_t f;
- 	int fd;
- 	size_t len;
--	__int64_t lr;
-+	int64_t lr;
- 	off64_t off;
- 	struct stat64 stb;
- 	int v;
-@@ -1925,8 +1926,8 @@ void dwrite_f(int opno, long r)
- 		return;
- 	}
- #endif
--	align = (__int64_t) diob.d_miniosz;
--	lr = ((__int64_t) random() << 32) + random();
-+	align = (int64_t) diob.d_miniosz;
-+	lr = ((int64_t) random() << 32) + random();
- 	off = (off64_t) (lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
- 	off -= (off % align);
- 	lseek64(fd, off, SEEK_SET);
-@@ -2224,7 +2225,7 @@ void read_f(int opno, long r)
- 	pathname_t f;
- 	int fd;
- 	size_t len;
--	__int64_t lr;
-+	int64_t lr;
- 	off64_t off;
- 	struct stat64 stb;
- 	int v;
-@@ -2262,7 +2263,7 @@ void read_f(int opno, long r)
- 		close(fd);
- 		return;
- 	}
--	lr = ((__int64_t) random() << 32) + random();
-+	lr = ((int64_t) random() << 32) + random();
- 	off = (off64_t) (lr % stb.st_size);
- 	lseek64(fd, off, SEEK_SET);
- 	len = (random() % (getpagesize() * 32)) + 1;
-@@ -2509,7 +2510,7 @@ void truncate_f(int opno, long r)
- {
- 	int e;
- 	pathname_t f;
--	__int64_t lr;
-+	int64_t lr;
- 	off64_t off;
- 	struct stat64 stb;
- 	int v;
-@@ -2530,7 +2531,7 @@ void truncate_f(int opno, long r)
- 		free_pathname(&f);
- 		return;
- 	}
--	lr = ((__int64_t) random() << 32) + random();
-+	lr = ((int64_t) random() << 32) + random();
- 	off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE);
- 	off %= maxfsize;
- 	e = truncate64_path(&f, off) < 0 ? errno : 0;
-@@ -2626,7 +2627,7 @@ void write_f(int opno, long r)
- 	pathname_t f;
- 	int fd;
- 	size_t len;
--	__int64_t lr;
-+	int64_t lr;
- 	off64_t off;
- 	struct stat64 stb;
- 	int v;
-@@ -2656,7 +2657,7 @@ void write_f(int opno, long r)
- 		close(fd);
- 		return;
- 	}
--	lr = ((__int64_t) random() << 32) + random();
-+	lr = ((int64_t) random() << 32) + random();
- 	off = (off64_t) (lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
- 	off %= maxfsize;
- 	lseek64(fd, off, SEEK_SET);
-diff --git a/testcases/network/nfs/nfs_fsstress/fsstress.c b/testcases/network/nfs/nfs_fsstress/fsstress.c
-index ac91262..a34c416 100644
---- a/testcases/network/nfs/nfs_fsstress/fsstress.c
-+++ b/testcases/network/nfs/nfs_fsstress/fsstress.c
-@@ -31,6 +31,7 @@
-  */
- 
- #include "global.h"
-+#include <limits.h>
- 
- #define XFS_ERRTAG_MAX		17
- 
-@@ -1368,7 +1369,7 @@ void allocsp_f(int opno, long r)
- 	pathname_t f;
- 	int fd;
- 	struct flock64 fl;
--	__int64_t lr;
-+	int64_t lr;
- 	off64_t off;
- 	struct stat64 stb;
- 	int v;
-@@ -1398,7 +1399,7 @@ void allocsp_f(int opno, long r)
- 		close(fd);
- 		return;
- 	}
--	lr = ((__int64_t) random() << 32) + random();
-+	lr = ((int64_t) random() << 32) + random();
- 	off = (off64_t) (lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
- 	off %= maxfsize;
- 	fl.l_whence = SEEK_SET;
-@@ -1519,7 +1520,7 @@ void bulkstat_f(int opno, long r)
- 	__uint64_t last;
- 	int nent;
- 	xfs_bstat_t *t;
--	__int64_t total;
-+	int64_t total;
- 	xfs_fsop_bulkreq_t bsr;
- 
- 	last = 0;
-@@ -1708,14 +1709,14 @@ int setdirect(int fd)
- 
- void dread_f(int opno, long r)
- {
--	__int64_t align;
-+	int64_t align;
- 	char *buf;
- 	struct dioattr diob;
- 	int e;
- 	pathname_t f;
- 	int fd;
- 	size_t len;
--	__int64_t lr;
-+	int64_t lr;
- 	off64_t off;
- 	struct stat64 stb;
- 	int v;
-@@ -1775,8 +1776,8 @@ void dread_f(int opno, long r)
- 		return;
- 	}
- #endif
--	align = (__int64_t) diob.d_miniosz;
--	lr = ((__int64_t) random() << 32) + random();
-+	align = (int64_t) diob.d_miniosz;
-+	lr = ((int64_t) random() << 32) + random();
- 	off = (off64_t) (lr % stb.st_size);
- 	off -= (off % align);
- 	lseek64(fd, off, SEEK_SET);
-@@ -1798,14 +1799,14 @@ void dread_f(int opno, long r)
- 
- void dwrite_f(int opno, long r)
- {
--	__int64_t align;
-+	int64_t align;
- 	char *buf;
- 	struct dioattr diob;
- 	int e;
- 	pathname_t f;
- 	int fd;
- 	size_t len;
--	__int64_t lr;
-+	int64_t lr;
- 	off64_t off;
- 	struct stat64 stb;
- 	int v;
-@@ -1854,8 +1855,8 @@ void dwrite_f(int opno, long r)
- 		return;
- 	}
- #endif
--	align = (__int64_t) diob.d_miniosz;
--	lr = ((__int64_t) random() << 32) + random();
-+	align = (int64_t) diob.d_miniosz;
-+	lr = ((int64_t) random() << 32) + random();
- 	off = (off64_t) (lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
- 	off -= (off % align);
- 	lseek64(fd, off, SEEK_SET);
-@@ -1917,7 +1918,7 @@ void freesp_f(int opno, long r)
- 	pathname_t f;
- 	int fd;
- 	struct flock64 fl;
--	__int64_t lr;
-+	int64_t lr;
- 	off64_t off;
- 	struct stat64 stb;
- 	int v;
-@@ -1947,7 +1948,7 @@ void freesp_f(int opno, long r)
- 		close(fd);
- 		return;
- 	}
--	lr = ((__int64_t) random() << 32) + random();
-+	lr = ((int64_t) random() << 32) + random();
- 	off = (off64_t) (lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
- 	off %= maxfsize;
- 	fl.l_whence = SEEK_SET;
-@@ -2145,7 +2146,7 @@ void read_f(int opno, long r)
- 	pathname_t f;
- 	int fd;
- 	size_t len;
--	__int64_t lr;
-+	int64_t lr;
- 	off64_t off;
- 	struct stat64 stb;
- 	int v;
-@@ -2183,7 +2184,7 @@ void read_f(int opno, long r)
- 		close(fd);
- 		return;
- 	}
--	lr = ((__int64_t) random() << 32) + random();
-+	lr = ((int64_t) random() << 32) + random();
- 	off = (off64_t) (lr % stb.st_size);
- 	lseek64(fd, off, SEEK_SET);
- 	len = (random() % (getpagesize() * 32)) + 1;
-@@ -2281,7 +2282,7 @@ void resvsp_f(int opno, long r)
- 	pathname_t f;
- 	int fd;
- 	struct flock64 fl;
--	__int64_t lr;
-+	int64_t lr;
- 	off64_t off;
- 	struct stat64 stb;
- 	int v;
-@@ -2311,7 +2312,7 @@ void resvsp_f(int opno, long r)
- 		close(fd);
- 		return;
- 	}
--	lr = ((__int64_t) random() << 32) + random();
-+	lr = ((int64_t) random() << 32) + random();
- 	off = (off64_t) (lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
- 	off %= maxfsize;
- 	fl.l_whence = SEEK_SET;
-@@ -2428,7 +2429,7 @@ void truncate_f(int opno, long r)
- {
- 	int e;
- 	pathname_t f;
--	__int64_t lr;
-+	int64_t lr;
- 	off64_t off;
- 	struct stat64 stb;
- 	int v;
-@@ -2449,7 +2450,7 @@ void truncate_f(int opno, long r)
- 		free_pathname(&f);
- 		return;
- 	}
--	lr = ((__int64_t) random() << 32) + random();
-+	lr = ((int64_t) random() << 32) + random();
- 	off = (off64_t) (lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
- 	off %= maxfsize;
- 	e = truncate64_path(&f, off) < 0 ? errno : 0;
-@@ -2491,7 +2492,7 @@ void unresvsp_f(int opno, long r)
- 	pathname_t f;
- 	int fd;
- 	struct flock64 fl;
--	__int64_t lr;
-+	int64_t lr;
- 	off64_t off;
- 	struct stat64 stb;
- 	int v;
-@@ -2521,7 +2522,7 @@ void unresvsp_f(int opno, long r)
- 		close(fd);
- 		return;
- 	}
--	lr = ((__int64_t) random() << 32) + random();
-+	lr = ((int64_t) random() << 32) + random();
- 	off = (off64_t) (lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
- 	off %= maxfsize;
- 	fl.l_whence = SEEK_SET;
-@@ -2543,7 +2544,7 @@ void write_f(int opno, long r)
- 	pathname_t f;
- 	int fd;
- 	size_t len;
--	__int64_t lr;
-+	int64_t lr;
- 	off64_t off;
- 	struct stat64 stb;
- 	int v;
-@@ -2573,7 +2574,7 @@ void write_f(int opno, long r)
- 		close(fd);
- 		return;
- 	}
--	lr = ((__int64_t) random() << 32) + random();
-+	lr = ((int64_t) random() << 32) + random();
- 	off = (off64_t) (lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
- 	off %= maxfsize;
- 	lseek64(fd, off, SEEK_SET);
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0013-include-fcntl.h-for-getting-O_-definitions.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0013-include-fcntl.h-for-getting-O_-definitions.patch
deleted file mode 100644
index 4266e4f..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0013-include-fcntl.h-for-getting-O_-definitions.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From 1ef8c32317064438ec3b37a114f5d82957f4e0c6 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 7 Jan 2016 20:05:54 +0000
-Subject: [PATCH 13/32] include fcntl.h for getting O_* definitions
-
-musl exposes this issue, with glibc fcntl.h is included via some other
-header and this problem remained latent
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- testcases/kernel/ipc/ipc_stress/shmem_test_03.c   | 1 +
- testcases/kernel/syscalls/mq_notify/mq_notify01.c | 1 +
- testcases/network/tcp_cmds/sendfile/testsf_c.c    | 1 +
- testcases/network/tcp_cmds/sendfile/testsf_s.c    | 1 +
- 4 files changed, 4 insertions(+)
-
-diff --git a/testcases/kernel/ipc/ipc_stress/shmem_test_03.c b/testcases/kernel/ipc/ipc_stress/shmem_test_03.c
-index c1b11fd..8be156f 100644
---- a/testcases/kernel/ipc/ipc_stress/shmem_test_03.c
-+++ b/testcases/kernel/ipc/ipc_stress/shmem_test_03.c
-@@ -72,6 +72,7 @@
- #include <string.h>
- #include <unistd.h>
- #include <limits.h>
-+#include <fcntl.h>
- #include <sys/file.h>
- #include <sys/ipc.h>
- #include <sys/mman.h>
-diff --git a/testcases/kernel/syscalls/mq_notify/mq_notify01.c b/testcases/kernel/syscalls/mq_notify/mq_notify01.c
-index 4728c70..5c7846c 100644
---- a/testcases/kernel/syscalls/mq_notify/mq_notify01.c
-+++ b/testcases/kernel/syscalls/mq_notify/mq_notify01.c
-@@ -41,6 +41,7 @@
- #include <mqueue.h>
- #include <signal.h>
- #include <stdlib.h>
-+#include <fcntl.h>
- 
- #include "../utils/include_j_h.h"
- 
-diff --git a/testcases/network/tcp_cmds/sendfile/testsf_c.c b/testcases/network/tcp_cmds/sendfile/testsf_c.c
-index 449784f..38d3274 100644
---- a/testcases/network/tcp_cmds/sendfile/testsf_c.c
-+++ b/testcases/network/tcp_cmds/sendfile/testsf_c.c
-@@ -9,6 +9,7 @@
- #include <sys/types.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <fcntl.h>
- #include <sys/file.h>
- #include <arpa/inet.h>
- #include <netinet/in.h>
-diff --git a/testcases/network/tcp_cmds/sendfile/testsf_s.c b/testcases/network/tcp_cmds/sendfile/testsf_s.c
-index 17e98ad..bce8dd1 100644
---- a/testcases/network/tcp_cmds/sendfile/testsf_s.c
-+++ b/testcases/network/tcp_cmds/sendfile/testsf_s.c
-@@ -6,6 +6,7 @@
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
-+#include <fcntl.h>
- #include <sys/file.h>
- #include <errno.h>
- #include <sys/signal.h>
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0014-hyperthreading-Include-sys-types.h-for-pid_t-definit.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0014-hyperthreading-Include-sys-types.h-for-pid_t-definit.patch
deleted file mode 100644
index 84d81e9..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0014-hyperthreading-Include-sys-types.h-for-pid_t-definit.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From d63fefa86dac437c47b9ebbea0a82a1240aaba2c Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 7 Jan 2016 20:09:56 +0000
-Subject: [PATCH 14/32] hyperthreading: Include sys/types.h for pid_t
- definition
-
-If sys/types.h is not included then it will not define pid_t_needed
-and therefore typedef wont be included and we get errors about pid_t
-being not known
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- testcases/kernel/sched/hyperthreading/ht_affinity/ht_utils.h  | 1 +
- testcases/kernel/sched/hyperthreading/ht_enabled/ht_utils.h   | 1 +
- testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.h | 1 +
- 3 files changed, 3 insertions(+)
-
-diff --git a/testcases/kernel/sched/hyperthreading/ht_affinity/ht_utils.h b/testcases/kernel/sched/hyperthreading/ht_affinity/ht_utils.h
-index 1ec9794..9084aa7 100644
---- a/testcases/kernel/sched/hyperthreading/ht_affinity/ht_utils.h
-+++ b/testcases/kernel/sched/hyperthreading/ht_affinity/ht_utils.h
-@@ -3,6 +3,7 @@
- #define _HTUTILS_H_
- 
- #include <stdlib.h>
-+#include <sys/types.h>
- 
- int is_cmdline_para(const char *para);
- 
-diff --git a/testcases/kernel/sched/hyperthreading/ht_enabled/ht_utils.h b/testcases/kernel/sched/hyperthreading/ht_enabled/ht_utils.h
-index 1ec9794..c03a124 100644
---- a/testcases/kernel/sched/hyperthreading/ht_enabled/ht_utils.h
-+++ b/testcases/kernel/sched/hyperthreading/ht_enabled/ht_utils.h
-@@ -2,6 +2,7 @@
- #ifndef _HTUTILS_H_
- #define _HTUTILS_H_
- 
-+#include <sys/types.h>
- #include <stdlib.h>
- 
- int is_cmdline_para(const char *para);
-diff --git a/testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.h b/testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.h
-index 2977ad0..6b484e1 100644
---- a/testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.h
-+++ b/testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.h
-@@ -3,6 +3,7 @@
- #define _HTUTILS_H_
- 
- #include <stdlib.h>
-+#include <sys/types.h>
- 
- int is_cmdline_para(const char *para);
- 
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0015-mincore01-Rename-PAGESIZE-to-pagesize.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0015-mincore01-Rename-PAGESIZE-to-pagesize.patch
deleted file mode 100644
index 963536f..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0015-mincore01-Rename-PAGESIZE-to-pagesize.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From f091839532f3afe0a58e8ba0b45615c899a43a47 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 7 Jan 2016 20:12:09 +0000
-Subject: [PATCH 15/32] mincore01: Rename PAGESIZE to pagesize
-
-PAGESIZE conflicts with system headers on musl
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- testcases/kernel/syscalls/mincore/mincore01.c | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/testcases/kernel/syscalls/mincore/mincore01.c b/testcases/kernel/syscalls/mincore/mincore01.c
-index 97a3d95..fa426d1 100644
---- a/testcases/kernel/syscalls/mincore/mincore01.c
-+++ b/testcases/kernel/syscalls/mincore/mincore01.c
-@@ -45,7 +45,7 @@
- #include "test.h"
- #include "safe_macros.h"
- 
--static int PAGESIZE;
-+static int pagesize;
- static rlim_t STACK_LIMIT = 10485760;
- 
- static void cleanup(void);
-@@ -146,7 +146,7 @@ static void setup4(struct test_case_t *tc)
- 	}
- 
- 	tc->addr = global_pointer;
--	tc->len = as_lim.rlim_cur - (rlim_t)global_pointer + PAGESIZE;
-+	tc->len = as_lim.rlim_cur - (rlim_t)global_pointer + pagesize;
- 	tc->vector = global_vec;
- 
- 	/*
-@@ -161,7 +161,7 @@ static void setup(void)
- 	char *buf;
- 	int fd;
- 
--	PAGESIZE = getpagesize();
-+	pagesize = getpagesize();
- 
- 	tst_sig(NOFORK, DEF_HANDLER, cleanup);
- 
-@@ -170,7 +170,7 @@ static void setup(void)
- 	TEST_PAUSE;
- 
- 	/* global_pointer will point to a mmapped area of global_len bytes */
--	global_len = PAGESIZE * 2;
-+	global_len = pagesize * 2;
- 
- 	buf = SAFE_MALLOC(cleanup, global_len);
- 	memset(buf, 42, global_len);
-@@ -186,7 +186,7 @@ static void setup(void)
- 				   PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- 
- 	global_vec = SAFE_MALLOC(cleanup,
--				 (global_len + PAGESIZE - 1) / PAGESIZE);
-+				 (global_len + pagesize - 1) / pagesize);
- 
- 	SAFE_CLOSE(cleanup, fd);
- }
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0016-ustat-Change-header-from-ustat.h-to-sys-ustat.h.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0016-ustat-Change-header-from-ustat.h-to-sys-ustat.h.patch
deleted file mode 100644
index 1b5b93a..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0016-ustat-Change-header-from-ustat.h-to-sys-ustat.h.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 2b9be924bbad8a1f84ae553fdd1aa8391aa8d2f4 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 7 Jan 2016 20:15:07 +0000
-Subject: [PATCH 16/32] ustat: Change header from ustat.h to sys/ustat.h
-
-makes it portable for musl, on glibc ustat.h is just including
-sys/ustat.h too
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- testcases/kernel/syscalls/ustat/ustat01.c | 2 +-
- testcases/kernel/syscalls/ustat/ustat02.c | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/testcases/kernel/syscalls/ustat/ustat01.c b/testcases/kernel/syscalls/ustat/ustat01.c
-index 01b7688..494647b 100644
---- a/testcases/kernel/syscalls/ustat/ustat01.c
-+++ b/testcases/kernel/syscalls/ustat/ustat01.c
-@@ -20,8 +20,8 @@
-  */
- 
- #include <unistd.h>
--#include <ustat.h>
- #include <errno.h>
-+#include <sys/ustat.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include "test.h"
-diff --git a/testcases/kernel/syscalls/ustat/ustat02.c b/testcases/kernel/syscalls/ustat/ustat02.c
-index 4e66236..edada31 100644
---- a/testcases/kernel/syscalls/ustat/ustat02.c
-+++ b/testcases/kernel/syscalls/ustat/ustat02.c
-@@ -21,8 +21,8 @@
-  */
- 
- #include <unistd.h>
--#include <ustat.h>
- #include <errno.h>
-+#include <sys/ustat.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- #include "test.h"
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0017-replace-sigval_t-with-union-sigval.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0017-replace-sigval_t-with-union-sigval.patch
deleted file mode 100644
index ed25802..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0017-replace-sigval_t-with-union-sigval.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-From c882bcd18820b44a685f0d5edd7aaff77a88c912 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 7 Jan 2016 20:17:55 +0000
-Subject: [PATCH 17/32] replace sigval_t with union sigval
-
-This makes it compatible across musl and glibc
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c | 2 +-
- testcases/kernel/syscalls/timer_gettime/timer_gettime01.c       | 2 +-
- testcases/kernel/timers/timer_create/timer_create02.c           | 4 ++--
- testcases/kernel/timers/timer_create/timer_create03.c           | 4 ++--
- 4 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c b/testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c
-index d186c1f..bc03544 100644
---- a/testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c
-+++ b/testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c
-@@ -54,7 +54,7 @@ int main(int ac, char **av)
- 
- 	setup();
- 
--	ev.sigev_value = (sigval_t) 0;
-+	ev.sigev_value = (union sigval) 0;
- 	ev.sigev_signo = SIGALRM;
- 	ev.sigev_notify = SIGEV_SIGNAL;
- 	TEST(ltp_syscall(__NR_timer_create, CLOCK_REALTIME, &ev, &timer));
-diff --git a/testcases/kernel/syscalls/timer_gettime/timer_gettime01.c b/testcases/kernel/syscalls/timer_gettime/timer_gettime01.c
-index b583aee..9371a6a 100644
---- a/testcases/kernel/syscalls/timer_gettime/timer_gettime01.c
-+++ b/testcases/kernel/syscalls/timer_gettime/timer_gettime01.c
-@@ -55,7 +55,7 @@ int main(int ac, char **av)
- 
- 	setup();
- 
--	ev.sigev_value = (sigval_t) 0;
-+	ev.sigev_value = (union sigval) 0;
- 	ev.sigev_signo = SIGALRM;
- 	ev.sigev_notify = SIGEV_SIGNAL;
- 	TEST(ltp_syscall(__NR_timer_create, CLOCK_REALTIME, &ev, &timer));
-diff --git a/testcases/kernel/timers/timer_create/timer_create02.c b/testcases/kernel/timers/timer_create/timer_create02.c
-index 7f528ed..1127400 100644
---- a/testcases/kernel/timers/timer_create/timer_create02.c
-+++ b/testcases/kernel/timers/timer_create/timer_create02.c
-@@ -142,7 +142,7 @@ void setup_test(int option)
- {
- 	switch (option) {
- 	case 0:
--		evp.sigev_value = (sigval_t) 0;
-+		evp.sigev_value = (union sigval) 0;
- 		evp.sigev_signo = SIGALRM;
- 		evp.sigev_notify = SIGEV_SIGNAL;
- 		evp_ptr = &evp;
-@@ -151,7 +151,7 @@ void setup_test(int option)
- 		evp_ptr = NULL;
- 		break;
- 	case 2:
--		evp.sigev_value = (sigval_t) 0;
-+		evp.sigev_value = (union sigval) 0;
- 		evp.sigev_signo = SIGALRM;	/* any will do */
- 		evp.sigev_notify = SIGEV_NONE;
- 		evp_ptr = &evp;
-diff --git a/testcases/kernel/timers/timer_create/timer_create03.c b/testcases/kernel/timers/timer_create/timer_create03.c
-index 291fcfa..8b01bf7 100644
---- a/testcases/kernel/timers/timer_create/timer_create03.c
-+++ b/testcases/kernel/timers/timer_create/timer_create03.c
-@@ -129,7 +129,7 @@ void setup_test(int option)
- {
- 	switch (option) {
- 	case 0:
--		evp.sigev_value = (sigval_t) 0;
-+		evp.sigev_value = (union sigval) 0;
- 		evp.sigev_signo = SIGALRM;
- 		evp.sigev_notify = SIGEV_SIGNAL;
- 		evp_ptr = &evp;
-@@ -138,7 +138,7 @@ void setup_test(int option)
- 		evp_ptr = NULL;
- 		break;
- 	case 2:
--		evp.sigev_value = (sigval_t) 0;
-+		evp.sigev_value = (union sigval) 0;
- 		evp.sigev_signo = SIGALRM;	/* any will do */
- 		evp.sigev_notify = SIGEV_NONE;
- 		evp_ptr = &evp;
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0019-tomoyo-Replace-canonicalize_file_name-with-realpath.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0019-tomoyo-Replace-canonicalize_file_name-with-realpath.patch
deleted file mode 100644
index 0a4c5f0..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0019-tomoyo-Replace-canonicalize_file_name-with-realpath.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 721e94985b9cff3e2724af7ea5be7d005bc12dec Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 8 Jan 2016 06:55:27 +0000
-Subject: [PATCH 19/32] tomoyo: Replace canonicalize_file_name() with
- realpath()
-
-canonicalize_file_name() API is specific to glibc
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- testcases/kernel/security/tomoyo/tomoyo_filesystem_test.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/testcases/kernel/security/tomoyo/tomoyo_filesystem_test.c b/testcases/kernel/security/tomoyo/tomoyo_filesystem_test.c
-index da4af0f..5c1a3ca 100644
---- a/testcases/kernel/security/tomoyo/tomoyo_filesystem_test.c
-+++ b/testcases/kernel/security/tomoyo/tomoyo_filesystem_test.c
-@@ -274,9 +274,9 @@ int main(int argc, char *argv[])
- 	/* Test mount(). */
- 	{
- 		static char buf[4096];
--		char *dev_ram_path = canonicalize_file_name("/dev/ram0");
-+		char *dev_ram_path = realpath("/dev/ram0", NULL);
- 		if (!dev_ram_path)
--			dev_ram_path = canonicalize_file_name("/dev/ram");
-+			dev_ram_path = realpath("/dev/ram", NULL);
- 		if (!dev_ram_path) {
- 			dev_ram_path = "/dev/ram0";
- 			mknod(dev_ram_path, S_IFBLK, MKDEV(1, 0));
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0022-include-sys-types.h.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0022-include-sys-types.h.patch
deleted file mode 100644
index 413b44a..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0022-include-sys-types.h.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 7ac6fd51991ac61d1d7594f601d87842060ee284 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 8 Jan 2016 07:06:11 +0000
-Subject: [PATCH 22/32] include sys/types.h
-
-Fixes
-
-error: unknown type name 'uint'
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- testcases/kernel/ipc/ipc_stress/shmem_test_04.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/testcases/kernel/ipc/ipc_stress/shmem_test_04.c b/testcases/kernel/ipc/ipc_stress/shmem_test_04.c
-index 72c2e60..e7e5f61 100644
---- a/testcases/kernel/ipc/ipc_stress/shmem_test_04.c
-+++ b/testcases/kernel/ipc/ipc_stress/shmem_test_04.c
-@@ -65,6 +65,7 @@
- #include <signal.h>
- #include <stdint.h>
- #include <sys/mman.h>
-+#include <sys/types.h>
- 
- #ifdef _LINUX_
- typedef unsigned long ulong_t;
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0027-sysconf01-Use-_SC_2_C_VERSION-conditionally.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0027-sysconf01-Use-_SC_2_C_VERSION-conditionally.patch
index b47d097..f75e33b 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0027-sysconf01-Use-_SC_2_C_VERSION-conditionally.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0027-sysconf01-Use-_SC_2_C_VERSION-conditionally.patch
@@ -1,29 +1,30 @@
-From 4a74b275acc8158850f2500928a1467c3482c986 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 8 Jan 2016 07:23:11 +0000
-Subject: [PATCH 27/32] sysconf01: Use _SC_2_C_VERSION conditionally
+From 1471012164ba8f26046d4b1ce5531a0d92805ef5 Mon Sep 17 00:00:00 2001
+From: Dengke Du <dengke.du@windriver.com>
+Date: Wed, 8 Feb 2017 16:21:16 +0800
+Subject: [PATCH 4/5] sysconf01: Use _SC_2_C_VERSION conditionally
 
 _SC_2_C_VERSION is not available on musl
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Dengke Du <dengke.du@windriver.com>
 ---
  testcases/kernel/syscalls/sysconf/sysconf01.c | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/testcases/kernel/syscalls/sysconf/sysconf01.c b/testcases/kernel/syscalls/sysconf/sysconf01.c
-index 8542e77..e806943 100644
+index 583deef..de93695 100644
 --- a/testcases/kernel/syscalls/sysconf/sysconf01.c
 +++ b/testcases/kernel/syscalls/sysconf/sysconf01.c
-@@ -102,7 +102,9 @@ int main(void)
- 	test_sysconf(_SC_ATEXIT_MAX);
+@@ -103,7 +103,9 @@ int main(void)
  	test_sysconf(_SC_2_C_BIND);
  	test_sysconf(_SC_2_C_DEV);
+ #ifdef _SC_2_C_VERSION
 +#ifdef __GLIBC__
  	test_sysconf(_SC_2_C_VERSION);
 +#endif
- 	/* 21 - 25 */
- 	test_sysconf(_SC_2_CHAR_TERM);
- 	test_sysconf(_SC_2_FORT_DEV);
+ #else
+ 	tst_resm(TCONF, "_SC_2_C_VERSION not defined");
+ #endif
 -- 
-2.7.0
+2.7.4
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0028-rt_sigaction.h-Use-sighandler_t-instead-of-__sighand.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0028-rt_sigaction.h-Use-sighandler_t-instead-of-__sighand.patch
index fc82ff9..b26aa13 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0028-rt_sigaction.h-Use-sighandler_t-instead-of-__sighand.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0028-rt_sigaction.h-Use-sighandler_t-instead-of-__sighand.patch
@@ -13,23 +13,29 @@
  testcases/kernel/syscalls/rt_sigsuspend/Makefile | 3 +++
  2 files changed, 4 insertions(+), 1 deletion(-)
 
-diff --git a/include/lapi/rt_sigaction.h b/include/lapi/rt_sigaction.h
-index 3a5a763..870918c 100644
---- a/include/lapi/rt_sigaction.h
-+++ b/include/lapi/rt_sigaction.h
-@@ -34,7 +34,7 @@
- #define INVAL_SA_PTR ((void *)-1)
- 
+Index: git/include/lapi/rt_sigaction.h
+===================================================================
+--- git.orig/include/lapi/rt_sigaction.h
++++ git/include/lapi/rt_sigaction.h
+@@ -36,12 +36,12 @@
+ #if defined(__mips__)
+ struct kernel_sigaction {
+ 	unsigned int sa_flags;
+-	__sighandler_t k_sa_handler;
++	sighandler_t k_sa_handler;
+ 	sigset_t sa_mask;
+ };
+ #else
  struct kernel_sigaction {
 -	__sighandler_t k_sa_handler;
 +	sighandler_t k_sa_handler;
  	unsigned long sa_flags;
  	void (*sa_restorer) (void);
  	sigset_t sa_mask;
-diff --git a/testcases/kernel/syscalls/rt_sigsuspend/Makefile b/testcases/kernel/syscalls/rt_sigsuspend/Makefile
-index 37bc3a9..2ca7f7c 100644
---- a/testcases/kernel/syscalls/rt_sigsuspend/Makefile
-+++ b/testcases/kernel/syscalls/rt_sigsuspend/Makefile
+Index: git/testcases/kernel/syscalls/rt_sigsuspend/Makefile
+===================================================================
+--- git.orig/testcases/kernel/syscalls/rt_sigsuspend/Makefile
++++ git/testcases/kernel/syscalls/rt_sigsuspend/Makefile
 @@ -19,4 +19,7 @@
  top_srcdir		?= ../../../..
  
@@ -38,6 +44,3 @@
 +CFLAGS	+= -D_GNU_SOURCE
 +
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0029-trace_shed-Fix-build-with-musl.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0029-trace_shed-Fix-build-with-musl.patch
deleted file mode 100644
index f7ece9e..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0029-trace_shed-Fix-build-with-musl.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 2f8a57f66a94210d34dd0361659a8297cf3d813f Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 8 Jan 2016 07:29:24 +0000
-Subject: [PATCH 29/32] trace_shed: Fix build with musl
-
-Errors on musl are
-
-trace_sched.c:425:16: error: invalid operands to binary & (have
-'thread_sched_t * {aka struct <anonymous> *}' and 'int')
-      thrd_ndx, WEXITSTATUS(status));
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- testcases/kernel/sched/tool/trace_sched.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/testcases/kernel/sched/tool/trace_sched.c b/testcases/kernel/sched/tool/trace_sched.c
-index 7815686..30dca5f 100644
---- a/testcases/kernel/sched/tool/trace_sched.c
-+++ b/testcases/kernel/sched/tool/trace_sched.c
-@@ -422,7 +422,7 @@ int main(int argc,		/* number of input parameters.                        */
- 			if (status == (thread_sched_t *) - 1) {
- 				fprintf(stderr,
- 					"thread [%d] - process exited with errors %d\n",
--					thrd_ndx, WEXITSTATUS(status));
-+					thrd_ndx, WEXITSTATUS((int)status));
- 				exit(-1);
- 			} else {
- 				exp_prio[thrd_ndx] = status->exp_prio;
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0030-lib-Use-PTHREAD_MUTEX_RECURSIVE-in-place-of-PTHREAD_.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0030-lib-Use-PTHREAD_MUTEX_RECURSIVE-in-place-of-PTHREAD_.patch
index d2d6d76..c5fac9b 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0030-lib-Use-PTHREAD_MUTEX_RECURSIVE-in-place-of-PTHREAD_.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0030-lib-Use-PTHREAD_MUTEX_RECURSIVE-in-place-of-PTHREAD_.patch
@@ -1,33 +1,33 @@
-From 77c95dacffe90382a1f131c801ac569120d95949 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 8 Jan 2016 07:32:24 +0000
-Subject: [PATCH 30/32] lib: Use PTHREAD_MUTEX_RECURSIVE in place of
+From 00ba7cdd0608b1507027428f9f87b1cb9747372b Mon Sep 17 00:00:00 2001
+From: Dengke Du <dengke.du@windriver.com>
+Date: Thu, 9 Feb 2017 15:54:53 +0800
+Subject: [PATCH] lib: Use PTHREAD_MUTEX_RECURSIVE in place of
  PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP for non-glibc
 
 e.g. musl does not implement the _NP mutex types
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Dengke Du <dengke.du@windriver.com>
 ---
- lib/tst_res.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
+ lib/tst_res.c | 4 ++++
+ 1 file changed, 4 insertions(+)
 
 diff --git a/lib/tst_res.c b/lib/tst_res.c
-index 5c1c58c..3244b5e 100644
+index 61daaeb..435224f 100644
 --- a/lib/tst_res.c
 +++ b/lib/tst_res.c
-@@ -104,8 +104,11 @@ int TEST_ERRNO;
+@@ -79,7 +79,11 @@ int TEST_ERRNO;
  	assert(strlen(buf) > 0);		\
  } while (0)
  
 +#ifdef __GLIBC__
  static pthread_mutex_t tmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
--
 +#else
 +static pthread_mutex_t tmutex = {  PTHREAD_MUTEX_RECURSIVE };
 +#endif
- /*
-  * Define local function prototypes.
-  */
+ 
+ static void check_env(void);
+ static void tst_condense(int tnum, int ttype, const char *tmesg);
 -- 
-2.7.0
+2.7.4
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0031-vma03-fix-page-size-offset-as-per-page-size-alignmen.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0031-vma03-fix-page-size-offset-as-per-page-size-alignmen.patch
deleted file mode 100644
index 473ca4c..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0031-vma03-fix-page-size-offset-as-per-page-size-alignmen.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 293ff1da06748ed4c69be6ece262d42e562e7298 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 8 Jan 2016 07:36:19 +0000
-Subject: [PATCH 31/32] vma03: fix page size offset as per page size alignment
-
-the offset the param of mmap2() doesn't align the page size, but,
-this param allow must be a multiple of the page size as returned
-by sysconf(_SC_PAGE_SIZE).meanwhile offset * 4096 must be a
-multiple of the system page size, so modify the input param of offset
-pgoff = (ULONG_MAX - 1)&(~((pgsz-1)>>12));
-
-Signed-off-by: Chuang Dong <Chuang.Dong@windriver.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- testcases/kernel/mem/vma/vma03.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/testcases/kernel/mem/vma/vma03.c b/testcases/kernel/mem/vma/vma03.c
-index ad8a7b4..a539233 100644
---- a/testcases/kernel/mem/vma/vma03.c
-+++ b/testcases/kernel/mem/vma/vma03.c
-@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
- 		if (fd == -1)
- 			tst_brkm(TBROK | TERRNO, NULL, "open %s", TESTFILE);
- 
--		pgoff = ULONG_MAX - 1;
-+		pgoff = (ULONG_MAX - 1)&(~((pgsz-1)>>12));
- 		map = mmap2(NULL, pgsz, PROT_READ | PROT_WRITE, MAP_PRIVATE,
- 			    fd, pgoff);
- 		if (map == MAP_FAILED)
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0032-regen.sh-Include-asm-unistd.h-explicitly.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0032-regen.sh-Include-asm-unistd.h-explicitly.patch
deleted file mode 100644
index 5c6bf91..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0032-regen.sh-Include-asm-unistd.h-explicitly.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 4f1905ff09c730091674818bd1b48ee221347101 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 8 Jan 2016 08:30:29 +0000
-Subject: [PATCH 32/32] regen.sh: Include asm/unistd.h explicitly
-
-on musl this is not included indirectly and it results in errors like
-testcases/kernel/include/linux_syscall_numbers.h:1035:25: error:
-'__NR_SYSCALL_BASE' undeclared (first use in this function)
-|  #  define __NR_readdir (__NR_SYSCALL_BASE+ 89)
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- testcases/kernel/include/regen.sh | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/testcases/kernel/include/regen.sh b/testcases/kernel/include/regen.sh
-index f93f49b..ee790af 100755
---- a/testcases/kernel/include/regen.sh
-+++ b/testcases/kernel/include/regen.sh
-@@ -32,6 +32,7 @@ cat << EOF > "${output_pid}"
- 
- #include <errno.h>
- #include <sys/syscall.h>
-+#include <asm/unistd.h>
- #include "cleanup.c"
- 
- #define ltp_syscall(NR, ...) ({ \\
--- 
-2.7.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0035-fix-test_proc_kill-hang.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0035-fix-test_proc_kill-hang.patch
index 32ae8aa..71e32a5 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0035-fix-test_proc_kill-hang.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0035-fix-test_proc_kill-hang.patch
@@ -1,23 +1,32 @@
-Fix test_proc_kill hanging
+From f7c602b639db0d118e07d3fa7b6deead0be0c72b Mon Sep 17 00:00:00 2001
+From: Dengke Du <dengke.du@windriver.com>
+Date: Wed, 8 Feb 2017 16:17:17 +0800
+Subject: [PATCH 3/5] Fix test_proc_kill hanging
 
 Sometimes the signal is delivered to memcg_process before the framework took
 into consideration its pid entered in the tasks. Fixed by delaying the signal
 send command.
 
 Signed-off-by: George Nita <george.nita@enea.com>
-Upstream-Status: Pending 
+Signed-off-by: Dengke Du <dengke.du@windriver.com>
+
+Upstream-Status: Pending
+---
+ testcases/kernel/controllers/memcg/functional/memcg_lib.sh | 1 +
+ 1 file changed, 1 insertion(+)
 
 diff --git a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
-index ffbe006..e81bf74 100755
+index b785fe3..2918cc5 100755
 --- a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
 +++ b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
-@@ -220,8 +220,8 @@ test_proc_kill()
- 
- 	$TEST_PATH/memcg_process $2 -s $3 &
+@@ -283,6 +283,7 @@ test_proc_kill()
  	pid=$!
--	sleep 1
+ 	TST_CHECKPOINT_WAIT 0
  	echo $pid > tasks
 +	sleep 1
  
- 	kill -s USR1 $pid 2> /dev/null
- 	sleep 1
+ 	signal_memcg_process $pid $3
+ 
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0001-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch
similarity index 100%
rename from import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0001-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch
rename to import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0039-fcntl-fix-the-time-def-to-use-time_t.patch b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0039-fcntl-fix-the-time-def-to-use-time_t.patch
new file mode 100644
index 0000000..c0c1dad
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp/0039-fcntl-fix-the-time-def-to-use-time_t.patch
@@ -0,0 +1,29 @@
+From 7bce3d223494803cb32897cabe66119076e53d89 Mon Sep 17 00:00:00 2001
+From: Dengke Du <dengke.du@windriver.com>
+Date: Wed, 8 Feb 2017 16:23:51 +0800
+Subject: [PATCH 5/5] fcntl: fix the time() def to use time_t
+
+This fixes the build on X32, where long is 32-bit rather than 64-bit.
+
+Signed-off-by: Christopher Larson <chris_larson@mentor.com>
+Signed-off-by: Dengke Du <dengke.du@windriver.com>
+---
+ testcases/kernel/syscalls/fcntl/fcntl14.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/testcases/kernel/syscalls/fcntl/fcntl14.c b/testcases/kernel/syscalls/fcntl/fcntl14.c
+index c61eb24..99e3867 100644
+--- a/testcases/kernel/syscalls/fcntl/fcntl14.c
++++ b/testcases/kernel/syscalls/fcntl/fcntl14.c
+@@ -775,7 +775,7 @@ void dochild(void)
+ 
+ void run_test(int file_flag, int file_mode, int seek, int start, int end)
+ {
+-	extern long time();
++	extern time_t time();
+ 
+ 	fail = 0;
+ 
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp_20160126.bb b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp_20170116.bb
similarity index 78%
rename from import-layers/yocto-poky/meta/recipes-extended/ltp/ltp_20160126.bb
rename to import-layers/yocto-poky/meta/recipes-extended/ltp/ltp_20170116.bb
index 7631e0e..58af104 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp_20160126.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/ltp/ltp_20170116.bb
@@ -11,9 +11,6 @@
     file://testcases/kernel/hotplug/cpu_hotplug/COPYING;md5=e04a2e542b2b8629bf9cd2ba29b0fe41 \
     file://testcases/open_posix_testsuite/COPYING;md5=216e43b72efbe4ed9017cc19c4c68b01 \
     file://testcases/realtime/COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
-    file://tools/netpipe-2.4/COPYING;md5=9e3781bb5fe787aa80e1f51f5006b6fa \
-    file://tools/netpipe-2.4-ipv6/COPYING;md5=9e3781bb5fe787aa80e1f51f5006b6fa \
-    file://tools/top-LTP/proc/COPYING;md5=aefc88eb8a41672fbfcfe6b69ab8c49c \
     file://tools/pounder21/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
     file://utils/benchmark/kernbench-0.42/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
     file://utils/ffsb-6.0-rc2/COPYING;md5=c46082167a314d785d012a244748d803 \
@@ -23,46 +20,37 @@
 DEPENDS_append_libc-musl = " fts "
 EXTRA_OEMAKE_append_libc-musl = " LIBC=musl "
 CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__"
-CFLAGS_append_mips64 = " -D__SANE_USERSPACE_TYPES__"
-SRCREV = "fce797676b14f50406718e7ef640b50da66c9b36"
+CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
+SRCREV = "2c8457b0769fc026e4e1772f4c2a6da0be63a631"
 
 SRC_URI = "git://github.com/linux-test-project/ltp.git \
-           file://0001-ltp-Don-t-link-against-libfl.patch \
+           file://0001-add-_GNU_SOURCE-to-pec_listener.c.patch \
            file://0002-Add-knob-to-control-whether-numa-support-should-be-c.patch \
            file://0003-Add-knob-to-control-tirpc-support.patch \
            file://0004-build-Add-option-to-select-libc-implementation.patch \
            file://0005-kernel-controllers-Link-with-libfts-explicitly-on-mu.patch \
-           file://0006-sendfile-Use-off64_t-instead-of-__off64_t.patch \
-           file://0007-replace-SIGCLD-with-SIGCHLD.patch \
+           file://0006-fix-PATH_MAX-undeclared-when-building-with-musl.patch \
+           file://0007-fix-__WORDSIZE-undeclared-when-building-with-musl.patch \
            file://0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch \
-           file://0009-Guard-error.h-with-__GLIBC__.patch \
+           file://0009-fix-redefinition-of-struct-msgbuf-error-building-wit.patch \
            file://0010-replace-__BEGIN_DECLS-and-__END_DECLS.patch \
            file://0011-Rename-sigset-variable-to-sigset1.patch \
-           file://0012-fsstress.c-Replace-__int64_t-with-int64_t.patch \
-           file://0013-include-fcntl.h-for-getting-O_-definitions.patch \
-           file://0014-hyperthreading-Include-sys-types.h-for-pid_t-definit.patch \
-           file://0015-mincore01-Rename-PAGESIZE-to-pagesize.patch \
-           file://0016-ustat-Change-header-from-ustat.h-to-sys-ustat.h.patch \
-           file://0017-replace-sigval_t-with-union-sigval.patch \
+           file://0012-fix-faccessat01.c-build-fails-with-security-flags.patch \
            file://0018-guard-mallocopt-with-__GLIBC__.patch \
-           file://0019-tomoyo-Replace-canonicalize_file_name-with-realpath.patch \
            file://0020-getdents-define-getdents-getdents64-only-for-glibc.patch \
            file://0021-Define-_GNU_SOURCE-for-MREMAP_MAYMOVE-definition.patch \
-           file://0022-include-sys-types.h.patch \
            file://0023-ptrace-Use-int-instead-of-enum-__ptrace_request.patch \
            file://0024-rt_sigaction-rt_sigprocmark-Define-_GNU_SOURCE.patch \
            file://0025-mc_gethost-include-sys-types.h.patch \
            file://0026-crash01-Define-_GNU_SOURCE.patch \
            file://0027-sysconf01-Use-_SC_2_C_VERSION-conditionally.patch \
            file://0028-rt_sigaction.h-Use-sighandler_t-instead-of-__sighand.patch \
-           file://0029-trace_shed-Fix-build-with-musl.patch \
            file://0030-lib-Use-PTHREAD_MUTEX_RECURSIVE-in-place-of-PTHREAD_.patch \
-           file://0031-vma03-fix-page-size-offset-as-per-page-size-alignmen.patch \
-           file://0032-regen.sh-Include-asm-unistd.h-explicitly.patch \
            file://0033-shmat1-Cover-GNU-specific-code-under-__USE_GNU.patch \
            file://0034-periodic_output.patch \
            file://0035-fix-test_proc_kill-hang.patch \
-           file://0001-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch \
+           file://0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch \
+           file://0039-fcntl-fix-the-time-def-to-use-time_t.patch \
            "
 
 S = "${WORKDIR}/git"
@@ -100,13 +88,16 @@
     # OSDL's Scaleable Test Platform, but now http://khack.osdl.org unaccessible
     rm -rf ${D}/opt/ltp/bin/STPfailure_report.pl
 
+    # In oe-core, we doesn't support ksh and csh now, so remove in.csh and in.ksh.
+    rm ${D}/opt/ltp/testcases/data/file01/in.csh
+    rm ${D}/opt/ltp/testcases/data/file01/in.ksh
     # Copy POSIX test suite into ${D}/opt/ltp/testcases by manual
     cp -r testcases/open_posix_testsuite ${D}/opt/ltp/testcases
 }
 
-RDEPENDS_${PN} = "perl e2fsprogs-mke2fs python-core libaio bash gawk expect ldd"
+RDEPENDS_${PN} = "perl e2fsprogs-mke2fs python-core libaio bash gawk expect ldd unzip gzip cpio cronie logrotate which at"
 
-FILES_${PN}-staticdev += "/opt/ltp/lib/libmem.a"
+FILES_${PN}-staticdev += "/opt/ltp/lib/libmem.a /opt/ltp/testcases/data/nm01/lib.a"
 
 FILES_${PN} += "/opt/ltp/* /opt/ltp/runtest/* /opt/ltp/scenario_groups/* /opt/ltp/testcases/bin/* /opt/ltp/testcases/bin/*/bin/* /opt/ltp/testscripts/* /opt/ltp/testcases/open_posix_testsuite/* /opt/ltp/testcases/open_posix_testsuite/conformance/* /opt/ltp/testcases/open_posix_testsuite/Documentation/* /opt/ltp/testcases/open_posix_testsuite/functional/* /opt/ltp/testcases/open_posix_testsuite/include/* /opt/ltp/testcases/open_posix_testsuite/scripts/* /opt/ltp/testcases/open_posix_testsuite/stress/* /opt/ltp/testcases/open_posix_testsuite/tools/*"
 
@@ -116,3 +107,8 @@
 # However, test_arch_stripped is already stripped, so...
 INSANE_SKIP_${PN} += "already-stripped"
 
+# Avoid file dependency scans, as LTP checks for things that may or may not
+# exist on the running system.  For instance it has specific checks for
+# csh and ksh which are not typically part of OpenEmbedded systems (but
+# can be added via additional layers.)
+SKIP_FILEDEPS_${PN} = '1'
diff --git a/import-layers/yocto-poky/meta/recipes-extended/lzip/lzip_1.18.bb b/import-layers/yocto-poky/meta/recipes-extended/lzip/lzip_1.18.bb
new file mode 100644
index 0000000..c1dc8ce
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/lzip/lzip_1.18.bb
@@ -0,0 +1,41 @@
+SUMMARY = "Lossless data compressor based on the LZMA algorithm"
+HOMEPAGE = "http://lzip.nongnu.org/lzip.html"
+SECTION = "console/utils"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=76d6e300ffd8fb9d18bd9b136a9bba13 \
+                    file://decoder.cc;beginline=3;endline=16;md5=db09fe3f9573f94d0076f7f07959e6e1"
+
+SRC_URI = "${SAVANNAH_GNU_MIRROR}/lzip/lzip-${PV}.tar.gz"
+
+SRC_URI[md5sum] = "3838567460ce4a10143de4bccc64fe1c"
+SRC_URI[sha256sum] = "47f9882a104ab05532f467a7b8f4ddbb898fa2f1e8d9d468556d6c2d04db14dd"
+
+CONFIGUREOPTS = "\
+    '--srcdir=${S}' \
+    '--prefix=${prefix}' \
+    '--exec-prefix=${exec_prefix}' \
+    '--bindir=${bindir}' \
+    '--datadir=${datadir}' \
+    '--infodir=${infodir}' \
+    '--sysconfdir=${sysconfdir}' \
+    'CXX=${CXX}' \
+    'CPPFLAGS=${CPPFLAGS}' \
+    'CXXFLAGS=${CXXFLAGS}' \
+    'LDFLAGS=${LDFLAGS}' \
+"
+EXTRA_OEMAKE = ""
+
+B = "${S}/obj"
+do_configure () {
+    ${S}/configure ${CONFIGUREOPTS}
+}
+
+do_install () {
+    oe_runmake 'DESTDIR=${D}' install
+    # Info dir listing isn't interesting at this point so remove it if it exists.
+    if [ -e "${D}${infodir}/dir" ]; then
+        rm -f ${D}${infodir}/dir
+    fi
+}
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/man-pages/man-pages_4.07.bb b/import-layers/yocto-poky/meta/recipes-extended/man-pages/man-pages_4.09.bb
similarity index 85%
rename from import-layers/yocto-poky/meta/recipes-extended/man-pages/man-pages_4.07.bb
rename to import-layers/yocto-poky/meta/recipes-extended/man-pages/man-pages_4.09.bb
index 76a3fd8..55fc21e 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/man-pages/man-pages_4.07.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/man-pages/man-pages_4.09.bb
@@ -7,8 +7,8 @@
 LIC_FILES_CHKSUM = "file://README;md5=8f2a3d43057d458e5066714980567a60"
 SRC_URI = "${KERNELORG_MIRROR}/linux/docs/${BPN}/Archive/${BP}.tar.gz"
 
-SRC_URI[md5sum] = "05ba1cb21e99d02bd7bc1a59378965d2"
-SRC_URI[sha256sum] = "c973351131931f7700f5e9fbf4ef366c43ea7c1515d282e8d5db9c77590c4c93"
+SRC_URI[md5sum] = "9e3c7b12a5fecda9a717a4bcc0ae3a67"
+SRC_URI[sha256sum] = "5fac324cefce0fbfae0df6c06ef3f6d6ab5227b9aad2a94f8657a0e3901f9185"
 
 RDEPENDS_${PN} = "man"
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/man/man_1.6g.bb b/import-layers/yocto-poky/meta/recipes-extended/man/man_1.6g.bb
index e78aa18..ff603f8 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/man/man_1.6g.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/man/man_1.6g.bb
@@ -10,8 +10,8 @@
 DEPENDS = "groff less"
 
 def compress_pkg(d):
-    if "compress_doc" in (d.getVar("INHERIT", True) or "").split():
-         compress = d.getVar("DOC_COMPRESS", True)
+    if "compress_doc" in (d.getVar("INHERIT") or "").split():
+         compress = d.getVar("DOC_COMPRESS")
          if compress == "gz":
              return "gzip"
          elif compress == "bz2":
diff --git a/import-layers/yocto-poky/meta/recipes-extended/mc/files/0001-mc-replace-perl-w-with-use-warnings.patch b/import-layers/yocto-poky/meta/recipes-extended/mc/files/0001-mc-replace-perl-w-with-use-warnings.patch
new file mode 100644
index 0000000..bf8037c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/mc/files/0001-mc-replace-perl-w-with-use-warnings.patch
@@ -0,0 +1,129 @@
+From cdc7c278212ae836eecb4cc9d42c29443cc128a0 Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Thu, 6 Apr 2017 02:24:28 -0700
+Subject: [PATCH] mc: replace "perl -w" with "use warnings"
+
+The shebang's max length is usually 128 as defined in
+/usr/include/linux/binfmts.h:
+  #define BINPRM_BUF_SIZE 128
+
+There would be errors when @PERL@ is longer than 128, use
+'/usr/bin/env perl' can fix the problem, but '/usr/bin/env perl -w'
+doesn't work:
+
+/usr/bin/env: perl -w: No such file or directory
+
+So replace "perl -w" with "use warnings" to make it work.
+
+The man2hlp.in already has "use warnings;", so just remove '-w' is OK.
+
+Upstream-Status: Pending
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ src/man2hlp/man2hlp.in           | 2 +-
+ src/vfs/extfs/helpers/a+.in      | 4 +++-
+ src/vfs/extfs/helpers/mailfs.in  | 3 ++-
+ src/vfs/extfs/helpers/patchfs.in | 3 ++-
+ src/vfs/extfs/helpers/ulib.in    | 4 +++-
+ src/vfs/extfs/helpers/uzip.in    | 3 ++-
+ 6 files changed, 13 insertions(+), 6 deletions(-)
+
+diff --git a/src/man2hlp/man2hlp.in b/src/man2hlp/man2hlp.in
+index f095830..558a674 100644
+--- a/src/man2hlp/man2hlp.in
++++ b/src/man2hlp/man2hlp.in
+@@ -1,4 +1,4 @@
+-#! @PERL@ -w
++#! @PERL@
+ #
+ #  Man page to help file converter
+ #  Copyright (C) 1994, 1995, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
+diff --git a/src/vfs/extfs/helpers/a+.in b/src/vfs/extfs/helpers/a+.in
+index 579441c..fe446f4 100644
+--- a/src/vfs/extfs/helpers/a+.in
++++ b/src/vfs/extfs/helpers/a+.in
+@@ -1,4 +1,4 @@
+-#! @PERL@ -w
++#! @PERL@
+ #
+ # External filesystem for mc, using mtools
+ # Written Ludek Brukner <lubr@barco.cz>, 1997
+@@ -9,6 +9,8 @@
+ 
+ # These mtools components must be in PATH for this to work
+ 
++use warnings;
++
+ sub quote {
+     $_ = shift(@_);
+     s/([^\w\/.+-])/\\$1/g;
+diff --git a/src/vfs/extfs/helpers/mailfs.in b/src/vfs/extfs/helpers/mailfs.in
+index e9455be..059f41f 100644
+--- a/src/vfs/extfs/helpers/mailfs.in
++++ b/src/vfs/extfs/helpers/mailfs.in
+@@ -1,6 +1,7 @@
+-#! @PERL@ -w
++#! @PERL@
+ 
+ use bytes;
++use warnings;
+ 
+ # MC extfs for (possibly compressed) Berkeley style mailbox files
+ # Peter Daum <gator@cs.tu-berlin.de> (Jan 1998, mc-4.1.24)
+diff --git a/src/vfs/extfs/helpers/patchfs.in b/src/vfs/extfs/helpers/patchfs.in
+index ef407de..3ad4b53 100644
+--- a/src/vfs/extfs/helpers/patchfs.in
++++ b/src/vfs/extfs/helpers/patchfs.in
+@@ -1,4 +1,4 @@
+-#! @PERL@ -w
++#! @PERL@
+ #
+ # Written by Adam Byrtek <alpha@debian.org>, 2002
+ # Rewritten by David Sterba <dave@jikos.cz>, 2009
+@@ -9,6 +9,7 @@
+ 
+ use bytes;
+ use strict;
++use warnings;
+ use POSIX;
+ use File::Temp 'tempfile';
+ 
+diff --git a/src/vfs/extfs/helpers/ulib.in b/src/vfs/extfs/helpers/ulib.in
+index 418611f..82c7ccf 100644
+--- a/src/vfs/extfs/helpers/ulib.in
++++ b/src/vfs/extfs/helpers/ulib.in
+@@ -1,9 +1,11 @@
+-#! @PERL@ -w
++#! @PERL@
+ #
+ # VFS to manage the gputils archives.
+ # Written by Molnár Károly (proton7@freemail.hu) 2012
+ #
+ 
++use warnings;
++
+ my %month = ('jan' => '01', 'feb' => '02', 'mar' => '03',
+              'apr' => '04', 'may' => '05', 'jun' => '06',
+              'jul' => '07', 'aug' => '08', 'sep' => '09',
+diff --git a/src/vfs/extfs/helpers/uzip.in b/src/vfs/extfs/helpers/uzip.in
+index b1c4f90..c8eb335 100644
+--- a/src/vfs/extfs/helpers/uzip.in
++++ b/src/vfs/extfs/helpers/uzip.in
+@@ -1,4 +1,4 @@
+-#! @PERL@ -w
++#! @PERL@
+ #
+ # zip file archive Virtual File System for Midnight Commander
+ # Version 1.4.0 (2001-08-07).
+@@ -9,6 +9,7 @@
+ use POSIX;
+ use File::Basename;
+ use strict;
++use warnings;
+ 
+ #
+ # Configuration options
+-- 
+2.10.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/mc/mc/mc-CTRL.patch b/import-layers/yocto-poky/meta/recipes-extended/mc/mc/mc-CTRL.patch
deleted file mode 100644
index ee4ba9f..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/mc/mc/mc-CTRL.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Fix build with musl by ensuring CTRL is defined.
-
-musl does not define CTRL in <termios.h>, we could include <sys/ttydefaults.h>
-explicitly but it's easier just to ensure CTRL is defined.
-
-This patch is taken from Sabotage Linux, the license statement for patches and
-build scripts in Sabotage Linux says:
-
-    To the extent possible under law, Christian Neukirchen has waived
-    all copyright and related or neighboring rights to this work.
-
-    http://creativecommons.org/publicdomain/zero/1.0/
-
-Therefore this should be good to include in OpenEmbedded.
-
-Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
-
-Upstream-Status: Accepted (should be included in v4.8.14)
-
-diff -u mc-4.8.1.7.org/lib/tty/tty-ncurses.c mc-4.8.1.7/lib/tty/tty-ncurses.c
---- mc-4.8.1.7.org/lib/tty/tty-ncurses.c
-+++ mc-4.8.1.7/lib/tty/tty-ncurses.c
-@@ -65,7 +65,7 @@
- 
- /*** file scope macro definitions ****************************************************************/
- 
--#if defined(_AIX) && !defined(CTRL)
-+#if !defined(CTRL)
- #define CTRL(x) ((x) & 0x1f)
- #endif
- 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/mc/mc_4.7.5.2.bb b/import-layers/yocto-poky/meta/recipes-extended/mc/mc_4.7.5.2.bb
deleted file mode 100644
index b38964d..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/mc/mc_4.7.5.2.bb
+++ /dev/null
@@ -1,47 +0,0 @@
-SUMMARY = "Midnight Commander is an ncurses based file manager"
-HOMEPAGE = "http://www.midnight-commander.org/"
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
-SECTION = "console/utils"
-DEPENDS = "ncurses glib-2.0"
-RDEPENDS_${PN} = "ncurses-terminfo"
-
-PR = "r3"
-
-SRC_URI = "http://www.midnight-commander.org/downloads/${BPN}-${PV}.tar.bz2 \
-           file://mc-CTRL.patch \
-           "
-
-SRC_URI[md5sum] = "bdae966244496cd4f6d282d80c9cf3c6"
-SRC_URI[sha256sum] = "a68338862bb30017eb65ed569a58e80ab66ae8cef11c886440c9e9f4d1efc6ab"
-
-inherit autotools gettext pkgconfig
-
-EXTRA_OECONF = "--with-screen=ncurses --without-gpm-mouse --without-x --without-samba"
-
-do_install_append () {
-	sed -i -e '1s,#!.*perl,#!${bindir}/env perl,' ${D}${libexecdir}/mc/extfs.d/*
-	sed -i -e '1s,#!.*python,#!${bindir}/env python,' ${D}${libexecdir}/mc/extfs.d/*
-}
-
-PACKAGES =+ "${BPN}-helpers-perl ${BPN}-helpers-python ${BPN}-helpers ${BPN}-fish"
-
-SUMMARY_${BPN}-helpers-perl = "Midnight Commander Perl-based helper scripts"
-FILES_${BPN}-helpers-perl = "${libexecdir}/mc/extfs.d/a+ ${libexecdir}/mc/extfs.d/apt+ \
-                             ${libexecdir}/mc/extfs.d/deb ${libexecdir}/mc/extfs.d/deba \
-                             ${libexecdir}/mc/extfs.d/debd ${libexecdir}/mc/extfs.d/dpkg+ \
-                             ${libexecdir}/mc/extfs.d/mailfs ${libexecdir}/mc/extfs.d/patchfs \ 
-                             ${libexecdir}/mc/extfs.d/rpms+ ${libexecdir}/mc/extfs.d/ulib \ 
-                             ${libexecdir}/mc/extfs.d/uzip"
-RDEPENDS_${BPN}-helpers-perl = "perl"
-
-SUMMARY_${BPN}-helpers-python = "Midnight Commander Python-based helper scripts"
-FILES_${BPN}-helpers-python = "${libexecdir}/mc/extfs.d/s3+ ${libexecdir}/mc/extfs.d/uc1541"
-RDEPENDS_${BPN}-helpers-python = "python"
-
-SUMMARY_${BPN}-helpers = "Midnight Commander shell helper scripts"
-FILES_${BPN}-helpers = "${libexecdir}/mc/extfs.d/* ${libexecdir}/mc/ext.d/*"
-
-SUMMARY_${BPN}-fish = "Midnight Commander Fish scripts"
-FILES_${BPN}-fish = "${libexecdir}/mc/fish"
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/mc/mc_4.8.17.bb b/import-layers/yocto-poky/meta/recipes-extended/mc/mc_4.8.18.bb
similarity index 88%
rename from import-layers/yocto-poky/meta/recipes-extended/mc/mc_4.8.17.bb
rename to import-layers/yocto-poky/meta/recipes-extended/mc/mc_4.8.18.bb
index a5c4ece..17f3f73 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/mc/mc_4.8.17.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/mc/mc_4.8.18.bb
@@ -7,9 +7,10 @@
 RDEPENDS_${PN} = "ncurses-terminfo"
 
 SRC_URI = "http://www.midnight-commander.org/downloads/${BPN}-${PV}.tar.bz2 \
+           file://0001-mc-replace-perl-w-with-use-warnings.patch \
            "
-SRC_URI[md5sum] = "6e9c07066e40af06b263a13fad17a07f"
-SRC_URI[sha256sum] = "66d0cb37baaed8ef930f8ad25a634adad4f264eb61820893920ac87b9dfb783b"
+SRC_URI[md5sum] = "cc56f0c9abd63c4caa3636bba3a08bfb"
+SRC_URI[sha256sum] = "5b591e10dcbea95233434da40cdad4663d360229adf89826576c319667c103cb"
 
 inherit autotools gettext pkgconfig
 
@@ -22,6 +23,8 @@
 
 EXTRA_OECONF = "--with-screen=ncurses --without-gpm-mouse --without-x"
 
+CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'"
+
 do_install_append () {
 	sed -i -e '1s,#!.*perl,#!${bindir}/env perl,' ${D}${libexecdir}/mc/extfs.d/*
 	sed -i -e '1s,#!.*python,#!${bindir}/env python,' ${D}${libexecdir}/mc/extfs.d/*
diff --git a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-Fix-some-type-comparison-problems.patch b/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-Fix-some-type-comparison-problems.patch
deleted file mode 100644
index f829467..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-Fix-some-type-comparison-problems.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 835baf02fd42012bbc0603dffb1f80c6ecf0fb9e Mon Sep 17 00:00:00 2001
-From: Xiao Ni <xni@redhat.com>
-Date: Mon, 8 Feb 2016 11:18:52 +0200
-Subject: [PATCH] Fix some type comparison problems
-
-As 26714713cd2bad9e0bf7f4669f6cc4659ceaab6c said, 32 bit signed
-timestamps will overflow in the year 2038. It already changed the
-utime and ctime in struct mdu_array_info_s from int to unsigned
-int. So we need to change the values that compared with them to
-unsigned int too.
-
-Upstream-Status: Backport
-
-Signed-off-by: : Xiao Ni <xni@redhat.com>
-Signed-off-by: Maxin B. John <maxin.john@intel.com>
----
-
- Monitor.c | 2 +-
- util.c    | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/Monitor.c b/Monitor.c
-index f19c2e5..6df80f9 100644
---- a/Monitor.c
-+++ b/Monitor.c
-@@ -33,7 +33,7 @@
- struct state {
- 	char *devname;
- 	char devnm[32];	/* to sync with mdstat info */
--	long utime;
-+	unsigned int utime;
- 	int err;
- 	char *spare_group;
- 	int active, working, failed, spare, raid;
-diff --git a/util.c b/util.c
-index 3e6d293..96a806d 100644
---- a/util.c
-+++ b/util.c
-@@ -1267,7 +1267,7 @@ struct supertype *guess_super_type(int fd, enum guess_types guess_type)
- 	 */
- 	struct superswitch  *ss;
- 	struct supertype *st;
--	time_t besttime = 0;
-+	unsigned int besttime = 0;
- 	int bestsuper = -1;
- 	int i;
- 
--- 
-2.4.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch b/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch
index deb7486..a891614 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch
@@ -10,6 +10,17 @@
 
 Signed-off-by: Maxin B. John <maxin.john@intel.com>
 ---
+mdadm only works with corosync 2.x which provides header file corosync/cmap.h.
+If build mdadm with corosync 1.x, it fails with:
+
+| member.c:12:27: fatal error: corosync/cmap.h: No such file or directory
+|  #include <corosync/cmap.h>
+|                            ^
+
+Build with corosync only header file corosync/cmap.h exists.
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+---
  Makefile | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
@@ -23,7 +34,7 @@
  
 -COROSYNC:=$(shell [ -d /usr/include/corosync ] || echo -DNO_COROSYNC)
 -DLM:=$(shell [ -f /usr/include/libdlm.h ] || echo -DNO_DLM)
-+COROSYNC:=$(shell [ -d $(SYSROOT)/usr/include/corosync ] || echo -DNO_COROSYNC)
++COROSYNC:=$(shell [ -f $(SYSROOT)/usr/include/corosync/cmap.h ] || echo -DNO_COROSYNC)
 +DLM:=$(shell [ -f $(SYSROOT)/usr/include/libdlm.h ] || echo -DNO_DLM)
  
  DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-Fix-typo-in-comparision.patch b/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-Fix-typo-in-comparision.patch
deleted file mode 100644
index df70b1c..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-Fix-typo-in-comparision.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-From 18d360d74271a066a849bc1fba4f10dbb23ed251 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Tue, 8 Sep 2015 08:17:42 +0000
-Subject: [PATCH] Fix typo in comparision
-
-error: comparison of array 'devnm' equal to a null pointer is always false
-
-User bitwise '&' operator as it is a mask
-
-Fixes
-error: use of logical '&&' with constant operand
-
-Remove extraneous parens
-
-error: equality comparison with extraneous parentheses
-
-Remove dead code
-
-restripe.c:465:21: error: explicitly assigning value of variable of type 'int' to itself
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Pending
-
- mdmon.h       | 2 +-
- mdopen.c      | 2 +-
- restripe.c    | 3 ---
- super-intel.c | 2 +-
- 4 files changed, 3 insertions(+), 6 deletions(-)
-
-diff --git a/mdmon.h b/mdmon.h
-index aa750c6..0b08c3d 100644
---- a/mdmon.h
-+++ b/mdmon.h
-@@ -101,7 +101,7 @@ static inline int is_resync_complete(struct mdinfo *array)
- 		break;
- 	case 10:
- 		l = array->array.layout;
--		ncopies = (l & 0xff) * ((l >> 8) && 0xff);
-+		ncopies = (l & 0xff) * ((l >> 8) & 0xff);
- 		sync_size = array->component_size * array->array.raid_disks;
- 		sync_size /= ncopies;
- 		break;
-diff --git a/mdopen.c b/mdopen.c
-index 28410f4..c5ee2a6 100644
---- a/mdopen.c
-+++ b/mdopen.c
-@@ -318,7 +318,7 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
- 	else if (num < 0) {
- 		/* need to choose a free number. */
- 		char *_devnm = find_free_devnm(use_mdp);
--		if (devnm == NULL) {
-+		if (_devnm == NULL) {
- 			pr_err("No avail md devices - aborting\n");
- 			return -1;
- 		}
-diff --git a/restripe.c b/restripe.c
-index 4d92190..cfe9666 100644
---- a/restripe.c
-+++ b/restripe.c
-@@ -461,9 +461,6 @@ int raid6_check_disks(int data_disks, int start, int chunk_size,
- 			curr_broken_disk = diskD;
- 		}
- 
--		if((Px == 0) && (Qx == 0))
--			curr_broken_disk = curr_broken_disk;
--
- 		if(curr_broken_disk >= data_disks + 2)
- 			broken_status = 2;
- 
-diff --git a/super-intel.c b/super-intel.c
-index 3f812d6..1838012 100644
---- a/super-intel.c
-+++ b/super-intel.c
-@@ -10027,7 +10027,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
- 				geo->size = max_size;
- 		}
- 
--		if ((direction == ROLLBACK_METADATA_CHANGES)) {
-+		if (direction == ROLLBACK_METADATA_CHANGES) {
- 			/* accept size for rollback only
- 			*/
- 		} else {
--- 
-2.5.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch b/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch
new file mode 100644
index 0000000..acd64ad
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch
@@ -0,0 +1,48 @@
+From 943616e5dffb79f307e4bd9b249d316212998750 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 18 Dec 2016 08:30:51 +0000
+Subject: [PATCH] include <sys/sysmacros.h> for major/minor defintions
+
+glibc 2.25 is warning about it if applications depend on
+sys/types.h for these macros, it expects to be included
+from <sys/sysmacros.h>
+
+Fixes
+| Grow.c:3534:13: error: In the GNU C Library, "minor" is defined
+|  by <sys/sysmacros.h>. For historical compatibility, it is
+|  currently defined by <sys/types.h> as well, but we plan to
+|  remove this soon. To use "minor", include <sys/sysmacros.h>
+|  directly. If you did not intend to use a system-defined macro
+|  "minor", you should undefine it after including <sys/types.h>. [-Werror]
+| Query.c: In function 'Query':
+| Query.c:105:13: error: In the GNU C Library, "makedev" is defined
+|  by <sys/sysmacros.h>. For historical compatibility, it is
+|  currently defined by <sys/types.h> as well, but we plan to
+|  remove this soon. To use "makedev", include <sys/sysmacros.h>
+|  directly. If you did not intend to use a system-defined macro
+|  "makedev", you should undefine it after including <sys/types.h>. [-Werror]
+|           makedev((unsigned)disc.major,(unsigned)disc.minor) == stb.st_rdev)
+|              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ mdadm.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/mdadm.h b/mdadm.h
+index 8c8f4d1..3ce13b5 100755
+--- a/mdadm.h
++++ b/mdadm.h
+@@ -34,6 +34,7 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
+ #endif
+ 
+ #include	<sys/types.h>
++#include	<sys/sysmacros.h>
+ #include	<sys/stat.h>
+ #include	<stdint.h>
+ #include	<stdlib.h>
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-mdadm.h-bswap-is-already-defined-in-uclibc.patch b/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-mdadm.h-bswap-is-already-defined-in-uclibc.patch
deleted file mode 100644
index 1395473..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-mdadm.h-bswap-is-already-defined-in-uclibc.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From cf14a9987ea1040457ce53bc2ab7d096818cb780 Mon Sep 17 00:00:00 2001
-From: "Maxin B. John" <maxin.john@intel.com>
-Date: Fri, 5 Feb 2016 18:06:32 +0200
-Subject: [PATCH] mdadm.h: bswap is already defined in uclibc
-
-Fixes this build error:
-
-| In file included from mdadm.c:28:0:
-| mdadm.h:142:0: error: "bswap_16" redefined [-Werror]
-|  #define bswap_16(x) (((x) & 0x00ffU) << 8 | \
-|  ^
-
-Upstream-Status: Submitted
-
-Signed-off-by: Maxin B. John <maxin.john@intel.com>
----
- mdadm.h | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/mdadm.h b/mdadm.h
-index dd02be7..230e60f 100755
---- a/mdadm.h
-+++ b/mdadm.h
-@@ -139,12 +139,20 @@ struct dlm_lksb {
-  * and there is no standard conversion function so... */
- /* And dietlibc doesn't think byteswap is ok, so.. */
- /*  #include <byteswap.h> */
-+
-+#ifndef bswap_16
- #define bswap_16(x) (((x) & 0x00ffU) << 8 | \
- 		     ((x) & 0xff00U) >> 8)
-+#endif
-+
-+#ifndef bswap_32
- #define bswap_32(x) (((x) & 0x000000ffU) << 24 | \
- 		     ((x) & 0xff000000U) >> 24 | \
- 		     ((x) & 0x0000ff00U) << 8  | \
- 		     ((x) & 0x00ff0000U) >> 8)
-+#endif
-+
-+#ifndef bswap_64
- #define bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
- 		     ((x) & 0xff00000000000000ULL) >> 56 | \
- 		     ((x) & 0x000000000000ff00ULL) << 40 | \
-@@ -153,6 +161,7 @@ struct dlm_lksb {
- 		     ((x) & 0x0000ff0000000000ULL) >> 24 | \
- 		     ((x) & 0x00000000ff000000ULL) << 8 | \
- 		     ((x) & 0x000000ff00000000ULL) >> 8)
-+#endif
- 
- #if !defined(__KLIBC__)
- #if BYTE_ORDER == LITTLE_ENDIAN
--- 
-2.4.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-raid6check-Fix-if-else-indentation.patch b/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-raid6check-Fix-if-else-indentation.patch
deleted file mode 100644
index 0b34b84..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-raid6check-Fix-if-else-indentation.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 1b0aa1debf6fbe9923c9aac671d2894f76c32f9d Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 20 Apr 2016 16:38:13 +0000
-Subject: [PATCH] raid6check: Fix if-else indentation
-
-gcc 6 warns about ambiguity due to this indentation
-| raid6check.c: In function 'manual_repair':
-| raid6check.c:267:4: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
-|     else
-|     ^~~~
-| raid6check.c:269:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else'
-|      printf("Repairing D(%d) and P\n", failed_data);
-|      ^~~~~~
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Submitted
-
- raid6check.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/raid6check.c b/raid6check.c
-index ad7ffe7..409b1b6 100644
---- a/raid6check.c
-+++ b/raid6check.c
-@@ -266,7 +266,7 @@ int manual_repair(int chunk_size, int syndrome_disks,
- 				failed_data = failed_slot2;
- 			else
- 				failed_data = failed_slot1;
--				printf("Repairing D(%d) and P\n", failed_data);
-+			printf("Repairing D(%d) and P\n", failed_data);
- 			raid6_datap_recov(syndrome_disks+2, chunk_size,
- 					  failed_data, (uint8_t**)blocks, 1);
- 		} else {
--- 
-1.9.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-util.c-include-poll.h-instead-of-sys-poll.h.patch b/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-util.c-include-poll.h-instead-of-sys-poll.h.patch
deleted file mode 100644
index d5cf003..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/0001-util.c-include-poll.h-instead-of-sys-poll.h.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 2645673a7ea948a1297d5b8f0daab29b898f044f Mon Sep 17 00:00:00 2001
-From: "Maxin B. John" <maxin.john@intel.com>
-Date: Fri, 5 Feb 2016 17:14:04 +0200
-Subject: [PATCH] util.c: include poll.h instead of sys/poll.h
-
-This fixes a compile warning when building with musl:
-
- In file included from util.c:27:0:
- |
- qemux86-64/usr/include/sys/poll.h:1:2:
- error: #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
- [-Werror=cpp]
- |  #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
- |   ^
-
-Upstream-Status: Accepted
-
-Signed-off-by: Maxin B. John <maxin.john@intel.com>
----
- util.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/util.c b/util.c
-index 970d484..3e6d293 100644
---- a/util.c
-+++ b/util.c
-@@ -24,7 +24,6 @@
- 
- #include	"mdadm.h"
- #include	"md_p.h"
--#include	<sys/poll.h>
- #include	<sys/socket.h>
- #include	<sys/utsname.h>
- #include	<sys/wait.h>
-@@ -32,6 +31,7 @@
- #include	<sys/resource.h>
- #include	<sys/vfs.h>
- #include	<linux/magic.h>
-+#include	<poll.h>
- #include	<ctype.h>
- #include	<dirent.h>
- #include	<signal.h>
--- 
-2.4.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/mdadm-3.2.2_fix_for_x32.patch b/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/mdadm-3.2.2_fix_for_x32.patch
deleted file mode 100644
index 84c382d..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/mdadm/files/mdadm-3.2.2_fix_for_x32.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Upstream-Status: Accepted
-
-By hardcoding CC's definition in the Makefile, all the gcc parameters 
-set by tune settings are lost. Causing compile failure with x32 toolchain
-
-As the bitbake defined CC is good, there is no need to redfine CC in the 
-make file, hence making the CC definition in the Makefile conditional.
-
-Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com> 2011/12/07
-
-Index: mdadm-3.3/Makefile
-===================================================================
---- mdadm-3.3.orig/Makefile	2013-09-03 07:47:47.000000000 +0300
-+++ mdadm-3.3/Makefile	2013-10-16 16:44:23.542295487 +0300
-@@ -41,7 +41,7 @@
- 
- KLIBC_GCC = gcc -nostdinc -iwithprefix include -I$(KLIBC)/klibc/include -I$(KLIBC)/linux/include -I$(KLIBC)/klibc/arch/i386/include -I$(KLIBC)/klibc/include/bits32
- 
--CC = $(CROSS_COMPILE)gcc
-+CC ?= $(CROSS_COMPILE)gcc
- CXFLAGS ?= -ggdb
- CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter
- ifdef WARN_UNUSED
diff --git a/import-layers/yocto-poky/meta/recipes-extended/mdadm/mdadm_3.4.bb b/import-layers/yocto-poky/meta/recipes-extended/mdadm/mdadm_4.0.bb
similarity index 74%
rename from import-layers/yocto-poky/meta/recipes-extended/mdadm/mdadm_3.4.bb
rename to import-layers/yocto-poky/meta/recipes-extended/mdadm/mdadm_4.0.bb
index 261054e..62614f0 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/mdadm/mdadm_3.4.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/mdadm/mdadm_4.0.bb
@@ -9,21 +9,16 @@
 
 
 SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \
-           file://mdadm-3.2.2_fix_for_x32.patch \
            file://gcc-4.9.patch \
            file://mdadm-3.3.2_x32_abi_time_t.patch \
-           file://0001-Fix-typo-in-comparision.patch \
            file://mdadm-fix-ptest-build-errors.patch \
-           file://0001-util.c-include-poll.h-instead-of-sys-poll.h.patch \
-           file://0001-mdadm.h-bswap-is-already-defined-in-uclibc.patch \
-           file://0001-Fix-some-type-comparison-problems.patch \
            file://0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch \
            file://run-ptest \
-           file://0001-raid6check-Fix-if-else-indentation.patch \
            file://0001-mdadm.h-Undefine-dprintf-before-redefining.patch \
+           file://0001-include-sys-sysmacros.h-for-major-minor-defintions.patch \
            "
-SRC_URI[md5sum] = "04b8b21f637540350f8517c7e68d3c63"
-SRC_URI[sha256sum] = "27d0be4627d38a12ddcd1c1c3721d649d4e89e1093914497e22b57245cda8808"
+SRC_URI[md5sum] = "2cb4feffea9167ba71b5f346a0c0a40d"
+SRC_URI[sha256sum] = "1d6ae7f24ced3a0fa7b5613b32f4a589bb4881e3946a5a2c3724056254ada3a9"
 
 CFLAGS += "-fno-strict-aliasing"
 inherit autotools-brokensep
@@ -34,10 +29,12 @@
 # to u64 == long in userspace. Define __SANE_USERSPACE_TYPES__ to get
 # int-ll64.h included
 CFLAGS_append_powerpc64 = ' -D__SANE_USERSPACE_TYPES__'
-CFLAGS_append_mips64 = ' -D__SANE_USERSPACE_TYPES__'
-CFLAGS_append_mips64n32 = ' -D__SANE_USERSPACE_TYPES__'
+CFLAGS_append_mipsarchn64 = ' -D__SANE_USERSPACE_TYPES__'
+CFLAGS_append_mipsarchn32 = ' -D__SANE_USERSPACE_TYPES__'
 
 do_compile() {
+	# Point to right sbindir
+	sed -i -e "s;BINDIR  = /sbin;BINDIR = $base_sbindir;" ${S}/Makefile
 	oe_runmake SYSROOT="${STAGING_DIR_TARGET}"
 }
 
@@ -56,7 +53,7 @@
 	cp -a ${S}/tests ${D}${PTEST_PATH}/tests
 	cp ${S}/test ${D}${PTEST_PATH}
 	sed -e 's!sleep 0.*!sleep 1!g; s!/var/tmp!/!g' -i ${D}${PTEST_PATH}/test
-	ln -s /sbin/mdadm ${D}${PTEST_PATH}/mdadm
+	ln -s ${base_sbindir}/mdadm ${D}${PTEST_PATH}/mdadm
 	for prg in test_stripe swap_super raid6check
 	do
 		install -D -m 755 $prg ${D}${PTEST_PATH}/
diff --git a/import-layers/yocto-poky/meta/recipes-extended/mktemp/mktemp_1.7.bb b/import-layers/yocto-poky/meta/recipes-extended/mktemp/mktemp_1.7.bb
index 9accc6e..e8ae5c6 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/mktemp/mktemp_1.7.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/mktemp/mktemp_1.7.bb
@@ -20,9 +20,11 @@
 EXTRA_OECONF = "--with-libc"
 
 do_install_append () {
-	install -d ${D}${base_bindir}
-	mv ${D}${bindir}/mktemp ${D}${base_bindir}/mktemp
-	rmdir ${D}${bindir}
+	if [ "${base_bindir}" != "${bindir}" ] ; then
+		install -d ${D}${base_bindir}
+		mv ${D}${bindir}/mktemp ${D}${base_bindir}/mktemp
+		rmdir ${D}${bindir}
+	fi
 }
 
 ALTERNATIVE_${PN} = "mktemp"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/msmtp/msmtp_1.6.5.bb b/import-layers/yocto-poky/meta/recipes-extended/msmtp/msmtp_1.6.6.bb
similarity index 85%
rename from import-layers/yocto-poky/meta/recipes-extended/msmtp/msmtp_1.6.5.bb
rename to import-layers/yocto-poky/meta/recipes-extended/msmtp/msmtp_1.6.6.bb
index d0c39eb..e172193 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/msmtp/msmtp_1.6.5.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/msmtp/msmtp_1.6.6.bb
@@ -12,8 +12,8 @@
 SRC_URI = "http://sourceforge.net/projects/msmtp/files/msmtp/${PV}/${BPN}-${PV}.tar.xz \
           "
 
-SRC_URI[md5sum] = "50a8c9bb72f8222779db6b4aae2965e0"
-SRC_URI[sha256sum] = "76a0d60693c7e65d0c7a12f01d300882d280b1e1be0202f54730ae44d44a5006"
+SRC_URI[md5sum] = "82b0520b57db4b2cf05333d11fb5974d"
+SRC_URI[sha256sum] = "da15db1f62bd0201fce5310adb89c86188be91cd745b7cb3b62b81a501e7fb5e"
 
 inherit gettext autotools update-alternatives pkgconfig
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/net-tools/net-tools_1.60-26.bb b/import-layers/yocto-poky/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
index 47a68a5..45d7bf4 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
@@ -75,6 +75,10 @@
 	# we pre-generate desired options and copy to source directory instead
 	cp ${WORKDIR}/net-tools-config.h    ${S}/config.h
 	cp ${WORKDIR}/net-tools-config.make ${S}/config.make
+
+	if [ "${USE_NLS}" = "no" ]; then
+		sed -i -e 's/^I18N=1/# I18N=1/' ${S}/config.make
+	fi
 }
 
 do_compile() {
@@ -93,6 +97,17 @@
 	unset CFLAGS
 	unset LDFLAGS
 	oe_runmake 'BASEDIR=${D}' install
+
+	if [ "${base_bindir}" != "/bin" ]; then
+		mkdir -p ${D}/${base_bindir}
+		mv ${D}/bin/* ${D}/${base_bindir}/
+		rmdir ${D}/bin
+	fi
+	if [ "${base_sbindir}" != "/sbin" ]; then
+		mkdir ${D}/${base_sbindir}
+		mv ${D}/sbin/* ${D}/${base_sbindir}/
+		rmdir ${D}/sbin
+	fi
 }
 
 inherit update-alternatives
@@ -101,15 +116,17 @@
 base_bindir_progs  = "dnsdomainname domainname hostname netstat nisdomainname ypdomainname"
 
 ALTERNATIVE_${PN} = "${base_sbindir_progs} ${base_bindir_progs}"
-ALTERNATIVE_${PN}-doc += "hostname.1"
+ALTERNATIVE_${PN}-doc += "hostname.1 dnsdomainname.1"
 ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1"
+ALTERNATIVE_LINK_NAME[dnsdomainname.1] = "${mandir}/man1/dnsdomainname.1"
 ALTERNATIVE_PRIORITY[hostname.1] = "10"
 
 python __anonymous() {
-	for prog in d.getVar('base_sbindir_progs', True).split():
-		d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_sbindir', True), prog))
-	for prog in d.getVar('base_bindir_progs', True).split():
-		d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir', True), prog))
+	for prog in d.getVar('base_sbindir_progs').split():
+		d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_sbindir'), prog))
+	for prog in d.getVar('base_bindir_progs').split():
+		d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog))
 }
 ALTERNATIVE_PRIORITY = "100"
 
+BBCLASSEXTEND = "native nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/packagegroups/packagegroup-core-full-cmdline.bb b/import-layers/yocto-poky/meta/recipes-extended/packagegroups/packagegroup-core-full-cmdline.bb
index a60a68c..d8975f2 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/packagegroups/packagegroup-core-full-cmdline.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/packagegroups/packagegroup-core-full-cmdline.bb
@@ -31,7 +31,7 @@
     namemap["packagegroup-core-full-cmdline-initscripts"] = "packagegroup-core-initscripts"
     namemap["packagegroup-core-full-cmdline-sys-services"] = "packagegroup-core-sys-services"
 
-    packages = d.getVar("PACKAGES", True).split()
+    packages = d.getVar("PACKAGES").split()
     for pkg in packages:
         if pkg.endswith('-dev'):
             mapped = namemap.get(pkg[:-4], None)
diff --git a/import-layers/yocto-poky/meta/recipes-extended/packagegroups/packagegroup-core-lsb.bb b/import-layers/yocto-poky/meta/recipes-extended/packagegroups/packagegroup-core-lsb.bb
index 29564e0..a156bcb 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/packagegroups/packagegroup-core-lsb.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/packagegroups/packagegroup-core-lsb.bb
@@ -11,13 +11,16 @@
 # The libxt, libxtst and others require x11 in DISTRO_FEATURES
 REQUIRED_DISTRO_FEATURES = "x11"
 
+# libglu needs virtual/libgl, which requires opengl in DISTRO_FEATURES
+REQUIRED_DISTRO_FEATURES += "opengl"
+
 #
 # We will skip parsing this packagegeoup for non-glibc systems
 #
 python __anonymous () {
-    if d.getVar('TCLIBC', True) != "glibc":
+    if d.getVar('TCLIBC') != "glibc":
         raise bb.parse.SkipPackage("incompatible with %s C library" %
-                                   d.getVar('TCLIBC', True))
+                                   d.getVar('TCLIBC'))
 }
 
 PACKAGES = "\
@@ -222,6 +225,8 @@
                 'libraries. Its intended use is for passing LSB tests as Qt4 is ' \
                 'a requirement for LSB.')
     return ''
+# We don't want this to rebuild every time you change your layer config
+get_libqt4[vardepsexclude] += "BBFILE_COLLECTIONS"
 
 SUMMARY_packagegroup-core-lsb-desktop = "LSB Desktop"
 DESCRIPTION_packagegroup-core-lsb-desktop = "Packages required to support libraries \
diff --git a/import-layers/yocto-poky/meta/recipes-extended/pam/libpam_1.3.0.bb b/import-layers/yocto-poky/meta/recipes-extended/pam/libpam_1.3.0.bb
index bb5a4bd..df56d27 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/pam/libpam_1.3.0.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/pam/libpam_1.3.0.bb
@@ -62,7 +62,7 @@
 PACKAGES_DYNAMIC += "^${MLPREFIX}pam-plugin-.*"
 
 def get_multilib_bit(d):
-    baselib = d.getVar('baselib', True) or ''
+    baselib = d.getVar('baselib') or ''
     return baselib.replace('lib', '')
 
 libpam_suffix = "suffix${@get_multilib_bit(d)}"
@@ -92,31 +92,31 @@
 python populate_packages_prepend () {
     def pam_plugin_append_file(pn, dir, file):
         nf = os.path.join(dir, file)
-        of = d.getVar('FILES_' + pn, True)
+        of = d.getVar('FILES_' + pn)
         if of:
             nf = of + " " + nf
         d.setVar('FILES_' + pn, nf)
 
     def pam_plugin_hook(file, pkg, pattern, format, basename):
-        pn = d.getVar('PN', True)
-        libpam_suffix = d.getVar('libpam_suffix', True)
+        pn = d.getVar('PN')
+        libpam_suffix = d.getVar('libpam_suffix')
 
-        rdeps = d.getVar('RDEPENDS_' + pkg, True)
+        rdeps = d.getVar('RDEPENDS_' + pkg)
         if rdeps:
             rdeps = rdeps + " " + pn + "-" + libpam_suffix
         else:
             rdeps = pn + "-" + libpam_suffix
         d.setVar('RDEPENDS_' + pkg, rdeps)
 
-        provides = d.getVar('RPROVIDES_' + pkg, True)
+        provides = d.getVar('RPROVIDES_' + pkg)
         if provides:
             provides = provides + " " + pkg + "-" + libpam_suffix
         else:
             provides = pkg + "-" + libpam_suffix
         d.setVar('RPROVIDES_' + pkg, provides)
 
-    mlprefix = d.getVar('MLPREFIX', True) or ''
-    dvar = bb.data.expand('${WORKDIR}/package', d, True)
+    mlprefix = d.getVar('MLPREFIX') or ''
+    dvar = d.expand('${WORKDIR}/package')
     pam_libdir = d.expand('${base_libdir}/security')
     pam_sbindir = d.expand('${sbindir}')
     pam_filterdir = d.expand('${base_libdir}/security/pam_filter')
diff --git a/import-layers/yocto-poky/meta/recipes-extended/parted/files/0002-libparted_fs_resize-link-against-libuuid-explicitly-.patch b/import-layers/yocto-poky/meta/recipes-extended/parted/files/0002-libparted_fs_resize-link-against-libuuid-explicitly-.patch
new file mode 100644
index 0000000..bd2b5c5
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/parted/files/0002-libparted_fs_resize-link-against-libuuid-explicitly-.patch
@@ -0,0 +1,34 @@
+From 5c99d7e4c2b5e7a957dc922aff03debfebbd6154 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
+Date: Fri, 3 Mar 2017 21:49:15 +0100
+Subject: [PATCH] libparted_fs_resize: link against libuuid explicitly to
+ unbreak gold linking on test
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+| ../libparted/fs/.libs/libparted-fs-resize.so: error: undefined reference to 'uuid_generate'
+
+Upstream-Status: Pending
+
+Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
+---
+ libparted/fs/Makefile.am | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/libparted/fs/Makefile.am b/libparted/fs/Makefile.am
+index d3cc8bc..c301b0b 100644
+--- a/libparted/fs/Makefile.am
++++ b/libparted/fs/Makefile.am
+@@ -113,6 +113,8 @@ libparted_fs_resize_la_SOURCES = \
+   r/hfs/reloc_plus.c		\
+   r/hfs/reloc_plus.h
+ 
++libparted_fs_resize_la_LIBADD   = $(UUID_LIBS)
++
+ AM_CPPFLAGS = \
+   -I$(top_srcdir)/libparted/labels	\
+   $(partedincludedir)			\
+-- 
+2.9.3
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/parted/parted/parted-3.2-sysmacros.patch b/import-layers/yocto-poky/meta/recipes-extended/parted/parted/parted-3.2-sysmacros.patch
new file mode 100644
index 0000000..211e6c7
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/parted/parted/parted-3.2-sysmacros.patch
@@ -0,0 +1,32 @@
+https://bugs.gentoo.org/580022
+
+From dec8995fe80508374beba6356f6ecbba8ef6b18b Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Tue, 21 Jun 2016 15:01:08 -0400
+Subject: [PATCH] include sysmacros.h for major/minor/makedev
+
+Linux C libs are moving away from including this header implicitly via
+sys/types.h, so include it explicitly.
+
+Upstream-Status: Pending
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+
+---
+ libparted/arch/linux.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
+index 326b95619d31..e5c168be3c68 100644
+--- a/libparted/arch/linux.c
++++ b/libparted/arch/linux.c
+@@ -37,6 +37,7 @@
+ #include <dirent.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
++#include <sys/sysmacros.h>
+ #include <sys/types.h>
+ #include <sys/utsname.h>        /* for uname() */
+ #include <scsi/scsi.h>
+-- 
+2.8.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/parted/parted_3.2.bb b/import-layers/yocto-poky/meta/recipes-extended/parted/parted_3.2.bb
index 30c00c8..9ce2dfe 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/parted/parted_3.2.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/parted/parted_3.2.bb
@@ -13,6 +13,8 @@
            file://fix-compile-failure-while-dis.patch \
            file://0001-Include-fcntl.h-in-platform_defs.h.patch \
            file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
+           file://0002-libparted_fs_resize-link-against-libuuid-explicitly-.patch \
+	   file://parted-3.2-sysmacros.patch \
            file://run-ptest \
            file://Makefile \
 "
diff --git a/import-layers/yocto-poky/meta/recipes-extended/pax/pax/0001-include-sys-sysmacros.h-for-major-minor-definitions.patch b/import-layers/yocto-poky/meta/recipes-extended/pax/pax/0001-include-sys-sysmacros.h-for-major-minor-definitions.patch
new file mode 100644
index 0000000..1d969bc
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/pax/pax/0001-include-sys-sysmacros.h-for-major-minor-definitions.patch
@@ -0,0 +1,65 @@
+From 7f4f379f8343c0ce92aa30f3f9037288a089a902 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 18 Dec 2016 08:24:56 +0000
+Subject: [PATCH] include <sys/sysmacros.h> for major/minor definitions
+
+glibc 2.25 will error out if the applications are expecting
+this to come from sys/types.h, it is being removed from
+there.
+
+Fixes
+
+error: In the GNU C Library, "minor" is defined
+|  by <sys/sysmacros.h>. For historical compatibility, it is
+|  currently defined by <sys/types.h> as well, but we plan to
+|  remove this soon. To use "minor", include <sys/sysmacros.h>
+|  directly. If you did not intend to use a system-defined macro
+|  "minor", you should undefine it after including <sys/types.h>. [-Werror]
+|        ul_oct ((u_long) MINOR (arcn->sb.st_rdev), hd->devminor,
+|              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ src/cpio.c     | 2 +-
+ src/gen_subs.c | 2 +-
+ src/tar.c      | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+Index: pax-3.4/src/cpio.c
+===================================================================
+--- pax-3.4.orig/src/cpio.c
++++ pax-3.4/src/cpio.c
+@@ -36,6 +36,7 @@
+ #include "config.h"
+ #endif
+ 
++#include <sys/sysmacros.h>
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/stat.h>
+Index: pax-3.4/src/gen_subs.c
+===================================================================
+--- pax-3.4.orig/src/gen_subs.c
++++ pax-3.4/src/gen_subs.c
+@@ -37,6 +37,7 @@
+ #include "config.h"
+ #endif
+ 
++#include <sys/sysmacros.h>
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/stat.h>
+Index: pax-3.4/src/tar.c
+===================================================================
+--- pax-3.4.orig/src/tar.c
++++ pax-3.4/src/tar.c
+@@ -37,6 +37,7 @@
+ #include "config.h"
+ #endif
+ 
++#include <sys/sysmacros.h>
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/stat.h>
diff --git a/import-layers/yocto-poky/meta/recipes-extended/pax/pax_3.4.bb b/import-layers/yocto-poky/meta/recipes-extended/pax/pax_3.4.bb
index 9d1abfb..9b4e17b 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/pax/pax_3.4.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/pax/pax_3.4.bb
@@ -16,7 +16,9 @@
 
 SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/${BPN}/${BP}.tar.bz2/fbd9023b590b45ac3ade95870702a0d6/${BP}.tar.bz2 \
 	file://fix_for_compile_with_gcc-4.6.0.patch \
-	file://pax-3.4_fix_for_x32.patch"
+	file://pax-3.4_fix_for_x32.patch \
+        file://0001-include-sys-sysmacros.h-for-major-minor-definitions.patch \
+"
 
 SRC_URI_append_libc-musl = " file://0001-Fix-build-with-musl.patch \
                              file://0001-use-strtoll-instead-of-strtoq.patch \
diff --git a/import-layers/yocto-poky/meta/recipes-extended/pigz/pigz.inc b/import-layers/yocto-poky/meta/recipes-extended/pigz/pigz.inc
index 86f434c..978f905 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/pigz/pigz.inc
+++ b/import-layers/yocto-poky/meta/recipes-extended/pigz/pigz.inc
@@ -7,8 +7,6 @@
 SECTION = "console/utils"
 LICENSE = "Zlib & Apache-2.0"
 
-SRC_URI = "http://zlib.net/${BPN}/${BP}.tar.gz"
-
 PROVIDES_class-native += "gzip-native"
 
 DEPENDS = "zlib"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/pigz/pigz/link-order.patch b/import-layers/yocto-poky/meta/recipes-extended/pigz/pigz/link-order.patch
deleted file mode 100644
index 4becc0e..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/pigz/pigz/link-order.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-This patch avoids underlinking issues since we pass -lz via LDFLAGS but it appears
-before pigz.o which needs symbols from libz however due to order linker happily discards libz
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Index: pigz-2.3.3/Makefile
-===================================================================
---- pigz-2.3.3.orig/Makefile	2015-01-19 20:12:31.000000000 -0800
-+++ pigz-2.3.3/Makefile	2015-01-28 09:11:50.266669184 -0800
-@@ -5,7 +5,7 @@
- # use gcc and gmake on Solaris
- 
- pigz: pigz.o yarn.o try.o ${ZOPFLI}deflate.o ${ZOPFLI}blocksplitter.o ${ZOPFLI}tree.o ${ZOPFLI}lz77.o ${ZOPFLI}cache.o ${ZOPFLI}hash.o ${ZOPFLI}util.o ${ZOPFLI}squeeze.o ${ZOPFLI}katajainen.o
--	$(CC) $(LDFLAGS) -o pigz $^ -lpthread -lm
-+	$(CC) -o pigz $^ $(LDFLAGS) -lz -lpthread -lm
- 	ln -f pigz unpigz
- 
- pigz.o: pigz.c yarn.h try.h ${ZOPFLI}deflate.h ${ZOPFLI}util.h
-@@ -35,7 +35,7 @@
- dev: pigz pigzt pigzn
- 
- pigzt: pigzt.o yarnt.o try.o ${ZOPFLI}deflate.o ${ZOPFLI}blocksplitter.o ${ZOPFLI}tree.o ${ZOPFLI}lz77.o ${ZOPFLI}cache.o ${ZOPFLI}hash.o ${ZOPFLI}util.o ${ZOPFLI}squeeze.o ${ZOPFLI}katajainen.o
--	$(CC) $(LDFLAGS) -o pigzt $^ -lpthread -lm
-+	$(CC) -o pigzt $^ $(LDFLAGS) -lz -lpthread -lm
- 
- pigzt.o: pigz.c yarn.h try.h
- 	$(CC) $(CFLAGS) -DDEBUG -g -c -o pigzt.o pigz.c
-@@ -44,7 +44,7 @@
- 	$(CC) $(CFLAGS) -DDEBUG -g -c -o yarnt.o yarn.c
- 
- pigzn: pigzn.o tryn.o ${ZOPFLI}deflate.o ${ZOPFLI}blocksplitter.o ${ZOPFLI}tree.o ${ZOPFLI}lz77.o ${ZOPFLI}cache.o ${ZOPFLI}hash.o ${ZOPFLI}util.o ${ZOPFLI}squeeze.o ${ZOPFLI}katajainen.o
--	$(CC) $(LDFLAGS) -o pigzn $^ -lm
-+	$(CC) -o pigzn $^ $(LDFLAGS) -lz -lm
- 
- pigzn.o: pigz.c try.h
- 	$(CC) $(CFLAGS) -DDEBUG -DNOTHREAD -g -c -o pigzn.o pigz.c
diff --git a/import-layers/yocto-poky/meta/recipes-extended/pigz/pigz_2.3.3.bb b/import-layers/yocto-poky/meta/recipes-extended/pigz/pigz_2.3.3.bb
deleted file mode 100644
index 9e97273..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/pigz/pigz_2.3.3.bb
+++ /dev/null
@@ -1,14 +0,0 @@
-require pigz.inc
-LIC_FILES_CHKSUM = "file://pigz.c;beginline=7;endline=21;md5=a21d4075cb00ab4ca17fce5e7534ca95"
-
-UPSTREAM_CHECK_URI := "${SRC_URI}"
-SRC_URI = "http://downloads.yoctoproject.org/mirror/sources/${BP}.tar.gz"
-SRC_URI += "file://link-order.patch"
-
-SRC_URI[md5sum] = "01d7a16cce77929cc1a78aa1bdfb68cb"
-SRC_URI[sha256sum] = "4e8b67b432ce7907575a549f3e1cac4709781ba0f6b48afea9f59369846b509c"
-
-NATIVE_PACKAGE_PATH_SUFFIX = "/${PN}"
-
-BBCLASSEXTEND = "native nativesdk"
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/pigz/pigz_2.3.4.bb b/import-layers/yocto-poky/meta/recipes-extended/pigz/pigz_2.3.4.bb
new file mode 100644
index 0000000..f4832df
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/pigz/pigz_2.3.4.bb
@@ -0,0 +1,11 @@
+require pigz.inc
+LIC_FILES_CHKSUM = "file://pigz.c;beginline=7;endline=21;md5=a21d4075cb00ab4ca17fce5e7534ca95"
+
+UPSTREAM_CHECK_URI = "http://zlib.net/${BPN}/"
+UPSTREAM_CHECK_REGEX = "pigz-(?P<pver>.*)\.tar"
+SRC_URI = "https://github.com/madler/pigz/archive/v${PV}.tar.gz;downloadfilename=${BP}.tar.gz"
+SRC_URI[md5sum] = "c109057050b15edf3eb9bb4d0805235e"
+SRC_URI[sha256sum] = "763f2fdb203aa0b7b640e63385e38e5dd4e5aaa041bc8e42aa96f2ef156b06e8"
+
+BBCLASSEXTEND = "native nativesdk"
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/pixz/pixz_1.0.6.bb b/import-layers/yocto-poky/meta/recipes-extended/pixz/pixz_1.0.6.bb
index 0e51472..3032586 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/pixz/pixz_1.0.6.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/pixz/pixz_1.0.6.bb
@@ -15,10 +15,11 @@
 "
 UPSTREAM_CHECK_URI = "https://github.com/vasi/pixz/releases"
 
-EXTRA_OECONF += "--without-manpage"
+PACKAGECONFIG[manpages] = "--with-manpage, --without-manpage, asciidoc-native"
+
 CFLAGS_append_libc-musl = " -D_GNU_SOURCE"
 CACHED_CONFIGUREVARS += "ac_cv_file_src_pixz_1=no"
 
-inherit autotools pkgconfig
+inherit autotools pkgconfig manpages
 
 BBCLASSEXTEND = "native"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/procps/procps_3.3.12.bb b/import-layers/yocto-poky/meta/recipes-extended/procps/procps_3.3.12.bb
index 4ca1a50..adabd75 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/procps/procps_3.3.12.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/procps/procps_3.3.12.bb
@@ -49,6 +49,7 @@
 base_sbindir_progs += "sysctl"
 
 ALTERNATIVE_PRIORITY = "200"
+ALTERNATIVE_PRIORITY[pidof] = "150"
 
 ALTERNATIVE_${PN} = "${bindir_progs} ${base_bindir_progs} ${base_sbindir_progs}"
 
@@ -57,10 +58,10 @@
 ALTERNATIVE_LINK_NAME[uptime.1] = "${mandir}/man1/uptime.1"
 
 python __anonymous() {
-    for prog in d.getVar('base_bindir_progs', True).split():
-        d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir', True), prog))
+    for prog in d.getVar('base_bindir_progs').split():
+        d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog))
 
-    for prog in d.getVar('base_sbindir_progs', True).split():
-        d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_sbindir', True), prog))
+    for prog in d.getVar('base_sbindir_progs').split():
+        d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_sbindir'), prog))
 }
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/psmisc/psmisc.inc b/import-layers/yocto-poky/meta/recipes-extended/psmisc/psmisc.inc
index 98a8470..22b2e85 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/psmisc/psmisc.inc
+++ b/import-layers/yocto-poky/meta/recipes-extended/psmisc/psmisc.inc
@@ -15,7 +15,7 @@
 
 inherit autotools gettext
 
-PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'ipv6', '', d)}"
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
 PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
 
 ALLOW_EMPTY_${PN} = "1"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/quota/quota_4.03.bb b/import-layers/yocto-poky/meta/recipes-extended/quota/quota_4.03.bb
index 22aab41..28b3854 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/quota/quota_4.03.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/quota/quota_4.03.bb
@@ -22,6 +22,8 @@
 SRC_URI[md5sum] = "6b09f9c93515c25a528be5754cdfb6f5"
 SRC_URI[sha256sum] = "9c6c4d9ae7bf30506dd2aa3d8056c4ff2f8d087930d7c721616f5c093bdc674b"
 
+CVE_PRODUCT = "linux_diskquota"
+
 UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/linuxquota/files/quota-tools/"
 UPSTREAM_CHECK_REGEX = "/quota-tools/(?P<pver>(\d+[\.\-_]*)+)/"
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind/0001-Avoid-use-of-glibc-sys-cdefs.h-header.patch b/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind/0001-Avoid-use-of-glibc-sys-cdefs.h-header.patch
deleted file mode 100644
index eeef9f1..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind/0001-Avoid-use-of-glibc-sys-cdefs.h-header.patch
+++ /dev/null
@@ -1,221 +0,0 @@
-From 2a44d862233f2126581e290d568e1c8b8f2eb9f5 Mon Sep 17 00:00:00 2001
-From: Carlo Landmeter <clandmeter@gmail.com>
-Date: Thu, 19 Feb 2015 15:28:45 +0000
-Subject: [PATCH] Avoid use of glibc sys/cdefs.h header
-
-Upstream-Status: Pending
----
- src/check_bound.c  |    2 +-
- src/pmap_svc.c     |   10 +++++-----
- src/rpcb_svc.c     |   10 +++++-----
- src/rpcb_svc_4.c   |   14 +++++++-------
- src/rpcb_svc_com.c |   46 +++++++++++++++++++++++-----------------------
- src/rpcbind.c      |   12 ++++++------
- src/util.c         |    2 +-
- src/warmstart.c    |    4 ++--
- 8 files changed, 50 insertions(+), 50 deletions(-)
-
-diff --git a/src/check_bound.c b/src/check_bound.c
-index c70b845..5d21730 100644
---- a/src/check_bound.c
-+++ b/src/check_bound.c
-@@ -70,7 +70,7 @@ static struct fdlist *fdhead;	/* Link list of the check fd's */
- static struct fdlist *fdtail;
- static char *nullstring = "";
- 
--static bool_t check_bound __P((struct fdlist *, char *uaddr));
-+static bool_t check_bound (struct fdlist *, char *uaddr);
- 
- /*
-  * Returns 1 if the given address is bound for the given addr & transport
-diff --git a/src/pmap_svc.c b/src/pmap_svc.c
-index ad28b93..9c7d409 100644
---- a/src/pmap_svc.c
-+++ b/src/pmap_svc.c
-@@ -60,11 +60,11 @@ static	char sccsid[] = "@(#)pmap_svc.c 1.23 89/04/05 Copyr 1984 Sun Micro";
- #include "rpcbind.h"
- #include "xlog.h"
- #include <rpc/svc_soc.h> /* svc_getcaller routine definition */
--static struct pmaplist *find_service_pmap __P((rpcprog_t, rpcvers_t,
--					       rpcprot_t));
--static bool_t pmapproc_change __P((struct svc_req *, SVCXPRT *, u_long));
--static bool_t pmapproc_getport __P((struct svc_req *, SVCXPRT *));
--static bool_t pmapproc_dump __P((struct svc_req *, SVCXPRT *));
-+static struct pmaplist *find_service_pmap (rpcprog_t, rpcvers_t,
-+					       rpcprot_t);
-+static bool_t pmapproc_change (struct svc_req *, SVCXPRT *, u_long);
-+static bool_t pmapproc_getport (struct svc_req *, SVCXPRT *);
-+static bool_t pmapproc_dump (struct svc_req *, SVCXPRT *);
- 
- /*
-  * Called for all the version 2 inquiries.
-diff --git a/src/rpcb_svc.c b/src/rpcb_svc.c
-index bd92201..6c7f7fe 100644
---- a/src/rpcb_svc.c
-+++ b/src/rpcb_svc.c
-@@ -53,10 +53,10 @@
- #include "rpcbind.h"
- #include "xlog.h"
- 
--static void *rpcbproc_getaddr_3_local __P((void *, struct svc_req *, SVCXPRT *,
--					   rpcvers_t));
--static void *rpcbproc_dump_3_local __P((void *, struct svc_req *, SVCXPRT *,
--					rpcvers_t));
-+static void *rpcbproc_getaddr_3_local (void *, struct svc_req *, SVCXPRT *,
-+					   rpcvers_t);
-+static void *rpcbproc_dump_3_local (void *, struct svc_req *, SVCXPRT *,
-+					rpcvers_t);
- 
- /*
-  * Called by svc_getreqset. There is a separate server handle for
-@@ -75,7 +75,7 @@ rpcb_service_3(struct svc_req *rqstp, SVCXPRT *transp)
- 	} argument;
- 	char *result;
- 	xdrproc_t xdr_argument, xdr_result;
--	void *(*local) __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t));
-+	void *(*local) (void *, struct svc_req *, SVCXPRT *, rpcvers_t);
- 	rpcprog_t setprog = 0;
- 
- 	rpcbs_procinfo(RPCBVERS_3_STAT, rqstp->rq_proc);
-diff --git a/src/rpcb_svc_4.c b/src/rpcb_svc_4.c
-index b673452..6764c0a 100644
---- a/src/rpcb_svc_4.c
-+++ b/src/rpcb_svc_4.c
-@@ -54,13 +54,13 @@
- #include "rpcbind.h"
- #include "xlog.h"
- 
--static void *rpcbproc_getaddr_4_local __P((void *, struct svc_req *, SVCXPRT *,
--				      rpcvers_t));
--static void *rpcbproc_getversaddr_4_local __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t));
-+static void *rpcbproc_getaddr_4_local (void *, struct svc_req *, SVCXPRT *,
-+				      rpcvers_t);
-+static void *rpcbproc_getversaddr_4_local (void *, struct svc_req *, SVCXPRT *, rpcvers_t);
- static void *rpcbproc_getaddrlist_4_local
--	__P((void *, struct svc_req *, SVCXPRT *, rpcvers_t));
--static void free_rpcb_entry_list __P((rpcb_entry_list_ptr *));
--static void *rpcbproc_dump_4_local __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t));
-+	(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
-+static void free_rpcb_entry_list (rpcb_entry_list_ptr *);
-+static void *rpcbproc_dump_4_local (void *, struct svc_req *, SVCXPRT *, rpcvers_t);
- 
- /*
-  * Called by svc_getreqset. There is a separate server handle for
-@@ -78,7 +78,7 @@ rpcb_service_4(struct svc_req *rqstp, SVCXPRT *transp)
- 	} argument;
- 	char *result;
- 	xdrproc_t xdr_argument, xdr_result;
--	void *(*local) __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t));
-+	void *(*local) (void *, struct svc_req *, SVCXPRT *, rpcvers_t);
- 	rpcprog_t setprog = 0;
- 
- 	rpcbs_procinfo(RPCBVERS_4_STAT, rqstp->rq_proc);
-diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
-index ff9ce6b..8aef9e5 100644
---- a/src/rpcb_svc_com.c
-+++ b/src/rpcb_svc_com.c
-@@ -100,29 +100,29 @@ struct finfo {
- static struct finfo     FINFO[NFORWARD];
- 
- 
--static bool_t xdr_encap_parms __P((XDR *, struct encap_parms *));
--static bool_t xdr_rmtcall_args __P((XDR *, struct r_rmtcall_args *));
--static bool_t xdr_rmtcall_result __P((XDR *, struct r_rmtcall_args *));
--static bool_t xdr_opaque_parms __P((XDR *, struct r_rmtcall_args *));
--static int find_rmtcallfd_by_netid __P((char *));
--static SVCXPRT *find_rmtcallxprt_by_fd __P((int));
--static int forward_register __P((u_int32_t, struct netbuf *, int, char *,
--    rpcproc_t, rpcvers_t, u_int32_t *));
--static struct finfo *forward_find __P((u_int32_t));
--static int free_slot_by_xid __P((u_int32_t));
--static int free_slot_by_index __P((int));
--static int netbufcmp __P((struct netbuf *, struct netbuf *));
--static struct netbuf *netbufdup __P((struct netbuf *));
--static void netbuffree __P((struct netbuf *));
--static int check_rmtcalls __P((struct pollfd *, int));
--static void xprt_set_caller __P((SVCXPRT *, struct finfo *));
--static void send_svcsyserr __P((SVCXPRT *, struct finfo *));
--static void handle_reply __P((int, SVCXPRT *));
--static void find_versions __P((rpcprog_t, char *, rpcvers_t *, rpcvers_t *));
--static rpcblist_ptr find_service __P((rpcprog_t, rpcvers_t, char *));
--static char *getowner __P((SVCXPRT *, char *, size_t));
--static int add_pmaplist __P((RPCB *));
--static int del_pmaplist __P((RPCB *));
-+static bool_t xdr_encap_parms (XDR *, struct encap_parms *);
-+static bool_t xdr_rmtcall_args (XDR *, struct r_rmtcall_args *);
-+static bool_t xdr_rmtcall_result (XDR *, struct r_rmtcall_args *);
-+static bool_t xdr_opaque_parms (XDR *, struct r_rmtcall_args *);
-+static int find_rmtcallfd_by_netid (char *);
-+static SVCXPRT *find_rmtcallxprt_by_fd (int);
-+static int forward_register (u_int32_t, struct netbuf *, int, char *,
-+    rpcproc_t, rpcvers_t, u_int32_t *);
-+static struct finfo *forward_find (u_int32_t);
-+static int free_slot_by_xid (u_int32_t);
-+static int free_slot_by_index (int);
-+static int netbufcmp (struct netbuf *, struct netbuf *);
-+static struct netbuf *netbufdup (struct netbuf *);
-+static void netbuffree (struct netbuf *);
-+static int check_rmtcalls (struct pollfd *, int);
-+static void xprt_set_caller (SVCXPRT *, struct finfo *);
-+static void send_svcsyserr (SVCXPRT *, struct finfo *);
-+static void handle_reply (int, SVCXPRT *);
-+static void find_versions (rpcprog_t, char *, rpcvers_t *, rpcvers_t *);
-+static rpcblist_ptr find_service (rpcprog_t, rpcvers_t, char *);
-+static char *getowner (SVCXPRT *, char *, size_t);
-+static int add_pmaplist (RPCB *);
-+static int del_pmaplist (RPCB *);
- 
- /*
-  * Set a mapping of program, version, netid
-diff --git a/src/rpcbind.c b/src/rpcbind.c
-index 045daa1..137011b 100644
---- a/src/rpcbind.c
-+++ b/src/rpcbind.c
-@@ -135,13 +135,13 @@ char *tcp_uaddr;	/* Universal TCP address */
- static char servname[] = "rpcbind";
- static char superuser[] = "superuser";
- 
--int main __P((int, char *[]));
-+int main (int, char *[]);
- 
--static int init_transport __P((struct netconfig *));
--static void rbllist_add __P((rpcprog_t, rpcvers_t, struct netconfig *,
--			     struct netbuf *));
--static void terminate __P((int));
--static void parseargs __P((int, char *[]));
-+static int init_transport (struct netconfig *);
-+static void rbllist_add (rpcprog_t, rpcvers_t, struct netconfig *,
-+			     struct netbuf *);
-+static void terminate (int);
-+static void parseargs (int, char *[]);
- 
- int
- main(int argc, char *argv[])
-diff --git a/src/util.c b/src/util.c
-index a6c835b..33b9e4f 100644
---- a/src/util.c
-+++ b/src/util.c
-@@ -70,7 +70,7 @@ static struct sockaddr_in *local_in4;
- static struct sockaddr_in6 *local_in6;
- #endif
- 
--static int bitmaskcmp __P((void *, void *, void *, int));
-+static int bitmaskcmp (void *, void *, void *, int);
- 
- /*
-  * For all bits set in "mask", compare the corresponding bits in
-diff --git a/src/warmstart.c b/src/warmstart.c
-index b6eb73e..42dd3af 100644
---- a/src/warmstart.c
-+++ b/src/warmstart.c
-@@ -58,8 +58,8 @@
- #define	PMAPFILE	RPCBIND_STATEDIR "/portmap.xdr"
- #endif
- 
--static bool_t write_struct __P((char *, xdrproc_t, void *));
--static bool_t read_struct __P((char *, xdrproc_t, void *));
-+static bool_t write_struct (char *, xdrproc_t, void *);
-+static bool_t read_struct (char *, xdrproc_t, void *);
- 
- static bool_t
- write_struct(char *filename, xdrproc_t structproc, void *list)
diff --git a/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind/0001-handle_reply-Don-t-use-the-xp_auth-pointer-directly.patch b/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind/0001-handle_reply-Don-t-use-the-xp_auth-pointer-directly.patch
deleted file mode 100644
index 16b763e..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind/0001-handle_reply-Don-t-use-the-xp_auth-pointer-directly.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 9194122389f2a56b1cd1f935e64307e2e963c2da Mon Sep 17 00:00:00 2001
-From: Steve Dickson <steved@redhat.com>
-Date: Mon, 2 Nov 2015 17:05:18 -0500
-Subject: [PATCH] handle_reply: Don't use the xp_auth pointer directly
-
-In the latest libtirpc version to access the xp_auth
-one must use the SVC_XP_AUTH macro. To be backwards
-compatible a couple ifdefs were added to use the
-macro when it exists.
-
-Upstream-Status: Backport
-
-Signed-off-by: Steve Dickson <steved@redhat.com>
-Signed-off-by: Maxin B. John <maxin.john@intel.com>
----
- src/rpcb_svc_com.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
-index 4ae93f1..22d6c84 100644
---- a/src/rpcb_svc_com.c
-+++ b/src/rpcb_svc_com.c
-@@ -1295,10 +1295,17 @@ handle_reply(int fd, SVCXPRT *xprt)
- 	a.rmt_localvers = fi->versnum;
- 
- 	xprt_set_caller(xprt, fi);
-+#if defined(SVC_XP_AUTH)
-+	SVC_XP_AUTH(xprt) = svc_auth_none;
-+#else 
- 	xprt->xp_auth = &svc_auth_none;
-+#endif
- 	svc_sendreply(xprt, (xdrproc_t) xdr_rmtcall_result, (char *) &a);
-+#if !defined(SVC_XP_AUTH)
- 	SVCAUTH_DESTROY(xprt->xp_auth);
- 	xprt->xp_auth = NULL;
-+#endif
-+
- done:
- 	if (buffer)
- 		free(buffer);
--- 
-2.4.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind/0001-rpcbind-pair-all-svc_getargs-calls-with-svc_freeargs.patch b/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind/0001-rpcbind-pair-all-svc_getargs-calls-with-svc_freeargs.patch
new file mode 100644
index 0000000..bf7aaef
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind/0001-rpcbind-pair-all-svc_getargs-calls-with-svc_freeargs.patch
@@ -0,0 +1,221 @@
+From 7ea36eeece56b59f98e469934e4c20b4da043346 Mon Sep 17 00:00:00 2001
+From: Doran Moppert <dmoppert@redhat.com>
+Date: Thu, 11 May 2017 11:42:54 -0400
+Subject: [PATCH] rpcbind: pair all svc_getargs() calls with svc_freeargs() to
+ avoid memory leak
+
+This patch is to address CVE-2017-8779 "rpcbomb" in rpcbind, discussed
+at [1], [2], [3].  The last link suggests this issue is actually a bug
+in rpcbind, which led me here.
+
+The leak caused by the reproducer at [4] appears to come from
+rpcb_service_4(), in the case where svc_getargs() returns false and the
+function had an early return, rather than passing through the cleanup
+path at done:, as would otherwise occur.
+
+It also addresses a couple of other locations where the same fault seems
+to exist, though I haven't been able to exercise those.  I hope someone
+more intimate with rpc(3) can confirm my understanding is correct, and
+that I haven't introduced any new bugs.
+
+Without this patch, using the reproducer (and variants) repeatedly
+against rpcbind with a numBytes argument of 1_000_000_000, /proc/$(pidof
+rpcbind)/status reports VmSize increase of 976564 kB each call, and
+VmRSS increase of around 260 kB every 33 calls - the specific numbers
+are probably an artifact of my rhel/glibc version.  With the patch,
+there is a small (~50 kB) VmSize increase with the first message, but
+thereafter both VmSize and VmRSS remain steady.
+
+[1]: http://seclists.org/oss-sec/2017/q2/209
+[2]: https://bugzilla.redhat.com/show_bug.cgi?id=1448124
+[3]: https://sourceware.org/ml/libc-alpha/2017-05/msg00129.html
+[4]: https://github.com/guidovranken/rpcbomb/
+
+
+CVE: CVE-2017-8779
+Upstream-Status: Backport
+
+Signed-off-by: Fan Xin <fan.xin@jp.fujitsu.com>
+---
+ src/pmap_svc.c     | 56 +++++++++++++++++++++++++++++++++++++++++++++---------
+ src/rpcb_svc.c     |  2 +-
+ src/rpcb_svc_4.c   |  2 +-
+ src/rpcb_svc_com.c |  8 ++++++++
+ 4 files changed, 57 insertions(+), 11 deletions(-)
+
+diff --git a/src/pmap_svc.c b/src/pmap_svc.c
+index 4c744fe..e926cdc 100644
+--- a/src/pmap_svc.c
++++ b/src/pmap_svc.c
+@@ -175,6 +175,7 @@ pmapproc_change(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt, unsigned long
+ 	long ans;
+ 	uid_t uid;
+ 	char uidbuf[32];
++	int rc = TRUE;
+ 
+ 	/*
+ 	 * Can't use getpwnam here. We might end up calling ourselves
+@@ -194,7 +195,8 @@ pmapproc_change(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt, unsigned long
+ 
+ 	if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *)&reg)) {
+ 		svcerr_decode(xprt);
+-		return (FALSE);
++		rc = FALSE;
++		goto done;
+ 	}
+ #ifdef RPCBIND_DEBUG
+ 	if (debugging)
+@@ -205,7 +207,8 @@ pmapproc_change(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt, unsigned long
+ 
+ 	if (!check_access(xprt, op, reg.pm_prog, PMAPVERS)) {
+ 		svcerr_weakauth(xprt);
+-		return (FALSE);
++		rc = (FALSE);
++		goto done;
+ 	}
+ 
+ 	rpcbreg.r_prog = reg.pm_prog;
+@@ -258,7 +261,16 @@ done_change:
+ 		rpcbs_set(RPCBVERS_2_STAT, ans);
+ 	else
+ 		rpcbs_unset(RPCBVERS_2_STAT, ans);
+-	return (TRUE);
++done:
++	if (!svc_freeargs(xprt, (xdrproc_t) xdr_pmap, (char *)&reg)) {
++		if (debugging) {
++			/*(void) xlog(LOG_DEBUG, "unable to free arguments\n");*/
++			if (doabort) {
++				rpcbind_abort();
++			}
++		}
++	}
++	return (rc);
+ }
+ 
+ /* ARGSUSED */
+@@ -272,15 +284,18 @@ pmapproc_getport(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
+ #ifdef RPCBIND_DEBUG
+ 	char *uaddr;
+ #endif
++	int rc = TRUE;
+ 
+ 	if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *)&reg)) {
+ 		svcerr_decode(xprt);
+-		return (FALSE);
++		rc = FALSE;
++		goto done;
+ 	}
+ 
+ 	if (!check_access(xprt, PMAPPROC_GETPORT, reg.pm_prog, PMAPVERS)) {
+ 		svcerr_weakauth(xprt);
+-		return FALSE;
++		rc = FALSE;
++		goto done;
+ 	}
+ 
+ #ifdef RPCBIND_DEBUG
+@@ -330,21 +345,34 @@ pmapproc_getport(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
+ 		pmap_ipprot2netid(reg.pm_prot) ?: "<unknown>",
+ 		port ? udptrans : "");
+ 
+-	return (TRUE);
++done:
++	if (!svc_freeargs(xprt, (xdrproc_t) xdr_pmap, (char *)&reg)) {
++		if (debugging) {
++			/* (void) xlog(LOG_DEBUG, "unable to free arguments\n");*/
++			if (doabort) {
++				rpcbind_abort();
++			}
++		}
++	}
++	return (rc);
+ }
+ 
+ /* ARGSUSED */
+ static bool_t
+ pmapproc_dump(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
+ {
++	int rc = TRUE;
++
+ 	if (!svc_getargs(xprt, (xdrproc_t)xdr_void, NULL)) {
+ 		svcerr_decode(xprt);
+-		return (FALSE);
++		rc = FALSE;
++		goto done;
+ 	}
+ 
+ 	if (!check_access(xprt, PMAPPROC_DUMP, 0, PMAPVERS)) {
+ 		svcerr_weakauth(xprt);
+-		return FALSE;
++		rc = FALSE;
++		goto done;
+ 	}
+ 	
+ 	if ((!svc_sendreply(xprt, (xdrproc_t) xdr_pmaplist_ptr,
+@@ -354,7 +382,17 @@ pmapproc_dump(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
+ 			rpcbind_abort();
+ 		}
+ 	}
+-	return (TRUE);
++
++done:
++	if (!svc_freeargs(xprt, (xdrproc_t) xdr_pmap, (char *)NULL)) {
++		if (debugging) {
++			/*(void) xlog(LOG_DEBUG, "unable to free arguments\n");*/
++			if (doabort) {
++				rpcbind_abort();
++			}
++		}
++	}
++	return (rc);
+ }
+ 
+ int pmap_netid2ipprot(const char *netid)
+diff --git a/src/rpcb_svc.c b/src/rpcb_svc.c
+index 709e3fb..091f530 100644
+--- a/src/rpcb_svc.c
++++ b/src/rpcb_svc.c
+@@ -166,7 +166,7 @@ rpcb_service_3(struct svc_req *rqstp, SVCXPRT *transp)
+ 		svcerr_decode(transp);
+ 		if (debugging)
+ 			(void) xlog(LOG_DEBUG, "rpcbind: could not decode");
+-		return;
++		goto done;
+ 	}
+ 
+ 	if (rqstp->rq_proc == RPCBPROC_SET
+diff --git a/src/rpcb_svc_4.c b/src/rpcb_svc_4.c
+index 5094879..eebbbbe 100644
+--- a/src/rpcb_svc_4.c
++++ b/src/rpcb_svc_4.c
+@@ -218,7 +218,7 @@ rpcb_service_4(struct svc_req *rqstp, SVCXPRT *transp)
+ 		svcerr_decode(transp);
+ 		if (debugging)
+ 			(void) xlog(LOG_DEBUG, "rpcbind: could not decode\n");
+-		return;
++		goto done;
+ 	}
+ 
+ 	if (rqstp->rq_proc == RPCBPROC_SET
+diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
+index 5862c26..cb63afd 100644
+--- a/src/rpcb_svc_com.c
++++ b/src/rpcb_svc_com.c
+@@ -927,6 +927,14 @@ error:
+ 	if (call_msg.rm_xid != 0)
+ 		(void) free_slot_by_xid(call_msg.rm_xid);
+ out:
++	if (!svc_freeargs(transp, (xdrproc_t) xdr_rmtcall_args, (char *) &a)) {
++		if (debugging) {
++			(void) xlog(LOG_DEBUG, "unable to free arguments\n");
++			if (doabort) {
++				rpcbind_abort();
++			}
++		}
++	}
+ 	if (local_uaddr)
+ 		free(local_uaddr);
+ 	if (buf_alloc)
+-- 
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind/cve-2015-7236.patch b/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind/cve-2015-7236.patch
deleted file mode 100644
index 741a990..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind/cve-2015-7236.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-commit 06f7ebb1dade2f0dbf872ea2bedf17cff4734bdd
-Author: Olaf Kirch <okir@...e.de>
-Date:   Thu Aug 6 16:27:20 2015 +0200
-
-    Fix memory corruption in PMAP_CALLIT code
-    
-     - A PMAP_CALLIT call comes in on IPv4 UDP
-     - rpcbind duplicates the caller's address to a netbuf and stores it in
-       FINFO[0].caller_addr. caller_addr->buf now points to a memory region A
-       with a size of 16 bytes
-     - rpcbind forwards the call to the local service, receives a reply
-     - when processing the reply, it does this in xprt_set_caller:
-         xprt->xp_rtaddr = *FINFO[0].caller_addr
-       It sends out the reply, and then frees the netbuf caller_addr and
-       caller_addr.buf.
-       However, it does not clear xp_rtaddr, so xp_rtaddr.buf now refers
-       to memory region A, which is free.
-     - When the next call comes in on the UDP/IPv4 socket, svc_dg_recv will
-       be called, which will set xp_rtaddr to the client's address.
-       It will reuse the buffer inside xp_rtaddr, ie it will write a
-       sockaddr_in to region A
-    
-    Some time down the road, an incoming TCP connection is accepted,
-    allocating a fresh SVCXPRT. The memory region A is inside the
-    new SVCXPRT
-    
-     - While processing the TCP call, another UDP call comes in, again
-       overwriting region A with the client's address
-     - TCP client closes connection. In svc_destroy, we now trip over
-       the garbage left in region A
-    
-    We ran into the case where a commercial scanner was triggering
-    occasional rpcbind segfaults. The core file that was captured showed
-    a corrupted xprt->xp_netid pointer that was really a sockaddr_in.
-    
-    Signed-off-by: Olaf Kirch <okir@...e.de>
-
-    Upstream-Status: Backport
-    CVE: CVE-2015-7236
-
-    Signed-off-by: Li Zhou <li.zhou@windriver.com>
----
- src/rpcb_svc_com.c |   23 ++++++++++++++++++++++-
- 1 file changed, 22 insertions(+), 1 deletion(-)
-
-Index: rpcbind-0.1.6+git20080930/src/rpcb_svc_com.c
-===================================================================
---- rpcbind-0.1.6+git20080930.orig/src/rpcb_svc_com.c
-+++ rpcbind-0.1.6+git20080930/src/rpcb_svc_com.c
-@@ -1298,12 +1298,33 @@ check_rmtcalls(struct pollfd *pfds, int
- 	return (ncallbacks_found);
- }
- 
-+/*
-+ * This is really a helper function defined in libtirpc, but unfortunately, it hasn't
-+ * been exported yet.
-+ */
-+static struct netbuf *
-+__rpc_set_netbuf(struct netbuf *nb, const void *ptr, size_t len)
-+{
-+	if (nb->len != len) {
-+		if (nb->len)
-+			mem_free(nb->buf, nb->len);
-+		nb->buf = mem_alloc(len);
-+		if (nb->buf == NULL)
-+			return NULL;
-+
-+		nb->maxlen = nb->len = len;
-+	}
-+	memcpy(nb->buf, ptr, len);
-+	return nb;
-+}
-+
- static void
- xprt_set_caller(SVCXPRT *xprt, struct finfo *fi)
- {
-+	const struct netbuf *caller = fi->caller_addr;
- 	u_int32_t *xidp;
- 
--	*(svc_getrpccaller(xprt)) = *(fi->caller_addr);
-+	__rpc_set_netbuf(svc_getrpccaller(xprt), caller->buf, caller->len);
- 	xidp = __rpcb_get_dg_xidp(xprt);
- 	*xidp = fi->caller_xid;
- }
diff --git a/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind_0.2.3.bb b/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind_0.2.4.bb
similarity index 84%
rename from import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind_0.2.3.bb
rename to import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind_0.2.4.bb
index c19a197..1a12055 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind_0.2.3.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/rpcbind/rpcbind_0.2.4.bb
@@ -12,23 +12,21 @@
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/rpcbind/rpcbind-${PV}.tar.bz2 \
            file://init.d \
-           file://0001-Avoid-use-of-glibc-sys-cdefs.h-header.patch \
            file://remove-sys-queue.patch \
-           file://0001-handle_reply-Don-t-use-the-xp_auth-pointer-directly.patch \
            ${UCLIBCPATCHES} \
            ${MUSLPATCHES} \
            file://rpcbind.conf \
            file://rpcbind.socket \
            file://rpcbind.service \
-           file://cve-2015-7236.patch \
+           file://0001-rpcbind-pair-all-svc_getargs-calls-with-svc_freeargs.patch \
           "
 MUSLPATCHES_libc-musl = "file://musl-sunrpc.patch"
 
 UCLIBCPATCHES ?= ""
 MUSLPATCHES ?= ""
 
-SRC_URI[md5sum] = "c8875246b2688a1adfbd6ad43480278d"
-SRC_URI[sha256sum] = "9897823a9d820ea011d9ea02054d5ab99469b9ca5346265fee380713c8fed27b"
+SRC_URI[md5sum] = "cf10cd41ed8228fc54c316191c1f07fe"
+SRC_URI[sha256sum] = "074a9a530dc7c11e0d905aa59bcb0847c009313f02e98d3d798aa9568f414c66"
 
 inherit autotools update-rc.d systemd pkgconfig
 
@@ -46,7 +44,7 @@
 USERADD_PARAM_${PN} = "--system --no-create-home --home-dir / \
                        --shell /bin/false --user-group rpc"
 
-PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
 PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/, \
                           --without-systemdsystemunitdir, \
                           systemd \
diff --git a/import-layers/yocto-poky/meta/recipes-extended/screen/screen_4.4.0.bb b/import-layers/yocto-poky/meta/recipes-extended/screen/screen_4.5.1.bb
similarity index 89%
rename from import-layers/yocto-poky/meta/recipes-extended/screen/screen_4.4.0.bb
rename to import-layers/yocto-poky/meta/recipes-extended/screen/screen_4.5.1.bb
index 769bac1..32c1a5a 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/screen/screen_4.4.0.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/screen/screen_4.5.1.bb
@@ -26,8 +26,8 @@
            file://0001-fix-for-multijob-build.patch \
           "
 
-SRC_URI[md5sum] = "d26e11a3648c2b11aaefa215a55dfd39"
-SRC_URI[sha256sum] = "ef722a54759a3bf23aad272bbf33c414c1078cad6bcd982fada93c0d7917218b"
+SRC_URI[md5sum] = "a8c5da2f42f8a18fa4dada2419d1549b"
+SRC_URI[sha256sum] = "97db2114dd963b016cd4ded34831955dcbe3251e5eee45ac2606e67e9f097b2d"
 
 inherit autotools texinfo
 
@@ -38,7 +38,7 @@
                ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)}"
 
 do_install_append () {
-	if [ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" = "pam" ]; then
+	if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
 		install -D -m 644 ${WORKDIR}/screen.pam ${D}/${sysconfdir}/pam.d/screen
 	fi
 }
diff --git a/import-layers/yocto-poky/meta/recipes-extended/sed/sed-4.1.2/Makevars b/import-layers/yocto-poky/meta/recipes-extended/sed/sed-4.1.2/Makevars
deleted file mode 100644
index 8b09f53..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/sed/sed-4.1.2/Makevars
+++ /dev/null
@@ -1,25 +0,0 @@
-# Makefile variables for PO directory in any package using GNU gettext.
-
-# Usually the message domain is the same as the package name.
-DOMAIN = $(PACKAGE)
-
-# These two variables depend on the location of this directory.
-subdir = po
-top_builddir = ..
-
-# These options get passed to xgettext.
-XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
-
-# This is the copyright holder that gets inserted into the header of the
-# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
-# package.  (Note that the msgstr strings, extracted from the package's
-# sources, belong to the copyright holder of the package.)  Translators are
-# expected to transfer the copyright for their translations to this person
-# or entity, or to disclaim their copyright.  The empty string stands for
-# the public domain; in this case the translators are expected to disclaim
-# their copyright.
-COPYRIGHT_HOLDER = Free Software Foundation, Inc.
-
-# This is the list of locale categories, beyond LC_MESSAGES, for which the
-# message catalogs shall be used.  It is usually empty.
-EXTRA_LOCALE_CATEGORIES =
diff --git a/import-layers/yocto-poky/meta/recipes-extended/sed/sed-4.1.2/fix_return_type.patch b/import-layers/yocto-poky/meta/recipes-extended/sed/sed-4.1.2/fix_return_type.patch
deleted file mode 100644
index 836551e..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/sed/sed-4.1.2/fix_return_type.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Upstream-Status: Pending
-
-Change the getline return type to match its declaration.
-
-Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
-
-diff -urN sed-4.1.2-orig/lib/getline.c sed-4.1.2/lib/getline.c
---- sed-4.1.2-orig/lib/getline.c	2010-08-31 08:47:50.070094024 +0800
-+++ sed-4.1.2/lib/getline.c	2010-08-31 08:48:50.982178172 +0800
-@@ -30,7 +30,7 @@
-    necessary.  Returns the number of characters read (not including the
-    null terminator), or -1 on error or EOF.  */
- 
--size_t
-+ssize_t
- getline (lineptr, n, stream)
-      char **lineptr;
-      size_t *n;
diff --git a/import-layers/yocto-poky/meta/recipes-extended/sed/sed-4.1.2/sed-4.1.2_fix_for_automake-1.12.patch b/import-layers/yocto-poky/meta/recipes-extended/sed/sed-4.1.2/sed-4.1.2_fix_for_automake-1.12.patch
deleted file mode 100644
index c7c0aa0..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/sed/sed-4.1.2/sed-4.1.2_fix_for_automake-1.12.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-Upstream-Status: Pending
-
-automake-1.12.x has deprecated use of @mkdir_p@, fix the issue by using @MKDIR_P@ instead.
-
-Avoid this build issue:
-| make[1]: mkdir_p@: Command not found
-| make[1]: *** [install-data-yes] Error 127
-
-Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
-2012/07/13
-
-Index: sed-4.1.2/intl/Makefile.in
-===================================================================
---- sed-4.1.2.orig/intl/Makefile.in
-+++ sed-4.1.2/intl/Makefile.in
-@@ -40,7 +40,7 @@ subdir = intl
- INSTALL = @INSTALL@
- INSTALL_DATA = @INSTALL_DATA@
- mkinstalldirs = $(mkdir_p)
--mkdir_p = @mkdir_p@
-+mkdir_p = @MKDIR_P@
- 
- l = @INTL_LIBTOOL_SUFFIX_PREFIX@
- 
-Index: sed-4.1.2/po/Makefile.in.in
-===================================================================
---- sed-4.1.2.orig/po/Makefile.in.in
-+++ sed-4.1.2/po/Makefile.in.in
-@@ -29,7 +29,7 @@ gettextsrcdir = $(datadir)/gettext/po
- INSTALL = /srv/home/nitin/builds2/build0/tmp/sysroots/x86_64-linux/usr/bin/install -c
- INSTALL_DATA = ${INSTALL} -m 644
- mkinstalldirs = $(mkdir_p)
--mkdir_p = @mkdir_p@
-+mkdir_p = @MKDIR_P@
- 
- CC = i586-poky-linux-gcc  -m32   -march=i586 --sysroot=/srv/home/nitin/builds2/build0/tmp/sysroots/qemux86
- GMSGFMT = /srv/home/nitin/builds2/build0/tmp/sysroots/x86_64-linux/usr/bin/msgfmt
diff --git a/import-layers/yocto-poky/meta/recipes-extended/sed/sed_4.1.2.bb b/import-layers/yocto-poky/meta/recipes-extended/sed/sed_4.1.2.bb
deleted file mode 100644
index 40e3a53..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/sed/sed_4.1.2.bb
+++ /dev/null
@@ -1,35 +0,0 @@
-SUMMARY = "Stream EDitor (text filtering utility)"
-HOMEPAGE = "http://www.gnu.org/software/sed/"
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
-                    file://sed/sed.h;beginline=1;endline=17;md5=e00ffd1837f298439a214fd197f6a407"
-SECTION = "console/utils"
-PR = "r7"
-
-SRC_URI = "${GNU_MIRROR}/sed/sed-${PV}.tar.gz \
-           file://fix_return_type.patch \
-           file://sed-4.1.2_fix_for_automake-1.12.patch \
-           file://Makevars"
-
-SRC_URI[md5sum] = "928f0e06422f414091917401f1a834d0"
-SRC_URI[sha256sum] = "638e837ba765d5da0a30c98b57c2953cecea96827882f594612acace93ceeeab"
-
-inherit autotools texinfo update-alternatives gettext
-
-do_configure_prepend () {
-	cp ${WORKDIR}/Makevars ${S}/po/
-}
-
-do_install () {
-	autotools_do_install
-	install -d ${D}${base_bindir}
-	if [ ! ${D}${bindir} -ef ${D}${base_bindir} ]; then
-	    mv ${D}${bindir}/sed ${D}${base_bindir}/sed
-	    rmdir ${D}${bindir}/
-	fi
-}
-
-ALTERNATIVE_${PN} = "sed"
-ALTERNATIVE_LINK_NAME[sed] = "${base_bindir}/sed"
-ALTERNATIVE_PRIORITY = "100"
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/shadow/files/0001-useradd-copy-extended-attributes-of-home.patch b/import-layers/yocto-poky/meta/recipes-extended/shadow/files/0001-useradd-copy-extended-attributes-of-home.patch
new file mode 100644
index 0000000..60a46e1
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/shadow/files/0001-useradd-copy-extended-attributes-of-home.patch
@@ -0,0 +1,47 @@
+From acec93540eba6899661c607408498ac72ab07a47 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
+Date: Tue, 7 Mar 2017 16:03:03 +0100
+Subject: [PATCH] useradd: copy extended attributes of home
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The Home directory wasn't getting the extended attributes
+of /etc/skel. This patch fixes that issue and adds the copy
+of the extended attributes of the root of the home directory.
+
+Upstream-Status: Submitted [http://lists.alioth.debian.org/pipermail/pkg-shadow-commits/2017-March/003804.html]
+
+Change-Id: Icd633f7c6c494efd2a30cb8f04c306f749ad0c3b
+Signed-off-by: José Bollo <jose.bollo@iot.bzh>
+---
+ src/useradd.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/useradd.c b/src/useradd.c
+index a8a1f76..8aefb9c 100644
+--- a/src/useradd.c
++++ b/src/useradd.c
+@@ -52,6 +52,9 @@
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <time.h>
++#ifdef WITH_ATTR
++#include <attr/libattr.h>
++#endif
+ #include "chkname.h"
+ #include "defines.h"
+ #include "faillog.h"
+@@ -1915,6 +1918,9 @@ static void create_home (void)
+ 		chown (user_home, user_id, user_gid);
+ 		chmod (user_home,
+ 		       0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK));
++#ifdef WITH_ATTR
++		attr_copy_file (def_template, user_home, NULL, NULL);
++#endif
+ 		home_added = true;
+ #ifdef WITH_AUDIT
+ 		audit_logger (AUDIT_ADD_USER, Prog,
+-- 
+2.9.3
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/shadow/files/0001-useradd.c-create-parent-directories-when-necessary.patch b/import-layers/yocto-poky/meta/recipes-extended/shadow/files/0001-useradd.c-create-parent-directories-when-necessary.patch
index 85dde8e..2f084b4 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/shadow/files/0001-useradd.c-create-parent-directories-when-necessary.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/shadow/files/0001-useradd.c-create-parent-directories-when-necessary.patch
@@ -11,7 +11,7 @@
 index 4bd969d..cb5dd6c 100644
 --- a/src/useradd.c
 +++ b/src/useradd.c
-@@ -1893,6 +1893,35 @@ static void usr_update (void)
+@@ -1896,6 +1896,35 @@ static void usr_update (void)
  }
  
  /*
@@ -47,7 +47,7 @@
   * create_home - create the user's home directory
   *
   *	create_home() creates the user's home directory if it does not
-@@ -1907,36 +1936,33 @@ static void create_home (void)
+@@ -1910,39 +1939,36 @@ static void create_home (void)
  			fail_exit (E_HOMEDIR);
  		}
  #endif
@@ -67,6 +67,9 @@
 -		chown (user_home, user_id, user_gid);
 -		chmod (user_home,
 -		       0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK));
+-#ifdef WITH_ATTR
+-		attr_copy_file (def_template, user_home, NULL, NULL);
+-#endif
 -		home_added = true;
 +		mkdir_p(user_home);
 +	}
@@ -88,6 +91,9 @@
 +	chown (user_home, user_id, user_gid);
 +	chmod (user_home,
 +	       0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK));
++#ifdef WITH_ATTR
++	attr_copy_file (def_template, user_home, NULL, NULL);
++#endif
 +	home_added = true;
 +#ifdef WITH_AUDIT
 +	audit_logger (AUDIT_ADD_USER, Prog,
diff --git a/import-layers/yocto-poky/meta/recipes-extended/shadow/files/allow-for-setting-password-in-clear-text.patch b/import-layers/yocto-poky/meta/recipes-extended/shadow/files/allow-for-setting-password-in-clear-text.patch
index 68da25f..615c6e0 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/shadow/files/allow-for-setting-password-in-clear-text.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/shadow/files/allow-for-setting-password-in-clear-text.patch
@@ -118,7 +118,7 @@
 index b3bd451..4416f90 100644
 --- a/src/useradd.c
 +++ b/src/useradd.c
-@@ -773,6 +773,7 @@ static void usage (int status)
+@@ -776,6 +776,7 @@ static void usage (int status)
  	(void) fputs (_("  -o, --non-unique              allow to create users with duplicate\n"
  	                "                                (non-unique) UID\n"), usageout);
  	(void) fputs (_("  -p, --password PASSWORD       encrypted password of the new account\n"), usageout);
@@ -126,7 +126,7 @@
  	(void) fputs (_("  -r, --system                  create a system account\n"), usageout);
  	(void) fputs (_("  -R, --root CHROOT_DIR         directory to chroot into\n"), usageout);
  	(void) fputs (_("  -s, --shell SHELL             login shell of the new account\n"), usageout);
-@@ -1047,6 +1048,7 @@ static void process_flags (int argc, char **argv)
+@@ -1050,6 +1051,7 @@ static void process_flags (int argc, char **argv)
  			{"no-user-group",  no_argument,       NULL, 'N'},
  			{"non-unique",     no_argument,       NULL, 'o'},
  			{"password",       required_argument, NULL, 'p'},
@@ -134,7 +134,7 @@
  			{"system",         no_argument,       NULL, 'r'},
  			{"root",           required_argument, NULL, 'R'},
  			{"shell",          required_argument, NULL, 's'},
-@@ -1059,9 +1061,9 @@ static void process_flags (int argc, char **argv)
+@@ -1062,9 +1064,9 @@ static void process_flags (int argc, char **argv)
  		};
  		while ((c = getopt_long (argc, argv,
  #ifdef WITH_SELINUX
@@ -146,7 +146,7 @@
  #endif				/* !WITH_SELINUX */
  		                         long_options, NULL)) != -1) {
  			switch (c) {
-@@ -1227,6 +1229,9 @@ static void process_flags (int argc, char **argv)
+@@ -1230,6 +1232,9 @@ static void process_flags (int argc, char **argv)
  				}
  				user_pass = optarg;
  				break;
diff --git a/import-layers/yocto-poky/meta/recipes-extended/shadow/shadow.inc b/import-layers/yocto-poky/meta/recipes-extended/shadow/shadow.inc
index f79565b..70ff68e 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/shadow/shadow.inc
+++ b/import-layers/yocto-poky/meta/recipes-extended/shadow/shadow.inc
@@ -6,7 +6,6 @@
 LIC_FILES_CHKSUM = "file://COPYING;md5=ed80ff1c2b40843cf5768e5229cf16e5 \
                     file://src/passwd.c;beginline=8;endline=30;md5=d83888ea14ae61951982d77125947661"
 
-DEPENDS = "shadow-native"
 DEPENDS_class-native = ""
 DEPENDS_class-nativesdk = ""
 
@@ -16,6 +15,7 @@
            file://fix-installation-failure-with-subids-disabled.patch \
            file://0001-Do-not-read-login.defs-before-doing-chroot.patch \
            file://check_size_of_uid_t_and_gid_t_using_AC_CHECK_SIZEOF.patch \
+           file://0001-useradd-copy-extended-attributes-of-home.patch \
            ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
            "
 
@@ -75,8 +75,9 @@
                pam-plugin-shells \
                pam-plugin-rootok"
 
-PACKAGECONFIG = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
-PACKAGECONFIG_class-native = ""
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
+                   ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
+PACKAGECONFIG_class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
 PACKAGECONFIG_class-nativesdk = ""
 PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}"
 PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr"
@@ -171,10 +172,11 @@
 
 ALTERNATIVE_PRIORITY = "200"
 
-ALTERNATIVE_${PN} = "passwd chfn chsh chpasswd vipw vigr"
+ALTERNATIVE_${PN} = "passwd chfn chsh chpasswd vipw vigr nologin"
 ALTERNATIVE_LINK_NAME[chpasswd] = "${sbindir}/chpasswd"
 ALTERNATIVE_LINK_NAME[vipw] = "${base_sbindir}/vipw"
 ALTERNATIVE_LINK_NAME[vigr] = "${base_sbindir}/vigr"
+ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin"
 
 ALTERNATIVE_${PN}-base = "newgrp groups login su"
 ALTERNATIVE_LINK_NAME[login] = "${base_bindir}/login"
@@ -187,6 +189,7 @@
 ALTERNATIVE_LINK_NAME[su.1] = "${mandir}/man1/su.1"
 ALTERNATIVE_LINK_NAME[nologin.8] = "${mandir}/man8/nologin.8"
 
+PACKAGE_WRITE_DEPS += "shadow-native"
 pkg_postinst_${PN} () {
 	if [ "x$D" != "x" ]; then
 	  rootarg="--root $D"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/slang/slang/0001-Fix-error-conflicting-types-for-posix_close.patch b/import-layers/yocto-poky/meta/recipes-extended/slang/slang/0001-Fix-error-conflicting-types-for-posix_close.patch
deleted file mode 100644
index 57ebfe4..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/slang/slang/0001-Fix-error-conflicting-types-for-posix_close.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 96eb7e29822151823a66a1eb59f1fa4aead5ae08 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Mon, 31 Aug 2015 06:33:21 +0000
-Subject: [PATCH] Fix  error: conflicting types for 'posix_close'
-
-Exposed while compiling on musl
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Pending
-
- src/slposio.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/slposio.c b/src/slposio.c
-index 9ce9697..9ff9bfe 100644
---- a/src/slposio.c
-+++ b/src/slposio.c
-@@ -363,7 +363,7 @@ static int posix_close_fd (int *fd)
-    return 0;
- }
- 
--static int posix_close (SLFile_FD_Type *f)
-+static int posix_closex (SLFile_FD_Type *f)
- {
-    int status = do_close (f);
- 
-@@ -1001,7 +1001,7 @@ static SLang_Intrin_Fun_Type Fd_Name_Table [] =
-    MAKE_INTRINSIC_2("write", posix_write, V, F, B),
-    MAKE_INTRINSIC_1("dup_fd", posix_dup, V, F),
-    MAKE_INTRINSIC_2("dup2_fd", posix_dup2, I, F, I),
--   MAKE_INTRINSIC_1("close", posix_close, I, F),
-+   MAKE_INTRINSIC_1("close", posix_closex, I, F),
-    MAKE_INTRINSIC_1("_close", posix_close_fd, I, I),
- #if defined(TTYNAME_R)
-    MAKE_INTRINSIC_0("ttyname", posix_ttyname, V),
--- 
-2.5.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/slang/slang/dont-link-to-host.patch b/import-layers/yocto-poky/meta/recipes-extended/slang/slang/dont-link-to-host.patch
new file mode 100644
index 0000000..42dba0f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/slang/slang/dont-link-to-host.patch
@@ -0,0 +1,16 @@
+SLANG_INST_LIB is the location of where slang will end up, but when building for
+packaging this doesn't have DESTDIR appended so can potentially link to the host
+for cross builds and will trigger QA errors.
+
+As this is obviously wrong, delete it.
+
+Upstream-Status: Pending
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/slsh/Makefile.in b/slsh/Makefile.in
+index cba9d81..4c1c370 100644
+--- a/slsh/Makefile.in
++++ b/slsh/Makefile.in
+@@ -80 +80 @@ SHELL = /bin/sh
+-INST_LIBS = $(DEST_LIB_DIR) $(RPATH) $(SLANG_INST_LIB) -lslang $(READLINE_LIB) $(DYNAMIC_LIBS)
++INST_LIBS = $(DEST_LIB_DIR) $(RPATH) -lslang $(READLINE_LIB) $(DYNAMIC_LIBS)
diff --git a/import-layers/yocto-poky/meta/recipes-extended/slang/slang/fix-check-pcre.patch b/import-layers/yocto-poky/meta/recipes-extended/slang/slang/fix-check-pcre.patch
deleted file mode 100644
index a0ec0ff..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/slang/slang/fix-check-pcre.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-fix the pcre existence checking
-
-when check if there is pcre, the configure file always check
-the host dir. now we make it work by adding correct prefix for
-cross-compile environment.
-
-When enable pcre-module, we see a QA warning because rpaths
-hardcoded into the build, rpaths are not needed, so lets turn
-this off.
-
-Upstream-Status: Inappropriate
-Signed-off-by: Roy.Li <rongqing.li@windriver.com>
----
- configure |   72 +++++---------------------------------------------------------
- 1 file changed, 6 insertions(+), 66 deletions(-)
-
-diff --git a/configure b/configure
---- a/configure
-+++ b/configure
-@@ -7191,6 +7191,7 @@ $as_echo_n "checking for the pcre library and header files ... " >&6; }
- 	 /usr/include/pcre,/usr/lib \
- 	 /usr/pcre/include,/usr/pcre/lib \
- 	 /usr/include,/usr/lib \
-+	 /usr/include,/usr/lib64 \
- 	 /opt/include/pcre,/opt/lib \
- 	 /opt/pcre/include,/opt/pcre/lib \
- 	 /opt/include,/opt/lib"
-@@ -7221,14 +7222,14 @@ $as_echo_n "checking for the pcre library and header files ... " >&6; }
-         xincdir=`echo $include_and_lib | tr ',' ' ' | awk '{print $1}'`
- 	xlibdir=`echo $include_and_lib | tr ',' ' ' | awk '{print $2}'`
- 	found=0
--	if test -r $xincdir/$xincfile
-+	if test -r $PKG_CONFIG_SYSROOT_DIR/$xincdir/$xincfile
- 	then
- 	  for E in $exts
- 	  do
--	    if test -r "$xlibdir/$xlibfile.$E"
-+	    if test -r "$PKG_CONFIG_SYSROOT_DIR/$xlibdir/$xlibfile.$E"
- 	    then
--	      jd_pcre_include_dir="$xincdir"
--	      jd_pcre_library_dir="$xlibdir"
-+	      jd_pcre_include_dir="$PKG_CONFIG_SYSROOT_DIR/$xincdir"
-+	      jd_pcre_library_dir="$PKG_CONFIG_SYSROOT_DIR/$xlibdir"
- 	      jd_with_pcre_library="yes"
- 	      found=1
- 	      break
-@@ -7255,68 +7255,7 @@ $as_echo "yes: $jd_pcre_library_dir and $jd_pcre_include_dir" >&6; }
-     then
-       PCRE_LIB=""
-     else
--
--if test "X$jd_pcre_library_dir" != "X"
--then
--  if test "X$RPATH" = "X"
--  then
--
--case "$host_os" in
--  *linux*|*solaris* )
--    if test "X$GCC" = Xyes
--    then
--      if test "X$ac_R_nospace" = "Xno"
--      then
--        RPATH="-Wl,-R,"
--      else
--        RPATH="-Wl,-R"
--      fi
--    else
--      if test "X$ac_R_nospace" = "Xno"
--      then
--        RPATH="-R "
--      else
--	RPATH="-R"
--      fi
--    fi
--  ;;
--  *osf*|*openbsd*|*freebsd*)
--    if test "X$GCC" = Xyes
--    then
--      RPATH="-Wl,-rpath,"
--    else
--      RPATH="-rpath "
--    fi
--  ;;
--  *netbsd*)
--    if test "X$GCC" = Xyes
--    then
--      RPATH="-Wl,-R"
--    fi
--  ;;
--esac
--
--    if test "X$RPATH" != "X"
--    then
--      RPATH="$RPATH$jd_pcre_library_dir"
--    fi
--  else
--    _already_there=0
--    for X in `echo $RPATH | sed 's/:/ /g'`
--    do
--      if test "$X" = "$jd_pcre_library_dir"
--      then
--        _already_there=1
--	break
--      fi
--    done
--    if test $_already_there = 0
--    then
--      RPATH="$RPATH:$jd_pcre_library_dir"
--    fi
--  fi
--fi
--
-+      RPATH=""
-     fi
- 
-     PCRE_INC=-I$jd_pcre_include_dir
diff --git a/import-layers/yocto-poky/meta/recipes-extended/slang/slang/no-x.patch b/import-layers/yocto-poky/meta/recipes-extended/slang/slang/no-x.patch
index d7666bf..7dc1602 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/slang/slang/no-x.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/slang/slang/no-x.patch
@@ -12,3 +12,7 @@
 -# For the socket module
 -AC_PATH_XTRA
 -
+--- a/modules/Makefile.in
++++ b/modules/Makefile.in
+@@ -67 +66,0 @@ ZLIB_LIB        = @Z_LIB@ -lz
+-SOCKET_LIBS = @X_EXTRA_LIBS@
diff --git a/import-layers/yocto-poky/meta/recipes-extended/slang/slang/rpathfix.patch b/import-layers/yocto-poky/meta/recipes-extended/slang/slang/rpathfix.patch
deleted file mode 100644
index f82a531..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/slang/slang/rpathfix.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-Without this patch we see rpaths hardcoded into the build which results in QA
-warnings. These rpaths are not needed so lets turn this off.
-
-Upstream-Status: Inappropriate
-(but could be turned into a proper configure option)
-
-RP 2012/03/14
-
-Index: slang-2.2.4/configure
-===================================================================
---- slang-2.2.4.orig/configure	2012-03-14 23:40:01.283560679 +0000
-+++ slang-2.2.4/configure	2012-03-14 23:41:18.023558900 +0000
-@@ -6246,68 +6246,7 @@ esac
- ELF_CFLAGS="$ELF_CFLAGS $IEEE_CFLAGS"
- CFLAGS="$CFLAGS $IEEE_CFLAGS"
- 
--
--if test "X$libdir" != "X"
--then
--  if test "X$RPATH" = "X"
--  then
--
--case "$host_os" in
--  *linux*|*solaris* )
--    if test "X$GCC" = Xyes
--    then
--      if test "X$ac_R_nospace" = "Xno"
--      then
--        RPATH="-Wl,-R,"
--      else
--        RPATH="-Wl,-R"
--      fi
--    else
--      if test "X$ac_R_nospace" = "Xno"
--      then
--        RPATH="-R "
--      else
--	RPATH="-R"
--      fi
--    fi
--  ;;
--  *osf*|*openbsd*|*freebsd*)
--    if test "X$GCC" = Xyes
--    then
--      RPATH="-Wl,-rpath,"
--    else
--      RPATH="-rpath "
--    fi
--  ;;
--  *netbsd*)
--    if test "X$GCC" = Xyes
--    then
--      RPATH="-Wl,-R"
--    fi
--  ;;
--esac
--
--    if test "X$RPATH" != "X"
--    then
--      RPATH="$RPATH$libdir"
--    fi
--  else
--    _already_there=0
--    for X in `echo $RPATH | sed 's/:/ /g'`
--    do
--      if test "$X" = "$libdir"
--      then
--        _already_there=1
--	break
--      fi
--    done
--    if test $_already_there = 0
--    then
--      RPATH="$RPATH:$libdir"
--    fi
--  fi
--fi
--
-+RPATH=""
- 
- # The cast to long int works around a bug in the HP C Compiler
- # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
diff --git a/import-layers/yocto-poky/meta/recipes-extended/slang/slang/slang-fix-the-iconv-existence-checking.patch b/import-layers/yocto-poky/meta/recipes-extended/slang/slang/slang-fix-the-iconv-existence-checking.patch
deleted file mode 100644
index 850551e..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/slang/slang/slang-fix-the-iconv-existence-checking.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-From 4588f4a0287787788eb86fb16f326cbaa7454e1d Mon Sep 17 00:00:00 2001
-From: Zheng Junling <zhengjunling@huawei.com>
-Date: Mon, 16 Jun 2014 12:51:25 +0000
-Subject: [PATCH] slang: fix the iconv existence checking
-
-When checking whether there is iconv, the configure file always check 
-the host env.
-
-Now we make it working properly by adding correct prefix for cross-
-compiling environment.
-
-When enabling iconv-module, we see a QA warning because rpaths hardcoded
-into the build. And rpaths are not needed, so let's turn this off.
-
-This patch is generated by referencing the existing "fix-check-pcre"
-patch.
-
-Upstream-Status: Inappropriate
-
-Signed-off-by: Zheng Junling <zhengjunling@huawei.com>
----
- configure |   72 +++++---------------------------------------------------------
- 1 file changed, 6 insertions(+), 66 deletions(-)
-
-diff --git a/configure b/configure
-index fa395ff..7fa769c 100755
---- a/configure
-+++ b/configure
-@@ -8259,6 +8259,7 @@ $as_echo_n "checking for the iconv library and header files ... " >&6; }
- 	 /usr/include/iconv,/usr/lib \
- 	 /usr/iconv/include,/usr/iconv/lib \
- 	 /usr/include,/usr/lib \
-+	 /usr/include,/usr/lib64 \
- 	 /opt/include/iconv,/opt/lib \
- 	 /opt/iconv/include,/opt/iconv/lib \
- 	 /opt/include,/opt/lib"
-@@ -8289,14 +8290,14 @@ $as_echo_n "checking for the iconv library and header files ... " >&6; }
-         xincdir=`echo $include_and_lib | tr ',' ' ' | awk '{print $1}'`
- 	xlibdir=`echo $include_and_lib | tr ',' ' ' | awk '{print $2}'`
- 	found=0
--	if test -r $xincdir/$xincfile
-+	if test -r $PKG_CONFIG_SYSROOT_DIR/$xincdir/$xincfile
- 	then
- 	  for E in $exts
- 	  do
--	    if test -r "$xlibdir/$xlibfile.$E"
-+	    if test -r "$PKG_CONFIG_SYSROOT_DIR/$xlibdir/$xlibfile.$E"
- 	    then
--	      jd_iconv_include_dir="$xincdir"
--	      jd_iconv_library_dir="$xlibdir"
-+	      jd_iconv_include_dir="$PKG_CONFIG_SYSROOT_DIR/$xincdir"
-+	      jd_iconv_library_dir="$PKG_CONFIG_SYSROOT_DIR/$xlibdir"
- 	      jd_with_iconv_library="yes"
- 	      found=1
- 	      break
-@@ -8201,68 +8201,7 @@ $as_echo "yes: $jd_iconv_library_dir and $jd_iconv_include_dir" >&6; }
-     then
-       ICONV_LIB=""
-     else
--
--if test "X$jd_iconv_library_dir" != "X"
--then
--  if test "X$RPATH" = "X"
--  then
--
--case "$host_os" in
--  *linux*|*solaris* )
--    if test "X$GCC" = Xyes
--    then
--      if test "X$ac_R_nospace" = "Xno"
--      then
--        RPATH="-Wl,-R,"
--      else
--        RPATH="-Wl,-R"
--      fi
--    else
--      if test "X$ac_R_nospace" = "Xno"
--      then
--        RPATH="-R "
--      else
--	RPATH="-R"
--      fi
--    fi
--  ;;
--  *osf*|*openbsd*|*freebsd*)
--    if test "X$GCC" = Xyes
--    then
--      RPATH="-Wl,-rpath,"
--    else
--      RPATH="-rpath "
--    fi
--  ;;
--  *netbsd*)
--    if test "X$GCC" = Xyes
--    then
--      RPATH="-Wl,-R"
--    fi
--  ;;
--esac
--
--    if test "X$RPATH" != "X"
--    then
--      RPATH="$RPATH$jd_iconv_library_dir"
--    fi
--  else
--    _already_there=0
--    for X in `echo $RPATH | sed 's/:/ /g'`
--    do
--      if test "$X" = "$jd_iconv_library_dir"
--      then
--        _already_there=1
--	break
--      fi
--    done
--    if test $_already_there = 0
--    then
--      RPATH="$RPATH:$jd_iconv_library_dir"
--    fi
--  fi
--fi
--
-+      RPATH=""
-     fi
- 
-     ICONV_INC=-I$jd_iconv_include_dir
diff --git a/import-layers/yocto-poky/meta/recipes-extended/slang/slang_2.3.0.bb b/import-layers/yocto-poky/meta/recipes-extended/slang/slang_2.3.1a.bb
similarity index 66%
rename from import-layers/yocto-poky/meta/recipes-extended/slang/slang_2.3.0.bb
rename to import-layers/yocto-poky/meta/recipes-extended/slang/slang_2.3.1a.bb
index d5967d2..c71d804 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/slang/slang_2.3.0.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/slang/slang_2.3.1a.bb
@@ -14,16 +14,13 @@
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=a52a18a472d4f7e45479b06563717c02"
 
-
 SRC_URI = "http://www.jedsoft.org/releases/${BPN}/${BP}.tar.bz2 \
-           file://rpathfix.patch \
-           file://fix-check-pcre.patch \
-           file://slang-fix-the-iconv-existence-checking.patch \
-           file://0001-Fix-error-conflicting-types-for-posix_close.patch \
            file://no-x.patch \
+           file://dont-link-to-host.patch \
           "
-SRC_URI[md5sum] = "3bcc790460d52db1316c20395b7ac2f1"
-SRC_URI[sha256sum] = "f95224060f45e0d8212a5039b339afa5f1a94a1bb0298e796104e5b12e926129"
+
+SRC_URI[md5sum] = "c5235313042ed0e71ec708f7b85ec241"
+SRC_URI[sha256sum] = "54f0c3007fde918039c058965dffdfd6c5aec0bad0f4227192cc486021f08c36"
 
 UPSTREAM_CHECK_URI = "http://www.jedsoft.org/releases/slang/"
 PREMIRRORS_append = "\n http://www.jedsoft.org/releases/slang/.* http://www.jedsoft.org/releases/slang/old/ \n"
@@ -32,24 +29,26 @@
 CLEANBROKEN = "1"
 
 EXTRA_OECONF = "--without-onig"
+# There's no way to turn off rpaths and slang will -rpath to the default search
+# path. Unset RPATH to stop this.
+EXTRA_OEMAKE = "RPATH=''"
 
 PACKAGECONFIG ??= "pcre"
-PACKAGECONFIG[pcre] = "--with-pcre,--without-pcre,pcre"
-PACKAGECONFIG[png] = "--with-png,--without-png,libpng"
-PACKAGECONFIG[zlib] = "--with-z,--without-z,zlib"
+PACKAGECONFIG[pcre] = "--with-pcre=${STAGING_DIR_HOST}${prefix},--without-pcre,pcre"
+PACKAGECONFIG[png] = "--with-png=${STAGING_DIR_HOST}${prefix},--without-png,libpng"
+PACKAGECONFIG[zlib] = "--with-z=${STAGING_DIR_HOST}${prefix},--without-z,zlib"
 
 do_configure_prepend() {
+    cd ${S}/autoconf
     # slang keeps configure.ac and rest of autoconf files in autoconf/ directory
     # we have to go there to be able to run gnu-configize cause it expects configure.{in,ac}
     # to be present. Resulting files land in autoconf/autoconf/ so we need to move them.
-    cd ${S}/autoconf && gnu-configize --force && mv autoconf/config.* .
+    gnu-configize --force && mv autoconf/config.* .
+    # For the same reason we also need to run autoconf manually.
+    autoconf && mv configure ..
     cd ${B}
 }
 
-do_install() {
-	oe_runmake install DESTDIR=${D} -e 'INST_LIB_DIR=${STAGING_DIR_HOST}/usr/lib'
-}
-
 FILES_${PN} += "${libdir}/${BPN}/v2/modules/ ${datadir}/slsh/"
 
 PARALLEL_MAKE = ""
diff --git a/import-layers/yocto-poky/meta/recipes-extended/sudo/sudo.inc b/import-layers/yocto-poky/meta/recipes-extended/sudo/sudo.inc
index a25876b..d42a04a 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/sudo/sudo.inc
+++ b/import-layers/yocto-poky/meta/recipes-extended/sudo/sudo.inc
@@ -4,7 +4,7 @@
 BUGTRACKER = "http://www.sudo.ws/bugs/"
 SECTION = "admin"
 LICENSE = "ISC & BSD & Zlib"
-LIC_FILES_CHKSUM = "file://doc/LICENSE;md5=c16e542408abda013d672be8eb88d174 \
+LIC_FILES_CHKSUM = "file://doc/LICENSE;md5=f600a47c2a2cdde5899e449607810ed1 \
                     file://plugins/sudoers/redblack.c;beginline=1;endline=41;md5=cfe41112f96c19a074934d128f45c693 \
                     file://lib/util/reallocarray.c;beginline=3;endline=16;md5=85b0905b795d4d58bf2e00635649eec6 \
                     file://lib/util/fnmatch.c;beginline=3;endline=27;md5=67f83ee9bd456557397082f8f1be0efd \
diff --git a/import-layers/yocto-poky/meta/recipes-extended/sudo/sudo_1.8.17p1.bb b/import-layers/yocto-poky/meta/recipes-extended/sudo/sudo_1.8.19p2.bb
similarity index 84%
rename from import-layers/yocto-poky/meta/recipes-extended/sudo/sudo_1.8.17p1.bb
rename to import-layers/yocto-poky/meta/recipes-extended/sudo/sudo_1.8.19p2.bb
index 614ad5c..a9659c3 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/sudo/sudo_1.8.17p1.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/sudo/sudo_1.8.19p2.bb
@@ -7,8 +7,8 @@
 
 PAM_SRC_URI = "file://sudo.pam"
 
-SRC_URI[md5sum] = "50a840a688ceb6fa3ab24fc0adf4fa23"
-SRC_URI[sha256sum] = "c690d707fb561b3ecdf6a6de5563bc0b769388eff201c851edbace408bb155cc"
+SRC_URI[md5sum] = "31a6090ed1d0946fa22cba19e86aafef"
+SRC_URI[sha256sum] = "237e18e67c2ad59ecacfa4b7707198b09fcf84914621585a9bc670dcc31a52e0"
 
 DEPENDS += " ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
 RDEPENDS_${PN} += " ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-limits pam-plugin-keyinit', '', d)}"
@@ -20,7 +20,7 @@
              "
 
 do_install_append () {
-	if [ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" = "pam" ]; then
+	if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
 		install -D -m 644 ${WORKDIR}/sudo.pam ${D}/${sysconfdir}/pam.d/sudo
 	fi
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/sysklogd/files/klogd.service b/import-layers/yocto-poky/meta/recipes-extended/sysklogd/files/klogd.service
new file mode 100644
index 0000000..0c888c4
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/sysklogd/files/klogd.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Kernel Logging Service
+After=syslogd.service
+
+[Service]
+Type=forking
+ExecStart=/sbin/klogd
+PIDFile=/var/run/klogd.pid
+StandardOutput=null
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/import-layers/yocto-poky/meta/recipes-extended/sysklogd/files/syslogd.service b/import-layers/yocto-poky/meta/recipes-extended/sysklogd/files/syslogd.service
new file mode 100644
index 0000000..eeaff3d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/sysklogd/files/syslogd.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=System Logging Service
+Requires=syslog.socket
+
+[Service]
+Type=forking
+ExecStart=/sbin/syslogd
+PIDFile=/var/run/syslogd.pid
+StandardOutput=null
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
+Alias=syslog.service
diff --git a/import-layers/yocto-poky/meta/recipes-extended/sysklogd/files/tmpfiles.sysklogd.conf b/import-layers/yocto-poky/meta/recipes-extended/sysklogd/files/tmpfiles.sysklogd.conf
new file mode 100644
index 0000000..f4aecd3
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/sysklogd/files/tmpfiles.sysklogd.conf
@@ -0,0 +1 @@
+p /dev/xconsole 0640 root adm
diff --git a/import-layers/yocto-poky/meta/recipes-extended/sysklogd/sysklogd.inc b/import-layers/yocto-poky/meta/recipes-extended/sysklogd/sysklogd.inc
index 5c15ffe..78b8d7a 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/sysklogd/sysklogd.inc
+++ b/import-layers/yocto-poky/meta/recipes-extended/sysklogd/sysklogd.inc
@@ -11,17 +11,24 @@
                     file://klogd.c;beginline=2;endline=19;md5=7e87ed0ae6142de079bce738c10c899d \
                    "
 
-inherit update-rc.d update-alternatives
+inherit update-rc.d update-alternatives systemd
 
 SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \
            file://no-strip-install.patch \
            file://0001-Fix-build-with-musl.patch \
            file://sysklogd \
            file://syslog.conf \
+           file://syslogd.service \
+           file://klogd.service \
+           file://tmpfiles.sysklogd.conf \
            "
 
 SRC_URI_append_e500v2 = " file://no-vectorization.patch"
 
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = "syslogd.service klogd.service"
+SYSTEMD_AUTO_ENABLE = "enable"
+
 INITSCRIPT_NAME = "syslog"
 CONFFILES_${PN} = "${sysconfdir}/syslog.conf.${BPN}"
 
@@ -39,13 +46,26 @@
 	install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/syslog.conf
 	install -d ${D}${sysconfdir}/init.d
 	install -m 755 ${WORKDIR}/sysklogd ${D}${sysconfdir}/init.d/syslog
+	install -d ${D}${systemd_unitdir}/system
+	install -m 644 ${WORKDIR}/syslogd.service ${D}${systemd_unitdir}/system
+	install -m 644 ${WORKDIR}/klogd.service ${D}${systemd_unitdir}/system
+	if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true', 'false', d)}; then
+		install -d ${D}${exec_prefix}/lib/tmpfiles.d
+		install -m 644 ${WORKDIR}/tmpfiles.sysklogd.conf ${D}${exec_prefix}/lib/tmpfiles.d/sysklogd.conf
+	fi
 }
 
+FILES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES','systemd','${exec_prefix}/lib/tmpfiles.d/sysklogd.conf', '', d)}"
+
 # sysklogd package has no internal systemd support, so we weigh busybox's
 # sysklogd utility over it in case of systemd
 ALTERNATIVE_PRIORITY = "${@bb.utils.contains('DISTRO_FEATURES','systemd','10','100',d)}"
 
-ALTERNATIVE_${PN} = "syslogd klogd syslog-init syslog-conf"
+ALTERNATIVE_${PN} = "syslogd klogd syslog-conf \
+    ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','syslog-init','',d)}"
+
+ALTERNATIVE_${PN}-doc = "syslogd.8"
+ALTERNATIVE_LINK_NAME[syslogd.8] = "${mandir}/man8/syslogd.8"
 
 ALTERNATIVE_LINK_NAME[syslogd] = "${base_sbindir}/syslogd"
 ALTERNATIVE_LINK_NAME[klogd] = "${base_sbindir}/klogd"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/sysstat/sysstat_11.4.0.bb b/import-layers/yocto-poky/meta/recipes-extended/sysstat/sysstat_11.4.0.bb
deleted file mode 100644
index 69f83fc..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/sysstat/sysstat_11.4.0.bb
+++ /dev/null
@@ -1,8 +0,0 @@
-require sysstat.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=a23a74b3f4caf9616230789d94217acb"
-
-SRC_URI += "file://0001-Include-needed-headers-explicitly.patch"
-
-SRC_URI[md5sum] = "ee7b8c0b139a11a7a3418dc0658ca1be"
-SRC_URI[sha256sum] = "b8518ca88acfcbc474a406022ee9c0c3210ccef4f0ec80e5b3e8c41dda8c16f2"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/sysstat/sysstat_11.5.4.bb b/import-layers/yocto-poky/meta/recipes-extended/sysstat/sysstat_11.5.4.bb
new file mode 100644
index 0000000..7ff363b2
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/sysstat/sysstat_11.5.4.bb
@@ -0,0 +1,8 @@
+require sysstat.inc
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=a23a74b3f4caf9616230789d94217acb"
+
+SRC_URI += "file://0001-Include-needed-headers-explicitly.patch"
+
+SRC_URI[md5sum] = "f16ae8edd462f5199ee033f7c0e2c197"
+SRC_URI[sha256sum] = "1e1008656575e70486b456e79775e98d3b8732d7e2cb408559209bd0318e0807"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/tar/tar-1.17/avoid_heap_overflow.patch b/import-layers/yocto-poky/meta/recipes-extended/tar/tar-1.17/avoid_heap_overflow.patch
deleted file mode 100644
index af5026f..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/tar/tar-1.17/avoid_heap_overflow.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Upstream-Status: Inappropriate [bugfix: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-0624]
-CVE: CVE-2010-0624
-
-This patch avoids heap overflow reported by :
-http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-0624
-
-This is a clean patch for the GPLv2 tar recipe.
-
-Nitin A Kamble <nitin.a.kamble@intel.com> 2011/04/25
-
-Index: tar-1.17/lib/rtapelib.c
-===================================================================
---- tar-1.17.orig/lib/rtapelib.c
-+++ tar-1.17/lib/rtapelib.c
-@@ -570,7 +570,7 @@ rmt_read__ (int handle, char *buffer, si
- 
-   sprintf (command_buffer, "R%lu\n", (unsigned long) length);
-   if (do_command (handle, command_buffer) == -1
--      || (status = get_status (handle)) == SAFE_READ_ERROR)
-+      || ((status = get_status (handle)) == SAFE_READ_ERROR) || (status > length))
-     return SAFE_READ_ERROR;
- 
-   for (counter = 0; counter < status; counter += rlen, buffer += rlen)
diff --git a/import-layers/yocto-poky/meta/recipes-extended/tar/tar-1.17/gcc43build.patch b/import-layers/yocto-poky/meta/recipes-extended/tar/tar-1.17/gcc43build.patch
deleted file mode 100644
index f8059a0..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/tar/tar-1.17/gcc43build.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-Upstream-Status: Inappropriate [licensing]
-
-# Fix errors when built with gcc 4.3
-# Patch taken from Debian bug #452096
-
-diff -urN tar-1.17.orig/lib/argp-fmtstream.h tar-1.17/lib/argp-fmtstream.h
---- tar-1.17.orig/lib/argp-fmtstream.h	2006-01-11 12:24:05.000000000 -0800
-+++ tar-1.17/lib/argp-fmtstream.h	2010-07-22 22:36:12.000000000 -0700
-@@ -198,7 +198,11 @@
- #endif
- 
- #ifndef ARGP_FS_EI
--#define ARGP_FS_EI extern inline
-+ #if defined __GNUC_STDC_INLINE__
-+   #define ARGP_FS_EI extern inline __attribute__((__gnu_inline__))
-+ #else
-+   #define ARGP_FS_EI extern inline
-+ #endif
- #endif
- 
- ARGP_FS_EI size_t
-diff -urN tar-1.17.orig/lib/argp.h tar-1.17/lib/argp.h
---- tar-1.17.orig/lib/argp.h	2007-03-30 00:09:11.000000000 -0700
-+++ tar-1.17/lib/argp.h	2010-07-22 22:38:44.000000000 -0700
-@@ -580,7 +580,11 @@
- # endif
- 
- # ifndef ARGP_EI
--#  define ARGP_EI extern __inline__
-+#  if defined __GNUC_STDC_INLINE__
-+#    define ARGP_EI extern __inline__ __attribute__((__gnu_inline__))
-+#  else
-+#    define ARGP_EI extern __inline__
-+#  endif
- # endif
- 
- ARGP_EI void
diff --git a/import-layers/yocto-poky/meta/recipes-extended/tar/tar-1.17/m4extensions.patch b/import-layers/yocto-poky/meta/recipes-extended/tar/tar-1.17/m4extensions.patch
deleted file mode 100644
index 30534c2..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/tar/tar-1.17/m4extensions.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-Upstream-Status: Inappropriate [licensing]
-
-# Define AC_USE_SYSTEM_EXTENSIONS only if it was previously undefined.
-# This is needed to configure correctly with newer versions of autoconf.
-
---- tar-1.17/m4/extensions.m4.orig	2010-07-22 22:21:35.000000000 -0700
-+++ tar-1.17/m4/extensions.m4	2010-07-22 22:23:41.000000000 -0700
-@@ -1,4 +1,4 @@
--# serial 4  -*- Autoconf -*-
-+# serial 5  -*- Autoconf -*-
- # Enable extensions on systems that normally disable them.
- 
- # Copyright (C) 2003, 2006 Free Software Foundation, Inc.
-@@ -16,6 +16,7 @@
- # ------------------------
- # Enable extensions on systems that normally disable them,
- # typically due to standards-conformance issues.
-+m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [], [
- AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
- [
-   AC_BEFORE([$0], [AC_COMPILE_IFELSE])
-@@ -48,7 +49,7 @@
-     AC_DEFINE([__EXTENSIONS__])
-   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-   AC_DEFINE([_TANDEM_SOURCE])
--])
-+])])
- 
- # gl_USE_SYSTEM_EXTENSIONS
- # ------------------------
diff --git a/import-layers/yocto-poky/meta/recipes-extended/tar/tar_1.17.bb b/import-layers/yocto-poky/meta/recipes-extended/tar/tar_1.17.bb
deleted file mode 100644
index b9ca206..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/tar/tar_1.17.bb
+++ /dev/null
@@ -1,14 +0,0 @@
-require tar.inc
-
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
-
-PR = "r3"
-
-SRC_URI += "file://m4extensions.patch \
-    file://gcc43build.patch \
-    file://avoid_heap_overflow.patch \
-    "
-
-SRC_URI[md5sum] = "c6c4f1c075dbf0f75c29737faa58f290"
-SRC_URI[sha256sum] = "19f9021dda51a16295e4706e80870e71f87107675e51c176a491eba0fc4ca492"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/texi2html/texi2html_5.0.bb b/import-layers/yocto-poky/meta/recipes-extended/texi2html/texi2html_5.0.bb
index ae64816..afd125b 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/texi2html/texi2html_5.0.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/texi2html/texi2html_5.0.bb
@@ -27,3 +27,5 @@
 }
 
 FILES_${PN}-doc += "${datadir}/texinfo"
+
+RDEPENDS_${PN} = "perl"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo-4.8/check-locale-h.patch b/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo-4.8/check-locale-h.patch
deleted file mode 100644
index f4d6660..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo-4.8/check-locale-h.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-fix the macro check
-
-Upstream-Status: Pending
-
-configure does not check if locale.h exists, but check setlocale,
-if setlocale exist, the locale.h should exist.
-
-Signed-off-by: Roy Li <rongqing.li@windriver.com>
----
- lib/system.h |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/system.h b/lib/system.h
-index 946eb3c..c70037b 100644
---- a/lib/system.h
-+++ b/lib/system.h
-@@ -42,7 +42,7 @@ extern char *substring (const char *, const char *);
- #include <ctype.h>
- 
- /* All systems nowadays probably have these functions, but ... */
--#ifdef HAVE_LOCALE_H
-+#ifdef HAVE_SETLOCALE
- #include <locale.h>
- #endif
- #ifndef HAVE_SETLOCALE
--- 
-1.7.10.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo-4.8/do-compile-native-tools.patch b/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo-4.8/do-compile-native-tools.patch
deleted file mode 100644
index 81ebe26..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo-4.8/do-compile-native-tools.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 458e9450cecf703f55536e609365162719585900 Mon Sep 17 00:00:00 2001
-From: "Roy.Li" <rongqing.li@windriver.com>
-Date: Wed, 10 Sep 2014 17:03:29 +0800
-Subject: [PATCH] do not compile host tools, since we have native
-
-Upstream-Status: Pending
-
-Signed-off-by: Roy.Li <rongqing.li@windriver.com>
----
- configure.ac | 23 +----------------------
- 1 file changed, 1 insertion(+), 22 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index b46130d..cf58654 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -90,28 +90,7 @@ AC_CANONICAL_BUILD
- # $native_tools is also added to SUBDIRS in the main Makefile.am,
- # so that make compiles the native tools first.
- #
--if test "$cross_compiling" = no; then
--  native_tools=
--else
--  native_tools=tools
--  test -d "$native_tools" || mkdir "$native_tools"
--  confdir=`(cd "$srcdir";pwd)`
--  # Make sure the secondary configure won't fail with
--  # "error: source directory already configured".
--  rm -f config.status
--  AC_MSG_NOTICE([[Doing configure of native tools (${build}).]])
--  cd "$native_tools" || exit 1
--  # Run secondary configure in alternate environment or
--  # it gets the wrong CC etc.  env -i gives this build host configure
--  # a clean environment.
--  env -i CC="${BUILD_CC}" AR="${BUILD_AR}" RANLIB="${BUILD_RANLIB}" \
--      PATH="${PATH}" \
--      tools_only=1 \
--    ${confdir}/configure --build=${build} --host=${build} \
--                         --disable-rpath --disable-nls
--  cd .. || exit 1
--  AC_MSG_NOTICE([[Continuing with main configure (${host}).]])
--fi
-+native_tools=
- AC_SUBST(native_tools)
- AM_CONDITIONAL(TOOLS_ONLY, [[test "x$tools_only" = x1]])
- 
--- 
-1.9.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo-4.8/using-native-makeinfo.patch b/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo-4.8/using-native-makeinfo.patch
deleted file mode 100644
index 2297051..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo-4.8/using-native-makeinfo.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From 9b0df7d6d3c18cfac82c291d60a5357d1bc8d9d0 Mon Sep 17 00:00:00 2001
-From: "Roy.Li" <rongqing.li@windriver.com>
-Date: Wed, 10 Sep 2014 17:10:03 +0800
-Subject: [PATCH] using native makeinfo
-
-Upstream-Status: Pending
-
-Signed-off-by: Roy.Li <rongqing.li@windriver.com>
----
- doc/Makefile.am                                |   2 +-
-
-diff --git a/doc/Makefile.am b/doc/Makefile.am
-index 63df818..b6ceb34 100644
---- a/doc/Makefile.am
-+++ b/doc/Makefile.am
-@@ -19,7 +19,7 @@ man_MANS = info.1 infokey.1 install-info.1 makeinfo.1 texindex.1 texi2dvi.1 \
- 
- # Use the programs built in our distribution, taking account of possible
- # cross-compiling.
--MAKEINFO = $(top_builddir)/$(native_tools)/makeinfo/makeinfo
-+MAKEINFO = makeinfo
- INSTALL_INFO = $(top_builddir)/$(native_tools)/util/install-info
- 
- TXI_XLATE = txi-cs.tex txi-de.tex txi-en.tex txi-es.tex txi-fr.tex \
diff --git a/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo/dont-depend-on-help2man.patch b/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo/dont-depend-on-help2man.patch
index 0ce47ec..f418439 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo/dont-depend-on-help2man.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo/dont-depend-on-help2man.patch
@@ -1,31 +1,32 @@
-From 6f1f3912fcb900b3a3e6cbe3360306fade333497 Mon Sep 17 00:00:00 2001
-From: Jussi Kukkonen <jussi.kukkonen@intel.com>
-Date: Thu, 6 Aug 2015 14:55:08 +0300
+From e89b1c57d76f5cf5acbb0d0187374f7a77bce1e2 Mon Sep 17 00:00:00 2001
+From: Edwin Plauchu <edwin.plauchu.camacho@intel.com>
+Date: Tue, 29 Nov 2016 13:43:24 -0600
 Subject: [PATCH] dont-depend-on-help2man
 
 Upstream-Status: Inappropriate
 
 Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
+Signed-off-by: Edwin Plauchu <edwin.plauchu.camacho@intel.com>
 ---
  doc/Makefile.am |  2 +-
  man/Makefile.am | 12 ++++++------
  2 files changed, 7 insertions(+), 7 deletions(-)
 
 diff --git a/doc/Makefile.am b/doc/Makefile.am
-index 7198a6b..4bba550 100644
+index 39db834..1bb2a4f
 --- a/doc/Makefile.am
 +++ b/doc/Makefile.am
-@@ -40,7 +40,7 @@ refcard_files = refcard/Makefile refcard/txicmdcheck \
+@@ -38,7 +38,7 @@ refcard_files = refcard/Makefile refcard/txicmdcheck \
  # Include our texinfo.tex, not Automake's.
  EXTRA_DIST = epsf.tex texinfo.tex \
               fdl.texi \
 -	     $(man_MANS) $(TXI_XLATE) \
 +	     $(TXI_XLATE) \
- 	     $(refcard_files)
+              $(refcard_files) texinfo-tex-test.texi \
+              texinfo-ja.tex short-sample-ja.texi
  
- if INSTALL_WARNINGS
 diff --git a/man/Makefile.am b/man/Makefile.am
-index a08d603..bdfc9a4 100644
+index 6bfcb3d..a820c96
 --- a/man/Makefile.am
 +++ b/man/Makefile.am
 @@ -13,24 +13,24 @@
@@ -60,5 +61,5 @@
  # Maintainers should be able to regenerate.
  MAINTAINERCLEANFILES = $(man_MANS)
 -- 
-2.1.4
+2.9.3
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo/texinfo-4.12-zlib.patch b/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo/texinfo-4.12-zlib.patch
index 41bd220..f25352c 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo/texinfo-4.12-zlib.patch
+++ b/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo/texinfo-4.12-zlib.patch
@@ -1,19 +1,22 @@
-From 20e1d8a9481dc13dd1d4d168b90e0ed2ff097b98 Mon Sep 17 00:00:00 2001
-From: Jussi Kukkonen <jussi.kukkonen@intel.com>
-Date: Thu, 6 Aug 2015 14:29:57 +0300
+From fe4f00459601efe0cfa75d92749a32237800a530 Mon Sep 17 00:00:00 2001
+From: Edwin Plauchu <edwin.plauchu.camacho@intel.com>
+Date: Tue, 29 Nov 2016 12:27:17 -0600
 Subject: [PATCH] texinfo-4.12-zlib
 
 Upstream-Status: Pending
+
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Signed-off-by: Edwin Plauchu <edwin.plauchu.camacho@intel.com>
 ---
- install-info/Makefile.in    |  2 +-
- install-info/install-info.c | 67 +++++++++++++++++++++++++++------------------
- 2 files changed, 42 insertions(+), 27 deletions(-)
+ install-info/Makefile.in    | 12 ++-----
+ install-info/install-info.c | 79 +++++++++++++++++++++++++++------------------
+ 2 files changed, 49 insertions(+), 42 deletions(-)
 
 diff --git a/install-info/Makefile.in b/install-info/Makefile.in
-index ad73abb..eaa2153 100644
+index 837d020..ba96579 100644
 --- a/install-info/Makefile.in
 +++ b/install-info/Makefile.in
-@@ -241,7 +241,7 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
+@@ -216,7 +208,7 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
  PROGRAMS = $(bin_PROGRAMS)
  am_ginstall_info_OBJECTS = install-info.$(OBJEXT)
  ginstall_info_OBJECTS = $(am_ginstall_info_OBJECTS)
@@ -23,7 +26,7 @@
  ginstall_info_DEPENDENCIES = $(top_builddir)/gnulib/lib/libgnu.a \
  	$(am__DEPENDENCIES_1)
 diff --git a/install-info/install-info.c b/install-info/install-info.c
-index b454c15..4e39122 100644
+index e58189c..8617787 100644
 --- a/install-info/install-info.c
 +++ b/install-info/install-info.c
 @@ -22,6 +22,7 @@
@@ -43,7 +46,7 @@
  open_possibly_compressed_file (char *filename,
      void (*create_callback) (char *),
 -    char **opened_filename, char **compression_program) 
-+    char **opened_filename, char **compression_program, int *is_pipe) 
++    char **opened_filename, char **compression_program, int *is_pipe)
  {
    char *local_opened_filename, *local_compression_program;
    int nread;
@@ -119,7 +122,7 @@
            if (!f)
              return 0;
          }
-@@ -767,12 +768,12 @@ open_possibly_compressed_file (char *filename,
+@@ -767,26 +768,26 @@ open_possibly_compressed_file (char *filename,
  
    /* Read first few bytes of file rather than relying on the filename.
       If the file is shorter than this it can't be usable anyway.  */
@@ -128,14 +131,34 @@
 +  nread = gzread (f, data, sizeof (data));
 +  if (nread != sizeof (data))
      {
-       /* Empty files don't set errno.  Calling code can check for
-          this, so make sure errno == 0 just in case it isn't already. */
 -      if (nread == 0)
 +      if (nread >= 0)
-         errno = 0;
-       return 0;
-     }
-@@ -838,35 +839,40 @@ open_possibly_compressed_file (char *filename,
+         {
+           /* Try to create the file if its empty. */
+-          if (feof (f) && create_callback)
++          if (gzeof(f) && create_callback)
+             {
+-              if (fclose (f) != 0)
++              if (gzclose(f) != 0)
+                 return 0; /* unknown error closing file */
+ 
+-              if (remove (filename) != 0)
++              if (remove(filename) != 0)
+                 return 0; /* unknown error deleting file */
+ 
+               (*create_callback) (filename);
+-              f = fopen (*opened_filename, FOPEN_RBIN);
++              f = gzopen (*opened_filename, FOPEN_RBIN);
+               if (!f)
+                 return 0;
+-              nread = fread (data, sizeof (data), 1, f);
+-              if (nread == 0)
++              nread = gzread(f, data, sizeof (data));
++              if (nread >= 0)
+                 return 0;
+               goto determine_file_type; /* success */
+             }
+@@ -857,35 +858,40 @@ determine_file_type:
      *compression_program = NULL;
  
    /* Seek back over the magic bytes.  */
@@ -183,7 +206,7 @@
      }
  
    return f;
-@@ -885,7 +891,8 @@ readfile (char *filename, int *sizep,
+@@ -904,7 +910,8 @@ readfile (char *filename, int *sizep,
      void (*create_callback) (char *), char **opened_filename,
      char **compression_program)
  {
@@ -193,7 +216,7 @@
    int filled = 0;
    int data_size = 8192;
    char *data = xmalloc (data_size);
-@@ -893,14 +900,20 @@ readfile (char *filename, int *sizep,
+@@ -912,14 +919,20 @@ readfile (char *filename, int *sizep,
    /* If they passed the space for the file name to return, use it.  */
    f = open_possibly_compressed_file (filename, create_callback,
                                       opened_filename,
@@ -216,7 +239,7 @@
        if (nread < 0)
          return 0;
        if (nread == 0)
-@@ -919,8 +932,10 @@ readfile (char *filename, int *sizep,
+@@ -938,8 +951,10 @@ readfile (char *filename, int *sizep,
    /* We need to close the stream, since on some systems the pipe created
       by popen is simulated by a temporary file which only gets removed
       inside pclose.  */
@@ -229,5 +252,5 @@
    *sizep = filled;
    return data;
 -- 
-2.1.4
+2.9.3
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo_4.8.bb b/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo_4.8.bb
deleted file mode 100644
index 13678e0..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo_4.8.bb
+++ /dev/null
@@ -1,55 +0,0 @@
-SUMMARY = "Documentation system for on-line information and printed output"
-DESCRIPTION = "Texinfo is a documentation system that can produce both \
-online information and printed output from a single source file. The \
-GNU Project uses the Texinfo file format for most of its documentation."
-HOMEPAGE = "http://www.gnu.org/software/texinfo/"
-SECTION = "console/utils"
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
-
-PROVIDES_append_class-native = " texinfo-4.8-replacement-native"
-
-DEPENDS = "zlib ncurses texinfo-4.8-replacement-native"
-DEPENDS_class-native = "zlib-native ncurses-native"
-
-TARGET_PATCH = "file://use_host_makedoc.patch \
-           file://using-native-makeinfo.patch \
-"
-TARGET_PATCH_class-native = ""
-
-SRC_URI = "${GNU_MIRROR}/texinfo/${BP}.tar.gz \
-           file://check-locale-h.patch \
-           file://do-compile-native-tools.patch \
-           ${TARGET_PATCH} \
-          "
-
-SRC_URI[md5sum] = "4e9a1a591ed236003d0d4b008bf07eef"
-SRC_URI[sha256sum] = "1f3cdeebe65fdf510f55d765ab1031b54416aa5bc2635b6a54ef9bcb2367c917"
-
-tex_texinfo = "texmf/tex/texinfo"
-
-inherit gettext autotools
-
-do_install_append() {
-	mkdir -p ${D}${datadir}/${tex_texinfo}
-	install -p -m644 ${S}/doc/texinfo.tex ${S}/doc/txi-??.tex ${D}${datadir}/${tex_texinfo}
-}
-
-do_install_append_class-native() {
-	install -m 755 info/makedoc ${D}${bindir}
-	install -m 755 makeinfo/makeinfo ${D}${bindir}
-}
-
-PACKAGES += "info info-doc"
-
-FILES_info = "${bindir}/info ${bindir}/infokey ${bindir}/install-info"
-FILES_info-doc = "${infodir}/info.info ${infodir}/dir ${infodir}/info-*.info \
-                  ${mandir}/man1/info.1* ${mandir}/man5/info.5* \
-                  ${mandir}/man1/infokey.1* ${mandir}/man1/install-info.1*"
-
-FILES_${PN} = "${bindir}/makeinfo ${bindir}/texi* ${bindir}/pdftexi2dvi ${bindir}/pod2texi ${datadir}/texinfo"
-FILES_${PN}-doc = "${infodir}/texinfo* \
-                   ${datadir}/${tex_texinfo} \
-                   ${mandir}/man1 ${mandir}/man5"
-
-BBCLASSEXTEND = "native"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo_6.0.bb b/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo_6.3.bb
similarity index 92%
rename from import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo_6.0.bb
rename to import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo_6.3.bb
index 8638bb1..d82731e 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo_6.0.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/texinfo/texinfo_6.3.bb
@@ -11,7 +11,7 @@
 
 def compress_pkg(d):
     if bb.data.inherits_class('compress_doc', d):
-         compress = d.getVar("DOC_COMPRESS", True)
+         compress = d.getVar("DOC_COMPRESS")
          if compress == "gz":
              return "gzip"
          elif compress == "bz2":
@@ -37,8 +37,8 @@
            ${TARGET_PATCH} \
           "
 
-SRC_URI[md5sum] = "e1a2ef5dce5018b53f0f6eed45b247a7"
-SRC_URI[sha256sum] = "83d3183290f34e7f958d209d0b20022c6fe9e921eb6fe94c27d988827d4878d2"
+SRC_URI[md5sum] = "9b08daca9bf8eccae9b0f884aba41f9e"
+SRC_URI[sha256sum] = "300a6ba4958c2dd4a6d5ce60f0a335daf7e379f5374f276f6ba31a221f02f606"
 
 tex_texinfo = "texmf/tex/texinfo"
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/time/time.inc b/import-layers/yocto-poky/meta/recipes-extended/time/time.inc
index 8586217..6b20d7c 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/time/time.inc
+++ b/import-layers/yocto-poky/meta/recipes-extended/time/time.inc
@@ -10,3 +10,5 @@
 
 ALTERNATIVE_${PN} = "time"
 ALTERNATIVE_PRIORITY = "100"
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/tzcode/tzcode-native_2017a.bb b/import-layers/yocto-poky/meta/recipes-extended/tzcode/tzcode-native_2017b.bb
similarity index 67%
rename from import-layers/yocto-poky/meta/recipes-extended/tzcode/tzcode-native_2017a.bb
rename to import-layers/yocto-poky/meta/recipes-extended/tzcode/tzcode-native_2017b.bb
index 2c26744..165d2c6 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/tzcode/tzcode-native_2017a.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/tzcode/tzcode-native_2017b.bb
@@ -9,16 +9,16 @@
            http://www.iana.org/time-zones/repository/releases/tzdata${PV}.tar.gz;name=tzdata"
 UPSTREAM_CHECK_URI = "http://www.iana.org/time-zones"
 
-SRC_URI[tzcode.md5sum] = "eef0bfac7a52dce6989a7d8b40d86fe0"
-SRC_URI[tzcode.sha256sum] = "02f2c6b58b99edd0d47f0cad34075b359fd1a4dab71850f493b0404ded3b38ac"
-SRC_URI[tzdata.md5sum] = "cb8274cd175f8a4d9d1b89895df876dc"
-SRC_URI[tzdata.sha256sum] = "df3a5c4d0a2cf0cde0b3f35796ccf6c9acfd598b8e70f8dece5404cd7626bbd6"
+SRC_URI[tzcode.md5sum] = "afaf15deb13759e8b543d86350385b16"
+SRC_URI[tzcode.sha256sum] = "4d1735bb54e22b8d7443d4d1f1a13d007ae11be79a35e51f8e8322fb8e292d40"
+SRC_URI[tzdata.md5sum] = "50dc0dc50c68644c1f70804f2e7a1625"
+SRC_URI[tzdata.sha256sum] = "f8242a522ea3496b0ce4ff4f2e75a049178da21001a08b8e666d8cbe07d18086"
 
 S = "${WORKDIR}"
 
 inherit native
 
-EXTRA_OEMAKE += "cc=${CC}"
+EXTRA_OEMAKE += "cc='${CC}'"
 
 do_install () {
         install -d ${D}${bindir}/
diff --git a/import-layers/yocto-poky/meta/recipes-extended/tzdata/tzdata_2017a.bb b/import-layers/yocto-poky/meta/recipes-extended/tzdata/tzdata_2017b.bb
similarity index 96%
rename from import-layers/yocto-poky/meta/recipes-extended/tzdata/tzdata_2017a.bb
rename to import-layers/yocto-poky/meta/recipes-extended/tzdata/tzdata_2017b.bb
index ce59d71..55e8976 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/tzdata/tzdata_2017a.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/tzdata/tzdata_2017b.bb
@@ -9,8 +9,8 @@
 SRC_URI = "http://www.iana.org/time-zones/repository/releases/tzdata${PV}.tar.gz;name=tzdata"
 UPSTREAM_CHECK_URI = "http://www.iana.org/time-zones"
 
-SRC_URI[tzdata.md5sum] = "cb8274cd175f8a4d9d1b89895df876dc"
-SRC_URI[tzdata.sha256sum] = "df3a5c4d0a2cf0cde0b3f35796ccf6c9acfd598b8e70f8dece5404cd7626bbd6"
+SRC_URI[tzdata.md5sum] = "50dc0dc50c68644c1f70804f2e7a1625"
+SRC_URI[tzdata.sha256sum] = "f8242a522ea3496b0ce4ff4f2e75a049178da21001a08b8e666d8cbe07d18086"
 
 inherit allarch
 
@@ -45,6 +45,7 @@
         cp -pPR ${S}/$exec_prefix ${D}/
         # libc is removing zoneinfo files from package
         cp -pP "${S}/zone.tab" ${D}${datadir}/zoneinfo
+        cp -pP "${S}/zone1970.tab" ${D}${datadir}/zoneinfo
         cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo
 
         # Install default timezone
@@ -206,8 +207,9 @@
                 ${datadir}/zoneinfo/WET                  \
                 ${datadir}/zoneinfo/Zulu                 \
                 ${datadir}/zoneinfo/zone.tab             \
+                ${datadir}/zoneinfo/zone1970.tab         \
                 ${datadir}/zoneinfo/iso3166.tab          \
                 ${datadir}/zoneinfo/Etc/*"
 
-CONFFILES_${PN} += "${@ "${sysconfdir}/timezone" if bb.utils.to_boolean(d.getVar('INSTALL_TIMEZONE_FILE', True)) else "" }"
+CONFFILES_${PN} += "${@ "${sysconfdir}/timezone" if bb.utils.to_boolean(d.getVar('INSTALL_TIMEZONE_FILE')) else "" }"
 CONFFILES_${PN} += "${sysconfdir}/localtime"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/unzip/unzip/18-cve-2014-9913-unzip-buffer-overflow.patch b/import-layers/yocto-poky/meta/recipes-extended/unzip/unzip/18-cve-2014-9913-unzip-buffer-overflow.patch
new file mode 100644
index 0000000..3c02d59
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/unzip/unzip/18-cve-2014-9913-unzip-buffer-overflow.patch
@@ -0,0 +1,33 @@
+From: "Steven M. Schweda" <sms@antinode.info>
+Subject: Fix CVE-2014-9913, buffer overflow in unzip
+Bug: https://sourceforge.net/p/infozip/bugs/27/
+Bug-Debian: https://bugs.debian.org/847485
+Bug-Ubuntu: https://launchpad.net/bugs/387350
+X-Debian-version: 6.0-21
+
+Upstream-Status: Backport
+CVE: CVE-2014-9913
+Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
+
+--- a/list.c
++++ b/list.c
+@@ -339,7 +339,18 @@
+                 G.crec.compression_method == ENHDEFLATED) {
+                 methbuf[5] = dtype[(G.crec.general_purpose_bit_flag>>1) & 3];
+             } else if (methnum >= NUM_METHODS) {
+-                sprintf(&methbuf[4], "%03u", G.crec.compression_method);
++                /* 2013-02-26 SMS.
++                 * http://sourceforge.net/p/infozip/bugs/27/  CVE-2014-9913.
++                 * Unexpectedly large compression methods overflow
++                 * &methbuf[].  Use the old, three-digit decimal format
++                 * for values which fit.  Otherwise, sacrifice the
++                 * colon, and use four-digit hexadecimal.
++                 */
++                if (G.crec.compression_method <= 999) {
++                    sprintf( &methbuf[ 4], "%03u", G.crec.compression_method);
++                } else {
++                    sprintf( &methbuf[ 3], "%04X", G.crec.compression_method);
++                }
+             }
+ 
+ #if 0       /* GRR/Euro:  add this? */
diff --git a/import-layers/yocto-poky/meta/recipes-extended/unzip/unzip/19-cve-2016-9844-zipinfo-buffer-overflow.patch b/import-layers/yocto-poky/meta/recipes-extended/unzip/unzip/19-cve-2016-9844-zipinfo-buffer-overflow.patch
new file mode 100644
index 0000000..ffadbc2
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/unzip/unzip/19-cve-2016-9844-zipinfo-buffer-overflow.patch
@@ -0,0 +1,32 @@
+From: "Steven M. Schweda" <sms@antinode.info>
+Subject: Fix CVE-2016-9844, buffer overflow in zipinfo
+Bug-Debian: https://bugs.debian.org/847486
+Bug-Ubuntu: https://launchpad.net/bugs/1643750
+X-Debian-version: 6.0-21
+
+Upstream-Status: Backport
+CVE: CVE-2016-9844
+Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
+
+--- a/zipinfo.c
++++ b/zipinfo.c
+@@ -1921,7 +1921,18 @@
+         ush  dnum=(ush)((G.crec.general_purpose_bit_flag>>1) & 3);
+         methbuf[3] = dtype[dnum];
+     } else if (methnum >= NUM_METHODS) {   /* unknown */
+-        sprintf(&methbuf[1], "%03u", G.crec.compression_method);
++        /* 2016-12-05 SMS.
++         * https://launchpad.net/bugs/1643750
++         * Unexpectedly large compression methods overflow
++         * &methbuf[].  Use the old, three-digit decimal format
++         * for values which fit.  Otherwise, sacrifice the "u",
++         * and use four-digit hexadecimal.
++         */
++        if (G.crec.compression_method <= 999) {
++            sprintf( &methbuf[ 1], "%03u", G.crec.compression_method);
++        } else {
++            sprintf( &methbuf[ 0], "%04X", G.crec.compression_method);
++        }
+     }
+ 
+     for (k = 0;  k < 15;  ++k)
diff --git a/import-layers/yocto-poky/meta/recipes-extended/unzip/unzip_6.0.bb b/import-layers/yocto-poky/meta/recipes-extended/unzip/unzip_6.0.bb
index 547379c..d4ee487 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/unzip/unzip_6.0.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/unzip/unzip_6.0.bb
@@ -16,7 +16,9 @@
 	file://11-cve-2014-8141-getzip64data.patch \
 	file://CVE-2015-7696.patch \
 	file://CVE-2015-7697.patch \
-        file://fix-security-format.patch \
+	file://fix-security-format.patch \
+	file://18-cve-2014-9913-unzip-buffer-overflow.patch \
+	file://19-cve-2016-9844-zipinfo-buffer-overflow.patch \
 "
 
 SRC_URI[md5sum] = "62b490407489521db863b523a7f86375"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog_5.15.bb b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog_5.15.bb
index cedfc04..9659f27 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog_5.15.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog_5.15.bb
@@ -52,8 +52,9 @@
     ${sbindir}/wd_keepalive \
 "
 
-RDEPENDS_${PN} += "${PN}-config ${PN}-keepalive"
+RDEPENDS_${PN} += "${PN}-config"
+RRECOMMENDS_${PN} += "kernel-module-softdog"
+
 RDEPENDS_${PN}-keepalive += "${PN}-config"
-
-RRECOMMENDS_${PN} = "kernel-module-softdog"
-
+RCONFLICTS_${PN}-keepalive += "${PN}"
+RRECOMMENDS_${PN}-keepalive += "kernel-module-softdog"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/wget/wget.inc b/import-layers/yocto-poky/meta/recipes-extended/wget/wget.inc
index c4abfe4..1299edb 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/wget/wget.inc
+++ b/import-layers/yocto-poky/meta/recipes-extended/wget/wget.inc
@@ -5,8 +5,6 @@
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 DEPENDS = "gnutls zlib libpcre"
 
-INC_PR = "r16"
-
 inherit autotools gettext texinfo update-alternatives pkgconfig
 
 EXTRA_OECONF = "--with-ssl=gnutls --disable-rpath --disable-iri \
@@ -18,9 +16,9 @@
 
 RRECOMMENDS_${PN} += "ca-certificates"
 
-BBCLASSEXTEND += "nativesdk"
+BBCLASSEXTEND = "nativesdk"
 
-PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'ipv6', '', d)}"
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
 PACKAGECONFIG[libuuid] = "--with-libuuid, --without-libuuid,util-linux"
 PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
 
diff --git a/import-layers/yocto-poky/meta/recipes-extended/wget/wget/CVE-2017-6508.patch b/import-layers/yocto-poky/meta/recipes-extended/wget/wget/CVE-2017-6508.patch
new file mode 100644
index 0000000..b9c290f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/wget/wget/CVE-2017-6508.patch
@@ -0,0 +1,44 @@
+From 4d729e322fae359a1aefaafec1144764a54e8ad4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
+Date: Mon, 6 Mar 2017 10:04:22 +0100
+Subject: [PATCH] Fix CRLF injection in Wget host part
+
+* src/url.c (url_parse): Reject control characters in host part of URL
+
+Reported-by: Orange Tsai
+
+Upstream-Status: Backport
+[http://git.savannah.gnu.org/cgit/wget.git/commit/?id=4d729e322fae359a1aefaafec1144764a54e8ad4]
+
+CVE: CVE-2017-6508
+
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+---
+ src/url.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/src/url.c b/src/url.c
+index 8f8ff0b..7d36b27 100644
+--- a/src/url.c
++++ b/src/url.c
+@@ -925,6 +925,17 @@ url_parse (const char *url, int *error, struct iri *iri, bool percent_encode)
+       url_unescape (u->host);
+       host_modified = true;
+ 
++      /* check for invalid control characters in host name */
++      for (p = u->host; *p; p++)
++        {
++          if (c_iscntrl(*p))
++            {
++              url_free(u);
++              error_code = PE_INVALID_HOST_NAME;
++              goto error;
++            }
++        }
++
+       /* Apply IDNA regardless of iri->utf8_encode status */
+       if (opt.enable_iri && iri)
+         {
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-extended/wget/wget_1.18.bb b/import-layers/yocto-poky/meta/recipes-extended/wget/wget_1.18.bb
deleted file mode 100644
index c969b98..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/wget/wget_1.18.bb
+++ /dev/null
@@ -1,8 +0,0 @@
-SRC_URI = "${GNU_MIRROR}/wget/wget-${PV}.tar.gz \
-           file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
-          "
-
-SRC_URI[md5sum] = "fc2debd8399e3b933a9b226794e2a886"
-SRC_URI[sha256sum] = "a00a65fab84cc46e24c53ce88c45604668a7a479276e037dc2f558e34717fb2d"
-
-require wget.inc
diff --git a/import-layers/yocto-poky/meta/recipes-extended/wget/wget_1.19.1.bb b/import-layers/yocto-poky/meta/recipes-extended/wget/wget_1.19.1.bb
new file mode 100644
index 0000000..78bde95
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-extended/wget/wget_1.19.1.bb
@@ -0,0 +1,9 @@
+SRC_URI = "${GNU_MIRROR}/wget/wget-${PV}.tar.gz \
+           file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
+           file://CVE-2017-6508.patch \
+          "
+
+SRC_URI[md5sum] = "87cea36b7161fd43e3fd51a4e8b89689"
+SRC_URI[sha256sum] = "9e4f12da38cc6167d0752d934abe27c7b1599a9af294e73829be7ac7b5b4da40"
+
+require wget.inc
diff --git a/import-layers/yocto-poky/meta/recipes-extended/which/which-2.18/automake-foreign.patch b/import-layers/yocto-poky/meta/recipes-extended/which/which-2.18/automake-foreign.patch
deleted file mode 100644
index 495cdc6..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/which/which-2.18/automake-foreign.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-Subject: [PATCH] automake foreign strictness
-
-Use foreign strictness to avoid automake errors.
-
-Upstream-Status: Inappropriate [upstream no longer active]
-
-Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
----
- configure.ac |    5 +++--
- 1 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index b30b6f5..bd3222c 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -1,6 +1,7 @@
- dnl Process this file with autoconf to produce a configure script.
--AC_INIT(which.c)
--AM_INIT_AUTOMAKE(which, 2.18)
-+AC_INIT([which],[2.18])
-+AC_CONFIG_SRCDIR(which.c)
-+AM_INIT_AUTOMAKE([foreign])
- AM_CONFIG_HEADER(config.h)
- AM_MAINTAINER_MODE
- 
--- 
-1.7.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/which/which-2.18/fix_name_conflict_group_member.patch b/import-layers/yocto-poky/meta/recipes-extended/which/which-2.18/fix_name_conflict_group_member.patch
deleted file mode 100644
index 0e0988b..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/which/which-2.18/fix_name_conflict_group_member.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-Upstream-Status: Inappropriate [this is 2.18(GPLv2) specific]
-
-# glibc also implements the function group_member. To avoid name conflict,
-# here let us append a "_" to which's version.
-#
-# Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>, 2010-08-20
-# (this patch is licensed under GPLv2)
-
---- which-2.18/bash.c
-+++ which-2.18/bash.c
-@@ -45,7 +45,12 @@
-  * - changed all occurences of 'gid_t' into 'GID_T'.
-  * - exported functions needed in which.c
-  */
--static int group_member (GID_T gid);
-+
-+/*
-+ * glibc also implements the function group_member. To avoid name conflict,
-+ * here let us append a "_" to which's version.
-+ */
-+static int _group_member (GID_T gid);
- static char* extract_colon_unit (char const* string, int *p_index);
- 
- /*===========================================================================
-@@ -200,8 +205,8 @@
- 
- /* From bash-2.05b / general.c / line 805 */
- /* Return non-zero if GID is one that we have in our groups list. */
--int
--group_member (GID_T gid)
-+static int
-+_group_member (GID_T gid)
- {
- #if defined (HAVE_GETGROUPS)
-   register int i;
-@@ -290,7 +295,7 @@
-     return (X_BIT (u_mode_bits (finfo.st_mode))) ? (FS_EXISTS | FS_EXECABLE) : FS_EXISTS;
- 
-   /* Otherwise, if we are in the owning group, the group permissions apply. */
--  if (group_member (finfo.st_gid))
-+  if (_group_member (finfo.st_gid))
-     return (X_BIT (g_mode_bits (finfo.st_mode))) ? (FS_EXISTS | FS_EXECABLE) : FS_EXISTS;
- 
-   /* Otherwise, if we are in the other group, the other permissions apply. */
-@@ -331,7 +336,7 @@
- /* Given a string containing units of information separated by colons,
-    return the next one pointed to by (P_INDEX), or NULL if there are no more.
-    Advance (P_INDEX) to the character after the colon. */
--char*
-+static char*
- extract_colon_unit (char const* string, int* p_index)
- {
-   int i, start, len;
diff --git a/import-layers/yocto-poky/meta/recipes-extended/which/which_2.18.bb b/import-layers/yocto-poky/meta/recipes-extended/which/which_2.18.bb
deleted file mode 100644
index eb6cc99..0000000
--- a/import-layers/yocto-poky/meta/recipes-extended/which/which_2.18.bb
+++ /dev/null
@@ -1,34 +0,0 @@
-SUMMARY = "Displays the full path of shell commands"
-DESCRIPTION = "Which is a utility that prints out the full path of the \
-executables that bash(1) would execute when the passed \
-program names would have been entered on the shell prompt. \
-It does this by using the exact same algorithm as bash."
-SECTION = "libs"
-HOMEPAGE = "http://carlo17.home.xs4all.nl/which/"
-
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
-
-PR = "r2"
-
-SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/which/which-2.18.tar.gz/42d51938e48b91f6e19fabf216f5c3e9/which-${PV}.tar.gz \
-           file://fix_name_conflict_group_member.patch \
-           file://automake-foreign.patch \
-"
-
-SRC_URI[md5sum] = "42d51938e48b91f6e19fabf216f5c3e9"
-SRC_URI[sha256sum] = "9445cd7e02ec0c26a44fd56098464ded064ba5d93dd2e15ec12410ba56b2e544"
-
-DEPENDS = "cwautomacros-native"
-
-inherit autotools texinfo update-alternatives
-
-do_configure_prepend() {
-	OLD="@ACLOCAL_CWFLAGS@"
-	NEW="-I ${STAGING_DIR_NATIVE}/${datadir}/cwautomacros/m4"
-	sed -i "s#${OLD}#${NEW}#g" `grep -rl ${OLD} ${S}`
-}
-
-ALTERNATIVE_${PN} = "which"
-ALTERNATIVE_PRIORITY = "100"
-
diff --git a/import-layers/yocto-poky/meta/recipes-extended/which/which_2.21.bb b/import-layers/yocto-poky/meta/recipes-extended/which/which_2.21.bb
index a7687f6..fac0fd3 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/which/which_2.21.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/which/which_2.21.bb
@@ -30,3 +30,6 @@
 
 ALTERNATIVE_${PN} = "which"
 ALTERNATIVE_PRIORITY = "100"
+
+ALTERNATIVE_${PN}-doc = "which.1"
+ALTERNATIVE_LINK_NAME[which.1] = "${mandir}/man1/which.1"
diff --git a/import-layers/yocto-poky/meta/recipes-extended/xz/xz_5.2.2.bb b/import-layers/yocto-poky/meta/recipes-extended/xz/xz_5.2.3.bb
similarity index 89%
rename from import-layers/yocto-poky/meta/recipes-extended/xz/xz_5.2.2.bb
rename to import-layers/yocto-poky/meta/recipes-extended/xz/xz_5.2.3.bb
index d118f3a..c0f8b82 100644
--- a/import-layers/yocto-poky/meta/recipes-extended/xz/xz_5.2.2.bb
+++ b/import-layers/yocto-poky/meta/recipes-extended/xz/xz_5.2.3.bb
@@ -22,8 +22,8 @@
                     file://lib/getopt.c;endline=23;md5=2069b0ee710572c03bb3114e4532cd84 "
 
 SRC_URI = "http://tukaani.org/xz/xz-${PV}.tar.gz"
-SRC_URI[md5sum] = "7cf6a8544a7dae8e8106fdf7addfa28c"
-SRC_URI[sha256sum] = "73df4d5d34f0468bd57d09f2d8af363e95ed6cc3a4a86129d2f2c366259902a2"
+SRC_URI[md5sum] = "ef68674fb47a8b8e741b34e429d86e9d"
+SRC_URI[sha256sum] = "71928b357d0a09a12a4b4c5fafca8c31c19b0e7d3b8ebb19622e96f26dbf28cb"
 
 inherit autotools gettext