Yocto 2.4

Move OpenBMC to Yocto 2.4(rocko)

Tested: Built and verified Witherspoon and Palmetto images
Change-Id: I12057b18610d6fb0e6903c60213690301e9b0c67
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/import-layers/meta-openembedded/meta-networking/recipes-extended/corosync/corosync/0001-Include-fcntl.h-for-F_-and-O_-defines.patch b/import-layers/meta-openembedded/meta-networking/recipes-extended/corosync/corosync/0001-Include-fcntl.h-for-F_-and-O_-defines.patch
new file mode 100644
index 0000000..fe4b079
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-networking/recipes-extended/corosync/corosync/0001-Include-fcntl.h-for-F_-and-O_-defines.patch
@@ -0,0 +1,28 @@
+From 85ea47fedbc96ed9180e08b0d371d9966e3a88da Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 30 Aug 2017 17:28:55 -0700
+Subject: [PATCH] Include fcntl.h for F_* and O_* defines
+
+Fixes errors like
+utils.c:95:22: error: use of undeclared identifier 'O_WRONLY'
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ qdevices/utils.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/qdevices/utils.c b/qdevices/utils.c
+index 41850b8c..87090853 100644
+--- a/qdevices/utils.c
++++ b/qdevices/utils.c
+@@ -39,6 +39,7 @@
+ 
+ #include <err.h>
+ #include <errno.h>
++#include <fcntl.h>
+ #include <inttypes.h>
+ #include <libgen.h>
+ #include <stdio.h>
+-- 
+2.14.1
+
diff --git a/import-layers/meta-openembedded/meta-networking/recipes-extended/corosync/corosync_2.4.2.bb b/import-layers/meta-openembedded/meta-networking/recipes-extended/corosync/corosync_2.4.2.bb
new file mode 100644
index 0000000..33e74e2
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-networking/recipes-extended/corosync/corosync_2.4.2.bb
@@ -0,0 +1,80 @@
+SUMMARY = "The Corosync Cluster Engine and Application Programming Interfaces"
+DESCRIPTION = "This package contains the Corosync Cluster Engine Executive, several default \
+APIs and libraries, default configuration files, and an init script."
+HOMEPAGE = "http://corosync.github.io/corosync/"
+
+SECTION = "base"
+
+inherit autotools pkgconfig systemd useradd
+
+SRC_URI = "http://build.clusterlabs.org/corosync/releases/${BP}.tar.gz \
+           file://0001-Include-fcntl.h-for-F_-and-O_-defines.patch \
+          "
+SRC_URI[md5sum] = "547fa78704da53aa35912be58d31035f"
+SRC_URI[sha256sum] = "f26e3011309fe4bcce94b1dc20ea8c462f19483a73f3ca62f13b925d011a4ba9"
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=a85eb4ce24033adb6088dd1d6ffc5e5d"
+
+DEPENDS = "groff-native nss libqb"
+
+SYSTEMD_SERVICE_${PN} = "corosync.service corosync-notifyd.service \
+                         ${@bb.utils.contains('PACKAGECONFIG', 'qdevice', 'corosync-qdevice.service', '', d)} \
+                         ${@bb.utils.contains('PACKAGECONFIG', 'qnetd', 'corosync-qnetd.service', '', d)} \
+"
+SYSTEMD_AUTO_ENABLE = "enable"
+
+INITSCRIPT_NAME = "corosync-daemon"
+
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
+                   dbus qdevice qnetd snmp \
+"
+
+PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,dbus"
+PACKAGECONFIG[qdevice] = "--enable-qdevices,--disable-qdevices"
+PACKAGECONFIG[qnetd] = "--enable-qnetd,--disable-qnetd"
+PACKAGECONFIG[rdma] = "--enable-rdma,--disable-rdma"
+PACKAGECONFIG[snmp] = "--enable-snmp,--disable-snmp,net-snmp"
+PACKAGECONFIG[systemd] = "--enable-systemd --with-systemddir=${systemd_system_unitdir},--disable-systemd --without-systemddir,systemd"
+
+EXTRA_OECONF = "ac_cv_path_BASHPATH=${base_bindir}/bash"
+EXTRA_OEMAKE = "tmpfilesdir_DATA="
+
+do_configure_prepend() {
+    ( cd ${S}
+    ${S}/autogen.sh )
+}
+
+do_install_append() {
+    install -d ${D}${sysconfdir}/sysconfig/
+    install -m 0644 ${S}/init/corosync.sysconfig.example ${D}${sysconfdir}/sysconfig/corosync
+    install -m 0644 ${S}/tools/corosync-notifyd.sysconfig.example ${D}${sysconfdir}/sysconfig/corosync-notifyd
+
+    rm -rf "${D}${localstatedir}/run"
+
+    install -d ${D}${sysconfdir}/default/volatiles
+    echo "d root root 0755 ${localstatedir}/log/cluster none" > ${D}${sysconfdir}/default/volatiles/05_corosync
+
+    if ${@bb.utils.contains('PACKAGECONFIG', 'qnetd', 'true', 'false', d)}; then
+        chown -R coroqnetd:coroqnetd ${D}${sysconfdir}/${BPN}/qnetd
+        echo "d coroqnetd coroqnetd 0770 /var/run/corosync-qnetd none" >> ${D}${sysconfdir}/default/volatiles/05_corosync
+    fi
+
+    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+        install -d ${D}${sysconfdir}/tmpfiles.d
+        echo "d ${localstatedir}/log/cluster - - - -" > ${D}${sysconfdir}/tmpfiles.d/corosync.conf
+
+        if ${@bb.utils.contains('PACKAGECONFIG', 'qnetd', 'true', 'false', d)}; then
+            install -m 0644 ${S}/conf/tmpfiles.d/corosync-qnetd.conf ${D}${sysconfdir}/tmpfiles.d
+        fi
+    fi
+}
+
+RDEPENDS_${PN} += "bash"
+
+FILES_${PN}-dbg += "${libexecdir}/lcrso/.debug"
+FILES_${PN}-doc += "${datadir}/snmp/mibs/COROSYNC-MIB.txt"
+
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "--system coroqnetd"
+USERADD_PARAM_${PN} = "--system -d / -M -s /bin/nologin -c 'User for corosync-qnetd' -g coroqnetd coroqnetd"
diff --git a/import-layers/meta-openembedded/meta-networking/recipes-extended/dlm/dlm/respect-ldflags-also-from-bin_ldflags.patch b/import-layers/meta-openembedded/meta-networking/recipes-extended/dlm/dlm/respect-ldflags-also-from-bin_ldflags.patch
new file mode 100644
index 0000000..69b2f90
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-networking/recipes-extended/dlm/dlm/respect-ldflags-also-from-bin_ldflags.patch
@@ -0,0 +1,36 @@
+diff -uNr dlm-4.0.2.orig/dlm_controld/Makefile dlm-4.0.2/dlm_controld/Makefile
+--- dlm-4.0.2.orig/dlm_controld/Makefile	2017-04-04 10:49:23.661320260 +0200
++++ dlm-4.0.2/dlm_controld/Makefile	2017-04-04 10:50:36.121326429 +0200
+@@ -55,7 +55,7 @@
+ BIN_CFLAGS += -fPIE -DPIE
+ BIN_CFLAGS += -I../include -I../libdlm
+ 
+-BIN_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
++BIN_LDFLAGS += $(LDFLAGS) -Wl,-z,now -Wl,-z,relro -pie
+ BIN_LDFLAGS += -lpthread -lrt -lcpg -lcmap -lcfg -lquorum
+ 
+ LIB_CFLAGS += $(BIN_CFLAGS)
+diff -uNr dlm-4.0.2.orig/dlm_tool/Makefile dlm-4.0.2/dlm_tool/Makefile
+--- dlm-4.0.2.orig/dlm_tool/Makefile	2013-07-31 17:50:26.000000000 +0200
++++ dlm-4.0.2/dlm_tool/Makefile	2017-04-04 10:50:44.617327153 +0200
+@@ -32,7 +32,7 @@
+ BIN_CFLAGS += -fPIE -DPIE
+ BIN_CFLAGS += -I../include -I../libdlm -I../dlm_controld
+ 
+-BIN_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
++BIN_LDFLAGS += $(LDFLAGS) -Wl,-z,now -Wl,-z,relro -pie
+ BIN_LDFLAGS += -L../libdlm -L../dlm_controld
+ BIN_LDFLAGS += -lpthread -ldlm -ldlmcontrol
+ 
+diff -uNr dlm-4.0.2.orig/dlm_controld/Makefile dlm-4.0.2/dlm_controld/Makefile
+--- dlm-4.0.2.orig/dlm_controld/Makefile	2017-04-04 11:02:58.578389641 +0200
++++ dlm-4.0.2/dlm_controld/Makefile	2017-04-04 11:07:55.672414935 +0200
+@@ -59,7 +59,7 @@
+ BIN_LDFLAGS += -lpthread -lrt -lcpg -lcmap -lcfg -lquorum
+ 
+ LIB_CFLAGS += $(BIN_CFLAGS)
+-LIB_LDFLAGS += -Wl,-z,relro -pie
++LIB_LDFLAGS += $(LDFLAGS) -Wl,-z,relro -pie
+ 
+ ifeq ($(USE_SD_NOTIFY),yes)
+ 	BIN_CFLAGS += $(shell pkg-config --cflags libsystemd-daemon) \
diff --git a/import-layers/meta-openembedded/meta-networking/recipes-extended/dlm/dlm_4.0.2.bb b/import-layers/meta-openembedded/meta-networking/recipes-extended/dlm/dlm_4.0.2.bb
new file mode 100644
index 0000000..31e411e
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-networking/recipes-extended/dlm/dlm_4.0.2.bb
@@ -0,0 +1,51 @@
+DESCRIPTION = "dlm control daemon and tool"
+
+SECTION = "utils"
+HOMEPAGE = "https://fedorahosted.org/cluster/wiki/HomePage"
+
+REQUIRED_DISTRO_FEATURES = "systemd"
+
+SRC_URI = "https://git.fedorahosted.org/cgit/dlm.git/snapshot/${BP}.tar.xz \
+    file://respect-ldflags-also-from-bin_ldflags.patch \
+"
+
+SRC_URI[md5sum] = "efc2ee6093aa6aa0a88aaad83e998a3f"
+SRC_URI[sha256sum] = "b89bc557aaffbab0ac005398025f247718a5589cff6574d902eaffe2b20e683e"
+
+LICENSE = "LGPLv2+ & GPLv2 & GPLv2+"
+LIC_FILES_CHKSUM = "file://README.license;md5=8f0bbcdd678df1bce9863492b6c8832d"
+
+DEPENDS = "corosync systemd"
+
+inherit pkgconfig systemd distro_features_check
+
+SYSTEMD_SERVICE_${PN} = "dlm.service"
+SYSTEMD_AUTO_ENABLE = "enable"
+
+export EXTRA_OEMAKE = ""
+
+do_compile_prepend() {
+    sed -i "s/libsystemd-daemon/libsystemd/g" ${S}/dlm_controld/Makefile
+}
+
+do_compile () {
+    oe_runmake 'CC=${CC}'
+}
+
+do_install_append (){
+    install -d ${D}${sysconfdir}/sysconfig/
+    install -d ${D}${sysconfdir}/init.d/
+    install -m 0644 ${S}/init/dlm.sysconfig ${D}${sysconfdir}/sysconfig/dlm
+    install -m 0644 ${S}/init/dlm.init ${D}${sysconfdir}/init.d/dlm
+
+    # install systemd unit files
+    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+        install -d ${D}${systemd_unitdir}/system
+        install -m 0644 ${S}/init/dlm.service ${D}${systemd_unitdir}/system
+    fi
+}
+
+do_install() {
+    oe_runmake install DESTDIR=${D} LIBDIR=${libdir}
+}
+
diff --git a/import-layers/meta-openembedded/meta-networking/recipes-extended/iscsitarget/files/0001-kernel-event-netlink_ack-now-requires-4-arguments.patch b/import-layers/meta-openembedded/meta-networking/recipes-extended/iscsitarget/files/0001-kernel-event-netlink_ack-now-requires-4-arguments.patch
new file mode 100644
index 0000000..4426d35
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-networking/recipes-extended/iscsitarget/files/0001-kernel-event-netlink_ack-now-requires-4-arguments.patch
@@ -0,0 +1,40 @@
+From cbc5f8151017f45231b75a826f18354a81c287c4 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 26 Aug 2017 07:52:59 -0700
+Subject: [PATCH] kernel/event: netlink_ack() now requires 4 arguments
+
+see https://patchwork.kernel.org/patch/9670181/
+
+event.c:32:4: error: too few arguments to function 'netlink_ack'
+|     netlink_ack(skb, nlh, 0);
+|     ^~~~~~~~~~~
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ kernel/event.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: iscsitarget-1.4.20.3+svn502/kernel/event.c
+===================================================================
+--- iscsitarget-1.4.20.3+svn502.orig/kernel/event.c
++++ iscsitarget-1.4.20.3+svn502/kernel/event.c
+@@ -6,6 +6,7 @@
+  * Some functions are based on audit code.
+  */
+ 
++#include <linux/version.h>
+ #include <linux/module.h>
+ #include <net/tcp.h>
+ #include "iet_u.h"
+@@ -29,7 +30,11 @@ static void event_recv_skb(struct sk_buf
+ 		ietd_pid = NETLINK_CB(skb).portid;
+ 		WARN_ON(ietd_pid == 0);
+ 		if (nlh->nlmsg_flags & NLM_F_ACK)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++			netlink_ack(skb, nlh, 0, NULL);
++#else
+ 			netlink_ack(skb, nlh, 0);
++#endif
+ 		skb_pull(skb, rlen);
+ 	}
+ }
diff --git a/import-layers/meta-openembedded/meta-networking/recipes-extended/iscsitarget/iscsitarget_1.4.20.3+svn502.bb b/import-layers/meta-openembedded/meta-networking/recipes-extended/iscsitarget/iscsitarget_1.4.20.3+svn502.bb
index 5c1e38e..6593661 100644
--- a/import-layers/meta-openembedded/meta-networking/recipes-extended/iscsitarget/iscsitarget_1.4.20.3+svn502.bb
+++ b/import-layers/meta-openembedded/meta-networking/recipes-extended/iscsitarget/iscsitarget_1.4.20.3+svn502.bb
@@ -14,7 +14,9 @@
            file://access-sk_v6_daddr-iff-IPV6-defined.patch \
            file://build_with_updated_bio_struct_of_linux_v4.3_and_above.patch \
            file://build_with_updated_interfaces_of_linux_v4.8_and_above.patch \
-           file://fix-call-trace-of-ahash-API-calling.patch"
+           file://fix-call-trace-of-ahash-API-calling.patch \
+           file://0001-kernel-event-netlink_ack-now-requires-4-arguments.patch \
+           "
 
 SRC_URI[md5sum] = "ef9bc823bbabd3c772208c00d5f2d089"
 SRC_URI[sha256sum] = "d3196ccb78a43266dce28587bfe30d8ab4db7566d7bce96057dfbb84100babb5"