summaryrefslogtreecommitdiffstats
path: root/import-layers/yocto-poky/meta/recipes-core/busybox/busybox
diff options
context:
space:
mode:
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-core/busybox/busybox')
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch73
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-sed-fix-sed-n-flushes-pattern-space-terminates-early.patch72
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2147.patch57
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2147_2.patch32
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2148.patch74
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/busybox-kbuild-race-fix-commit-d8e61bb.patch53
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/commit-applet_tables-fix-commit-0dddbc1.patch61
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/defconfig2
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/ip_fix_problem_on_mips64_n64_big_endian_musl_systems.patch90
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/makefile-fix-backport.patch40
-rw-r--r--import-layers/yocto-poky/meta/recipes-core/busybox/busybox/makefile-libbb-race.patch34
11 files changed, 587 insertions, 1 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch
new file mode 100644
index 000000000..8bcbd73de
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch
@@ -0,0 +1,73 @@
+From 198f18addf1d814c2fefcb492f3b9fbd221669bb Mon Sep 17 00:00:00 2001
+From: "Maxin B. John" <maxin.john@intel.com>
+Date: Wed, 20 Apr 2016 18:24:45 +0300
+Subject: [PATCH] flock: update the behaviour of -c parameter to match upstream
+
+In upstream, -c 'PROG ARGS' means "run sh -c 'PROG ARGS'"
+
+function old new delta
+flock_main 286 377 +91
+.rodata 155849 155890 +41
+
+Upstream-Status: Submitted
+[ http://lists.busybox.net/pipermail/busybox/2016-April/084142.html ]
+
+Signed-off-by: Maxin B. John <maxin.john@intel.com>
+---
+ util-linux/flock.c | 20 ++++++++++++++------
+ 1 file changed, 14 insertions(+), 6 deletions(-)
+
+diff --git a/util-linux/flock.c b/util-linux/flock.c
+index 05a747f..c85a25d 100644
+--- a/util-linux/flock.c
++++ b/util-linux/flock.c
+@@ -20,6 +20,7 @@ int flock_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+ int flock_main(int argc UNUSED_PARAM, char **argv)
+ {
+ int mode, opt, fd;
++ char *cmd_args[4];
+ enum {
+ OPT_s = (1 << 0),
+ OPT_x = (1 << 1),
+@@ -57,7 +58,6 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
+ /* If it is "flock FILE -c PROG", then -c isn't caught by getopt32:
+ * we use "+" in order to support "flock -opt FILE PROG -with-opts",
+ * we need to remove -c by hand.
+- * TODO: in upstream, -c 'PROG ARGS' means "run sh -c 'PROG ARGS'"
+ */
+ if (argv[0]
+ && argv[0][0] == '-'
+@@ -65,7 +65,10 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
+ || (ENABLE_LONG_OPTS && strcmp(argv[0] + 1, "-command") == 0)
+ )
+ ) {
+- argv++;
++ if (argc != optind + 3)
++ bb_error_msg_and_die("-c requires exactly one command argument");
++ else
++ argv++;
+ }
+
+ if (OPT_s == LOCK_SH && OPT_x == LOCK_EX && OPT_n == LOCK_NB && OPT_u == LOCK_UN) {
+@@ -89,9 +92,14 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
+ return EXIT_FAILURE;
+ bb_perror_nomsg_and_die();
+ }
+-
+- if (argv[0])
+- return spawn_and_wait(argv);
+-
++ if (argv[0]) {
++ cmd_args[0] = getenv("SHELL");
++ if (!cmd_args[0])
++ cmd_args[0] = (char*)DEFAULT_SHELL;
++ cmd_args[1] = (char*)"-c";
++ cmd_args[2] = argv[0];
++ cmd_args[3] = NULL;
++ return spawn_and_wait(cmd_args);
++ }
+ return EXIT_SUCCESS;
+ }
+--
+2.4.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-sed-fix-sed-n-flushes-pattern-space-terminates-early.patch b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-sed-fix-sed-n-flushes-pattern-space-terminates-early.patch
new file mode 100644
index 000000000..4f539848c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/0001-sed-fix-sed-n-flushes-pattern-space-terminates-early.patch
@@ -0,0 +1,72 @@
+From 903542f7331c58007a3ef938d41e1c55fc329648 Mon Sep 17 00:00:00 2001
+From: Dengke Du <dengke.du@windriver.com>
+Date: Wed, 31 Aug 2016 23:40:43 -0400
+Subject: [PATCH] sed: fix "sed n (flushes pattern space, terminates early)"
+ testcase failure
+
+This patch fix "sed n (flushes pattern space, terminates early)"
+testcase failure. We can see it at:
+
+ https://git.busybox.net/busybox/commit/?id=76d72376e0244a5cafd4880cdc623e37d86a75e4
+
+Upstream-Status: Backport
+
+Signed-off-by: Dengke Du <dengke.du@windriver.com>
+---
+ editors/sed.c | 19 ++++++++++---------
+ testsuite/sed.tests | 6 +-----
+ 2 files changed, 11 insertions(+), 14 deletions(-)
+
+diff --git a/editors/sed.c b/editors/sed.c
+index 7bbf820..259c39c 100644
+--- a/editors/sed.c
++++ b/editors/sed.c
+@@ -1274,16 +1274,17 @@ static void process_files(void)
+ case 'n':
+ if (!G.be_quiet)
+ sed_puts(pattern_space, last_gets_char);
+- if (next_line) {
+- free(pattern_space);
+- pattern_space = next_line;
+- last_gets_char = next_gets_char;
+- next_line = get_next_line(&next_gets_char, &last_puts_char, last_gets_char);
+- substituted = 0;
+- linenum++;
+- break;
++ if (next_line == NULL) {
++ /* If no next line, jump to end of script and exit. */
++ goto discard_line;
+ }
+- /* fall through */
++ free(pattern_space);
++ pattern_space = next_line;
++ last_gets_char = next_gets_char;
++ next_line = get_next_line(&next_gets_char, &last_puts_char, last_gets_char);
++ substituted = 0;
++ linenum++;
++ break;
+
+ /* Quit. End of script, end of input. */
+ case 'q':
+diff --git a/testsuite/sed.tests b/testsuite/sed.tests
+index 34479e5..96ff7a5 100755
+--- a/testsuite/sed.tests
++++ b/testsuite/sed.tests
+@@ -73,13 +73,9 @@ testing "sed t (test/branch clears test bit)" "sed -e 's/a/b/;:loop;t loop'" \
+ testing "sed T (!test/branch)" "sed -e 's/a/1/;T notone;p;: notone;p'" \
+ "1\n1\n1\nb\nb\nc\nc\n" "" "a\nb\nc\n"
+
+-test x"$SKIP_KNOWN_BUGS" = x"" && {
+-# Normal sed end-of-script doesn't print "c" because n flushed the pattern
+-# space. If n hits EOF, pattern space is empty when script ends.
+-# Query: how does this interact with no newline at EOF?
+ testing "sed n (flushes pattern space, terminates early)" "sed -e 'n;p'" \
+ "a\nb\nb\nc\n" "" "a\nb\nc\n"
+-}
++
+ # non-GNU sed: N does _not_ flush pattern space, therefore c is eaten @ script end
+ # GNU sed: N flushes pattern space, therefore c is printed too @ script end
+ testing "sed N (flushes pattern space (GNU behavior))" "sed -e 'N;p'" \
+--
+2.8.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2147.patch b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2147.patch
new file mode 100644
index 000000000..84cae6aa2
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2147.patch
@@ -0,0 +1,57 @@
+From d474ffc68290e0a83651c4432eeabfa62cd51e87 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Thu, 10 Mar 2016 11:47:58 +0100
+Subject: [PATCH] udhcp: fix a SEGV on malformed RFC1035-encoded domain name
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+
+Upstream-Status: Backport
+CVE: CVE-2016-2147
+
+https://git.busybox.net/busybox/commit/?id=d474ffc
+Signed-off-by: Armin Kuster <akuster@mvista.com>
+
+---
+ networking/udhcp/domain_codec.c | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+Index: busybox-1.23.2/networking/udhcp/domain_codec.c
+===================================================================
+--- busybox-1.23.2.orig/networking/udhcp/domain_codec.c
++++ busybox-1.23.2/networking/udhcp/domain_codec.c
+@@ -63,11 +63,10 @@ char* FAST_FUNC dname_dec(const uint8_t
+ if (crtpos + *c + 1 > clen) /* label too long? abort */
+ return NULL;
+ if (dst)
+- memcpy(dst + len, c + 1, *c);
++ /* \3com ---> "com." */
++ ((char*)mempcpy(dst + len, c + 1, *c))[0] = '.';
+ len += *c + 1;
+ crtpos += *c + 1;
+- if (dst)
+- dst[len - 1] = '.';
+ } else {
+ /* NUL: end of current domain name */
+ if (retpos == 0) {
+@@ -78,7 +77,10 @@ char* FAST_FUNC dname_dec(const uint8_t
+ crtpos = retpos;
+ retpos = depth = 0;
+ }
+- if (dst)
++ if (dst && len != 0)
++ /* \4host\3com\0\4host and we are at \0:
++ * \3com was converted to "com.", change dot to space.
++ */
+ dst[len - 1] = ' ';
+ }
+
+@@ -228,6 +230,9 @@ int main(int argc, char **argv)
+ int len;
+ uint8_t *encoded;
+
++ uint8_t str[6] = { 0x00, 0x00, 0x02, 0x65, 0x65, 0x00 };
++ printf("NUL:'%s'\n", dname_dec(str, 6, ""));
++
+ #define DNAME_DEC(encoded,pre) dname_dec((uint8_t*)(encoded), sizeof(encoded), (pre))
+ printf("'%s'\n", DNAME_DEC("\4host\3com\0", "test1:"));
+ printf("test2:'%s'\n", DNAME_DEC("\4host\3com\0\4host\3com\0", ""));
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2147_2.patch b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2147_2.patch
new file mode 100644
index 000000000..1473d4603
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2147_2.patch
@@ -0,0 +1,32 @@
+From 1b7c17391de66502dd7a97c866e0a33681edbb1f Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Fri, 11 Mar 2016 00:26:58 +0100
+Subject: [PATCH] udhcpc: fix a warning in debug code
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+Upsteam-Status: Backport
+CVE: CVE-2016-2147 regression fix
+
+https://git.busybox.net/busybox/commit/?id=1b7c17
+
+Signed-off-by: Armin Kuster <akuster@mvista.com>
+
+---
+ networking/udhcp/domain_codec.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/networking/udhcp/domain_codec.c b/networking/udhcp/domain_codec.c
+index cee31f1..5a923cc 100644
+--- a/networking/udhcp/domain_codec.c
++++ b/networking/udhcp/domain_codec.c
+@@ -7,6 +7,7 @@
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
+ */
+ #ifdef DNS_COMPR_TESTING
++# define _GNU_SOURCE
+ # define FAST_FUNC /* nothing */
+ # define xmalloc malloc
+ # include <stdlib.h>
+--
+2.3.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2148.patch b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2148.patch
new file mode 100644
index 000000000..af04a7f5b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/CVE-2016-2148.patch
@@ -0,0 +1,74 @@
+From 352f79acbd759c14399e39baef21fc4ffe180ac2 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Fri, 26 Feb 2016 15:54:56 +0100
+Subject: [PATCH] udhcpc: fix OPTION_6RD parsing (could overflow its malloced
+ buffer)
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+
+Upstream-Status: Backport
+CVE: CVE-2016-2148
+https://git.busybox.net/busybox/commit/?id=352f79
+
+Signed-off-by: Armin Kuster <akuster@mvista.com>
+
+---
+ networking/udhcp/common.c | 15 +++++++++++++--
+ networking/udhcp/dhcpc.c | 4 ++--
+ 2 files changed, 15 insertions(+), 4 deletions(-)
+
+Index: busybox-1.23.2/networking/udhcp/common.c
+===================================================================
+--- busybox-1.23.2.orig/networking/udhcp/common.c
++++ busybox-1.23.2/networking/udhcp/common.c
+@@ -142,7 +142,7 @@ const char dhcp_option_strings[] ALIGN1
+ * udhcp_str2optset: to determine how many bytes to allocate.
+ * xmalloc_optname_optval: to estimate string length
+ * from binary option length: (option[LEN] / dhcp_option_lengths[opt_type])
+- * is the number of elements, multiply in by one element's string width
++ * is the number of elements, multiply it by one element's string width
+ * (len_of_option_as_string[opt_type]) and you know how wide string you need.
+ */
+ const uint8_t dhcp_option_lengths[] ALIGN1 = {
+@@ -162,7 +162,18 @@ const uint8_t dhcp_option_lengths[] ALIG
+ [OPTION_S32] = 4,
+ /* Just like OPTION_STRING, we use minimum length here */
+ [OPTION_STATIC_ROUTES] = 5,
+- [OPTION_6RD] = 22, /* ignored by udhcp_str2optset */
++ [OPTION_6RD] = 12, /* ignored by udhcp_str2optset */
++ /* The above value was chosen as follows:
++ * len_of_option_as_string[] for this option is >60: it's a string of the form
++ * "32 128 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 255.255.255.255 ".
++ * Each additional ipv4 address takes 4 bytes in binary option and appends
++ * another "255.255.255.255 " 16-byte string. We can set [OPTION_6RD] = 4
++ * but this severely overestimates string length: instead of 16 bytes,
++ * it adds >60 for every 4 bytes in binary option.
++ * We cheat and declare here that option is in units of 12 bytes.
++ * This adds more than 60 bytes for every three ipv4 addresses - more than enough.
++ * (Even 16 instead of 12 should work, but let's be paranoid).
++ */
+ };
+
+
+Index: busybox-1.23.2/networking/udhcp/dhcpc.c
+===================================================================
+--- busybox-1.23.2.orig/networking/udhcp/dhcpc.c
++++ busybox-1.23.2/networking/udhcp/dhcpc.c
+@@ -103,7 +103,7 @@ static const uint8_t len_of_option_as_st
+ [OPTION_IP ] = sizeof("255.255.255.255 "),
+ [OPTION_IP_PAIR ] = sizeof("255.255.255.255 ") * 2,
+ [OPTION_STATIC_ROUTES ] = sizeof("255.255.255.255/32 255.255.255.255 "),
+- [OPTION_6RD ] = sizeof("32 128 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 255.255.255.255 "),
++ [OPTION_6RD ] = sizeof("132 128 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 255.255.255.255 "),
+ [OPTION_STRING ] = 1,
+ [OPTION_STRING_HOST ] = 1,
+ #if ENABLE_FEATURE_UDHCP_RFC3397
+@@ -214,7 +214,7 @@ static NOINLINE char *xmalloc_optname_op
+ type = optflag->flags & OPTION_TYPE_MASK;
+ optlen = dhcp_option_lengths[type];
+ upper_length = len_of_option_as_string[type]
+- * ((unsigned)(len + optlen - 1) / (unsigned)optlen);
++ * ((unsigned)(len + optlen) / (unsigned)optlen);
+
+ dest = ret = xmalloc(upper_length + strlen(opt_name) + 2);
+ dest += sprintf(ret, "%s=", opt_name);
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/busybox-kbuild-race-fix-commit-d8e61bb.patch b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/busybox-kbuild-race-fix-commit-d8e61bb.patch
new file mode 100644
index 000000000..38302e0b6
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/busybox-kbuild-race-fix-commit-d8e61bb.patch
@@ -0,0 +1,53 @@
+Upstream-Status: Backport
+
+Patch addressing a parallel make race in Busybox
+
+ http://git.busybox.net/busybox/commit/?id=d8e61bbf13d0cf38d477255cfd5dc71c5d51d575
+
+Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
+
+From d8e61bbf13d0cf38d477255cfd5dc71c5d51d575 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Sun, 21 Aug 2016 22:00:20 +0200
+Subject: build system: different fix for
+ include/applet_tables.h/include/NUM_APPLETS.h
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+
+diff --git a/applets/Kbuild.src b/applets/Kbuild.src
+index 5cc1827..3aedbbf 100644
+--- a/applets/Kbuild.src
++++ b/applets/Kbuild.src
+@@ -29,7 +29,7 @@ applets/applets.o: include/usage_compressed.h include/applet_tables.h
+
+ applets/applet_tables: .config include/applets.h
+ applets/usage: .config include/applets.h
+-applets/usage_pod: .config include/applets.h include/applet_tables.h include/NUM_APPLETS.h
++applets/usage_pod: .config include/applets.h include/applet_tables.h
+
+ quiet_cmd_gen_usage_compressed = GEN include/usage_compressed.h
+ cmd_gen_usage_compressed = $(srctree_slash)applets/usage_compressed include/usage_compressed.h applets
+@@ -37,8 +37,21 @@ quiet_cmd_gen_usage_compressed = GEN include/usage_compressed.h
+ include/usage_compressed.h: applets/usage $(srctree_slash)applets/usage_compressed
+ $(call cmd,gen_usage_compressed)
+
+-quiet_cmd_gen_applet_tables = GEN include/applet_tables.h
++quiet_cmd_gen_applet_tables = GEN include/applet_tables.h include/NUM_APPLETS.h
+ cmd_gen_applet_tables = applets/applet_tables include/applet_tables.h include/NUM_APPLETS.h
+
+-include/applet_tables.h include/NUM_APPLETS.h: applets/applet_tables
++include/NUM_APPLETS.h: applets/applet_tables
++ $(call cmd,gen_applet_tables)
++
++# In fact, include/applet_tables.h depends only on applets/applet_tables,
++# and is generated by it. But specifying only it can run
++# applets/applet_tables twice, possibly in parallel.
++# We say that it also needs NUM_APPLETS.h
++#
++# Unfortunately, we need to list the same command,
++# and it can be executed twice (sequentially).
++# The alternative is to not list any command,
++# and then if include/applet_tables.h is deleted, it won't be rebuilt.
++#
++include/applet_tables.h: include/NUM_APPLETS.h applets/applet_tables
+ $(call cmd,gen_applet_tables)
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/commit-applet_tables-fix-commit-0dddbc1.patch b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/commit-applet_tables-fix-commit-0dddbc1.patch
new file mode 100644
index 000000000..7f80a1d91
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/commit-applet_tables-fix-commit-0dddbc1.patch
@@ -0,0 +1,61 @@
+Upstream-Status: Backport
+
+Patch addressing a parallel make race in Busybox
+
+ http://git.busybox.net/busybox/commit/?id=0dddbc1a59795a77679d8c5ef48a2795cb470563
+
+Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
+
+From 0dddbc1a59795a77679d8c5ef48a2795cb470563 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Tue, 23 Aug 2016 20:21:36 +0200
+Subject: build system: always rewrite NUM_APPLETS.h
+
+Conditional rewrite can keep NUM_APPLETS.h mtime old,
+this causes make to try to regenerate it at every invocation.
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+
+diff --git a/applets/applet_tables.c b/applets/applet_tables.c
+index 8401a15..ef911a4 100644
+--- a/applets/applet_tables.c
++++ b/applets/applet_tables.c
+@@ -192,27 +192,28 @@ int main(int argc, char **argv)
+ printf("};\n");
+ #endif
+ //printf("#endif /* SKIP_definitions */\n");
++
+ // printf("\n");
+ // printf("#define MAX_APPLET_NAME_LEN %u\n", MAX_APPLET_NAME_LEN);
+
+ if (argv[2]) {
+- char line_old[80];
+- char line_new[80];
+ FILE *fp;
++ char line_new[80];
++// char line_old[80];
+
+- line_old[0] = 0;
+- fp = fopen(argv[2], "r");
+- if (fp) {
+- fgets(line_old, sizeof(line_old), fp);
+- fclose(fp);
+- }
+ sprintf(line_new, "#define NUM_APPLETS %u\n", NUM_APPLETS);
+- if (strcmp(line_old, line_new) != 0) {
++// line_old[0] = 0;
++// fp = fopen(argv[2], "r");
++// if (fp) {
++// fgets(line_old, sizeof(line_old), fp);
++// fclose(fp);
++// }
++// if (strcmp(line_old, line_new) != 0) {
+ fp = fopen(argv[2], "w");
+ if (!fp)
+ return 1;
+ fputs(line_new, fp);
+- }
++// }
+ }
+
+ return 0;
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/defconfig b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/defconfig
index ffea6be87..c0459d596 100644
--- a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/defconfig
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/defconfig
@@ -135,7 +135,7 @@ CONFIG_FEATURE_SEAMLESS_LZMA=y
CONFIG_FEATURE_SEAMLESS_BZ2=y
CONFIG_FEATURE_SEAMLESS_GZ=y
CONFIG_FEATURE_SEAMLESS_Z=y
-CONFIG_AR=y
+# CONFIG_AR is not set
# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
# CONFIG_FEATURE_AR_CREATE is not set
# CONFIG_UNCOMPRESS is not set
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/ip_fix_problem_on_mips64_n64_big_endian_musl_systems.patch b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/ip_fix_problem_on_mips64_n64_big_endian_musl_systems.patch
new file mode 100644
index 000000000..41c565658
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/ip_fix_problem_on_mips64_n64_big_endian_musl_systems.patch
@@ -0,0 +1,90 @@
+From 4ab372d49a6e82b0bf097dedb96d26330c5f2d5f Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Sun, 24 Apr 2016 17:39:02 +0200
+Subject: [PATCH] ip: fix problem on mips64 n64 big endian musl systems
+
+Use designated initializers for struct msghdr.
+The struct layout is non-portable and musl libc does not match what busybox expects.
+
+Signed-off-by: Szabolcs Nagy <nsz@port70.net>
+Tested-by: Waldemar Brodkorb <wbx@openadk.org>
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+
+Upstream-Status: Backport
+
+https://git.busybox.net/busybox/commit/?id=4ab372d49a6e82b0bf097dedb96d26330c5f2d5f
+
+Signed-off-by: Armin Kuster <akuster@mvista.com>
+
+---
+ networking/libiproute/libnetlink.c | 37 ++++++++++++++++++++++++-------------
+ 1 file changed, 24 insertions(+), 13 deletions(-)
+
+diff --git a/networking/libiproute/libnetlink.c b/networking/libiproute/libnetlink.c
+index c7533a4..cbb5daf 100644
+--- a/networking/libiproute/libnetlink.c
++++ b/networking/libiproute/libnetlink.c
+@@ -71,11 +71,15 @@ int FAST_FUNC rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, in
+ struct nlmsghdr nlh;
+ struct sockaddr_nl nladdr;
+ struct iovec iov[2] = { { &nlh, sizeof(nlh) }, { req, len } };
++ /* Use designated initializers, struct layout is non-portable */
+ struct msghdr msg = {
+- (void*)&nladdr, sizeof(nladdr),
+- iov, 2,
+- NULL, 0,
+- 0
++ .msg_name = (void*)&nladdr,
++ .msg_namelen = sizeof(nladdr),
++ .msg_iov = iov,
++ .msg_iovlen = 2,
++ .msg_control = NULL,
++ .msg_controllen = 0,
++ .msg_flags = 0
+ };
+
+ memset(&nladdr, 0, sizeof(nladdr));
+@@ -104,12 +108,15 @@ static int rtnl_dump_filter(struct rtnl_handle *rth,
+ while (1) {
+ int status;
+ struct nlmsghdr *h;
+-
++ /* Use designated initializers, struct layout is non-portable */
+ struct msghdr msg = {
+- (void*)&nladdr, sizeof(nladdr),
+- &iov, 1,
+- NULL, 0,
+- 0
++ .msg_name = (void*)&nladdr,
++ .msg_namelen = sizeof(nladdr),
++ .msg_iov = &iov,
++ .msg_iovlen = 1,
++ .msg_control = NULL,
++ .msg_controllen = 0,
++ .msg_flags = 0
+ };
+
+ status = recvmsg(rth->fd, &msg, 0);
+@@ -211,11 +218,15 @@ int FAST_FUNC rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
+ struct sockaddr_nl nladdr;
+ struct iovec iov = { (void*)n, n->nlmsg_len };
+ char *buf = xmalloc(8*1024); /* avoid big stack buffer */
++ /* Use designated initializers, struct layout is non-portable */
+ struct msghdr msg = {
+- (void*)&nladdr, sizeof(nladdr),
+- &iov, 1,
+- NULL, 0,
+- 0
++ .msg_name = (void*)&nladdr,
++ .msg_namelen = sizeof(nladdr),
++ .msg_iov = &iov,
++ .msg_iovlen = 1,
++ .msg_control = NULL,
++ .msg_controllen = 0,
++ .msg_flags = 0
+ };
+
+ memset(&nladdr, 0, sizeof(nladdr));
+--
+2.3.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/makefile-fix-backport.patch b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/makefile-fix-backport.patch
new file mode 100644
index 000000000..2e9842e5e
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/makefile-fix-backport.patch
@@ -0,0 +1,40 @@
+From 9e5820a86277818c2f83c11c2aa76d7f0a38283e Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Sun, 14 Aug 2016 02:54:27 +0200
+Subject: build system: fix include/NUM_APPLETS.h generation
+
+TBH, it's more like "work around my bad makefile-fu" than "fix"...
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+---
+ applets/Kbuild.src | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+Upstream-Status: Backport
+
+diff --git a/applets/Kbuild.src b/applets/Kbuild.src
+index b612399..5cc1827 100644
+--- a/applets/Kbuild.src
++++ b/applets/Kbuild.src
+@@ -29,7 +29,7 @@ applets/applets.o: include/usage_compressed.h include/applet_tables.h
+
+ applets/applet_tables: .config include/applets.h
+ applets/usage: .config include/applets.h
+-applets/usage_pod: .config include/applet_tables.h include/applets.h
++applets/usage_pod: .config include/applets.h include/applet_tables.h include/NUM_APPLETS.h
+
+ quiet_cmd_gen_usage_compressed = GEN include/usage_compressed.h
+ cmd_gen_usage_compressed = $(srctree_slash)applets/usage_compressed include/usage_compressed.h applets
+@@ -40,8 +40,5 @@ include/usage_compressed.h: applets/usage $(srctree_slash)applets/usage_compress
+ quiet_cmd_gen_applet_tables = GEN include/applet_tables.h
+ cmd_gen_applet_tables = applets/applet_tables include/applet_tables.h include/NUM_APPLETS.h
+
+-include/applet_tables.h: applets/applet_tables
+- $(call cmd,gen_applet_tables)
+-
+-include/NUM_APPLETS.h: applets/applet_tables
++include/applet_tables.h include/NUM_APPLETS.h: applets/applet_tables
+ $(call cmd,gen_applet_tables)
+--
+cgit v0.12
+
diff --git a/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/makefile-libbb-race.patch b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/makefile-libbb-race.patch
new file mode 100644
index 000000000..97278ab97
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-core/busybox/busybox/makefile-libbb-race.patch
@@ -0,0 +1,34 @@
+There is a potential race when building libbb, as some header files
+needed by libbb are not generated yet (or are being modified) at the time
+libbb is compiled.
+This patch avoids this scenario by building libbb as the last directory.
+
+Upstream-Status: Submitted
+Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
+
+Index: busybox-1.24.1/Makefile
+===================================================================
+diff --git a/Makefile b/Makefile
+index 5cfc763..69f3831 100644
+--- a/Makefile
++++ b/Makefile
+@@ -738,9 +738,18 @@ $(sort $(busybox-all)): $(busybox-dirs) ;
+ # Error messages still appears in the original language
+
+ PHONY += $(busybox-dirs)
+-$(busybox-dirs): prepare scripts
++
++libbb-dir = $(filter libbb,$(busybox-dirs))
++busybox-dirs1 = $(filter-out libbb,$(busybox-dirs))
++
++$(busybox-dirs1): prepare scripts
+ $(Q)$(MAKE) $(build)=$@
+
++ifneq ($(libbb-dir),)
++$(libbb-dir): | $(busybox-dirs1)
++ $(Q)$(MAKE) $(build)=$@
++endif
++
+ # Build the kernel release string
+ # The KERNELRELEASE is stored in a file named .kernelrelease
+ # to be used when executing for example make install or make modules_install
OpenPOWER on IntegriCloud