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-protocols/net-snmp/files/init b/import-layers/meta-openembedded/meta-networking/recipes-protocols/net-snmp/files/init
index 2b8fe18..4799546 100755
--- a/import-layers/meta-openembedded/meta-networking/recipes-protocols/net-snmp/files/init
+++ b/import-layers/meta-openembedded/meta-networking/recipes-protocols/net-snmp/files/init
@@ -3,9 +3,6 @@
 
 . /etc/init.d/functions
 
-test -x /usr/sbin/snmpd || exit 0
-test -x /usr/sbin/snmptrapd || exit 0
-
 # Defaults
 export MIBDIRS=/usr/share/snmp/mibs
 SNMPDRUN=yes
@@ -18,6 +15,9 @@
 # Reads config file if exists (will override defaults above)
 [ -r /etc/default/snmpd ] && . /etc/default/snmpd
 
+[ "$SNMPDRUN" = "yes" ] && { test -x /usr/sbin/snmpd || exit 0; }
+[ "$TRAPDRUN" = "yes" ] && { test -x /usr/sbin/snmptrapd || exit 0; }
+
 case "$1" in
   start)
     echo -n "Starting network management services:"
diff --git a/import-layers/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch b/import-layers/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch
new file mode 100644
index 0000000..efe8038
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch
@@ -0,0 +1,45 @@
+From e47c60dc7f649959f63e56bc62355de4bdfd73f4 Mon Sep 17 00:00:00 2001
+From: Marian Florea <marian.florea@windriver.com>
+Date: Thu, 20 Jul 2017 16:55:24 +0800
+Subject: [PATCH] net snmp: fix engineBoots value on SIGHUP
+
+Upstream-Status: Pending
+
+Signed-off-by: Marian Florea <marian.florea@windriver.com>
+Signed-off-by: Li Zhou <li.zhou@windriver.com>
+---
+ agent/snmpd.c    | 1 +
+ snmplib/snmpv3.c | 4 ++--
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/agent/snmpd.c b/agent/snmpd.c
+index 056048a..12a7ea1 100644
+--- a/agent/snmpd.c
++++ b/agent/snmpd.c
+@@ -1246,6 +1246,7 @@ receive(void)
+ 	    snmp_log(LOG_INFO, "NET-SNMP version %s restarted\n",
+ 		     netsnmp_get_version());
+             update_config();
++            snmp_store(app_name);
+             send_easy_trap(SNMP_TRAP_ENTERPRISESPECIFIC, 3);
+ #if HAVE_SIGHOLD
+             sigrelse(SIGHUP);
+diff --git a/snmplib/snmpv3.c b/snmplib/snmpv3.c
+index 435cafd..6ad8208 100644
+--- a/snmplib/snmpv3.c
++++ b/snmplib/snmpv3.c
+@@ -984,9 +984,9 @@ init_snmpv3_post_config(int majorid, int minorid, void *serverarg,
+     /*
+      * if our engineID has changed at all, the boots record must be set to 1 
+      */
+-    if (engineIDLen != oldEngineIDLength ||
++    if (oldEngineIDLength != (size_t)0 && (engineIDLen != oldEngineIDLength ||
+         oldEngineID == NULL || c_engineID == NULL ||
+-        memcmp(oldEngineID, c_engineID, engineIDLen) != 0) {
++        memcmp(oldEngineID, c_engineID, engineIDLen) != 0)) {
+         engineBoots = 1;
+     }
+ 
+-- 
+1.9.1
+
diff --git a/import-layers/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-fix-for-disable-des.patch b/import-layers/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-fix-for-disable-des.patch
new file mode 100644
index 0000000..25eb9c9
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-fix-for-disable-des.patch
@@ -0,0 +1,32 @@
+From 270e952f58a7e5ddeabe5a15e3ddaaadf40017d0 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang@windriver.com>
+Date: Thu, 22 Jun 2017 10:25:08 +0800
+Subject: [PATCH] net-snmp: fix for --disable-des
+
+Include des.h only if it's found in openssl so that
+the --disable-des works correctly.
+
+Upstream-Status: Submitted [net-snmp-coders@lists.sourceforge.net]
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+---
+ snmplib/scapi.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/snmplib/scapi.c b/snmplib/scapi.c
+index 16ac829..271684b 100644
+--- a/snmplib/scapi.c
++++ b/snmplib/scapi.c
+@@ -79,7 +79,9 @@ netsnmp_feature_child_of(usm_scapi, usm_support)
+ #include <openssl/hmac.h>
+ #include <openssl/evp.h>
+ #include <openssl/rand.h>
++#ifdef HAVE_OPENSSL_DES_H
+ #include <openssl/des.h>
++#endif
+ #ifdef HAVE_AES
+ #include <openssl/aes.h>
+ #endif
+-- 
+2.11.0
+
diff --git a/import-layers/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb b/import-layers/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb
index 2d6887e..849ae07 100644
--- a/import-layers/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb
+++ b/import-layers/meta-openembedded/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb
@@ -30,6 +30,8 @@
            file://0002-configure-fix-a-cc-check-issue.patch \
            file://0003-CHANGES-BUG-2712-Fix-Perl-module-compilation.patch \
            file://0004-configure-fix-incorrect-variable.patch \
+           file://net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch \
+           file://net-snmp-fix-for-disable-des.patch \
            "
 SRC_URI[md5sum] = "9f682bd70c717efdd9f15b686d07baee"
 SRC_URI[sha256sum] = "e8dfc79b6539b71a6ff335746ce63d2da2239062ad41872fff4354cafed07a3e"
@@ -58,7 +60,8 @@
                 --with-defaults \
                 --with-install-prefix=${D} \
                 --with-persistent-directory=${localstatedir}/lib/net-snmp \
-                ${@base_conditional('SITEINFO_ENDIANNESS', 'le', '--with-endianness=little', '--with-endianness=big', d)}"
+                ${@base_conditional('SITEINFO_ENDIANNESS', 'le', '--with-endianness=little', '--with-endianness=big', d)} \
+"
 
 # net-snmp needs to have mib-modules=smux enabled to enable quagga to support snmp
 EXTRA_OECONF += "--with-mib-modules=smux"