diff options
Diffstat (limited to 'common')
152 files changed, 6566 insertions, 0 deletions
diff --git a/common/custom-licenses/BSD_LMS b/common/custom-licenses/BSD_LMS new file mode 100755 index 00000000..2ea28ff4 --- /dev/null +++ b/common/custom-licenses/BSD_LMS @@ -0,0 +1,30 @@ +Copyright (C) 2004-2012 Intel Corporation. All rights reserved. + +• This license covers the sources of the Local Manageability Service (LMS). +For licensing information for the LMS build scripts, please refer to the file build_script_license.txt. + +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. diff --git a/common/custom-licenses/Intel-Microcode-License b/common/custom-licenses/Intel-Microcode-License new file mode 100644 index 00000000..af5b41c2 --- /dev/null +++ b/common/custom-licenses/Intel-Microcode-License @@ -0,0 +1,123 @@ +INTEL SOFTWARE LICENSE AGREEMENT + +IMPORTANT - READ BEFORE COPYING, INSTALLING OR USING. +Do not use or load this software and any associated materials (collectively, +the "Software") until you have carefully read the following terms and +conditions. By loading or using the Software, you agree to the terms of this +Agreement. If you do not wish to so agree, do not install or use the Software. + +LICENSES: Please Note: +- If you are a network administrator, the "Site License" below shall +apply to you. +- If you are an end user, the "Single User License" shall apply to you. +- If you are an original equipment manufacturer (OEM), the "OEM License" +shall apply to you. + +SITE LICENSE. You may copy the Software onto your organization's computers +for your organization's use, and you may make a reasonable number of +back-up copies of the Software, subject to these conditions: + +1. This Software is licensed for use only in conjunction with Intel +component products. Use of the Software in conjunction with non-Intel +component products is not licensed hereunder. +2. You may not copy, modify, rent, sell, distribute or transfer any part +of the Software except as provided in this Agreement, and you agree to +prevent unauthorized copying of the Software. +3. You may not reverse engineer, decompile, or disassemble the Software. +4. You may not sublicense or permit simultaneous use of the Software by +more than one user. +5. The Software may include portions offered on terms in addition to those +set out here, as set out in a license accompanying those portions. + +SINGLE USER LICENSE. You may copy the Software onto a single computer for +your personal, noncommercial use, and you may make one back-up copy of the +Software, subject to these conditions: + +1. This Software is licensed for use only in conjunction with Intel +component products. Use of the Software in conjunction with non-Intel +component products is not licensed hereunder. +2. You may not copy, modify, rent, sell, distribute or transfer any part +of the Software except as provided in this Agreement, and you agree to +prevent unauthorized copying of the Software. +3. You may not reverse engineer, decompile, or disassemble the Software. +4. You may not sublicense or permit simultaneous use of the Software by +more than one user. +5. The Software may include portions offered on terms in addition to those +set out here, as set out in a license accompanying those portions. + +OEM LICENSE: You may reproduce and distribute the Software only as an +integral part of or incorporated in Your product or as a standalone +Software maintenance update for existing end users of Your products, +excluding any other standalone products, subject to these conditions: + +1. This Software is licensed for use only in conjunction with Intel +component products. Use of the Software in conjunction with non-Intel +component products is not licensed hereunder. +2. You may not copy, modify, rent, sell, distribute or transfer any part +of the Software except as provided in this Agreement, and you agree to +prevent unauthorized copying of the Software. +3. You may not reverse engineer, decompile, or disassemble the Software. +4. You may only distribute the Software to your customers pursuant to a +written license agreement. Such license agreement may be a "break-the- +seal" license agreement. At a minimum such license shall safeguard +Intel's ownership rights to the Software. +5. The Software may include portions offered on terms in addition to those +set out here, as set out in a license accompanying those portions. + +NO OTHER RIGHTS. No rights or licenses are granted by Intel to You, expressly +or by implication, with respect to any proprietary information or patent, +copyright, mask work, trademark, trade secret, or other intellectual property +right owned or controlled by Intel, except as expressly provided in this +Agreement. + +OWNERSHIP OF SOFTWARE AND COPYRIGHTS. Title to all copies of the Software +remains with Intel or its suppliers. The Software is copyrighted and +protected by the laws of the United States and other countries, and +international treaty provisions. You may not remove any copyright notices +from the Software. Intel may make changes to the Software, or to items +referenced therein, at any time without notice, but is not obligated to +support or update the Software. Except as otherwise expressly provided, Intel +grants no express or implied right under Intel patents, copyrights, +trademarks, or other intellectual property rights. You may transfer the +Software only if the recipient agrees to be fully bound by these terms and if +you retain no copies of the Software. + +LIMITED MEDIA WARRANTY. If the Software has been delivered by Intel on +physical media, Intel warrants the media to be free from material physical +defects for a period of ninety days after delivery by Intel. If such a defect +is found, return the media to Intel for replacement or alternate delivery of +the Software as Intel may select. + +EXCLUSION OF OTHER WARRANTIES. EXCEPT AS PROVIDED ABOVE, THE SOFTWARE IS +PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND +INCLUDING WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, OR FITNESS FOR A +PARTICULAR PURPOSE. Intel does not warrant or assume responsibility for the +accuracy or completeness of any information, text, graphics, links or other +items contained within the Software. + +LIMITATION OF LIABILITY. IN NO EVENT SHALL INTEL OR ITS SUPPLIERS BE LIABLE +FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, LOST PROFITS, +BUSINESS INTERRUPTION, OR LOST INFORMATION) ARISING OUT OF THE USE OF OR +INABILITY TO USE THE SOFTWARE, EVEN IF INTEL HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. SOME JURISDICTIONS PROHIBIT EXCLUSION OR +LIMITATION OF LIABILITY FOR IMPLIED WARRANTIES OR CONSEQUENTIAL OR INCIDENTAL +DAMAGES, SO THE ABOVE LIMITATION MAY NOT APPLY TO YOU. YOU MAY ALSO HAVE +OTHER LEGAL RIGHTS THAT VARY FROM JURISDICTION TO JURISDICTION. + +TERMINATION OF THIS AGREEMENT. Intel may terminate this Agreement at any time +if you violate its terms. Upon termination, you will immediately destroy the +Software or return all copies of the Software to Intel. + +APPLICABLE LAWS. Claims arising under this Agreement shall be governed by the +laws of California, excluding its principles of conflict of laws and the +United Nations Convention on Contracts for the Sale of Goods. You may not +export the Software in violation of applicable export laws and regulations. +Intel is not obligated under any other agreements unless they are in writing +and signed by an authorized representative of Intel. + +GOVERNMENT RESTRICTED RIGHTS. The Software is provided with "RESTRICTED +RIGHTS." Use, duplication, or disclosure by the Government is subject to +restrictions as set forth in FAR52.227-14 and DFAR252.227-7013 et seq. or its +successor. Use of the Software by the Government constitutes acknowledgment +of Intel's proprietary rights therein. Contractor or Manufacturer is Intel +2200 Mission College Blvd., Santa Clara, CA 95052. diff --git a/common/recipes-bsp/amt/files/atnetworktool-printf-fix.patch b/common/recipes-bsp/amt/files/atnetworktool-printf-fix.patch new file mode 100644 index 00000000..6bb03e3a --- /dev/null +++ b/common/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/common/recipes-bsp/amt/files/readlink-declaration.patch b/common/recipes-bsp/amt/files/readlink-declaration.patch new file mode 100644 index 00000000..0246d501 --- /dev/null +++ b/common/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/common/recipes-bsp/amt/lms/0001-Include-sys-select.h-for-fd_set.patch b/common/recipes-bsp/amt/lms/0001-Include-sys-select.h-for-fd_set.patch new file mode 100644 index 00000000..e28d45ac --- /dev/null +++ b/common/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/common/recipes-bsp/amt/lms/0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch b/common/recipes-bsp/amt/lms/0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch new file mode 100644 index 00000000..17b206e2 --- /dev/null +++ b/common/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/common/recipes-bsp/amt/lms/0002-Use-proper-netinet-in.h-API.patch b/common/recipes-bsp/amt/lms/0002-Use-proper-netinet-in.h-API.patch new file mode 100644 index 00000000..fa2e29a5 --- /dev/null +++ b/common/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/common/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch b/common/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/common/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/common/recipes-bsp/amt/lms/0004-Intel-AMT-ME-real-time-notification-infra.patch b/common/recipes-bsp/amt/lms/0004-Intel-AMT-ME-real-time-notification-infra.patch new file mode 100644 index 00000000..04f584ae --- /dev/null +++ b/common/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/common/recipes-bsp/amt/lms7_7.1.20.bb b/common/recipes-bsp/amt/lms7_7.1.20.bb new file mode 100644 index 00000000..eca36811 --- /dev/null +++ b/common/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/common/recipes-bsp/amt/lms8_8.0.0-7.bb b/common/recipes-bsp/amt/lms8_8.0.0-7.bb new file mode 100644 index 00000000..9b37b9b4 --- /dev/null +++ b/common/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/common/recipes-bsp/efilinux/efilinux/0001-Disable-address-of-packed-member-warning.patch b/common/recipes-bsp/efilinux/efilinux/0001-Disable-address-of-packed-member-warning.patch new file mode 100644 index 00000000..afb99514 --- /dev/null +++ b/common/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/common/recipes-bsp/efilinux/efilinux/0002-initialize-char-pointers.patch b/common/recipes-bsp/efilinux/efilinux/0002-initialize-char-pointers.patch new file mode 100644 index 00000000..127c187a --- /dev/null +++ b/common/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/common/recipes-bsp/efilinux/efilinux_1.1.bb b/common/recipes-bsp/efilinux/efilinux_1.1.bb new file mode 100644 index 00000000..63e80f88 --- /dev/null +++ b/common/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/common/recipes-bsp/formfactor/formfactor/machconfig b/common/recipes-bsp/formfactor/formfactor/machconfig new file mode 100644 index 00000000..73695fac --- /dev/null +++ b/common/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/common/recipes-bsp/formfactor/formfactor_0.0.bbappend b/common/recipes-bsp/formfactor/formfactor_0.0.bbappend new file mode 100644 index 00000000..6dd422ae --- /dev/null +++ b/common/recipes-bsp/formfactor/formfactor_0.0.bbappend @@ -0,0 +1 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:" diff --git a/common/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.conf b/common/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.conf new file mode 100644 index 00000000..74d33c87 --- /dev/null +++ b/common/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/common/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.sh b/common/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.sh new file mode 100644 index 00000000..75cda99f --- /dev/null +++ b/common/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/common/recipes-bsp/gma500-gfx-check/gma500-gfx-check_1.0.bb b/common/recipes-bsp/gma500-gfx-check/gma500-gfx-check_1.0.bb new file mode 100644 index 00000000..7b08064b --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG b/common/recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG new file mode 100644 index 00000000..dd1b9114 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG @@ -0,0 +1,3 @@ +boot.conf +install.conf + diff --git a/common/recipes-bsp/rmc/boards/Galileo2/boot.conf b/common/recipes-bsp/rmc/boards/Galileo2/boot.conf new file mode 100644 index 00000000..580ea486 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/Galileo2/gallieo2.fp b/common/recipes-bsp/rmc/boards/Galileo2/gallieo2.fp Binary files differnew file mode 100755 index 00000000..fe77d4d1 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/Galileo2/gallieo2.fp diff --git a/common/recipes-bsp/rmc/boards/Galileo2/install.conf b/common/recipes-bsp/rmc/boards/Galileo2/install.conf new file mode 100644 index 00000000..688c2a8f --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/MinnowboardTurbot/KBOOTPARAM b/common/recipes-bsp/rmc/boards/MinnowboardTurbot/KBOOTPARAM new file mode 100644 index 00000000..476b1fbe --- /dev/null +++ b/common/recipes-bsp/rmc/boards/MinnowboardTurbot/KBOOTPARAM @@ -0,0 +1 @@ +console=ttyS0,115200 diff --git a/common/recipes-bsp/rmc/boards/MinnowboardTurbot/minnowboardturbot.fp b/common/recipes-bsp/rmc/boards/MinnowboardTurbot/minnowboardturbot.fp Binary files differnew file mode 100644 index 00000000..9aa145f3 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/MinnowboardTurbot/minnowboardturbot.fp diff --git a/common/recipes-bsp/rmc/boards/NUC5i5RYB/BOOTENTRY.CONFIG b/common/recipes-bsp/rmc/boards/NUC5i5RYB/BOOTENTRY.CONFIG new file mode 100644 index 00000000..b2fabe82 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/NUC5i5RYB/BOOTENTRY.CONFIG @@ -0,0 +1,2 @@ +boot.conf +install.conf diff --git a/common/recipes-bsp/rmc/boards/NUC5i5RYB/INSTALLER.CONFIG b/common/recipes-bsp/rmc/boards/NUC5i5RYB/INSTALLER.CONFIG new file mode 100644 index 00000000..ca5f04b9 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/NUC5i5RYB/POSTINSTALL.sh b/common/recipes-bsp/rmc/boards/NUC5i5RYB/POSTINSTALL.sh new file mode 100644 index 00000000..6694261b --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/NUC5i5RYB/boot.conf b/common/recipes-bsp/rmc/boards/NUC5i5RYB/boot.conf new file mode 100644 index 00000000..b29fa45e --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/NUC5i5RYB/install.conf b/common/recipes-bsp/rmc/boards/NUC5i5RYB/install.conf new file mode 100644 index 00000000..0dca3cae --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/NUC5i5RYB/nuc5i5.fp b/common/recipes-bsp/rmc/boards/NUC5i5RYB/nuc5i5.fp Binary files differnew file mode 100644 index 00000000..57374779 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/NUC5i5RYB/nuc5i5.fp diff --git a/common/recipes-bsp/rmc/boards/T100-32bit/BOOTENTRY.CONFIG b/common/recipes-bsp/rmc/boards/T100-32bit/BOOTENTRY.CONFIG new file mode 100644 index 00000000..b2fabe82 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/T100-32bit/BOOTENTRY.CONFIG @@ -0,0 +1,2 @@ +boot.conf +install.conf diff --git a/common/recipes-bsp/rmc/boards/T100-32bit/T100-32bit.fp b/common/recipes-bsp/rmc/boards/T100-32bit/T100-32bit.fp Binary files differnew file mode 100644 index 00000000..86ecea73 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/T100-32bit/T100-32bit.fp diff --git a/common/recipes-bsp/rmc/boards/T100-32bit/boot.conf b/common/recipes-bsp/rmc/boards/T100-32bit/boot.conf new file mode 100644 index 00000000..f1578e0f --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/T100-32bit/install.conf b/common/recipes-bsp/rmc/boards/T100-32bit/install.conf new file mode 100644 index 00000000..67e7eb18 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/broxton-m/BOOTENTRY.CONFIG b/common/recipes-bsp/rmc/boards/broxton-m/BOOTENTRY.CONFIG new file mode 100644 index 00000000..b2fabe82 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/broxton-m/BOOTENTRY.CONFIG @@ -0,0 +1,2 @@ +boot.conf +install.conf diff --git a/common/recipes-bsp/rmc/boards/broxton-m/INSTALLER.CONFIG b/common/recipes-bsp/rmc/boards/broxton-m/INSTALLER.CONFIG new file mode 100644 index 00000000..ecd20609 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/broxton-m/KBOOTPARAM b/common/recipes-bsp/rmc/boards/broxton-m/KBOOTPARAM new file mode 100644 index 00000000..08be5dfb --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/broxton-m/POSTINSTALL.sh b/common/recipes-bsp/rmc/boards/broxton-m/POSTINSTALL.sh new file mode 100644 index 00000000..30bbd28e --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/broxton-m/bm-1F1.fp b/common/recipes-bsp/rmc/boards/broxton-m/bm-1F1.fp Binary files differnew file mode 100755 index 00000000..1a150280 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/broxton-m/bm-1F1.fp diff --git a/common/recipes-bsp/rmc/boards/broxton-m/bm.fp b/common/recipes-bsp/rmc/boards/broxton-m/bm.fp Binary files differnew file mode 100755 index 00000000..135a7a5d --- /dev/null +++ b/common/recipes-bsp/rmc/boards/broxton-m/bm.fp diff --git a/common/recipes-bsp/rmc/boards/broxton-m/boot.conf b/common/recipes-bsp/rmc/boards/broxton-m/boot.conf new file mode 100644 index 00000000..caa00c50 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/broxton-m/install.conf b/common/recipes-bsp/rmc/boards/broxton-m/install.conf new file mode 100644 index 00000000..9cdd86b7 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/broxton-m/joule-1F1.fp b/common/recipes-bsp/rmc/boards/broxton-m/joule-1F1.fp Binary files differnew file mode 100644 index 00000000..d757614f --- /dev/null +++ b/common/recipes-bsp/rmc/boards/broxton-m/joule-1F1.fp diff --git a/common/recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG b/common/recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG new file mode 100644 index 00000000..b2fabe82 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG @@ -0,0 +1,2 @@ +boot.conf +install.conf diff --git a/common/recipes-bsp/rmc/boards/minnowmax/boot.conf b/common/recipes-bsp/rmc/boards/minnowmax/boot.conf new file mode 100644 index 00000000..6e789cd8 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/minnowmax/install.conf b/common/recipes-bsp/rmc/boards/minnowmax/install.conf new file mode 100644 index 00000000..1a493aec --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/minnowmax/minnowmax.fp b/common/recipes-bsp/rmc/boards/minnowmax/minnowmax.fp Binary files differnew file mode 100644 index 00000000..3c5a286f --- /dev/null +++ b/common/recipes-bsp/rmc/boards/minnowmax/minnowmax.fp diff --git a/common/recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG b/common/recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG new file mode 100644 index 00000000..b2fabe82 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG @@ -0,0 +1,2 @@ +boot.conf +install.conf diff --git a/common/recipes-bsp/rmc/boards/minnowmaxB3/boot.conf b/common/recipes-bsp/rmc/boards/minnowmaxB3/boot.conf new file mode 100644 index 00000000..577e5d6a --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/minnowmaxB3/install.conf b/common/recipes-bsp/rmc/boards/minnowmaxB3/install.conf new file mode 100644 index 00000000..cf500d6c --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/minnowmaxB3/minnowmaxB3.fp b/common/recipes-bsp/rmc/boards/minnowmaxB3/minnowmaxB3.fp Binary files differnew file mode 100644 index 00000000..ad3f0d6d --- /dev/null +++ b/common/recipes-bsp/rmc/boards/minnowmaxB3/minnowmaxB3.fp diff --git a/common/recipes-bsp/rmc/boards/mohonpeak/BOOTENTRY.CONFIG b/common/recipes-bsp/rmc/boards/mohonpeak/BOOTENTRY.CONFIG new file mode 100644 index 00000000..b2fabe82 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/mohonpeak/BOOTENTRY.CONFIG @@ -0,0 +1,2 @@ +boot.conf +install.conf diff --git a/common/recipes-bsp/rmc/boards/mohonpeak/INSTALLER.CONFIG b/common/recipes-bsp/rmc/boards/mohonpeak/INSTALLER.CONFIG new file mode 100644 index 00000000..8c5a7678 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/mohonpeak/KBOOTPARAM b/common/recipes-bsp/rmc/boards/mohonpeak/KBOOTPARAM new file mode 100644 index 00000000..169056ee --- /dev/null +++ b/common/recipes-bsp/rmc/boards/mohonpeak/KBOOTPARAM @@ -0,0 +1 @@ +console=ttyS1,115200 console=tty1 diff --git a/common/recipes-bsp/rmc/boards/mohonpeak/POSTINSTALL.sh b/common/recipes-bsp/rmc/boards/mohonpeak/POSTINSTALL.sh new file mode 100644 index 00000000..5f440c38 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/mohonpeak/boot.conf b/common/recipes-bsp/rmc/boards/mohonpeak/boot.conf new file mode 100644 index 00000000..5b7a0f63 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/mohonpeak/install.conf b/common/recipes-bsp/rmc/boards/mohonpeak/install.conf new file mode 100644 index 00000000..dde3497d --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/mohonpeak/mohonpeak.fp b/common/recipes-bsp/rmc/boards/mohonpeak/mohonpeak.fp Binary files differnew file mode 100644 index 00000000..bc4bdae4 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/mohonpeak/mohonpeak.fp diff --git a/common/recipes-bsp/rmc/boards/nucgen6/BOOTENTRY.CONFIG b/common/recipes-bsp/rmc/boards/nucgen6/BOOTENTRY.CONFIG new file mode 100644 index 00000000..b2fabe82 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/nucgen6/BOOTENTRY.CONFIG @@ -0,0 +1,2 @@ +boot.conf +install.conf diff --git a/common/recipes-bsp/rmc/boards/nucgen6/INSTALLER.CONFIG b/common/recipes-bsp/rmc/boards/nucgen6/INSTALLER.CONFIG new file mode 100644 index 00000000..7d5378b2 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/nucgen6/KBOOTPARAM b/common/recipes-bsp/rmc/boards/nucgen6/KBOOTPARAM new file mode 100644 index 00000000..27943b49 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/nucgen6/KBOOTPARAM @@ -0,0 +1 @@ +i915.preliminary_hw_support=1 diff --git a/common/recipes-bsp/rmc/boards/nucgen6/POSTINSTALL.sh b/common/recipes-bsp/rmc/boards/nucgen6/POSTINSTALL.sh new file mode 100644 index 00000000..bec3be42 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/nucgen6/boot.conf b/common/recipes-bsp/rmc/boards/nucgen6/boot.conf new file mode 100644 index 00000000..e6ecb029 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/nucgen6/install.conf b/common/recipes-bsp/rmc/boards/nucgen6/install.conf new file mode 100644 index 00000000..916bb04b --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/nucgen6/mylib.conf b/common/recipes-bsp/rmc/boards/nucgen6/mylib.conf new file mode 100644 index 00000000..fd8357c2 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/boards/nucgen6/nuc6.fp b/common/recipes-bsp/rmc/boards/nucgen6/nuc6.fp Binary files differnew file mode 100644 index 00000000..834f800b --- /dev/null +++ b/common/recipes-bsp/rmc/boards/nucgen6/nuc6.fp diff --git a/common/recipes-bsp/rmc/boards/qemu-2.6/KBOOTPARAM b/common/recipes-bsp/rmc/boards/qemu-2.6/KBOOTPARAM new file mode 100644 index 00000000..476b1fbe --- /dev/null +++ b/common/recipes-bsp/rmc/boards/qemu-2.6/KBOOTPARAM @@ -0,0 +1 @@ +console=ttyS0,115200 diff --git a/common/recipes-bsp/rmc/boards/qemu-2.6/qemu-2.6.fp b/common/recipes-bsp/rmc/boards/qemu-2.6/qemu-2.6.fp Binary files differnew file mode 100644 index 00000000..e4c41657 --- /dev/null +++ b/common/recipes-bsp/rmc/boards/qemu-2.6/qemu-2.6.fp diff --git a/common/recipes-bsp/rmc/boards/qemu-2.8/KBOOTPARAM b/common/recipes-bsp/rmc/boards/qemu-2.8/KBOOTPARAM new file mode 100644 index 00000000..476b1fbe --- /dev/null +++ b/common/recipes-bsp/rmc/boards/qemu-2.8/KBOOTPARAM @@ -0,0 +1 @@ +console=ttyS0,115200 diff --git a/common/recipes-bsp/rmc/boards/qemu-2.8/qemu-2.8.fp b/common/recipes-bsp/rmc/boards/qemu-2.8/qemu-2.8.fp Binary files differnew file mode 100644 index 00000000..7f28f37c --- /dev/null +++ b/common/recipes-bsp/rmc/boards/qemu-2.8/qemu-2.8.fp diff --git a/common/recipes-bsp/rmc/rmc-db.bb b/common/recipes-bsp/rmc/rmc-db.bb new file mode 100644 index 00000000..f24ed11c --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/rmc-efi.bb b/common/recipes-bsp/rmc/rmc-efi.bb new file mode 100644 index 00000000..2a1c9a98 --- /dev/null +++ b/common/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/common/recipes-bsp/rmc/rmc.bb b/common/recipes-bsp/rmc/rmc.bb new file mode 100644 index 00000000..8797644b --- /dev/null +++ b/common/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/common/recipes-bsp/systemd-boot/systemd-boot/0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch b/common/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/common/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/common/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch b/common/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/common/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/common/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-stub-check-LoadOptions-contains-data.patch b/common/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/common/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/common/recipes-bsp/systemd-boot/systemd-boot/0002-sd-boot-Load-board-specific-boot-entries-from-RMC-da.patch b/common/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/common/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/common/recipes-bsp/systemd-boot/systemd-boot/0003-sd-boot-Support-global-kernel-command-line-fragment.patch b/common/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/common/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/common/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch b/common/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/common/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/common/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc b/common/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc new file mode 100644 index 00000000..1172d53d --- /dev/null +++ b/common/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/common/recipes-bsp/systemd-boot/systemd-boot/systemd-boot.inc b/common/recipes-bsp/systemd-boot/systemd-boot/systemd-boot.inc new file mode 100644 index 00000000..fcce6ce1 --- /dev/null +++ b/common/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/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend b/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend new file mode 100644 index 00000000..557c0493 --- /dev/null +++ b/common/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/common/recipes-bsp/thermald/thermald_1.6.bb b/common/recipes-bsp/thermald/thermald_1.6.bb new file mode 100644 index 00000000..e6cbb621 --- /dev/null +++ b/common/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" diff --git a/common/recipes-core/images/core-image-minimal-initramfs.bbappend b/common/recipes-core/images/core-image-minimal-initramfs.bbappend new file mode 100644 index 00000000..4ddca375 --- /dev/null +++ b/common/recipes-core/images/core-image-minimal-initramfs.bbappend @@ -0,0 +1,6 @@ +# Use initramfs-framework instead of initramfs-live* +PACKAGE_INSTALL_remove_intel-x86-common = "initramfs-live-boot initramfs-live-install initramfs-live-install-efi" +PACKAGE_INSTALL_append_intel-x86-common = " initramfs-framework-base initramfs-module-udev initramfs-module-setup-live initramfs-module-install-efi" + +# Add i915 graphics firmware +PACKAGE_INSTALL_append_intel-x86-common = " linux-firmware-i915" diff --git a/common/recipes-core/images/core-image-tiny.bb b/common/recipes-core/images/core-image-tiny.bb new file mode 100644 index 00000000..ed39fd77 --- /dev/null +++ b/common/recipes-core/images/core-image-tiny.bb @@ -0,0 +1,37 @@ +SUMMARY = "A tiny image just capable of allowing a device to boot from RAM, \ +this image recipe generates an image file which rather boots from initrd than \ +from storage, it achieves this by using wic to pick up the artifacts generated \ +by the core-image-tiny-initramfs image" + +# The actual rootfs/initrd will be the one from core-image-tiny-initramfs, so +# we reset IMAGE_INSTALL to avoid building other things that will be pointless +IMAGE_INSTALL = "" + +# Do not pollute the initrd image with rootfs features +IMAGE_FEATURES = "" + +IMAGE_LINGUAS = " " + +LICENSE = "MIT" + +IMAGE_ROOTFS_SIZE ?= "8192" + +IMAGE_FSTYPES = "wic" +inherit core-image + +# We get some parts from image-live that we need in order to boot from initrd +INITRD_IMAGE_LIVE ?= "core-image-tiny-initramfs" + +python() { + image_b = d.getVar('IMAGE_BASENAME') + initrd_i = d.getVar('INITRD_IMAGE_LIVE') + if image_b == initrd_i: + bb.error('INITRD_IMAGE_LIVE %s cannot use the requested IMAGE_FSTYPE' % initrd_i) + bb.fatal('Check IMAGE_FSTYPES and INITRAMFS_FSTYPES settings.') + elif initrd_i: + d.appendVarFlag('do_image', 'depends', ' %s:do_image_complete' % initrd_i) +} + +WKS_FILE_intel-corei7-64 = "core-image-tiny.wks.in" +WKS_FILE_intel-core2-32 = "core-image-tiny.wks.in" +WKS_FILE_intel-quark = "mktinygalileodisk.wks" diff --git a/common/recipes-core/initrdscripts/files/intel-x86-common/init-install-efi.sh b/common/recipes-core/initrdscripts/files/intel-x86-common/init-install-efi.sh new file mode 100644 index 00000000..a7a2ad4c --- /dev/null +++ b/common/recipes-core/initrdscripts/files/intel-x86-common/init-install-efi.sh @@ -0,0 +1,342 @@ +#!/bin/sh -e +# +# Copyright (c) 2016, Intel Corporation. +# All rights reserved. +# +# install.sh [device_name] [rootfs_name] +# +# This file is a copy of file with same name in OE: +# meta/recipes-core/initrdscripts/files/. We modify +# it for RMC feature to deploy file blobs from RMC +# database file to target. + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +# We need 20 Mb for the boot partition +boot_size=20 + +# 5% for swap +swap_ratio=5 + +# Get a list of hard drives +hdnamelist="" +live_dev_name=`cat /proc/mounts | grep ${1%/} | awk '{print $1}'` +live_dev_name=${live_dev_name#\/dev/} +# Only strip the digit identifier if the device is not an mmc +case $live_dev_name in + mmcblk*) + ;; + nvme*) + ;; + *) + live_dev_name=${live_dev_name%%[0-9]*} + ;; +esac + +echo "Searching for hard drives ..." + +for device in `ls /sys/block/`; do + case $device in + loop*) + # skip loop device + ;; + sr*) + # skip CDROM device + ;; + ram*) + # skip ram device + ;; + *) + # skip the device LiveOS is on + # Add valid hard drive name to the list + case $device in + $live_dev_name*) + # skip the device we are running from + ;; + *) + hdnamelist="$hdnamelist $device" + ;; + esac + ;; + esac +done + +if [ -z "${hdnamelist}" ]; then + echo "You need another device (besides the live device /dev/${live_dev_name}) to install the image. Installation aborted." + exit 1 +fi + +TARGET_DEVICE_NAME="" +for hdname in $hdnamelist; do + # Display found hard drives and their basic info + echo "-------------------------------" + echo /dev/$hdname + if [ -r /sys/block/$hdname/device/vendor ]; then + echo -n "VENDOR=" + cat /sys/block/$hdname/device/vendor + fi + if [ -r /sys/block/$hdname/device/model ]; then + echo -n "MODEL=" + cat /sys/block/$hdname/device/model + fi + if [ -r /sys/block/$hdname/device/uevent ]; then + echo -n "UEVENT=" + cat /sys/block/$hdname/device/uevent + fi + echo +done + +# Get user choice +while true; do + echo "Please select an install target or press n to exit ($hdnamelist ): " + read answer + if [ "$answer" = "n" ]; then + echo "Installation manually aborted." + exit 1 + fi + for hdname in $hdnamelist; do + if [ "$answer" = "$hdname" ]; then + TARGET_DEVICE_NAME=$answer + break + fi + done + if [ -n "$TARGET_DEVICE_NAME" ]; then + break + fi +done + +if [ -n "$TARGET_DEVICE_NAME" ]; then + echo "Installing image on /dev/$TARGET_DEVICE_NAME ..." +else + echo "No hard drive selected. Installation aborted." + exit 1 +fi + +device=/dev/$TARGET_DEVICE_NAME + +# +# The udev automounter can cause pain here, kill it +# +rm -f /etc/udev/rules.d/automount.rules +rm -f /etc/udev/scripts/mount* + +# +# Unmount anything the automounter had mounted +# +umount ${device}* 2> /dev/null || /bin/true + +mkdir -p /tmp + +# Create /etc/mtab if not present +if [ ! -e /etc/mtab ]; then + cat /proc/mounts > /etc/mtab +fi + +disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//") + +swap_size=$((disk_size*swap_ratio/100)) +rootfs_size=$((disk_size-boot_size-swap_size)) + +rootfs_start=$((boot_size)) +rootfs_end=$((rootfs_start+rootfs_size)) +swap_start=$((rootfs_end)) + +# MMC devices are special in a couple of ways +# 1) they use a partition prefix character 'p' +# 2) they are detected asynchronously (need rootwait) +rootwait="" +part_prefix="" +if [ ! "${device#/dev/mmcblk}" = "${device}" ] || \ +[ ! "${device#/dev/nvme}" = "${device}" ]; then + part_prefix="p" + rootwait="rootwait" +fi +bootfs=${device}${part_prefix}1 +rootfs=${device}${part_prefix}2 +swap=${device}${part_prefix}3 + +echo "*****************" +echo "Boot partition size: $boot_size MB ($bootfs)" +echo "Rootfs partition size: $rootfs_size MB ($rootfs)" +echo "Swap partition size: $swap_size MB ($swap)" +echo "*****************" +echo "Deleting partition table on ${device} ..." +dd if=/dev/zero of=${device} bs=512 count=35 + +echo "Creating new partition table on ${device} ..." +parted ${device} mklabel gpt + +echo "Creating boot partition on $bootfs" +parted ${device} mkpart boot fat32 0% $boot_size +parted ${device} set 1 boot on + +echo "Creating rootfs partition on $rootfs" +parted ${device} mkpart root ext3 $rootfs_start $rootfs_end + +echo "Creating swap partition on $swap" +parted ${device} mkpart swap linux-swap $swap_start 100% + +parted ${device} print + +echo "Formatting $bootfs to vfat..." +mkfs.vfat $bootfs + +echo "Formatting $rootfs to ext3..." +mkfs.ext3 $rootfs + +echo "Formatting swap partition...($swap)" +mkswap $swap + +mkdir /tgt_root +mkdir /src_root +mkdir -p /boot + +# Handling of the target root partition +mount $rootfs /tgt_root +mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root +echo "Copying rootfs files..." +cp -a /src_root/* /tgt_root +if [ -d /tgt_root/etc/ ] ; then + boot_uuid=$(blkid -o value -s UUID ${bootfs}) + swap_part_uuid=$(blkid -o value -s PARTUUID ${swap}) + echo "/dev/disk/by-partuuid/$swap_part_uuid swap swap defaults 0 0" >> /tgt_root/etc/fstab + echo "UUID=$boot_uuid /boot vfat defaults 1 2" >> /tgt_root/etc/fstab + # We dont want udev to mount our root device while we're booting... + if [ -d /tgt_root/etc/udev/ ] ; then + echo "${device}" >> /tgt_root/etc/udev/mount.blacklist + fi +fi + +# Handling of the target boot partition +mount $bootfs /boot +echo "Preparing boot partition..." + +EFIDIR="/boot/EFI/BOOT" +mkdir -p $EFIDIR +# Copy the efi loader +cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR + +# RMC deployment +RMC_CMD=/src_root/usr/bin/rmc +RMC_DB=/run/media/$1/rmc.db + +# We don't want to quit when a step failed. For example, +# a file system could not support some operations. +set +e + +if [ -f "${RMC_DB}" ] && [ -f "${RMC_CMD}" ]; then + echo "Found RMC database and tool, start RMC deployment" + # query INSTALLER.CONFIG from RMC DB + if ${RMC_CMD} -B INSTALLER.CONFIG -d "${RMC_DB}" -o /tmp/installer.config; then + while IFS=':' read -r NAME TGT_UID TGT_GID TGT_MODE TGT_PATH; do + # skip comment + # The regexp in grep works with busybox grep which doesn't + # seem to have a -P to recognize '\t'. But this expression could not + # work with gnu grep... + if echo "$NAME"|grep -q $'^[ \t]*#'; then + continue + fi + # check if we should create a directory (last char in target path is '/') + # or deploy a file + LAST_CHAR=$(echo "${TGT_PATH:$((${#TGT_PATH}-1)):1}") + + # Do not bail out for failures but user should get stderr message + if [ ${LAST_CHAR} = "/" ]; then + # name field is skipped for directory + echo "DIR: ${TGT_UID}:${TGT_GID}:${TGT_MODE} => ${TGT_PATH}" + mkdir -p "$TGT_PATH" + chown "${TGT_UID}:${TGT_GID}" "$TGT_PATH" + chmod "${TGT_MODE}" "$TGT_PATH" + else + ${RMC_CMD} -B "${NAME}" -d "${RMC_DB}" -o "${TGT_PATH}" + echo "FILE: ${NAME}:${TGT_UID}:${TGT_GID}:${TGT_MODE} => ${TGT_PATH}" + chown "${TGT_UID}:${TGT_GID}" "$TGT_PATH" + chmod "${TGT_MODE}" "$TGT_PATH" + fi + done < /tmp/installer.config + rm -rf /tmp/installer.config + + # remove rmc from target since we don't think it is a valid + # case to run rmc after installation. + rm -rf /tgt_root/usr/bin/rmc + echo "RMC deployment finished" + else + echo "INSTALLER.CONFIG is not found, skip RMC deployment" + fi + + # Final retouching by calling post-install hook + if ${RMC_CMD} -B POSTINSTALL.sh -d "${RMC_DB}" -o /tmp/POSTINSTALL.sh; then + echo "Found POSTINSTALL.sh execute it..." + chmod 500 /tmp/POSTINSTALL.sh + /tmp/POSTINSTALL.sh + rm -rf /tmp/POSTINSTALL.sh + fi +fi +set -e + +if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then + root_part_uuid=$(blkid -o value -s PARTUUID ${rootfs}) + GRUBCFG="$EFIDIR/grub.cfg" + cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG + # Update grub config for the installed image + # Delete the install entry + sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG + # Delete the initrd lines + sed -i "/initrd /d" $GRUBCFG + # Delete any LABEL= strings + sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG + # Delete any root= strings + sed -i "s/ root=[^ ]*/ /g" $GRUBCFG + # Add the root= and other standard boot options + sed -i "s@linux /vmlinuz *@linux /vmlinuz root=PARTUUID=$root_part_uuid rw $rootwait quiet @" $GRUBCFG +fi + +if [ -d /run/media/$1/loader ]; then + rootuuid=$(blkid -o value -s PARTUUID ${rootfs}) + GUMMIBOOT_CFGS="/boot/loader/entries/*.conf" + if [ -d /boot/loader ]; then + # Don't override loader.conf RMC already deployed + if [ ! -f /boot/loader/loader.conf ]; then + cp /run/media/$1/loader/loader.conf /boot/loader/ + fi + # only copy built OE entries when RMC entries don't exist. + if [ ! -d /boot/loader/entries ] || [ ! ls /boot/loader/entries/*.conf &>/dev/null ]; then + cp -dr /run/media/$1/loader/entries /boot/loader + fi + else + # copy config files for gummiboot + cp -dr /run/media/$1/loader /boot + # delete the install entry + rm -f /boot/loader/entries/install.conf + fi + # delete the initrd lines + sed -i "/initrd /d" $GUMMIBOOT_CFGS + # delete any LABEL= strings + sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS + # delete any root= strings + sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS + # add the root= and other standard boot options + sed -i "s@options *@options root=PARTUUID=$rootuuid rw $rootwait quiet @" $GUMMIBOOT_CFGS + # if RMC feature presents, append global kernel command line fragment when it exists. + if [ -f "${RMC_DB}" ] && [ -f "${RMC_CMD}" ]; then + if ${RMC_CMD} -B KBOOTPARAM -d "${RMC_DB}" -o /tmp/kbootparam; then + sed -i "/^[ \t]*options/ s/$/ $(cat /tmp/kbootparam)/" $GUMMIBOOT_CFGS + rm /tmp/kbootparam + fi + fi +fi + +cp /run/media/$1/vmlinuz /boot + +umount /src_root +umount /tgt_root +umount /boot + +sync + +echo "Remove your installation media, and press ENTER" + +read enter + +echo "Rebooting..." +reboot -f diff --git a/common/recipes-core/initrdscripts/initramfs-live-install-efi_%.bbappend b/common/recipes-core/initrdscripts/initramfs-live-install-efi_%.bbappend new file mode 100644 index 00000000..0b3a1d3d --- /dev/null +++ b/common/recipes-core/initrdscripts/initramfs-live-install-efi_%.bbappend @@ -0,0 +1,2 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/files:" +PACKAGE_ARCH_intel-x86-common = "${INTEL_COMMON_PACKAGE_ARCH}" diff --git a/common/recipes-core/microcode/intel-microcode_20170707.bb b/common/recipes-core/microcode/intel-microcode_20170707.bb new file mode 100644 index 00000000..2244088b --- /dev/null +++ b/common/recipes-core/microcode/intel-microcode_20170707.bb @@ -0,0 +1,66 @@ +SUMMARY = "Intel Processor Microcode Datafile for Linux" +HOMEPAGE = "http://www.intel.com/" +DESCRIPTION = "The microcode data file contains the latest microcode\ + definitions for all Intel processors. Intel releases microcode updates\ + to correct processor behavior as documented in the respective processor\ + specification updates. While the regular approach to getting this microcode\ + update is via a BIOS upgrade, Intel realizes that this can be an\ + administrative hassle. The Linux operating system and VMware ESX\ + products have a mechanism to update the microcode after booting.\ + For example, this file will be used by the operating system mechanism\ + if the file is placed in the /etc/firmware directory of the Linux system." + +LICENSE = "Intel-Microcode-License" +LIC_FILES_CHKSUM = "file://microcode.dat;md5=e5b1dc41901d2de706d4bccee94bbadc" + +SRC_URI = "https://downloadmirror.intel.com/26925/eng/microcode-${PV}.tgz" +SRC_URI[md5sum] = "fe4bcb12e4600629a81fb65208c34248" +SRC_URI[sha256sum] = "4fd44769bf52a7ac11e90651a307aa6e56ca6e1a814e50d750ba8207973bee93" + +DEPENDS = "iucode-tool-native" +S = "${WORKDIR}" + +COMPATIBLE_HOST = "(i.86|x86_64).*-linux" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit deploy + +# Use any of the iucode_tool parameters to filter specific microcodes from the data file +# For further information, check the iucode-tool's manpage : http://manned.org/iucode-tool +UCODE_FILTER_PARAMETERS ?= "" + +do_compile() { + mkdir -p ${WORKDIR}/ucode/kernel/x86/microcode + ${STAGING_DIR_NATIVE}${sbindir_native}/iucode_tool \ + ${UCODE_FILTER_PARAMETERS} \ + --overwrite \ + --write-to=${WORKDIR}/microcode_${PV}.bin \ + ${WORKDIR}/microcode.dat + + ${STAGING_DIR_NATIVE}${sbindir_native}/iucode_tool \ + ${UCODE_FILTER_PARAMETERS} \ + --overwrite \ + --write-earlyfw=${WORKDIR}/microcode_${PV}.cpio \ + ${WORKDIR}/microcode.dat +} + +do_install() { + install -d ${D}${base_libdir}/firmware/intel-ucode/ + install ${WORKDIR}/microcode_${PV}.bin ${D}${base_libdir}/firmware/intel-ucode/ + cd ${D}${base_libdir}/firmware/intel-ucode/ + ln -sf microcode_${PV}.bin microcode.bin +} + +do_deploy() { + install -d ${DEPLOYDIR} + install ${S}/microcode_${PV}.cpio ${DEPLOYDIR}/ + cd ${DEPLOYDIR} + rm -f microcode.cpio + ln -sf microcode_${PV}.cpio microcode.cpio +} + +addtask deploy before do_build after do_compile + +PACKAGES = "${PN}" + +FILES_${PN} = "${base_libdir}" diff --git a/common/recipes-core/microcode/iucode-tool/0001-Makefile.am-Add-arg-parse-library-for-MUSL-support.patch b/common/recipes-core/microcode/iucode-tool/0001-Makefile.am-Add-arg-parse-library-for-MUSL-support.patch new file mode 100644 index 00000000..ca97d2ab --- /dev/null +++ b/common/recipes-core/microcode/iucode-tool/0001-Makefile.am-Add-arg-parse-library-for-MUSL-support.patch @@ -0,0 +1,29 @@ +From 5f6826b3a59dedf508d5a6122362d69a4813e8e6 Mon Sep 17 00:00:00 2001 +From: Saul Wold <sgw@linux.intel.com> +Date: Fri, 3 Feb 2017 16:08:51 -0800 +Subject: [PATCH] Makefile.am: Add arg-parse library for MUSL support + +iucode-tool needs argp-standalone when used with MUSL, so add this +patch to the Makefile to link with argp + +Upstream-Status: Pending +Signed-off-by: Saul Wold <sgw@linux.intel.com> +--- + Makefile.am | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Makefile.am b/Makefile.am +index 415a241..764fb61 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -5,6 +5,7 @@ + sbin_PROGRAMS = iucode_tool + man_MANS = iucode_tool.8 + ++iucode_tool_LDADD = -largp + iucode_tool_SOURCES = intel_microcode.h intel_microcode.c iucode_tool.c + EXTRA_DIST = autogen.sh CONTRIBUTING + +-- +2.7.4 + diff --git a/common/recipes-core/microcode/iucode-tool_2.1.2.bb b/common/recipes-core/microcode/iucode-tool_2.1.2.bb new file mode 100644 index 00000000..e1fb56f4 --- /dev/null +++ b/common/recipes-core/microcode/iucode-tool_2.1.2.bb @@ -0,0 +1,33 @@ +SUMMARY = "Update Intel CPU microcode" + +DESCRIPTION = "iucode_tool is a program to manipulate Intel i686 and X86-64\ + processor microcode update collections, and to use the kernel facilities to\ + update the microcode on Intel system processors. It can load microcode data\ + files in text and binary format, sort, list and filter the microcode updates\ + contained in these files, write selected microcode updates to a new file in\ + binary format, or upload them to the kernel. \ + It operates on microcode data downloaded directly from Intel:\ + http://feeds.downloadcenter.intel.com/rss/?p=2371\ +" +HOMEPAGE = "https://gitlab.com/iucode-tool/" +BUGTRACKER = "https://bugs.debian.org/cgi-bin/pkgreport.cgi?ordering=normal;archive=0;src=iucode-tool;repeatmerged=0" + +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \ + file://iucode_tool.c;beginline=1;endline=15;md5=5d8e3639c3b6a80e7d5e0e073933da16" + +DEPENDS_append_libc-musl = " argp-standalone" + +SRC_URI = "https://gitlab.com/iucode-tool/releases/raw/master/iucode-tool_${PV}.tar.xz" +SRC_URI_append_libc-musl = " file://0001-Makefile.am-Add-arg-parse-library-for-MUSL-support.patch" + +SRC_URI[md5sum] = "c6f131a0b69443f5498782a2335973fa" +SRC_URI[sha256sum] = "01f1c02ba6935e0ac8440fb594c2ef57ce4437fcbce539e3ef329f55a6fd71ab" + +inherit autotools + +BBCLASSEXTEND = "native" + +COMPATIBLE_HOST = "(i.86|x86_64).*-linux" + +UPSTREAM_CHECK_URI = "https://gitlab.com/iucode-tool/releases" diff --git a/common/recipes-core/ovmf/files/0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch b/common/recipes-core/ovmf/files/0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch new file mode 100644 index 00000000..62db0633 --- /dev/null +++ b/common/recipes-core/ovmf/files/0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch @@ -0,0 +1,105 @@ +From 48e511481d83c1614cd00a5a2edcf6b5d746b9c4 Mon Sep 17 00:00:00 2001 +From: Mikko Ylinen <mikko.ylinen@linux.intel.com> +Date: Fri, 7 Apr 2017 12:06:14 +0300 +Subject: [PATCH] ovmf: RefkitTestCA: TEST UEFI SecureBoot + +This patch adds refkit-db.cer (via xxd -i) in OVMF's db +signature database when used with EnrollDefaultKeys EFI +application. It's used for testing purposes only. + +Images signed with refkit-db keys are allowed to boot. + +Signed-off-by: Mikko Ylinen <mikko.ylinen@linux.intel.com> +--- + OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c | 68 +++++++++++++++++++++++++++ + 1 file changed, 68 insertions(+) + +diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c +index 24ab977..a3c12ba 100644 +--- a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c ++++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c +@@ -516,6 +516,73 @@ STATIC CONST UINT8 MicrosoftUefiCA[] = { + 0x07, 0x92, 0x9b, 0xf5, 0xa6, 0xbc, 0x59, 0x83, 0x58 + }; + ++STATIC CONST UINT8 RefkitTestCA[] = { ++ 0x30, 0x82, 0x02, 0xfb, 0x30, 0x82, 0x01, 0xe3, 0xa0, 0x03, 0x02, 0x01, ++ 0x02, 0x02, 0x09, 0x00, 0xd4, 0xf6, 0x48, 0xc2, 0x68, 0x19, 0x91, 0xac, ++ 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, ++ 0x0b, 0x05, 0x00, 0x30, 0x14, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, ++ 0x04, 0x03, 0x0c, 0x09, 0x72, 0x65, 0x66, 0x6b, 0x69, 0x74, 0x2d, 0x64, ++ 0x62, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x37, 0x30, 0x34, 0x32, 0x30, 0x31, ++ 0x32, 0x30, 0x36, 0x33, 0x32, 0x5a, 0x17, 0x0d, 0x31, 0x38, 0x30, 0x34, ++ 0x32, 0x30, 0x31, 0x32, 0x30, 0x36, 0x33, 0x32, 0x5a, 0x30, 0x14, 0x31, ++ 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x09, 0x72, 0x65, ++ 0x66, 0x6b, 0x69, 0x74, 0x2d, 0x64, 0x62, 0x30, 0x82, 0x01, 0x22, 0x30, ++ 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, ++ 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, ++ 0x82, 0x01, 0x01, 0x00, 0xb4, 0x1c, 0x22, 0xa6, 0x22, 0x01, 0x57, 0xcd, ++ 0xf1, 0x4f, 0xaf, 0x72, 0xe3, 0xd9, 0x01, 0x80, 0x50, 0x55, 0xef, 0x02, ++ 0x5e, 0xeb, 0x99, 0x35, 0xcb, 0x7f, 0x2a, 0x79, 0xff, 0xb5, 0x3e, 0xec, ++ 0x5d, 0x92, 0x06, 0x30, 0x20, 0xe7, 0x95, 0xad, 0xa4, 0x84, 0x2e, 0x3f, ++ 0xfa, 0xd7, 0x46, 0xdd, 0x49, 0xa8, 0xe8, 0xe3, 0x79, 0x49, 0xf6, 0x8f, ++ 0x0b, 0x1d, 0xfe, 0x63, 0xa8, 0xd1, 0x63, 0xa3, 0xd6, 0x0d, 0x4e, 0x6c, ++ 0x66, 0x5c, 0xd6, 0x66, 0x26, 0xd1, 0x26, 0x98, 0xd4, 0x4f, 0x76, 0xc9, ++ 0x65, 0x48, 0x58, 0x13, 0x08, 0x31, 0xbc, 0xe5, 0x47, 0x25, 0x65, 0x95, ++ 0x39, 0x89, 0x5f, 0x02, 0xf1, 0xc5, 0x06, 0x17, 0x58, 0xca, 0x09, 0xfd, ++ 0xf6, 0x1e, 0xc5, 0x97, 0xda, 0xa3, 0x4e, 0x1a, 0x48, 0xbe, 0xcf, 0x96, ++ 0x27, 0x04, 0x4b, 0xb7, 0x6d, 0x67, 0xb6, 0x50, 0x18, 0x04, 0x73, 0x51, ++ 0xd2, 0x6a, 0x2d, 0xdf, 0x3b, 0xab, 0xf2, 0x2d, 0x95, 0xd7, 0xa8, 0xb8, ++ 0xa8, 0x30, 0xa1, 0xab, 0x8b, 0x92, 0x2b, 0x60, 0x3e, 0x3a, 0xe5, 0x86, ++ 0x40, 0x71, 0xc1, 0x3f, 0x2d, 0x2e, 0x90, 0xe7, 0xd6, 0xec, 0xcc, 0xc2, ++ 0x0b, 0x79, 0x83, 0x71, 0x6d, 0xf6, 0xa3, 0xa9, 0x4c, 0xcd, 0x46, 0x81, ++ 0xdc, 0xef, 0xec, 0x51, 0xbe, 0x81, 0x2a, 0xf1, 0x78, 0x73, 0x41, 0xdb, ++ 0x54, 0xce, 0x7c, 0xce, 0xa2, 0xe3, 0x90, 0x4f, 0x45, 0x1a, 0xf9, 0x3d, ++ 0x88, 0xfc, 0x0e, 0xed, 0xd3, 0x69, 0x22, 0x4c, 0xfa, 0x0a, 0x69, 0xd1, ++ 0x48, 0xc0, 0xaa, 0xa9, 0x3a, 0xb3, 0x8f, 0x10, 0x3a, 0x76, 0xa8, 0x0c, ++ 0x7a, 0x3d, 0xd8, 0x79, 0xce, 0x1c, 0x96, 0x62, 0xf4, 0x06, 0xee, 0x47, ++ 0xe8, 0xe0, 0x69, 0x91, 0xae, 0xea, 0x34, 0xcf, 0xda, 0xa8, 0xb4, 0x39, ++ 0x5e, 0xf3, 0x7a, 0xd0, 0x88, 0x48, 0x47, 0x69, 0x02, 0x03, 0x01, 0x00, ++ 0x01, 0xa3, 0x50, 0x30, 0x4e, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, ++ 0x04, 0x16, 0x04, 0x14, 0x68, 0x60, 0x11, 0x25, 0x85, 0x14, 0x78, 0x1b, ++ 0x1a, 0x9f, 0x46, 0x12, 0xe6, 0x21, 0xe4, 0xef, 0xfb, 0x3b, 0xaa, 0xdd, ++ 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, ++ 0x14, 0x68, 0x60, 0x11, 0x25, 0x85, 0x14, 0x78, 0x1b, 0x1a, 0x9f, 0x46, ++ 0x12, 0xe6, 0x21, 0xe4, 0xef, 0xfb, 0x3b, 0xaa, 0xdd, 0x30, 0x0c, 0x06, ++ 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, ++ 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, ++ 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x8f, 0xd2, 0x84, 0x7c, 0x43, ++ 0x47, 0xca, 0x6b, 0xfd, 0x87, 0x83, 0xd0, 0xef, 0x75, 0xd3, 0x20, 0x52, ++ 0x73, 0x18, 0xaa, 0x32, 0x71, 0xfb, 0xa5, 0xf4, 0xc9, 0x11, 0xa3, 0x68, ++ 0x4d, 0xb7, 0x9d, 0xe6, 0xd9, 0x46, 0x24, 0xdc, 0xc7, 0xc2, 0x3b, 0xf9, ++ 0xb0, 0x98, 0xfc, 0xee, 0x34, 0x6e, 0x10, 0x9b, 0x3d, 0x44, 0x6e, 0x33, ++ 0x09, 0x11, 0xb8, 0x29, 0xd6, 0x2d, 0x06, 0xcf, 0x67, 0x8f, 0x96, 0x85, ++ 0x9d, 0x63, 0x72, 0xbf, 0x64, 0x5f, 0x0d, 0xe3, 0xc9, 0x63, 0x19, 0x71, ++ 0xd4, 0x7d, 0x4c, 0x9c, 0x77, 0x46, 0xda, 0x20, 0x97, 0x6d, 0xbc, 0xdd, ++ 0xc2, 0x1f, 0xf3, 0x40, 0x38, 0x1e, 0xe7, 0xcc, 0x55, 0x05, 0x72, 0xba, ++ 0x24, 0x4f, 0xb3, 0x8a, 0x93, 0x0c, 0x30, 0x60, 0xda, 0x9f, 0x6f, 0x35, ++ 0xf6, 0xfb, 0xb0, 0x1f, 0xb3, 0x00, 0xdd, 0xc4, 0xa6, 0xbc, 0xe2, 0x37, ++ 0xc1, 0xa3, 0xef, 0xd9, 0xa1, 0x86, 0xf9, 0xeb, 0xa4, 0xa5, 0x45, 0x38, ++ 0xff, 0x4e, 0x87, 0x4a, 0x41, 0xcf, 0x6e, 0x69, 0x7e, 0x97, 0xbe, 0x2d, ++ 0x22, 0xbc, 0x8d, 0xa0, 0x1a, 0x21, 0x8f, 0x4b, 0x72, 0x90, 0x01, 0x5c, ++ 0xba, 0xa5, 0x9c, 0x2d, 0xd7, 0x25, 0x24, 0xfc, 0xff, 0x5c, 0x58, 0x14, ++ 0x46, 0x30, 0x09, 0x7c, 0x55, 0x64, 0x83, 0x0b, 0xb9, 0xdf, 0xcf, 0x25, ++ 0xee, 0xec, 0xf7, 0xcb, 0xdb, 0xd1, 0x5b, 0x93, 0x93, 0xc8, 0x8a, 0x10, ++ 0x46, 0xb8, 0xb0, 0x35, 0x1c, 0x6c, 0x0d, 0x8f, 0x03, 0x6a, 0x8f, 0x1b, ++ 0x36, 0x68, 0xf3, 0x53, 0x89, 0x36, 0x5b, 0x21, 0x80, 0xde, 0xe3, 0x92, ++ 0x52, 0x94, 0x97, 0x9d, 0x49, 0x89, 0x7d, 0x3e, 0xde, 0x29, 0x51, 0xba, ++ 0x11, 0xf7, 0xba, 0x01, 0xf7, 0xab, 0xea, 0xc1, 0xa7, 0x2e, 0xa3, 0x4d, ++ 0x65, 0xfd, 0x40, 0x71, 0xf1, 0xe2, 0x3f, 0x6c, 0x28, 0xcb, 0xd3 ++}; ++ + // + // The most important thing about the variable payload is that it is a list of + // lists, where the element size of any given *inner* list is constant. +@@ -908,6 +975,7 @@ ShellAppMain ( + &gEfiImageSecurityDatabaseGuid, + MicrosoftPCA, sizeof MicrosoftPCA, &gEfiCallerIdGuid, + MicrosoftUefiCA, sizeof MicrosoftUefiCA, &gEfiCallerIdGuid, ++ RefkitTestCA, sizeof RefkitTestCA, &gEfiCallerIdGuid, + NULL); + if (EFI_ERROR (Status)) { + return 1; +-- +2.1.4 + diff --git a/common/recipes-core/ovmf/ovmf-shell-image-enrollkeys.bb b/common/recipes-core/ovmf/ovmf-shell-image-enrollkeys.bb new file mode 100644 index 00000000..b20f6e58 --- /dev/null +++ b/common/recipes-core/ovmf/ovmf-shell-image-enrollkeys.bb @@ -0,0 +1,13 @@ +require recipes-core/ovmf/ovmf-shell-image.bb + +WKS_SEARCH_PATH_append = ":${COREBASE}/meta/recipes-core/ovmf" + +QB_DRIVE_TYPE = "/dev/vd" + +do_image_append() { + cat > ${IMAGE_ROOTFS}/startup.nsh << EOF +EnrollDefaultKeys +reset +EOF + +} diff --git a/common/recipes-core/ovmf/ovmf_%.bbappend b/common/recipes-core/ovmf/ovmf_%.bbappend new file mode 100644 index 00000000..bbf5fa32 --- /dev/null +++ b/common/recipes-core/ovmf/ovmf_%.bbappend @@ -0,0 +1,6 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/files:" + +SRC_URI_append_intel-x86-common = " \ + file://0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch \ +" +PACKAGECONFIG_append_intel-x86-common = " secureboot" diff --git a/common/recipes-graphics/intel-gpu-tools/intel-gpu-tools_1.19.bb b/common/recipes-graphics/intel-gpu-tools/intel-gpu-tools_1.19.bb new file mode 100644 index 00000000..de9ed609 --- /dev/null +++ b/common/recipes-graphics/intel-gpu-tools/intel-gpu-tools_1.19.bb @@ -0,0 +1,40 @@ +require ${COREBASE}/meta/recipes-graphics/xorg-app/xorg-app-common.inc + +SUMMARY = "Intel GPU tools" +DESCRIPTION = "Variety of small tools for testing intel graphics." + +LIC_FILES_CHKSUM = "file://COPYING;md5=e4b3dd344780e0400593b21b115a6947" + +LICENSE_append = " & ISC" + +inherit autotools gtk-doc + +DEPENDS += "libdrm libpciaccess cairo udev glib-2.0 libxv libx11 libxext libxrandr procps" +RDEPENDS_${PN} += "bash" +RDEPENDS_${PN}-tests += "bash" + +PACKAGE_BEFORE_PN = "${PN}-benchmarks ${PN}-tests" + +SRC_URI[md5sum] = "4fdfa56acca3b046fc61fb12686656f3" +SRC_URI[sha256sum] = "a49c8ae7c0431c1f33cd9492f83ec4e06e98a48429178e4bd22d9a1a87e3b0f1" + +PACKAGECONFIG ??= "" +PACKAGECONFIG[libunwind] = "--with-libunwind,--without-libunwind,libunwind,libunwind" + +EXTRA_OECONF = "--disable-nouveau --disable-shader-debugger" +COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux" +COMPATIBLE_HOST_libc-musl_class-target = "null" + +gputools_sysroot_preprocess() { + rm -f ${SYSROOT_DESTDIR}${libdir}/pkgconfig/intel-gen4asm.pc +} +SYSROOT_PREPROCESS_FUNCS += "gputools_sysroot_preprocess" + +FILES_${PN} += "${libdir}/intel_aubdump.so" +FILES_${PN}-benchmarks += "${libexecdir}/intel-gpu-tools/benchmarks" +FILES_${PN}-tests += "\ + ${libexecdir}/intel-gpu-tools/*\ + ${datadir}/intel-gpu-tools/1080p-right.png\ + ${datadir}/intel-gpu-tools/1080p-left.png\ + ${datadir}/intel-gpu-tools/pass.png\ + ${datadir}/intel-gpu-tools/test-list.txt" diff --git a/common/recipes-graphics/xorg-driver/xf86-video-ast_1.1.5.bb b/common/recipes-graphics/xorg-driver/xf86-video-ast_1.1.5.bb new file mode 100644 index 00000000..090efd62 --- /dev/null +++ b/common/recipes-graphics/xorg-driver/xf86-video-ast_1.1.5.bb @@ -0,0 +1,12 @@ +require recipes-graphics/xorg-driver/xorg-driver-video.inc + +SUMMARY = "X.Org X server -- ASpeed Technologies graphics driver" + +DESCRIPTION = "ast is an Xorg driver for ASpeed Technologies video cards" + +LIC_FILES_CHKSUM = "file://COPYING;md5=0b8c242f0218eea5caa949b7910a774b" + +DEPENDS += "libpciaccess" + +SRC_URI[md5sum] = "4f85febe48d51e53624550a96fc9e9ee" +SRC_URI[sha256sum] = "1edbbc55d47d3fd71dec99b15c2483e22738c642623a0fb86ef4a81a9067a2de" diff --git a/common/recipes-graphics/xorg-driver/xf86-video-mga/checkfile.patch b/common/recipes-graphics/xorg-driver/xf86-video-mga/checkfile.patch new file mode 100644 index 00000000..ceae6dfb --- /dev/null +++ b/common/recipes-graphics/xorg-driver/xf86-video-mga/checkfile.patch @@ -0,0 +1,68 @@ +Upstream-Status: Submitted [https://bugs.freedesktop.org/show_bug.cgi?id=57606] +Signed-off-by: Ross Burton <ross.burton@intel.com> + +From c9014a8f3c9b691b5aa7b1f3ec66cf7c84b8211b Mon Sep 17 00:00:00 2001 +From: Ross Burton <ross.burton@intel.com> +Date: Thu, 29 Nov 2012 11:00:43 +0000 +Subject: [PATCH] build: dont use AC_CHECK_FILE when enabling DRI + +Automatically enabling or disabling a feature based on installed files isn't +deterministic, and AC_CHECK_FILE returns an error when cross-compiling. + +Fix this by enabling DRI by default, and removing the explicit file checks as +pkg-config is good enough. + +(#57606) + +Signed-off-by: Ross Burton <ross.burton@intel.com> +--- + configure.ac | 25 ++----------------------- + 1 file changed, 2 insertions(+), 23 deletions(-) + +diff --git a/configure.ac b/configure.ac +index fca1a9c..d2aa2ed 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -55,9 +55,9 @@ AC_ARG_WITH(xorg-module-dir, + [moduledir="$libdir/xorg/modules"]) + + AC_ARG_ENABLE(dri, AS_HELP_STRING([--disable-dri], +- [Disable DRI support [[default=auto]]]), ++ [Disable DRI support [[default=enabled]]]), + [DRI="$enableval"], +- [DRI=auto]) ++ [DRI=yes]) + AC_ARG_ENABLE(exa, + AS_HELP_STRING([--disable-exa], + [Disable EXA support [[default=enabled]]]), +@@ -76,27 +76,6 @@ sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server` + + # Checks for libraries. + +-if test "x$DRI" != xno; then +- AC_CHECK_FILE([${sdkdir}/dri.h], +- [have_dri_h="yes"], [have_dri_h="no"]) +- AC_CHECK_FILE([${sdkdir}/sarea.h], +- [have_sarea_h="yes"], [have_sarea_h="no"]) +- AC_CHECK_FILE([${sdkdir}/dristruct.h], +- [have_dristruct_h="yes"], [have_dristruct_h="no"]) +-fi +- +-AC_MSG_CHECKING([whether to include DRI support]) +-if test "x$DRI" = xauto; then +- if test "x$have_dri_h" = xyes && \ +- test "x$have_sarea_h" = xyes && \ +- test "x$have_dristruct_h" = xyes; then +- DRI="yes" +- else +- DRI="no" +- fi +-fi +-AC_MSG_RESULT([$DRI]) +- + AM_CONDITIONAL(DRI, test "x$DRI" = xyes) + if test "x$DRI" = xyes; then + PKG_CHECK_MODULES(DRI, [libdrm >= 2.0 xf86driproto]) +-- +1.7.10.4 + diff --git a/common/recipes-graphics/xorg-driver/xf86-video-mga_1.6.5.bb b/common/recipes-graphics/xorg-driver/xf86-video-mga_1.6.5.bb new file mode 100644 index 00000000..d30936b6 --- /dev/null +++ b/common/recipes-graphics/xorg-driver/xf86-video-mga_1.6.5.bb @@ -0,0 +1,23 @@ +require recipes-graphics/xorg-driver/xorg-driver-video.inc + +SUMMARY = "X.Org X server -- Matrox MGA display driver" + +DESCRIPTION = "mga is an Xorg driver for Matrox video cards" + +LIC_FILES_CHKSUM = "file://COPYING;md5=bc1395d2cd32dfc5d6c57d2d8f83d3fc" + +SRC_URI += "file://checkfile.patch" + +DEPENDS += "virtual/libx11 libpciaccess" + +PR = "r1" + +COMPATIBLE_HOST = '(i.86.*-linux|x86_64.*-linux)' + +SRC_URI[md5sum] = "3ee2549247e01de3e7bce52c27483118" +SRC_URI[sha256sum] = "b663cd8e6364f7c4e2637b9fcab9861d0e3971518c73b00d213f6545a1289422" + +PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'dri', '', d)}" +PACKAGECONFIG[dri] = "--enable-dri,--disable-dri,drm xf86driproto,xserver-xorg-extension-dri" + +RDEPENDS_${PN} = "xserver-xorg-module-exa" diff --git a/common/recipes-kernel/cryptodev/cryptodev-module/0001-zc-Force-4.10-get_user_pages_remote-API.patch b/common/recipes-kernel/cryptodev/cryptodev-module/0001-zc-Force-4.10-get_user_pages_remote-API.patch new file mode 100644 index 00000000..353126fe --- /dev/null +++ b/common/recipes-kernel/cryptodev/cryptodev-module/0001-zc-Force-4.10-get_user_pages_remote-API.patch @@ -0,0 +1,26 @@ +From 3fcc81ad127c267018aed96a359bbf01db1bd8ee Mon Sep 17 00:00:00 2001 +From: Saul Wold <sgw@linux.intel.com> +Date: Sat, 1 Apr 2017 11:43:31 -0700 +Subject: [PATCH] zc: Force 4.10 get_user_pages_remote API + +This change forces the newer API, as the linux-intel 4.9-LTS kernel +backported the 4.10 API change in the page handling code. + +Signed-off-by: Saul Wold <sgw@linux.intel.com> +--- + zc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/zc.c b/zc.c +index ae464ff..b2759ce 100644 +--- a/zc.c ++++ b/zc.c +@@ -65,7 +65,7 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write, + #elif (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)) + ret = get_user_pages_remote(task, mm, + (unsigned long)addr, pgcount, write, 0, pg, NULL); +-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)) ++#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) & 0) + ret = get_user_pages_remote(task, mm, + (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, + pg, NULL); diff --git a/common/recipes-kernel/cryptodev/cryptodev-module_%.bbappend b/common/recipes-kernel/cryptodev/cryptodev-module_%.bbappend new file mode 100644 index 00000000..c59ddb2f --- /dev/null +++ b/common/recipes-kernel/cryptodev/cryptodev-module_%.bbappend @@ -0,0 +1,9 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:" + +python() { + # When we add more kernels for linux-intel, we may have to add a Version check + if (d.getVar("PREFERRED_PROVIDER_virtual/kernel") == "linux-intel"): + src_uri = d.getVar("SRC_URI") + d.setVar("SRC_URI", src_uri + + " file://0001-zc-Force-4.10-get_user_pages_remote-API.patch") +} diff --git a/common/recipes-kernel/intel-ethernet/ixgbe.bb b/common/recipes-kernel/intel-ethernet/ixgbe.bb new file mode 100644 index 00000000..5b6f0311 --- /dev/null +++ b/common/recipes-kernel/intel-ethernet/ixgbe.bb @@ -0,0 +1,43 @@ +SUMMARY="ixgbe kernel driver for Intel Magnolia Park 10GbE" +DESCRIPTION="Intel 10-Gbps Ethernet driver for Magnolia Park" +AUTHOR = "Ong Boon Leong" +HOMEPAGE = "http://www.intel.com/network/connectivity/products/server_adapters.htm" +SECTION = "kernel/network" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://${WORKDIR}/${PN}-${PV}/COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +PV = "5.1.3" +PR = "r0" + +SRC_URI = "https://sourceforge.net/projects/e1000/files/ixgbe%20stable/${PV}/ixgbe-${PV}.tar.gz" +SRC_URI += "file://0001-ixgbe-src-Makefile-change-make-install-to-make.patch" + +SRC_URI[md5sum] = "ae35ed547aa6a5087672c3f70ce1e676" +SRC_URI[sha256sum] = "9f537d79bddf0a087a17af632d57812d26d26bcfebbd4bdcf10df656ff055bb4" + +S = "${WORKDIR}/${PN}-${PV}/src" +SCRIPT_DIR = "${WORKDIR}/${PN}-${PV}/scripts" + +EXTRA_OEMAKE='KSRC="${STAGING_KERNEL_BUILDDIR}" KVER="${KERNEL_VERSION}" \ + BUILD_ARCH="${TARGET_ARCH}" PREFIX="${D}" \ + SYSTEM_MAP_FILE="${STAGING_KERNEL_BUILDDIR}/System.map-${KERNEL_VERSION}" INSTALL_MOD_PATH="${D}"' + +KERNEL_MODULE_AUTOLOAD_append_intel-core2-32 = " ixgbe" +KERNEL_MODULE_AUTOLOAD_append_intel-corei7-64 = " ixgbe" + +inherit module + +do_install_append () { + # Install scripts/set_irq_affinity + install -d ${D}/etc/network + install -m 0755 ${SCRIPT_DIR}/set_irq_affinity ${D}/etc/network +} + +#SSTATE_DUPWHITELIST += "${STAGING_DIR_HOST}/lib/modules/${KERNEL_VERSION}/" + +PACKAGES += "${PN}-script" + +FILES_${PN}-script += "/etc/network/set_irq_affinity" + +#Ignore "ERROR: QA Issue: ixgbe: Files/directories were installed but not shipped" +INSANE_SKIP_${PN} = "installed-vs-shipped" diff --git a/common/recipes-kernel/intel-ethernet/ixgbe/0001-ixgbe-src-Makefile-change-make-install-to-make.patch b/common/recipes-kernel/intel-ethernet/ixgbe/0001-ixgbe-src-Makefile-change-make-install-to-make.patch new file mode 100644 index 00000000..88f5335a --- /dev/null +++ b/common/recipes-kernel/intel-ethernet/ixgbe/0001-ixgbe-src-Makefile-change-make-install-to-make.patch @@ -0,0 +1,40 @@ +From 09c7a5afa76530a3720d97726f2b372f72b0af08 Mon Sep 17 00:00:00 2001 +From: "Goh, Wen Sen" <wen.sen.goh@intel.com> +Date: Wed, 22 Jun 2016 11:18:37 +0800 +Subject: [PATCH] ixgbe: src/Makefile: change make install to make + modules_install + +Per guideline from Linux Documentation at +Documentation/kbuild/modules.txt +the correct target is "modules_install" not "install". + +Upstream-Status: Inappropriate [It is tarball released by Intel Network +driver group] + +--- + src/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 852becb..480ecee 100644 +--- a/Makefile ++++ b/Makefile +@@ -136,7 +136,7 @@ clean: + @-rm -rf *.${MANSECTION}.gz *.ko + + # Install the modules and manpage +-install: default manfile ++modules_install: default manfile + @echo "Copying manpages..." + @install -D -m 644 ${DRIVER}.${MANSECTION}.gz ${INSTALL_MOD_PATH}${MANDIR}/man${MANSECTION}/${DRIVER}.${MANSECTION}.gz + @echo "Installing modules..." +@@ -191,6 +191,6 @@ help: + @echo ' Other variables may be available for tuning make process, see' + @echo ' Kernel Kbuild documentation for more information' + +-.PHONY: default noisy clean manfile silent sparse ccc install uninstall help ++.PHONY: default noisy clean manfile silent sparse ccc modules_install uninstall help + + endif # ifneq($(KERNELRELEASE),) +-- +2.8.3 diff --git a/common/recipes-kernel/intel-ethernet/ixgbevf.bb b/common/recipes-kernel/intel-ethernet/ixgbevf.bb new file mode 100644 index 00000000..bee601ba --- /dev/null +++ b/common/recipes-kernel/intel-ethernet/ixgbevf.bb @@ -0,0 +1,44 @@ +SUMMARY="ixgbevf kernel driver for Intel Magnolia Park 10GbE" +DESCRIPTION="Intel 10-Gbps Ethernet driver for Magnolia Park" +AUTHOR = "Ong Boon Leong" +HOMEPAGE = "http://www.intel.com/network/connectivity/products/server_adapters.htm" +SECTION = "kernel/network" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://${WORKDIR}/${PN}-${PV}/COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +PV = "4.1.2" +PR = "r0" + +SRC_URI = "https://sourceforge.net/projects/e1000/files/ixgbevf%20stable/${PV}/ixgbevf-${PV}.tar.gz" +SRC_URI += "file://0001-ixgbevf-src-Makefile-change-make-install-to-make.patch" +SRC_URI += "file://0002-ixgbevf_common.patch" + +SRC_URI[md5sum] = "f02ec46369d1ca949a1e9d2e0eb74d5f" +SRC_URI[sha256sum] = "ab2824541f8a2d8f7b7d26ccbb46359ef551c5d4625fb333014e2b8023ac3ab6" + +S = "${WORKDIR}/${PN}-${PV}/src" +SCRIPT_DIR = "${WORKDIR}/${PN}-${PV}/scripts" + +EXTRA_OEMAKE='KSRC="${STAGING_KERNEL_BUILDDIR}" KVER="${KERNEL_VERSION}" \ + BUILD_ARCH="${TARGET_ARCH}" PREFIX="${D}" \ + SYSTEM_MAP_FILE="${STAGING_KERNEL_BUILDDIR}/System.map-${KERNEL_VERSION}" INSTALL_MOD_PATH="${D}"' + +KERNEL_MODULE_AUTOLOAD_append_intel-core2-32 = " ixgbevf" +KERNEL_MODULE_AUTOLOAD_append_intel-corei7-64 = " ixgbevf" + +inherit module + +do_install_append () { + # Install scripts/set_irq_affinity + install -d ${D}/etc/network + install -m 0755 ${SCRIPT_DIR}/set_irq_affinity ${D}/etc/network +} + +#SSTATE_DUPWHITELIST += "${STAGING_DIR_HOST}/lib/modules/${KERNEL_VERSION}/" + +PACKAGES += "${PN}-script" + +FILES_${PN}-script += "/etc/network/set_irq_affinity" + +#Ignore "ERROR: QA Issue: ixgbe: Files/directories were installed but not shipped" +INSANE_SKIP_${PN} = "installed-vs-shipped" diff --git a/common/recipes-kernel/intel-ethernet/ixgbevf/0001-ixgbevf-src-Makefile-change-make-install-to-make.patch b/common/recipes-kernel/intel-ethernet/ixgbevf/0001-ixgbevf-src-Makefile-change-make-install-to-make.patch new file mode 100644 index 00000000..8234f589 --- /dev/null +++ b/common/recipes-kernel/intel-ethernet/ixgbevf/0001-ixgbevf-src-Makefile-change-make-install-to-make.patch @@ -0,0 +1,32 @@ +From 511ee0d8d40a3e76b3e9875a96228ff370dbdfc6 Mon Sep 17 00:00:00 2001 +From: "Goh, Wen Sen" <wen.sen.goh@intel.com> +Date: Wed, 22 Jun 2016 11:25:41 +0800 +Subject: [PATCH] ixgbevf_patch + +--- + Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 8df134a..8d5660e 100644 +--- a/Makefile ++++ b/Makefile +@@ -100,7 +100,7 @@ clean: + @-rm -rf *.${MANSECTION}.gz *.ko + + # Install the modules and manpage +-install: default manfile ++modules_install: default manfile + @echo "Copying manpages..." + @install -D -m 644 ${DRIVER}.${MANSECTION}.gz ${INSTALL_MOD_PATH}${MANDIR}/man${MANSECTION}/${DRIVER}.${MANSECTION}.gz + @echo "Installing modules..." +@@ -145,6 +145,6 @@ help: + @echo ' Other variables may be available for tuning make process, see' + @echo ' Kernel Kbuild documentation for more information' + +-.PHONY: default noisy clean manfile silent sparse ccc install uninstall help ++.PHONY: default noisy clean manfile silent sparse ccc modules_install uninstall help + + endif # ifneq($(KERNELRELEASE),) +-- +2.8.3 diff --git a/common/recipes-kernel/intel-ethernet/ixgbevf/0002-ixgbevf_common.patch b/common/recipes-kernel/intel-ethernet/ixgbevf/0002-ixgbevf_common.patch new file mode 100644 index 00000000..d442e24d --- /dev/null +++ b/common/recipes-kernel/intel-ethernet/ixgbevf/0002-ixgbevf_common.patch @@ -0,0 +1,23 @@ +From f74fbcd821a394dec58263fd2c2ea62eae298b2f Mon Sep 17 00:00:00 2001 +From: "Goh, Wen Sen" <wen.sen.goh@intel.com> +Date: Sun, 26 Jun 2016 12:01:36 +0800 +Subject: [PATCH] ixgbevf patch + +--- + common.mk | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/common.mk b/common.mk +index b9b01c7..228a926 100644 +--- a/common.mk ++++ b/common.mk +@@ -289,6 +289,7 @@ export INSTALL_MOD_DIR ?= updates/drivers/net/ethernet/intel/${DRIVER} + kernelbuild = ${MAKE} $(if ${GCC_I_SYS},CC="${GCC_I_SYS}") \ + ${CCFLAGS_VAR}="${EXTRA_CFLAGS}" \ + -C "${KSRC}" \ ++ CONFIG_IXGBE=m \ + CONFIG_${DRIVER_UPPERCASE}=m \ + M="${CURDIR}" \ + ${2} ${1}; +-- +2.8.3 diff --git a/common/recipes-kernel/iwlwifi/backport-iwlwifi/0001-Makefile.real-skip-host-install-scripts.patch b/common/recipes-kernel/iwlwifi/backport-iwlwifi/0001-Makefile.real-skip-host-install-scripts.patch new file mode 100644 index 00000000..1d4137ba --- /dev/null +++ b/common/recipes-kernel/iwlwifi/backport-iwlwifi/0001-Makefile.real-skip-host-install-scripts.patch @@ -0,0 +1,36 @@ +From f69ff2fd27903ee052309179271f708d720a2f94 Mon Sep 17 00:00:00 2001 +From: Mikko Ylinen <mikko.ylinen@linux.intel.com> +Date: Thu, 10 Aug 2017 21:12:51 +0300 +Subject: [PATCH] Makefile.real: skip host install scripts + +The scripts run in install target are relevant (and working) +only if the driver installation is run on the build host. + +Skip the scripts when cross-compiling. + +Upstream-Status: Inappropriate [Cross-Compile] + +Signed-off-by: Mikko Ylinen <mikko.ylinen@linux.intel.com> +--- + Makefile.real | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/Makefile.real b/Makefile.real +index ba09f99..f5075de 100644 +--- a/Makefile.real ++++ b/Makefile.real +@@ -104,11 +104,6 @@ install: modules + @$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_DIR) \ + INSTALL_MOD_DIR=$(KMODDIR) $(KMODPATH_ARG) \ + modules_install +- @./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR) +- @./scripts/compress_modules.sh $(KLIB)/$(KMODDIR) +- @./scripts/check_depmod.sh +- @/sbin/depmod -a +- @./scripts/update-initramfs.sh $(KLIB) + @echo + @echo Your backported driver modules should be installed now. + @echo Reboot. +-- +2.1.4 + diff --git a/common/recipes-kernel/iwlwifi/backport-iwlwifi/iwlwifi.conf b/common/recipes-kernel/iwlwifi/backport-iwlwifi/iwlwifi.conf new file mode 100644 index 00000000..a0e5f6ff --- /dev/null +++ b/common/recipes-kernel/iwlwifi/backport-iwlwifi/iwlwifi.conf @@ -0,0 +1,12 @@ +# /etc/modprobe.d/iwlwifi.conf +# iwlwifi will dynamically load either iwldvm or iwlmvm depending on the +# microcode file installed on the system. When removing iwlwifi, first +# remove the iwl?vm module and then iwlwifi. +remove iwlwifi (/sbin/lsmod | grep -o -e ^iwlmvm -e ^iwldvm16 -e ^iwldvm -e ^iwlwifi | xargs /sbin/rmmod) && /sbin/modprobe -r mac80211 + +#options iwlwifi lar_disable=1 +#options iwlwifi nvm_file="nvm-sfp-b2-open.bin" +options iwlmvm power_scheme=1 + +# PCI BUS + diff --git a/common/recipes-kernel/iwlwifi/backport-iwlwifi_git.bb b/common/recipes-kernel/iwlwifi/backport-iwlwifi_git.bb new file mode 100644 index 00000000..f793a109 --- /dev/null +++ b/common/recipes-kernel/iwlwifi/backport-iwlwifi_git.bb @@ -0,0 +1,42 @@ +SUMMARY = "Intel Wireless LinuxCore kernel driver" +DESCRIPTION = "Intel Wireless LinuxCore kernel driver" +SECTION = "kernel" +LICENSE = "GPLv2" + +REQUIRED_DISTRO_FEATURES = "wifi" + +LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" + +inherit module + +PV = "30" +SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/backport-iwlwifi;branch=release/LinuxCore${PV}" +SRC_URI += "file://0001-Makefile.real-skip-host-install-scripts.patch" +SRC_URI += "file://iwlwifi.conf" + +SRCREV = "${AUTOREV}" + +S = "${WORKDIR}/git" + +EXTRA_OEMAKE = "INSTALL_MOD_PATH=${D} KLIB_BUILD=${KBUILD_OUTPUT}" + +do_configure() { + CC=gcc CFLAGS= LDFLAGS= make defconfig-iwlwifi-public KLIB_BUILD=${KBUILD_OUTPUT} +} + +MODULES_INSTALL_TARGET="install" + +do_install_append() { + ## install configs and service scripts + install -d ${D}${sysconfdir}/modprobe.d + install -m 0644 ${WORKDIR}/iwlwifi.conf ${D}${sysconfdir}/modprobe.d +} + +SYSTEMD_AUTO_ENABLE_${PN} = "enable" + +RDEPENDS_${PN} = "linux-firmware-iwlwifi" + +KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " iwlwifi" +KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " iwlwifi" + +KERNEL_MODULE_PACKAGE_PREFIX = "backport-iwlwifi" diff --git a/common/recipes-kernel/linux-firmware/linux-firmware_%.bbappend b/common/recipes-kernel/linux-firmware/linux-firmware_%.bbappend new file mode 100644 index 00000000..f6968af8 --- /dev/null +++ b/common/recipes-kernel/linux-firmware/linux-firmware_%.bbappend @@ -0,0 +1,23 @@ +# meta-intel maintains a recipe that installs iwlwifi's LinuxCore wifi +# driver releases. For some iwfwifi LinuxCore supported wireless chips, the +# best/latest firmware blobs are found in the iwlwifi's linux-firmware.git fork. +# +# See: https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi/core_release +# +# This bbappend fetches the -31.ucode (currently, for Intel Wireless 8260 +# only!) that is the best match for the iwlwifi LinuxCore release built. +# +# Note: keep these in sync when updating the iwlwifi_git.bb LinuxCore +# versions. + +SRC_URI_append_intel-x86-common = " https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/linux-firmware.git/plain/iwlwifi-8000C-31.ucode?id=${IWLWIFI_SRCREV};name=iwlwifi-8000C-31" + +IWLWIFI_SRCREV = "942f14f65363f33c3fd8a06db58c8ccca0559335" + +SRC_URI[iwlwifi-8000C-31.md5sum] = "428a84a780bbe864a7af6a6734c4b529" +SRC_URI[iwlwifi-8000C-31.sha256sum] = "5a337c52f9d7a7cb5cb0a13c93232f4de742ed0debef757d68231bdb55455406" + +do_install_append_intel-x86-common() { + # Copy the iwlwifi/LinuxCore required ucode for Intel Wireless 8260 + cp ${WORKDIR}/iwlwifi-8000C-31.ucode\?id\=${IWLWIFI_SRCREV} ${D}/${nonarch_base_libdir}/firmware/iwlwifi-8000C-31.ucode +} diff --git a/common/recipes-kernel/linux/linux-intel-rt_4.9.bb b/common/recipes-kernel/linux/linux-intel-rt_4.9.bb new file mode 100644 index 00000000..3fbe8fda --- /dev/null +++ b/common/recipes-kernel/linux/linux-intel-rt_4.9.bb @@ -0,0 +1,17 @@ + +require linux-intel.inc + +# Skip processing of this recipe if it is not explicitly specified as the +# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying +# to build multiple virtual/kernel providers, e.g. as dependency of +# core-image-rt-sdk, core-image-rt. +python () { + if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-intel-rt": + raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-intel-rt to enable it") +} + +KBRANCH = "base-rt" +SRCREV_machine ?= "fc08e0615edccfb4d297c07531451cb7905fb4f4" +SRCREV_meta ?= "3ddaed3671efc2936efbebf4c5216e11b9dfd55d" + +LINUX_KERNEL_TYPE = "preempt-rt" diff --git a/common/recipes-kernel/linux/linux-intel.inc b/common/recipes-kernel/linux/linux-intel.inc new file mode 100644 index 00000000..46f28efe --- /dev/null +++ b/common/recipes-kernel/linux/linux-intel.inc @@ -0,0 +1,43 @@ +require recipes-kernel/linux/linux-yocto.inc + +FILESEXTRAPATHS_prepend := "${THISDIR}/linux-intel:" + +KERNEL_CONFIG_URI ?= " \ + git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.9;destsuffix=${KMETA} \ + " +SRC_URI = " \ + git://github.com/01org/linux-intel-4.9.git;protocol=https;name=machine;branch=${KBRANCH}; \ + ${KERNEL_CONFIG_URI} \ + " + +SRC_URI_append_core2-32-intel-common = " file://disable_skylake_sound.cfg" + + +LINUX_VERSION ?= "4.9.47" +LINUX_VERSION_EXTENSION ?= "-intel-pk-${LINUX_KERNEL_TYPE}" + +PV = "${LINUX_VERSION}+git${SRCPV}" + +KMETA = "kernel-meta" +KCONF_BSP_AUDIT_LEVEL = "2" + +KERNEL_FEATURES_INTEL_COMMON ?= "" + +COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" +KMACHINE_core2-32-intel-common = "intel-core2-32" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" +KMACHINE_corei7-64-intel-common = "intel-corei7-64" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_i586-nlp-32-intel-common = "${MACHINE}" +KMACHINE_i586-nlp-32-intel-common = "intel-quark" +KERNEL_FEATURES_append_i586-nlp-32-intel-common = "features/qat/qat.scc" + +# Functionality flags +KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}" +KERNEL_FEATURES_append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "" ,d)}" + +KERNEL_MODULE_PROBECONF_corei7-64-intel-common += "snd-soc-skl" +module_conf_snd-soc-skl_corei7-64-intel-common = "blacklist snd-soc-skl" diff --git a/common/recipes-kernel/linux/linux-intel/disable_skylake_sound.cfg b/common/recipes-kernel/linux/linux-intel/disable_skylake_sound.cfg new file mode 100644 index 00000000..f7d7322e --- /dev/null +++ b/common/recipes-kernel/linux/linux-intel/disable_skylake_sound.cfg @@ -0,0 +1,14 @@ +# CONFIG_SND_SOC_INTEL_SKYLAKE is not set +# CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH is not set +# CONFIG_SND_SOC_INTEL_BXT_FLORIDA_MACH is not set +# CONFIG_SND_SOC_INTEL_BXT_RT298_MACH is not set +# CONFIG_SND_SOC_INTEL_BXT_TDF8532_MACH is not set +# CONFIG_SND_SOC_INTEL_KBL_RT5663_MAX98927_MACH is not set +# CONFIG_SND_SOC_INTEL_SKL_RT286_MACH is not set +# CONFIG_SND_SOC_INTEL_CNL_WM8281_MACH is not set +# CONFIG_SND_SOC_INTEL_CNL_RT274_MACH is not set +# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH is not set +# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH is not set +# CONFIG_SND_SOC_INTEL_CNL_CS42L42_MACH is not set +# CONFIG_SND_SOC_INTEL_CNL_RT700_MACH is not set +# CONFIG_SND_SOC_INTEL_CNL_SVFPGA_MACH is not set diff --git a/common/recipes-kernel/linux/linux-intel_4.9.bb b/common/recipes-kernel/linux/linux-intel_4.9.bb new file mode 100644 index 00000000..4823c98d --- /dev/null +++ b/common/recipes-kernel/linux/linux-intel_4.9.bb @@ -0,0 +1,13 @@ + +require linux-intel.inc + +KBRANCH = "base" +SRCREV_machine ?= "2d533948da0a7c53a0a662d3764be166ba996d93" +SRCREV_meta ?= "3ddaed3671efc2936efbebf4c5216e11b9dfd55d" + +# For Crystalforest and Romley +KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " uio" +KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " uio" + +# Functionality flags +KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc" diff --git a/common/recipes-kernel/linux/linux-yocto-dev.bbappend b/common/recipes-kernel/linux/linux-yocto-dev.bbappend new file mode 100644 index 00000000..ee33ecc3 --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -0,0 +1,26 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:" + +COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" +KMACHINE_core2-32-intel-common = "intel-core2-32" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" +KMACHINE_corei7-64-intel-common = "intel-corei7-64" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +# Quark / X1000 BSP Info +COMPATIBLE_MACHINE_i586-nlp-32-intel-common = "${MACHINE}" +KMACHINE_i586-nlp-32-intel-common = "intel-quark" +KERNEL_FEATURES_append_i586-nlp-32-intel-common = "" + +# NOTE: We do not set SRCREVs here as -dev is intended to be built with AUTOREV +# and setting them here breaks the default mechanism to use AUTOREV if the +# default SRCREV is set and linux-yocto-dev is the preferred provider. + +# For Crystalforest and Romley +KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " uio" +KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " uio" + +# For FRI2, NUC +KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " iwlwifi" +KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " iwlwifi" diff --git a/common/recipes-kernel/linux/linux-yocto-rt_4.10.bbappend b/common/recipes-kernel/linux/linux-yocto-rt_4.10.bbappend new file mode 100644 index 00000000..17569a1c --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-rt_4.10.bbappend @@ -0,0 +1,13 @@ +KERNEL_FEATURES_INTEL_COMMON ?= "" + +COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" +KMACHINE_core2-32-intel-common = "intel-core2-32" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" +KMACHINE_corei7-64-intel-common = "intel-corei7-64" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_i586-nlp-32-intel-common = "${MACHINE}" +KMACHINE_i586-nlp-32-intel-common = "intel-quark" +KERNEL_FEATURES_append_i586-nlp-32-intel-common = "" diff --git a/common/recipes-kernel/linux/linux-yocto-rt_4.12.bbappend b/common/recipes-kernel/linux/linux-yocto-rt_4.12.bbappend new file mode 100644 index 00000000..17569a1c --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-rt_4.12.bbappend @@ -0,0 +1,13 @@ +KERNEL_FEATURES_INTEL_COMMON ?= "" + +COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" +KMACHINE_core2-32-intel-common = "intel-core2-32" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" +KMACHINE_corei7-64-intel-common = "intel-corei7-64" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_i586-nlp-32-intel-common = "${MACHINE}" +KMACHINE_i586-nlp-32-intel-common = "intel-quark" +KERNEL_FEATURES_append_i586-nlp-32-intel-common = "" diff --git a/common/recipes-kernel/linux/linux-yocto-rt_4.4.bbappend b/common/recipes-kernel/linux/linux-yocto-rt_4.4.bbappend new file mode 100644 index 00000000..c18f4a11 --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-rt_4.4.bbappend @@ -0,0 +1,33 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:" + +LINUX_VERSION_INTEL_COMMON = "4.4.87" +SRCREV_META_INTEL_COMMON ?= "804d2b3164ec25ed519fd695de9aa0908460c92e" +SRCREV_MACHINE_INTEL_COMMON ?= "d1ce34c9e66fe55382cc196fe7facbe7865c4eed" + +KBRANCH_INTEL_COMMON = "standard/preempt-rt/intel/base" + +KERNEL_FEATURES_INTEL_COMMON ?= "" + +LINUX_VERSION_core2-32-intel-common = "${LINUX_VERSION_INTEL_COMMON}" +COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" +KMACHINE_core2-32-intel-common = "intel-core2-32" +KBRANCH_core2-32-intel-common = "${KBRANCH_INTEL_COMMON}" +SRCREV_meta_core2-32-intel-common ?= "${SRCREV_META_INTEL_COMMON}" +SRCREV_machine_core2-32-intel-common ?= "${SRCREV_MACHINE_INTEL_COMMON}" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +LINUX_VERSION_corei7-64-intel-common = "${LINUX_VERSION_INTEL_COMMON}" +COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" +KMACHINE_corei7-64-intel-common = "intel-corei7-64" +KBRANCH_corei7-64-intel-common = "${KBRANCH_INTEL_COMMON}" +SRCREV_meta_corei7-64-intel-common ?= "${SRCREV_META_INTEL_COMMON}" +SRCREV_machine_corei7-64-intel-common ?= "${SRCREV_MACHINE_INTEL_COMMON}" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +LINUX_VERSION_i586-nlp-32-intel-common = "${LINUX_VERSION_INTEL_COMMON}" +COMPATIBLE_MACHINE_i586-nlp-32-intel-common = "${MACHINE}" +KMACHINE_i586-nlp-32-intel-common = "intel-quark" +KBRANCH_i586-nlp-32-intel-common = "${KBRANCH_INTEL_COMMON}" +SRCREV_meta_i586-nlp-32-intel-common ?= "${SRCREV_META_INTEL_COMMON}" +SRCREV_machine_i586-nlp-32-intel-common ?= "${SRCREV_MACHINE_INTEL_COMMON}" +KERNEL_FEATURES_append_i586-nlp-32-intel-common = "" diff --git a/common/recipes-kernel/linux/linux-yocto-rt_4.9.bbappend b/common/recipes-kernel/linux/linux-yocto-rt_4.9.bbappend new file mode 100644 index 00000000..9d2e3c0b --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-rt_4.9.bbappend @@ -0,0 +1,13 @@ +KERNEL_FEATURES_INTEL_COMMON = "" + +COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" +KMACHINE_core2-32-intel-common = "intel-core2-32" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" +KMACHINE_corei7-64-intel-common = "intel-corei7-64" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_i586-nlp-32-intel-common = "${MACHINE}" +KMACHINE_i586-nlp-32-intel-common = "intel-quark" +KERNEL_FEATURES_append_i586-nlp-32-intel-common = "" diff --git a/common/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend b/common/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend new file mode 100644 index 00000000..b8d3d81c --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend @@ -0,0 +1,19 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:" + +KERNEL_FEATURES_INTEL_COMMON ?= "" + +COMPATIBLE_MACHINE_i586-nlp-32-intel-common = "${MACHINE}" +COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" +COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" + +KBRANCH_i586-nlp-32-intel-common = "standard/tiny/base" +KBRANCH_core2-32-intel-common = "standard/tiny/base" +KBRANCH_corei7-64-intel-common = "standard/tiny/base" + +KMACHINE_i586-nlp-32-intel-common = "intel-quark" +KMACHINE_core2-32-intel-common = "intel-core2-32" +KMACHINE_corei7-64-intel-common = "intel-corei7-64" + +KERNEL_FEATURES_append_i586-nlp-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON} cfg/fs/ext4.scc" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON} cfg/fs/ext4.scc" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON} cfg/fs/ext4.scc" diff --git a/common/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend b/common/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend new file mode 100644 index 00000000..b8d3d81c --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend @@ -0,0 +1,19 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:" + +KERNEL_FEATURES_INTEL_COMMON ?= "" + +COMPATIBLE_MACHINE_i586-nlp-32-intel-common = "${MACHINE}" +COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" +COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" + +KBRANCH_i586-nlp-32-intel-common = "standard/tiny/base" +KBRANCH_core2-32-intel-common = "standard/tiny/base" +KBRANCH_corei7-64-intel-common = "standard/tiny/base" + +KMACHINE_i586-nlp-32-intel-common = "intel-quark" +KMACHINE_core2-32-intel-common = "intel-core2-32" +KMACHINE_corei7-64-intel-common = "intel-corei7-64" + +KERNEL_FEATURES_append_i586-nlp-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON} cfg/fs/ext4.scc" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON} cfg/fs/ext4.scc" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON} cfg/fs/ext4.scc" diff --git a/common/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend b/common/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend new file mode 100644 index 00000000..54430e21 --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend @@ -0,0 +1,33 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:" + +EXTRA_OEMAKE = "LD=${STAGING_BINDIR_NATIVE}/${HOST_SYS}/${TARGET_PREFIX}ld AR=${STAGING_BINDIR_NATIVE}/${HOST_SYS}/${TARGET_PREFIX}gcc-ar" + +KERNEL_FEATURES_INTEL_COMMON ?= "" + +LINUX_VERSION_i586-nlp-32-intel-common = "4.4.87" +LINUX_VERSION_core2-32-intel-common = "4.4.87" +LINUX_VERSION_corei7-64-intel-common = "4.4.87" + +SRCREV_meta_i586-nlp-32-intel-common = "804d2b3164ec25ed519fd695de9aa0908460c92e" +SRCREV_meta_core2-32-intel-common = "804d2b3164ec25ed519fd695de9aa0908460c92e" +SRCREV_meta_corei7-64-intel-common = "804d2b3164ec25ed519fd695de9aa0908460c92e" + +SRCREV_machine_i586-nlp-32-intel-common = "85b913cc9d5e13602d69e50bd9cf1a6ef242f9ee" +SRCREV_machine_core2-32-intel-common = "85b913cc9d5e13602d69e50bd9cf1a6ef242f9ee" +SRCREV_machine_corei7-64-intel-common = "85b913cc9d5e13602d69e50bd9cf1a6ef242f9ee" + +COMPATIBLE_MACHINE_i586-nlp-32-intel-common = "${MACHINE}" +COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" +COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" + +KBRANCH_i586-nlp-32-intel-common = "standard/tiny/intel/base" +KBRANCH_core2-32-intel-common = "standard/tiny/intel/base" +KBRANCH_corei7-64-intel-common = "standard/tiny/intel/base" + +KMACHINE_i586-nlp-32-intel-common = "intel-quark" +KMACHINE_core2-32-intel-common = "intel-core2-32" +KMACHINE_corei7-64-intel-common = "intel-corei7-64" + +KERNEL_FEATURES_append_i586-nlp-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON} cfg/fs/ext4.scc" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON} cfg/fs/ext4.scc" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON} cfg/fs/ext4.scc" diff --git a/common/recipes-kernel/linux/linux-yocto-tiny_4.9.bbappend b/common/recipes-kernel/linux/linux-yocto-tiny_4.9.bbappend new file mode 100644 index 00000000..9ecdb95a --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-tiny_4.9.bbappend @@ -0,0 +1,31 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:" + +EXTRA_OEMAKE = "LD=${STAGING_BINDIR_NATIVE}/${HOST_SYS}/${TARGET_PREFIX}ld AR=${STAGING_BINDIR_NATIVE}/${HOST_SYS}/${TARGET_PREFIX}gcc-ar" + +LINUX_VERSION_i586-nlp-32-intel-common = "4.9.13" +LINUX_VERSION_core2-32-intel-common = "4.9.13" +LINUX_VERSION_corei7-64-intel-common = "4.9.13" + +SRCREV_meta_i586-nlp-32-intel-common = "8f3bc608ae61c5333043167fa31bac33be93c3de" +SRCREV_meta_core2-32-intel-common = "8f3bc608ae61c5333043167fa31bac33be93c3de" +SRCREV_meta_corei7-64-intel-common = "8f3bc608ae61c5333043167fa31bac33be93c3de" + +SRCREV_machine_i586-nlp-32-intel-common = "95c0a80ee83f1cf8e59d733f36e8a9dfd50a0098" +SRCREV_machine_core2-32-intel-common = "95c0a80ee83f1cf8e59d733f36e8a9dfd50a0098" +SRCREV_machine_corei7-64-intel-common = "95c0a80ee83f1cf8e59d733f36e8a9dfd50a0098" + +COMPATIBLE_MACHINE_i586-nlp-32-intel-common = "${MACHINE}" +COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" +COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" + +KBRANCH_i586-nlp-32-intel-common = "standard/tiny/base" +KBRANCH_core2-32-intel-common = "standard/tiny/base" +KBRANCH_corei7-64-intel-common = "standard/tiny/base" + +KMACHINE_i586-nlp-32-intel-common = "intel-quark" +KMACHINE_core2-32-intel-common = "intel-core2-32" +KMACHINE_corei7-64-intel-common = "intel-corei7-64" + +KERNEL_FEATURES_append_i586-nlp-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON} cfg/fs/ext4.scc" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON} cfg/fs/ext4.scc" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON} cfg/fs/ext4.scc" diff --git a/common/recipes-kernel/linux/linux-yocto_%.bbappend b/common/recipes-kernel/linux/linux-yocto_%.bbappend new file mode 100644 index 00000000..7c29be14 --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto_%.bbappend @@ -0,0 +1,4 @@ +# The kernel build is 64-bit regardless, so include both common overrides. +# Without this, the kernel will be missing vars that make it buildable for the +# intel-corei7-64 machine. +MACHINEOVERRIDES_prepend_corei7-64-x32-intel-common = "corei7-64-intel-common:" diff --git a/common/recipes-kernel/linux/linux-yocto_4.10.bbappend b/common/recipes-kernel/linux/linux-yocto_4.10.bbappend new file mode 100644 index 00000000..20504637 --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto_4.10.bbappend @@ -0,0 +1,21 @@ +KERNEL_FEATURES_INTEL_COMMON ?= "" + +COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" +KMACHINE_core2-32-intel-common = "intel-core2-32" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" +KMACHINE_corei7-64-intel-common = "intel-corei7-64" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_i586-nlp-32-intel-common = "${MACHINE}" +KMACHINE_i586-nlp-32-intel-common = "intel-quark" +KERNEL_FEATURES_append_i586-nlp-32-intel-common = "" + +# For Crystalforest and Romley +KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " uio" +KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " uio" + +# For FRI2, NUC +KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " iwlwifi" +KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " iwlwifi" diff --git a/common/recipes-kernel/linux/linux-yocto_4.12.bbappend b/common/recipes-kernel/linux/linux-yocto_4.12.bbappend new file mode 100644 index 00000000..20504637 --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto_4.12.bbappend @@ -0,0 +1,21 @@ +KERNEL_FEATURES_INTEL_COMMON ?= "" + +COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" +KMACHINE_core2-32-intel-common = "intel-core2-32" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" +KMACHINE_corei7-64-intel-common = "intel-corei7-64" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_i586-nlp-32-intel-common = "${MACHINE}" +KMACHINE_i586-nlp-32-intel-common = "intel-quark" +KERNEL_FEATURES_append_i586-nlp-32-intel-common = "" + +# For Crystalforest and Romley +KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " uio" +KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " uio" + +# For FRI2, NUC +KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " iwlwifi" +KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " iwlwifi" diff --git a/common/recipes-kernel/linux/linux-yocto_4.4.bbappend b/common/recipes-kernel/linux/linux-yocto_4.4.bbappend new file mode 100644 index 00000000..3b02a932 --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto_4.4.bbappend @@ -0,0 +1,43 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:" + +LINUX_VERSION_INTEL_COMMON = "4.4.87" +SRCREV_META_INTEL_COMMON = "804d2b3164ec25ed519fd695de9aa0908460c92e" +SRCREV_MACHINE_INTEL_COMMON = "57746baa7ae35660fe807c65b6809e6b16d4a448" + +KBRANCH_INTEL_COMMON = "standard/intel/base" + +KERNEL_FEATURES_INTEL_COMMON ?= "" + +LINUX_VERSION_core2-32-intel-common = "${LINUX_VERSION_INTEL_COMMON}" +COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" +KMACHINE_core2-32-intel-common = "intel-core2-32" +KBRANCH_core2-32-intel-common = "${KBRANCH_INTEL_COMMON}" +SRCREV_meta_core2-32-intel-common ?= "${SRCREV_META_INTEL_COMMON}" +SRCREV_machine_core2-32-intel-common ?= "${SRCREV_MACHINE_INTEL_COMMON}" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +LINUX_VERSION_corei7-64-intel-common = "${LINUX_VERSION_INTEL_COMMON}" +COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" +KMACHINE_corei7-64-intel-common = "intel-corei7-64" +SRCREV_meta_corei7-64-intel-common ?= "${SRCREV_META_INTEL_COMMON}" +SRCREV_machine_corei7-64-intel-common ?= "${@bb.utils.contains('INTEL_MACHINE_SUBTYPE', 'broxton-m', 'a249f6388ace2a4035220c2333649b42c300faa9', '${SRCREV_MACHINE_INTEL_COMMON}', d)}" +KBRANCH_corei7-64-intel-common = "${@bb.utils.contains('INTEL_MACHINE_SUBTYPE', 'broxton-m', 'standard/intel/bxt-rebase;rebaseable=1', '${KBRANCH_INTEL_COMMON}', d)}" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +# Quark / X1000 BSP Info +LINUX_VERSION_i586-nlp-32-intel-common = "${LINUX_VERSION_INTEL_COMMON}" +COMPATIBLE_MACHINE_i586-nlp-32-intel-common = "${MACHINE}" +KMACHINE_i586-nlp-32-intel-common = "intel-quark" +KBRANCH_i586-nlp-32-intel-common = "${KBRANCH_INTEL_COMMON}" +SRCREV_meta_i586-nlp-32-intel-common ?= "${SRCREV_META_INTEL_COMMON}" +SRCREV_machine_i586-nlp-32-intel-common ?= "${SRCREV_MACHINE_INTEL_COMMON}" +KERNEL_FEATURES_append_i586-nlp-32-intel-common = "" + + +# For Crystalforest and Romley +KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " uio" +KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " uio" + +# For FRI2, NUC +KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " iwlwifi" +KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " iwlwifi" diff --git a/common/recipes-kernel/linux/linux-yocto_4.9.bbappend b/common/recipes-kernel/linux/linux-yocto_4.9.bbappend new file mode 100644 index 00000000..a09fe1a4 --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto_4.9.bbappend @@ -0,0 +1,21 @@ +KERNEL_FEATURES_INTEL_COMMON = "" + +COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" +KMACHINE_core2-32-intel-common = "intel-core2-32" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" +KMACHINE_corei7-64-intel-common = "intel-corei7-64" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +COMPATIBLE_MACHINE_i586-nlp-32-intel-common = "${MACHINE}" +KMACHINE_i586-nlp-32-intel-common = "intel-quark" +KERNEL_FEATURES_append_i586-nlp-32-intel-common = "" + +# For Crystalforest and Romley +KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " uio" +KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " uio" + +# For FRI2, NUC +KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " iwlwifi" +KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " iwlwifi" diff --git a/common/recipes-kernel/lttng/lttng-modules/0002-lttng-modules-PKT-4.9-yocto-build-failed.patch b/common/recipes-kernel/lttng/lttng-modules/0002-lttng-modules-PKT-4.9-yocto-build-failed.patch new file mode 100644 index 00000000..32b49b8d --- /dev/null +++ b/common/recipes-kernel/lttng/lttng-modules/0002-lttng-modules-PKT-4.9-yocto-build-failed.patch @@ -0,0 +1,38 @@ +From ebfdc8b8af17f9cf23c6878eb52476fde7b48e5c Mon Sep 17 00:00:00 2001 +From: Priyalee Kushwaha <priyalee.kushwaha@intel.com> +Date: Fri, 22 Sep 2017 14:40:57 -0700 +Subject: [PATCH] lttng-modules: PKT 4.9 yocto build failed + +PKT 4.9 yocto kernel backports a patch from upstream and that +changes header include/linux/ktimer.h. Since this backported +patch is only relevant for PKT kernel, we need to carry this +patch. + +Upstream-Status: Backport +Signed-off-by: Kushwaha, Priyalee <priyalee.kushwaha@intel.com> +--- + instrumentation/events/lttng-module/timer.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/instrumentation/events/lttng-module/timer.h b/instrumentation/events/lttng-module/timer.h +index d62fd25..59da988 100644 +--- a/instrumentation/events/lttng-module/timer.h ++++ b/instrumentation/events/lttng-module/timer.h +@@ -16,11 +16,11 @@ struct timer_list; + + #endif /* _TRACE_TIMER_DEF_ */ + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0)) + #define lttng_ktime_get_tv64(kt) (kt) +-#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */ ++#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0)) */ + #define lttng_ktime_get_tv64(kt) ((kt).tv64) +-#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */ ++#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0)) */ + + LTTNG_TRACEPOINT_EVENT_CLASS(timer_class, + +-- +2.7.4 + diff --git a/common/recipes-kernel/lttng/lttng-modules_%.bbappend b/common/recipes-kernel/lttng/lttng-modules_%.bbappend new file mode 100644 index 00000000..ee8b8c14 --- /dev/null +++ b/common/recipes-kernel/lttng/lttng-modules_%.bbappend @@ -0,0 +1,7 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:" + + +LTTNG_PATCH = "${@bb.utils.contains('PREFERRED_PROVIDER_virtual/kernel','linux-intel','file://0002-lttng-modules-PKT-4.9-yocto-build-failed.patch','',d)}" + +SRC_URI += "${LTTNG_PATCH}" + diff --git a/common/recipes-multimedia/libva/libva-intel-driver_1.8.3.bb b/common/recipes-multimedia/libva/libva-intel-driver_1.8.3.bb new file mode 100644 index 00000000..72451c02 --- /dev/null +++ b/common/recipes-multimedia/libva/libva-intel-driver_1.8.3.bb @@ -0,0 +1,35 @@ +SUMMARY = "VA driver for Intel G45 & HD Graphics family" +DESCRIPTION = "libva-driver-intel is the VA-API implementation \ +for Intel G45 chipsets and Intel HD Graphics for Intel Core \ +processor family." + +HOMEPAGE = "http://www.freedesktop.org/wiki/Software/vaapi" +BUGTRACKER = "https://bugs.freedesktop.org" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=2e48940f94acb0af582e5ef03537800f" + +COMPATIBLE_HOST = '(i.86|x86_64).*-linux' + +DEPENDS = "libva libdrm" + +SRC_URI = "git://github.com/01org/intel-vaapi-driver.git;branch=v1.8-branch" +# 1.8.3 release tag +SRCREV = "f1d9ceddc0e84ed8d44dd59017b0e19b75dd5dcd" + +S = "${WORKDIR}/git" + +inherit autotools pkgconfig distro_features_check + +REQUIRED_DISTRO_FEATURES = "opengl" + +PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "x11", "x11", "", d)} \ + ${@bb.utils.contains("DISTRO_FEATURES", "opengl wayland", "wayland", "", d)}" +PACKAGECONFIG[x11] = "--enable-x11,--disable-x11" +PACKAGECONFIG[wayland] = "--enable-wayland,--disable-wayland,wayland wayland-native virtual/egl" + +FILES_${PN} += "${libdir}/dri/*.so" +FILES_${PN}-dev += "${libdir}/dri/*.la" +FILES_${PN}-dbg += "${libdir}/dri/.debug" + +UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+(\.\d+)*)" diff --git a/common/recipes-multimedia/libva/va-intel.bb b/common/recipes-multimedia/libva/va-intel.bb new file mode 100644 index 00000000..88539e25 --- /dev/null +++ b/common/recipes-multimedia/libva/va-intel.bb @@ -0,0 +1,32 @@ +DESCRIPTION = "Video Acceleration Add-ons for Intel BSPs" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +S = "${WORKDIR}" + +PR = "r1" + +def map_valibs(d): + # The intel implementation requires the libva-intel-driver package + if bb.utils.contains('MACHINE_FEATURES', 'va-impl-intel', "1", "0", d) == "1": + return "libva libva-intel-driver" + # All meta-intel video acceleration requires libva + return "libva" + +VA_IMPL = "${@map_valibs(d)}" + +PACKAGES = "\ + va-intel \ + " + +ALLOW_EMPTY_va-intel = "1" + +RDEPENDS_va-intel = " \ + ${VA_IMPL} \ + " + +COMPATIBLE_HOST = '(i.86|x86_64).*-linux*' + +inherit distro_features_check + +REQUIRED_DISTRO_FEATURES = "opengl" diff --git a/common/recipes-multimedia/libyami/libyami-utils/0001-Fix-build-with-clang.patch b/common/recipes-multimedia/libyami/libyami-utils/0001-Fix-build-with-clang.patch new file mode 100644 index 00000000..a4a4029c --- /dev/null +++ b/common/recipes-multimedia/libyami/libyami-utils/0001-Fix-build-with-clang.patch @@ -0,0 +1,99 @@ +From b7e66182788cd925570bb4c310e21fbcd3185040 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sat, 12 Aug 2017 08:49:20 -0700 +Subject: [PATCH] Fix build with clang + +Fix errors e.g. +error: comparison of constant -1 with expression of type 'char' is always true [-Werror,-Wtautological-constant-out-of-range-compare]error: comparison of constant -1 with expression of type 'char' is always true [-Werror,-Wtautological-constant-out-of-range-compare] + +and + +psnr.cpp:225:17: error: bool literal returned from 'main' [-Werror,-Wmain] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + tests/decodehelp.cpp | 2 +- + tests/encodehelp.h | 2 +- + tests/vpp.cpp | 2 +- + tests/yamitranscode.cpp | 2 +- + testscripts/psnr.cpp | 4 ++-- + 5 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/tests/decodehelp.cpp b/tests/decodehelp.cpp +index a69eab6..2d96598 100644 +--- a/tests/decodehelp.cpp ++++ b/tests/decodehelp.cpp +@@ -70,7 +70,7 @@ bool processCmdLine(int argc, char** argv, DecodeParameter* parameters) + {"capi", no_argument, NULL, 0}, + {NULL, no_argument, NULL, 0}}; + +- char opt; ++ int opt; + while ((opt = getopt_long_only(argc, argv, "h:m:n:i:f:o:w:?", long_opts,&option_index)) != -1){ + switch (opt) { + case 'h': +diff --git a/tests/encodehelp.h b/tests/encodehelp.h +index 57ccd77..76df801 100644 +--- a/tests/encodehelp.h ++++ b/tests/encodehelp.h +@@ -107,7 +107,7 @@ static VideoRateControl string_to_rc_mode(char *str) + + static bool process_cmdline(int argc, char *argv[]) + { +- char opt; ++ int opt; + const struct option long_opts[] = { + { "help", no_argument, NULL, 'h' }, + { "qp", required_argument, NULL, 0 }, +diff --git a/tests/vpp.cpp b/tests/vpp.cpp +index 5a60c0a..52da43b 100644 +--- a/tests/vpp.cpp ++++ b/tests/vpp.cpp +@@ -151,7 +151,7 @@ public: + private: + bool processCmdLine(int argc, char* argv[]) + { +- char opt; ++ int opt; + const struct option long_opts[] = { + { "help", no_argument, NULL, 'h' }, + { "sharpening", required_argument, NULL, 's' }, +diff --git a/tests/yamitranscode.cpp b/tests/yamitranscode.cpp +index 4cb72aa..2fc6725 100755 +--- a/tests/yamitranscode.cpp ++++ b/tests/yamitranscode.cpp +@@ -95,7 +95,7 @@ static VideoRateControl string_to_rc_mode(char *str) + + static bool processCmdLine(int argc, char *argv[], TranscodeParams& para) + { +- char opt; ++ int opt; + const struct option long_opts[] = { + { "help", no_argument, NULL, 'h' }, + { "qp", required_argument, NULL, 0 }, +diff --git a/testscripts/psnr.cpp b/testscripts/psnr.cpp +index 5cc24c9..68bd668 100644 +--- a/testscripts/psnr.cpp ++++ b/testscripts/psnr.cpp +@@ -215,14 +215,14 @@ int main(int argc, char *argv[]) + const char* psnrresult = "average_psnr.txt"; + int width=0,height=0; + int standardpsnr = NORMAL_PSNR; +- char opt; ++ int opt; + while ((opt = getopt(argc, argv, "h:W:H:i:o:s:?")) != -1) + { + switch (opt) { + case 'h': + case '?': + print_help(argv[0]); +- return false; ++ return -1; + case 'i': + filename1 = optarg; + break; +-- +2.14.1 + diff --git a/common/recipes-multimedia/libyami/libyami-utils_1.2.0.bb b/common/recipes-multimedia/libyami/libyami-utils_1.2.0.bb new file mode 100644 index 00000000..62d62d58 --- /dev/null +++ b/common/recipes-multimedia/libyami/libyami-utils_1.2.0.bb @@ -0,0 +1,31 @@ +SUMMARY = "Applications and Scripts for libyami." +DESCRIPTION = "Applications and Scripts for libyami." + +HOMEPAGE = "https://github.com/01org/libyami-utils" +BUGTRACKER = "https://github.com/01org/libyami-utils/issues/new" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" + +SRC_URI = "git://github.com/01org/libyami-utils.git \ + file://0001-Fix-build-with-clang.patch \ + " +SRCREV = "b480c0594a7e761a8ccfe6b19b3f9bd0c3d871a1" +S = "${WORKDIR}/git" + +DEPENDS = "libva libyami" + +EXTRA_OECONF = "--enable-tests-gles --disable-md5" + +inherit autotools pkgconfig distro_features_check + +REQUIRED_DISTRO_FEATURES = "opengl" + +PACKAGECONFIG = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" + +# --enable-x11 needs libva-x11 +# gles-tests fail to build without x11: see https://github.com/01org/libyami-utils/issues/91 +PACKAGECONFIG[x11] = "--enable-x11 --enable-tests-gles,--disable-x11 --disable-tests-gles, virtual/libx11" + +UPSTREAM_CHECK_URI = "http://github.com/01org/libyami-utils/releases" +UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)" diff --git a/common/recipes-multimedia/libyami/libyami/0001-bitWriter.cpp-Delete-unused-CACHEBYTES.patch b/common/recipes-multimedia/libyami/libyami/0001-bitWriter.cpp-Delete-unused-CACHEBYTES.patch new file mode 100644 index 00000000..a96c9b85 --- /dev/null +++ b/common/recipes-multimedia/libyami/libyami/0001-bitWriter.cpp-Delete-unused-CACHEBYTES.patch @@ -0,0 +1,27 @@ +From 294874b610a5b8af9b736b3afc938010af58785e Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 11 Aug 2017 17:15:45 -0700 +Subject: [PATCH 1/9] bitWriter.cpp: Delete unused CACHEBYTES + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + codecparsers/bitWriter.cpp | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/codecparsers/bitWriter.cpp b/codecparsers/bitWriter.cpp +index 9bcb14d..08469bf 100644 +--- a/codecparsers/bitWriter.cpp ++++ b/codecparsers/bitWriter.cpp +@@ -24,7 +24,6 @@ + + namespace YamiParser { + +-const uint32_t CACHEBYTES = sizeof(unsigned long int); + const uint32_t CACHEBITS = sizeof(unsigned long int) * 8; + + // clip to keep lowest n bits +-- +2.14.1 + diff --git a/common/recipes-multimedia/libyami/libyami/0002-typecast-index-from-size_t-to-int.patch b/common/recipes-multimedia/libyami/libyami/0002-typecast-index-from-size_t-to-int.patch new file mode 100644 index 00000000..a216566c --- /dev/null +++ b/common/recipes-multimedia/libyami/libyami/0002-typecast-index-from-size_t-to-int.patch @@ -0,0 +1,42 @@ +From 88fa048e22ad00b04054b8a64df53bd440e01537 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 11 Aug 2017 17:29:02 -0700 +Subject: [PATCH 2/9] typecast index from size_t to int + +size_t is not consistent across architectures e.g. on arm its unsigned int + +Fixes +error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + codecparsers/jpegParser.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/codecparsers/jpegParser.cpp b/codecparsers/jpegParser.cpp +index 2217028..6da5c36 100644 +--- a/codecparsers/jpegParser.cpp ++++ b/codecparsers/jpegParser.cpp +@@ -639,7 +639,7 @@ bool Parser::parseDAC() + + length -= 2; + +- if (index < 0 || index >= (2 * NUM_ARITH_TBLS)) { ++ if ((int)index < 0 || index >= (2 * NUM_ARITH_TBLS)) { + ERROR("Invalid DAC Index"); + return false; + } +@@ -747,7 +747,7 @@ bool Parser::parseDHT() + huffTables = &m_dcHuffTables; + } + +- if (index < 0 || index >= NUM_HUFF_TBLS) { ++ if ((int)index < 0 || index >= NUM_HUFF_TBLS) { + ERROR("Bad Huff Table Index"); + return false; + } +-- +2.14.1 + diff --git a/common/recipes-multimedia/libyami/libyami/0003-Add-Wno-invalid-offsetof-to-compiler-commandline.patch b/common/recipes-multimedia/libyami/libyami/0003-Add-Wno-invalid-offsetof-to-compiler-commandline.patch new file mode 100644 index 00000000..17289602 --- /dev/null +++ b/common/recipes-multimedia/libyami/libyami/0003-Add-Wno-invalid-offsetof-to-compiler-commandline.patch @@ -0,0 +1,29 @@ +From 533d63287e9dd8f269b137c18fbe6c19206c8668 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 11 Aug 2017 17:49:43 -0700 +Subject: [PATCH 3/9] Add -Wno-invalid-offsetof to compiler commandline + +clang++ is fussy about offsetof on non-POD types + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + codecparsers/Makefile.am | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/codecparsers/Makefile.am b/codecparsers/Makefile.am +index 720bf81..d9226b3 100644 +--- a/codecparsers/Makefile.am ++++ b/codecparsers/Makefile.am +@@ -118,6 +118,7 @@ libyami_codecparser_cppflags = \ + -Dvp8dx_start_decode=libyami_vp8dx_start_decode \ + -Dvp8dx_bool_decoder_fill=libyami_vp8dx_bool_decoder_fill \ + -I$(top_srcdir)/interface \ ++ -Wno-invalid-offsetof \ + $(extra_includes) \ + $(NULL) + +-- +2.14.1 + diff --git a/common/recipes-multimedia/libyami/libyami/0004-Typecast-POWER32SUB2-to-uint8_t.patch b/common/recipes-multimedia/libyami/libyami/0004-Typecast-POWER32SUB2-to-uint8_t.patch new file mode 100644 index 00000000..27eca39b --- /dev/null +++ b/common/recipes-multimedia/libyami/libyami/0004-Typecast-POWER32SUB2-to-uint8_t.patch @@ -0,0 +1,33 @@ +From d9c831ee38da4551396fad5cd53c3dfc0e5e0cf8 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 11 Aug 2017 17:57:34 -0700 +Subject: [PATCH 4/9] Typecast POWER32SUB2 to uint8_t + +Fixes + +h265Parser.cpp:1064:5: error: comparison of constant 4294967294 with expression +of type 'uint8_t' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + codecparsers/h265Parser.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/codecparsers/h265Parser.cpp b/codecparsers/h265Parser.cpp +index 0dea3a6..c6cded2 100644 +--- a/codecparsers/h265Parser.cpp ++++ b/codecparsers/h265Parser.cpp +@@ -125,7 +125,7 @@ namespace H265 { + \ + CHECK_READ_UE(var->var##_max_num_reorder_pics[i], 0, var->var##_max_dec_pic_buffering_minus1[i]); \ + \ +- CHECK_READ_UE(var->var##_max_latency_increase_plus1[i], 0, POWER32SUB2); \ ++ CHECK_READ_UE(var->var##_max_latency_increase_plus1[i], 0, (uint8_t)POWER32SUB2); \ + } \ + } + +-- +2.14.1 + diff --git a/common/recipes-multimedia/libyami/libyami/0005-move-c-definitions-out-of-extern-C-block.patch b/common/recipes-multimedia/libyami/libyami/0005-move-c-definitions-out-of-extern-C-block.patch new file mode 100644 index 00000000..e77e85f7 --- /dev/null +++ b/common/recipes-multimedia/libyami/libyami/0005-move-c-definitions-out-of-extern-C-block.patch @@ -0,0 +1,130 @@ +From 3748cf904089878971cfcf66abf14c4d74f8241a Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 11 Aug 2017 18:03:07 -0700 +Subject: [PATCH 5/9] move c++ definitions out of extern "C" block + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + decoder/vaapidecoder_host.cpp | 2 +- + encoder/vaapiencoder_host.cpp | 3 ++- + interface/VideoDecoderHost.h | 8 ++++---- + interface/VideoEncoderHost.h | 8 ++++---- + interface/VideoPostProcessHost.h | 8 ++++---- + vpp/vaapipostprocess_host.cpp | 3 +-- + 6 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/decoder/vaapidecoder_host.cpp b/decoder/vaapidecoder_host.cpp +index bcc9165..d9129f3 100644 +--- a/decoder/vaapidecoder_host.cpp ++++ b/decoder/vaapidecoder_host.cpp +@@ -100,9 +100,9 @@ void releaseVideoDecoder(IVideoDecoder * p) + { + delete p; + } ++} // extern "C" + + std::vector<std::string> getVideoDecoderMimeTypes() + { + return VaapiDecoderFactory::keys(); + } +-} // extern "C" +diff --git a/encoder/vaapiencoder_host.cpp b/encoder/vaapiencoder_host.cpp +index 49e903a..3ee9354 100644 +--- a/encoder/vaapiencoder_host.cpp ++++ b/encoder/vaapiencoder_host.cpp +@@ -78,9 +78,10 @@ void releaseVideoEncoder(IVideoEncoder* p) { + delete p; + } + ++} // extern "C" ++ + std::vector<std::string> getVideoEncoderMimeTypes() + { + return VaapiEncoderFactory::keys(); + } + +-} // extern "C" +diff --git a/interface/VideoDecoderHost.h b/interface/VideoDecoderHost.h +index 86210fe..fd2ba7b 100644 +--- a/interface/VideoDecoderHost.h ++++ b/interface/VideoDecoderHost.h +@@ -32,12 +32,12 @@ extern "C" { // for dlsym usage + YamiMediaCodec::IVideoDecoder *createVideoDecoder(const char *mimeType); + /// \brief destroy the decoder + void releaseVideoDecoder(YamiMediaCodec::IVideoDecoder * p); +-/** \fn void getVideoDecoderMimeTypes() +- * \brief return the MimeTypes enabled in the current build +-*/ +-std::vector<std::string> getVideoDecoderMimeTypes(); + + typedef YamiMediaCodec::IVideoDecoder *(*YamiCreateVideoDecoderFuncPtr) (const char *mimeType); + typedef void (*YamiReleaseVideoDecoderFuncPtr)(YamiMediaCodec::IVideoDecoder * p); + } ++// \fn void getVideoDecoderMimeTypes() ++// \brief return the MimeTypes enabled in the current build ++// ++std::vector<std::string> getVideoDecoderMimeTypes(); + #endif /* VIDEO_DECODER_HOST_H_ */ +diff --git a/interface/VideoEncoderHost.h b/interface/VideoEncoderHost.h +index fb80335..5fb5ab3 100644 +--- a/interface/VideoEncoderHost.h ++++ b/interface/VideoEncoderHost.h +@@ -32,12 +32,12 @@ extern "C" { // for dlsym usage + YamiMediaCodec::IVideoEncoder *createVideoEncoder(const char *mimeType); + ///brief destroy encoder + void releaseVideoEncoder(YamiMediaCodec::IVideoEncoder * p); +-/** \fn void getVideoEncoderMimeTypes() +- * \brief return the MimeTypes enabled in the current build +-*/ +-std::vector<std::string> getVideoEncoderMimeTypes(); + + typedef YamiMediaCodec::IVideoEncoder *(*YamiCreateVideoEncoderFuncPtr) (const char *mimeType); + typedef void (*YamiReleaseVideoEncoderFuncPtr)(YamiMediaCodec::IVideoEncoder * p); + } + #endif /* VIDEO_ENCODER_HOST_H_ */ ++// \fn void getVideoEncoderMimeTypes() ++// \brief return the MimeTypes enabled in the current build ++// ++std::vector<std::string> getVideoEncoderMimeTypes(); +diff --git a/interface/VideoPostProcessHost.h b/interface/VideoPostProcessHost.h +index de046cd..f1c5ce5 100644 +--- a/interface/VideoPostProcessHost.h ++++ b/interface/VideoPostProcessHost.h +@@ -34,12 +34,12 @@ YamiMediaCodec::IVideoPostProcess *createVideoPostProcess(const char *mimeType); + * \brief destroy encoder + */ + void releaseVideoPostProcess(YamiMediaCodec::IVideoPostProcess * p); +-/** \fn void getVideoPostProcessMimeTypes() +- * \brief return the MimeTypes enabled in the current build +-*/ +-std::vector<std::string> getVideoPostProcessMimeTypes(); + + typedef YamiMediaCodec::IVideoPostProcess *(*YamiCreateVideoPostProcessFuncPtr) (const char *mimeType); + typedef void (*YamiReleaseVideoPostProcessFuncPtr)(YamiMediaCodec::IVideoPostProcess * p); + } + #endif /* VIDEO_POST_PROCESS_HOST_H_ */ ++// \fn void getVideoPostProcessMimeTypes() ++// \brief return the MimeTypes enabled in the current build ++// ++std::vector<std::string> getVideoPostProcessMimeTypes(); +diff --git a/vpp/vaapipostprocess_host.cpp b/vpp/vaapipostprocess_host.cpp +index cd40dea..bc06b38 100644 +--- a/vpp/vaapipostprocess_host.cpp ++++ b/vpp/vaapipostprocess_host.cpp +@@ -75,10 +75,9 @@ void releaseVideoPostProcess(IVideoPostProcess * p) + { + delete p; + } ++} // extern "C" + + std::vector<std::string> getVideoPostProcessMimeTypes() + { + return VaapiPostProcessFactory::keys(); + } +- +-} // extern "C" +-- +2.14.1 + diff --git a/common/recipes-multimedia/libyami/libyami/0006-Avoid-namespace-conflicts-by-adding-explicit-using-n.patch b/common/recipes-multimedia/libyami/libyami/0006-Avoid-namespace-conflicts-by-adding-explicit-using-n.patch new file mode 100644 index 00000000..c9c74520 --- /dev/null +++ b/common/recipes-multimedia/libyami/libyami/0006-Avoid-namespace-conflicts-by-adding-explicit-using-n.patch @@ -0,0 +1,41 @@ +From 27b61f5ab1b1643436f56517e4980734b4b9acca Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 11 Aug 2017 18:38:05 -0700 +Subject: [PATCH 6/9] Avoid namespace conflicts by adding explicit using + <namespace> + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + decoder/vaapidecoder_h264.h | 1 + + decoder/vaapidecoder_h265.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/decoder/vaapidecoder_h264.h b/decoder/vaapidecoder_h264.h +index 57e2c27..ea5c2f2 100644 +--- a/decoder/vaapidecoder_h264.h ++++ b/decoder/vaapidecoder_h264.h +@@ -30,6 +30,7 @@ namespace YamiMediaCodec { + + class VaapiDecPictureH264; + class VaapiDecoderH264 : public VaapiDecoderBase { ++using YamiMediaCodec::VaapiDecoderBase::createPicture; + public: + typedef SharedPtr<VaapiDecPictureH264> PicturePtr; + typedef std::vector<PicturePtr> RefSet; +diff --git a/decoder/vaapidecoder_h265.h b/decoder/vaapidecoder_h265.h +index f7e2303..159e25f 100644 +--- a/decoder/vaapidecoder_h265.h ++++ b/decoder/vaapidecoder_h265.h +@@ -38,6 +38,7 @@ namespace YamiMediaCodec { + + class VaapiDecPictureH265; + class VaapiDecoderH265:public VaapiDecoderBase { ++ using YamiMediaCodec::VaapiDecoderBase::createPicture; + typedef YamiParser::H265::SPS SPS; + typedef YamiParser::H265::SliceHeader SliceHeader; + typedef YamiParser::H265::NalUnit NalUnit; +-- +2.14.1 + diff --git a/common/recipes-multimedia/libyami/libyami/0007-Delete-unused-variables.patch b/common/recipes-multimedia/libyami/libyami/0007-Delete-unused-variables.patch new file mode 100644 index 00000000..b80774c9 --- /dev/null +++ b/common/recipes-multimedia/libyami/libyami/0007-Delete-unused-variables.patch @@ -0,0 +1,36 @@ +From b982997c96e11b9c0b3cd58a31af2d0a219713a3 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 11 Aug 2017 18:39:58 -0700 +Subject: [PATCH 7/9] Delete unused variables + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + decoder/vaapidecoder_vp8.cpp | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/decoder/vaapidecoder_vp8.cpp b/decoder/vaapidecoder_vp8.cpp +index 5fc89ec..ff5b896 100644 +--- a/decoder/vaapidecoder_vp8.cpp ++++ b/decoder/vaapidecoder_vp8.cpp +@@ -32,12 +32,12 @@ typedef VaapiDecoderVP8::PicturePtr PicturePtr; + + // the following parameter apply to Intra-Predicted Macroblocks, + // $11.2 $11.4: key frame default probs +-static const uint8_t keyFrameYModeProbs[4] = { 145, 156, 163, 128 }; +-static const uint8_t keyFrameUVModeProbs[3] = { 142, 114, 183 }; ++//static const uint8_t keyFrameYModeProbs[4] = { 145, 156, 163, 128 }; ++//static const uint8_t keyFrameUVModeProbs[3] = { 142, 114, 183 }; + + // $16.1: non-key frame default probs +-static const uint8_t nonKeyFrameDefaultYModeProbs[4] = { 112, 86, 140, 37 }; +-static const uint8_t nonKeyFrameDefaultUVModeProbs[3] = { 162, 101, 204 }; ++//static const uint8_t nonKeyFrameDefaultYModeProbs[4] = { 112, 86, 140, 37 }; ++//static const uint8_t nonKeyFrameDefaultUVModeProbs[3] = { 162, 101, 204 }; + + static const uint32_t surfaceNumVP8 = 3; + +-- +2.14.1 + diff --git a/common/recipes-multimedia/libyami/libyami/0008-NalUnit-is-declared-in-different-namespace.patch b/common/recipes-multimedia/libyami/libyami/0008-NalUnit-is-declared-in-different-namespace.patch new file mode 100644 index 00000000..18b98be8 --- /dev/null +++ b/common/recipes-multimedia/libyami/libyami/0008-NalUnit-is-declared-in-different-namespace.patch @@ -0,0 +1,31 @@ +From c54130511c91e457f1c5bb47729f5e3a0fc0cb91 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 11 Aug 2017 18:42:28 -0700 +Subject: [PATCH 8/9] NalUnit is declared in different namespace + +Fixes +vaapidecoder_h265.h:32:5: error: struct 'NalUnit' was previously declared as a class [-Werror,-Wmismatched-tags] struct NalUnit; + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + decoder/vaapidecoder_h265.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/decoder/vaapidecoder_h265.h b/decoder/vaapidecoder_h265.h +index 159e25f..674638f 100644 +--- a/decoder/vaapidecoder_h265.h ++++ b/decoder/vaapidecoder_h265.h +@@ -29,7 +29,7 @@ namespace YamiParser { + namespace H265 { + struct SPS; + struct SliceHeader; +- struct NalUnit; ++ class NalUnit; + class Parser; + }; + }; +-- +2.14.1 + diff --git a/common/recipes-multimedia/libyami/libyami/0009-Fix-clang-warnings.patch b/common/recipes-multimedia/libyami/libyami/0009-Fix-clang-warnings.patch new file mode 100644 index 00000000..08ef455b --- /dev/null +++ b/common/recipes-multimedia/libyami/libyami/0009-Fix-clang-warnings.patch @@ -0,0 +1,37 @@ +From a54dc7b6a777882f55a3f31bd97748a261db03d2 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 11 Aug 2017 18:53:06 -0700 +Subject: [PATCH 9/9] Fix clang warnings + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + encoder/vaapiencoder_h264.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/encoder/vaapiencoder_h264.cpp b/encoder/vaapiencoder_h264.cpp +index 98bc2ed..94015cb 100644 +--- a/encoder/vaapiencoder_h264.cpp ++++ b/encoder/vaapiencoder_h264.cpp +@@ -509,7 +509,7 @@ bit_writer_write_sps(BitWriter* bitwriter, + } + /* vcl_hrd_parameters_present_flag */ + bitwriter->writeBits(0, 1); +- if (nal_hrd_parameters_present_flag || 0/*vcl_hrd_parameters_present_flag*/) { ++ if (nal_hrd_parameters_present_flag || !!(0)/*vcl_hrd_parameters_present_flag*/) { + /* low_delay_hrd_flag */ + bitwriter->writeBits(0, 1); + } +@@ -1889,7 +1889,7 @@ bool VaapiEncoderH264::addSliceHeaders (const PicturePtr& picture) const + sliceParam->num_macroblocks = curSliceMbs; + sliceParam->macroblock_info = VA_INVALID_ID; + sliceParam->slice_type = h264_get_slice_type (picture->m_type); +- assert (sliceParam->slice_type != -1); ++ assert ((int)sliceParam->slice_type != -1); + sliceParam->idr_pic_id = m_idrNum; + sliceParam->pic_order_cnt_lsb = picture->m_poc % m_maxPicOrderCnt; + +-- +2.14.1 + diff --git a/common/recipes-multimedia/libyami/libyami_1.2.0.bb b/common/recipes-multimedia/libyami/libyami_1.2.0.bb new file mode 100644 index 00000000..1d1d02fa --- /dev/null +++ b/common/recipes-multimedia/libyami/libyami_1.2.0.bb @@ -0,0 +1,34 @@ +SUMMARY = "Yami is media infrastructure base on libva" +DESCRIPTION = "Yet Another Media Infrastructure \ +light weight hardware codec library base on VA-API " + +HOMEPAGE = "https://github.com/01org/libyami" +BUGTRACKER = "https://github.com/01org/libyami/issues/new" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=3b83ef96387f14655fc854ddc3c6bd57" + +SRC_URI = "git://github.com/01org/libyami.git;branch=apache \ + file://0001-bitWriter.cpp-Delete-unused-CACHEBYTES.patch \ + file://0002-typecast-index-from-size_t-to-int.patch \ + file://0003-Add-Wno-invalid-offsetof-to-compiler-commandline.patch \ + file://0004-Typecast-POWER32SUB2-to-uint8_t.patch \ + file://0005-move-c-definitions-out-of-extern-C-block.patch \ + file://0006-Avoid-namespace-conflicts-by-adding-explicit-using-n.patch \ + file://0007-Delete-unused-variables.patch \ + file://0008-NalUnit-is-declared-in-different-namespace.patch \ + file://0009-Fix-clang-warnings.patch \ +" +SRCREV = "c884fc3facbf1a0adf2082a1cf95cb146300a5ca" +S = "${WORKDIR}/git" + +PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "x11", "x11", "", d)}" +PACKAGECONFIG[x11] = "--enable-x11,--disable-x11,virtual/libx11 libxrandr libxrender" + +DEPENDS = "libva" +inherit autotools pkgconfig distro_features_check + +REQUIRED_DISTRO_FEATURES = "opengl" + +UPSTREAM_CHECK_URI = "https://github.com/01org/libyami/releases" +UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)" diff --git a/common/recipes-rt/images/core-image-rt-sdk.bb b/common/recipes-rt/images/core-image-rt-sdk.bb new file mode 100644 index 00000000..6b43a872 --- /dev/null +++ b/common/recipes-rt/images/core-image-rt-sdk.bb @@ -0,0 +1,20 @@ +require recipes-core/images/core-image-minimal.bb + +# Skip processing of this recipe if linux-intel-rt is not explicitly specified as the +# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying +# to build multiple virtual/kernel providers. +python () { + if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-intel-rt": + raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-intel-rt to enable it") +} + +DESCRIPTION = "Small image capable of booting a device with a test suite and \ +tools for real-time use. It includes the full meta-toolchain, development \ +headers and libraries to form a standalone SDK." +DEPENDS = "linux-intel-rt" + +IMAGE_FEATURES += "dev-pkgs tools-sdk tools-debug eclipse-debug tools-profile tools-testapps debug-tweaks" + +IMAGE_INSTALL += "rt-tests hwlatdetect kernel-dev" + +LICENSE = "MIT" diff --git a/common/recipes-rt/images/core-image-rt.bb b/common/recipes-rt/images/core-image-rt.bb new file mode 100644 index 00000000..4db0a579 --- /dev/null +++ b/common/recipes-rt/images/core-image-rt.bb @@ -0,0 +1,17 @@ +require recipes-core/images/core-image-minimal.bb + +# Skip processing of this recipe if linux-intel-rt is not explicitly specified as the +# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying +# to build multiple virtual/kernel providers. +python () { + if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-intel-rt": + raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-intel-rt to enable it") +} + +DESCRIPTION = "A small image just capable of allowing a device to boot plus a \ +real-time test suite and tools appropriate for real-time use." +DEPENDS = "linux-intel-rt" + +IMAGE_INSTALL += "rt-tests hwlatdetect" + +LICENSE = "MIT" diff --git a/common/recipes-selftest/images/files/incorrect.crt b/common/recipes-selftest/images/files/incorrect.crt new file mode 100644 index 00000000..3a2411ab --- /dev/null +++ b/common/recipes-selftest/images/files/incorrect.crt @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDCTCCAfGgAwIBAgIJAIYXAHv3cQNjMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNV +BAMMEFRlc3QgWW9jdG8gdGhpbmcwHhcNMTcwMTI1MjI1MjI3WhcNMTgwMTI1MjI1 +MjI3WjAbMRkwFwYDVQQDDBBUZXN0IFlvY3RvIHRoaW5nMIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEAukI2ioMeL8qaXxMtryonAT51w+Zre0wB8bDBPuXD +SwDVXNWfiKKTfCVEkLEUnsUEd7jiKswCT5orTwCD7aQK0mTrkAWEi8hEI3MkNoeh +T51gkuTfv7A/HgPkhhlU4UQqipI6XoLf7o7PUV33ZfB43//iKY2kLBdsFvs4ALWE +31hLOkCFb+nqMnfZxq7DgvBwIdxJdLQvaskpDMfkna+zE3QWqkH5v55atW8Bunwk +/6q5kqNhyrjZb4i0BqJ5AHFUEQzlDcjpyFVUtR14r0IxjBFMHZXrx4uLe7KvGf/4 +GqpqeFOPqxMsfC5ILJJ7nvwFViqftGgtWg/12bKMTB5saQIDAQABo1AwTjAdBgNV +HQ4EFgQURA8KbgpiGfS2+7MT0H5AvpxeYLowHwYDVR0jBBgwFoAURA8KbgpiGfS2 ++7MT0H5AvpxeYLowDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAK9n+ +9T+hlM2kEpsUgtyihEJbGHzbw+Pj11b0ICntCVuPKewtBMveYp8lejrQwMFNGRMt +ZQe1LFb9HcLeM3MLUz9Lm4BJIjkey3Jfq1AskROYk/bJnFIJIx6P3U9gBa20P46X +LH3g6yub1HR7KZC9nfBsak3FPoJR/SYTJs0HsMeL4878+2IbETA4BL0kbKW48FFW +jF4f6don0eiaF8b4KkfbWKrCaEm+LMxbyBEQ6fIb1cmGY8A9A5houjmgi6YWSkoi +SLpOC9TZ2R51fO9rRsv7XwLK0V9o9YaEYPBg6V/TeJl5nxAZBeVTKVTQbBGZY+l2 +nzN0pKsl7RXLf3SRYA== +-----END CERTIFICATE----- diff --git a/common/recipes-selftest/images/files/incorrect.key b/common/recipes-selftest/images/files/incorrect.key new file mode 100644 index 00000000..d05475b6 --- /dev/null +++ b/common/recipes-selftest/images/files/incorrect.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAukI2ioMeL8qaXxMtryonAT51w+Zre0wB8bDBPuXDSwDVXNWf +iKKTfCVEkLEUnsUEd7jiKswCT5orTwCD7aQK0mTrkAWEi8hEI3MkNoehT51gkuTf +v7A/HgPkhhlU4UQqipI6XoLf7o7PUV33ZfB43//iKY2kLBdsFvs4ALWE31hLOkCF +b+nqMnfZxq7DgvBwIdxJdLQvaskpDMfkna+zE3QWqkH5v55atW8Bunwk/6q5kqNh +yrjZb4i0BqJ5AHFUEQzlDcjpyFVUtR14r0IxjBFMHZXrx4uLe7KvGf/4GqpqeFOP +qxMsfC5ILJJ7nvwFViqftGgtWg/12bKMTB5saQIDAQABAoIBAQCEtAox86s9N6d2 +164z3998Zmj3UyL+7K9x6JI2YvMabBSYGOeaLOLRj6fjQxdC63H8brBM958p4di7 +Z82XMco4Dok6yoOeJ+hMLYv+gfGvTJxy7DhyVXsSwok99axg9vUsV3TYw3wSdpNF +EKLkcUldpu0W2ADBHUr4sLI85xctHH3Kt0sNDzhgADFa5rDYACXTKHtFOhEqBIwN +FmbuRQirnErUkI3Pczgl2Xy1MlaozH9CB+bLAb5q2FYu4DKgjl4UorC+w2HV41KH +XoL7L36XXqLRHBfEAwOWb8yro+TK8T7gW7aagTI1wgsbbQkjQmOHxclmJACdMOiJ +DjPeR0GBAoGBAO7i2eaEoKa9QlKokN+93uOJD/F6DBi6jF0vGOqWlF8AVTj3kGL3 +X8fY/avrSlg7hKZWdei+Q5PyZViKxqmHjq781ZisKck52Tqz4s7ylqRXSgStinZr +UqrkShCqZ3g1W91gIeVPQz0/b+gBskoHzQ5WQHfV5v9S1PaxjzcYtCrRAoGBAMea +LcA2jjuEjqxa5v5fh8ygcHasJMRKJxW1OCKiQ94DjjzPsdVqZ1sJZChLW/N3nxe7 +wHlNJmsGbJ2w1zD5+qkkPjLq5Q4B5KAd62NNrWaEHFdEc/PPkn4xP7Zkfuu5K+m2 +7z/MF4ibvVh9PvD3HY8FWKEtkqB4rfD8AoUOVd4ZAoGAXxXAsfa8k2Hl0kzyTXyg +CWV3CSERS46FbFngyw9gw2e4hFJWEG5ym3ONlS60iuY16JelmxyQfYUQPewPI0+n +xZMx2fE9OLFj+++6KbF5sLRl6/K/mF8jqo3vxS5uvPRQOo+XLlUcaHalrm1ub/Um +87v1MT3dEmgACKmoXb/hhuECgYAZluiapePiOYJZEmZe4jx0vXTtofAswhz0qYEC +3663vdj0buQrqjKJ91BB4jdtpT5eOpHYe02blv1B0jQkcUfze1QGDxtCineXF37g +Aktiwzkm7v22mjv7tbCnX4buDZVVp0BQ+4dg2iaSO6xgFC5T8amFMGSF8jLKnGRu +ToIvsQKBgADBTse2vnI85NRsYq48ztQuIU2zlGXIAcoPSvGb8Vhty/joc0jWcI5P +raGXBARbuVlcEapK3mDRfO0CQjDaTPK4EYYJwGp8k33Hkkcbgs4kfm308jRsclMr +YeMwQsYyOv45x4iPCwrqZEhpPDvACBi7DB6QvZ0++vJbobTt1jyi +-----END RSA PRIVATE KEY----- diff --git a/common/recipes-selftest/images/files/refkit-db.crt b/common/recipes-selftest/images/files/refkit-db.crt new file mode 100644 index 00000000..22ad6a89 --- /dev/null +++ b/common/recipes-selftest/images/files/refkit-db.crt @@ -0,0 +1,18 @@ +-----BEGIN CERTIFICATE----- +MIIC+zCCAeOgAwIBAgIJANT2SMJoGZGsMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV +BAMMCXJlZmtpdC1kYjAeFw0xNzA0MjAxMjA2MzJaFw0xODA0MjAxMjA2MzJaMBQx +EjAQBgNVBAMMCXJlZmtpdC1kYjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBALQcIqYiAVfN8U+vcuPZAYBQVe8CXuuZNct/Knn/tT7sXZIGMCDnla2khC4/ ++tdG3Umo6ON5SfaPCx3+Y6jRY6PWDU5sZlzWZibRJpjUT3bJZUhYEwgxvOVHJWWV +OYlfAvHFBhdYygn99h7Fl9qjThpIvs+WJwRLt21ntlAYBHNR0mot3zur8i2V16i4 +qDChq4uSK2A+OuWGQHHBPy0ukOfW7MzCC3mDcW32o6lMzUaB3O/sUb6BKvF4c0Hb +VM58zqLjkE9FGvk9iPwO7dNpIkz6CmnRSMCqqTqzjxA6dqgMej3Yec4clmL0Bu5H +6OBpka7qNM/aqLQ5XvN60IhIR2kCAwEAAaNQME4wHQYDVR0OBBYEFGhgESWFFHgb +Gp9GEuYh5O/7O6rdMB8GA1UdIwQYMBaAFGhgESWFFHgbGp9GEuYh5O/7O6rdMAwG +A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAI/ShHxDR8pr/YeD0O910yBS +cxiqMnH7pfTJEaNoTbed5tlGJNzHwjv5sJj87jRuEJs9RG4zCRG4KdYtBs9nj5aF +nWNyv2RfDePJYxlx1H1MnHdG2iCXbbzdwh/zQDge58xVBXK6JE+zipMMMGDan281 +9vuwH7MA3cSmvOI3waPv2aGG+eukpUU4/06HSkHPbml+l74tIryNoBohj0tykAFc +uqWcLdclJPz/XFgURjAJfFVkgwu5388l7uz3y9vRW5OTyIoQRriwNRxsDY8Dao8b +NmjzU4k2WyGA3uOSUpSXnUmJfT7eKVG6Efe6Afer6sGnLqNNZf1AcfHiP2woy9M= +-----END CERTIFICATE----- diff --git a/common/recipes-selftest/images/files/refkit-db.key b/common/recipes-selftest/images/files/refkit-db.key new file mode 100644 index 00000000..4b54587e --- /dev/null +++ b/common/recipes-selftest/images/files/refkit-db.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC0HCKmIgFXzfFP +r3Lj2QGAUFXvAl7rmTXLfyp5/7U+7F2SBjAg55WtpIQuP/rXRt1JqOjjeUn2jwsd +/mOo0WOj1g1ObGZc1mYm0SaY1E92yWVIWBMIMbzlRyVllTmJXwLxxQYXWMoJ/fYe +xZfao04aSL7PlicES7dtZ7ZQGARzUdJqLd87q/ItldeouKgwoauLkitgPjrlhkBx +wT8tLpDn1uzMwgt5g3Ft9qOpTM1Ggdzv7FG+gSrxeHNB21TOfM6i45BPRRr5PYj8 +Du3TaSJM+gpp0UjAqqk6s48QOnaoDHo92HnOHJZi9AbuR+jgaZGu6jTP2qi0OV7z +etCISEdpAgMBAAECggEAbtXplKbUgL4hQ9JKN2Cxhc7qMv0YgI92BVaqQw1S8ffu +1Q+tynH5MDRPi06gBJ59SvkA6AsZsvrv8nM7zQWd9ZKh+aLHk1X04upOgDoW9JiX +FV/txlslTUrs/ohIMfsgCrweNXvUSTXZobIi8s8QHyipE4HpXMFjjZYHIV7GTlgA +PRgGu3NygbWfR8hcx5JtzVz/jka7FFFSbk/pMr0TeJHXP55VfqWLeeSBQmWwooj2 +QcRfqMXgLKgu6uEggaP5HMcfTuWgWNhbke/596CgsUtQ5Gg64Q6v7cKcPy0/lgn1 +PnvfT9uhgEFDLNFkSBxV3ImrNYo73Nqmbp3w5tK9SQKBgQDs/HW7pNnB0LD51qok +pkX0SBvyKxDT1QuU4z0FY9GT7OKOg8Xa0ZGyErt+ZbyFiyUGF5Axc3rJ3DyGslgu +5O+AqcpCQOlOyovGQ6ST9x/gEeVcRnZn1MV4vMxwaOSXtY7u0IGyaDlFn1QWHWCN +imv8OR6YuhivwBIXGzJ16oEqDwKBgQDCj3ls7tlPrLvUQIh8gfjCoInU8fRAqtAe +Ab/OximLsKQPKLDma6xd+X2Fk8Dowdb88GNT99x3VZjHqVJM9URDkiOGKAXA/rBp +jAXhnQwahT8YCzOUHqDYNMMQrXHvbiHqLodGrrO2WjYNmH69prQAk8WYAIwl+hdx +BS70LGLPBwKBgQDU9RinAkBcFjiyieBjBreeCJ50Q5bfhHbf2EOhcE2IbDo6bteB +Bwmxx3uM3cdHCf6/NrVweqFAfBQ3xlPP8BH4wJrsZoBBOWnZRDfEbzHJnMtK3FbS +fzTkhmQAL4Ibgh9rIxspQtcUZVSees+k4VqgUIPaIoDEjgizktEJfS2MqQKBgQDA +rOFtVaRz2PYyHq6LzxMRe3bEIdDn8cEk1kqjdW9TXV07feqiZmNOtXLvRAG4/63u +1Akp8L6ul2Az6qUMfaBa4nC3vQ7lr9P40qhIZATGhsqS/xTXTPWw55999qZsnL6N +cgKZpw1mOzRohmqNWnfMUotOGsywF1n7nUyAlyxLJQKBgElTaNTFYF3MbGfhl1He +fnDXlf8OCOK1i5oIzMLqverb2UN/qp6p0b3SAtcw5cUXcaPlajHrfYgacF/0Qyua +Cerey9GLEdJ7saDWhz0GyJ8yyEXy8CVs0svVaLPWI0s2B7/obzP9+gTb/WE9qZqu +bNoVEpJ/wZhk+IL4+KPmqphu +-----END PRIVATE KEY----- diff --git a/common/recipes-selftest/images/secureboot-selftest-image-signed.bb b/common/recipes-selftest/images/secureboot-selftest-image-signed.bb new file mode 100644 index 00000000..3ce11f32 --- /dev/null +++ b/common/recipes-selftest/images/secureboot-selftest-image-signed.bb @@ -0,0 +1,6 @@ +require secureboot-selftest-image-unsigned.bb + +IMAGE_FEATURES += "secureboot" + +SECURE_BOOT_SIGNING_KEY ?= "${THISDIR}/files/refkit-db.key" +SECURE_BOOT_SIGNING_CERT ?= "${THISDIR}/files/refkit-db.crt" diff --git a/common/recipes-selftest/images/secureboot-selftest-image-unsigned.bb b/common/recipes-selftest/images/secureboot-selftest-image-unsigned.bb new file mode 100644 index 00000000..e03e7b47 --- /dev/null +++ b/common/recipes-selftest/images/secureboot-selftest-image-unsigned.bb @@ -0,0 +1,20 @@ +require recipes-core/images/core-image-minimal.bb + +DEPENDS_remove = "grub-efi" + +inherit uefi-comboapp + +WKS_FILE = "generic-bootdisk.wks.in" + +do_uefiapp_deploy_append() { + for i in ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.boot*.efi; do + target=`basename $i` + target=`echo $target | sed -e 's/${IMAGE_LINK_NAME}.//'` + + cat > ${IMAGE_ROOTFS}/boot/startup.nsh << EOF +$target +reset +EOF + break + done +} diff --git a/common/recipes-support/sbsigntool/sbsigntool-native_git.bb b/common/recipes-support/sbsigntool/sbsigntool-native_git.bb new file mode 100644 index 00000000..430a6a78 --- /dev/null +++ b/common/recipes-support/sbsigntool/sbsigntool-native_git.bb @@ -0,0 +1,77 @@ +DESCRIPTION = "Utility for signing and verifying files for UEFI Secure Boot" +LICENSE = "GPLv3 & LGPL-2.1 & LGPL-3.0 & MIT" + +# sbsigntool statically links to libccan.a which is built with modules +# passed to "create-ccan-tree" (and their dependencies). Therefore, +# we also keep track of all the ccan module licenses. +LIC_FILES_CHKSUM = "file://LICENSE.GPLv3;md5=9eef91148a9b14ec7f9df333daebc746 \ + file://COPYING;md5=a7710ac18adec371b84a9594ed04fd20 \ + file://lib/ccan.git/ccan/endian/LICENSE;md5=2d5025d4aa3495befef8f17206a5b0a1 \ + file://lib/ccan.git/ccan/htable/LICENSE;md5=2d5025d4aa3495befef8f17206a5b0a1 \ + file://lib/ccan.git/ccan/list/LICENSE;md5=2d5025d4aa3495befef8f17206a5b0a1 \ + file://lib/ccan.git/ccan/read_write_all/LICENSE;md5=2d5025d4aa3495befef8f17206a5b0a1 \ + file://lib/ccan.git/ccan/talloc/LICENSE;md5=2d5025d4aa3495befef8f17206a5b0a1 \ + file://lib/ccan.git/ccan/typesafe_cb/LICENSE;md5=2d5025d4aa3495befef8f17206a5b0a1 \ + file://lib/ccan.git/ccan/failtest/LICENSE;md5=6a6a8e020838b23406c81b19c1d46df6 \ + file://lib/ccan.git/ccan/tlist/LICENSE;md5=6a6a8e020838b23406c81b19c1d46df6 \ + file://lib/ccan.git/ccan/time/LICENSE;md5=838c366f69b72c5df05c96dff79b35f2 \ +" + +# The original upstream is git://kernel.ubuntu.com/jk/sbsigntool but it has +# not been maintained and many patches have been backported in this repo. +SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git;protocol=https;name=sbsigntools \ + git://github.com/rustyrussell/ccan.git;protocol=https;destsuffix=git/lib/ccan.git;name=ccan \ + " + +SRCREV_sbsigntools ?= "efbb550858e7bd3f43e64228d22aea440ef6a14d" +SRCREV_ccan ?= "b1f28e17227f2320d07fe052a8a48942fe17caa5" +SRCREV_FORMAT = "sbsigntools_ccan" + +DEPENDS = "binutils-native gnu-efi-native help2man-native openssl10-native util-linux-native" + +PV = "0.8-git${SRCPV}" + +S = "${WORKDIR}/git" + +inherit native autotools pkgconfig + +do_configure_prepend() { + cd ${S} + + if [ ! -e lib/ccan ]; then + + # Use empty SCOREDIR because 'make scores' is not run. + # The default setting depends on (non-whitelisted) host tools. + sed -i -e 's#^\(SCOREDIR=\).*#\1#' lib/ccan.git/Makefile + + lib/ccan.git/tools/create-ccan-tree \ + --build-type=automake lib/ccan \ + talloc read_write_all build_assert array_size endian + fi + + # Create generatable docs from git + ( + echo "Authors of sbsigntool:" + echo + git log --format='%an' | sort -u | sed 's,^,\t,' + ) > AUTHORS + + # Generate simple ChangeLog + git log --date=short --format='%ad %t %an <%ae>%n%n * %s%n' > ChangeLog + + cd ${B} +} + +def efi_arch(d): + import re + harch = d.getVar("HOST_ARCH") + if re.match("i[3456789]86", harch): + return "ia32" + return harch + +EXTRA_OEMAKE = "\ + INCLUDES+='-I${S}/lib/ccan.git/ \ + -I${STAGING_INCDIR_NATIVE}/efi \ + -I${STAGING_INCDIR_NATIVE} \ + -I${STAGING_INCDIR_NATIVE}/efi/${@efi_arch(d)}' \ + " |