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/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"