aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-bsp
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-bsp')
-rw-r--r--recipes-bsp/amt/files/atnetworktool-printf-fix.patch20
-rw-r--r--recipes-bsp/amt/files/readlink-declaration.patch18
-rw-r--r--recipes-bsp/amt/lms/0001-Include-sys-select.h-for-fd_set.patch28
-rw-r--r--recipes-bsp/amt/lms/0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch31
-rw-r--r--recipes-bsp/amt/lms/0002-Use-proper-netinet-in.h-API.patch31
-rw-r--r--recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch91
-rw-r--r--recipes-bsp/amt/lms/0004-Intel-AMT-ME-real-time-notification-infra.patch2647
-rw-r--r--recipes-bsp/amt/lms7_7.1.20.bb58
-rw-r--r--recipes-bsp/amt/lms8_8.0.0-7.bb46
-rw-r--r--recipes-bsp/efilinux/efilinux/0001-Disable-address-of-packed-member-warning.patch33
-rw-r--r--recipes-bsp/efilinux/efilinux/0002-initialize-char-pointers.patch33
-rw-r--r--recipes-bsp/efilinux/efilinux_1.1.bb38
-rw-r--r--recipes-bsp/formfactor/formfactor/machconfig39
-rw-r--r--recipes-bsp/formfactor/formfactor_0.0.bbappend1
-rw-r--r--recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.conf2
-rw-r--r--recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.sh15
-rw-r--r--recipes-bsp/gma500-gfx-check/gma500-gfx-check_1.0.bb18
-rw-r--r--recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG3
-rw-r--r--recipes-bsp/rmc/boards/Galileo2/boot.conf4
-rwxr-xr-xrecipes-bsp/rmc/boards/Galileo2/gallieo2.fpbin0 -> 109 bytes
-rw-r--r--recipes-bsp/rmc/boards/Galileo2/install.conf4
-rw-r--r--recipes-bsp/rmc/boards/MinnowboardTurbot/KBOOTPARAM1
-rw-r--r--recipes-bsp/rmc/boards/MinnowboardTurbot/minnowboardturbot.fpbin0 -> 154 bytes
-rw-r--r--recipes-bsp/rmc/boards/NUC5i5RYB/BOOTENTRY.CONFIG2
-rw-r--r--recipes-bsp/rmc/boards/NUC5i5RYB/INSTALLER.CONFIG2
-rw-r--r--recipes-bsp/rmc/boards/NUC5i5RYB/POSTINSTALL.sh2
-rw-r--r--recipes-bsp/rmc/boards/NUC5i5RYB/boot.conf4
-rw-r--r--recipes-bsp/rmc/boards/NUC5i5RYB/install.conf4
-rw-r--r--recipes-bsp/rmc/boards/NUC5i5RYB/nuc5i5.fpbin0 -> 149 bytes
-rw-r--r--recipes-bsp/rmc/boards/T100-32bit/BOOTENTRY.CONFIG2
-rw-r--r--recipes-bsp/rmc/boards/T100-32bit/T100-32bit.fpbin0 -> 116 bytes
-rw-r--r--recipes-bsp/rmc/boards/T100-32bit/boot.conf4
-rw-r--r--recipes-bsp/rmc/boards/T100-32bit/install.conf4
-rw-r--r--recipes-bsp/rmc/boards/broxton-m/BOOTENTRY.CONFIG2
-rw-r--r--recipes-bsp/rmc/boards/broxton-m/INSTALLER.CONFIG3
-rw-r--r--recipes-bsp/rmc/boards/broxton-m/KBOOTPARAM1
-rw-r--r--recipes-bsp/rmc/boards/broxton-m/POSTINSTALL.sh2
-rwxr-xr-xrecipes-bsp/rmc/boards/broxton-m/bm-1F1.fpbin0 -> 83 bytes
-rwxr-xr-xrecipes-bsp/rmc/boards/broxton-m/bm.fpbin0 -> 83 bytes
-rw-r--r--recipes-bsp/rmc/boards/broxton-m/boot.conf4
-rw-r--r--recipes-bsp/rmc/boards/broxton-m/install.conf4
-rw-r--r--recipes-bsp/rmc/boards/broxton-m/joule-1F1.fpbin0 -> 122 bytes
-rw-r--r--recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG2
-rw-r--r--recipes-bsp/rmc/boards/minnowmax/boot.conf4
-rw-r--r--recipes-bsp/rmc/boards/minnowmax/install.conf4
-rw-r--r--recipes-bsp/rmc/boards/minnowmax/minnowmax.fpbin0 -> 143 bytes
-rw-r--r--recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG2
-rw-r--r--recipes-bsp/rmc/boards/minnowmaxB3/boot.conf4
-rw-r--r--recipes-bsp/rmc/boards/minnowmaxB3/install.conf4
-rw-r--r--recipes-bsp/rmc/boards/minnowmaxB3/minnowmaxB3.fpbin0 -> 148 bytes
-rw-r--r--recipes-bsp/rmc/boards/mohonpeak/BOOTENTRY.CONFIG2
-rw-r--r--recipes-bsp/rmc/boards/mohonpeak/INSTALLER.CONFIG3
-rw-r--r--recipes-bsp/rmc/boards/mohonpeak/KBOOTPARAM1
-rw-r--r--recipes-bsp/rmc/boards/mohonpeak/POSTINSTALL.sh3
-rw-r--r--recipes-bsp/rmc/boards/mohonpeak/boot.conf4
-rw-r--r--recipes-bsp/rmc/boards/mohonpeak/install.conf4
-rw-r--r--recipes-bsp/rmc/boards/mohonpeak/mohonpeak.fpbin0 -> 121 bytes
-rw-r--r--recipes-bsp/rmc/boards/nucgen6/BOOTENTRY.CONFIG2
-rw-r--r--recipes-bsp/rmc/boards/nucgen6/INSTALLER.CONFIG6
-rw-r--r--recipes-bsp/rmc/boards/nucgen6/KBOOTPARAM1
-rw-r--r--recipes-bsp/rmc/boards/nucgen6/POSTINSTALL.sh7
-rw-r--r--recipes-bsp/rmc/boards/nucgen6/boot.conf4
-rw-r--r--recipes-bsp/rmc/boards/nucgen6/install.conf4
-rw-r--r--recipes-bsp/rmc/boards/nucgen6/mylib.conf7
-rw-r--r--recipes-bsp/rmc/boards/nucgen6/nuc6.fpbin0 -> 149 bytes
-rw-r--r--recipes-bsp/rmc/boards/qemu-2.6/KBOOTPARAM1
-rw-r--r--recipes-bsp/rmc/boards/qemu-2.6/qemu-2.6.fpbin0 -> 113 bytes
-rw-r--r--recipes-bsp/rmc/boards/qemu-2.8/KBOOTPARAM1
-rw-r--r--recipes-bsp/rmc/boards/qemu-2.8/qemu-2.8.fpbin0 -> 113 bytes
-rw-r--r--recipes-bsp/rmc/rmc-db.bb49
-rw-r--r--recipes-bsp/rmc/rmc-efi.bb40
-rw-r--r--recipes-bsp/rmc/rmc.bb46
-rw-r--r--recipes-bsp/systemd-boot/systemd-boot/0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch31
-rw-r--r--recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch39
-rw-r--r--recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-stub-check-LoadOptions-contains-data.patch42
-rw-r--r--recipes-bsp/systemd-boot/systemd-boot/0002-sd-boot-Load-board-specific-boot-entries-from-RMC-da.patch250
-rw-r--r--recipes-bsp/systemd-boot/systemd-boot/0003-sd-boot-Support-global-kernel-command-line-fragment.patch66
-rw-r--r--recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch81
-rw-r--r--recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc12
-rw-r--r--recipes-bsp/systemd-boot/systemd-boot/systemd-boot.inc7
-rw-r--r--recipes-bsp/systemd-boot/systemd-boot_%.bbappend23
-rw-r--r--recipes-bsp/thermald/thermald_1.6.bb33
82 files changed, 3990 insertions, 0 deletions
diff --git a/recipes-bsp/amt/files/atnetworktool-printf-fix.patch b/recipes-bsp/amt/files/atnetworktool-printf-fix.patch
new file mode 100644
index 00000000..6bb03e3a
--- /dev/null
+++ b/recipes-bsp/amt/files/atnetworktool-printf-fix.patch
@@ -0,0 +1,20 @@
+Add a missing debug ifdef causing compilation problems.
+
+Upstream-Status: Submitted
+
+Signed-off-by: Tom Zanussi <tom.zanussi (a] intel.com>
+
+Index: lms-7.1.20/src/tools/ATNetworkTool.cpp
+===================================================================
+--- lms-7.1.20.orig/src/tools/ATNetworkTool.cpp 2012-04-30 23:24:56.693879920 -0500
++++ lms-7.1.20/src/tools/ATNetworkTool.cpp 2012-04-30 23:25:32.363473948 -0500
+@@ -302,7 +302,9 @@
+ close(s);
+ return -1;
+ }
++#ifdef LMS_NET_DEBUG
+ printf("successfully binded local\n");
++#endif
+
+ }
+ if (bind(s, addr, addrlen) == -1) {
diff --git a/recipes-bsp/amt/files/readlink-declaration.patch b/recipes-bsp/amt/files/readlink-declaration.patch
new file mode 100644
index 00000000..0246d501
--- /dev/null
+++ b/recipes-bsp/amt/files/readlink-declaration.patch
@@ -0,0 +1,18 @@
+Add a missing include causing compilation (missing declaration) problems.
+
+Upstream-Status: Submitted
+
+Signed-off-by: Tom Zanussi <tom.zanussi (a] intel.com>
+
+Index: lms-7.1.20/src/tools/ATVersion.cpp
+===================================================================
+--- lms-7.1.20.orig/src/tools/ATVersion.cpp 2012-05-29 20:34:34.061997035 -0500
++++ lms-7.1.20/src/tools/ATVersion.cpp 2012-05-29 20:35:22.671412948 -0500
+@@ -40,6 +40,7 @@
+ #include <cerrno>
+ #include <fstream>
+ #include <dirent.h>
++#include <unistd.h>
+
+ #define AT_VERSION_ARGUMENT "--version"
+ #define AT_VERSION_MAXSIZE 40
diff --git a/recipes-bsp/amt/lms/0001-Include-sys-select.h-for-fd_set.patch b/recipes-bsp/amt/lms/0001-Include-sys-select.h-for-fd_set.patch
new file mode 100644
index 00000000..e28d45ac
--- /dev/null
+++ b/recipes-bsp/amt/lms/0001-Include-sys-select.h-for-fd_set.patch
@@ -0,0 +1,28 @@
+From 518a3a277c89a3d6b0a9d3ee552cfa33a1dbd5c6 Mon Sep 17 00:00:00 2001
+From: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date: Mon, 23 Jan 2017 20:45:08 +0200
+Subject: [PATCH 1/2] Include sys/select.h for fd_set()
+
+This is needed at least on musl.
+
+Upstream-Status: Pending
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+---
+ src/mei/MEILinux.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/mei/MEILinux.cpp b/src/mei/MEILinux.cpp
+index 1e9d28f..631270e 100755
+--- a/src/mei/MEILinux.cpp
++++ b/src/mei/MEILinux.cpp
+@@ -37,6 +37,7 @@
+ #include <cerrno>
+ #include <fcntl.h>
+ #include <sys/ioctl.h>
++#include <sys/select.h>
+ #include <unistd.h>
+ #include <stdint.h>
+ #include <aio.h>
+--
+2.1.4
+
diff --git a/recipes-bsp/amt/lms/0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch b/recipes-bsp/amt/lms/0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch
new file mode 100644
index 00000000..17b206e2
--- /dev/null
+++ b/recipes-bsp/amt/lms/0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch
@@ -0,0 +1,31 @@
+From 8d737ba9745bef223c3d3b96899f11c26102ea04 Mon Sep 17 00:00:00 2001
+From: Saul Wold <sgw@linux.intel.com>
+Date: Mon, 16 May 2016 09:01:05 -0700
+Subject: [PATCH] Protocol.cpp: Add whitespace for gcc6 compile error
+
+When moving from C++-3 -> C++11 additiona white space is required between
+User-defined literals.
+
+Upstream-Status: Pending
+
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+---
+ src/Protocol.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/Protocol.cpp b/src/Protocol.cpp
+index 1c21a0f..3a4a9bb 100755
+--- a/src/Protocol.cpp
++++ b/src/Protocol.cpp
+@@ -1428,7 +1428,7 @@ int Protocol::_handleFQDNChange(const char *fqdn)
+ char host[FQDN_MAX_SIZE + 1];
+ #define LMS_MAX_LINE_LEN 1023
+ char line[LMS_MAX_LINE_LEN + 1];
+-#define LMS_LINE_SIG_FIRST_WORDS(a) "# LMS GENERATED "a" "
++#define LMS_LINE_SIG_FIRST_WORDS(a) "# LMS GENERATED " a " "
+ #define LMS_LINE_SIG_LAST_WORD "LINE"
+ #define LMS_LINE_SIG_LAST_WORD_LEN 4
+ #define LMS_LINE_SIG(a) LMS_LINE_SIG_FIRST_WORDS(a) LMS_LINE_SIG_LAST_WORD
+--
+2.5.0
+
diff --git a/recipes-bsp/amt/lms/0002-Use-proper-netinet-in.h-API.patch b/recipes-bsp/amt/lms/0002-Use-proper-netinet-in.h-API.patch
new file mode 100644
index 00000000..fa2e29a5
--- /dev/null
+++ b/recipes-bsp/amt/lms/0002-Use-proper-netinet-in.h-API.patch
@@ -0,0 +1,31 @@
+From 0adc925ca9e005f93d77f373ccda2a6c6cc3ff2f Mon Sep 17 00:00:00 2001
+From: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date: Mon, 23 Jan 2017 20:46:50 +0200
+Subject: [PATCH 2/2] Use proper netinet/in.h API
+
+in6addr is only guaranteed to contain this member:
+ uint8_t s6_addr[16]
+Use that instead of the glibc implementation detail __in6_u.
+
+Upstream-Status: Pending
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+---
+ src/tools/ATNetworkTool.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/tools/ATNetworkTool.cpp b/src/tools/ATNetworkTool.cpp
+index 66e27df..0789c79 100755
+--- a/src/tools/ATNetworkTool.cpp
++++ b/src/tools/ATNetworkTool.cpp
+@@ -207,7 +207,7 @@ int ATNetworkTool::GetSockPeerIP(int sock, ATAddressList & peerAddresses, int &e
+ if(sa->sa_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&addr)) //if(IN6_IS_ADDR_V4COMPAT(&addr))
+ {
+ struct in_addr demapped_addr;
+- memcpy(&demapped_addr.s_addr, &addr.__in6_u.__u6_addr8[12], 4);
++ memcpy(&demapped_addr.s_addr, &addr.s6_addr[12], 4);
+
+ struct sockaddr_in sa_in;
+ sa_in.sin_family = AF_INET;
+--
+2.1.4
+
diff --git a/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch b/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch
new file mode 100644
index 00000000..433d3016
--- /dev/null
+++ b/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch
@@ -0,0 +1,91 @@
+Fix device file referance to /dev/mei0, remove select post write.
+
+LMS uses /dev/mei character device which is absent on current kernel versions causing LMS fail to initialize. LMS sends messages to MEI with a post select timeout. Select timeout causes SendMessage to fail causing LMS to not to communicate properly with MEI.
+
+Adding /dev/mei0 device file reference to check first and then /dev/mei sucessfully initializes LMS. Rely on write return length and remove select with timeout to fix communication with MEI.
+
+Upstream-Status: Pending
+
+Signed-off-by: Anand Vastrad <anand.vastrad@intel.com>
+---
+ src/mei/MEILinux.cpp | 43 +++++++------------------------------------
+ 1 file changed, 7 insertions(+), 36 deletions(-)
+
+diff --git a/src/mei/MEILinux.cpp b/src/mei/MEILinux.cpp
+index 1e9d28f..6d23f54 100755
+--- a/src/mei/MEILinux.cpp
++++ b/src/mei/MEILinux.cpp
+@@ -94,13 +94,17 @@ bool MEILinux::Init(unsigned char reqProtocolVersion)
+ Deinit();
+ }
+
+- _fd = open("/dev/mei", O_RDWR);
++ _fd = open("/dev/mei0", O_RDWR);
+
+ if (_fd == -1 ) {
+ if (_verbose) {
+- fprintf(stderr, "Error: Cannot establish a handle to the MEI driver\n");
++ fprintf(stderr, "Warning: Cannot establish a handle to the MEI driver mei0, retrying with mei \n");
++ }
++ _fd = open("/dev/mei", O_RDWR);
++ if (_fd == -1 ) {
++ fprintf(stderr, "Error: Cannot establish a handle to the MEI driver mei\n");
++ return false;
+ }
+- return false;
+ }
+ _initialized = true;
+
+@@ -181,13 +185,7 @@ int MEILinux::ReceiveMessage(unsigned char *buffer, int len, unsigned long timeo
+ int MEILinux::SendMessage(const unsigned char *buffer, int len, unsigned long timeout)
+ {
+ int rv = 0;
+- int return_length =0;
+ int error = 0;
+- fd_set set;
+- struct timeval tv;
+-
+- tv.tv_sec = timeout / 1000;
+- tv.tv_usec =(timeout % 1000) * 1000000;
+
+ if (_verbose) {
+ fprintf(stdout, "call write length = %d\n", len);
+@@ -198,35 +196,8 @@ int MEILinux::SendMessage(const unsigned char *buffer, int len, unsigned long ti
+ if (_verbose) {
+ fprintf(stderr,"write failed with status %d %d\n", rv, error);
+ }
+- goto out;
+- }
+-
+- return_length = rv;
+-
+- FD_ZERO(&set);
+- FD_SET(_fd, &set);
+- rv = select(_fd+1 ,&set, NULL, NULL, &tv);
+- if (rv > 0 && FD_ISSET(_fd, &set)) {
+- if (_verbose) {
+- fprintf(stderr, "write success\n");
+- }
+ }
+- else if (rv == 0) {
+- if (_verbose) {
+- fprintf(stderr, "write failed on timeout with status\n");
+- }
+- goto out;
+- }
+- else { //rv<0
+- if (_verbose) {
+- fprintf(stderr, "write failed on select with status %d\n", rv);
+- }
+- goto out;
+- }
+-
+- rv = return_length;
+
+-out:
+ if (rv < 0) {
+ Deinit();
+ }
+--
+2.7.4
+
diff --git a/recipes-bsp/amt/lms/0004-Intel-AMT-ME-real-time-notification-infra.patch b/recipes-bsp/amt/lms/0004-Intel-AMT-ME-real-time-notification-infra.patch
new file mode 100644
index 00000000..04f584ae
--- /dev/null
+++ b/recipes-bsp/amt/lms/0004-Intel-AMT-ME-real-time-notification-infra.patch
@@ -0,0 +1,2647 @@
+Added Intel AMT ME real time notification infra to LMS.
+
+Notification support now actively captures all the INTEL AMT ME events by plugging in to APF infra.
+These events message are in the WsMan XML format. WsMan XML is parsed to get the AlertID and Message arguments.
+A map is initialized initially by reading AMTAlerts.xml which provides alertid,messageArguements and verbose description.
+From AlertID, verbose description is obtained and then using d-bus infra verbose description is notified to the user.
+
+src/tools/utils.cpp Utils class provides static methods for string manipulation and desktop notification.
+src/tools/miniXmlParser.cpp MiniXmlParser class provide methods for parsing the xmlBuffer, validation and retreving tag/value.
+src/tools/httpParser.cpp HttpParser class provides method to parse http response buffer and populate header,body,headerfields properties.
+src/alertDescription.cpp AlertDescription class parses AMTAlerts.xml like xml to populate map of alertId-Arguments and verbose desctiption.
+src/alertIndication.cpp AlertIndication class provides binding to some xmlTags. It uses MiniXmlParse to parse xmlBuffer and provides access methods to some of the fields.
+src/defaultAlerts.cpp provides default AlertID-Description paris. This is used in absence of AMTAlerts.xml.
+src/notifyDesktop.sh is script which uses d-bus infra to pop up desktop notification. The following script can be modified based on device environment and libraries installed.
+src/LMEConnection.cpp has modified the buffer 4x times because of the size of AMT ME Xml data.
+src/Protocol.cpp [ _UNSHandler(char *data, int dataLength) ] has changes to recieve AMT ME event data, gracefully process the data and close the channel.
+
+src/tools/miniXmlParser.cpp has derived work from http://info.meshcentral.com/downloads/MeshAgentFullSource.rar microstack. Author: Bryan Y Roe <bryan.y.roe@intel.com>/Intel Corporation.
+
+Upstream-Status: Pending
+
+Signed-off-by: AnandVastrad <anand.vastrad@intel.com>
+---
+ Makefile.in | 2 +
+ src/AMTAlerts.xml | 464 ++++++++++++++++++++++++++++++++++++++++++++
+ src/LMEConnection.cpp | 2 +-
+ src/Makefile.am | 3 +
+ src/Makefile.in | 172 ++++++++++++++--
+ src/Makefile.inc | 20 +-
+ src/Protocol.cpp | 191 +++++++++++++++---
+ src/Protocol.h | 8 +-
+ src/alertDescription.cpp | 144 ++++++++++++++
+ src/alertDescription.h | 45 +++++
+ src/alertIndication.cpp | 90 +++++++++
+ src/alertIndication.h | 54 ++++++
+ src/defaultAlerts.h | 43 ++++
+ src/notifyDesktop.sh | 10 +
+ src/tools/httpParser.cpp | 101 ++++++++++
+ src/tools/httpParser.h | 49 +++++
+ src/tools/miniXmlParser.cpp | 375 +++++++++++++++++++++++++++++++++++
+ src/tools/miniXmlParser.h | 51 +++++
+ src/tools/utils.cpp | 185 ++++++++++++++++++
+ src/tools/utils.h | 57 ++++++
+ src/tools/xmlNode.cpp | 45 +++++
+ src/tools/xmlNode.h | 49 +++++
+ 22 files changed, 2105 insertions(+), 55 deletions(-)
+ mode change 100755 => 100644 Makefile.in
+ create mode 100755 src/AMTAlerts.xml
+ mode change 100755 => 100644 src/Makefile.in
+ create mode 100644 src/alertDescription.cpp
+ create mode 100644 src/alertDescription.h
+ create mode 100644 src/alertIndication.cpp
+ create mode 100644 src/alertIndication.h
+ create mode 100644 src/defaultAlerts.h
+ create mode 100644 src/notifyDesktop.sh
+ create mode 100644 src/tools/httpParser.cpp
+ create mode 100644 src/tools/httpParser.h
+ create mode 100644 src/tools/miniXmlParser.cpp
+ create mode 100644 src/tools/miniXmlParser.h
+ create mode 100644 src/tools/utils.cpp
+ create mode 100644 src/tools/utils.h
+ create mode 100644 src/tools/xmlNode.cpp
+ create mode 100644 src/tools/xmlNode.h
+
+diff --git a/Makefile.in b/Makefile.in
+old mode 100755
+new mode 100644
+index f90be60..e1a248b
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -133,6 +133,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ RANLIB = @RANLIB@
+@@ -185,6 +186,7 @@ pdfdir = @pdfdir@
+ prefix = @prefix@
+ program_transform_name = @program_transform_name@
+ psdir = @psdir@
++runstatedir = @runstatedir@
+ sbindir = @sbindir@
+ sharedstatedir = @sharedstatedir@
+ sysconfdir = @sysconfdir@
+diff --git a/src/AMTAlerts.xml b/src/AMTAlerts.xml
+new file mode 100755
+index 0000000..ddb3383
+--- /dev/null
++++ b/src/AMTAlerts.xml
+@@ -0,0 +1,464 @@
++<?xml version="1.0" encoding="utf-8" standalone="no"?>
++<!-- Copyright (c) Intel Corporation, 2010 All Rights Reserved. -->
++<Alerts>
++<Alert>
++<Id>iAMT0001</Id>
++<Arg></Arg>
++<Message>System Defense Policy triggered.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0002</Id>
++<Arg></Arg>
++<Message>Agent Presence Agent not started.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0003</Id>
++<Arg></Arg>
++<Message>Agent Presence Agent stopped.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0004</Id>
++<Arg></Arg>
++<Message>Agent Presence: running.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0005</Id>
++<Arg></Arg>
++<Message>Agent Presence: expired.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0006</Id>
++<Arg></Arg>
++<Message>Agent Presence: suspended.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0007</Id>
++<Arg></Arg>
++<Message>Host software attempt to disable AMT Network link detected.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0008</Id>
++<Arg></Arg>
++<Message>Host software attempt to disable AMT Network link detected -- Host Network link blocked.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0009</Id>
++<Arg></Arg>
++<Message>AMT clock or FLASH wear-out protection disabled.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0010</Id>
++<Arg></Arg>
++<Message>Intel(R) AMT Network Interface: Heuristics defense slow threshold trespassed.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0011</Id>
++<Arg></Arg>
++<Message>Intel(R) AMT Network Interface: Heuristics defense fast threshold trespassed.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0012</Id>
++<Arg></Arg>
++<Message>Intel(R) AMT Network Interface: Heuristics defense factory defined threshold trespassed.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0013</Id>
++<Arg></Arg>
++<Message>Intel(R) AMT Network Interface: Heuristics defense Encounter timeout expired.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0014</Id>
++<Arg></Arg>
++<Message>General certificate error.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0015</Id>
++<Arg></Arg>
++<Message>Certificate expired.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0016</Id>
++<Arg></Arg>
++<Message>No trusted root certificate.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0017</Id>
++<Arg></Arg>
++<Message>Not configured to work with server certificate.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0018</Id>
++<Arg></Arg>
++<Message>Certificate revoked.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0019</Id>
++<Arg></Arg>
++<Message>RSA exponent too large.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0020</Id>
++<Arg></Arg>
++<Message>RSA modulus too large.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0021</Id>
++<Arg></Arg>
++<Message>Unsupported digest.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0022</Id>
++<Arg></Arg>
++<Message>Distinguished name too long.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0023</Id>
++<Arg></Arg>
++<Message>Key usage missing.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0024</Id>
++<Arg></Arg>
++<Message>General SSL handshake error.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0025</Id>
++<Arg></Arg>
++<Message>General 802.1x error.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0026</Id>
++<Arg></Arg>
++<Message>AMT Diagnostic AlertEAC error - General NAC error.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0027</Id>
++<Arg></Arg>
++<Message>AMT Diagnostic AlertEAC error - attempt to get a NAC posture while AMT NAC is disabled.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0028</Id>
++<Arg></Arg>
++<Message>AMT Diagnostic AlertEAC error - attempt to get a posture of an unsupported type.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0029</Id>
++<Arg></Arg>
++<Message>Audit log storage is 50% full.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0030</Id>
++<Arg></Arg>
++<Message>Audit log storage is 75% full.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0031</Id>
++<Arg></Arg>
++<Message>Audit log storage is 85% full.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0032</Id>
++<Arg></Arg>
++<Message>Audit log storage is 95% full.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0033</Id>
++<Arg></Arg>
++<Message>Audit log storage is full.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0034</Id>
++<Arg></Arg>
++<Message>Firmware Update Event - Partial.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0035</Id>
++<Arg></Arg>
++<Message>Firmware Update Event - Failure.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0036</Id>
++<Arg></Arg>
++<Message>Remote connectivity initiated.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0037</Id>
++<Arg></Arg>
++<Message>ME Presence event.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0038</Id>
++<Arg>0</Arg>
++<Message>AMT is being unprovisioned using BIOS command.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0038</Id>
++<Arg>1</Arg>
++<Message>AMT is being unprovisioned using Local MEI command.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0038</Id>
++<Arg>2</Arg>
++<Message>AMT is being unprovisioned using Local WS-MAN/SOAP command.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0038</Id>
++<Arg>3</Arg>
++<Message>AMT is being unprovisioned using Remote WS-MAN/SOAP command.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0050</Id>
++<Arg></Arg>
++<Message>User Notification Alert - General Notification.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0050</Id>
++<Arg>16</Arg>
++<Message>User Notification Alert - Circuit Breaker notification (CB Drop TX filter hit.).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0050</Id>
++<Arg>17</Arg>
++<Message>User Notification Alert - Circuit Breaker notification (CB Rate Limit TX filter hit.).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0050</Id>
++<Arg>18</Arg>
++<Message>User Notification Alert - Circuit Breaker notification (CB Drop RX filter hit.).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0050</Id>
++<Arg>19</Arg>
++<Message>User Notification Alert - Circuit Breaker notification (CB Rate Limit RX filter hit.).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0050</Id>
++<Arg>32</Arg>
++<Message>User Notification Alert - EAC notification.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0050</Id>
++<Arg>48</Arg>
++<Message>User Notification Alert - Remote diagnostics - (Remote Redirection session started - SOL).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0050</Id>
++<Arg>49</Arg>
++<Message>User Notification Alert - Remote diagnostics - (Remote Redirection session stopped - SOL).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0050</Id>
++<Arg>50</Arg>
++<Message>User Notification Alert - Remote diagnostics. (Remote Redirection session started - IDE-R).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0050</Id>
++<Arg>51</Arg>
++<Message>User Notification Alert - Remote diagnostics. (Remote Redirection session stopped - IDE-R).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0050</Id>
++<Arg>66</Arg>
++<Message>User Notification Alert - WLAN notification (Host profile mismatch - Management Interface ignored).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0050</Id>
++<Arg>67</Arg>
++<Message>User Notification Alert - WLAN notification (Management device overrides host radio).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0050</Id>
++<Arg>68</Arg>
++<Message>User Notification Alert - WLAN notification (Host profile security mismatch).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0050</Id>
++<Arg>69</Arg>
++<Message>User Notification Alert - WLAN notification (Management device relinquishes control over host Radio).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0051</Id>
++<Arg></Arg>
++<Message>User Notification Alert - SecIo event.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0051</Id>
++<Arg>0</Arg>
++<Message>User Notification Alert - SecIo event semaphore at host.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0051</Id>
++<Arg>1</Arg>
++<Message>User Notification Alert - semaphore at ME.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0051</Id>
++<Arg>2</Arg>
++<Message>User Notification Alert - SecIo event - semaphore timeout.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0052</Id>
++<Arg></Arg>
++<Message>User Notification Alert - KVM session event.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0052</Id>
++<Arg>0</Arg>
++<Message>User Notification Alert - KVM session requested.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0052</Id>
++<Arg>1</Arg>
++<Message>User Notification Alert - KVM session started.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0052</Id>
++<Arg>2</Arg>
++<Message>User Notification Alert - KVM session stopped.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0053</Id>
++<Arg></Arg>
++<Message>User Notification Alert - RCS notification.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0053</Id>
++<Arg>50</Arg>
++<Message>User Notification Alert - RCS notification (HW button pressed. Connection initiated automatically).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0053</Id>
++<Arg>52</Arg>
++<Message>User Notification Alert - RCS notification (HW button pressed. Connection wasn't initiated automatically).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0053</Id>
++<Arg>53</Arg>
++<Message>User Notification Alert - RCS notification (Contracts updated).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0054</Id>
++<Arg></Arg>
++<Message>User Notification Alert - WLAN notification. Wireless Profile sync enablement state changed.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0055</Id>
++<Arg></Arg>
++<Message>User Notification Alert - Provisioning state change notification.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0055</Id>
++<Arg>0</Arg>
++<Message>User Notification Alert - Provisioning state change notification - Pre-configuration.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0055</Id>
++<Arg>1</Arg>
++<Message>User Notification Alert - Provisioning state change notification - In configuration.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0055</Id>
++<Arg>2</Arg>
++<Message>User Notification Alert - Provisioning state change notification - Post-configuration.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0055</Id>
++<Arg>3</Arg>
++<Message>User Notification Alert - Provisioning state change notification - unprovision process has started.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0056</Id>
++<Arg></Arg>
++<Message>User Notification Alert - System Defense change notification.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0057</Id>
++<Arg></Arg>
++<Message>User Notification Alert - Network State change notification.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0058</Id>
++<Arg></Arg>
++<Message>User Notification Alert - Remote Access change notification.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0058</Id>
++<Arg>1</Arg>
++<Message>User Notification Alert - Remote Access change notification - tunnel is closed.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0058</Id>
++<Arg>1</Arg>
++<Message>User Notification Alert - Remote Access change notification - tunnel is open.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0059</Id>
++<Arg></Arg>
++<Message>User Notification Alert - KVM enabled event.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0059</Id>
++<Arg>0</Arg>
++<Message>User Notification Alert - KVM enabled event - KVM disabled.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0059</Id>
++<Arg>1</Arg>
++<Message>User Notification Alert - KVM enabled event - KVM enabled (both from MEBx and PTNI).</Message>
++</Alert>
++<Alert>
++<Id>iAMT0060</Id>
++<Arg></Arg>
++<Message>User Notification Alert - SecIO configuration event.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0061</Id>
++<Arg></Arg>
++<Message>ME FW reset occurred.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0062</Id>
++<Arg></Arg>
++<Message>User Notification Alert - IpSyncEnabled event.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0062</Id>
++<Arg>0</Arg>
++<Message>User Notification Alert - IpSyncEnabled event - IpSync disabled.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0062</Id>
++<Arg>1</Arg>
++<Message>User Notification Alert - IpSyncEnabled event - IpSync enabled.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0063</Id>
++<Arg></Arg>
++<Message>User Notification Alert - HTTP Proxy sync enabled event.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0063</Id>
++<Arg>0</Arg>
++<Message>User Notification Alert - HTTP Proxy sync enabled event - HTTP Proxy Sync disabled.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0063</Id>
++<Arg>1</Arg>
++<Message>User Notification Alert - HTTP Proxy sync enabled event - HTTP Proxy Sync enabled.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0064</Id>
++<Arg></Arg>
++<Message>User Notification Alert - User Consent event.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0064</Id>
++<Arg>1</Arg>
++<Message>User Notification Alert - User Consent event - User Consent granted.</Message>
++</Alert>
++<Alert>
++<Id>iAMT0064</Id>
++<Arg>2</Arg>
++<Message>User Notification Alert - User Consent event - User Consent ended.</Message>
++</Alert>
++</Alerts>
+diff --git a/src/LMEConnection.cpp b/src/LMEConnection.cpp
+index f3e7a2b..d192626 100755
+--- a/src/LMEConnection.cpp
++++ b/src/LMEConnection.cpp
+@@ -48,7 +48,7 @@ extern glue plugin;
+
+ const GUID LMEConnection::_guid = {0x6733a4db, 0x0476, 0x4e7b, {0xb3, 0xaf, 0xbc, 0xfc, 0x29, 0xbe, 0xe7, 0xa7}};
+
+-const UINT32 LMEConnection::RX_WINDOW_SIZE = 1024;
++const UINT32 LMEConnection::RX_WINDOW_SIZE = 4096;
+
+ LMEConnection::LMEConnection(bool verbose) :
+ _reqID(0),
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 42d9f47..364427b 100755
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -1,4 +1,7 @@
+ sbin_PROGRAMS=lms
++dist_bin_SCRIPTS=notifyDesktop.sh
++xml_dir=$(datadir)/xml
++xml__DATA=AMTAlerts.xml
+
+ SYNCLIB_SRCDIR=SyncLib/src
+ SYNCLIB_HDRDIR=SyncLib/Include
+diff --git a/src/Makefile.in b/src/Makefile.in
+old mode 100755
+new mode 100644
+index c6fe1ba..7b6cafd
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -14,6 +14,8 @@
+
+ @SET_MAKE@
+
++
++
+ srcdir = @srcdir@
+ top_srcdir = @top_srcdir@
+ VPATH = @srcdir@
+@@ -37,9 +39,9 @@ POST_UNINSTALL = :
+ build_triplet = @build@
+ host_triplet = @host@
+ sbin_PROGRAMS = lms$(EXEEXT)
+-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+- $(srcdir)/Makefile.inc $(srcdir)/iatshareddata.h.in \
+- $(srcdir)/plugin.h.in
++DIST_COMMON = $(dist_bin_SCRIPTS) $(srcdir)/Makefile.am \
++ $(srcdir)/Makefile.in $(srcdir)/Makefile.inc \
++ $(srcdir)/iatshareddata.h.in $(srcdir)/plugin.h.in
+ subdir = src
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+@@ -48,14 +50,17 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ mkinstalldirs = $(install_sh) -d
+ CONFIG_HEADER = $(top_builddir)/config.h
+ CONFIG_CLEAN_FILES = plugin.h iatshareddata.h
+-am__installdirs = "$(DESTDIR)$(sbindir)"
++am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(bindir)" \
++ "$(DESTDIR)$(xml_dir)"
+ sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+ PROGRAMS = $(sbin_PROGRAMS)
+ am__objects_1 = main.$(OBJEXT) LMEConnection.$(OBJEXT) \
+ ConfigConnection.$(OBJEXT) Protocol.$(OBJEXT) glue.$(OBJEXT) \
+- ChannelGenerator.$(OBJEXT)
++ ChannelGenerator.$(OBJEXT) alertIndication.$(OBJEXT) \
++ alertDescription.$(OBJEXT)
+ am__objects_2 = ATVersion.$(OBJEXT) ATNetworkTool.$(OBJEXT) \
+- daemonize.$(OBJEXT)
++ daemonize.$(OBJEXT) utils.$(OBJEXT) miniXmlParser.$(OBJEXT) \
++ xmlNode.$(OBJEXT) httpParser.$(OBJEXT)
+ am__objects_3 = MEILinux.$(OBJEXT) MNGCommand.$(OBJEXT) \
+ FWULCommand.$(OBJEXT) PTHICommand.$(OBJEXT)
+ am__objects_4 = EventLinux.$(OBJEXT) SemaphoreLinux.$(OBJEXT) \
+@@ -68,6 +73,8 @@ am__objects_7 = $(am__objects_6) $(am__objects_6) $(am__objects_6) \
+ am_lms_OBJECTS = $(am__objects_5) $(am__objects_7)
+ lms_OBJECTS = $(am_lms_OBJECTS)
+ lms_LDADD = $(LDADD)
++dist_binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
++SCRIPTS = $(dist_bin_SCRIPTS)
+ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+ depcomp = $(SHELL) $(top_srcdir)/depcomp
+ am__depfiles_maybe = depfiles
+@@ -89,6 +96,14 @@ LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+ SOURCES = $(lms_SOURCES)
+ DIST_SOURCES = $(lms_SOURCES)
++am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
++am__vpath_adj = case $$p in \
++ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
++ *) f=$$p;; \
++ esac;
++am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
++xml_DATA_INSTALL = $(INSTALL_DATA)
++DATA = $(xml__DATA)
+ ETAGS = etags
+ CTAGS = ctags
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+@@ -150,6 +165,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ RANLIB = @RANLIB@
+@@ -202,10 +218,14 @@ pdfdir = @pdfdir@
+ prefix = @prefix@
+ program_transform_name = @program_transform_name@
+ psdir = @psdir@
++runstatedir = @runstatedir@
+ sbindir = @sbindir@
+ sharedstatedir = @sharedstatedir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++dist_bin_SCRIPTS = notifyDesktop.sh
++xml_dir = $(datadir)/xml
++xml__DATA = AMTAlerts.xml
+ SYNCLIB_SRCDIR = SyncLib/src
+ SYNCLIB_HDRDIR = SyncLib/Include
+ MEI_DIR = mei
+@@ -238,11 +258,19 @@ $(MEI_DIR)/PTHICommand.cpp
+
+ TOOLS_HDRS = $(TOOLS_DIR)/ATVersion.h \
+ $(TOOLS_DIR)/ATNetworkTool.h \
+-$(TOOLS_DIR)/daemonize.h
++$(TOOLS_DIR)/daemonize.h \
++$(TOOLS_DIR)/utils.h \
++$(TOOLS_DIR)/miniXmlParser.h \
++$(TOOLS_DIR)/xmlNode.h \
++$(TOOLS_DIR)/httpParser.h
+
+ TOOLS_SRCS = $(TOOLS_DIR)/ATVersion.cpp \
+ $(TOOLS_DIR)/ATNetworkTool.cpp \
+-$(TOOLS_DIR)/daemonize.cpp
++$(TOOLS_DIR)/daemonize.cpp \
++$(TOOLS_DIR)/utils.cpp \
++$(TOOLS_DIR)/miniXmlParser.cpp \
++$(TOOLS_DIR)/xmlNode.cpp \
++$(TOOLS_DIR)/httpParser.cpp
+
+ MAIN_HDRS = types.h \
+ Channel.h \
+@@ -254,14 +282,18 @@ ConfigConnection.h \
+ Protocol.h \
+ glue.h \
+ version.h \
+-ChannelGenerator.h
++ChannelGenerator.h \
++alertIndication.h \
++alertDescription.h
+
+ MAIN_SRCS = main.cpp \
+ LMEConnection.cpp \
+ ConfigConnection.cpp \
+ Protocol.cpp \
+ glue.cpp \
+-ChannelGenerator.cpp
++ChannelGenerator.cpp \
++alertIndication.cpp \
++alertDescription.cpp
+
+ SRCS = $(MAIN_SRCS) \
+ $(TOOLS_SRCS) \
+@@ -342,6 +374,25 @@ clean-sbinPROGRAMS:
+ lms$(EXEEXT): $(lms_OBJECTS) $(lms_DEPENDENCIES)
+ @rm -f lms$(EXEEXT)
+ $(CXXLINK) $(lms_LDFLAGS) $(lms_OBJECTS) $(lms_LDADD) $(LIBS)
++install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
++ @$(NORMAL_INSTALL)
++ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
++ @list='$(dist_bin_SCRIPTS)'; for p in $$list; do \
++ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
++ if test -f $$d$$p; then \
++ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
++ echo " $(dist_binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \
++ $(dist_binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \
++ else :; fi; \
++ done
++
++uninstall-dist_binSCRIPTS:
++ @$(NORMAL_UNINSTALL)
++ @list='$(dist_bin_SCRIPTS)'; for p in $$list; do \
++ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
++ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
++ rm -f "$(DESTDIR)$(bindir)/$$f"; \
++ done
+
+ mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+@@ -355,17 +406,23 @@ distclean-compile:
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConfigConnection.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EventLinux.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FWULCommand.Po@am__quote@
+-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MEILinux.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LMEConnection.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MEILinux.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MNGCommand.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PTHICommand.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Protocol.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RWLock.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SemaphoreLinux.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ThreadLinux.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alertDescription.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alertIndication.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/daemonize.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glue.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpParser.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miniXmlParser.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlNode.Po@am__quote@
+
+ .cpp.o:
+ @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@@ -430,6 +487,62 @@ daemonize.obj: $(TOOLS_DIR)/daemonize.cpp
+ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o daemonize.obj `if test -f '$(TOOLS_DIR)/daemonize.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/daemonize.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/daemonize.cpp'; fi`
+
++utils.o: $(TOOLS_DIR)/utils.cpp
++@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT utils.o -MD -MP -MF "$(DEPDIR)/utils.Tpo" -c -o utils.o `test -f '$(TOOLS_DIR)/utils.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/utils.cpp; \
++@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/utils.Tpo" "$(DEPDIR)/utils.Po"; else rm -f "$(DEPDIR)/utils.Tpo"; exit 1; fi
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/utils.cpp' object='utils.o' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o utils.o `test -f '$(TOOLS_DIR)/utils.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/utils.cpp
++
++utils.obj: $(TOOLS_DIR)/utils.cpp
++@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT utils.obj -MD -MP -MF "$(DEPDIR)/utils.Tpo" -c -o utils.obj `if test -f '$(TOOLS_DIR)/utils.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/utils.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/utils.cpp'; fi`; \
++@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/utils.Tpo" "$(DEPDIR)/utils.Po"; else rm -f "$(DEPDIR)/utils.Tpo"; exit 1; fi
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/utils.cpp' object='utils.obj' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o utils.obj `if test -f '$(TOOLS_DIR)/utils.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/utils.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/utils.cpp'; fi`
++
++miniXmlParser.o: $(TOOLS_DIR)/miniXmlParser.cpp
++@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT miniXmlParser.o -MD -MP -MF "$(DEPDIR)/miniXmlParser.Tpo" -c -o miniXmlParser.o `test -f '$(TOOLS_DIR)/miniXmlParser.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/miniXmlParser.cpp; \
++@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/miniXmlParser.Tpo" "$(DEPDIR)/miniXmlParser.Po"; else rm -f "$(DEPDIR)/miniXmlParser.Tpo"; exit 1; fi
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/miniXmlParser.cpp' object='miniXmlParser.o' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o miniXmlParser.o `test -f '$(TOOLS_DIR)/miniXmlParser.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/miniXmlParser.cpp
++
++miniXmlParser.obj: $(TOOLS_DIR)/miniXmlParser.cpp
++@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT miniXmlParser.obj -MD -MP -MF "$(DEPDIR)/miniXmlParser.Tpo" -c -o miniXmlParser.obj `if test -f '$(TOOLS_DIR)/miniXmlParser.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/miniXmlParser.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/miniXmlParser.cpp'; fi`; \
++@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/miniXmlParser.Tpo" "$(DEPDIR)/miniXmlParser.Po"; else rm -f "$(DEPDIR)/miniXmlParser.Tpo"; exit 1; fi
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/miniXmlParser.cpp' object='miniXmlParser.obj' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o miniXmlParser.obj `if test -f '$(TOOLS_DIR)/miniXmlParser.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/miniXmlParser.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/miniXmlParser.cpp'; fi`
++
++xmlNode.o: $(TOOLS_DIR)/xmlNode.cpp
++@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT xmlNode.o -MD -MP -MF "$(DEPDIR)/xmlNode.Tpo" -c -o xmlNode.o `test -f '$(TOOLS_DIR)/xmlNode.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/xmlNode.cpp; \
++@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/xmlNode.Tpo" "$(DEPDIR)/xmlNode.Po"; else rm -f "$(DEPDIR)/xmlNode.Tpo"; exit 1; fi
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/xmlNode.cpp' object='xmlNode.o' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o xmlNode.o `test -f '$(TOOLS_DIR)/xmlNode.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/xmlNode.cpp
++
++xmlNode.obj: $(TOOLS_DIR)/xmlNode.cpp
++@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT xmlNode.obj -MD -MP -MF "$(DEPDIR)/xmlNode.Tpo" -c -o xmlNode.obj `if test -f '$(TOOLS_DIR)/xmlNode.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/xmlNode.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/xmlNode.cpp'; fi`; \
++@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/xmlNode.Tpo" "$(DEPDIR)/xmlNode.Po"; else rm -f "$(DEPDIR)/xmlNode.Tpo"; exit 1; fi
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/xmlNode.cpp' object='xmlNode.obj' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o xmlNode.obj `if test -f '$(TOOLS_DIR)/xmlNode.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/xmlNode.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/xmlNode.cpp'; fi`
++
++httpParser.o: $(TOOLS_DIR)/httpParser.cpp
++@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT httpParser.o -MD -MP -MF "$(DEPDIR)/httpParser.Tpo" -c -o httpParser.o `test -f '$(TOOLS_DIR)/httpParser.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/httpParser.cpp; \
++@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/httpParser.Tpo" "$(DEPDIR)/httpParser.Po"; else rm -f "$(DEPDIR)/httpParser.Tpo"; exit 1; fi
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/httpParser.cpp' object='httpParser.o' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o httpParser.o `test -f '$(TOOLS_DIR)/httpParser.cpp' || echo '$(srcdir)/'`$(TOOLS_DIR)/httpParser.cpp
++
++httpParser.obj: $(TOOLS_DIR)/httpParser.cpp
++@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT httpParser.obj -MD -MP -MF "$(DEPDIR)/httpParser.Tpo" -c -o httpParser.obj `if test -f '$(TOOLS_DIR)/httpParser.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/httpParser.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/httpParser.cpp'; fi`; \
++@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/httpParser.Tpo" "$(DEPDIR)/httpParser.Po"; else rm -f "$(DEPDIR)/httpParser.Tpo"; exit 1; fi
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(TOOLS_DIR)/httpParser.cpp' object='httpParser.obj' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o httpParser.obj `if test -f '$(TOOLS_DIR)/httpParser.cpp'; then $(CYGPATH_W) '$(TOOLS_DIR)/httpParser.cpp'; else $(CYGPATH_W) '$(srcdir)/$(TOOLS_DIR)/httpParser.cpp'; fi`
++
+ MEILinux.o: $(MEI_DIR)/MEILinux.cpp
+ @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MEILinux.o -MD -MP -MF "$(DEPDIR)/MEILinux.Tpo" -c -o MEILinux.o `test -f '$(MEI_DIR)/MEILinux.cpp' || echo '$(srcdir)/'`$(MEI_DIR)/MEILinux.cpp; \
+ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/MEILinux.Tpo" "$(DEPDIR)/MEILinux.Po"; else rm -f "$(DEPDIR)/MEILinux.Tpo"; exit 1; fi
+@@ -551,6 +664,23 @@ clean-libtool:
+ distclean-libtool:
+ -rm -f libtool
+ uninstall-info-am:
++install-xml_DATA: $(xml__DATA)
++ @$(NORMAL_INSTALL)
++ test -z "$(xml_dir)" || $(mkdir_p) "$(DESTDIR)$(xml_dir)"
++ @list='$(xml__DATA)'; for p in $$list; do \
++ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
++ f=$(am__strip_dir) \
++ echo " $(xml_DATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xml_dir)/$$f'"; \
++ $(xml_DATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xml_dir)/$$f"; \
++ done
++
++uninstall-xml_DATA:
++ @$(NORMAL_UNINSTALL)
++ @list='$(xml__DATA)'; for p in $$list; do \
++ f=$(am__strip_dir) \
++ echo " rm -f '$(DESTDIR)$(xml_dir)/$$f'"; \
++ rm -f "$(DESTDIR)$(xml_dir)/$$f"; \
++ done
+
+ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+@@ -629,9 +759,9 @@ distdir: $(DISTFILES)
+ done
+ check-am: all-am
+ check: check-am
+-all-am: Makefile $(PROGRAMS)
++all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA)
+ installdirs:
+- for dir in "$(DESTDIR)$(sbindir)"; do \
++ for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(xml_dir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+ install: install-am
+@@ -679,11 +809,11 @@ info: info-am
+
+ info-am:
+
+-install-data-am:
++install-data-am: install-xml_DATA
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+-install-exec-am: install-sbinPROGRAMS
++install-exec-am: install-dist_binSCRIPTS install-sbinPROGRAMS
+
+ install-info: install-info-am
+
+@@ -709,20 +839,22 @@ ps: ps-am
+
+ ps-am:
+
+-uninstall-am: uninstall-info-am uninstall-sbinPROGRAMS
++uninstall-am: uninstall-dist_binSCRIPTS uninstall-info-am \
++ uninstall-sbinPROGRAMS uninstall-xml_DATA
+
+ .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-sbinPROGRAMS ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+- install-data-hook install-exec install-exec-am install-info \
+- install-info-am install-man install-sbinPROGRAMS install-strip \
++ install-data-hook install-dist_binSCRIPTS install-exec \
++ install-exec-am install-info install-info-am install-man \
++ install-sbinPROGRAMS install-strip install-xml_DATA \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+- tags uninstall uninstall-am uninstall-info-am \
+- uninstall-sbinPROGRAMS
++ tags uninstall uninstall-am uninstall-dist_binSCRIPTS \
++ uninstall-info-am uninstall-sbinPROGRAMS uninstall-xml_DATA
+
+
+ install-data-hook:
+diff --git a/src/Makefile.inc b/src/Makefile.inc
+index 079503c..8d7e7ab 100755
+--- a/src/Makefile.inc
++++ b/src/Makefile.inc
+@@ -26,11 +26,19 @@ $(MEI_DIR)/PTHICommand.cpp
+
+ TOOLS_HDRS=$(TOOLS_DIR)/ATVersion.h \
+ $(TOOLS_DIR)/ATNetworkTool.h \
+-$(TOOLS_DIR)/daemonize.h
++$(TOOLS_DIR)/daemonize.h \
++$(TOOLS_DIR)/utils.h \
++$(TOOLS_DIR)/miniXmlParser.h \
++$(TOOLS_DIR)/xmlNode.h \
++$(TOOLS_DIR)/httpParser.h
+
+ TOOLS_SRCS=$(TOOLS_DIR)/ATVersion.cpp \
+ $(TOOLS_DIR)/ATNetworkTool.cpp \
+-$(TOOLS_DIR)/daemonize.cpp
++$(TOOLS_DIR)/daemonize.cpp \
++$(TOOLS_DIR)/utils.cpp \
++$(TOOLS_DIR)/miniXmlParser.cpp \
++$(TOOLS_DIR)/xmlNode.cpp \
++$(TOOLS_DIR)/httpParser.cpp
+
+ MAIN_HDRS=types.h \
+ Channel.h \
+@@ -42,14 +50,18 @@ ConfigConnection.h \
+ Protocol.h \
+ glue.h \
+ version.h \
+-ChannelGenerator.h
++ChannelGenerator.h \
++alertIndication.h \
++alertDescription.h
+
+ MAIN_SRCS=main.cpp \
+ LMEConnection.cpp \
+ ConfigConnection.cpp \
+ Protocol.cpp \
+ glue.cpp \
+-ChannelGenerator.cpp
++ChannelGenerator.cpp \
++alertIndication.cpp \
++alertDescription.cpp
+
+ SRCS=$(MAIN_SRCS) \
+ $(TOOLS_SRCS) \
+diff --git a/src/Protocol.cpp b/src/Protocol.cpp
+index 3a4a9bb..c3de5cc 100755
+--- a/src/Protocol.cpp
++++ b/src/Protocol.cpp
+@@ -28,6 +28,7 @@
+ * POSSIBILITY OF SUCH DAMAGE.
+ *******************************************************************************/
+
++
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+@@ -42,7 +43,8 @@
+ #include <fcntl.h>
+ #include <netdb.h>
+ #include <syslog.h>
+-#include "strings.h"
++#include <vector>
++#include <string.h>
+
+ #define _stprintf_s snprintf
+ #define strnicmp strncasecmp
+@@ -53,6 +55,11 @@
+ #include "LMS_if.h"
+ #include "Lock.h"
+ #include "ATNetworkTool.h"
++#include "utils.h"
++#include "httpParser.h"
++#include "miniXmlParser.h"
++#include "alertIndication.h"
++#include "alertDescription.h"
+
+
+ const LMEProtocolVersionMessage Protocol::MIN_PROT_VERSION(1, 0);
+@@ -99,9 +106,9 @@ bool Protocol::Init(EventLogCallback cb, void *param)
+ PRINT("Protocol::Init started\n");
+ _eventLog = cb;
+ _eventLogParam = param;
++ _UNSSenderChannel = INVALID_CHANNEL;
+
+ DeinitFull();
+-
+ {
+ Lock dl(_deinitLock);
+ _deinitReq = false;
+@@ -1170,10 +1177,112 @@ void Protocol::_removeFromMaps(Channel *c)
+ _channelToSocket.erase(c->GetSenderChannel());
+ _socketToChannel.erase(s);
+ }
+-void Protocol::_UNSConnection()
++
++std::string Protocol::_PACKET_BODY_LENGTH="Content-Length";
++std::string Protocol::_NOTIFICATION_HEADER="Intel Management Engine Notification";
++int Protocol::_UNSHandler(char *data, int dataLength)
+ {
+- PRINT("UNS event\n");
++ PRINT("UNS event data\n");
++ char *pBuffer = NULL;
++ static char *sBuffer = NULL;
++ static int sBufferLength = 0;
++ int rc = -1;
++ unsigned int packetBodyLength = 0;
++ HttpParser httpParser;
++ std::string httpBody;
++ AlertIndication alertIndication;
++
++ //printf("Processing notification message %d\n", newNotification);
++
++ //Init if new notification. Append recieved notification bytes to existing buffer otherwise.
++ if (_newNotification == true)
++ { if (sBuffer != NULL) {
++ delete []sBuffer;
++ }
++ sBuffer = NULL;
++ sBufferLength = 0;
++ }
++
++ if (sBuffer == NULL) {
++ sBufferLength = 0;
++ sBuffer = new char[(dataLength+1) *sizeof(char)];
++ memcpy(sBuffer, data, dataLength);
++ } else {
++ pBuffer = new char[(sBufferLength + dataLength + 1)*sizeof(char)];
++ memcpy(pBuffer, sBuffer, sBufferLength);
++ memcpy(pBuffer+sBufferLength, data, dataLength);
++ delete []sBuffer;
++ sBuffer = pBuffer;
++ }
++
++ sBufferLength += dataLength;
++ sBuffer[sBufferLength] = '\0';
++
++ do {
++
++ if (httpParser.parse(sBuffer) != 0) {
++ break;
++ }
++
++ if (httpParser.getHeaderField(_PACKET_BODY_LENGTH).empty()) {
++ break;
++ }
++
++ packetBodyLength = stoi(httpParser.getHeaderField(_PACKET_BODY_LENGTH));
++
++ if (packetBodyLength == 0) {
++ break;
++ }
++
++ httpBody = httpParser.getBody();
++ if (httpBody.size() < packetBodyLength) {
++ break;
++ }
++
++ if (alertIndication.initFromXml((char*)httpBody.c_str(), httpBody.size())) {
++ break;
++ }
++
++ std::string alertIDString(alertIndication.getMessageID().data, alertIndication.getMessageID().dataLength);
++ if (alertIDString.empty()) {
++ break;
++ }
++
++ /*Check if we have match only with ID, if fails then use MessageArguments and checkagain */
++ std::string alertDescription;
++ std::string _alertDescription;
++ std::string notificationBody;
++ std::string messageArguments;
++ alertDescription = AlertDescription::getAlertDescription(alertIDString);
++ messageArguments = std::string(alertIndication.getMessageArguments().data, alertIndication.getMessageArguments().dataLength);
++
++ if (alertDescription.empty()) {
++ alertIDString += "-" + messageArguments;
++ alertDescription = AlertDescription::getAlertDescription(alertIDString);
++ } else {
++ _alertDescription = messageArguments;
++ }
++
++ notificationBody = std::string(alertIndication.getIndicationTime().data, alertIndication.getIndicationTime().dataLength);
++ if (alertDescription.empty()) {
++ notificationBody += " " + alertIDString;
++ } else {
++ if (_alertDescription.empty()) {
++ notificationBody += " " + alertDescription;
++ } else {
++ notificationBody += " : " + _alertDescription + " : " + alertDescription;
++ }
++ }
++
++ Utils::notifyDesktop(_NOTIFICATION_HEADER, notificationBody, true);
++ rc = 0;
++
++ } while(0);
++
++ return rc;
++
+ }
++
+ int Protocol::_sendHostFQDN()
+ {
+ char localName[FQDN_MAX_SIZE] = "\0";
+@@ -1195,12 +1304,15 @@ void Protocol::_apfChannelOpen(LMEChannelOpenRequestMessage *chOpenMsg, int *sta
+ " Recipient channel %d for address %s, port %d.\n",
+ chOpenMsg->SenderChannel,
+ chOpenMsg->Address.c_str(), chOpenMsg->Port);
++
+ if(chOpenMsg->Port==0)
+ {
+- _UNSConnection();
+- _sendHostFQDN();
+- return;
++ _UNSSenderChannel = chOpenMsg->SenderChannel;
++ _lme.ChannelOpenReplySuccess(_UNSSenderChannel, _UNSRecipientChannel);
++ _newNotification = true;
++ return;
+ }
++
+ SOCKET s = ATNetworkTool::Connect(chOpenMsg->Address.c_str(),
+ chOpenMsg->Port, error, PF_UNSPEC);
+ if (s == INVALID_SOCKET) {
+@@ -1282,33 +1394,41 @@ PortForwardRequest *Protocol::_apfChannelClose(LMEChannelCloseMessage *chClMsg)
+ Lock l(_channelsLock);
+ PRINT("_apfChannelClose: RecipientChannel=%d\n",chClMsg->RecipientChannel);
+
+-
+- ChannelToSocketMap::iterator it = _channelToSocket.find(chClMsg->RecipientChannel);
+- if (it != _channelToSocket .end())
+- {
+- SOCKET s = it->second;
+- Channel *c = _socketToChannel[s];
+- switch(c->GetStatus()) {
+- case Channel::OPEN:
+- c->SetStatus(Channel::CLOSED);
+-
+- _lme.ChannelClose(c->GetRecipientChannel(), c->GetSenderChannel());
+- PRINT("Channel %d was closed by Intel AMT.\n", c->GetSenderChannel());
++ do {
++ if (chClMsg->RecipientChannel == _UNSRecipientChannel)
++ {
++ //UNS event channel close.
++ //We have not created a channel on LMS side, hence ignore
+ break;
++ }
+
+- case Channel::WAITING_CLOSE:
+- PRINT("Received reply by Intel AMT on closing channel %d.\n", c->GetSenderChannel());
+- break;
++ ChannelToSocketMap::iterator it = _channelToSocket.find(chClMsg->RecipientChannel);
++ if (it != _channelToSocket .end())
++ {
++ SOCKET s = it->second;
++ Channel *c = _socketToChannel[s];
++ switch(c->GetStatus()) {
++ case Channel::OPEN:
++ c->SetStatus(Channel::CLOSED);
++
++ _lme.ChannelClose(c->GetRecipientChannel(), c->GetSenderChannel());
++ PRINT("Channel %d was closed by Intel AMT.\n", c->GetSenderChannel());
++ break;
+
+- case Channel::CLOSED:
+- case Channel::NOT_OPENED:
+- break;
+- }
++ case Channel::WAITING_CLOSE:
++ PRINT("Received reply by Intel AMT on closing channel %d.\n", c->GetSenderChannel());
++ break;
+
+- _removeFromMaps(c);
+- clPFwdReq = _closeMChannel(c);
++ case Channel::CLOSED:
++ case Channel::NOT_OPENED:
++ break;
++ }
++
++ _removeFromMaps(c);
++ clPFwdReq = _closeMChannel(c);
+
+- }
++ }
++ } while(0);
+
+ _channelGenerator.FreeChannel(chClMsg->RecipientChannel);
+
+@@ -1320,6 +1440,18 @@ PortForwardRequest *Protocol::_apfChannelData(LMEChannelDataMessage *chDMsg, int
+ PortForwardRequest *clPFwdReq = NULL;
+
+ do {
++ if (chDMsg->RecipientChannel == _UNSRecipientChannel)
++
++ {
++ if (_UNSHandler((char*)chDMsg->Data, chDMsg->DataLength) == 0)
++ {
++ _lme.ChannelClose(_UNSSenderChannel, _UNSRecipientChannel);
++ }
++ _newNotification = false;
++ //UNS event data handle.
++ //We have not created a channel on LMS side, hence break
++ break;
++ }
+ Lock l(_channelsLock);
+
+ ChannelToSocketMap::iterator it = _channelToSocket.find(chDMsg->RecipientChannel);
+@@ -1341,6 +1473,7 @@ PortForwardRequest *Protocol::_apfChannelData(LMEChannelDataMessage *chDMsg, int
+ int senderr = 0;
+ int count = _send(channel->GetSocket(), (char *)chDMsg->Data,
+ chDMsg->DataLength, senderr);
++
+ PRINT("Sent %d bytes of %d from Intel AMT to channel %d with socket %d.\n",
+ count, chDMsg->DataLength, chDMsg->RecipientChannel,
+ channel->GetSocket());
+diff --git a/src/Protocol.h b/src/Protocol.h
+index a4ef419..858cb78 100755
+--- a/src/Protocol.h
++++ b/src/Protocol.h
+@@ -46,6 +46,7 @@
+
+ #define SOCKET int
+ #define INVALID_SOCKET (SOCKET)(~0)
++#define INVALID_CHANNEL -1
+ #define SOCKET_ERROR (-1)
+
+
+@@ -120,7 +121,7 @@ private:
+ PortForwardRequest *_apfChannelData(LMEChannelDataMessage *chDMsg, int *status);
+ void _LmeReceive(void *buffer, unsigned int len, int *status);
+ void _signalSelect();
+- void _UNSConnection();
++ int _UNSHandler(char *buffer, int len);
+ bool _acceptConnection(SOCKET s, unsigned int port);
+ int _rxFromSocket(SOCKET s);
+ int _handleFQDNChange(const char *fqdn);
+@@ -192,6 +193,11 @@ private:
+ typedef std::set<unsigned int> listenPortSet;
+ listenPortSet _listenFailReported;
+ ChannelGenerator _channelGenerator;
++ static const unsigned int _UNSRecipientChannel = 55555;
++ unsigned int _UNSSenderChannel;
++ bool _newNotification;
++ static std::string _PACKET_BODY_LENGTH;
++ static std::string _NOTIFICATION_HEADER;
+ };
+
+ #endif
+diff --git a/src/alertDescription.cpp b/src/alertDescription.cpp
+new file mode 100644
+index 0000000..f05f940
+--- /dev/null
++++ b/src/alertDescription.cpp
+@@ -0,0 +1,144 @@
++/*******************************************************************************
++ * Copyright (C) 2017 Intel Corporation. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are met:
++ *
++ * - Redistributions of source code must retain the above copyright notice,
++ * this list of conditions and the following disclaimer.
++ *
++ * - Redistributions in binary form must reproduce the above copyright notice,
++ * this list of conditions and the following disclaimer in the documentation
++ * and/or other materials provided with the distribution.
++ *
++ * - Neither the name of Intel Corporation. nor the names of its
++ * contributors may be used to endorse or promote products derived from this
++ * software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS
++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ *******************************************************************************/
++#include "alertDescription.h"
++#include "miniXmlParser.h"
++#include <sstream>
++#include <fstream>
++#include "defaultAlerts.h"
++#include "types.h"
++
++bool AlertDescription::classInited = false;
++std::string AlertDescription::alertXmlFile = "/usr/local/share/xml/AMTAlerts.xml";
++std::string AlertDescription::alertXmlFile1 = "/usr/share/xml/AMTAlerts.xml";
++std::map<std::string,std::string> AlertDescription::alertDescriptionMap;
++
++void AlertDescription::initAlertDescription() {
++
++ char *value = NULL;
++ unsigned int valueLength = 0;
++ bool fromFile = false;
++ std::string alertIdArg;
++ std::stringstream ss;
++ std::string xmlData;
++ CDataLen id;
++ CDataLen arg;
++ CDataLen description;
++ MiniXmlParser xmlParser;
++ std::list<CDataLen>defaultAlertsList;
++ std::list<CDataLen>::iterator it;
++
++ do {
++ if (classInited) {
++ break;
++ }
++
++ std::ifstream is(alertXmlFile, std::ifstream::in);
++ if (is.good()) {
++ ss << is.rdbuf();
++ xmlData = ss.str();
++ fromFile = true;
++ } else {
++ std::ifstream _is(alertXmlFile1, std::ifstream::in);
++ if (_is.good()) {
++ ss << _is.rdbuf();
++ xmlData = ss.str();
++ fromFile = true;
++ }
++ _is.close();
++ }
++ is.close();
++
++ /* Parse alert descriptions from xml file, if file is absent use the default ones */
++ if (fromFile) {
++ /* From xml file */
++ if (xmlParser.parse((char*)xmlData.c_str(), xmlData.size()) == 0) {
++ /* Process alert xml of form
++ * <Alerts><Alert><Id>iAMT0052</Id><Arg>1</Arg></Alert> <Alert>...</Alert> ...<Alerts>
++ */
++ if (xmlParser.getXmlTagValue(xmlParser.getRootNode(), "Alerts", 6, NULL, 0, &value, &valueLength) == 0 ) {
++ while (xmlParser.getXmlTagValue(NULL, "Alert", 5, NULL, 0, &value, &valueLength) == 0) {
++ xmlParser.getXmlTagValue(NULL, "Id", 2, NULL, 0, &value, &valueLength);
++ id.data = value;
++ id.dataLength = valueLength;
++
++ xmlParser.getXmlTagValue(NULL, "Arg", 3, NULL, 0, &value, &valueLength);
++ arg.data = value;
++ arg.dataLength = valueLength;
++
++ alertIdArg = std::string(id.data, id.dataLength) + "-" + std::string(arg.data, arg.dataLength);
++
++ xmlParser.getXmlTagValue(NULL, "Message", 7, NULL, 0, &value, &valueLength);
++ alertDescriptionMap.insert(std::pair<std::string, std::string>(alertIdArg, std::string(value, valueLength)));
++ }
++ classInited = true;
++ }
++ } else {
++ PRINT("Failed to parse XML\n");
++ }
++ } else {
++ /* Using default XML alerts descriptions */
++ defaultAlertsList = Utils::split(DEFAULT_ALERTS , DEFAULT_ALERTS_LENGTH , ";", 1);
++ for (CDataLen alert: defaultAlertsList) {
++ std::list<CDataLen> alertIdDescription = Utils::split(alert.data, alert.dataLength, ":", 1);
++ if (alertIdDescription.size() >= 2) {
++ it = alertIdDescription.begin();
++ id.data = it->data;
++ id.dataLength = it->dataLength;
++ it++;
++ description.data = it->data;
++ description.dataLength = it->dataLength;
++ /* Add to std::map for faster retreival */
++ alertDescriptionMap.insert(std::pair<std::string, std::string>(std::string(id.data, id.dataLength),
++ std::string(description.data, description.dataLength)));
++ }
++ }
++ classInited = true;
++ }
++ } while(0);
++}
++
++
++std::string AlertDescription::getAlertDescription(std::string alert) {
++ CDataLen alertDescription;
++ std::map<std::string, std::string>::iterator it;
++
++ if (classInited == false) {
++ initAlertDescription();
++ }
++
++ if (classInited && alertDescriptionMap.empty() == false) {
++ it = alertDescriptionMap.find(alert);
++ if (it != alertDescriptionMap.end()) {
++ return it->second;
++ }
++ }
++
++ return "";
++};
+diff --git a/src/alertDescription.h b/src/alertDescription.h
+new file mode 100644
+index 0000000..6413f2a
+--- /dev/null
++++ b/src/alertDescription.h
+@@ -0,0 +1,45 @@
++/*******************************************************************************
++ * Copyright (C) 2017 Intel Corporation. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are met:
++ *
++ * - Redistributions of source code must retain the above copyright notice,
++ * this list of conditions and the following disclaimer.
++ *
++ * - Redistributions in binary form must reproduce the above copyright notice,
++ * this list of conditions and the following disclaimer in the documentation
++ * and/or other materials provided with the distribution.
++ *
++ * - Neither the name of Intel Corporation. nor the names of its
++ * contributors may be used to endorse or promote products derived from this
++ * software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS
++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ *******************************************************************************/
++#ifndef _ALERTDESCRIPTION_H
++#define _AlERTDESCRIPTION_H
++#include "utils.h"
++#include <string>
++#include <map>
++class AlertDescription {
++ protected:
++ static bool classInited;
++ static std::string alertXmlFile;
++ static std::string alertXmlFile1;
++ static void initAlertDescription();
++ static std::map<std::string, std::string> alertDescriptionMap;
++ public:
++ static std::string getAlertDescription(std::string alert);
++};
++#endif
+diff --git a/src/alertIndication.cpp b/src/alertIndication.cpp
+new file mode 100644
+index 0000000..ed14abd
+--- /dev/null
++++ b/src/alertIndication.cpp
+@@ -0,0 +1,90 @@
++/*******************************************************************************
++ * Copyright (C) 2017 Intel Corporation. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are met:
++ *
++ * - Redistributions of source code must retain the above copyright notice,
++ * this list of conditions and the following disclaimer.
++ *
++ * - Redistributions in binary form must reproduce the above copyright notice,
++ * this list of conditions and the following disclaimer in the documentation
++ * and/or other materials provided with the distribution.
++ *
++ * - Neither the name of Intel Corporation. nor the names of its
++ * contributors may be used to endorse or promote products derived from this
++ * software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS
++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ *******************************************************************************/
++#include "miniXmlParser.h"
++#include "alertIndication.h"
++#include <string.h>
++
++const char* AlertIndication::CLASS_URI = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_AlertIndication";
++void AlertIndication::initAlertIndication(char *ns, unsigned int nsLen) {
++
++ char *value = NULL;
++ unsigned int valueLen= 0;
++
++ if (xmlParser.getXmlTagValue(xmlParser.getRootNode(), "MessageID", strlen("MessageID"), ns, nsLen, &value, &valueLen) == 0) {
++ messageID.data = value;
++ messageID.dataLength = valueLen;
++ }
++
++ if (xmlParser.getXmlTagValue(xmlParser.getRootNode(), "MessageArguments", strlen("MessageArguments"), ns, nsLen, &value, &valueLen) == 0) {
++ messageArguments.data = value;
++ messageArguments.dataLength = valueLen;
++ }
++
++ if (xmlParser.getXmlTagValue(xmlParser.getRootNode(), "IndicationTime", strlen("IndicationTime"), ns, nsLen, &value, &valueLen) == 0) {
++ if (xmlParser.getXmlTagValue(NULL, "Datetime", strlen("Datetime"), NULL, 0, &value, &valueLen) == 0) {
++ indicationTime.data = value;
++ indicationTime.dataLength = valueLen;
++ }
++ }
++}
++
++int AlertIndication::initFromXml(char *buffer, unsigned int bufferLen) {
++
++ char *nsPrefix = NULL;
++ int rc = 0;
++ unsigned int nsPrefixLen = 0;
++
++ do {
++ if (buffer == NULL || bufferLen == 0) {
++ rc = -1;
++ break;
++ }
++
++ if (xmlParser.parse(buffer, bufferLen)) {
++ rc = -1;
++ break;
++ }
++
++ if (xmlParser.getNSPrefix(xmlParser.getRootNode(), (char*)CLASS_URI, CLASS_URI_LEN, &nsPrefix, &nsPrefixLen)) {
++ rc = -1;
++ break;
++ }
++
++ initAlertIndication(nsPrefix, nsPrefixLen);
++
++ } while(0);
++
++ return rc;
++}
++
++CDataLen AlertIndication::getMessageArguments() { return messageArguments; };
++CDataLen AlertIndication::getIndicationTime() { return indicationTime; };
++CDataLen AlertIndication::getMessageID() { return messageID; };
++
+diff --git a/src/alertIndication.h b/src/alertIndication.h
+new file mode 100644
+index 0000000..cf6dc51
+--- /dev/null
++++ b/src/alertIndication.h
+@@ -0,0 +1,54 @@
++/*******************************************************************************
++ * Copyright (C) 2017 Intel Corporation. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are met:
++ *
++ * - Redistributions of source code must retain the above copyright notice,
++ * this list of conditions and the following disclaimer.
++ *
++ * - Redistributions in binary form must reproduce the above copyright notice,
++ * this list of conditions and the following disclaimer in the documentation
++ * and/or other materials provided with the distribution.
++ *
++ * - Neither the name of Intel Corporation. nor the names of its
++ * contributors may be used to endorse or promote products derived from this
++ * software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS
++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ *******************************************************************************/
++#ifndef __ALERTINDICATION_H
++#define __ALERTINDICATION_H
++
++#include "utils.h"
++#include <map>
++
++class AlertIndication {
++ private:
++ MiniXmlParser xmlParser;
++ CDataLen messageArguments;
++ CDataLen indicationTime;
++ CDataLen messageID;
++ void initAlertIndication(char *ns, unsigned int nsLen);
++
++ public:
++ static const char* CLASS_URI;
++ static const int CLASS_URI_LEN = 69;
++ int initFromXml(char *buffer, unsigned int bufferLen);
++ CDataLen getMessageArguments();
++ CDataLen getMessageID();
++ CDataLen getIndicationTime();
++
++};
++
++#endif
+diff --git a/src/defaultAlerts.h b/src/defaultAlerts.h
+new file mode 100644
+index 0000000..23283f8
+--- /dev/null
++++ b/src/defaultAlerts.h
+@@ -0,0 +1,43 @@
++#ifndef _DEFAULTALERTS_H
++#define _DEFAULTALERTS_H
++#define DEFAULT_ALERTS_LENGTH 6257
++#define DEFAULT_ALERTS "iAMT0001-:System Defense Policy triggered.;iAMT0002-:Agent Presence Agent not started.;iAMT0003-:Agent Presence Agent stopped.;iAMT0004-:Agent Presence: running.;\
++iAMT0005-:Agent Presence: expired.;iAMT0006-:Agent Presence: suspended.;iAMT0007-:Host software attempt to disable AMT Network link detected.;\
++iAMT0008-:Host software attempt to disable AMT Network link detected -- Host Network link blocked.;iAMT0009-:AMT clock or FLASH wear-out protection disabled.;\
++iAMT0010-:Intel(R) AMT Network Interface: Heuristics defense slow threshold trespassed.;iAMT0011-:Intel(R) AMT Network Interface: Heuristics defense fast threshold trespassed.;\
++iAMT0012-:Intel(R) AMT Network Interface: Heuristics defense factory defined threshold trespassed.;iAMT0013-:Intel(R) AMT Network Interface: Heuristics defense Encounter timeout expired.;\
++iAMT0014-:General certificate error.;iAMT0015-:Certificate expired.;iAMT0016-:No trusted root certificate.;iAMT0017-:Not configured to work with server certificate.;iAMT0018-:Certificate revoked.;\
++iAMT0019-:RSA exponent too large.;iAMT0020-:RSA modulus too large.;iAMT0021-:Unsupported digest.;iAMT0022-:Distinguished name too long.;iAMT0023-:Key usage missing.;\
++iAMT0024-:General SSL handshake error.;iAMT0025-:General 802.1x error.;iAMT0026-:AMT Diagnostic AlertEAC error - General NAC error.;\
++iAMT0027-:AMT Diagnostic AlertEAC error - attempt to get a NAC posture while AMT NAC is disabled.;iAMT0028-:AMT Diagnostic AlertEAC error - attempt to get a posture of an unsupported type.;\
++iAMT0029-:Audit log storage is 50% full.;iAMT0030-:Audit log storage is 75% full.;iAMT0031-:Audit log storage is 85% full.;iAMT0032-:Audit log storage is 95% full.;\
++iAMT0033-:Audit log storage is full.;iAMT0034-:Firmware Update Event - Partial.;iAMT0035-:Firmware Update Event - Failure.;iAMT0036-:Remote connectivity initiated.;\
++iAMT0037-:ME Presence event.;iAMT0038-0:AMT is being unprovisioned using BIOS command.;iAMT0038-1:AMT is being unprovisioned using Local MEI command.;\
++iAMT0038-2:AMT is being unprovisioned using Local WS-MAN/SOAP command.;iAMT0038-3:AMT is being unprovisioned using Remote WS-MAN/SOAP command.;\
++iAMT0050-:User Notification Alert - General Notification.;iAMT0050-16:User Notification Alert - Circuit Breaker notification (CB Drop TX filter hit.).;\
++iAMT0050-17:User Notification Alert - Circuit Breaker notification (CB Rate Limit TX filter hit.).;iAMT0050-18:User Notification Alert - Circuit Breaker notification (CB Drop RX filter hit.).;\
++iAMT0050-19:User Notification Alert - Circuit Breaker notification (CB Rate Limit RX filter hit.).;iAMT0050-32:User Notification Alert - EAC notification.;\
++iAMT0050-48:User Notification Alert - Remote diagnostics - (Remote Redirection session started - SOL).;iAMT0050-49:User Notification Alert - Remote diagnostics - (Remote Redirection session stopped - SOL).;\
++iAMT0050-50:User Notification Alert - Remote diagnostics. (Remote Redirection session started - IDE-R).;iAMT0050-51:User Notification Alert - Remote diagnostics. (Remote Redirection session stopped - IDE-R).;\
++iAMT0050-66:User Notification Alert - WLAN notification (Host profile mismatch - Management Interface ignored).;\
++iAMT0050-67:User Notification Alert - WLAN notification (Management device overrides host radio).;iAMT0050-68:User Notification Alert - WLAN notification (Host profile security mismatch).;\
++iAMT0050-69:User Notification Alert - WLAN notification (Management device relinquishes control over host Radio).;iAMT0051-:User Notification Alert - SecIo event.;\
++iAMT0051-0:User Notification Alert - SecIo event semaphore at host.;iAMT0051-1:User Notification Alert - semaphore at ME.;iAMT0051-2:User Notification Alert - SecIo event - semaphore timeout.;\
++iAMT0052-:User Notification Alert - KVM session event.;iAMT0052-0:User Notification Alert - KVM session requested.;iAMT0052-1:User Notification Alert - KVM session started.;\
++iAMT0052-2:User Notification Alert - KVM session stopped.;iAMT0053-:User Notification Alert - RCS notification.;\
++iAMT0053-50:User Notification Alert - RCS notification (HW button pressed. Connection initiated automatically).;\
++iAMT0053-52:User Notification Alert - RCS notification (HW button pressed. Connection wasn't initiated automatically).;iAMT0053-53:User Notification Alert - RCS notification (Contracts updated).;\
++iAMT0054-:User Notification Alert - WLAN notification. Wireless Profile sync enablement state changed.;iAMT0055-:User Notification Alert - Provisioning state change notification.;\
++iAMT0055-0:User Notification Alert - Provisioning state change notification - Pre-configuration.;iAMT0055-1:User Notification Alert - Provisioning state change notification - In configuration.;\
++iAMT0055-2:User Notification Alert - Provisioning state change notification - Post-configuration.;\
++iAMT0055-3:User Notification Alert - Provisioning state change notification - unprovision process has started.;iAMT0056-:User Notification Alert - System Defense change notification.;\
++iAMT0057-:User Notification Alert - Network State change notification.;iAMT0058-:User Notification Alert - Remote Access change notification.;\
++iAMT0058-1:User Notification Alert - Remote Access change notification - tunnel is closed.;iAMT0058-1:User Notification Alert - Remote Access change notification - tunnel is open.;\
++iAMT0059-:User Notification Alert - KVM enabled event.;iAMT0059-0:User Notification Alert - KVM enabled event - KVM disabled.;\
++iAMT0059-1:User Notification Alert - KVM enabled event - KVM enabled (both from MEBx and PTNI).;iAMT0060-:User Notification Alert - SecIO configuration event.;iAMT0061-:ME FW reset occurred.;\
++iAMT0062-:User Notification Alert - IpSyncEnabled event.;iAMT0062-0:User Notification Alert - IpSyncEnabled event - IpSync disabled.;\
++iAMT0062-1:User Notification Alert - IpSyncEnabled event - IpSync enabled.;iAMT0063-:User Notification Alert - HTTP Proxy sync enabled event.;\
++iAMT0063-0:User Notification Alert - HTTP Proxy sync enabled event - HTTP Proxy Sync disabled.;iAMT0063-1:User Notification Alert - HTTP Proxy sync enabled event - HTTP Proxy Sync enabled.;\
++iAMT0064-:User Notification Alert - User Consent event.;iAMT0064-1:User Notification Alert - User Consent event - User Consent granted.;\
++iAMT0064-2:User Notification Alert - User Consent event - User Consent ended.;"
++#endif
+diff --git a/src/notifyDesktop.sh b/src/notifyDesktop.sh
+new file mode 100644
+index 0000000..06bfd97
+--- /dev/null
++++ b/src/notifyDesktop.sh
+@@ -0,0 +1,10 @@
++#!/bin/sh
++# get list of current users
++for x in $(who | sort -u -k1,1 | awk '{print $1}'); do
++ # send message to anyone on display 0
++ dbus_session_file=$(eval echo "~$x")/.dbus/session-bus/$(cat /var/lib/dbus/machine-id)-0
++ if [ -e "$dbus_session_file" ]; then
++ su -l "$x" -c "source '$dbus_session_file'; export DISPLAY=:0; notify-send -u critical -t 2000 '$1' '$2'"
++ fi
++done
++
+diff --git a/src/tools/httpParser.cpp b/src/tools/httpParser.cpp
+new file mode 100644
+index 0000000..38d2901
+--- /dev/null
++++ b/src/tools/httpParser.cpp
+@@ -0,0 +1,101 @@
++/*******************************************************************************
++ * Copyright (C) 2017 Intel Corporation. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are met:
++ *
++ * - Redistributions of source code must retain the above copyright notice,
++ * this list of conditions and the following disclaimer.
++ *
++ * - Redistributions in binary form must reproduce the above copyright notice,
++ * this list of conditions and the following disclaimer in the documentation
++ * and/or other materials provided with the distribution.
++ *
++ * - Neither the name of Intel Corporation. nor the names of its
++ * contributors may be used to endorse or promote products derived from this
++ * software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS
++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ *******************************************************************************/
++#include "httpParser.h"
++#include "utils.h"
++#include "types.h"
++
++int HttpParser::parse(char *buffer) {
++
++ std::vector<std::string> headerBody;
++ std::vector<std::string> header;
++ int rc = 0;
++ do {
++ if (buffer == NULL) {
++ rc = -1;
++ break;
++ }
++
++ headerBody = Utils::split(buffer, "\r\n\r\n");
++ if (headerBody.size() < 2)
++ {
++ PRINT("Failed to process httpHeader\n");
++ rc = -1;
++ break;
++ }
++
++ /* Entries in Header are seperated by \r\n */
++ header = Utils::split((char*)headerBody[0].c_str(), "\r\n");
++
++ /* First line in header is the the header line
++ * e.g. POST <path> HTTP/1.1
++ * e.g GET <path> HTTP/1.1
++ */
++ headerLine = header[0];
++
++ /* After headerline are the Fields
++ * e.g Content-Length:2204
++ */
++ for (unsigned int i=1; i< header.size(); i++) {
++ std::vector<std::string> field = Utils::split((char*)header[i].c_str(), ":");
++ if (field.size() < 2) {
++ rc = -1;
++ break;
++ }
++ headerFields.insert(std::pair<std::string, std::string>(field[0], field[1]));
++ }
++
++ if (rc) break;
++
++ body = headerBody[1];
++ } while(0);
++
++ return rc;
++}
++
++std::string HttpParser::getHeaderLine() {
++ return headerLine;
++}
++
++std::string HttpParser::getHeaderField(std::string field) {
++ std::map<std::string,std::string>::iterator it;
++ std::string fieldValue = "";
++
++ it = headerFields.find(field);
++ if (it != headerFields.end())
++ {
++ fieldValue = it->second;
++ }
++
++ return fieldValue;
++}
++
++std::string HttpParser::getBody() {
++ return body;
++}
+diff --git a/src/tools/httpParser.h b/src/tools/httpParser.h
+new file mode 100644
+index 0000000..a82d82a
+--- /dev/null
++++ b/src/tools/httpParser.h
+@@ -0,0 +1,49 @@
++/*******************************************************************************
++ * Copyright (C) 2017 Intel Corporation. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are met:
++ *
++ * - Redistributions of source code must retain the above copyright notice,
++ * this list of conditions and the following disclaimer.
++ *
++ * - Redistributions in binary form must reproduce the above copyright notice,
++ * this list of conditions and the following disclaimer in the documentation
++ * and/or other materials provided with the distribution.
++ *
++ * - Neither the name of Intel Corporation. nor the names of its
++ * contributors may be used to endorse or promote products derived from this
++ * software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS
++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ *******************************************************************************/
++#ifndef _HTTPPARSER_H
++#define _HTTPPARSER_H
++#include <vector>
++#include <map>
++#include <string>
++
++class HttpParser {
++
++ public:
++ int parse(char *buffer);
++ std::string getHeaderLine();
++ std::string getHeaderField(std::string field);
++ std::string getBody();
++ private:
++ std::string headerLine;
++ std::map<std::string, std::string> headerFields;
++ std::string body;
++
++};
++#endif
+diff --git a/src/tools/miniXmlParser.cpp b/src/tools/miniXmlParser.cpp
+new file mode 100644
+index 0000000..f1f0503
+--- /dev/null
++++ b/src/tools/miniXmlParser.cpp
+@@ -0,0 +1,375 @@
++/*******************************************************************************
++ * Copyright (C) 2017 Intel Corporation. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are met:
++ *
++ * - Redistributions of source code must retain the above copyright notice,
++ * this list of conditions and the following disclaimer.
++ *
++ * - Redistributions in binary form must reproduce the above copyright notice,
++ * this list of conditions and the following disclaimer in the documentation
++ * and/or other materials provided with the distribution.
++ *
++ * - Neither the name of Intel Corporation. nor the names of its
++ * contributors may be used to endorse or promote products derived from this
++ * software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS
++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ *******************************************************************************/
++#include "miniXmlParser.h"
++#include "utils.h"
++#include <string.h>
++#include <list>
++#include <stack>
++#include "types.h"
++
++MiniXmlParser::MiniXmlParser() {
++ rootNode = NULL;
++}
++
++MiniXmlParser::~MiniXmlParser() {
++ if (rootNode) {
++ deleteXmlTree(rootNode);
++ rootNode = NULL;
++ }
++}
++
++void MiniXmlParser::deleteXmlTree(XMLNode* rootNode) {
++ XMLNode* node = rootNode;
++ XMLNode* tempNode = NULL;
++
++ while (node != NULL) {
++ tempNode = node->childNode;
++ delete node;
++ node = tempNode;
++ }
++}
++
++int MiniXmlParser::validateXML(XMLNode const* rootNode) {
++ int rc = 0;
++ XMLNode* current = (XMLNode *)rootNode;
++ XMLNode* temp = NULL;
++ std::stack<XMLNode*> tagStack;
++
++ while (current != NULL) {
++ if (current->tagName == NULL) {
++ PRINT("ValidateXML failed, foung a empty tag\n");
++ rc = -1;
++ break;
++ }
++
++ if (memcmp(current->tagName, "!", 1) == 0) {
++ temp = current;
++ current = tagStack.empty()?NULL:tagStack.top();
++ if (current != NULL) {
++ current->childNode = temp->childNode;
++ } else {
++ current = temp;
++ }
++ } else if (current->startTag) {
++ current->parentNode = tagStack.empty()?NULL:tagStack.top();
++ tagStack.push(current);
++ } else {
++ if (tagStack.empty() == false) {
++ temp = tagStack.top();
++ tagStack.pop();
++ } else {
++ temp = NULL;
++ }
++ if (temp != NULL) {
++ if (temp->tagLength == current->tagLength && memcmp(temp->tagName, current->tagName, current->tagLength) == 0) {
++ if (current->childNode != NULL) {
++ if (current->childNode->startTag != 0) {
++ temp->siblingNode = current->childNode;
++ }
++ }
++ temp->closingTag = current;
++ current->startingTag = temp;
++ } else {
++ PRINT("ValidateXML failed, Illegal tag\n");
++ rc = -1;
++ break;
++ }
++ } else {
++ PRINT("ValidateXML failed, Illegal closing tag\n");
++ rc = -1;
++ break;
++ }
++ }
++ current = current->childNode;
++ }
++
++ if (tagStack.empty() == false) {
++ PRINT("ValidateXML failed, Incomplete XML\n");
++ rc = -1;
++ }
++
++ return rc;
++}
++
++int MiniXmlParser::parse(char* buffer, unsigned int bufferLength) {
++ int validXml = -1;
++ XMLNode* node = NULL;
++
++ node = _parse(buffer, bufferLength);
++ if (node) {
++ validXml = validateXML(node);
++ }
++ rootNode = node;
++ return validXml;
++}
++
++XMLNode* MiniXmlParser::_parse(char const* buffer, unsigned int bufferLength) {
++
++ char* tagName = NULL;
++ char* nsTag = NULL;
++ char* CommentEnd = NULL;
++
++ int tagLength = 0;
++ int startTag = 0;
++ int emptyTag = 0;
++ int nsLength = 0;
++ int i = 0;
++ int CommentIndex = 0;
++
++ std::list<CDataLen> xmlFields;
++ std::list<CDataLen> temp2;
++ std::list<CDataLen> tagValue;
++
++ XMLNode *rootNode = NULL;;
++ XMLNode *current = NULL;
++ XMLNode *newNode = NULL;
++ std::list<CDataLen>::iterator it;
++
++ if (buffer == NULL || bufferLength == 0) {
++ return NULL;
++ }
++
++ xmlFields = Utils::split(buffer, bufferLength, "<", 1);
++ for (CDataLen xmlField: xmlFields) {
++ if (xmlField.dataLength != 0 && memcmp(xmlField.data, "?", 1) != 0 && (xmlField.data > CommentEnd)) {
++ /*Parse XML comments and ignore it.*/
++ if (xmlField.dataLength > 3 && memcmp(xmlField.data, "!--", 3)==0) {
++ CommentIndex = 3;
++ while (((xmlField.data + CommentIndex) < (buffer + bufferLength)) && memcmp(xmlField.data + CommentIndex, "-->", 3) != 0) {
++ CommentIndex++;
++ }
++ CommentEnd = xmlField.data + CommentIndex;
++ continue;
++ } else {
++ emptyTag = 0;
++ /*if the first char is / after < then its ending tag, otherwise starting tag. ("</....") */
++ if (memcmp(xmlField.data, "/", 1) == 0) {
++ startTag = 0;
++ xmlField.data = xmlField.data + 1;
++ xmlField.dataLength -= 1;
++ temp2 = Utils::split(xmlField.data, xmlField.dataLength, ">", 1);
++ } else {
++
++ startTag = 1;
++ temp2 = Utils::split(xmlField.data, xmlField.dataLength, ">", 1);
++ if (temp2.front().dataLength > 0 && *(char*)(temp2.front().data-1) == '/') {
++ //".../>" are empty tags
++ emptyTag = 1;
++ }
++ }
++ }
++ /*split on ":" to get namespace:tagName*/
++ tagValue = Utils::split(temp2.front().data, temp2.front().dataLength, ":", 1);
++ if (tagValue.size() == 1) {
++ nsTag = NULL;
++ nsLength = 0;
++ tagName = tagValue.front().data;
++ tagLength = tagValue.front().dataLength;
++ } else {
++ it = tagValue.begin();
++ nsTag = it->data;
++ nsLength = it->dataLength;
++ it++;
++ tagName = it->data;
++ tagLength = it->dataLength;
++ }
++ tagValue.clear();
++ temp2.clear();
++
++ /*Parse for multiple ns:tags and recompute the first tagLength*/
++ for(i=0; i<tagLength; i++) {
++ if ((tagName[i] == ' ')||(tagName[i] == '/')||(tagName[i] == '>')||(tagName[i] == '\t')||(tagName[i] == '\r')||(tagName[i] == '\n')) {
++ if (i != 0) {
++ if (tagName[i]=='/') {
++ emptyTag = 1;
++ }
++ tagLength = i;
++ break;
++ }
++ }
++ }
++
++ /*Create XML Node, populate properties and add it to the list*/
++ if (tagLength != 0) {
++ newNode = new XMLNode();
++ newNode->tagName = tagName;
++ newNode->tagLength = tagLength;
++ newNode->startTag = startTag;
++ newNode->nsTag = nsTag;
++ newNode->nsLength = nsLength;
++
++
++ if (rootNode == NULL) {
++ rootNode = newNode;
++ }
++ else {
++ current->childNode = newNode;
++ }
++ current = newNode;
++
++ if (emptyTag) {
++ newNode = new XMLNode();
++ newNode->tagName = tagName;
++ newNode->tagLength = tagLength;
++ newNode->nsTag = nsTag;
++ newNode->nsLength = nsLength;
++
++ current->emptyTag = 1;
++ current->childNode = newNode;
++ current = newNode;
++ }
++ }
++
++ }
++ }
++
++ xmlFields.clear();
++ return rootNode;
++}
++
++/*
++ * Parse the XML Tree from rootNode and retrive value of a given key.
++ * If rootNode is passed as NULL, parsing resumes from last key retrieved node.
++ * Return 0 on Success , -1 otherwise.
++ * Inputs : XMLNode *rootNode, char *tag, unsigned int tagLen, char *ns, unsigned int nsLen
++ * Outputs: char** value, unsigned int *valueLen
++ */
++int MiniXmlParser::getXmlTagValue(XMLNode const* rootNode, char const* tag, unsigned int tagLen, char const* ns, unsigned int nsLen, char** value, unsigned int *valueLen)
++{
++
++ static XMLNode *cur = (XMLNode*) rootNode;
++ static XMLNode *pcur = cur;
++ char *pValue = NULL;
++ bool found = false;
++
++ if (tag == NULL) {
++ return -1;
++ }
++
++ if (rootNode != NULL) {
++ cur = (XMLNode *) rootNode;
++ pcur = cur;
++ }
++
++ while (cur != NULL) {
++ while (pcur != NULL) {
++ if (pcur->closingTag && memcmp((pcur->tagName), tag, tagLen) == 0) {
++ if (ns) {
++ if (memcmp(pcur->nsTag, ns, pcur->nsLength) == 0) {
++ found = true;
++ }
++ } else {
++ found = true;
++ }
++
++ if (found) {
++ pValue = strstr(pcur->tagName, ">") + 1;
++ if (pcur->closingTag->nsLength) {
++ *valueLen = pcur->closingTag->nsTag - pValue - 2;
++ } else {
++ *valueLen = pcur->closingTag->tagName - pValue - 2;
++ }
++ *value = pValue;
++ pcur = pcur->childNode;
++ return 0;
++ }
++ }
++ pcur = pcur->childNode;
++ }
++ cur = cur->siblingNode;
++ pcur = cur;
++ }
++
++ return -1;
++}
++
++/* Returns Namespace prefix of given URI namespace
++ * Inputs : XMLNode *node, char *uri, unsigned int uriLen
++ * Outputs: char **nsPrefix, unsigned int *nsPrefixLen
++ */
++int MiniXmlParser::getNSPrefix(XMLNode const* node, char const* uri, unsigned int uriLen, char **nsPrefix, unsigned int *nsPrefixLen) {
++
++ bool foundNS = false;;
++ char *tagEnd = NULL;
++ int rc = 0;
++ CDataLen tempNS;
++ CDataLen tempURI;
++ std::list<CDataLen> tags;
++ std::list<CDataLen> temp;
++ std::list<CDataLen> temp2;
++ std::list<CDataLen>::iterator it;
++
++ if (node == NULL || uri == NULL) {
++ rc = -1;
++ return rc;
++ }
++
++ tagEnd = strstr(node->tagName, ">");
++ if (tagEnd && nsPrefix != NULL && nsPrefixLen != NULL) {
++ tags = Utils::split(node->tagName, tagEnd - node->tagName, " ", 1);
++ for (CDataLen tag: tags) {
++ temp = Utils::split(tag.data, tag.dataLength, ":", 1);
++ if (temp.size() >= 2) {
++ it = temp.begin();
++ tempNS.data = it->data;
++ tempNS.dataLength = it->dataLength;
++ it++;
++
++ if (memcmp(tempNS.data, "xmlns", 5) == 0) {
++ temp2 = Utils::split(it->data, it->dataLength, "=", 1);
++ if (temp2.size() >= 2) {
++ it = temp2.begin();
++ tempNS.data = it->data;
++ tempNS.dataLength = it->dataLength;
++ it++;
++ }
++ }
++ //Ignore if first character is " or '
++ if (it->data[0] == 34 || it->data[0] == 39) {
++ it->data = it->data + 1;
++ }
++
++ if (memcmp(it->data, uri, uriLen) == 0) {
++ foundNS = true;
++ break;
++ }
++ }
++ }
++ } else {
++ rc = -1;
++ }
++
++ if (rc == 0 && foundNS) {
++ *nsPrefix = tempNS.data;
++ *nsPrefixLen = tempNS.dataLength;
++ }
++
++ return rc;
++}
+diff --git a/src/tools/miniXmlParser.h b/src/tools/miniXmlParser.h
+new file mode 100644
+index 0000000..ae0d234
+--- /dev/null
++++ b/src/tools/miniXmlParser.h
+@@ -0,0 +1,51 @@
++/*******************************************************************************
++ * Copyright (C) 2017 Intel Corporation. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are met:
++ *
++ * - Redistributions of source code must retain the above copyright notice,
++ * this list of conditions and the following disclaimer.
++ *
++ * - Redistributions in binary form must reproduce the above copyright notice,
++ * this list of conditions and the following disclaimer in the documentation
++ * and/or other materials provided with the distribution.
++ *
++ * - Neither the name of Intel Corporation. nor the names of its
++ * contributors may be used to endorse or promote products derived from this
++ * software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS
++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ *******************************************************************************/
++#ifndef _MINIXMLPARSER_H
++#define _MINIXMLPARSER_H
++#include <iostream>
++#include "xmlNode.h"
++
++class MiniXmlParser {
++ public:
++ MiniXmlParser();
++ ~MiniXmlParser();
++ int parse(char* buffer, unsigned int bufferLength);
++ XMLNode* getRootNode() { return rootNode; };
++ int getXmlTagValue(XMLNode const* rootNode, char const *tag, unsigned int tagLen, char const* ns, unsigned int nsLen, char** value, unsigned int *valueLen);
++ int getNSPrefix(XMLNode const* nonde, char const* uri, unsigned int uriLen, char **nsPrefix, unsigned int *nsPrefixLen);
++
++ private:
++ XMLNode* rootNode;
++ XMLNode* _parse(char const* buffer, unsigned int bufferLength);
++ /* Validates if the XML is well formed and sets up parent sibling pointers */
++ int validateXML(XMLNode const* rootNode);
++ void deleteXmlTree(XMLNode *root);
++};
++#endif
+diff --git a/src/tools/utils.cpp b/src/tools/utils.cpp
+new file mode 100644
+index 0000000..ec20b28
+--- /dev/null
++++ b/src/tools/utils.cpp
+@@ -0,0 +1,185 @@
++/*******************************************************************************
++ * Copyright (C) 2017 Intel Corporation. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are met:
++ *
++ * - Redistributions of source code must retain the above copyright notice,
++ * this list of conditions and the following disclaimer.
++ *
++ * - Redistributions in binary form must reproduce the above copyright notice,
++ * this list of conditions and the following disclaimer in the documentation
++ * and/or other materials provided with the distribution.
++ *
++ * - Neither the name of Intel Corporation. nor the names of its
++ * contributors may be used to endorse or promote products derived from this
++ * software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS
++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ *******************************************************************************/
++#include <string.h>
++#include "utils.h"
++#include <syslog.h>
++#include <unistd.h>
++
++std::vector<std::string> Utils::split(char const * str, char const * delim) {
++ char* tok = (char*)str;
++ char* ptok = tok;
++ int delimLength = 0;
++ std::vector<std::string> splittedStrings;
++
++ do {
++ if (str == NULL) {
++ break;
++ }
++
++ if (delim == NULL) {
++ splittedStrings.push_back(std::string(str));
++ break;
++ }
++
++ delimLength = strlen(delim);
++ tok = strstr(ptok, delim);
++ while (tok) {
++ if (ptok != tok) {
++ splittedStrings.push_back(std::string(ptok, tok-ptok));
++ }
++ ptok = tok + delimLength;
++ tok = strstr(ptok, delim);
++ }
++
++ if (ptok != str+strlen(str)) {
++ splittedStrings.push_back(std::string(ptok, strlen(ptok)));
++ }
++ } while(0);
++ return splittedStrings;
++}
++
++
++char* Utils::strnstr(char const* haystack, unsigned int haystackLength, char const* needle, unsigned int needleLength) {
++
++ char* needleInHaystack = NULL;
++ unsigned int j;
++ do {
++ if (haystack == NULL || needle == NULL) {
++ break;
++ }
++
++ for (unsigned int i = 0; i < haystackLength; i++) {
++ if (haystack[i] == '\0' || ((haystackLength - i) < needleLength)) {
++ break;
++ }
++
++ for (j = 0; j < needleLength; j++) {
++ if (haystack[i + j] != needle[j]) {
++ break;
++ }
++ }
++
++ if (j == needleLength) {
++ //Found needle in haystack
++ needleInHaystack = (char*)&haystack[i];
++ break;
++ }
++ }
++ } while(0);
++ return needleInHaystack;
++}
++
++std::list<CDataLen> Utils::split(char const* str, unsigned int strLength, char const* delim, unsigned int delimLength) {
++ char* tok = (char*)str;
++ char* ptok = tok;
++ std::list<CDataLen> splittedStrings;
++ CDataLen dataLen;
++
++ do {
++ if (str == NULL) {
++ break;
++ }
++
++ if (delim == NULL) {
++ dataLen.data = (char*)str;
++ dataLen.dataLength = strLength;
++ splittedStrings.push_back(dataLen);
++ break;
++ }
++
++ tok = Utils::strnstr(str, strLength, delim, delimLength);
++ while (tok) {
++ dataLen.data = ptok;
++ dataLen.dataLength = tok-ptok;
++ if (ptok!=tok) {
++ splittedStrings.push_back(dataLen);
++ }
++ ptok = tok + delimLength;
++ tok = Utils::strnstr(ptok, (str + strLength - ptok), delim, delimLength);
++ }
++
++ if (ptok != (str + strLength)) {
++ dataLen.data = ptok;
++ dataLen.dataLength = str + strLength - ptok;
++ splittedStrings.push_back(dataLen);
++ }
++ } while (0);
++ return splittedStrings;
++}
++
++std::string Utils::DEFAULT_NOTIFY_CMD="export DISPLAY=:0; notify-send -u critical -t 2000 ";
++std::string Utils::NOTIFY_DESKTOP_SCRIPT="/usr/local/bin/notifyDesktop.sh";
++std::string Utils::NOTIFY_DESKTOP_SCRIPT1="/usr/bin/notifyDesktop.sh";
++
++void Utils::notifyDesktop(std::string header, std::string body, bool logInSyslog) {
++
++ std::string notifyCMD;
++
++ if (! access (NOTIFY_DESKTOP_SCRIPT.c_str(), X_OK)) {
++ notifyCMD = NOTIFY_DESKTOP_SCRIPT + " '" + header + "' '" + body + "'";
++ } else if (! access (NOTIFY_DESKTOP_SCRIPT1.c_str(), X_OK)) {
++ notifyCMD = NOTIFY_DESKTOP_SCRIPT1 + " '" + header + "' '" + body + "'";
++ } else {
++ notifyCMD = DEFAULT_NOTIFY_CMD + " '" + header + "' '" + body + "'";
++ }
++
++ if (logInSyslog) {
++ syslog(LOG_INFO, "%s %s\n", header.c_str(), body.c_str());
++ }
++
++ system(notifyCMD.c_str());
++}
++
++
++std::string Utils::format(const char *format , ...) {
++ char* buffer = NULL;
++ int bufferLength = 512;
++ int _bufferLength = 0;
++ va_list vl;
++ std::string formattedString("");
++
++ buffer = new char[bufferLength];
++ if (buffer) {
++ va_start(vl, format);
++
++ _bufferLength = vsnprintf(buffer, bufferLength, format, vl);
++ if (bufferLength <= _bufferLength) {
++ delete[] buffer;
++ buffer = new char[_bufferLength + 1];
++ _bufferLength = vsnprintf(buffer, _bufferLength, format, vl);
++ }
++
++ formattedString = std::string(buffer);
++ va_end(vl);
++ delete[] buffer;
++ }
++
++ return formattedString;
++}
+diff --git a/src/tools/utils.h b/src/tools/utils.h
+new file mode 100644
+index 0000000..a7568fa
+--- /dev/null
++++ b/src/tools/utils.h
+@@ -0,0 +1,57 @@
++/*******************************************************************************
++ * Copyright (C) 2017 Intel Corporation. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are met:
++ *
++ * - Redistributions of source code must retain the above copyright notice,
++ * this list of conditions and the following disclaimer.
++ *
++ * - Redistributions in binary form must reproduce the above copyright notice,
++ * this list of conditions and the following disclaimer in the documentation
++ * and/or other materials provided with the distribution.
++ *
++ * - Neither the name of Intel Corporation. nor the names of its
++ * contributors may be used to endorse or promote products derived from this
++ * software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS
++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ *******************************************************************************/
++
++#ifndef __UTILS_H
++#define __UTILS_H
++#include <iostream>
++#include <vector>
++#include <list>
++#include <string>
++#include <cstdarg>
++
++class CDataLen {
++ public:
++ char* data;
++ int dataLength;
++ CDataLen() { data = NULL; dataLength = 0; };
++};
++
++class Utils {
++ public:
++ static std::string NOTIFY_DESKTOP_SCRIPT;
++ static std::string NOTIFY_DESKTOP_SCRIPT1;
++ static std::string DEFAULT_NOTIFY_CMD;
++ static std::vector<std::string> split(char const* str, char const * delim);
++ static std::list<CDataLen> split(char const* str, unsigned int strLength, char const* delim, unsigned int delimLength);
++ static char* strnstr(char const* haystack, unsigned int haystackLength, char const* needle, unsigned int needleLength);
++ static void notifyDesktop(std::string header, std::string body, bool logInSyslog);
++ static std::string format(const char *format , ...);
++};
++#endif
+diff --git a/src/tools/xmlNode.cpp b/src/tools/xmlNode.cpp
+new file mode 100644
+index 0000000..827cd3f
+--- /dev/null
++++ b/src/tools/xmlNode.cpp
+@@ -0,0 +1,45 @@
++/*******************************************************************************
++ * Copyright (C) 2017 Intel Corporation. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are met:
++ *
++ * - Redistributions of source code must retain the above copyright notice,
++ * this list of conditions and the following disclaimer.
++ *
++ * - Redistributions in binary form must reproduce the above copyright notice,
++ * this list of conditions and the following disclaimer in the documentation
++ * and/or other materials provided with the distribution.
++ *
++ * - Neither the name of Intel Corporation. nor the names of its
++ * contributors may be used to endorse or promote products derived from this
++ * software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS
++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ *******************************************************************************/
++#include "xmlNode.h"
++#include <iostream>
++XMLNode::XMLNode() {
++ tagName = NULL;
++ nsTag = NULL;
++ tagLength = 0;
++ nsLength = 0;
++ startTag = 0;
++ emptyTag = 0;
++
++ closingTag = NULL;
++ startingTag = NULL;
++ parentNode = NULL;
++ childNode = NULL;
++ siblingNode = NULL;
++}
+diff --git a/src/tools/xmlNode.h b/src/tools/xmlNode.h
+new file mode 100644
+index 0000000..4a6c91e
+--- /dev/null
++++ b/src/tools/xmlNode.h
+@@ -0,0 +1,49 @@
++/*******************************************************************************
++ * Copyright (C) 2017 Intel Corporation. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are met:
++ *
++ * - Redistributions of source code must retain the above copyright notice,
++ * this list of conditions and the following disclaimer.
++ *
++ * - Redistributions in binary form must reproduce the above copyright notice,
++ * this list of conditions and the following disclaimer in the documentation
++ * and/or other materials provided with the distribution.
++ *
++ * - Neither the name of Intel Corporation. nor the names of its
++ * contributors may be used to endorse or promote products derived from this
++ * software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS
++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ *******************************************************************************/
++#ifndef __XMLNODE_H
++#define __XMLNODE_H
++class XMLNode {
++
++ public:
++ char* tagName;
++ char* nsTag;
++ int tagLength;
++ int nsLength;
++ int startTag;
++ int emptyTag;
++
++ XMLNode* closingTag;
++ XMLNode* startingTag;
++ XMLNode* parentNode;
++ XMLNode* childNode;
++ XMLNode* siblingNode;
++ XMLNode();
++};
++#endif
+--
+2.9.3
+
diff --git a/recipes-bsp/amt/lms7_7.1.20.bb b/recipes-bsp/amt/lms7_7.1.20.bb
new file mode 100644
index 00000000..eca36811
--- /dev/null
+++ b/recipes-bsp/amt/lms7_7.1.20.bb
@@ -0,0 +1,58 @@
+DESCRIPTION = "Intel Local Manageability Service allows applications \
+to access the Intel Active Management Technology (AMT) firmware via \
+the Intel Management Engine Interface (MEI)."
+HOMEPAGE = "http://software.intel.com/en-us/articles/download-the-latest-intel-amt-open-source-drivers"
+
+LICENSE = "BSD_LMS"
+
+PR = "r0"
+BPN="lms"
+PV_SUB = "25"
+SRC_URI = "http://software.intel.com/sites/default/files/m/4/e/a/9/b/37962-${BPN}_${PV}.${PV_SUB}.zip \
+ file://atnetworktool-printf-fix.patch \
+ file://readlink-declaration.patch \
+ file://0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch \
+ file://0001-Include-sys-select.h-for-fd_set.patch \
+ file://0002-Use-proper-netinet-in.h-API.patch \
+ "
+
+LOCALSRC = "file://${WORKDIR}/outputdir/${BPN}-${PV}-${PV_SUB}.tar.gz"
+
+COMPATIBLE_HOST = '(i.86|x86_64).*-linux'
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=7264184cf88d9f27b719a9656255b47b"
+
+SRC_URI[md5sum] = "687b76e78bfdbcf567c0e842c1fe240a"
+SRC_URI[sha256sum] = "cc0457f0044e924794bb1aeae9a72c28666a525cd8a963d0d92970222946e75b"
+
+inherit autotools update-rc.d
+
+INITSCRIPT_NAME = "lms7"
+INITSCRIPT_PARAMS = "defaults"
+
+python do_unpack() {
+ s = d.getVar('S', True)
+ d.setVar('S', '${WORKDIR}/outputdir')
+ bb.build.exec_func('base_do_unpack', d)
+ # temorarily change SRC_URI for unpack
+ src_uri = d.getVar('SRC_URI', True)
+ d.setVar('SRC_URI', '${LOCALSRC}')
+ d.setVar('S', s)
+ bb.build.exec_func('base_do_unpack', d)
+ d.setVar('SRC_URI', src_uri)
+}
+
+
+do_install_append () {
+ mv ${D}/${sbindir}/lms ${D}/${sbindir}/lms7
+ install -d ${D}${sysconfdir}/init.d
+ # The configure script looks at the host to decide where to put init
+ # scripts, so move it at the same time as renaming it.
+ if test -f ${D}${sysconfdir}/rc.d/init.d/lms ; then
+ mv ${D}${sysconfdir}/rc.d/init.d/lms ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME}
+ else
+ mv ${D}${sysconfdir}/init.d/lms ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME}
+ fi
+ sed -i 's/^NAME=lms/NAME=lms7/' ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME}
+ rmdir ${D}${datadir} || :
+}
diff --git a/recipes-bsp/amt/lms8_8.0.0-7.bb b/recipes-bsp/amt/lms8_8.0.0-7.bb
new file mode 100644
index 00000000..9b37b9b4
--- /dev/null
+++ b/recipes-bsp/amt/lms8_8.0.0-7.bb
@@ -0,0 +1,46 @@
+DESCRIPTION = "Intel Local Manageability Service allows applications \
+to access the Intel Active Management Technology (AMT) firmware via \
+the Intel Management Engine Interface (MEI)."
+HOMEPAGE = "http://software.intel.com/en-us/articles/download-the-latest-intel-amt-open-source-drivers"
+
+LICENSE = "BSD_LMS"
+
+PR = "r0"
+BPN="lms"
+SRC_URI = "http://software.intel.com/sites/default/files/${BPN}-${PV}.tar.gz \
+ file://readlink-declaration.patch \
+ file://0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch \
+ file://0001-Include-sys-select.h-for-fd_set.patch \
+ file://0002-Use-proper-netinet-in.h-API.patch \
+ file://0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch \
+ file://0004-Intel-AMT-ME-real-time-notification-infra.patch \
+ "
+
+FILES_${PN} += "${datadir}/xml/AMTAlerts.xml"
+
+COMPATIBLE_HOST = '(i.86|x86_64).*-linux'
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=ec77c894e8a1a89fa07aed2c76680ab8"
+
+SRC_URI[md5sum] = "3cbd027a0e6e9ced8238478b24cde3c6"
+SRC_URI[sha256sum] = "7077db6f2f381e67cb37565b20c40ff0c7d3f98f014e65622a4b4b66c2b1d637"
+
+inherit autotools update-rc.d
+
+INITSCRIPT_NAME = "lms8"
+INITSCRIPT_PARAMS = "defaults"
+
+
+do_install_append () {
+ mv ${D}/${sbindir}/lms ${D}/${sbindir}/lms8
+ install -d ${D}${sysconfdir}/init.d
+ # The configure script looks at the host to decide where to put init
+ # scripts, so move it at the same time as renaming it.
+ if test -f ${D}${sysconfdir}/rc.d/init.d/lms ; then
+ mv ${D}${sysconfdir}/rc.d/init.d/lms ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME}
+ else
+ mv ${D}${sysconfdir}/init.d/lms ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME}
+ fi
+ sed -i 's/^NAME=lms/NAME=lms8/' ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME}
+ rmdir ${D}${datadir} || :
+}
diff --git a/recipes-bsp/efilinux/efilinux/0001-Disable-address-of-packed-member-warning.patch b/recipes-bsp/efilinux/efilinux/0001-Disable-address-of-packed-member-warning.patch
new file mode 100644
index 00000000..afb99514
--- /dev/null
+++ b/recipes-bsp/efilinux/efilinux/0001-Disable-address-of-packed-member-warning.patch
@@ -0,0 +1,33 @@
+From 7c171c1813651a3a02ad2cda361b42ebc7ce324d Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 12 Aug 2017 10:34:19 -0700
+Subject: [PATCH 1/2] Disable address-of-packed-member warning
+
+Clang complains so make it happy
+
+loaders/bzimage/bzimage.c:346:55: error: taking address of packed member 'base' of class or structure 'dt_addr_t' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
+ err = emalloc(gdt.limit, 8, (EFI_PHYSICAL_ADDRESS *)&gdt.base);
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index a955e34..ff1b79b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -61,7 +61,7 @@ ifeq ($(ARCH),ia32)
+ endif
+ endif
+ ifeq ($(ARCH),x86_64)
+- CFLAGS += -mno-red-zone
++ CFLAGS += -mno-red-zone -Wno-address-of-packed-member
+ endif
+
+ LDFLAGS=-T $(LDSCRIPT) -Bsymbolic -shared -nostdlib -znocombreloc \
+--
+2.14.1
+
diff --git a/recipes-bsp/efilinux/efilinux/0002-initialize-char-pointers.patch b/recipes-bsp/efilinux/efilinux/0002-initialize-char-pointers.patch
new file mode 100644
index 00000000..127c187a
--- /dev/null
+++ b/recipes-bsp/efilinux/efilinux/0002-initialize-char-pointers.patch
@@ -0,0 +1,33 @@
+From 49053e4ff0f3550d019cdad8a93677c18fc69791 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 12 Aug 2017 10:35:09 -0700
+Subject: [PATCH 2/2] initialize char pointers
+
+Clang complains about using them without initializing
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ entry.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/entry.c b/entry.c
+index 0aa6cdd..23ba51e 100644
+--- a/entry.c
++++ b/entry.c
+@@ -402,9 +402,9 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *_table)
+ WCHAR *error_buf;
+ EFI_STATUS err;
+ EFI_LOADED_IMAGE *info;
+- CHAR16 *name, *options;
++ CHAR16 *name = NULL, *options;
+ UINT32 options_size;
+- char *cmdline;
++ char *cmdline = NULL;
+
+ InitializeLib(image, _table);
+ sys_table = _table;
+--
+2.14.1
+
diff --git a/recipes-bsp/efilinux/efilinux_1.1.bb b/recipes-bsp/efilinux/efilinux_1.1.bb
new file mode 100644
index 00000000..63e80f88
--- /dev/null
+++ b/recipes-bsp/efilinux/efilinux_1.1.bb
@@ -0,0 +1,38 @@
+DESCRIPTION = "A UEFI OS loader"
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://efilinux.h;beginline=5;endline=27;md5=f8d56e644672ac63fd81b55c205283ad"
+
+DEPENDS = "gnu-efi"
+
+inherit deploy
+
+SRCREV = "a995826f9e43f1134baea61610eafd8c173bb776"
+PV = "1.1+git${SRCPV}"
+
+SRC_URI = "git://git.kernel.org/pub/scm/boot/efilinux/efilinux.git \
+ file://0001-Disable-address-of-packed-member-warning.patch \
+ file://0002-initialize-char-pointers.patch \
+ "
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_HOST = '(x86_64|i.86).*-(linux|freebsd.*)'
+
+EXTRA_OEMAKE = "INCDIR=${STAGING_INCDIR} LIBDIR=${STAGING_LIBDIR}"
+
+# syslinux uses $LD for linking, strip `-Wl,' so it can work
+export LDFLAGS = "`echo $LDFLAGS | sed 's/-Wl,//g'`"
+
+do_deploy () {
+ install ${S}/efilinux.efi ${DEPLOYDIR}/efilinux.efi
+}
+addtask deploy before do_build after do_compile
+
+python () {
+ ccargs = d.getVar('TUNE_CCARGS').split()
+ if '-mx32' in ccargs:
+ # use x86_64 EFI ABI
+ ccargs.remove('-mx32')
+ ccargs.append('-m64')
+ d.setVar('TUNE_CCARGS', ' '.join(ccargs))
+}
diff --git a/recipes-bsp/formfactor/formfactor/machconfig b/recipes-bsp/formfactor/formfactor/machconfig
new file mode 100644
index 00000000..73695fac
--- /dev/null
+++ b/recipes-bsp/formfactor/formfactor/machconfig
@@ -0,0 +1,39 @@
+# Note: superuser permission is required to run usbhid-dump
+# successfully.
+
+# HEX keys are according to the USB HID spec and USB HID usage table
+# We can add more keys as needed in the future.
+
+# This test may not be very accurate, as we only look for the first
+# two lines of a descriptor section. Example:
+#
+# 001:003:000:DESCRIPTOR 1460501386.337809
+# 05 01 09 02 A1 01 09 01 A1 00 05 09 19 01 29 03
+# 15 00 25 01 95 03 75 01 81 02 .. .. .. .. .. ..
+# .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+#
+# By doing so we eliminate false matches when HEX keys are in the lines
+# in the middle of the whole descriptor section.
+
+if type usbhid-dump &>/dev/null; then
+ if USBHID_DUMP_OUTPUT=$(usbhid-dump -e descriptor 2>/dev/null|grep -A1 DESCRIPTOR); then
+ # checker for generic USB HID keyboard
+ USBHID_KBD_CMD="grep -E '^ 05 01 09 06'"
+
+ # checker for touch screen
+ USBHID_TS_CMD="grep -E '^ 05 0D 09 04'"
+
+ if echo "$USBHID_DUMP_OUTPUT"|eval $USBHID_TS_CMD &>/dev/null; then
+ HAVE_TOUCHSCREEN=1
+ fi
+
+ if echo "$USBHID_DUMP_OUTPUT"|eval $USBHID_KBD_CMD &>/dev/null; then
+ HAVE_KEYBOARD=1
+ else
+ # config script in OE will set HAVE_KEYBOARD=1
+ # if we don't set any value. We have to explicitly
+ # tell it when keyboard is not detected.
+ HAVE_KEYBOARD=0
+ fi
+ fi
+fi
diff --git a/recipes-bsp/formfactor/formfactor_0.0.bbappend b/recipes-bsp/formfactor/formfactor_0.0.bbappend
new file mode 100644
index 00000000..6dd422ae
--- /dev/null
+++ b/recipes-bsp/formfactor/formfactor_0.0.bbappend
@@ -0,0 +1 @@
+FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:"
diff --git a/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.conf b/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.conf
new file mode 100644
index 00000000..74d33c87
--- /dev/null
+++ b/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.conf
@@ -0,0 +1,2 @@
+# Mimic modprobe's install funcitonality with busybox's modprobe
+install gma500_gfx dmesg | grep gma500_gfx_checked || { /etc/modprobe.d/gma500-gfx-check.sh || modprobe gma500_gfx; }
diff --git a/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.sh b/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.sh
new file mode 100644
index 00000000..75cda99f
--- /dev/null
+++ b/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Check for devices we wish to avoid gma500_gfx for
+DEVICES="0x8119 0x4108"
+
+# Checked flag to avoid infinite modprobe
+echo "gma500_gfx_checked" >> /dev/kmsg;
+
+for DEVICE in $DEVICES; do
+ if udevadm trigger --subsystem-match=pci --verbose --attr-match=device=$DEVICE | grep "pci" >> /dev/null ; then
+ echo "Found $DEVICE, avoiding gma500_gfx module" >> /dev/kmsg;
+ exit 0
+ fi
+done
+exit 1
diff --git a/recipes-bsp/gma500-gfx-check/gma500-gfx-check_1.0.bb b/recipes-bsp/gma500-gfx-check/gma500-gfx-check_1.0.bb
new file mode 100644
index 00000000..7b08064b
--- /dev/null
+++ b/recipes-bsp/gma500-gfx-check/gma500-gfx-check_1.0.bb
@@ -0,0 +1,18 @@
+SUMMARY = "Intel gma500_gfx fix for certain hardware"
+DESCRIPTION = "Avoid inserting gma500_gfx module for certain hardware devices."
+LICENSE="GPLv2"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
+
+SRC_URI = "file://gma500-gfx-check.conf \
+ file://gma500-gfx-check.sh "
+
+do_install(){
+ install -d ${D}${sysconfdir}/modprobe.d/
+ install -m 755 ${WORKDIR}/gma500-gfx-check.sh ${D}${sysconfdir}/modprobe.d/gma500-gfx-check.sh
+ install -m 644 ${WORKDIR}/gma500-gfx-check.conf ${D}${sysconfdir}/modprobe.d/gma500-gfx-check.conf
+}
+
+FILES_${PN}="${sysconfdir}/modprobe.d/gma500-gfx-check.conf \
+ ${sysconfdir}/modprobe.d/gma500-gfx-check.sh"
+
+COMPATIBLE_MACHINE = "intel-core2-32"
diff --git a/recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG
new file mode 100644
index 00000000..dd1b9114
--- /dev/null
+++ b/recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG
@@ -0,0 +1,3 @@
+boot.conf
+install.conf
+
diff --git a/recipes-bsp/rmc/boards/Galileo2/boot.conf b/recipes-bsp/rmc/boards/Galileo2/boot.conf
new file mode 100644
index 00000000..580ea486
--- /dev/null
+++ b/recipes-bsp/rmc/boards/Galileo2/boot.conf
@@ -0,0 +1,4 @@
+title Galileo Gen 2 boot
+linux /vmlinuz
+initrd /initrd
+options LABEL=boot rootwait console=ttyS1,115200
diff --git a/recipes-bsp/rmc/boards/Galileo2/gallieo2.fp b/recipes-bsp/rmc/boards/Galileo2/gallieo2.fp
new file mode 100755
index 00000000..fe77d4d1
--- /dev/null
+++ b/recipes-bsp/rmc/boards/Galileo2/gallieo2.fp
Binary files differ
diff --git a/recipes-bsp/rmc/boards/Galileo2/install.conf b/recipes-bsp/rmc/boards/Galileo2/install.conf
new file mode 100644
index 00000000..688c2a8f
--- /dev/null
+++ b/recipes-bsp/rmc/boards/Galileo2/install.conf
@@ -0,0 +1,4 @@
+title Galileo Gen 2 install
+linux /vmlinuz
+initrd /initrd
+options LABEL=install-efi rootwait console=ttyS1,115200
diff --git a/recipes-bsp/rmc/boards/MinnowboardTurbot/KBOOTPARAM b/recipes-bsp/rmc/boards/MinnowboardTurbot/KBOOTPARAM
new file mode 100644
index 00000000..476b1fbe
--- /dev/null
+++ b/recipes-bsp/rmc/boards/MinnowboardTurbot/KBOOTPARAM
@@ -0,0 +1 @@
+console=ttyS0,115200
diff --git a/recipes-bsp/rmc/boards/MinnowboardTurbot/minnowboardturbot.fp b/recipes-bsp/rmc/boards/MinnowboardTurbot/minnowboardturbot.fp
new file mode 100644
index 00000000..9aa145f3
--- /dev/null
+++ b/recipes-bsp/rmc/boards/MinnowboardTurbot/minnowboardturbot.fp
Binary files differ
diff --git a/recipes-bsp/rmc/boards/NUC5i5RYB/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/NUC5i5RYB/BOOTENTRY.CONFIG
new file mode 100644
index 00000000..b2fabe82
--- /dev/null
+++ b/recipes-bsp/rmc/boards/NUC5i5RYB/BOOTENTRY.CONFIG
@@ -0,0 +1,2 @@
+boot.conf
+install.conf
diff --git a/recipes-bsp/rmc/boards/NUC5i5RYB/INSTALLER.CONFIG b/recipes-bsp/rmc/boards/NUC5i5RYB/INSTALLER.CONFIG
new file mode 100644
index 00000000..ca5f04b9
--- /dev/null
+++ b/recipes-bsp/rmc/boards/NUC5i5RYB/INSTALLER.CONFIG
@@ -0,0 +1,2 @@
+efi_entry_dir:root:disk:770:/boot/loader/entries/
+boot.conf:root:disk:770:/boot/loader/entries/rmcboot.conf
diff --git a/recipes-bsp/rmc/boards/NUC5i5RYB/POSTINSTALL.sh b/recipes-bsp/rmc/boards/NUC5i5RYB/POSTINSTALL.sh
new file mode 100644
index 00000000..6694261b
--- /dev/null
+++ b/recipes-bsp/rmc/boards/NUC5i5RYB/POSTINSTALL.sh
@@ -0,0 +1,2 @@
+# There is no tty device on this board.
+sed -i '/start_getty.\+ttyS.*/d' /tgt_root/etc/inittab
diff --git a/recipes-bsp/rmc/boards/NUC5i5RYB/boot.conf b/recipes-bsp/rmc/boards/NUC5i5RYB/boot.conf
new file mode 100644
index 00000000..b29fa45e
--- /dev/null
+++ b/recipes-bsp/rmc/boards/NUC5i5RYB/boot.conf
@@ -0,0 +1,4 @@
+title NUC5i5RYB boot
+linux /vmlinuz
+initrd /initrd
+options LABEL=boot rootwait
diff --git a/recipes-bsp/rmc/boards/NUC5i5RYB/install.conf b/recipes-bsp/rmc/boards/NUC5i5RYB/install.conf
new file mode 100644
index 00000000..0dca3cae
--- /dev/null
+++ b/recipes-bsp/rmc/boards/NUC5i5RYB/install.conf
@@ -0,0 +1,4 @@
+title NUC5i5RYB install
+linux /vmlinuz
+initrd /initrd
+options LABEL=install-efi rootwait
diff --git a/recipes-bsp/rmc/boards/NUC5i5RYB/nuc5i5.fp b/recipes-bsp/rmc/boards/NUC5i5RYB/nuc5i5.fp
new file mode 100644
index 00000000..57374779
--- /dev/null
+++ b/recipes-bsp/rmc/boards/NUC5i5RYB/nuc5i5.fp
Binary files differ
diff --git a/recipes-bsp/rmc/boards/T100-32bit/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/T100-32bit/BOOTENTRY.CONFIG
new file mode 100644
index 00000000..b2fabe82
--- /dev/null
+++ b/recipes-bsp/rmc/boards/T100-32bit/BOOTENTRY.CONFIG
@@ -0,0 +1,2 @@
+boot.conf
+install.conf
diff --git a/recipes-bsp/rmc/boards/T100-32bit/T100-32bit.fp b/recipes-bsp/rmc/boards/T100-32bit/T100-32bit.fp
new file mode 100644
index 00000000..86ecea73
--- /dev/null
+++ b/recipes-bsp/rmc/boards/T100-32bit/T100-32bit.fp
Binary files differ
diff --git a/recipes-bsp/rmc/boards/T100-32bit/boot.conf b/recipes-bsp/rmc/boards/T100-32bit/boot.conf
new file mode 100644
index 00000000..f1578e0f
--- /dev/null
+++ b/recipes-bsp/rmc/boards/T100-32bit/boot.conf
@@ -0,0 +1,4 @@
+title T100T(32bit) boot
+linux /vmlinuz
+initrd /initrd
+options LABEL=boot loglevel=8
diff --git a/recipes-bsp/rmc/boards/T100-32bit/install.conf b/recipes-bsp/rmc/boards/T100-32bit/install.conf
new file mode 100644
index 00000000..67e7eb18
--- /dev/null
+++ b/recipes-bsp/rmc/boards/T100-32bit/install.conf
@@ -0,0 +1,4 @@
+title T100T(32bit) install
+linux /vmlinuz
+initrd /initrd
+options LABEL=install-efi
diff --git a/recipes-bsp/rmc/boards/broxton-m/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/broxton-m/BOOTENTRY.CONFIG
new file mode 100644
index 00000000..b2fabe82
--- /dev/null
+++ b/recipes-bsp/rmc/boards/broxton-m/BOOTENTRY.CONFIG
@@ -0,0 +1,2 @@
+boot.conf
+install.conf
diff --git a/recipes-bsp/rmc/boards/broxton-m/INSTALLER.CONFIG b/recipes-bsp/rmc/boards/broxton-m/INSTALLER.CONFIG
new file mode 100644
index 00000000..ecd20609
--- /dev/null
+++ b/recipes-bsp/rmc/boards/broxton-m/INSTALLER.CONFIG
@@ -0,0 +1,3 @@
+# Keep rmc Joule boot.conf instead of meta-intel default
+efi_entry_dir:root:disk:770:/boot/loader/entries/
+boot.conf:root:disk:770:/boot/loader/entries/boot.conf
diff --git a/recipes-bsp/rmc/boards/broxton-m/KBOOTPARAM b/recipes-bsp/rmc/boards/broxton-m/KBOOTPARAM
new file mode 100644
index 00000000..08be5dfb
--- /dev/null
+++ b/recipes-bsp/rmc/boards/broxton-m/KBOOTPARAM
@@ -0,0 +1 @@
+video=efifb maxcpus=4 reboot=efi kmemleak=off console=tty0 console=ttyS2,115200
diff --git a/recipes-bsp/rmc/boards/broxton-m/POSTINSTALL.sh b/recipes-bsp/rmc/boards/broxton-m/POSTINSTALL.sh
new file mode 100644
index 00000000..30bbd28e
--- /dev/null
+++ b/recipes-bsp/rmc/boards/broxton-m/POSTINSTALL.sh
@@ -0,0 +1,2 @@
+# Joule uses only S2 for serial, so remove S0
+sed -i '/start_getty.\+ttyS0/d' /tgt_root/etc/inittab
diff --git a/recipes-bsp/rmc/boards/broxton-m/bm-1F1.fp b/recipes-bsp/rmc/boards/broxton-m/bm-1F1.fp
new file mode 100755
index 00000000..1a150280
--- /dev/null
+++ b/recipes-bsp/rmc/boards/broxton-m/bm-1F1.fp
Binary files differ
diff --git a/recipes-bsp/rmc/boards/broxton-m/bm.fp b/recipes-bsp/rmc/boards/broxton-m/bm.fp
new file mode 100755
index 00000000..135a7a5d
--- /dev/null
+++ b/recipes-bsp/rmc/boards/broxton-m/bm.fp
Binary files differ
diff --git a/recipes-bsp/rmc/boards/broxton-m/boot.conf b/recipes-bsp/rmc/boards/broxton-m/boot.conf
new file mode 100644
index 00000000..caa00c50
--- /dev/null
+++ b/recipes-bsp/rmc/boards/broxton-m/boot.conf
@@ -0,0 +1,4 @@
+title Joule / Broxton-m
+linux /vmlinuz
+initrd /initrd
+options LABEL=boot
diff --git a/recipes-bsp/rmc/boards/broxton-m/install.conf b/recipes-bsp/rmc/boards/broxton-m/install.conf
new file mode 100644
index 00000000..9cdd86b7
--- /dev/null
+++ b/recipes-bsp/rmc/boards/broxton-m/install.conf
@@ -0,0 +1,4 @@
+title Joule / Broxton-m Install
+linux /vmlinuz
+initrd /initrd
+options LABEL=install-efi rootwait
diff --git a/recipes-bsp/rmc/boards/broxton-m/joule-1F1.fp b/recipes-bsp/rmc/boards/broxton-m/joule-1F1.fp
new file mode 100644
index 00000000..d757614f
--- /dev/null
+++ b/recipes-bsp/rmc/boards/broxton-m/joule-1F1.fp
Binary files differ
diff --git a/recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG
new file mode 100644
index 00000000..b2fabe82
--- /dev/null
+++ b/recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG
@@ -0,0 +1,2 @@
+boot.conf
+install.conf
diff --git a/recipes-bsp/rmc/boards/minnowmax/boot.conf b/recipes-bsp/rmc/boards/minnowmax/boot.conf
new file mode 100644
index 00000000..6e789cd8
--- /dev/null
+++ b/recipes-bsp/rmc/boards/minnowmax/boot.conf
@@ -0,0 +1,4 @@
+title Minnow Max boot
+linux /vmlinuz
+initrd /initrd
+options LABEL=boot console=ttyS0,115200n8
diff --git a/recipes-bsp/rmc/boards/minnowmax/install.conf b/recipes-bsp/rmc/boards/minnowmax/install.conf
new file mode 100644
index 00000000..1a493aec
--- /dev/null
+++ b/recipes-bsp/rmc/boards/minnowmax/install.conf
@@ -0,0 +1,4 @@
+title Minnow Max install
+linux /vmlinuz
+initrd /initrd
+options LABEL=install-efi console=ttyS0,115200n8
diff --git a/recipes-bsp/rmc/boards/minnowmax/minnowmax.fp b/recipes-bsp/rmc/boards/minnowmax/minnowmax.fp
new file mode 100644
index 00000000..3c5a286f
--- /dev/null
+++ b/recipes-bsp/rmc/boards/minnowmax/minnowmax.fp
Binary files differ
diff --git a/recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG
new file mode 100644
index 00000000..b2fabe82
--- /dev/null
+++ b/recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG
@@ -0,0 +1,2 @@
+boot.conf
+install.conf
diff --git a/recipes-bsp/rmc/boards/minnowmaxB3/boot.conf b/recipes-bsp/rmc/boards/minnowmaxB3/boot.conf
new file mode 100644
index 00000000..577e5d6a
--- /dev/null
+++ b/recipes-bsp/rmc/boards/minnowmaxB3/boot.conf
@@ -0,0 +1,4 @@
+title Minnow Max B3 boot
+linux /vmlinuz
+initrd /initrd
+options LABEL=boot console=ttyS0,115200n8
diff --git a/recipes-bsp/rmc/boards/minnowmaxB3/install.conf b/recipes-bsp/rmc/boards/minnowmaxB3/install.conf
new file mode 100644
index 00000000..cf500d6c
--- /dev/null
+++ b/recipes-bsp/rmc/boards/minnowmaxB3/install.conf
@@ -0,0 +1,4 @@
+title Minnow Max B3 install
+linux /vmlinuz
+initrd /initrd
+options LABEL=install-efi console=ttyS0,115200n8
diff --git a/recipes-bsp/rmc/boards/minnowmaxB3/minnowmaxB3.fp b/recipes-bsp/rmc/boards/minnowmaxB3/minnowmaxB3.fp
new file mode 100644
index 00000000..ad3f0d6d
--- /dev/null
+++ b/recipes-bsp/rmc/boards/minnowmaxB3/minnowmaxB3.fp
Binary files differ
diff --git a/recipes-bsp/rmc/boards/mohonpeak/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/mohonpeak/BOOTENTRY.CONFIG
new file mode 100644
index 00000000..b2fabe82
--- /dev/null
+++ b/recipes-bsp/rmc/boards/mohonpeak/BOOTENTRY.CONFIG
@@ -0,0 +1,2 @@
+boot.conf
+install.conf
diff --git a/recipes-bsp/rmc/boards/mohonpeak/INSTALLER.CONFIG b/recipes-bsp/rmc/boards/mohonpeak/INSTALLER.CONFIG
new file mode 100644
index 00000000..8c5a7678
--- /dev/null
+++ b/recipes-bsp/rmc/boards/mohonpeak/INSTALLER.CONFIG
@@ -0,0 +1,3 @@
+# Keep rmc Mohonpeak boot.conf instead of meta-intel default
+efi_entry_dir:root:disk:770:/boot/loader/entries/
+boot.conf:root:disk:770:/boot/loader/entries/boot.conf
diff --git a/recipes-bsp/rmc/boards/mohonpeak/KBOOTPARAM b/recipes-bsp/rmc/boards/mohonpeak/KBOOTPARAM
new file mode 100644
index 00000000..169056ee
--- /dev/null
+++ b/recipes-bsp/rmc/boards/mohonpeak/KBOOTPARAM
@@ -0,0 +1 @@
+console=ttyS1,115200 console=tty1
diff --git a/recipes-bsp/rmc/boards/mohonpeak/POSTINSTALL.sh b/recipes-bsp/rmc/boards/mohonpeak/POSTINSTALL.sh
new file mode 100644
index 00000000..5f440c38
--- /dev/null
+++ b/recipes-bsp/rmc/boards/mohonpeak/POSTINSTALL.sh
@@ -0,0 +1,3 @@
+# Mohonpeak uses only S1 for serial, so remove S0 and S2
+sed -i '/start_getty.\+ttyS0/d' /tgt_root/etc/inittab
+sed -i '/start_getty.\+ttyS2/d' /tgt_root/etc/inittab
diff --git a/recipes-bsp/rmc/boards/mohonpeak/boot.conf b/recipes-bsp/rmc/boards/mohonpeak/boot.conf
new file mode 100644
index 00000000..5b7a0f63
--- /dev/null
+++ b/recipes-bsp/rmc/boards/mohonpeak/boot.conf
@@ -0,0 +1,4 @@
+title Mohon Peak boot
+linux /vmlinuz
+initrd /initrd
+options LABEL=boot
diff --git a/recipes-bsp/rmc/boards/mohonpeak/install.conf b/recipes-bsp/rmc/boards/mohonpeak/install.conf
new file mode 100644
index 00000000..dde3497d
--- /dev/null
+++ b/recipes-bsp/rmc/boards/mohonpeak/install.conf
@@ -0,0 +1,4 @@
+title Mohon Peak Install
+linux /vmlinuz
+initrd /initrd
+options LABEL=install-efi rootwait
diff --git a/recipes-bsp/rmc/boards/mohonpeak/mohonpeak.fp b/recipes-bsp/rmc/boards/mohonpeak/mohonpeak.fp
new file mode 100644
index 00000000..bc4bdae4
--- /dev/null
+++ b/recipes-bsp/rmc/boards/mohonpeak/mohonpeak.fp
Binary files differ
diff --git a/recipes-bsp/rmc/boards/nucgen6/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/nucgen6/BOOTENTRY.CONFIG
new file mode 100644
index 00000000..b2fabe82
--- /dev/null
+++ b/recipes-bsp/rmc/boards/nucgen6/BOOTENTRY.CONFIG
@@ -0,0 +1,2 @@
+boot.conf
+install.conf
diff --git a/recipes-bsp/rmc/boards/nucgen6/INSTALLER.CONFIG b/recipes-bsp/rmc/boards/nucgen6/INSTALLER.CONFIG
new file mode 100644
index 00000000..7d5378b2
--- /dev/null
+++ b/recipes-bsp/rmc/boards/nucgen6/INSTALLER.CONFIG
@@ -0,0 +1,6 @@
+# This file specifies which file or dir RMC will install onto target.
+# Note the absolute path is referred from mount points in installation.
+efi_entry_dir:root:disk:770:/boot/loader/entries/
+boot.conf:root:disk:770:/boot/loader/entries/rmcboot.conf
+mylibdir:root:root:770:/tgt_root/etc/mylib/
+mylib.conf:root:root:660:/tgt_root/etc/mylib/mylib.conf
diff --git a/recipes-bsp/rmc/boards/nucgen6/KBOOTPARAM b/recipes-bsp/rmc/boards/nucgen6/KBOOTPARAM
new file mode 100644
index 00000000..27943b49
--- /dev/null
+++ b/recipes-bsp/rmc/boards/nucgen6/KBOOTPARAM
@@ -0,0 +1 @@
+i915.preliminary_hw_support=1
diff --git a/recipes-bsp/rmc/boards/nucgen6/POSTINSTALL.sh b/recipes-bsp/rmc/boards/nucgen6/POSTINSTALL.sh
new file mode 100644
index 00000000..bec3be42
--- /dev/null
+++ b/recipes-bsp/rmc/boards/nucgen6/POSTINSTALL.sh
@@ -0,0 +1,7 @@
+# NUC Gen 6 specific retouch after RMC deployment
+
+# The generated inittab from OE build causes error messages:
+# "auth.err getty[615]: tcgetattr: Input/output error"
+# in /var/log/messages because NUC Gen 6 doesn't have any
+# serial tty. We delete line(s) here on target.
+sed -i '/start_getty.\+ttyS.*/d' /tgt_root/etc/inittab
diff --git a/recipes-bsp/rmc/boards/nucgen6/boot.conf b/recipes-bsp/rmc/boards/nucgen6/boot.conf
new file mode 100644
index 00000000..e6ecb029
--- /dev/null
+++ b/recipes-bsp/rmc/boards/nucgen6/boot.conf
@@ -0,0 +1,4 @@
+title NUC Gen6 boot
+linux /vmlinuz
+initrd /initrd
+options LABEL=boot
diff --git a/recipes-bsp/rmc/boards/nucgen6/install.conf b/recipes-bsp/rmc/boards/nucgen6/install.conf
new file mode 100644
index 00000000..916bb04b
--- /dev/null
+++ b/recipes-bsp/rmc/boards/nucgen6/install.conf
@@ -0,0 +1,4 @@
+title NUC Gen6 install
+linux /vmlinuz
+initrd /initrd
+options LABEL=install-efi
diff --git a/recipes-bsp/rmc/boards/nucgen6/mylib.conf b/recipes-bsp/rmc/boards/nucgen6/mylib.conf
new file mode 100644
index 00000000..fd8357c2
--- /dev/null
+++ b/recipes-bsp/rmc/boards/nucgen6/mylib.conf
@@ -0,0 +1,7 @@
+# This is a demo conf file read by an imagined program or library
+# which reads this file at runtime to customize its behavior.
+# rmc will deploy it to the location specified in INSTALLER.CONFIG.
+
+lib.info = "V1.0 for rmc demo"
+lib.board = "NUC gen 6"
+prog.ui.layout = "minimal"
diff --git a/recipes-bsp/rmc/boards/nucgen6/nuc6.fp b/recipes-bsp/rmc/boards/nucgen6/nuc6.fp
new file mode 100644
index 00000000..834f800b
--- /dev/null
+++ b/recipes-bsp/rmc/boards/nucgen6/nuc6.fp
Binary files differ
diff --git a/recipes-bsp/rmc/boards/qemu-2.6/KBOOTPARAM b/recipes-bsp/rmc/boards/qemu-2.6/KBOOTPARAM
new file mode 100644
index 00000000..476b1fbe
--- /dev/null
+++ b/recipes-bsp/rmc/boards/qemu-2.6/KBOOTPARAM
@@ -0,0 +1 @@
+console=ttyS0,115200
diff --git a/recipes-bsp/rmc/boards/qemu-2.6/qemu-2.6.fp b/recipes-bsp/rmc/boards/qemu-2.6/qemu-2.6.fp
new file mode 100644
index 00000000..e4c41657
--- /dev/null
+++ b/recipes-bsp/rmc/boards/qemu-2.6/qemu-2.6.fp
Binary files differ
diff --git a/recipes-bsp/rmc/boards/qemu-2.8/KBOOTPARAM b/recipes-bsp/rmc/boards/qemu-2.8/KBOOTPARAM
new file mode 100644
index 00000000..476b1fbe
--- /dev/null
+++ b/recipes-bsp/rmc/boards/qemu-2.8/KBOOTPARAM
@@ -0,0 +1 @@
+console=ttyS0,115200
diff --git a/recipes-bsp/rmc/boards/qemu-2.8/qemu-2.8.fp b/recipes-bsp/rmc/boards/qemu-2.8/qemu-2.8.fp
new file mode 100644
index 00000000..7f28f37c
--- /dev/null
+++ b/recipes-bsp/rmc/boards/qemu-2.8/qemu-2.8.fp
Binary files differ
diff --git a/recipes-bsp/rmc/rmc-db.bb b/recipes-bsp/rmc/rmc-db.bb
new file mode 100644
index 00000000..f24ed11c
--- /dev/null
+++ b/recipes-bsp/rmc/rmc-db.bb
@@ -0,0 +1,49 @@
+SUMMARY = "Central RMC Database"
+DESCRIPTION = "Generate a centralized RMC database for RMC feature. \
+Fingerprints and data for all boards supported are specified by variable \
+RMC_BOARD_DATA_DIRS which is a list of top directories that contains \
+subdirectories for boards. Developers can add their top directories by appending \
+them to this variable in a rmc-db.bbappend.Refer to rmc-db bbclass for more \
+information."
+
+LICENSE = "MIT"
+
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+S = "${WORKDIR}"
+
+inherit rmc-db
+
+RMC_BOARD_DATA_DIRS ?= "${THISDIR}/boards/"
+RMC_DB_DIR = "${WORKDIR}/db"
+
+# Let sstate be aware of change in any added board directories
+do_generate_rmc_db[file-checksums] = "${@get_rmc_top_dirs_list(d)}"
+
+# derived from get_lic_checksum_file_list(d) in base.bbclass in OE
+def get_rmc_top_dirs_list(d):
+ dirlist = []
+ dirs = d.getVar("RMC_BOARD_DATA_DIRS", True) or ''
+ topdirs = dirs.split()
+ for each in topdirs:
+ dirlist.append(each + ":" + str(os.path.exists(each)))
+ return " ".join(dirlist)
+
+do_generate_rmc_db () {
+ rmc_generate_db "${RMC_BOARD_DATA_DIRS}" "${RMC_DB_DIR}"/rmc.db
+}
+
+addtask generate_rmc_db after do_compile
+
+inherit deploy
+
+do_deploy () {
+ if [ -f ${RMC_DB_DIR}/rmc.db ]; then
+ install -m 0400 ${RMC_DB_DIR}/rmc.db ${DEPLOYDIR}
+ else
+ rm -f ${DEPLOYDIR}/rmc.db
+ echo "Warning: no RMC central database found, skip deployment."
+ fi
+}
+
+addtask deploy after do_generate_rmc_db
diff --git a/recipes-bsp/rmc/rmc-efi.bb b/recipes-bsp/rmc/rmc-efi.bb
new file mode 100644
index 00000000..2a1c9a98
--- /dev/null
+++ b/recipes-bsp/rmc/rmc-efi.bb
@@ -0,0 +1,40 @@
+SUMMARY = "RMC (Runtime Machine Configuration) EFI library"
+
+DESCRIPTION = "The RMC EFI library adds RMC support to existing EFI bootloaders"
+
+LICENSE = "MIT"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=ade413c694d3aaefc9554b24a8814ee8"
+
+SRC_URI = "git://git.yoctoproject.org/rmc"
+
+SRCREV = "027ac76f642dcab1a9f237a00f03a3a714bd04b9"
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux*"
+
+TARGET_CFLAGS +="-Wl,--hash-style=both"
+
+EXTRA_OEMAKE = "RMC_INSTALL_PREFIX=${D}/${prefix} \
+ RMC_INSTALL_LIB_PATH=${D}${libdir} \
+ RMC_INSTALL_HEADER_PATH=${D}${includedir}/rmc"
+
+SECURITY_CFLAGS_remove_class-target = "-fstack-protector-strong"
+SECURITY_CFLAGS_append_class-target = " -fno-stack-protector"
+
+python () {
+ ccargs = d.getVar('TUNE_CCARGS').split()
+ if '-mx32' in ccargs:
+ ccargs.remove('-mx32')
+ ccargs.append('-m64')
+ d.setVar('TUNE_CCARGS', ' '.join(ccargs))
+}
+
+do_compile() {
+ oe_runmake -f Makefile.efi
+}
+
+do_install() {
+ oe_runmake -f Makefile.efi install
+}
diff --git a/recipes-bsp/rmc/rmc.bb b/recipes-bsp/rmc/rmc.bb
new file mode 100644
index 00000000..8797644b
--- /dev/null
+++ b/recipes-bsp/rmc/rmc.bb
@@ -0,0 +1,46 @@
+SUMMARY = "RMC (Runtime Machine Configuration)"
+
+DESCRIPTION = "RMC project provides a tool and libraries to identify types \
+of hardware boards and access any file-based data specific to the board's \
+type at runtime in a centralized way. Software (clients) can have a generic \
+logic to query board-specific data from RMC without knowing the type of board. \
+This make it possible to have a generic software work running on boards which \
+require any quirks or customizations at a board or product level. \
+"
+
+LICENSE = "MIT"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=ade413c694d3aaefc9554b24a8814ee8"
+
+SRC_URI = "git://git.yoctoproject.org/rmc"
+
+SRCREV = "027ac76f642dcab1a9f237a00f03a3a714bd04b9"
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux*"
+
+TARGET_CFLAGS +="-Wl,--hash-style=both"
+
+EXTRA_OEMAKE = "RMC_INSTALL_PREFIX=${D}/${prefix} \
+ RMC_INSTALL_BIN_PATH=${D}${bindir} \
+ RMC_INSTALL_LIB_PATH=${D}${libdir} \
+ RMC_INSTALL_HEADER_PATH=${D}${includedir}/rmc"
+
+SECURITY_CFLAGS_remove_class-target = "-fstack-protector-strong"
+SECURITY_CFLAGS_append_class-target = " -fno-stack-protector"
+
+do_compile_class-target() {
+ oe_runmake
+}
+
+do_install() {
+ oe_runmake install
+}
+
+do_install_class-native() {
+ install -d ${D}${STAGING_BINDIR_NATIVE}
+ install -m 0755 ${S}/src/rmc ${D}${STAGING_BINDIR_NATIVE}
+}
+
+BBCLASSEXTEND = "native"
diff --git a/recipes-bsp/systemd-boot/systemd-boot/0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch b/recipes-bsp/systemd-boot/systemd-boot/0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch
new file mode 100644
index 00000000..8d0b6149
--- /dev/null
+++ b/recipes-bsp/systemd-boot/systemd-boot/0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch
@@ -0,0 +1,31 @@
+From 58669ad764767afea4de53f8a97357773b1855ef Mon Sep 17 00:00:00 2001
+From: Saul Wold <sgw@linux.intel.com>
+Date: Tue, 25 Oct 2016 12:54:08 -0700
+Subject: [PATCH] efi/boot.c: workaround for Joule BIOS hang
+
+This patch should be removed when the BIOS is fixed
+
+Authored-by: Steve Sakoman <steve@sakoman.com>
+
+Upstream-Status: Inappropriate [machine specific workaround]
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+---
+ src/boot/efi/boot.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c
+index 3dcd9a5..3c6ed8c 100644
+--- a/src/boot/efi/boot.c
++++ b/src/boot/efi/boot.c
+@@ -649,7 +649,7 @@ static BOOLEAN menu_run(Config *config, ConfigEntry **chosen_entry, CHAR16 *load
+ }
+
+ /* timeout disabled, wait for next key */
+- wait = TRUE;
++ wait = FALSE;
+ continue;
+ }
+
+--
+2.7.4
+
diff --git a/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch b/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch
new file mode 100644
index 00000000..2f248e21
--- /dev/null
+++ b/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch
@@ -0,0 +1,39 @@
+From fe1c2fdfe81f2ac2b41fe8543ba07f1911770d26 Mon Sep 17 00:00:00 2001
+From: Jianxun Zhang <jianxun.zhang@linux.intel.com>
+Date: Sat, 21 May 2016 18:52:07 -0700
+Subject: [PATCH] sd-boot: Link RMC library into bootloader and stub
+
+Add RMC library into bootloader binary and stub.
+
+Upstream-Status: Pending
+
+Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
+---
+ Makefile.am | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 305099ab6..9fb6f9b7b 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -2802,7 +2802,7 @@ $(top_builddir)/src/boot/efi/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(t
+
+ $(systemd_boot_solib): $(systemd_boot_objects)
+ $(AM_V_CCLD)$(LD) $(efi_ldflags) $(systemd_boot_objects) \
+- -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \
++ -o $@ -lefi -lgnuefi -lrmcefi $(shell $(CC) -print-libgcc-file-name); \
+ nm -D -u $@ | grep ' U ' && exit 1 || :
+
+ $(systemd_boot): $(systemd_boot_solib)
+@@ -2852,7 +2852,7 @@ $(top_builddir)/src/boot/efi/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(t
+
+ $(stub_solib): $(stub_objects)
+ $(AM_V_CCLD)$(LD) $(efi_ldflags) $(stub_objects) \
+- -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \
++ -o $@ -lefi -lgnuefi -lrmcefi $(shell $(CC) -print-libgcc-file-name); \
+ nm -D -u $@ | grep ' U ' && exit 1 || :
+
+ $(stub): $(stub_solib)
+--
+2.11.0
+
diff --git a/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-stub-check-LoadOptions-contains-data.patch b/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-stub-check-LoadOptions-contains-data.patch
new file mode 100644
index 00000000..69acc8f8
--- /dev/null
+++ b/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-stub-check-LoadOptions-contains-data.patch
@@ -0,0 +1,42 @@
+From 87cd5a5e0f06ceb7f9dbdcc4029e0c279a38e6ad Mon Sep 17 00:00:00 2001
+From: Mikko Ylinen <mikko.ylinen@linux.intel.com>
+Date: Mon, 27 Feb 2017 10:04:03 +0200
+Subject: [PATCH] sd-boot: stub: check LoadOptions contains data
+
+With some UEFI shells LoadOptionsSize is reported being > 0
+but the corresponding LoadOptions does not contain any data
+(the first element has value 0).
+
+When that happens, the stub feature that allows .cmdline to be
+replaced by what's in LoadOptions ends up copying nothing/random
+data to the kernel cmdline resulting in different kinds of boot
+problems.
+
+To fix this, add a check to see if LoadOptions contains data
+before replacing the .cmdline.
+
+Upstream-Status: Accepted [https://github.com/systemd/systemd/pull/5467]
+
+Fixes [YOCTO #11078].
+
+Signed-off-by: Mikko Ylinen <mikko.ylinen@linux.intel.com>
+---
+ src/boot/efi/stub.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c
+index 7c1ffb1bc..b7d5d3cda 100644
+--- a/src/boot/efi/stub.c
++++ b/src/boot/efi/stub.c
+@@ -87,7 +87,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
+ cmdline_len = szs[0];
+
+ /* if we are not in secure boot mode, accept a custom command line and replace the built-in one */
+- if (!secure && loaded_image->LoadOptionsSize > 0) {
++ if (!secure && loaded_image->LoadOptionsSize > 0 && *(CHAR16 *)loaded_image->LoadOptions != 0) {
+ CHAR16 *options;
+ CHAR8 *line;
+ UINTN i;
+--
+2.11.0
+
diff --git a/recipes-bsp/systemd-boot/systemd-boot/0002-sd-boot-Load-board-specific-boot-entries-from-RMC-da.patch b/recipes-bsp/systemd-boot/systemd-boot/0002-sd-boot-Load-board-specific-boot-entries-from-RMC-da.patch
new file mode 100644
index 00000000..e88012c3
--- /dev/null
+++ b/recipes-bsp/systemd-boot/systemd-boot/0002-sd-boot-Load-board-specific-boot-entries-from-RMC-da.patch
@@ -0,0 +1,250 @@
+From a3c4fc8c2847fe289a617bcba1d905f580f0e18d Mon Sep 17 00:00:00 2001
+From: Jianxun Zhang <jianxun.zhang@linux.intel.com>
+Date: Wed, 1 Jun 2016 16:32:22 -0700
+Subject: [PATCH 2/3] sd-boot: Load board-specific boot entries from RMC
+ database
+
+RMC provides a centralized database file on ESP. The DB contains
+fingerprints and any file blobs associated to physical boards.
+Callers can fetch board-specific data with fingerprint info
+collected from board at runtime if there is any record matched
+board's fingerprint.
+
+To let bootloader know which file blob in RMC should be queried,
+a special config file BOOTENTRY.CONFIG is defined as:
+
+boot.conf
+install.conf
+
+Bootloader calls RMC APIs and other functions to perform these
+tasks before it shows boot menu to user:
+
+(1) Load RMC database file from ESP
+(2) Collect fingerprint data from board
+(3) Query BOOTENTRY.CONFIG from RMC DB with fingerprint
+(4) Parse BOOTENTRY.CONFIG to know names of boot entry files
+(5) Query boot entry files one by one from RMC DB, and add
+ them into sd-boot config data.
+
+The final effect is that bootloader will show board-specific
+boot entries in boot menu to user. User then can choose one
+of them to boot system with the selected configuration.
+
+If any of these steps fails, bootloader simply skips loading
+RMC configs or any entry file not successfully fetched from
+RMC DB. Once any entry is loaded successfully from RMC DB,
+bootloader skips loading any boot entries from ESP.
+
+Upstream-Status: Pending
+
+Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
+---
+ src/boot/efi/boot.c | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 145 insertions(+), 2 deletions(-)
+
+diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c
+index 30c1ead..d1b029b 100644
+--- a/src/boot/efi/boot.c
++++ b/src/boot/efi/boot.c
+@@ -15,6 +15,7 @@
+
+ #include <efi.h>
+ #include <efilib.h>
++#include <rmc_api.h>
+
+ #include "console.h"
+ #include "disk.h"
+@@ -33,6 +34,9 @@ static const char __attribute__((used)) magic[] = "#### LoaderInfo: systemd-boot
+
+ static const EFI_GUID global_guid = EFI_GLOBAL_VARIABLE;
+
++static CHAR8* rmc_db;
++static rmc_fingerprint_t *rmc_fp;
++
+ enum loader_type {
+ LOADER_UNDEFINED,
+ LOADER_EFI,
+@@ -1702,6 +1706,136 @@ static VOID config_free(Config *config) {
+ FreePool(config->entry_oneshot);
+ }
+
++/* Derived from line_get_key_value(), we could consolidate two functions later */
++static CHAR8 *get_line(CHAR8 *content, UINT64 *pos) {
++ CHAR8 *line;
++ UINT64 linelen;
++
++skip:
++ line = content + *pos;
++ if (*line == '\0')
++ return NULL;
++
++ linelen = 0;
++ while (line[linelen] && !strchra((CHAR8 *)"\n\r", line[linelen]))
++ linelen++;
++
++ /* move pos to next line */
++ *pos += linelen;
++ if (content[*pos])
++ (*pos)++;
++
++ /* empty line */
++ if (linelen == 0)
++ goto skip;
++
++ /* terminate line */
++ line[linelen] = '\0';
++
++ /* remove leading whitespace */
++ while (strchra((CHAR8 *)" \t", *line)) {
++ line++;
++ linelen--;
++ }
++
++ /* remove trailing whitespace */
++ while (linelen > 0 && strchra((CHAR8 *)" \t", line[linelen-1]))
++ linelen--;
++ line[linelen] = '\0';
++
++ if (*line == '#')
++ goto skip;
++
++ return line;
++}
++
++/* load rmc database file from ESP and try to get fingerprint. These
++ * are essential information indicating we could query rmc data for
++ * this board at least
++ * return 0 if both database file and fingerprint can be obtained, otherwise
++ * non-zero value is returned.
++ *
++ * Note: db and fp hold valid values only when this function returns 0.
++ * Caller is responsible to free allocated memory pointed by *db and *fp when
++ * this function returns 0.
++ */
++
++static UINTN rmc_initialize(EFI_FILE *root_dir, EFI_SYSTEM_TABLE *sys_table, CHAR8 **db, rmc_fingerprint_t **fp) {
++ UINTN len;
++ UINTN ret = 1;
++
++ if (!db || !fp)
++ return ret;
++
++ *db = NULL;
++ *fp = NULL;
++
++ /* load rmc database */
++ len = file_read(root_dir, L"\\rmc.db", 0, 0, db);
++
++ if (len <= 0)
++ goto done;
++
++ *fp = AllocateZeroPool(sizeof(rmc_fingerprint_t));
++ /* call rmc to get fingerprint. We will use single-action rmc APIs to query multiple files.
++ * This should bring a better performance than calling double-action rmc API every time.
++ */
++ if (rmc_get_fingerprint(sys_table, *fp))
++ goto done;
++
++ ret = 0;
++done:
++ if (ret) {
++ FreePool(*db);
++ FreePool(*fp);
++ }
++
++ return ret;
++}
++
++/* load RMC entries
++ * return TRUE when at least one entry is loaded, otherwise, return FALSE
++ */
++static BOOLEAN config_load_rmc_entries(Config *config, EFI_HANDLE *device, CHAR16 *loaded_image_path, CHAR8 *db, rmc_fingerprint_t *fp) {
++ CHAR8 *boot_entry = NULL;
++ CHAR8 *boot_config = NULL;
++ rmc_file_t rp;
++ CHAR8 *line;
++ UINT64 pos = 0;
++ BOOLEAN ret = FALSE;
++
++ if (!db || !fp)
++ return ret;
++
++ /* query boot entry config file */
++ if (rmc_query_file_by_fp(fp, db, "BOOTENTRY.CONFIG", &rp))
++ return ret;
++
++ /* file blob read from rmc db is not necessarily null-terminated, and we
++ * should keep mem where rmc db lives from change during parsing
++ */
++ boot_config = AllocatePool(rp.blob_len * sizeof(CHAR8) + 1);
++ CopyMem(boot_config, rp.blob, rp.blob_len);
++ boot_config[rp.blob_len] = '\0';
++ /* parse boot entry config */
++ while ((line = get_line(boot_config, &pos))) {
++ if (rmc_query_file_by_fp(fp, db, (char *)line, &rp))
++ continue;
++ if (rp.blob_len > 0) {
++ boot_entry = AllocatePool(rp.blob_len * sizeof(CHAR8) + 1);
++ CopyMem(boot_entry, rp.blob, rp.blob_len);
++ boot_entry[rp.blob_len] = '\0';
++ config_entry_add_from_file(config, device,
++ stra_to_str(line), boot_entry,
++ loaded_image_path);
++ /* tell caller success when a RMC entry is loaded */
++ ret = TRUE;
++ }
++ }
++
++ return ret;
++}
++
+ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
+ CHAR16 *s;
+ CHAR8 *b;
+@@ -1714,6 +1848,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
+ UINT64 init_usec;
+ BOOLEAN menu = FALSE;
+ CHAR16 uuid[37];
++ BOOLEAN rmc_entry = FALSE;
+
+ InitializeLib(image, sys_table);
+ init_usec = time_usec();
+@@ -1745,6 +1880,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
+ return EFI_LOAD_ERROR;
+ }
+
++ /* Initialize rmc before loading any config */
++ rmc_initialize(root_dir, sys_table, &rmc_db, &rmc_fp);
+
+ /* the filesystem path to this image, to prevent adding ourselves to the menu */
+ loaded_image_path = DevicePathToStr(loaded_image->FilePath);
+@@ -1753,11 +1890,15 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
+ ZeroMem(&config, sizeof(Config));
+ config_load_defaults(&config, root_dir);
+
++ if (rmc_db && rmc_fp)
++ rmc_entry = config_load_rmc_entries(&config, loaded_image->DeviceHandle, loaded_image_path, rmc_db, rmc_fp);
++
+ /* scan /EFI/Linux/ directory */
+ config_entry_add_linux(&config, loaded_image, root_dir);
+
+- /* scan /loader/entries/\*.conf files */
+- config_load_entries(&config, loaded_image->DeviceHandle, root_dir, loaded_image_path);
++ /* scan /loader/entries/\*.conf files only when no RMC entry is loaded */
++ if (rmc_entry == FALSE)
++ config_load_entries(&config, loaded_image->DeviceHandle, root_dir, loaded_image_path);
+
+ /* sort entries after version number */
+ config_sort_entries(&config);
+@@ -1851,6 +1992,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
+ out:
+ FreePool(loaded_image_path);
+ config_free(&config);
++ FreePool(rmc_db);
++ FreePool(rmc_fp);
+ uefi_call_wrapper(root_dir->Close, 1, root_dir);
+ uefi_call_wrapper(BS->CloseProtocol, 4, image, &LoadedImageProtocol, image, NULL);
+ return err;
+--
+2.7.4
+
diff --git a/recipes-bsp/systemd-boot/systemd-boot/0003-sd-boot-Support-global-kernel-command-line-fragment.patch b/recipes-bsp/systemd-boot/systemd-boot/0003-sd-boot-Support-global-kernel-command-line-fragment.patch
new file mode 100644
index 00000000..a4b63557
--- /dev/null
+++ b/recipes-bsp/systemd-boot/systemd-boot/0003-sd-boot-Support-global-kernel-command-line-fragment.patch
@@ -0,0 +1,66 @@
+From 1e33f99e13a70c19c1f63f6ef1c5522a09adece6 Mon Sep 17 00:00:00 2001
+From: Jianxun Zhang <jianxun.zhang@linux.intel.com>
+Date: Mon, 20 Jun 2016 13:08:20 -0700
+Subject: [PATCH 3/3] sd-boot: Support global kernel command line fragment
+
+Query file blob KBOOTPARAM from RMC. If it exists, we append
+it to the new linux boot entry's cmdline. A boot entry could
+be read from a .conf file on ESP, RMC database, or embedded
+linux image. content in KBOOTPARAM is effective in all of
+these cases.
+
+Upstream-Status: Pending
+
+Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
+---
+ src/boot/efi/boot.c | 34 ++++++++++++++++++++++++++++++++++
+ 1 file changed, 34 insertions(+)
+
+diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c
+index d1b029b..8dffc48 100644
+--- a/src/boot/efi/boot.c
++++ b/src/boot/efi/boot.c
+@@ -846,6 +846,40 @@ static VOID config_add_entry(Config *config, ConfigEntry *entry) {
+ config->entries = ReallocatePool(config->entries,
+ sizeof(VOID *) * config->entry_count, sizeof(VOID *) * i);
+ }
++
++ /* rmc: a linux entry could be added from .conf file or an embedded linux image
++ * we put appending global command line here to cover both of two cases.
++ */
++ if (entry->type == LOADER_LINUX && rmc_db && rmc_fp) {
++ rmc_file_t rmc_kp;
++
++ if (!rmc_query_file_by_fp(rmc_fp, rmc_db, "KBOOTPARAM", &rmc_kp)) {
++ CHAR8 *cmdline;
++ CHAR16 *s;
++ CHAR16 *t;
++ CHAR16 *p;
++
++ cmdline = AllocatePool(rmc_kp.blob_len * sizeof(CHAR8) + 1);
++ CopyMem(cmdline, rmc_kp.blob, rmc_kp.blob_len);
++ cmdline[rmc_kp.blob_len] = '\0';
++ p = stra_to_str(cmdline);
++ t = p;
++
++ while (*t) {
++ if (*t == '\n')
++ *t = '\0';
++ t++;
++ }
++
++ s = PoolPrint(L"%s %s", entry->options, p);
++ FreePool(entry->options);
++ FreePool(p);
++ FreePool(cmdline);
++
++ entry->options = s;
++ }
++ }
++
+ config->entries[config->entry_count++] = entry;
+ }
+
+--
+2.7.4
+
diff --git a/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch b/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch
new file mode 100644
index 00000000..75082693
--- /dev/null
+++ b/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch
@@ -0,0 +1,81 @@
+From 4cb9c65ea9c0eba3ba04d036dccd4a5ab3d2547b Mon Sep 17 00:00:00 2001
+From: Mikko Ylinen <mikko.ylinen@intel.com>
+Date: Fri, 27 Jan 2017 13:31:45 +0200
+Subject: [PATCH] sd-boot: support global kernel command line in EFI stub
+
+This change integrates rmc into EFI stub and supports a
+global fragment (RMC KBOOTPARAM) that is appended to the
+cmdline at boot.
+
+The fragment is board-specific and read from the database.
+
+Implements [YOCTO #10924].
+
+Upstream-status: Pending
+
+Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
+---
+ src/boot/efi/stub.c | 33 +++++++++++++++++++++++++++++++++
+ 1 file changed, 33 insertions(+)
+
+diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c
+index 1e250f34f..f3865199f 100644
+--- a/src/boot/efi/stub.c
++++ b/src/boot/efi/stub.c
+@@ -13,6 +13,7 @@
+
+ #include <efi.h>
+ #include <efilib.h>
++#include <rmc_api.h>
+
+ #include "disk.h"
+ #include "graphics.h"
+@@ -48,6 +49,9 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
+ UINTN cmdline_len;
+ CHAR16 uuid[37];
+ EFI_STATUS err;
++ INTN len;
++ CHAR8 *rmc_db = NULL;
++ rmc_file_t rmc_file;
+
+ InitializeLib(image, sys_table);
+
+@@ -112,6 +116,35 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
+ #endif
+ }
+
++ len = file_read(root_dir, L"\\rmc.db", 0, 0, &rmc_db);
++ if (len <= 0)
++ rmc_db = NULL;
++
++ /* If the board has a fragment in rmc database, append it to the cmdline */
++ if (rmc_db && !rmc_gimme_file(sys_table, rmc_db, "KBOOTPARAM", &rmc_file)) {
++ CHAR8 *line;
++ UINTN i = 0;
++ UINTN j;
++
++ line = AllocatePool(rmc_file.blob_len + cmdline_len + 2);
++
++ while (i < cmdline_len && cmdline[i] != '\0') {
++ line[i] = cmdline[i];
++ i++;
++ }
++
++ line[i++] = ' ';
++
++ for (j=0; j < rmc_file.blob_len; j++)
++ line[i+j] = rmc_file.blob[j];
++ line[i+j] = '\0';
++
++ cmdline = line;
++ cmdline_len = i + j;
++
++ FreePool(rmc_db);
++ }
++
+ /* export the device path this image is started from */
+ if (disk_get_part_uuid(loaded_image->DeviceHandle, uuid) == EFI_SUCCESS)
+ efivar_set(L"LoaderDevicePartUUID", uuid, FALSE);
+--
+2.11.0
+
diff --git a/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc b/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc
new file mode 100644
index 00000000..1172d53d
--- /dev/null
+++ b/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc
@@ -0,0 +1,12 @@
+DEPENDS_append_intel-x86-common = " rmc rmc-efi"
+
+EXTRA_OEMAKE_append_intel-x86-common = ' EFI_LDFLAGS="-L${STAGING_DIR_HOST}/usr/lib" EFI_CFLAGS="-I${STAGING_INCDIR}/rmc -DRMC_EFI"'
+
+SRC_URI_append_intel-x86-common = " \
+ file://0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch \
+ file://0002-sd-boot-Load-board-specific-boot-entries-from-RMC-da.patch \
+ file://0003-sd-boot-Support-global-kernel-command-line-fragment.patch \
+ file://0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch \
+ file://0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch \
+ file://0001-sd-boot-stub-check-LoadOptions-contains-data.patch \
+ "
diff --git a/recipes-bsp/systemd-boot/systemd-boot/systemd-boot.inc b/recipes-bsp/systemd-boot/systemd-boot/systemd-boot.inc
new file mode 100644
index 00000000..fcce6ce1
--- /dev/null
+++ b/recipes-bsp/systemd-boot/systemd-boot/systemd-boot.inc
@@ -0,0 +1,7 @@
+EXTRA_OEMAKE_append_intel-x86-common = ' EFI_LDFLAGS="-L${STAGING_DIR_HOST}/usr/lib" '
+
+SRC_URI_append_intel-x86-common = " \
+ file://0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch \
+ file://0001-sd-boot-stub-check-LoadOptions-contains-data.patch \
+ "
+
diff --git a/recipes-bsp/systemd-boot/systemd-boot_%.bbappend b/recipes-bsp/systemd-boot/systemd-boot_%.bbappend
new file mode 100644
index 00000000..557c0493
--- /dev/null
+++ b/recipes-bsp/systemd-boot/systemd-boot_%.bbappend
@@ -0,0 +1,23 @@
+FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/systemd-boot:"
+
+# Pin systemd revision down for systemd-boot recipe.
+# Patches could not be applied cleanly when systemd in OE is updated,
+# though we don't expect a lot of changes could happen in bootloader.
+# RMC is designed to support a large number of types of boards, so we
+# should do explicit update with validation to prevent regression even
+# resolving conflicts for a new tip could be done in a short time.
+
+# Revision: systemd v232 in OE
+SRCREV_intel-x86-common = "a1e2ef7ec912902d8142e7cb5830cbfb47dba86c"
+
+include systemd-boot/${EFI_PROVIDER}.inc
+
+PACKAGE_ARCH_intel-x86-common = "${INTEL_COMMON_PACKAGE_ARCH}"
+
+do_compile_append_intel-x86-common() {
+ oe_runmake linux${SYSTEMD_BOOT_EFI_ARCH}.efi.stub
+}
+
+do_deploy_append_intel-x86-common() {
+ install ${B}/linux*.efi.stub ${DEPLOYDIR}
+}
diff --git a/recipes-bsp/thermald/thermald_1.6.bb b/recipes-bsp/thermald/thermald_1.6.bb
new file mode 100644
index 00000000..e6cbb621
--- /dev/null
+++ b/recipes-bsp/thermald/thermald_1.6.bb
@@ -0,0 +1,33 @@
+SUMMARY = "Linux thermal daemon"
+
+DESCRIPTION = "Thermal Daemon is a Linux daemon used to prevent the \
+overheating of platforms. This daemon monitors temperature and applies \
+compensation using available cooling methods."
+
+HOMEPAGE = "https://github.com/01org/thermal_daemon"
+
+DEPENDS = "dbus dbus-glib dbus-glib-native libxml2 glib-2.0 glib-2.0-native"
+DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd','',d)}"
+DEPENDS_append_libc-musl = " argp-standalone"
+DEPENDS_append_toolchain-clang = " openmp"
+LICENSE = "GPL-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=ea8831610e926e2e469075b52bf08848"
+
+SRC_URI = "git://github.com/intel/thermal_daemon/"
+SRCREV = "5f1be4d9d6f3b27d2c9884f833ca05cdcb4428e0"
+S = "${WORKDIR}/git"
+
+inherit pkgconfig autotools systemd
+
+FILES_${PN} += "${datadir}/dbus-1/system-services/*.service"
+
+SYSTEMD_SERVICE_${PN} = "thermald.service"
+
+COMPATIBLE_HOST = '(i.86|x86_64).*-linux'
+
+CONFFILES_${PN} = " \
+ ${sysconfdir}/thermald/thermal-conf.xml \
+ ${sysconfdir}/thermald/thermal-cpu-cdev-order.xml \
+ "
+
+UPSTREAM_CHECK_URI = "https://github.com/01org/thermal_daemon/releases"