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/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0001-Revert-media-ctl-Don-t-install-libmediactl-and-libv4.patch b/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0001-Revert-media-ctl-Don-t-install-libmediactl-and-libv4.patch
index 4b3de3c..7413094 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0001-Revert-media-ctl-Don-t-install-libmediactl-and-libv4.patch
+++ b/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0001-Revert-media-ctl-Don-t-install-libmediactl-and-libv4.patch
@@ -1,4 +1,4 @@
-From 4ee15a8a69b84526ece1180a288a37db077bcd9b Mon Sep 17 00:00:00 2001
+From 2d6bfa75b2e16b4d764f1bf00bb902fb4b5e507b Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 27 Feb 2015 21:55:36 +0000
 Subject: [PATCH] Revert "media-ctl: Don't install libmediactl and
@@ -11,23 +11,27 @@
 Conflicts:
 	utils/media-ctl/Makefile.am
 ---
- utils/media-ctl/Makefile.am | 11 +++--------
- 1 file changed, 3 insertions(+), 8 deletions(-)
+ utils/media-ctl/Makefile.am | 10 +++-------
+ 1 file changed, 3 insertions(+), 7 deletions(-)
 
 diff --git a/utils/media-ctl/Makefile.am b/utils/media-ctl/Makefile.am
-index a3931fb..fe1fea5 100644
+index ee7dcc9..d11fa2e 100644
 --- a/utils/media-ctl/Makefile.am
 +++ b/utils/media-ctl/Makefile.am
-@@ -1,14 +1,9 @@
+@@ -1,8 +1,7 @@
 -noinst_LTLIBRARIES = libmediactl.la libv4l2subdev.la
 -
 +lib_LTLIBRARIES = libmediactl.la libv4l2subdev.la
  libmediactl_la_SOURCES = libmediactl.c mediactl-priv.h
 -libmediactl_la_CFLAGS = -static $(LIBUDEV_CFLAGS)
 -libmediactl_la_LDFLAGS = -static $(LIBUDEV_LIBS)
--
 +libmediactl_la_CFLAGS = $(LIBUDEV_CFLAGS)
 +libmediactl_la_LDFLAGS = $(LIBUDEV_LIBS)
+ 
+ media-bus-format-names.h: ../../include/linux/media-bus-format.h
+ 	sed -e '/#define MEDIA_BUS_FMT/ ! d; s/.*FMT_//; /FIXED/ d; s/\t.*//; s/.*/{ \"&\", MEDIA_BUS_FMT_& },/;' \
+@@ -18,9 +17,6 @@ CLEANFILES = $(BUILT_SOURCES)
+ nodist_libv4l2subdev_la_SOURCES = $(BUILT_SOURCES)
  libv4l2subdev_la_SOURCES = libv4l2subdev.c
  libv4l2subdev_la_LIBADD = libmediactl.la
 -libv4l2subdev_la_CFLAGS = -static
@@ -37,5 +41,5 @@
  noinst_HEADERS = mediactl.h v4l2subdev.h
  
 -- 
-2.1.4
+2.9.3
 
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0001-buildsystem-do-not-assume-building-in-source-tree.patch b/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0001-buildsystem-do-not-assume-building-in-source-tree.patch
new file mode 100644
index 0000000..54161f9
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0001-buildsystem-do-not-assume-building-in-source-tree.patch
@@ -0,0 +1,110 @@
+From 806822f5acb756d5acda0f9063c84b28b38b3ffb Mon Sep 17 00:00:00 2001
+From: Ismo Puustinen <ismo.puustinen@intel.com>
+Date: Mon, 3 Apr 2017 13:23:38 +0300
+Subject: [PATCH v4l-utils] buildsystem: do not assume building in source tree.
+
+Use $(top_srcdir) as reference for include paths and buildtime scripts.
+Otherwise compilation outside of project root directory will fail
+because header and script paths are wrong.
+
+To reproduce: mkdir b; cd b; ../configure; make
+
+Upstream-status: Accepted [https://git.linuxtv.org//v4l-utils.git/commit/?id=bd98c9a99bffc8d44c54859345e4dfee0ada4275]
+
+Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
+---
+ utils/cec-compliance/Makefile.am  | 2 +-
+ utils/cec-ctl/Makefile.am         | 2 +-
+ utils/cec-follower/Makefile.am    | 4 ++--
+ utils/qv4l2/Makefile.am           | 2 +-
+ utils/v4l2-compliance/Makefile.am | 2 +-
+ utils/v4l2-ctl/Makefile.am        | 2 +-
+ 6 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/utils/cec-compliance/Makefile.am b/utils/cec-compliance/Makefile.am
+index ec5de51..8331aa0 100644
+--- a/utils/cec-compliance/Makefile.am
++++ b/utils/cec-compliance/Makefile.am
+@@ -7,7 +7,7 @@ cec_compliance_LDFLAGS = -lrt
+ cec-compliance.cpp: cec-table.h
+ 
+ cec-table.h: ../cec-ctl/msg2ctl.pl ../../include/linux/cec.h ../../include/linux/cec-funcs.h
+-	../cec-ctl/msg2ctl.pl 2 ../../include/linux/cec.h ../../include/linux/cec-funcs.h >$@
++	$(top_srcdir)/utils/cec-ctl/msg2ctl.pl 2 $(top_srcdir)/include/linux/cec.h $(top_srcdir)/include/linux/cec-funcs.h >$@
+ 
+ cec-compliance.cpp: version.h
+ 
+diff --git a/utils/cec-ctl/Makefile.am b/utils/cec-ctl/Makefile.am
+index 0a7ef22..6afb6c9 100644
+--- a/utils/cec-ctl/Makefile.am
++++ b/utils/cec-ctl/Makefile.am
+@@ -7,7 +7,7 @@ cec_ctl_LDFLAGS = -lrt
+ cec-ctl.cpp: cec-ctl-gen.h
+ 
+ cec-ctl-gen.h: msg2ctl.pl ../../include/linux/cec.h ../../include/linux/cec-funcs.h
+-	./msg2ctl.pl 0 ../../include/linux/cec.h ../../include/linux/cec-funcs.h >$@
++	$(top_srcdir)/utils/cec-ctl/msg2ctl.pl 0 $(top_srcdir)/include/linux/cec.h $(top_srcdir)/include/linux/cec-funcs.h >$@
+ 
+ clean-local:
+ 	-rm -vf cec-ctl-gen.h
+diff --git a/utils/cec-follower/Makefile.am b/utils/cec-follower/Makefile.am
+index 538edb2..fdbf3d9 100644
+--- a/utils/cec-follower/Makefile.am
++++ b/utils/cec-follower/Makefile.am
+@@ -7,12 +7,12 @@ cec_follower_LDFLAGS = -lrt
+ cec-log.cpp: cec-log.h
+ 
+ cec-log.h: ../cec-ctl/msg2ctl.pl ../../include/linux/cec.h ../../include/linux/cec-funcs.h
+-	../cec-ctl/msg2ctl.pl 1 ../../include/linux/cec.h ../../include/linux/cec-funcs.h >$@
++	$(top_srcdir)/utils/cec-ctl/msg2ctl.pl 1 $(top_srcdir)/include/linux/cec.h $(top_srcdir)/include/linux/cec-funcs.h >$@
+ 
+ cec-follower.cpp: cec-table.h version.h
+ 
+ cec-table.h: ../cec-ctl/msg2ctl.pl ../../include/linux/cec.h ../../include/linux/cec-funcs.h
+-	../cec-ctl/msg2ctl.pl 2 ../../include/linux/cec.h ../../include/linux/cec-funcs.h >$@
++	$(top_srcdir)/utils/cec-ctl/msg2ctl.pl 2 $(top_srcdir)/include/linux/cec.h $(top_srcdir)/include/linux/cec-funcs.h >$@
+ 
+ version.h:
+ 	@if git rev-parse HEAD >/dev/null 2>&1; then \
+diff --git a/utils/qv4l2/Makefile.am b/utils/qv4l2/Makefile.am
+index fd58486..ccd1a2a 100644
+--- a/utils/qv4l2/Makefile.am
++++ b/utils/qv4l2/Makefile.am
+@@ -8,7 +8,7 @@ qv4l2_SOURCES = qv4l2.cpp general-tab.cpp ctrl-tab.cpp vbi-tab.cpp capture-win.c
+ nodist_qv4l2_SOURCES = moc_qv4l2.cpp moc_general-tab.cpp moc_capture-win.cpp moc_vbi-tab.cpp qrc_qv4l2.cpp
+ qv4l2_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la \
+   ../libv4l2util/libv4l2util.la ../libmedia_dev/libmedia_dev.la
+-qv4l2_CPPFLAGS = -I../common
++qv4l2_CPPFLAGS = -I$(top_srcdir)/utils/common
+ 
+ if WITH_QTGL
+ qv4l2_CPPFLAGS += $(QTGL_CFLAGS)
+diff --git a/utils/v4l2-compliance/Makefile.am b/utils/v4l2-compliance/Makefile.am
+index 03db8df..18b9892 100644
+--- a/utils/v4l2-compliance/Makefile.am
++++ b/utils/v4l2-compliance/Makefile.am
+@@ -5,7 +5,7 @@ DEFS :=
+ v4l2_compliance_SOURCES = v4l2-compliance.cpp v4l2-test-debug.cpp v4l2-test-input-output.cpp \
+ 	v4l2-test-controls.cpp v4l2-test-io-config.cpp v4l2-test-formats.cpp v4l2-test-buffers.cpp \
+ 	v4l2-test-codecs.cpp v4l2-test-colors.cpp v4l2-compliance.h
+-v4l2_compliance_CPPFLAGS = -I../common
++v4l2_compliance_CPPFLAGS = -I$(top_srcdir)/utils/common
+ 
+ if WITH_V4L2_COMPLIANCE_LIBV4L
+ v4l2_compliance_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lrt -lpthread
+diff --git a/utils/v4l2-ctl/Makefile.am b/utils/v4l2-ctl/Makefile.am
+index 955647d..825e53f 100644
+--- a/utils/v4l2-ctl/Makefile.am
++++ b/utils/v4l2-ctl/Makefile.am
+@@ -7,7 +7,7 @@ v4l2_ctl_SOURCES = v4l2-ctl.cpp v4l2-ctl.h v4l2-ctl-common.cpp v4l2-ctl-tuner.cp
+ 	v4l2-ctl-overlay.cpp v4l2-ctl-vbi.cpp v4l2-ctl-selection.cpp v4l2-ctl-misc.cpp \
+ 	v4l2-ctl-streaming.cpp v4l2-ctl-sdr.cpp v4l2-ctl-edid.cpp v4l2-ctl-modes.cpp \
+ 	v4l2-tpg-colors.c v4l2-tpg-core.c v4l-stream.c
+-v4l2_ctl_CPPFLAGS = -I../common
++v4l2_ctl_CPPFLAGS = -I$(top_srcdir)/utils/common
+ 
+ if WITH_V4L2_CTL_LIBV4L
+ v4l2_ctl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lrt -lpthread
+-- 
+2.9.3
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0001-ir-ctl-Define-TEMP_FAILURE_RETRY-if-undefined.patch b/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0001-ir-ctl-Define-TEMP_FAILURE_RETRY-if-undefined.patch
new file mode 100644
index 0000000..f1e11da
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0001-ir-ctl-Define-TEMP_FAILURE_RETRY-if-undefined.patch
@@ -0,0 +1,55 @@
+From e60aea50e41ae8a17672beb5859beecb66e7a305 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 14 Jul 2017 13:11:25 -0700
+Subject: [PATCH 1/3] ir-ctl: Define TEMP_FAILURE_RETRY if undefined
+
+use strndup() instead of strndupa() which is not
+universally available in C libraries
+
+Taken from AlpineLinux
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ utils/ir-ctl/ir-ctl.c | 14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
+index bc58cee..1a44011 100644
+--- a/utils/ir-ctl/ir-ctl.c
++++ b/utils/ir-ctl/ir-ctl.c
+@@ -42,6 +42,16 @@
+ # define _(string) string
+ #endif
+ 
++/* taken from glibc unistd.h */
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(expression) \
++  (__extension__                                                              \
++    ({ long int __result;                                                     \
++       do __result = (long int) (expression);                                 \
++       while (__result == -1L && errno == EINTR);                             \
++       __result; }))
++#endif
++
+ # define N_(string) string
+ 
+ 
+@@ -344,12 +354,14 @@ static struct file *read_scancode(const char *name)
+ 		return NULL;
+ 	}
+ 
+-	pstr = strndupa(name, p - name);
++	pstr = strndup(name, p - name);
+ 
+ 	if (!protocol_match(pstr, &proto)) {
+ 		fprintf(stderr, _("error: protocol '%s' not found\n"), pstr);
++		free(pstr);
+ 		return NULL;
+ 	}
++	free(pstr);
+ 
+ 	if (!strtoscancode(p + 1, &scancode)) {
+ 		fprintf(stderr, _("error: invalid scancode '%s'\n"), p + 1);
+-- 
+2.13.3
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0002-contrib-test-Link-mc_nextgen_test-with-libargp-if-ne.patch b/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0002-contrib-test-Link-mc_nextgen_test-with-libargp-if-ne.patch
new file mode 100644
index 0000000..2fb4057
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0002-contrib-test-Link-mc_nextgen_test-with-libargp-if-ne.patch
@@ -0,0 +1,28 @@
+From b3acc4c6407f9553f32582a9aee6a11b5fcd1d8a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 14 Jul 2017 13:17:19 -0700
+Subject: [PATCH 2/3] contrib/test: Link mc_nextgen_test with libargp if needed
+
+musl depends on external argp implementation e.g.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ contrib/test/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/contrib/test/Makefile.am b/contrib/test/Makefile.am
+index 4641e21..e47b948 100644
+--- a/contrib/test/Makefile.am
++++ b/contrib/test/Makefile.am
+@@ -32,7 +32,7 @@ v4l2gl_LDFLAGS = $(X11_LIBS) $(GL_LIBS) $(GLU_LIBS) $(ARGP_LIBS)
+ v4l2gl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la
+ 
+ mc_nextgen_test_CFLAGS = $(LIBUDEV_CFLAGS)
+-mc_nextgen_test_LDFLAGS = $(LIBUDEV_LIBS)
++mc_nextgen_test_LDFLAGS = $(ARGP_LIBS) $(LIBUDEV_LIBS)
+ 
+ 
+ ioctl_test_SOURCES = ioctl-test.c ioctl-test.h ioctl_32.h ioctl_64.h
+-- 
+2.13.3
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0003-v4l2-ctl-Do-not-use-getsubopt.patch b/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0003-v4l2-ctl-Do-not-use-getsubopt.patch
new file mode 100644
index 0000000..0a986ae
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0003-v4l2-ctl-Do-not-use-getsubopt.patch
@@ -0,0 +1,49 @@
+From d04aa6866cbea57c4a81b033cd60586a9436ac6b Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 14 Jul 2017 13:20:05 -0700
+Subject: [PATCH 3/3] v4l2-ctl: Do not use getsubopt
+
+POSIX says that behavior when subopts list is empty is undefined.
+musl libs will set value to NULL which leads to crash.
+
+Taken from AlpineLinux
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ utils/v4l2-ctl/v4l2-ctl-common.cpp | 19 ++++++++++---------
+ 1 file changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp
+index 3ea6cd3..291fb3e 100644
+--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
++++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
+@@ -692,16 +692,17 @@ static bool parse_subset(char *optarg)
+ 
+ static bool parse_next_subopt(char **subs, char **value)
+ {
+-	static char *const subopts[] = {
+-	    NULL
+-	};
+-	int opt = getsubopt(subs, subopts, value);
++	char *p = *subs;
++	*value = *subs;
+ 
+-	if (opt < 0 || *value)
+-		return false;
+-	fprintf(stderr, "No value given to suboption <%s>\n",
+-			subopts[opt]);
+-	return true;
++	while (*p && *p != ',')
++		p++;
++
++	if (*p)
++		*p++ = '\0';
++
++	*subs = p;
++	return false;
+ }
+ 
+ void common_cmd(int ch, char *optarg)
+-- 
+2.13.3
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils_1.10.1.bb b/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils_1.12.3.bb
similarity index 78%
rename from import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils_1.10.1.bb
rename to import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils_1.12.3.bb
index b9732fe..b408bb0 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils_1.10.1.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/v4l-utils_1.12.3.bb
@@ -6,6 +6,7 @@
 
 DEPENDS = "jpeg \
            ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'virtual/libx11', '', d)}"
+DEPENDS_append_libc-musl = " argp-standalone"
 
 inherit autotools gettext pkgconfig
 
@@ -14,11 +15,15 @@
 
 SRC_URI = "http://linuxtv.org/downloads/v4l-utils/v4l-utils-${PV}.tar.bz2 \
            file://0001-Revert-media-ctl-Don-t-install-libmediactl-and-libv4.patch \
+           file://0001-buildsystem-do-not-assume-building-in-source-tree.patch \
            file://mediactl-pkgconfig.patch \
            file://export-mediactl-headers.patch \
-          "
-SRC_URI[md5sum] = "936c9c58343840e91294e4dcec7dc05f"
-SRC_URI[sha256sum] = "6147ccc29fe7dd3c5c3994d613c4f2a099bac8b44694a96e5cf4d7caca8336c0"
+           file://0001-ir-ctl-Define-TEMP_FAILURE_RETRY-if-undefined.patch \
+           file://0002-contrib-test-Link-mc_nextgen_test-with-libargp-if-ne.patch \
+           file://0003-v4l2-ctl-Do-not-use-getsubopt.patch \
+           "
+SRC_URI[md5sum] = "89e1ed6c69c94e0489dc0a638c7841aa"
+SRC_URI[sha256sum] = "5a47dd6f0e7dfe902d94605c01d385a4a4e87583ff5856d6f181900ea81cf46e"
 
 EXTRA_OECONF = "--disable-qv4l2 --enable-shared --with-udevdir=${base_libdir}/udev"