commit 5789f1b122ac5b32dce85e80a36dafe049c757cd Author: brl Date: Mon Dec 4 16:35:46 2017 -0500 Squashed 'meta-intel/' content from commit c811c0b338 git-subtree-dir: meta-intel git-subtree-split: c811c0b33862a2f911fe2afdd2054958b1f28e40 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae17442 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.pyc +*.pyo +*.swp +*.orig +*.rej +*~ diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..a99cbb1 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,87 @@ +This file will only list major changes that occur within a release. +For a full list of changes, view the git log of the repository. + +Rocko Release 11/2017 +===================== + +Moved qat support to separate layer +----------------------------------- +Quick Assist Technology (QAT) is more middleware and should not be part of the +core BSP. The new layer can be found here: +https://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-qat/ + +Moved dpdk support to separate layer +------------------------------------ +We had some requests to make DPDK standalone so that it could be included +without bringing in anything else from meta-intel, as it is not specific to +Intel(R) hardware. The new layer is located here: +https://git.yoctoproject.org/cgit/cgit.cgi/meta-dpdk/ + +Added support for out-of-tree iwlwifi drivers +--------------------------------------------- +Backport-iwlwifi out-of-tree wifi modules are now available via meta-intel. +Backport-iwlwifi brings the latest iwlwifi drivers to almost any kernel +Note that mac80211 and cfg80211 backports are also necessary, which will most +likely cause incompatibility with other in-tree wifi drivers. +See https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi for more info. + +Added support for out-of-tree ixgbe drivers +------------------------------------------- +The out-of-tree ixgbe drivers bring ixgbe support to nearly any kernel. See +here: http://www.intel.com/network/connectivity/products/server_adapters.htm + +Added an implementation of Secure Boot +-------------------------------------- +meta-intel now supports a simple Secure Boot implementation. This implementation +consists of a single binary consisting of an EFI stub, the kernel, an +initrd, and a kernel command line. The binary is then signed via keys defined by +the variables SECUREBOOT_SIGNING_KEY and SECUREBOOT_SIGNING_CERT. These keys +should match the keys embedded in your hardware's firmware. +See documentation/secureboot/README for more information on this feature. + +Improved Yocto Project Compatibility status +------------------------------------------- +The common layer should now be considered Yocto Project compatible - it should +no longer modify OE-core values when adding the layer to your bblayers.conf. +The meta-tlk layer is still not Yocto Project compatible, however. + +Pyro Release 5/2017 +=================== + +Changed default kernel provider from linux-yocto to linux-intel. +---------------------------------------------------------------- +Linux-intel is an Intel(R)-maintained kernel based on the latest stable +branch, along with backports from upstream to better support Intel(R) +hardware. The intel-linux kernel also has a branch with the preempt-rt +patches applied, providing a preempt-rt kernel with no additional work. + +Added QEMU support. +------------------- +We now build several virtio drivers into the kernel by default, and +have qemuboot.conf files for intel-corei7-64 and intel-core2-32 +targets. This allows one to do basic testing on meta-intel images +without having to use hardware. The virtio drivers are added via +KERNEL_FEATURES_INTEL_COMMON. This prevents them from being added to +custom kernels by default. They can be removed by adding the +following to a conf or kernel bbappend file: + KERNEL_FEATURES_INTEL_COMMON_remove = “cfg/virtio.scc” +OVMF firmware is also built and can be used in order to emulate a UEFI +environment. A full runqemu command line for intel-corei7-64 could look +like this: + runqemu core-image-minimal intel-corei7-64 wic ovmf + +Musl support +------------ +Meta-intel is now compatible with the musl C library. You can specify musl +As your C library by adding the following to your local.conf: + TCLIBC = “musl” +Note: there is a known failure with DPDK. + +X32 support +----------- +The meta-intel layer can now build with the x32 tune settings in a multi-lib +setting, it will not work in as the primary MACHINE tune as the bootloader needs +to be built as a 64bit binary. The setup for this would be as follows: + require conf/multilib.conf + MULTILIBS = "multilib:libx32 + DEFAULTTUNE_virtclass-multilib-libx32 = "corei7-64-x32" diff --git a/COPYING.MIT b/COPYING.MIT new file mode 100644 index 0000000..fb950dc --- /dev/null +++ b/COPYING.MIT @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e57d3b9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,5 @@ +All metadata files (including, but not limited to bb, bbappend, +bbclass, inc and conf files) are MIT licensed unless otherwise stated. +Source code included in tree for individual recipes is under the +LICENSE stated in the associated recipe (.bb file) unless otherwise +stated. diff --git a/MAINTAINERS b/MAINTAINERS new file mode 100644 index 0000000..a45da80 --- /dev/null +++ b/MAINTAINERS @@ -0,0 +1,32 @@ +This file contains a list of BSP maintainers for the BSPs contained in +the meta-intel repository. + +The purpose of this file is to provide contact information for +specific BSPs and other code contained within meta-intel. You should +address questions and patches for a particular BSP or other code to +the appropriate maintainer listed in this file, cc'ing the meta-intel +mailing list. This ensures that your question or patch will be +addressed by the appropriate person, and that it will be seen by other +users who may be facing similar problems or questions. + +Please see the top-level README file for guidelines relating to the +details of submitting patches, reporting problems, or asking questions +about any of the BSPs or other recipes contained within meta-intel. + +Descriptions of section entries: + + M: Mail patches to: FullName + F: Files and directories with wildcard patterns. + A trailing slash includes all files and subdirectory files. + F: common/ all files in and below common + F: common/* all files in common, but not below + One pattern per line. Multiple F: lines acceptable. + +Please keep this list in alphabetical order. + +Maintainers List (try to look for most precise areas first) + + ----------------------------------- + +M: Saul Wold +F: * diff --git a/README b/README new file mode 100644 index 0000000..d16f692 --- /dev/null +++ b/README @@ -0,0 +1,481 @@ +meta-intel +========== + +This README file contains information on building and booting +meta-intel BSP layers. Please see the corresponding sections below +for details. + + +Yocto Project Compatible +======================== + +The BSPs contained in this layer are compatible with the Yocto Project +as per the requirements listed here: + + https://www.yoctoproject.org/webform/yocto-project-compatible-registration + + +Dependencies +============ + +This layer depends on: + + URI: git://git.openembedded.org/bitbake + branch: 1.34 + + URI: git://git.openembedded.org/openembedded-core + layers: meta + branch: rocko + + +Table of Contents +================= + + I. Overview + II. Building and booting meta-intel BSP layers + a. Building the intel-common and quark BSP layers + b. Booting the intel-common BSP images + c. Booting the intel-quark BSP image on a Galileo board + III. Technical Miscellany + Benefits of using meta-intel + The intel-common kernel package architecture + Intel-specific machine features + IV. Tested Hardware + V. Guidelines for submitting patches + + +I. Overview +=========== + +This is the location for Intel-maintained BSPs. + +For details on the intel-common and intel-quark BSPs, see the +information below. + +For all others, please see the README files contained in the +individual BSP layers for BSP-specific information. + +If you have problems with or questions about a particular BSP, please +contact the maintainer listed in the MAINTAINERS file directly (cc:ing +the Yocto mailing list puts it in the archive and helps other people +who might have the same questions in the future), but please try to do +the following first: + + - look in the Yocto Project Bugzilla + (http://bugzilla.yoctoproject.org/) to see if a problem has + already been reported + + - look through recent entries of the meta-intel + (https://lists.yoctoproject.org/pipermail/meta-intel/) and Yocto + (https://lists.yoctoproject.org/pipermail/yocto/) mailing list + archives to see if other people have run into similar problems or + had similar questions answered. + +If you believe you have encountered a bug, you can open a new bug and +enter the details in the Yocto Project Bugzilla +(http://bugzilla.yoctoproject.org/). If you're relatively certain +that it's a bug against the BSP itself, please use the 'Yocto Project +Components: BSPs | meta-intel' category for the bug; otherwise, please +submit the bug against the most likely category for the problem - if +you're wrong, it's not a big deal and the bug will be recategorized +upon triage. + + +II. Building and booting meta-intel BSP layers +============================================== + +The following sections contain information on building and booting the +BSPs contained in the meta-intel layer. + +Note that these instructions specifically cover the intel-common and +quark BSPs, which may or may not be applicable to other BSPs contained +in this layer - if a given BSP contains its own README, that version +should be used instead, and these instructions can be ignored. + +a. Building the intel-common and quark BSP layers +------------------------------------------------- + +In order to build an image with BSP support for a given release, you +need to download the corresponding BSP tarball from the 'Board Support +Package (BSP) Downloads' page of the Yocto Project website (or +equivalently, check out the appropriate branch from the meta-intel git +repository, see below). For the intel-common and quark BSPs, those +tarballs would correspond to the following choices in the BSP +downloads section: + + - Intel-core2-32 Intel® Common Core BSP (Intel-core2-32) + - Intel-core2-32 Intel® Common Core BSP (Intel-quark) + - Intel-corei7-64 Intel® Common Core BSP (Intel-corei7-64) + +The intel-* BSPs, also known as the intel-common BSPs, provide a few +carefully selected tune options and generic hardware support to cover +the majority of current Intel CPUs and devices. The naming follows the +convention of intel--, where TUNE is the gcc cpu-type +(used with mtune and march typically) and BITS is either 32 bit or 64 +bit. + +Having done that, and assuming you extracted the BSP tarball contents +at the top-level of your yocto build tree, you can build a BSP image +by adding the location of the meta-intel layer to bblayers.conf e.g.: + + yocto/meta-intel \ + +To enable a particular machine, you need to add a MACHINE line naming +the BSP to the local.conf file: + + MACHINE ?= "xxx" + +where 'xxx' is replaced by one of the following BSP names: + + - intel-core2-32 + + This BSP is optimized for the Core2 family of CPUs as well as all + Atom CPUs prior to the Silvermont core. + + - intel-corei7-64 + + This BSP is optimized for Nehalem and later Core and Xeon CPUs as + well as Silvermont and later Atom CPUs, such as the Baytrail SoCs. + + - intel-quark + + This BSP is optimized for Quark-based systems. + +You should then be able to build an image as such: + + $ source oe-init-build-env + $ bitbake core-image-sato + +At the end of a successful build, you should have an image that +you can boot from a USB flash drive (see instructions on how to do +that below, in the section 'Booting the intel-common BSP images'). + +As an alternative to downloading the BSP tarball, you can also work +directly from the meta-intel git repository. For each BSP in the +'meta-intel' repository, there are multiple branches, one +corresponding to each major release starting with 'laverne' (0.90), in +addition to the latest code which tracks the current master (note that +not all BSPs are present in every release). Instead of extracting +a BSP tarball at the top level of your yocto build tree, you can +equivalently check out the appropriate branch from the meta-intel +repository at the same location. + +b. Booting the intel-common BSP images +-------------------------------------- + +If you downloaded the BSP tarball, you will find bootable images in +the /binary directory. If you've built your own image, either from +the downloaded BSP layer or from the meta-intel git repository, you'll +find the bootable image in the build/tmp/deploy/images/xxx directory, +where again 'xxx' refers to the machine name used in the build. + +The BSP /binary directory or build contains bootable live images, +which can be used to directly boot Yocto off of a USB flash drive. + +Under Linux, insert a USB flash drive. Assuming the USB flash drive +takes device /dev/sdf, use dd to copy the image to it. For example: + + $ dd if=core-image-sato-intel-corei7-64.wic of=/dev/sdf + $ sync + $ eject /dev/sdf + +This should give you a bootable USB flash device. Insert the device +into a bootable USB socket on the target, and power on. This should +result in a system booted to the Sato graphical desktop. + +If you want a terminal, use the arrows at the top of the UI to move to +different pages of available applications, one of which is named +'Terminal'. Clicking that should give you a root terminal. + +If you want to ssh into the system, you can use the root terminal to +ifconfig the IP address and use that to ssh in. The root password is +empty, so to log in type 'root' for the user name and hit 'Enter' at +the Password prompt: and you should be in. + +If you find you're getting corrupt images on the USB (it doesn't show +the syslinux boot: prompt, or the boot: prompt contains strange +characters), try doing this first: + + $ dd if=/dev/zero of=/dev/sdf bs=1M count=512 + +c. Booting the intel-quark BSP image on a Galileo board +------------------------------------------------------- + +If you downloaded the BSP tarball, you will find bootable images in +the /binary directory. If you've built your own image, either from +the downloaded BSP layer or from the meta-intel git repository, you'll +find the bootable image in the build/tmp/deploy/images/xxx directory, +where again 'xxx' refers to the machine name used in the build. + +The Galileo board can boot off of either an SD card or USB storage +media that has a special disk layout. The 'wic' tool can be used to +create directly bootable images for either of the two formats via the +following steps. As of meta-intel 6.0-morty-2.2 or newer, wic images are +created automatically during build time, and the manual use of wic is +not necessary. By default, the galileodisk-sd wic kickstart file is used, +which targets SD cards. This can be changed by setting the WKS_FILE to +something else in local.conf, such as the following: + +WKS_FILE = “galileodisk-usb” + +If your build is successful, a .wic image will be created in the usual +deploy directory. Write this image to an SD card: + + $ sudo dd if=/path/to/image/image-name.wic of=/dev/your_sd_dev + $ sync + $ sudo eject /dev/your_sd_dev + +Insert the SD card into the Galileo and power on. + +The Galileo board can boot from an hddimg formatted USB drive as well, +but currently only live-boot, and not installation, is supported. +An image in hddimg format is generated when you build the quark BSP. +You can follow the procedure in II.b to use dd command to prepare your USB +drive, then press F7 key during startup to bring up the boot option menu. +Choose the UEFI USB boot option for the drive to boot the system. If the board +already passes this stage and show a grub boot menu, you can press 'c' +key and then type "quit" in grub shell. The board should come back to +the UEFI boot menu. + +III. Technical Miscellany +========================= + +Benefits of using meta-intel +---------------------------- + +Using meta-intel has the following benefits over a generic BSP: + +tune flags +++++++++++ +intel-* MACHINEs each have different compilation flags appropriate for their +targeted hardware sets. intel-corei7-64 has tune flags appropriate for modern +64-bit Intel Core i microarchitecture, and includes instruction sets up to +SSE4.2. intel-core2-32 has tune flags appropriate for legacy 32-bit Intel Core2 +microarchitecture, and includes instruction sets up to SSE3. intel-quark +contains a subset of the intel-core2-32 instruction set, as quark does not +support prefix locking instructions. + +linux-intel kernel +++++++++++++++++++ +The linux-intel kernel is an initiative to bring better Intel(R) hardware +support to the current LTS linux kernel. It contains a base LTS kernel with +additional backports from upstream Intel drivers. In addition, a default kernel +config containing most features found on Intel boards is supplied via the +yocto-kernel-cache. + +graphics stack +++++++++++++++ +Meta-intel provides the latest Intel Graphics Linux Stack drivers to support +Intel hardware as defined by the https://01.org/linuxgraphics. + +Other software +++++++++++++++ + * intel ucode - provides the latest microcode updates for Intel processors + + * thermald - which proactively controls thermal, using P-states, T-states, and +the Intel power clamp driver. +(https://01.org/linux-thermal-daemon/documentation/introduction-thermal-daemon) + + * RMC - Runtime Machine Configuration, which allows the bootload to determine +board and CPU information in order to set specific kernel command line +information at startup. + +The intel-common kernel package architecture +-------------------------------------------- + +These BSPs use what we call the intel-common Linux kernel package +architecture. This includes core2-32-intel-common and +corei7-64-intel-common. These kernel packages can also be used by any +of the BSPs in meta-intel that choose to include the +intel-common-pkgarch.inc file. + +To minimize the proliferation of vendor trees, reduce the sources we +must support, and consolidate QA efforts, all BSP maintainers are +encouraged to make use of the intel-common Linux kernel package +architecture. + +Intel-specific machine features +------------------------------- + +The meta-intel layer makes some additional machine features available +to BSPs. These machine features can be used in a BSP layer in the +same way that machine features are used in other layers based on +oe-core, via the MACHINE_FEATURES variable. + +Requirements +++++++++++++ + +The meta-intel-specific machine features are only available to a BSP +when the meta-intel layer is included in the build configuration, and +the meta-intel.inc file is included in the machine configuration of +that BSP. + +To make these features available for your machine, you will need to: + + 1. include a configuration line such as the below in bblayers.conf + BBLAYERS += "/meta-intel" + 2. include the following line in the machine configuration file + require conf/machine/include/meta-intel.inc + +Once the above requirements are met, the machine features provided by +the meta-intel layer will be available for the BSP to use. + +Available machine features +++++++++++++++++++++++++++ + +Currently, the meta-intel layer makes the following set of +Intel-specific machine features available: + + * intel-ucode + +These machine features can be included by listing them in the +MACHINE_FEATURES variable in the machine configuration file. For +example: + + MACHINE_FEATURES += "intel-ucode" + +Machine feature details ++++++++++++++++++++++++ + + * intel-ucode + + This feature provides support for microcode updates to Intel + processors. The intel-ucode feature runs at early boot and uses + the microcode data file added by the feature into the BSP's + initrd. It also puts the userland microcode-updating tool, + iucode_tool, into the target images along with the microcode data + file. + + Q. Why might a user want to enable the intel-ucode feature? + + A. Intel releases microcode updates to correct processor behavior + as documented in the respective processor specification + updates. While the normal approach to getting such microcode + updates is via a BIOS upgrade, this can be an administrative + hassle and not always possible in the field. The intel-ucode + feature enables the microcode update capability present in the + Linux kernel. It provides an easy path for upgrading processor + microcode without the need to change the BIOS. If the feature + is enabled, it is also possible to update the existing target + images with a newer microcode update in the future. + + Q. How would a user bundle only target-specific microcode in the + target image? + + A. The Intel microcode data file released by Intel contains + microcode updates for multiple processors. If the BSP image is + meant to run on only a certain subset of processor types, a + processor-specific subset of microcode can be bundled into the + target image via the UCODE_FILTER_PARAMETERS variable. This + works by listing a sequence of iucode-tool parameters in the + UCODE_FILTER_PARAMETERS variable, which in this case will + select only the specific microcode relevant to the BSP. For + more information on the underlying parameters refer to the + iucode-tool manual page at http://manned.org/iucode-tool + + To define a set of parameters for microcode-filtering via the + UCODE_FILTER_PARAMETERS variable, one needs to identify the + cpuid signatures of all the processors the BSP is meant to run + on. One way to determine the cpuid signature for a specific + processor is to build and run an intel-ucode-feature-enabled + image on the target hardware, without first assigning any value + to the UCODE_FILTER_PARAMETERS variable, and then once the + image is booted, run the "ucode_tool -S" command to have the + ucode tool scan the system for processor signatures. These + signatures can then be used in the UCODE_FILTER_PARAMETERS + variable in conjunction with -s parameter. For example, for + the fri2 BSP, the cpuid can be determined as such: + + [root@fri2 ~]# iucode_tool -S + iucode_tool: system has processor(s) with signature 0x00020661 + + Given that output, a suitable UCODE_FILTER_PARAMETERS variable + definition could be specified in the machine configuration as + such: + + UCODE_FILTER_PARAMETERS = "-s 0x00020661" + + Q. Are there any reasons a user might want to disable the + intel-ucode feature? + + A. The microcode data file and associated tools occupy a small + amount of space (a few KB) on the target image. BSPs which are + highly sensitive to target image size and which are not + experiencing microcode-related issues might consider not + enabling this feature. + + +IV. Tested Hardware +=================== + +The following undergo regular basic testing with their respective MACHINE types. +Note that both 64-bit and 32-bit firmware is available for the MinnowBoard +Turbot, so it is tested against both intel-corei7-64 and intel-core2-32. + +intel-corei7-64: + NUC6i5SYH + MinnowBoard Turbot + Braswell RVP + +intel-core2-32: + MinnowBoard Turbot + +Intel-quark: + Galileo 2 + + +V. Guidelines for submitting patches +==================================== + +Please submit any patches against meta-intel BSPs to the meta-intel +mailing list (meta-intel@yoctoproject.org). Also, if your patches are +available via a public git repository, please also include a URL to +the repo and branch containing your patches as that makes it easier +for maintainers to grab and test your patches. + +There are patch submission scripts available that will, among other +things, automatically include the repo URL and branch as mentioned. +Please see the Yocto Project Development Manual sections entitled +'Using Scripts to Push a Change Upstream and Request a Pull' and +'Using Email to Submit a Patch' for details. + +Regardless of how you submit a patch or patchset, the patches should +at minimum follow the suggestions outlined in the 'Submitting a Change +to the Yocto Project' section in the Yocto Project Development Manual. +Specifically, they should: + + - Include a 'Signed-off-by:' line. A commit can't legally be pulled + in without this. + + - Provide a single-line, short summary of the change. This short + description should be prefixed by the BSP or recipe name, as + appropriate, followed by a colon. Capitalize the first character + of the summary (following the colon). + + - For the body of the commit message, provide detailed information + that describes what you changed, why you made the change, and the + approach you used. + + - If the change addresses a specific bug or issue that is associated + with a bug-tracking ID, include a reference to that ID in your + detailed description in the following format: [YOCTO #]. + + - Pay attention to line length - please don't allow any particular + line in the commit message to stretch past 72 characters. + + - For any non-trivial patch, provide information about how you + tested the patch, and for any non-trivial or non-obvious testing + setup, provide details of that setup. + +Doing a quick 'git log' in meta-intel will provide you with many +examples of good example commits if you have questions about any +aspect of the preferred format. + +The meta-intel maintainers will do their best to review and/or pull in +a patch or patchset within 24 hours of the time it was posted. For +larger and/or more involved patches and patchsets, the review process +may take longer. + +Please see the meta-intel/MAINTAINERS file for the list of maintainers +and their specific areas; it's also a good idea to cc: the specific +maintainer, if applicable. diff --git a/README.sources b/README.sources new file mode 100644 index 0000000..ee72e54 --- /dev/null +++ b/README.sources @@ -0,0 +1,17 @@ +The sources for the packages comprising the images shipped with this +BSP can be found at the following location: + +http://downloads.yoctoproject.org/mirror/sources/ + +The metadata used to generate the images shipped with this BSP, in +addition to the code contained in this BSP, can be found at the +following location: + +http://downloads.yoctoproject.org/releases/yocto/yocto-2.1/poky-krogoth-15.0.tar.bz2 + +The metadata used to generate the images shipped with this BSP, in +addition to the code contained in this BSP, can also be found at the +following locations: + +git://git.yoctoproject.org/poky.git +git://git.yoctoproject.org/meta-intel diff --git a/classes/rmc-boot.bbclass b/classes/rmc-boot.bbclass new file mode 100644 index 0000000..37c3e30 --- /dev/null +++ b/classes/rmc-boot.bbclass @@ -0,0 +1,17 @@ +# rmc-boot bbclass +# Deploy central RMC database file to ESP + +IMAGE_INSTALL_append = " rmc" +RMC_BOOTLOADER ?= "systemd-boot" + +inherit ${RMC_BOOTLOADER} + +do_bootimg[depends] += "${MLPREFIX}rmc-db:do_deploy" + +efi_populate_append() { + if [ -f ${DEPLOY_DIR_IMAGE}/rmc.db ]; then + install -m 0400 ${DEPLOY_DIR_IMAGE}/rmc.db ${DEST}/rmc.db + else + rm -f ${DEST}/rmc.db + fi +} diff --git a/classes/rmc-db.bbclass b/classes/rmc-db.bbclass new file mode 100644 index 0000000..72594d6 --- /dev/null +++ b/classes/rmc-db.bbclass @@ -0,0 +1,92 @@ +# RMC database bbclass +# provide functions to generate RMC database file on build host (native) + +DEPENDS += "rmc-native" + +# rmc_generate_db() +# $1: a list of directories. Each directory holds directories for a group of +# boards. +# $2: path_name of rmc generates database file and records +# +# WARNING: content of directory of database file will be removed. +# +# Each board directory shall contain a fingerprint file (*.fp) at least, with +# optional file blob(s) associated to the type of board. If a board directory +# has no file blob, no record is created for that board. +# +# An example of two directories each of which contains two boards for RMC: +# (All file and directory names are for illustration purpose.) +# +# dir_1/ +# board_1/ +# board_1_fingerprint.fp +# file_1.blob +# board_2/ +# board_2.fp +# dir_2/ +# board_3/ +# b3.fp +# file_1.blob +# file_2.conf +# board_4/ +# board_foo.fp +# mylib.config +# +# To generate a RMC database "rmc.db" with data of all (actually 3) of boards in +# a directory "deploy_dir": +# +# rmc_generate_db "dir_1 dir_2" "deploy_dir/rmc.db" +# +# The board_2 will be skipped. No record or any data for it is packed in +# generated database because it only contains a fingerprint file. +# + +rmc_generate_db () { + RMC_BOARD_DIRS=$1 + + if [ "$#" -ne 2 ]; then + echo "rmc_generate_db(): Wrong number of arguments: $#" + return 1 + fi + + RMC_DB_DIR=$(dirname "$2") + RMC_RECORDS="" + + rm -rf ${RMC_DB_DIR} + mkdir -p ${RMC_DB_DIR} + + # generate rmc database + for topdir in ${RMC_BOARD_DIRS}; do + # For all board dirs in a topdir: + CUR_BOARD_DIRS=$(find ${topdir}/* -type d) + for board_dir in ${CUR_BOARD_DIRS}; do + CUR_FINGERPRINT=$(find ${board_dir}/ -name "*.fp") + + # disallow a board directory without any fingerprint file in it. + if [ -z "${CUR_FINGERPRINT}" ]; then + echo "Cannot find RMC fingerprint file in ${board_dir}" + return 1 + fi + + CUR_FILES=$(find ${board_dir}/ -type f |grep -v '\.fp$' || true) + + # allow a directory only with fingerprint file. Developer may + # check in fingerprint for future use. + if [ -z "${CUR_FILES}" ]; then + continue + fi + + for fp in ${CUR_FINGERPRINT}; do + fullname=$(basename ${fp}) + CUR_TAG="${fullname%.*}" + CUR_RECORD=${RMC_DB_DIR}/${CUR_TAG}.rec + rmc -R -f ${fp} -b ${CUR_FILES} -o ${CUR_RECORD} + RMC_RECORDS="${RMC_RECORDS} ${CUR_RECORD}" + done + done + done + + if [ ! -z "${RMC_RECORDS}" ]; then + rmc -D ${RMC_RECORDS} -o "$2" + fi +} diff --git a/classes/uefi-comboapp.bbclass b/classes/uefi-comboapp.bbclass new file mode 100644 index 0000000..4ecc553 --- /dev/null +++ b/classes/uefi-comboapp.bbclass @@ -0,0 +1,151 @@ +# This class brings a more generic version of the UEFI combo app from refkit to meta-intel. +# It uses a combo file, containing kernel, initramfs and +# command line, presented to the BIOS as UEFI application, by prepending +# it with the efi stub obtained from systemd-boot. + +# Don't add syslinux or build an ISO +PCBIOS_forcevariable = "0" +NOISO_forcevariable = "1" + +# image-live.bbclass will default INITRD_LIVE to the image INITRD_IMAGE creates. +# We want behavior to be consistent whether or not "live" is in IMAGE_FSTYPES, so +# we default INITRD_LIVE to the INITRD_IMAGE as well. +INITRD_IMAGE ?= "core-image-minimal-initramfs" +INITRD_LIVE ?= " ${@ ('${DEPLOY_DIR_IMAGE}/' + d.getVar('INITRD_IMAGE', expand=True) + '-${MACHINE}.cpio.gz') if d.getVar('INITRD_IMAGE', True) else ''}" + +do_uefiapp[depends] += " \ + intel-microcode:do_deploy \ + systemd-boot:do_deploy \ + virtual/kernel:do_deploy \ + " + +# INITRD_IMAGE is added to INITRD_LIVE, which we use to create our initrd, so depend on it if it is set +do_uefiapp[depends] += "${@ '${INITRD_IMAGE}:do_image_complete' if d.getVar('INITRD_IMAGE') else ''}" + +# The image does without traditional bootloader. +# In its place, instead, it uses a single UEFI executable binary, which is +# composed by: +# - an UEFI stub +# The linux kernel can generate a UEFI stub, however the one from systemd-boot can fetch +# the command line from a separate section of the EFI application, avoiding the need to +# rebuild the kernel. +# - the kernel +# - an initramfs (optional) + +def create_uefiapp(d, uuid=None, app_suffix=''): + import glob, re + from subprocess import check_call + + build_dir = d.getVar('B') + deploy_dir_image = d.getVar('DEPLOY_DIR_IMAGE') + image_link_name = d.getVar('IMAGE_LINK_NAME') + + cmdline = '%s/cmdline.txt' % build_dir + linux = '%s/%s' % (deploy_dir_image, d.getVar('KERNEL_IMAGETYPE')) + initrd = '%s/initrd' % build_dir + + stub_path = '%s/linux*.efi.stub' % deploy_dir_image + stub = glob.glob(stub_path)[0] + m = re.match(r"\S*(ia32|x64)(.efi)\S*", os.path.basename(stub)) + app = "boot%s%s%s" % (m.group(1), app_suffix, m.group(2)) + executable = '%s/%s.%s' % (deploy_dir_image, image_link_name, app) + + if d.getVar('INITRD_LIVE'): + with open(initrd, 'wb') as dst: + for cpio in d.getVar('INITRD_LIVE').split(): + with open(cpio, 'rb') as src: + dst.write(src.read()) + initrd_cmd = "--add-section .initrd=%s --change-section-vma .initrd=0x3000000 " % initrd + else: + initrd_cmd = "" + + root = 'root=PARTUUID=%s' % uuid if uuid else '' + + with open(cmdline, 'w') as f: + f.write('%s %s' % (d.getVar('APPEND'), root)) + + objcopy_cmd = ("objcopy " + "--add-section .cmdline=%s --change-section-vma .cmdline=0x30000 " + "--add-section .linux=%s --change-section-vma .linux=0x40000 " + "%s %s %s") % \ + (cmdline, linux, initrd_cmd, stub, executable) + + check_call(objcopy_cmd, shell=True) + +python create_uefiapps () { + # We must clean up anything that matches the expected output pattern, to ensure that + # the next steps do not accidentally use old files. + import glob + pattern = d.expand('${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.boot*.efi') + for old_efi in glob.glob(pattern): + os.unlink(old_efi) + uuid = d.getVar('DISK_SIGNATURE_UUID') + create_uefiapp(d, uuid=uuid) +} + +# This is intentionally split into different parts. This way, derived +# classes or images can extend the individual parts. We can also use +# whatever language (shell script or Python) is more suitable. +python do_uefiapp() { + bb.build.exec_func('create_uefiapps', d) +} + +do_uefiapp[vardeps] += "APPEND DISK_SIGNATURE_UUID INITRD_LIVE KERNEL_IMAGETYPE IMAGE_LINK_NAME" + +uefiapp_deploy_at() { + dest=$1 + for i in ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.boot*.efi; do + target=`basename $i` + target=`echo $target | sed -e 's/${IMAGE_LINK_NAME}.//'` + cp --preserve=timestamps -r $i $dest/$target + done +} + +fakeroot do_uefiapp_deploy() { + rm -rf ${IMAGE_ROOTFS}/boot/* + dest=${IMAGE_ROOTFS}/boot/EFI/BOOT + mkdir -p $dest + uefiapp_deploy_at $dest +} + +do_uefiapp_deploy[depends] += "${PN}:do_uefiapp virtual/fakeroot-native:do_populate_sysroot" + + +# This decides when/how we add our tasks to the image +python () { + image_fstypes = d.getVar('IMAGE_FSTYPES', True) + initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES', True) + + # Don't add any of these tasks to initramfs images + if initramfs_fstypes not in image_fstypes: + bb.build.addtask('uefiapp', 'do_image', 'do_rootfs', d) + bb.build.addtask('uefiapp_deploy', 'do_image', 'do_rootfs', d) +} + +SIGN_AFTER ?= "do_uefiapp" +SIGN_BEFORE ?= "do_uefiapp_deploy" +SIGNING_DIR ?= "${DEPLOY_DIR_IMAGE}" +SIGNING_BINARIES ?= "${IMAGE_LINK_NAME}.boot*.efi" +inherit uefi-sign + +# Legacy hddimg support below this line +efi_hddimg_populate() { + uefiapp_deploy_at "$1" +} + +build_efi_cfg() { + # The command line is built into the combo app, so this is a null op + : +} + +populate_kernel_append() { + # The kernel and initrd are built into the app, so we don't need these + if [ -f $dest/initrd ]; then + rm $dest/initrd + fi + if [ -f $dest/vmlinuz ]; then + rm $dest/vmlinuz + fi +} + +IMAGE_FEATURES[validitems] += "secureboot" diff --git a/classes/uefi-sign.bbclass b/classes/uefi-sign.bbclass new file mode 100644 index 0000000..e8f203b --- /dev/null +++ b/classes/uefi-sign.bbclass @@ -0,0 +1,50 @@ +# By default, sign all .efi binaries in ${B} after compiling and before deploying +SIGNING_DIR ?= "${B}" +SIGNING_BINARIES ?= "*.efi" +SIGN_AFTER ?= "do_compile" +SIGN_BEFORE ?= "do_deploy" + +python () { + import os + import hashlib + + # Ensure that if the signing key or cert change, we rerun the uefiapp process + if bb.utils.contains('IMAGE_FEATURES', 'secureboot', True, False, d): + for varname in ('SECURE_BOOT_SIGNING_CERT', 'SECURE_BOOT_SIGNING_KEY'): + filename = d.getVar(varname) + if filename is None: + bb.fatal('%s is not set.' % varname) + if not os.path.isfile(filename): + bb.fatal('%s=%s is not a file.' % (varname, filename)) + with open(filename, 'rb') as f: + data = f.read() + hash = hashlib.sha256(data).hexdigest() + d.setVar('%s_HASH' % varname, hash) + + # Must reparse and thus rehash on file changes. + bb.parse.mark_dependency(d, filename) + + bb.build.addtask('uefi_sign', d.getVar('SIGN_BEFORE'), d.getVar('SIGN_AFTER'), d) + + # Original binary needs to be regenerated if the hash changes since we overwrite it + # SIGN_AFTER isn't necessarily when it gets generated, but its our best guess + d.appendVarFlag(d.getVar('SIGN_AFTER'), 'vardeps', 'SECURE_BOOT_SIGNING_CERT_HASH SECURE_BOOT_SIGNING_KEY_HASH') +} + +do_uefi_sign() { + if [ -f ${SECURE_BOOT_SIGNING_KEY} ] && [ -f ${SECURE_BOOT_SIGNING_CERT} ]; then + for i in `find ${SIGNING_DIR}/ -name '${SIGNING_BINARIES}'`; do + sbsign --key ${SECURE_BOOT_SIGNING_KEY} --cert ${SECURE_BOOT_SIGNING_CERT} $i + sbverify --cert ${SECURE_BOOT_SIGNING_CERT} $i.signed + mv $i.signed $i + done + fi +} + +do_uefi_sign[depends] += "sbsigntool-native:do_populate_sysroot" + +do_uefi_sign[vardeps] += "SECURE_BOOT_SIGNING_CERT_HASH \ + SECURE_BOOT_SIGNING_KEY_HASH \ + SIGNING_BINARIES SIGNING_DIR \ + SIGN_BEFORE SIGN_AFTER \ + " diff --git a/conf/include/maintainers.inc b/conf/include/maintainers.inc new file mode 100644 index 0000000..7c84020 --- /dev/null +++ b/conf/include/maintainers.inc @@ -0,0 +1,23 @@ +# This file contains a list of recipe maintainers for meta-intel + +RECIPE_MAINTAINER_pn-core-image-rt = "Alejandro Hernandez " +RECIPE_MAINTAINER_pn-core-image-rt-sdk = "Alejandro Hernandez " +RECIPE_MAINTAINER_pn-efilinux = "Alejandro Hernandez " +RECIPE_MAINTAINER_pn-gma500-gfx-check = "Alejandro Hernandez " +RECIPE_MAINTAINER_pn-intel-gpu-tools = "Alejandro Hernandez " +RECIPE_MAINTAINER_pn-intel-microcode = "Alejandro Hernandez " +RECIPE_MAINTAINER_pn-intel-minimal-initramfs = "California Sullivan " +RECIPE_MAINTAINER_pn-iucode-tool = "Alejandro Hernandez " +RECIPE_MAINTAINER_pn-libva-intel-driver = "Alejandro Hernandez " +RECIPE_MAINTAINER_pn-libyami = "Alejandro Hernandez " +RECIPE_MAINTAINER_pn-libyami-utils = "Alejandro Hernandez " +RECIPE_MAINTAINER_pn-linux-intel = "California Sullivan " +RECIPE_MAINTAINER_pn-linux-intel-rt = "California Sullivan " +RECIPE_MAINTAINER_pn-lms7 = "TBD" +RECIPE_MAINTAINER_pn-lms8 = "TBD" +RECIPE_MAINTAINER_pn-rmc = "Todor Minchev " +RECIPE_MAINTAINER_pn-rmc-db = "Todor Minchev " +RECIPE_MAINTAINER_pn-thermald = "Alejandro Hernandez " +RECIPE_MAINTAINER_pn-va-intel = "Alejandro Hernandez " +RECIPE_MAINTAINER_pn-xf86-video-ast = "Alejandro Hernandez " +RECIPE_MAINTAINER_pn-xf86-video-mga = "Alejandro Hernandez " diff --git a/conf/layer.conf b/conf/layer.conf new file mode 100644 index 0000000..2063112 --- /dev/null +++ b/conf/layer.conf @@ -0,0 +1,24 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have recipes-* directories, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "intel" +BBFILE_PATTERN_intel := "^${LAYERDIR}/" +BBFILE_PRIORITY_intel = "5" + +# Additional license directories. +LICENSE_PATH += "${LAYERDIR}/custom-licenses" + +LAYERDEPENDS_intel = "core" +LAYERRECOMMENDS_intel = "dpdk intel-qat" + +# This should only be incremented on significant changes that will +# cause compatibility issues with other layers +LAYERVERSION_intel = "5" +LAYERSERIES_COMPAT_intel = "rocko" + + +require ${LAYERDIR}/conf/include/maintainers.inc diff --git a/conf/machine/include/intel-common-pkgarch.inc b/conf/machine/include/intel-common-pkgarch.inc new file mode 100644 index 0000000..d0f208b --- /dev/null +++ b/conf/machine/include/intel-common-pkgarch.inc @@ -0,0 +1,15 @@ +INTEL_COMMON_PACKAGE_ARCH ?= "${TUNE_PKGARCH}-intel-common" +PACKAGE_ARCH_pn-linux-intel = "${INTEL_COMMON_PACKAGE_ARCH}" +PACKAGE_ARCH_pn-linux-intel-rt = "${INTEL_COMMON_PACKAGE_ARCH}" +PACKAGE_ARCH_pn-linux-intel-tiny = "${INTEL_COMMON_PACKAGE_ARCH}" +PACKAGE_ARCH_pn-linux-intel-dev = "${INTEL_COMMON_PACKAGE_ARCH}" +PACKAGE_ARCH_pn-linux-yocto = "${INTEL_COMMON_PACKAGE_ARCH}" +PACKAGE_ARCH_pn-linux-yocto-rt = "${INTEL_COMMON_PACKAGE_ARCH}" +PACKAGE_ARCH_pn-linux-yocto-tiny = "${INTEL_COMMON_PACKAGE_ARCH}" +PACKAGE_ARCH_pn-linux-yocto-dev = "${INTEL_COMMON_PACKAGE_ARCH}" +PACKAGE_ARCH_pn-intel-microcode = "${INTEL_COMMON_PACKAGE_ARCH}" +PACKAGE_ARCH_pn-backport-iwlwifi = "${INTEL_COMMON_PACKAGE_ARCH}" +PACKAGE_ARCH_pn-ixgbe = "${INTEL_COMMON_PACKAGE_ARCH}" +PACKAGE_ARCH_pn-ixgbevf = "${INTEL_COMMON_PACKAGE_ARCH}" +PACKAGE_EXTRA_ARCHS_append += "${INTEL_COMMON_PACKAGE_ARCH}" +MACHINEOVERRIDES =. "${INTEL_COMMON_PACKAGE_ARCH}:" diff --git a/conf/machine/include/intel-core2-32-common.inc b/conf/machine/include/intel-core2-32-common.inc new file mode 100644 index 0000000..8c46949 --- /dev/null +++ b/conf/machine/include/intel-core2-32-common.inc @@ -0,0 +1,7 @@ +# +# Common configuration for all MACHINEs of the intel-core2 type +# + +DEFAULTTUNE ?= "core2-32" +require conf/machine/include/tune-core2.inc +require conf/machine/include/x86-base.inc diff --git a/conf/machine/include/intel-corei7-64-common.inc b/conf/machine/include/intel-corei7-64-common.inc new file mode 100644 index 0000000..0028256 --- /dev/null +++ b/conf/machine/include/intel-corei7-64-common.inc @@ -0,0 +1,7 @@ +# +# Common configuration for all MACHINES of the intel-corei7-64 type +# + +DEFAULTTUNE ?= "corei7-64" +require conf/machine/include/tune-corei7.inc +require conf/machine/include/x86-base.inc diff --git a/conf/machine/include/intel-quark-common.inc b/conf/machine/include/intel-quark-common.inc new file mode 100644 index 0000000..f7cfe14 --- /dev/null +++ b/conf/machine/include/intel-quark-common.inc @@ -0,0 +1,12 @@ +# +# Common configuration for all MACHINES of the intel-quark type +# + +DEFAULTTUNE ?= "i586-nlp-32" +require conf/machine/include/tune-i586-nlp.inc +require conf/machine/include/x86-base.inc + +# gnutls padlock code uses CMOV instruction in assembly which +# is not valid for Quark. +EXTRA_OECONF_append_pn-gnutls_intel-quark = " --disable-padlock" +EXTRA_OECONF_append_pn-openssl_intel-quark = " no-asm" diff --git a/conf/machine/include/meta-intel.inc b/conf/machine/include/meta-intel.inc new file mode 100644 index 0000000..107f6c9 --- /dev/null +++ b/conf/machine/include/meta-intel.inc @@ -0,0 +1,53 @@ +# +# BSP variables and settings specific to the meta-intel layer. +# You must include the meta-intel layer in your bblayers.conf +# to use them. +# + +# +# XSERVER subcomponents, used to build the XSERVER variable +# + +# Soft set linux-yocto as preferred kernel like x86-base.inc +PREFERRED_PROVIDER_virtual/kernel ?= "linux-intel" +PREFERRED_PROVIDER_virtual/kernel_poky-tiny ?= "linux-intel" +PREFERRED_PROVIDER_virtual/kernel_linuxstdbase ?= "linux-yocto" +PREFERRED_VERSION_linux-intel ?= "4.9%" + +# for Xserver older than 1.13.0 +OLD_XSERVER_X86_EXT = "xserver-xorg-extension-dri \ + xserver-xorg-extension-dri2 \ + xserver-xorg-extension-extmod \ + xserver-xorg-extension-dbe \ + " + +XSERVER_X86_MATROX_MGA = "xf86-video-mga \ + " + +XSERVER_X86_ASPEED_AST = "xf86-video-ast \ + " + +# include the user space intel microcode loading support in the generated images. +MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append = "${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', ' intel-microcode', '', d)} thermald" + +# recommended extra packages common to all intel machines +MACHINE_EXTRA_RRECOMMENDS_append = " kernel-modules linux-firmware" + +# for the early boot time kernel microcode loading support, +# merge the microcode data in the final initrd image. +INITRD_LIVE_prepend = "${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', '${DEPLOY_DIR_IMAGE}/microcode.cpio ', '', d)}" + +DISK_SIGNATURE_UUID ??= "deadbeef-dead-beef-dead-beefdeadbeef" + +EFI_PROVIDER ?= "rmc-boot" +EFI_PROVIDER_x86-x32 = "grub-efi" + +# Add general MACHINEOVERRIDE for meta-intel +MACHINEOVERRIDES =. "intel-x86-common:" + +# Definition of (more or less) suitable virtual machines. +require conf/machine/include/qemuboot-intel.inc + +# Ensure that the extra tools needed by qemu are built when building images +# and tweak machine definition to make the result more usable under qemu. +require conf/machine/include/qemu-intel.inc diff --git a/conf/machine/include/qemu-intel.inc b/conf/machine/include/qemu-intel.inc new file mode 100644 index 0000000..8151040 --- /dev/null +++ b/conf/machine/include/qemu-intel.inc @@ -0,0 +1,19 @@ +# Similar to meta/conf/machine/include/qemu.inc but influences the +# distro content (in particular the kernel) less than qemu.inc. + +# Ensure that qemu gets built when building images. +EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" + +# Build ovmf firmware for uefi support in qemu. +EXTRA_IMAGEDEPENDS += "ovmf" + +# runqemu uses virtio, so we have to enable the corresponding +# kernel drivers. +KERNEL_FEATURES_INTEL_COMMON += "cfg/virtio.scc" + +# Other useful extensions which are not enabled by default: +# rng-tools to take advantage of qemu's virtio-rng-pci device. +# MACHINE_EXTRA_RRECOMMENDS += "rng-tools" + +# Creates the necessary .qemuboot.conf file for each image. +IMAGE_CLASSES += "qemuboot" diff --git a/conf/machine/include/qemuboot-intel.inc b/conf/machine/include/qemuboot-intel.inc new file mode 100644 index 0000000..cb52330 --- /dev/null +++ b/conf/machine/include/qemuboot-intel.inc @@ -0,0 +1,19 @@ +# For runqemu +IMAGE_CLASSES += "qemuboot" +QB_SYSTEM_NAME_intel-core2-32 = "qemu-system-i386" +QB_CPU_intel-core2-32 = "-cpu coreduo" +QB_CPU_KVM_intel-core2-32 = "-cpu kvm32" + +QB_SYSTEM_NAME_intel-corei7-64 = "qemu-system-x86_64" +QB_CPU_intel-corei7-64 = "-cpu Nehalem" +QB_CPU_KVM_intel-corei7-64 = "-cpu kvm64" + +QB_SYSTEM_NAME_intel-quark = "qemu-system-i386" +QB_CPU_intel-quark = "-cpu coreduo" +QB_CPU_KVM_intel-quark = "-cpu kvm32" + +QB_AUDIO_DRV = "alsa" +QB_AUDIO_OPT = "-soundhw ac97,es1370" +QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1" +# Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy +QB_OPT_APPEND = "-vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci" diff --git a/conf/machine/intel-core2-32.conf b/conf/machine/intel-core2-32.conf new file mode 100644 index 0000000..abe6f90 --- /dev/null +++ b/conf/machine/intel-core2-32.conf @@ -0,0 +1,35 @@ +#@TYPE: Machine +#@NAME: intel-core2-32 + +#@DESCRIPTION: Machine configuration for 32 bit Intel Core 2 CPU (and later) with MMX, SSE, SSE2, SSE3, and SSSE3 instruction set support. Supports a moderately wide range of drivers that should boot and be usable on "typical" hardware. + +require conf/machine/include/meta-intel.inc +require conf/machine/include/intel-core2-32-common.inc +require conf/machine/include/intel-common-pkgarch.inc + +MACHINE_FEATURES += "pcbios efi" +MACHINE_FEATURES += "va-impl-intel" +MACHINE_FEATURES += "wifi 3g nfc" +MACHINE_FEATURES += "intel-ucode" + +MACHINE_HWCODECS ?= "va-intel gstreamer1.0-vaapi" + +MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "gma500-gfx-check" + +XSERVER ?= "${XSERVER_X86_BASE} \ + ${XSERVER_X86_EXT} \ + ${XSERVER_X86_FBDEV} \ + ${XSERVER_X86_I915} \ + ${XSERVER_X86_I965} \ + ${XSERVER_X86_MODESETTING} \ + ${XSERVER_X86_VESA} \ + ${XSERVER_X86_ASPEED_AST} \ + " + +SYSLINUX_OPTS = "serial 0 115200" +SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS1 115200;ttyPCH0" +APPEND += "rootwait console=ttyS0,115200 console=ttyPCH0,115200 console=tty0" + +IMAGE_FSTYPES += "wic" +WKS_FILE ?= "${@bb.utils.contains_any("EFI_PROVIDER", "systemd-boot rmc-boot", "systemd-bootdisk.wks", "mkefidisk.wks", d)}" +do_image_wic[depends] += "gptfdisk-native:do_populate_sysroot mtools-native:do_populate_sysroot dosfstools-native:do_populate_sysroot" diff --git a/conf/machine/intel-corei7-64.conf b/conf/machine/intel-corei7-64.conf new file mode 100644 index 0000000..78a1f6e --- /dev/null +++ b/conf/machine/intel-corei7-64.conf @@ -0,0 +1,46 @@ +#@TYPE: Machine +#@NAME: intel-corei7-64 + +#@DESCRIPTION: Machine configuration for 64 bit Intel Core i7 CPU (and later) with MMX, SSE, SSE2, SSE3, and SSSE3 instruction set support. Supports a moderately wide range of drivers that should boot and be usable on "typical" hardware. + +require conf/machine/include/meta-intel.inc +require conf/machine/include/intel-corei7-64-common.inc +require conf/machine/include/intel-common-pkgarch.inc + +MACHINE_FEATURES += "pcbios efi" +MACHINE_FEATURES += "va-impl-intel" +MACHINE_FEATURES += "wifi 3g nfc" +MACHINE_FEATURES += "intel-ucode" + +MACHINE_HWCODECS ?= "va-intel gstreamer1.0-vaapi" + +MACHINE_EXTRA_RRECOMMENDS += "lms8" + +# Enable optional dpdk: +COMPATIBLE_MACHINE_pn-dpdk = "intel-corei7-64" +COMPATIBLE_MACHINE_pn-dpdk-dev-libibverbs = "intel-corei7-64" +DPDK_TARGET_MACHINE ?= "atm" + +# Enable optional QAT items: +COMPATIBLE_MACHINE_pn-openssl-qat = "intel-corei7-64" +COMPATIBLE_MACHINE_pn-qat16 = "intel-corei7-64" +COMPATIBLE_MACHINE_pn-zlib-qat = "intel-corei7-64" + +XSERVER ?= "${XSERVER_X86_BASE} \ + ${XSERVER_X86_EXT} \ + ${XSERVER_X86_FBDEV} \ + ${XSERVER_X86_I915} \ + ${XSERVER_X86_I965} \ + ${XSERVER_X86_MATROX_MGA} \ + ${XSERVER_X86_MODESETTING} \ + ${XSERVER_X86_VESA} \ + ${XSERVER_X86_ASPEED_AST} \ + " + +SYSLINUX_OPTS = "serial 0 115200" +SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS1 115200;ttyS2" +APPEND += "rootwait console=ttyS0,115200 console=tty0" + +IMAGE_FSTYPES += "wic" +WKS_FILE ?= "${@bb.utils.contains_any("EFI_PROVIDER", "systemd-boot rmc-boot", "systemd-bootdisk.wks", "mkefidisk.wks", d)}" +do_image_wic[depends] += "gptfdisk-native:do_populate_sysroot mtools-native:do_populate_sysroot dosfstools-native:do_populate_sysroot" diff --git a/conf/machine/intel-quark.conf b/conf/machine/intel-quark.conf new file mode 100644 index 0000000..17e8c52 --- /dev/null +++ b/conf/machine/intel-quark.conf @@ -0,0 +1,33 @@ +#@TYPE: Machine +#@NAME: quark + +#@DESCRIPTION: Machine configuration for Quark systems + +require conf/machine/include/meta-intel.inc +require conf/machine/include/intel-quark-common.inc +require conf/machine/include/intel-common-pkgarch.inc + +#Avoid pulling in GRUB +MACHINE_ESSENTIAL_EXTRA_RDEPENDS = "" + +MACHINE_FEATURES = "efi usb" +MACHINE_FEATURES += "intel-ucode" + +SERIAL_CONSOLE = "115200 ttyS1" +APPEND += "rootwait console=ttyS1,115200 console=tty0" + +# Bypass the default labels which also has "install" option in OE. +# +# We don't need to do this when constructing direct-boot image with +# wic. But EFI installer in hddimg image doesn't work on quark now, +# so we only provide a live-boot entry in boot menu for images in +# hddimg format. + +LABELS_LIVE = "boot" + +# Ensure that the Lock prefix is omitted for the kernel" +KERNEL_EXTRA_ARGS = "EXTRA_CFLAGS=-Wa,-momit-lock-prefix=yes" + +IMAGE_FSTYPES += "wic" +WKS_FILE ?= "galileodisk-sd.wks" +do_image_wic[depends] += "gptfdisk-native:do_populate_sysroot mtools-native:do_populate_sysroot dosfstools-native:do_populate_sysroot" diff --git a/custom-licenses/BSD_LMS b/custom-licenses/BSD_LMS new file mode 100755 index 0000000..2ea28ff --- /dev/null +++ b/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/custom-licenses/Intel-Microcode-License b/custom-licenses/Intel-Microcode-License new file mode 100644 index 0000000..af5b41c --- /dev/null +++ b/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/documentation/rmc/README b/documentation/rmc/README new file mode 100644 index 0000000..eaa763e --- /dev/null +++ b/documentation/rmc/README @@ -0,0 +1,382 @@ +Runtime Machine Configuration (RMC) +-------------------------------------------------------------------------------- +Table of Contents + +Introduction +Usage +Enable RMC Feature +Examples +Troubleshooting +When you (don't) need RMC feature + + +Introduction: +-------------------------------------------------------------------------------- +RMC Project - a light-weight project provide developers a mechanism to keep +their software implementation board-type agnostic, yet still able to customize +software behavior according to the type of a running board at runtime. Recipes +and bbclasses are available for other components to reuse to construct their own +RMC database. + +RMC Feature - An end-to-end solution based on RMC project to have a generic +image capable to apply board-type-specific quirks and configurations for a board +at runtime. It consists of a modified bootloader (systemd-boot), an updated EFI +installer, recipes, bbclass and RMC project. + +RMC feature supports special customizations cannot be covered by conventional +auto-detection features based on probing a hardware module because they happen +at a board or a product level. For example: + - tty console for kernel log output in kernel cmdline + - default audio route configuration + - network configuration + - UI layout + - requirement to software driven by a mechanical design + - or static configuration bits for a physical bus that doesn't support to + identify devices or their presence at runtime + +An image with the feature has ability to configure supported boards with data +associated only to a type of board to get full functionality of the target at +runtime, yet still with a single image. + +Effect after installation is identical to what a conventional image specially +customized for a type of board (depending on the way to deploy image). + +Main functions of RMC Feature: + +Show board-specific boot entries in boot menu and boot system with configuration +(boot title, boot options, etc) in a selected boot entry. + +Support a "global" kernel boot command line fragment which is effective for all +boot entries. + +Deploy file blobs and create directories specific to the type of running board. + +Beside from this document, you can also find several built-in examples in +common/recipes-bsp/rmc/boards/. Refer to "Examples" section. + +You can also add new board types in your layer via a simple variable. + + + +Usage +-------------------------------------------------------------------------------- +Developers are suggested to organize all board-specific files in their own layer +following this example, so that RMC recipes can pick up them correctly in build. + +- my_top_dir/ Top directory of your board (Note 0) + |- rmc-db.bbappend bbappend file to rmc-db recipe at a lower level + |- rmc/ + |- target_board_1/ subdirectory of a board. + | |- board1.fp fingerprint file must be provided (NOTE 1) + | |- BOOTENTRY.CONFIG optional config file for boot entries. (NOTE 2) + | |- INSTALLER.CONFIG optional config file for installer. (NOTE 3) + | |- POSTINSTALL.sh optional script hook for installer (NOTE 4) + | |- board_file_1 A file blob specific to the type of board + | |- board_file_2 An another file specific to the type of board + | |- ...more files + |- target_board_2/ subdirectory of another board. + |- board_2_v2.fp fingerprint file for board 2. + |- BOOTENTRY.CONFIG + |- INSTALLER.CONFIG + |- board_file_1 + |- ...more files + +Note 0: +Developers are expected to use variable RMC_BOARD_DATA_DIRS to specify data of +boards packed into RMC database file generated in a build. The default value of +the variable in meta-intel specifies a group of boards. They work as examples +and necessary quirks for these boards to function properly. Developers can +override, append to the default boards with data of their own boards in the +database file, or even disable the generation of the database file. + +For example, in your local.conf file: + +This line adds your boards along with the default boards into RMC database file, +assuming you have a directory named "rmc" which has a subdirectory for each +board: + +RMC_BOARD_DATA_DIRS_append = " /path_of/rmc" + +This line directs RMC to pack data of your boards only, without data of the +default boards in meta-intel: + +RMC_BOARD_DATA_DIRS = "/path_of/rmc" + +And this line disables database generation: + +RMC_BOARD_DATA_DIRS = "" + +Please also refer to the "Example 1" in this document. + +Subdirectory is not supported in a board's directory. + +Note 1: +Fingerprint files must be provided and with ".fp" at the end of their names. +Fingerprint can be obtained by running RMC tool on your board. An easy way is to +live-boot USB stick flashed with any image enabled this feature on your board, +then run this command: + +# rmc -F -o my_board.fp + +Or you will need to build RMC tool for the architecture of your board, 32 or +64 bit x86, from RMC project. + +You can run RMC tool without any argument to get usage and examples. + +DO NOT NAME ANY FILE ENDING WITH '.fp' IF IT IS NOT A RMC FINGERPRINT FILE. + +If you do need a .fp file deployed onto target, please rename it in source and +specify the real name of file on target in INSTALLER.CONFIG. + +Note 2: +At runtime, RMC bootloader tries to fetch this file specific to the board at run +time, then tries to fetch each boot entry file specified in BOOTENTRY.CONFIG and +show them in boot menu options. The format of this file is very simple. Each +line is the name of a boot entry file: + +boot.conf +Install.conf +myrmcboot.conf + +Name of a boot entry file is defined by developer so it can be anything. But the +name of config file is what RMC bootloader looks up in RMC database, so it must +be named BOOTENTRY.CONFIG. + +Bootloader skips loading entry conf files from disk once any entry is loaded +from RMC database. + +Note 3: +At runtime, RMC installer tries to fetch INSTALLER.CONFIG file specific to the +board, then tries to fetch each file specified in this config file, and then +deploy the file onto target with its permissions, UID, GID and other attributes +also specified in this config file if file for the board can be retrieved from +RMC database. The format of this file is (# is for comment line) + +# name:uid:gid:mode:path_on_target +# to create a directory, add a “/” at the end of path_on_target: +audio_policy:0:0:600:/etc/audio/ +audio_def_policy:0:0:600:/etc/audio/audio_policy + +The above example creates /etc/audio directory first, then fetch a file named +“audio_def_policy” from RMC database for the board, then copy it to /etc/audio/ +with a new name “audio_policy”. + +If this config file is not provided, No data in RMC database is deployed to the +target. + +Some steps defined by developers could not be supported on a filesystem. +Installer simply ignores any errors in RMC deployment stage. + +The name of this config file is what installer looks up first, so it must be +INSTALLER.CONFIG. + +Note 4: +At the end of RMC deployment during installation, RMC installer queries a script +file POSTINSTALL.sh from RMC database file, and execute it when query is +successful on the running board. This hook provides developers almost ultimate +flexibility to retouch what have been deployed on the target. There are some +steps still can override results from this hook for boot entries and KBOOTPARAM. + + + +Enable RMC Feature +-------------------------------------------------------------------------------- +To enable the RMC feature please add the following variables to your local.conf. + +DISTRO_FEATURES_append = " rmc" +EFI_PROVIDER = "rmc-boot" + +The default EFI bootloader used with RMC is systemd-boot. To change the default +bootloader please overwrite the RMC_BOOTLOADER variable in your local.conf + +Note: +Image could be still bootable if you only have either of two lines, but RMC +feature could not be fully functional, depending on the availability of the +database file, installer and the rmc tool. + +Examples +-------------------------------------------------------------------------------- +We checked in configuration data in common/recipes-bsp/rmc/boards/ for several +boards, to help users to understand the RMC feature. These examples are also for +validation. For any example you find not working as what this section depicts, +it should be treated as a bug to be fixed. + +To test this feature with examples, enable it and build an image first, then +boot the built image on supported boards. Examples are always built in when the +feature is enabled, except for the EXAMPLE 1. + +EXAMPLE 1: Support a new board type: +(1) enable the feature and do a build to get a live-boot image by adding these + lines in conf/local.conf: + DISTRO_FEATURES_append = " rmc" + EFI_PROVIDER = "rmc-boot" + +(2) flash the image to a USB stick and boot it on your board + +(3) in super user mode, run "rmc -F -o my_board.fp" + +(4) create directories in your host "mkdir -p my_top_dir/my_rmc/my_board" + +(5) copy my_board.fp from target to my_top_dir/my_rmc/my_board/ on host + +(6) create a file my_top_dir/my_rmc/my_board/KBOOTPARAM, put some fake + and harmless options in a single line, say, "loglevel=7" + +(7) create a file my_top_dir/rmc-db.bbappend, put this single line in it: + RMC_BOARD_DATA_DIRS_append := " ${THISDIR}/my_rmc" + From parent directory of my_top_dir, the tree should look like: + my_top_dir/ + my_rmc/ + my_board/ + KBOOTPARAM + my_board.fp + rmc-db.bbappend + Later, you can add more board directories in my_rmc directory. + +(8) modify build configuration to add my_top_dir into build, for example, put + this line in a bblayers.conf: + BBFILES += "/full/path/of/my_top_dir/rmc-db.bbappend" + +(9) build image again then boot it on your board + +(10) Once you login to shell, new options should be effective, run this command + "cat /proc/cmdline" to verify the result. + +EXAMPLE 2: Board-specific boot entry +MinnowBoard MAX and B3 version: +common/recipes-bsp/rmc/boards/minnowmax +common/recipes-bsp/rmc/boards/minnowmaxB3 + +We have found two identities (type of board) exist for the "same" Minnow Max +hardware, so they have to be treated as two different types of hardware. The two +examples show you a boot entry specific to a type of board. Titles shown in boot +menu have different names according to the type of running board, "Minnow Max +boot" or "Minnow Max B3 boot". in /proc/cmdline, "console=ttyS0,115200n8" shall +be there. Kernel prints logs from 6-pin FTDI serial port on Minnow Max(s). This +console setting is in board-specific entries, so you won't see it effective if +you select default "boot" entry to boot the device. + +EXAMPLE 3: Board-specific boot entry, global kernel cmdline and installer +NUC Gen 6: +common/recipes-bsp/rmc/boards/nucgen6 +This is a combo example with all supported configuration data for NUC Gen 6 +product. It shows two boot entries in bootloader menu when you boot image on NUC +Gen 6 product, with "NUC Gen6" in entry titles. There shall no any "console=" in +/proc/cmdline when you boot with either of two "NUC Gen6"entries. We designed it +this way because there is no accessible tty port on NUC Gen 6 with housing. The +post-install hook is also provided in this example. + +This example also includes a global kernel cmdline fragment KBOOTPARAM. Content +of KBOOTPARAM shall be at the end of /proc/cmdline no matter which boot entry +you selected to boot NUC Gen6. + +INSTALLER.CONFIG directs installer to create a directory and deploy a file in it +when install the image on NUC Gen6. + +Choose "NUC Gen6 install" boot entry to boot shall start installation. Once +the device reboots after installation, we can verify the configurations. + +The boot entry "NUC Gen6 boot" shall be shown in boot menu. + +The content of KBOOTPARAM shall be in /proc/cmdline too. + +A directory /etc/mylib/ is created and a file "mylib.conf" is there. The content +of that file shall be what we put in mylib.conf in +common/recipes-bsp/rmc/boards/nucgen6 + +POSTINSTALL.sh shows how we get rid of an error message caused by no serial +console available on NUC Gen 6, without creating another static board +configuration. + +EXAMPLE 4: For validation only +T100 (32bit): +common/recipes-bsp/rmc/boards/T100-32bit +This example is provided for validation on 32 bit X86 architecture. It doesn't +provide any new function not mentioned in above examples. + +EXAMPLE 5: RMC for quark +Galileo Gen 2 +common/recipes-bsp/rmc/boards/Galileo2 +This example doesn't show any feature not covered in the above examples. Note +RMC only supports hddimg image format so far. Please refer to the section II.c +in README in meta-intel for how to boot Galileo with images in hddimg format. +Bootloader should show a board-specific boot option "Galileo Gen 2 boot" when +the board boots off. + +Troubleshooting +-------------------------------------------------------------------------------- +Issue: Cannot obtain RMC fingerprint for a board + +RMC tool requires UEFI BIOS and SMBIOS support in firmware. It doesn't support +other type of firmware, e.g. legacy BIOS. It also requires EFI driver enabled +in Linux kernel. + +Issue: Configuration for a board seems not effective at runtime. + +Check if board is booted from the storage where the image or installation lives +when you have multiple boot options in BIOS. On some old hardwares it is not +that obvious as you assume. A build image can support boot from both of legacy +and UEFI mode, but RMC only works with UEFI boot so far. + +Make sure configuration files (BOOTENTRY.CONFIG, INSTALLER.CONFIG and, +KBOOTPARAM ...) are properly named in the board directory. + +Make sure configuration files have correct contents. + +Some file attributes could not be supported by targeted file system. Installer +cannot setup file blobs as you wish. It simply move to the next step if a step +fails. + +Kernel command line can be customized globally with KBOOTPARAM or just in a boot +entry for the type of board. They have different effective scopes. + +If no any board-specific configuration becomes effective on your board but it +works on other boards of same product, you can run rmc tool to obtain +fingerprint file on your board and compare it with fingerprint of a working +board. It is possible they have different firmware versions and unluckily, some +information for fingerprint changes between two versions. You can update BIOS +on every board to the same BIOS version if it is feasible. Otherwise you have +to treat them as two different type of boards. We could extend rmc design to +allow multiple fingerprints in a board directory as a workaround. + +Issue: RMC reports error because it cannot find fingerprint when building image. + +Make sure you have a fingerprint file. Its name must be ended with '.fp'. You +can put a fingerprint file in a board directory and provide data later. + +Issue: Any problems the above troubleshooting cannot help + +Please report it to us. Extra information like the type of your board or a dump +file from dmidecode tool is helpful. We will investigate the problem and keep +improving this feature. + + + + +When you (don't) need RMC feature +-------------------------------------------------------------------------------- +RMC feature is designed to as generic as possible, in order to support a large +number of types of boards. And it shall be designed not to break things when it +is disabled. These considerations help users to decide if they really need or +enable it. + +If you are satisfied with a dedicated build target and image for each board in +your development cycle (source, build, validation, release, etc), you don't need +this feature. + +If you have a generic build for multiple type of boards and features supported +by that build meet your needs to functionality on all of boards, you don't need +to have this feature or you can disable it until you need to check in the first +board's data, in order to apply a quirk or customization only for that board. + +If you want this feature but have concerns to see more and more boards' finger- +prints and data in a generic project, you can have another layer to hold all of +board-specific data to split them from a generic layer at source level. Another +suggestion is always seeking chances not to clone or copy a common configuration +to each board's directory. + + + +Thanks + +Jianxun Zhang diff --git a/documentation/secureboot/README b/documentation/secureboot/README new file mode 100644 index 0000000..3d5703b --- /dev/null +++ b/documentation/secureboot/README @@ -0,0 +1,38 @@ +Currently, only one implementation of Secure Boot is available out of the box, +which is using a single signed EFI application to directly boot the kernel with +an optional initramfs. + +This can be added to your build either through local.conf, or via your own +custom image recipe. + +If you are adding it via local.conf, set the following variables: + +IMAGE_FEATURES += "secureboot" +WKS_FILE = "generic-bootdisk.wks.in" +SECURE_BOOT_SIGNING_KEY = "/path/to/your/signing/key" +SECURE_BOOT_SIGNING_CERT = "/path/to/your/signing/cert" +IMAGE_CLASSES += "uefi-comboapp" + +If working with an image recipe, you can inherit uefi-comboapp directly instead +of using the IMAGE_CLASSES variable. + +The signing keys and certs can be created via openssl commands. Here's an +example: +openssl req -new -x509 -newkey rsa:2048 -subj "/CN=your-subject/" -keyout \ +your-key.key -out your-key.crt -days 365 -nodes -sha256 +openssl x509 -in your-key.crt -out your-key.cer -outform DER + +The .crt file is your SECURE_BOOT_SIGNING_CERT, and the .key file is your +SECURE_BOOT_SIGNING_KEY. + +You should enroll the .crt key in your firmware under the PK, KEK, and DB +options (methods are different depending on your firmware). If a key should ever +become invalid, enroll it under DBX to blacklist it. + +The comboapp can be further manipulated in a number of ways. You can modify the +kernel command line via the APPEND variable, you can change the default UUID via +the DISK_SIGNATURE_UUID variable, and you can modify the contents of the +initramfs via the INITRD_IMAGE or INITRD_LIVE variables. + +A simple Secure Boot enabled image used for testing can be viewed at: +common/recipes-selftest/images/secureboot-selftest-image-signed.bb diff --git a/lib/oeqa/selftest/cases/secureboot.py b/lib/oeqa/selftest/cases/secureboot.py new file mode 100644 index 0000000..4c059e2 --- /dev/null +++ b/lib/oeqa/selftest/cases/secureboot.py @@ -0,0 +1,176 @@ +#!/usr/bin/env python +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# Copyright (c) 2017, Intel Corporation. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# AUTHORS +# Mikko Ylinen +# +# Based on meta/lib/oeqa/selftest/* and meta-refkit/lib/oeqa/selftest/* + +"""Test cases for secure boot with QEMU running OVMF.""" + +import os +import unittest +import re +import glob +from shutil import rmtree, copy + +from oeqa.core.decorator.depends import OETestDepends +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu + +class SecureBootTests(OESelftestTestCase): + """Secure Boot test class.""" + + ovmf_keys_enrolled = False + ovmf_qemuparams = '' + ovmf_dir = '' + test_image_unsigned = 'secureboot-selftest-image-unsigned' + test_image_signed = 'secureboot-selftest-image-signed' + correct_key = 'refkit-db' + incorrect_key = 'incorrect' + + @classmethod + def setUpLocal(self): + + if not SecureBootTests.ovmf_keys_enrolled: + bitbake('ovmf ovmf-shell-image-enrollkeys', output_log=self.logger) + + bb_vars = get_bb_vars(['TMPDIR', 'DEPLOY_DIR_IMAGE']) + + SecureBootTests.ovmf_dir = os.path.join(bb_vars['TMPDIR'], 'oeselftest', 'secureboot', 'ovmf') + bb.utils.mkdirhier(SecureBootTests.ovmf_dir) + + # Copy (all) OVMF in a temporary location + for src in glob.glob('%s/ovmf.*' % bb_vars['DEPLOY_DIR_IMAGE']): + copy(src, SecureBootTests.ovmf_dir) + + SecureBootTests.ovmf_qemuparams = '-drive if=pflash,format=qcow2,file=%s/ovmf.secboot.qcow2' % SecureBootTests.ovmf_dir + + cmd = ("runqemu " + "qemuparams='%s' " + "ovmf-shell-image-enrollkeys wic intel-corei7-64 " + "nographic slirp") % SecureBootTests.ovmf_qemuparams + print('Running "%s"' % cmd) + status = runCmd(cmd) + + if not re.search('info: success', status.output, re.M): + self.fail('Failed to enroll keys. EFI shell log:\n%s' % status.output) + else: + # keys enrolled in ovmf.secboot.vars + SecureBootTests.ovmf_keys_enrolled = True + + @classmethod + def tearDownLocal(self): + # Seems this is mandatory between the tests (a signed image is booted + # when running test_boot_unsigned_image after test_boot_signed_image). + # bitbake('-c clean %s' % test_image, output_log=self.logger) + # + # Whatever the problem was, it no longer seems to be necessary, so + # we can skip the time-consuming clean + full rebuild (5:04 min instead + # of 6:55min here). + pass + + @classmethod + def tearDownClass(self): + bitbake('ovmf-shell-image-enrollkeys:do_cleanall', output_log=self.logger) + rmtree(self.ovmf_dir, ignore_errors=True) + + def secureboot_with_image(self, boot_timeout=300, signing_key=None): + """Boot the image with UEFI SecureBoot enabled and see the result. """ + + config = "" + + if signing_key: + test_image = self.test_image_signed + config += 'SECURE_BOOT_SIGNING_KEY = "${THISDIR}/files/%s.key"\n' % signing_key + config += 'SECURE_BOOT_SIGNING_CERT = "${THISDIR}/files/%s.crt"\n' % signing_key + else: + test_image = self.test_image_unsigned + + self.write_config(config) + bitbake(test_image, output_log=self.logger) + self.remove_config(config) + + # Some of the cases depend on the timeout to expire. Allow overrides + # so that we don't have to wait 1000s which is the default. + overrides = { + 'TEST_QEMUBOOT_TIMEOUT': boot_timeout, + } + + print('Booting %s' % test_image) + + try: + with runqemu(test_image, ssh=False, + runqemuparams='nographic slirp', + qemuparams=self.ovmf_qemuparams, + overrides=overrides, + image_fstype='wic') as qemu: + + cmd = 'uname -a' + + status, output = qemu.run_serial(cmd) + + self.assertTrue(status, 'Could not run \'uname -a\' (status=%s):\n%s' % (status, output)) + + # if we got this far without a correctly signed image, something went wrong + if signing_key != self.correct_key: + self.fail('The image not give a Security violation when expected. Boot log:\n%s' % output) + + + except Exception: + + # Currently runqemu() fails if 'login:' prompt is not seen and it's + # not possible to login as 'root'. Those conditions aren't met when + # booting to EFI shell (See [YOCTO #11438]). We catch the failure + # and parse the boot log to determine the success. Note: the + # timeout triggers verbose bb.error() but that's normal with some + # of the test cases. + + workdir = get_bb_var('WORKDIR', test_image) + bootlog = "%s/testimage/qemu_boot_log" % workdir + + with open(bootlog, "r") as log: + + # This isn't right but all we can do at this point. The right + # approach would run commands in the EFI shell to determine + # the BIOS rejects unsigned and/or images signed with keys in + # dbx key store but that needs changes in oeqa framework. + + output = log.read() + + # PASS if we see a security violation on unsigned or incorrectly signed images, otherwise fail + if signing_key == self.correct_key: + self.fail('Correctly signed image failed to boot. Boot log:\n%s' % output) + elif not re.search('Security Violation', output): + self.fail('The image not give a Security violation when expected. Boot log:\n%s' % output) + + def test_boot_unsigned_image(self): + """ Boot unsigned image with secureboot enabled in UEFI.""" + self.secureboot_with_image(boot_timeout=120, signing_key=None) + + @OETestDepends(['secureboot.SecureBootTests.test_boot_unsigned_image']) + def test_boot_incorrectly_signed_image(self): + """ Boot (correctly) signed image with secureboot enabled in UEFI.""" + self.secureboot_with_image(boot_timeout=120, signing_key=self.incorrect_key) + + @OETestDepends(['secureboot.SecureBootTests.test_boot_incorrectly_signed_image']) + def test_boot_correctly_signed_image(self): + """ Boot (correctly) signed image with secureboot enabled in UEFI.""" + self.secureboot_with_image(boot_timeout=150, signing_key=self.correct_key) diff --git a/recipes-bsp/amt/files/atnetworktool-printf-fix.patch b/recipes-bsp/amt/files/atnetworktool-printf-fix.patch new file mode 100644 index 0000000..6bb03e3 --- /dev/null +++ b/recipes-bsp/amt/files/atnetworktool-printf-fix.patch @@ -0,0 +1,20 @@ +Add a missing debug ifdef causing compilation problems. + +Upstream-Status: Submitted + +Signed-off-by: Tom Zanussi + +Index: lms-7.1.20/src/tools/ATNetworkTool.cpp +=================================================================== +--- lms-7.1.20.orig/src/tools/ATNetworkTool.cpp 2012-04-30 23:24:56.693879920 -0500 ++++ lms-7.1.20/src/tools/ATNetworkTool.cpp 2012-04-30 23:25:32.363473948 -0500 +@@ -302,7 +302,9 @@ + close(s); + return -1; + } ++#ifdef LMS_NET_DEBUG + printf("successfully binded local\n"); ++#endif + + } + if (bind(s, addr, addrlen) == -1) { diff --git a/recipes-bsp/amt/files/readlink-declaration.patch b/recipes-bsp/amt/files/readlink-declaration.patch new file mode 100644 index 0000000..0246d50 --- /dev/null +++ b/recipes-bsp/amt/files/readlink-declaration.patch @@ -0,0 +1,18 @@ +Add a missing include causing compilation (missing declaration) problems. + +Upstream-Status: Submitted + +Signed-off-by: Tom Zanussi + +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 + #include + #include ++#include + + #define AT_VERSION_ARGUMENT "--version" + #define AT_VERSION_MAXSIZE 40 diff --git a/recipes-bsp/amt/lms/0001-Include-sys-select.h-for-fd_set.patch b/recipes-bsp/amt/lms/0001-Include-sys-select.h-for-fd_set.patch new file mode 100644 index 0000000..e28d45a --- /dev/null +++ b/recipes-bsp/amt/lms/0001-Include-sys-select.h-for-fd_set.patch @@ -0,0 +1,28 @@ +From 518a3a277c89a3d6b0a9d3ee552cfa33a1dbd5c6 Mon Sep 17 00:00:00 2001 +From: Jussi Kukkonen +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 +--- + 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 + #include + #include ++#include + #include + #include + #include +-- +2.1.4 + diff --git a/recipes-bsp/amt/lms/0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch b/recipes-bsp/amt/lms/0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch new file mode 100644 index 0000000..17b206e --- /dev/null +++ b/recipes-bsp/amt/lms/0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch @@ -0,0 +1,31 @@ +From 8d737ba9745bef223c3d3b96899f11c26102ea04 Mon Sep 17 00:00:00 2001 +From: Saul Wold +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 +--- + src/Protocol.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Protocol.cpp b/src/Protocol.cpp +index 1c21a0f..3a4a9bb 100755 +--- a/src/Protocol.cpp ++++ b/src/Protocol.cpp +@@ -1428,7 +1428,7 @@ int Protocol::_handleFQDNChange(const char *fqdn) + char host[FQDN_MAX_SIZE + 1]; + #define LMS_MAX_LINE_LEN 1023 + char line[LMS_MAX_LINE_LEN + 1]; +-#define LMS_LINE_SIG_FIRST_WORDS(a) "# LMS GENERATED "a" " ++#define LMS_LINE_SIG_FIRST_WORDS(a) "# LMS GENERATED " a " " + #define LMS_LINE_SIG_LAST_WORD "LINE" + #define LMS_LINE_SIG_LAST_WORD_LEN 4 + #define LMS_LINE_SIG(a) LMS_LINE_SIG_FIRST_WORDS(a) LMS_LINE_SIG_LAST_WORD +-- +2.5.0 + diff --git a/recipes-bsp/amt/lms/0002-Use-proper-netinet-in.h-API.patch b/recipes-bsp/amt/lms/0002-Use-proper-netinet-in.h-API.patch new file mode 100644 index 0000000..fa2e29a --- /dev/null +++ b/recipes-bsp/amt/lms/0002-Use-proper-netinet-in.h-API.patch @@ -0,0 +1,31 @@ +From 0adc925ca9e005f93d77f373ccda2a6c6cc3ff2f Mon Sep 17 00:00:00 2001 +From: Jussi Kukkonen +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 +--- + src/tools/ATNetworkTool.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/tools/ATNetworkTool.cpp b/src/tools/ATNetworkTool.cpp +index 66e27df..0789c79 100755 +--- a/src/tools/ATNetworkTool.cpp ++++ b/src/tools/ATNetworkTool.cpp +@@ -207,7 +207,7 @@ int ATNetworkTool::GetSockPeerIP(int sock, ATAddressList & peerAddresses, int &e + if(sa->sa_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&addr)) //if(IN6_IS_ADDR_V4COMPAT(&addr)) + { + struct in_addr demapped_addr; +- memcpy(&demapped_addr.s_addr, &addr.__in6_u.__u6_addr8[12], 4); ++ memcpy(&demapped_addr.s_addr, &addr.s6_addr[12], 4); + + struct sockaddr_in sa_in; + sa_in.sin_family = AF_INET; +-- +2.1.4 + diff --git a/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch b/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch new file mode 100644 index 0000000..433d301 --- /dev/null +++ b/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch @@ -0,0 +1,91 @@ +Fix device file referance to /dev/mei0, remove select post write. + +LMS uses /dev/mei character device which is absent on current kernel versions causing LMS fail to initialize. LMS sends messages to MEI with a post select timeout. Select timeout causes SendMessage to fail causing LMS to not to communicate properly with MEI. + +Adding /dev/mei0 device file reference to check first and then /dev/mei sucessfully initializes LMS. Rely on write return length and remove select with timeout to fix communication with MEI. + +Upstream-Status: Pending + +Signed-off-by: Anand Vastrad +--- + src/mei/MEILinux.cpp | 43 +++++++------------------------------------ + 1 file changed, 7 insertions(+), 36 deletions(-) + +diff --git a/src/mei/MEILinux.cpp b/src/mei/MEILinux.cpp +index 1e9d28f..6d23f54 100755 +--- a/src/mei/MEILinux.cpp ++++ b/src/mei/MEILinux.cpp +@@ -94,13 +94,17 @@ bool MEILinux::Init(unsigned char reqProtocolVersion) + Deinit(); + } + +- _fd = open("/dev/mei", O_RDWR); ++ _fd = open("/dev/mei0", O_RDWR); + + if (_fd == -1 ) { + if (_verbose) { +- fprintf(stderr, "Error: Cannot establish a handle to the MEI driver\n"); ++ fprintf(stderr, "Warning: Cannot establish a handle to the MEI driver mei0, retrying with mei \n"); ++ } ++ _fd = open("/dev/mei", O_RDWR); ++ if (_fd == -1 ) { ++ fprintf(stderr, "Error: Cannot establish a handle to the MEI driver mei\n"); ++ return false; + } +- return false; + } + _initialized = true; + +@@ -181,13 +185,7 @@ int MEILinux::ReceiveMessage(unsigned char *buffer, int len, unsigned long timeo + int MEILinux::SendMessage(const unsigned char *buffer, int len, unsigned long timeout) + { + int rv = 0; +- int return_length =0; + int error = 0; +- fd_set set; +- struct timeval tv; +- +- tv.tv_sec = timeout / 1000; +- tv.tv_usec =(timeout % 1000) * 1000000; + + if (_verbose) { + fprintf(stdout, "call write length = %d\n", len); +@@ -198,35 +196,8 @@ int MEILinux::SendMessage(const unsigned char *buffer, int len, unsigned long ti + if (_verbose) { + fprintf(stderr,"write failed with status %d %d\n", rv, error); + } +- goto out; +- } +- +- return_length = rv; +- +- FD_ZERO(&set); +- FD_SET(_fd, &set); +- rv = select(_fd+1 ,&set, NULL, NULL, &tv); +- if (rv > 0 && FD_ISSET(_fd, &set)) { +- if (_verbose) { +- fprintf(stderr, "write success\n"); +- } + } +- else if (rv == 0) { +- if (_verbose) { +- fprintf(stderr, "write failed on timeout with status\n"); +- } +- goto out; +- } +- else { //rv<0 +- if (_verbose) { +- fprintf(stderr, "write failed on select with status %d\n", rv); +- } +- goto out; +- } +- +- rv = return_length; + +-out: + if (rv < 0) { + Deinit(); + } +-- +2.7.4 + diff --git a/recipes-bsp/amt/lms/0004-Intel-AMT-ME-real-time-notification-infra.patch b/recipes-bsp/amt/lms/0004-Intel-AMT-ME-real-time-notification-infra.patch new file mode 100644 index 0000000..04f584a --- /dev/null +++ b/recipes-bsp/amt/lms/0004-Intel-AMT-ME-real-time-notification-infra.patch @@ -0,0 +1,2647 @@ +Added Intel AMT ME real time notification infra to LMS. + +Notification support now actively captures all the INTEL AMT ME events by plugging in to APF infra. +These events message are in the WsMan XML format. WsMan XML is parsed to get the AlertID and Message arguments. +A map is initialized initially by reading AMTAlerts.xml which provides alertid,messageArguements and verbose description. +From AlertID, verbose description is obtained and then using d-bus infra verbose description is notified to the user. + +src/tools/utils.cpp Utils class provides static methods for string manipulation and desktop notification. +src/tools/miniXmlParser.cpp MiniXmlParser class provide methods for parsing the xmlBuffer, validation and retreving tag/value. +src/tools/httpParser.cpp HttpParser class provides method to parse http response buffer and populate header,body,headerfields properties. +src/alertDescription.cpp AlertDescription class parses AMTAlerts.xml like xml to populate map of alertId-Arguments and verbose desctiption. +src/alertIndication.cpp AlertIndication class provides binding to some xmlTags. It uses MiniXmlParse to parse xmlBuffer and provides access methods to some of the fields. +src/defaultAlerts.cpp provides default AlertID-Description paris. This is used in absence of AMTAlerts.xml. +src/notifyDesktop.sh is script which uses d-bus infra to pop up desktop notification. The following script can be modified based on device environment and libraries installed. +src/LMEConnection.cpp has modified the buffer 4x times because of the size of AMT ME Xml data. +src/Protocol.cpp [ _UNSHandler(char *data, int dataLength) ] has changes to recieve AMT ME event data, gracefully process the data and close the channel. + +src/tools/miniXmlParser.cpp has derived work from http://info.meshcentral.com/downloads/MeshAgentFullSource.rar microstack. Author: Bryan Y Roe /Intel Corporation. + +Upstream-Status: Pending + +Signed-off-by: AnandVastrad +--- + 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 @@ ++ ++ ++ ++ ++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. ++ ++ +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 + #include + #include +-#include "strings.h" ++#include ++#include + + #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 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 ++#include ++#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 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::listdefaultAlertsList; ++ std::list::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 ++ * iAMT00521 ... ... ++ */ ++ 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(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 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(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::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 ++#include ++class AlertDescription { ++ protected: ++ static bool classInited; ++ static std::string alertXmlFile; ++ static std::string alertXmlFile1; ++ static void initAlertDescription(); ++ static std::map 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 ++ ++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 ++ ++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 headerBody; ++ std::vector 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 HTTP/1.1 ++ * e.g GET 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 field = Utils::split((char*)header[i].c_str(), ":"); ++ if (field.size() < 2) { ++ rc = -1; ++ break; ++ } ++ headerFields.insert(std::pair(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::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 ++#include ++#include ++ ++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 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 ++#include ++#include ++#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 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 xmlFields; ++ std::list temp2; ++ std::list tagValue; ++ ++ XMLNode *rootNode = NULL;; ++ XMLNode *current = NULL; ++ XMLNode *newNode = NULL; ++ std::list::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. ("", 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')||(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 tags; ++ std::list temp; ++ std::list temp2; ++ std::list::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 ++#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 ++#include "utils.h" ++#include ++#include ++ ++std::vector Utils::split(char const * str, char const * delim) { ++ char* tok = (char*)str; ++ char* ptok = tok; ++ int delimLength = 0; ++ std::vector 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 Utils::split(char const* str, unsigned int strLength, char const* delim, unsigned int delimLength) { ++ char* tok = (char*)str; ++ char* ptok = tok; ++ std::list 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 ++#include ++#include ++#include ++#include ++ ++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 split(char const* str, char const * delim); ++ static std::list 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 ++XMLNode::XMLNode() { ++ tagName = NULL; ++ nsTag = NULL; ++ tagLength = 0; ++ nsLength = 0; ++ startTag = 0; ++ emptyTag = 0; ++ ++ closingTag = NULL; ++ startingTag = NULL; ++ parentNode = NULL; ++ childNode = NULL; ++ siblingNode = NULL; ++} +diff --git a/src/tools/xmlNode.h b/src/tools/xmlNode.h +new file mode 100644 +index 0000000..4a6c91e +--- /dev/null ++++ b/src/tools/xmlNode.h +@@ -0,0 +1,49 @@ ++/******************************************************************************* ++ * Copyright (C) 2017 Intel Corporation. All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * ++ * - Redistributions of source code must retain the above copyright notice, ++ * this list of conditions and the following disclaimer. ++ * ++ * - Redistributions in binary form must reproduce the above copyright notice, ++ * this list of conditions and the following disclaimer in the documentation ++ * and/or other materials provided with the distribution. ++ * ++ * - Neither the name of Intel Corporation. nor the names of its ++ * contributors may be used to endorse or promote products derived from this ++ * software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS ++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ *******************************************************************************/ ++#ifndef __XMLNODE_H ++#define __XMLNODE_H ++class XMLNode { ++ ++ public: ++ char* tagName; ++ char* nsTag; ++ int tagLength; ++ int nsLength; ++ int startTag; ++ int emptyTag; ++ ++ XMLNode* closingTag; ++ XMLNode* startingTag; ++ XMLNode* parentNode; ++ XMLNode* childNode; ++ XMLNode* siblingNode; ++ XMLNode(); ++}; ++#endif +-- +2.9.3 + diff --git a/recipes-bsp/amt/lms7_7.1.20.bb b/recipes-bsp/amt/lms7_7.1.20.bb new file mode 100644 index 0000000..eca3681 --- /dev/null +++ b/recipes-bsp/amt/lms7_7.1.20.bb @@ -0,0 +1,58 @@ +DESCRIPTION = "Intel Local Manageability Service allows applications \ +to access the Intel Active Management Technology (AMT) firmware via \ +the Intel Management Engine Interface (MEI)." +HOMEPAGE = "http://software.intel.com/en-us/articles/download-the-latest-intel-amt-open-source-drivers" + +LICENSE = "BSD_LMS" + +PR = "r0" +BPN="lms" +PV_SUB = "25" +SRC_URI = "http://software.intel.com/sites/default/files/m/4/e/a/9/b/37962-${BPN}_${PV}.${PV_SUB}.zip \ + file://atnetworktool-printf-fix.patch \ + file://readlink-declaration.patch \ + file://0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch \ + file://0001-Include-sys-select.h-for-fd_set.patch \ + file://0002-Use-proper-netinet-in.h-API.patch \ + " + +LOCALSRC = "file://${WORKDIR}/outputdir/${BPN}-${PV}-${PV_SUB}.tar.gz" + +COMPATIBLE_HOST = '(i.86|x86_64).*-linux' + +LIC_FILES_CHKSUM = "file://COPYING;md5=7264184cf88d9f27b719a9656255b47b" + +SRC_URI[md5sum] = "687b76e78bfdbcf567c0e842c1fe240a" +SRC_URI[sha256sum] = "cc0457f0044e924794bb1aeae9a72c28666a525cd8a963d0d92970222946e75b" + +inherit autotools update-rc.d + +INITSCRIPT_NAME = "lms7" +INITSCRIPT_PARAMS = "defaults" + +python do_unpack() { + s = d.getVar('S', True) + d.setVar('S', '${WORKDIR}/outputdir') + bb.build.exec_func('base_do_unpack', d) + # temorarily change SRC_URI for unpack + src_uri = d.getVar('SRC_URI', True) + d.setVar('SRC_URI', '${LOCALSRC}') + d.setVar('S', s) + bb.build.exec_func('base_do_unpack', d) + d.setVar('SRC_URI', src_uri) +} + + +do_install_append () { + mv ${D}/${sbindir}/lms ${D}/${sbindir}/lms7 + install -d ${D}${sysconfdir}/init.d + # The configure script looks at the host to decide where to put init + # scripts, so move it at the same time as renaming it. + if test -f ${D}${sysconfdir}/rc.d/init.d/lms ; then + mv ${D}${sysconfdir}/rc.d/init.d/lms ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} + else + mv ${D}${sysconfdir}/init.d/lms ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} + fi + sed -i 's/^NAME=lms/NAME=lms7/' ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} + rmdir ${D}${datadir} || : +} diff --git a/recipes-bsp/amt/lms8_8.0.0-7.bb b/recipes-bsp/amt/lms8_8.0.0-7.bb new file mode 100644 index 0000000..9b37b9b --- /dev/null +++ b/recipes-bsp/amt/lms8_8.0.0-7.bb @@ -0,0 +1,46 @@ +DESCRIPTION = "Intel Local Manageability Service allows applications \ +to access the Intel Active Management Technology (AMT) firmware via \ +the Intel Management Engine Interface (MEI)." +HOMEPAGE = "http://software.intel.com/en-us/articles/download-the-latest-intel-amt-open-source-drivers" + +LICENSE = "BSD_LMS" + +PR = "r0" +BPN="lms" +SRC_URI = "http://software.intel.com/sites/default/files/${BPN}-${PV}.tar.gz \ + file://readlink-declaration.patch \ + file://0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch \ + file://0001-Include-sys-select.h-for-fd_set.patch \ + file://0002-Use-proper-netinet-in.h-API.patch \ + file://0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch \ + file://0004-Intel-AMT-ME-real-time-notification-infra.patch \ + " + +FILES_${PN} += "${datadir}/xml/AMTAlerts.xml" + +COMPATIBLE_HOST = '(i.86|x86_64).*-linux' + +LIC_FILES_CHKSUM = "file://COPYING;md5=ec77c894e8a1a89fa07aed2c76680ab8" + +SRC_URI[md5sum] = "3cbd027a0e6e9ced8238478b24cde3c6" +SRC_URI[sha256sum] = "7077db6f2f381e67cb37565b20c40ff0c7d3f98f014e65622a4b4b66c2b1d637" + +inherit autotools update-rc.d + +INITSCRIPT_NAME = "lms8" +INITSCRIPT_PARAMS = "defaults" + + +do_install_append () { + mv ${D}/${sbindir}/lms ${D}/${sbindir}/lms8 + install -d ${D}${sysconfdir}/init.d + # The configure script looks at the host to decide where to put init + # scripts, so move it at the same time as renaming it. + if test -f ${D}${sysconfdir}/rc.d/init.d/lms ; then + mv ${D}${sysconfdir}/rc.d/init.d/lms ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} + else + mv ${D}${sysconfdir}/init.d/lms ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} + fi + sed -i 's/^NAME=lms/NAME=lms8/' ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} + rmdir ${D}${datadir} || : +} diff --git a/recipes-bsp/efilinux/efilinux/0001-Disable-address-of-packed-member-warning.patch b/recipes-bsp/efilinux/efilinux/0001-Disable-address-of-packed-member-warning.patch new file mode 100644 index 0000000..afb9951 --- /dev/null +++ b/recipes-bsp/efilinux/efilinux/0001-Disable-address-of-packed-member-warning.patch @@ -0,0 +1,33 @@ +From 7c171c1813651a3a02ad2cda361b42ebc7ce324d Mon Sep 17 00:00:00 2001 +From: Khem Raj +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 +--- +Upstream-Status: Pending + + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index a955e34..ff1b79b 100644 +--- a/Makefile ++++ b/Makefile +@@ -61,7 +61,7 @@ ifeq ($(ARCH),ia32) + endif + endif + ifeq ($(ARCH),x86_64) +- CFLAGS += -mno-red-zone ++ CFLAGS += -mno-red-zone -Wno-address-of-packed-member + endif + + LDFLAGS=-T $(LDSCRIPT) -Bsymbolic -shared -nostdlib -znocombreloc \ +-- +2.14.1 + diff --git a/recipes-bsp/efilinux/efilinux/0002-initialize-char-pointers.patch b/recipes-bsp/efilinux/efilinux/0002-initialize-char-pointers.patch new file mode 100644 index 0000000..127c187 --- /dev/null +++ b/recipes-bsp/efilinux/efilinux/0002-initialize-char-pointers.patch @@ -0,0 +1,33 @@ +From 49053e4ff0f3550d019cdad8a93677c18fc69791 Mon Sep 17 00:00:00 2001 +From: Khem Raj +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 +--- +Upstream-Status: Pending + + entry.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/entry.c b/entry.c +index 0aa6cdd..23ba51e 100644 +--- a/entry.c ++++ b/entry.c +@@ -402,9 +402,9 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *_table) + WCHAR *error_buf; + EFI_STATUS err; + EFI_LOADED_IMAGE *info; +- CHAR16 *name, *options; ++ CHAR16 *name = NULL, *options; + UINT32 options_size; +- char *cmdline; ++ char *cmdline = NULL; + + InitializeLib(image, _table); + sys_table = _table; +-- +2.14.1 + diff --git a/recipes-bsp/efilinux/efilinux_1.1.bb b/recipes-bsp/efilinux/efilinux_1.1.bb new file mode 100644 index 0000000..63e80f8 --- /dev/null +++ b/recipes-bsp/efilinux/efilinux_1.1.bb @@ -0,0 +1,38 @@ +DESCRIPTION = "A UEFI OS loader" +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://efilinux.h;beginline=5;endline=27;md5=f8d56e644672ac63fd81b55c205283ad" + +DEPENDS = "gnu-efi" + +inherit deploy + +SRCREV = "a995826f9e43f1134baea61610eafd8c173bb776" +PV = "1.1+git${SRCPV}" + +SRC_URI = "git://git.kernel.org/pub/scm/boot/efilinux/efilinux.git \ + file://0001-Disable-address-of-packed-member-warning.patch \ + file://0002-initialize-char-pointers.patch \ + " + +S = "${WORKDIR}/git" + +COMPATIBLE_HOST = '(x86_64|i.86).*-(linux|freebsd.*)' + +EXTRA_OEMAKE = "INCDIR=${STAGING_INCDIR} LIBDIR=${STAGING_LIBDIR}" + +# syslinux uses $LD for linking, strip `-Wl,' so it can work +export LDFLAGS = "`echo $LDFLAGS | sed 's/-Wl,//g'`" + +do_deploy () { + install ${S}/efilinux.efi ${DEPLOYDIR}/efilinux.efi +} +addtask deploy before do_build after do_compile + +python () { + ccargs = d.getVar('TUNE_CCARGS').split() + if '-mx32' in ccargs: + # use x86_64 EFI ABI + ccargs.remove('-mx32') + ccargs.append('-m64') + d.setVar('TUNE_CCARGS', ' '.join(ccargs)) +} diff --git a/recipes-bsp/formfactor/formfactor/machconfig b/recipes-bsp/formfactor/formfactor/machconfig new file mode 100644 index 0000000..73695fa --- /dev/null +++ b/recipes-bsp/formfactor/formfactor/machconfig @@ -0,0 +1,39 @@ +# Note: superuser permission is required to run usbhid-dump +# successfully. + +# HEX keys are according to the USB HID spec and USB HID usage table +# We can add more keys as needed in the future. + +# This test may not be very accurate, as we only look for the first +# two lines of a descriptor section. Example: +# +# 001:003:000:DESCRIPTOR 1460501386.337809 +# 05 01 09 02 A1 01 09 01 A1 00 05 09 19 01 29 03 +# 15 00 25 01 95 03 75 01 81 02 .. .. .. .. .. .. +# .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. +# +# By doing so we eliminate false matches when HEX keys are in the lines +# in the middle of the whole descriptor section. + +if type usbhid-dump &>/dev/null; then + if USBHID_DUMP_OUTPUT=$(usbhid-dump -e descriptor 2>/dev/null|grep -A1 DESCRIPTOR); then + # checker for generic USB HID keyboard + USBHID_KBD_CMD="grep -E '^ 05 01 09 06'" + + # checker for touch screen + USBHID_TS_CMD="grep -E '^ 05 0D 09 04'" + + if echo "$USBHID_DUMP_OUTPUT"|eval $USBHID_TS_CMD &>/dev/null; then + HAVE_TOUCHSCREEN=1 + fi + + if echo "$USBHID_DUMP_OUTPUT"|eval $USBHID_KBD_CMD &>/dev/null; then + HAVE_KEYBOARD=1 + else + # config script in OE will set HAVE_KEYBOARD=1 + # if we don't set any value. We have to explicitly + # tell it when keyboard is not detected. + HAVE_KEYBOARD=0 + fi + fi +fi diff --git a/recipes-bsp/formfactor/formfactor_0.0.bbappend b/recipes-bsp/formfactor/formfactor_0.0.bbappend new file mode 100644 index 0000000..6dd422a --- /dev/null +++ b/recipes-bsp/formfactor/formfactor_0.0.bbappend @@ -0,0 +1 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:" diff --git a/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.conf b/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.conf new file mode 100644 index 0000000..74d33c8 --- /dev/null +++ b/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.conf @@ -0,0 +1,2 @@ +# Mimic modprobe's install funcitonality with busybox's modprobe +install gma500_gfx dmesg | grep gma500_gfx_checked || { /etc/modprobe.d/gma500-gfx-check.sh || modprobe gma500_gfx; } diff --git a/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.sh b/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.sh new file mode 100644 index 0000000..75cda99 --- /dev/null +++ b/recipes-bsp/gma500-gfx-check/gma500-gfx-check/gma500-gfx-check.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# Check for devices we wish to avoid gma500_gfx for +DEVICES="0x8119 0x4108" + +# Checked flag to avoid infinite modprobe +echo "gma500_gfx_checked" >> /dev/kmsg; + +for DEVICE in $DEVICES; do + if udevadm trigger --subsystem-match=pci --verbose --attr-match=device=$DEVICE | grep "pci" >> /dev/null ; then + echo "Found $DEVICE, avoiding gma500_gfx module" >> /dev/kmsg; + exit 0 + fi +done +exit 1 diff --git a/recipes-bsp/gma500-gfx-check/gma500-gfx-check_1.0.bb b/recipes-bsp/gma500-gfx-check/gma500-gfx-check_1.0.bb new file mode 100644 index 0000000..7b08064 --- /dev/null +++ b/recipes-bsp/gma500-gfx-check/gma500-gfx-check_1.0.bb @@ -0,0 +1,18 @@ +SUMMARY = "Intel gma500_gfx fix for certain hardware" +DESCRIPTION = "Avoid inserting gma500_gfx module for certain hardware devices." +LICENSE="GPLv2" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" + +SRC_URI = "file://gma500-gfx-check.conf \ + file://gma500-gfx-check.sh " + +do_install(){ + install -d ${D}${sysconfdir}/modprobe.d/ + install -m 755 ${WORKDIR}/gma500-gfx-check.sh ${D}${sysconfdir}/modprobe.d/gma500-gfx-check.sh + install -m 644 ${WORKDIR}/gma500-gfx-check.conf ${D}${sysconfdir}/modprobe.d/gma500-gfx-check.conf +} + +FILES_${PN}="${sysconfdir}/modprobe.d/gma500-gfx-check.conf \ + ${sysconfdir}/modprobe.d/gma500-gfx-check.sh" + +COMPATIBLE_MACHINE = "intel-core2-32" diff --git a/recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG new file mode 100644 index 0000000..dd1b911 --- /dev/null +++ b/recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG @@ -0,0 +1,3 @@ +boot.conf +install.conf + diff --git a/recipes-bsp/rmc/boards/Galileo2/boot.conf b/recipes-bsp/rmc/boards/Galileo2/boot.conf new file mode 100644 index 0000000..580ea48 --- /dev/null +++ b/recipes-bsp/rmc/boards/Galileo2/boot.conf @@ -0,0 +1,4 @@ +title Galileo Gen 2 boot +linux /vmlinuz +initrd /initrd +options LABEL=boot rootwait console=ttyS1,115200 diff --git a/recipes-bsp/rmc/boards/Galileo2/gallieo2.fp b/recipes-bsp/rmc/boards/Galileo2/gallieo2.fp new file mode 100755 index 0000000..fe77d4d Binary files /dev/null and b/recipes-bsp/rmc/boards/Galileo2/gallieo2.fp differ diff --git a/recipes-bsp/rmc/boards/Galileo2/install.conf b/recipes-bsp/rmc/boards/Galileo2/install.conf new file mode 100644 index 0000000..688c2a8 --- /dev/null +++ b/recipes-bsp/rmc/boards/Galileo2/install.conf @@ -0,0 +1,4 @@ +title Galileo Gen 2 install +linux /vmlinuz +initrd /initrd +options LABEL=install-efi rootwait console=ttyS1,115200 diff --git a/recipes-bsp/rmc/boards/MinnowboardTurbot/KBOOTPARAM b/recipes-bsp/rmc/boards/MinnowboardTurbot/KBOOTPARAM new file mode 100644 index 0000000..476b1fb --- /dev/null +++ b/recipes-bsp/rmc/boards/MinnowboardTurbot/KBOOTPARAM @@ -0,0 +1 @@ +console=ttyS0,115200 diff --git a/recipes-bsp/rmc/boards/MinnowboardTurbot/minnowboardturbot.fp b/recipes-bsp/rmc/boards/MinnowboardTurbot/minnowboardturbot.fp new file mode 100644 index 0000000..9aa145f Binary files /dev/null and b/recipes-bsp/rmc/boards/MinnowboardTurbot/minnowboardturbot.fp differ diff --git a/recipes-bsp/rmc/boards/NUC5i5RYB/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/NUC5i5RYB/BOOTENTRY.CONFIG new file mode 100644 index 0000000..b2fabe8 --- /dev/null +++ b/recipes-bsp/rmc/boards/NUC5i5RYB/BOOTENTRY.CONFIG @@ -0,0 +1,2 @@ +boot.conf +install.conf diff --git a/recipes-bsp/rmc/boards/NUC5i5RYB/INSTALLER.CONFIG b/recipes-bsp/rmc/boards/NUC5i5RYB/INSTALLER.CONFIG new file mode 100644 index 0000000..ca5f04b --- /dev/null +++ b/recipes-bsp/rmc/boards/NUC5i5RYB/INSTALLER.CONFIG @@ -0,0 +1,2 @@ +efi_entry_dir:root:disk:770:/boot/loader/entries/ +boot.conf:root:disk:770:/boot/loader/entries/rmcboot.conf diff --git a/recipes-bsp/rmc/boards/NUC5i5RYB/POSTINSTALL.sh b/recipes-bsp/rmc/boards/NUC5i5RYB/POSTINSTALL.sh new file mode 100644 index 0000000..6694261 --- /dev/null +++ b/recipes-bsp/rmc/boards/NUC5i5RYB/POSTINSTALL.sh @@ -0,0 +1,2 @@ +# There is no tty device on this board. +sed -i '/start_getty.\+ttyS.*/d' /tgt_root/etc/inittab diff --git a/recipes-bsp/rmc/boards/NUC5i5RYB/boot.conf b/recipes-bsp/rmc/boards/NUC5i5RYB/boot.conf new file mode 100644 index 0000000..b29fa45 --- /dev/null +++ b/recipes-bsp/rmc/boards/NUC5i5RYB/boot.conf @@ -0,0 +1,4 @@ +title NUC5i5RYB boot +linux /vmlinuz +initrd /initrd +options LABEL=boot rootwait diff --git a/recipes-bsp/rmc/boards/NUC5i5RYB/install.conf b/recipes-bsp/rmc/boards/NUC5i5RYB/install.conf new file mode 100644 index 0000000..0dca3ca --- /dev/null +++ b/recipes-bsp/rmc/boards/NUC5i5RYB/install.conf @@ -0,0 +1,4 @@ +title NUC5i5RYB install +linux /vmlinuz +initrd /initrd +options LABEL=install-efi rootwait diff --git a/recipes-bsp/rmc/boards/NUC5i5RYB/nuc5i5.fp b/recipes-bsp/rmc/boards/NUC5i5RYB/nuc5i5.fp new file mode 100644 index 0000000..5737477 Binary files /dev/null and b/recipes-bsp/rmc/boards/NUC5i5RYB/nuc5i5.fp differ diff --git a/recipes-bsp/rmc/boards/T100-32bit/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/T100-32bit/BOOTENTRY.CONFIG new file mode 100644 index 0000000..b2fabe8 --- /dev/null +++ b/recipes-bsp/rmc/boards/T100-32bit/BOOTENTRY.CONFIG @@ -0,0 +1,2 @@ +boot.conf +install.conf diff --git a/recipes-bsp/rmc/boards/T100-32bit/T100-32bit.fp b/recipes-bsp/rmc/boards/T100-32bit/T100-32bit.fp new file mode 100644 index 0000000..86ecea7 Binary files /dev/null and b/recipes-bsp/rmc/boards/T100-32bit/T100-32bit.fp differ diff --git a/recipes-bsp/rmc/boards/T100-32bit/boot.conf b/recipes-bsp/rmc/boards/T100-32bit/boot.conf new file mode 100644 index 0000000..f1578e0 --- /dev/null +++ b/recipes-bsp/rmc/boards/T100-32bit/boot.conf @@ -0,0 +1,4 @@ +title T100T(32bit) boot +linux /vmlinuz +initrd /initrd +options LABEL=boot loglevel=8 diff --git a/recipes-bsp/rmc/boards/T100-32bit/install.conf b/recipes-bsp/rmc/boards/T100-32bit/install.conf new file mode 100644 index 0000000..67e7eb1 --- /dev/null +++ b/recipes-bsp/rmc/boards/T100-32bit/install.conf @@ -0,0 +1,4 @@ +title T100T(32bit) install +linux /vmlinuz +initrd /initrd +options LABEL=install-efi diff --git a/recipes-bsp/rmc/boards/broxton-m/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/broxton-m/BOOTENTRY.CONFIG new file mode 100644 index 0000000..b2fabe8 --- /dev/null +++ b/recipes-bsp/rmc/boards/broxton-m/BOOTENTRY.CONFIG @@ -0,0 +1,2 @@ +boot.conf +install.conf diff --git a/recipes-bsp/rmc/boards/broxton-m/INSTALLER.CONFIG b/recipes-bsp/rmc/boards/broxton-m/INSTALLER.CONFIG new file mode 100644 index 0000000..ecd2060 --- /dev/null +++ b/recipes-bsp/rmc/boards/broxton-m/INSTALLER.CONFIG @@ -0,0 +1,3 @@ +# Keep rmc Joule boot.conf instead of meta-intel default +efi_entry_dir:root:disk:770:/boot/loader/entries/ +boot.conf:root:disk:770:/boot/loader/entries/boot.conf diff --git a/recipes-bsp/rmc/boards/broxton-m/KBOOTPARAM b/recipes-bsp/rmc/boards/broxton-m/KBOOTPARAM new file mode 100644 index 0000000..08be5df --- /dev/null +++ b/recipes-bsp/rmc/boards/broxton-m/KBOOTPARAM @@ -0,0 +1 @@ +video=efifb maxcpus=4 reboot=efi kmemleak=off console=tty0 console=ttyS2,115200 diff --git a/recipes-bsp/rmc/boards/broxton-m/POSTINSTALL.sh b/recipes-bsp/rmc/boards/broxton-m/POSTINSTALL.sh new file mode 100644 index 0000000..30bbd28 --- /dev/null +++ b/recipes-bsp/rmc/boards/broxton-m/POSTINSTALL.sh @@ -0,0 +1,2 @@ +# Joule uses only S2 for serial, so remove S0 +sed -i '/start_getty.\+ttyS0/d' /tgt_root/etc/inittab diff --git a/recipes-bsp/rmc/boards/broxton-m/bm-1F1.fp b/recipes-bsp/rmc/boards/broxton-m/bm-1F1.fp new file mode 100755 index 0000000..1a15028 Binary files /dev/null and b/recipes-bsp/rmc/boards/broxton-m/bm-1F1.fp differ diff --git a/recipes-bsp/rmc/boards/broxton-m/bm.fp b/recipes-bsp/rmc/boards/broxton-m/bm.fp new file mode 100755 index 0000000..135a7a5 Binary files /dev/null and b/recipes-bsp/rmc/boards/broxton-m/bm.fp differ diff --git a/recipes-bsp/rmc/boards/broxton-m/boot.conf b/recipes-bsp/rmc/boards/broxton-m/boot.conf new file mode 100644 index 0000000..caa00c5 --- /dev/null +++ b/recipes-bsp/rmc/boards/broxton-m/boot.conf @@ -0,0 +1,4 @@ +title Joule / Broxton-m +linux /vmlinuz +initrd /initrd +options LABEL=boot diff --git a/recipes-bsp/rmc/boards/broxton-m/install.conf b/recipes-bsp/rmc/boards/broxton-m/install.conf new file mode 100644 index 0000000..9cdd86b --- /dev/null +++ b/recipes-bsp/rmc/boards/broxton-m/install.conf @@ -0,0 +1,4 @@ +title Joule / Broxton-m Install +linux /vmlinuz +initrd /initrd +options LABEL=install-efi rootwait diff --git a/recipes-bsp/rmc/boards/broxton-m/joule-1F1.fp b/recipes-bsp/rmc/boards/broxton-m/joule-1F1.fp new file mode 100644 index 0000000..d757614 Binary files /dev/null and b/recipes-bsp/rmc/boards/broxton-m/joule-1F1.fp differ diff --git a/recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG new file mode 100644 index 0000000..b2fabe8 --- /dev/null +++ b/recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG @@ -0,0 +1,2 @@ +boot.conf +install.conf diff --git a/recipes-bsp/rmc/boards/minnowmax/boot.conf b/recipes-bsp/rmc/boards/minnowmax/boot.conf new file mode 100644 index 0000000..6e789cd --- /dev/null +++ b/recipes-bsp/rmc/boards/minnowmax/boot.conf @@ -0,0 +1,4 @@ +title Minnow Max boot +linux /vmlinuz +initrd /initrd +options LABEL=boot console=ttyS0,115200n8 diff --git a/recipes-bsp/rmc/boards/minnowmax/install.conf b/recipes-bsp/rmc/boards/minnowmax/install.conf new file mode 100644 index 0000000..1a493ae --- /dev/null +++ b/recipes-bsp/rmc/boards/minnowmax/install.conf @@ -0,0 +1,4 @@ +title Minnow Max install +linux /vmlinuz +initrd /initrd +options LABEL=install-efi console=ttyS0,115200n8 diff --git a/recipes-bsp/rmc/boards/minnowmax/minnowmax.fp b/recipes-bsp/rmc/boards/minnowmax/minnowmax.fp new file mode 100644 index 0000000..3c5a286 Binary files /dev/null and b/recipes-bsp/rmc/boards/minnowmax/minnowmax.fp differ diff --git a/recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG new file mode 100644 index 0000000..b2fabe8 --- /dev/null +++ b/recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG @@ -0,0 +1,2 @@ +boot.conf +install.conf diff --git a/recipes-bsp/rmc/boards/minnowmaxB3/boot.conf b/recipes-bsp/rmc/boards/minnowmaxB3/boot.conf new file mode 100644 index 0000000..577e5d6 --- /dev/null +++ b/recipes-bsp/rmc/boards/minnowmaxB3/boot.conf @@ -0,0 +1,4 @@ +title Minnow Max B3 boot +linux /vmlinuz +initrd /initrd +options LABEL=boot console=ttyS0,115200n8 diff --git a/recipes-bsp/rmc/boards/minnowmaxB3/install.conf b/recipes-bsp/rmc/boards/minnowmaxB3/install.conf new file mode 100644 index 0000000..cf500d6 --- /dev/null +++ b/recipes-bsp/rmc/boards/minnowmaxB3/install.conf @@ -0,0 +1,4 @@ +title Minnow Max B3 install +linux /vmlinuz +initrd /initrd +options LABEL=install-efi console=ttyS0,115200n8 diff --git a/recipes-bsp/rmc/boards/minnowmaxB3/minnowmaxB3.fp b/recipes-bsp/rmc/boards/minnowmaxB3/minnowmaxB3.fp new file mode 100644 index 0000000..ad3f0d6 Binary files /dev/null and b/recipes-bsp/rmc/boards/minnowmaxB3/minnowmaxB3.fp differ diff --git a/recipes-bsp/rmc/boards/mohonpeak/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/mohonpeak/BOOTENTRY.CONFIG new file mode 100644 index 0000000..b2fabe8 --- /dev/null +++ b/recipes-bsp/rmc/boards/mohonpeak/BOOTENTRY.CONFIG @@ -0,0 +1,2 @@ +boot.conf +install.conf diff --git a/recipes-bsp/rmc/boards/mohonpeak/INSTALLER.CONFIG b/recipes-bsp/rmc/boards/mohonpeak/INSTALLER.CONFIG new file mode 100644 index 0000000..8c5a767 --- /dev/null +++ b/recipes-bsp/rmc/boards/mohonpeak/INSTALLER.CONFIG @@ -0,0 +1,3 @@ +# Keep rmc Mohonpeak boot.conf instead of meta-intel default +efi_entry_dir:root:disk:770:/boot/loader/entries/ +boot.conf:root:disk:770:/boot/loader/entries/boot.conf diff --git a/recipes-bsp/rmc/boards/mohonpeak/KBOOTPARAM b/recipes-bsp/rmc/boards/mohonpeak/KBOOTPARAM new file mode 100644 index 0000000..169056e --- /dev/null +++ b/recipes-bsp/rmc/boards/mohonpeak/KBOOTPARAM @@ -0,0 +1 @@ +console=ttyS1,115200 console=tty1 diff --git a/recipes-bsp/rmc/boards/mohonpeak/POSTINSTALL.sh b/recipes-bsp/rmc/boards/mohonpeak/POSTINSTALL.sh new file mode 100644 index 0000000..5f440c3 --- /dev/null +++ b/recipes-bsp/rmc/boards/mohonpeak/POSTINSTALL.sh @@ -0,0 +1,3 @@ +# Mohonpeak uses only S1 for serial, so remove S0 and S2 +sed -i '/start_getty.\+ttyS0/d' /tgt_root/etc/inittab +sed -i '/start_getty.\+ttyS2/d' /tgt_root/etc/inittab diff --git a/recipes-bsp/rmc/boards/mohonpeak/boot.conf b/recipes-bsp/rmc/boards/mohonpeak/boot.conf new file mode 100644 index 0000000..5b7a0f6 --- /dev/null +++ b/recipes-bsp/rmc/boards/mohonpeak/boot.conf @@ -0,0 +1,4 @@ +title Mohon Peak boot +linux /vmlinuz +initrd /initrd +options LABEL=boot diff --git a/recipes-bsp/rmc/boards/mohonpeak/install.conf b/recipes-bsp/rmc/boards/mohonpeak/install.conf new file mode 100644 index 0000000..dde3497 --- /dev/null +++ b/recipes-bsp/rmc/boards/mohonpeak/install.conf @@ -0,0 +1,4 @@ +title Mohon Peak Install +linux /vmlinuz +initrd /initrd +options LABEL=install-efi rootwait diff --git a/recipes-bsp/rmc/boards/mohonpeak/mohonpeak.fp b/recipes-bsp/rmc/boards/mohonpeak/mohonpeak.fp new file mode 100644 index 0000000..bc4bdae Binary files /dev/null and b/recipes-bsp/rmc/boards/mohonpeak/mohonpeak.fp differ diff --git a/recipes-bsp/rmc/boards/nucgen6/BOOTENTRY.CONFIG b/recipes-bsp/rmc/boards/nucgen6/BOOTENTRY.CONFIG new file mode 100644 index 0000000..b2fabe8 --- /dev/null +++ b/recipes-bsp/rmc/boards/nucgen6/BOOTENTRY.CONFIG @@ -0,0 +1,2 @@ +boot.conf +install.conf diff --git a/recipes-bsp/rmc/boards/nucgen6/INSTALLER.CONFIG b/recipes-bsp/rmc/boards/nucgen6/INSTALLER.CONFIG new file mode 100644 index 0000000..7d5378b --- /dev/null +++ b/recipes-bsp/rmc/boards/nucgen6/INSTALLER.CONFIG @@ -0,0 +1,6 @@ +# This file specifies which file or dir RMC will install onto target. +# Note the absolute path is referred from mount points in installation. +efi_entry_dir:root:disk:770:/boot/loader/entries/ +boot.conf:root:disk:770:/boot/loader/entries/rmcboot.conf +mylibdir:root:root:770:/tgt_root/etc/mylib/ +mylib.conf:root:root:660:/tgt_root/etc/mylib/mylib.conf diff --git a/recipes-bsp/rmc/boards/nucgen6/KBOOTPARAM b/recipes-bsp/rmc/boards/nucgen6/KBOOTPARAM new file mode 100644 index 0000000..27943b4 --- /dev/null +++ b/recipes-bsp/rmc/boards/nucgen6/KBOOTPARAM @@ -0,0 +1 @@ +i915.preliminary_hw_support=1 diff --git a/recipes-bsp/rmc/boards/nucgen6/POSTINSTALL.sh b/recipes-bsp/rmc/boards/nucgen6/POSTINSTALL.sh new file mode 100644 index 0000000..bec3be4 --- /dev/null +++ b/recipes-bsp/rmc/boards/nucgen6/POSTINSTALL.sh @@ -0,0 +1,7 @@ +# NUC Gen 6 specific retouch after RMC deployment + +# The generated inittab from OE build causes error messages: +# "auth.err getty[615]: tcgetattr: Input/output error" +# in /var/log/messages because NUC Gen 6 doesn't have any +# serial tty. We delete line(s) here on target. +sed -i '/start_getty.\+ttyS.*/d' /tgt_root/etc/inittab diff --git a/recipes-bsp/rmc/boards/nucgen6/boot.conf b/recipes-bsp/rmc/boards/nucgen6/boot.conf new file mode 100644 index 0000000..e6ecb02 --- /dev/null +++ b/recipes-bsp/rmc/boards/nucgen6/boot.conf @@ -0,0 +1,4 @@ +title NUC Gen6 boot +linux /vmlinuz +initrd /initrd +options LABEL=boot diff --git a/recipes-bsp/rmc/boards/nucgen6/install.conf b/recipes-bsp/rmc/boards/nucgen6/install.conf new file mode 100644 index 0000000..916bb04 --- /dev/null +++ b/recipes-bsp/rmc/boards/nucgen6/install.conf @@ -0,0 +1,4 @@ +title NUC Gen6 install +linux /vmlinuz +initrd /initrd +options LABEL=install-efi diff --git a/recipes-bsp/rmc/boards/nucgen6/mylib.conf b/recipes-bsp/rmc/boards/nucgen6/mylib.conf new file mode 100644 index 0000000..fd8357c --- /dev/null +++ b/recipes-bsp/rmc/boards/nucgen6/mylib.conf @@ -0,0 +1,7 @@ +# This is a demo conf file read by an imagined program or library +# which reads this file at runtime to customize its behavior. +# rmc will deploy it to the location specified in INSTALLER.CONFIG. + +lib.info = "V1.0 for rmc demo" +lib.board = "NUC gen 6" +prog.ui.layout = "minimal" diff --git a/recipes-bsp/rmc/boards/nucgen6/nuc6.fp b/recipes-bsp/rmc/boards/nucgen6/nuc6.fp new file mode 100644 index 0000000..834f800 Binary files /dev/null and b/recipes-bsp/rmc/boards/nucgen6/nuc6.fp differ diff --git a/recipes-bsp/rmc/boards/qemu-2.6/KBOOTPARAM b/recipes-bsp/rmc/boards/qemu-2.6/KBOOTPARAM new file mode 100644 index 0000000..476b1fb --- /dev/null +++ b/recipes-bsp/rmc/boards/qemu-2.6/KBOOTPARAM @@ -0,0 +1 @@ +console=ttyS0,115200 diff --git a/recipes-bsp/rmc/boards/qemu-2.6/qemu-2.6.fp b/recipes-bsp/rmc/boards/qemu-2.6/qemu-2.6.fp new file mode 100644 index 0000000..e4c4165 Binary files /dev/null and b/recipes-bsp/rmc/boards/qemu-2.6/qemu-2.6.fp differ diff --git a/recipes-bsp/rmc/boards/qemu-2.8/KBOOTPARAM b/recipes-bsp/rmc/boards/qemu-2.8/KBOOTPARAM new file mode 100644 index 0000000..476b1fb --- /dev/null +++ b/recipes-bsp/rmc/boards/qemu-2.8/KBOOTPARAM @@ -0,0 +1 @@ +console=ttyS0,115200 diff --git a/recipes-bsp/rmc/boards/qemu-2.8/qemu-2.8.fp b/recipes-bsp/rmc/boards/qemu-2.8/qemu-2.8.fp new file mode 100644 index 0000000..7f28f37 Binary files /dev/null and b/recipes-bsp/rmc/boards/qemu-2.8/qemu-2.8.fp differ diff --git a/recipes-bsp/rmc/rmc-db.bb b/recipes-bsp/rmc/rmc-db.bb new file mode 100644 index 0000000..f24ed11 --- /dev/null +++ b/recipes-bsp/rmc/rmc-db.bb @@ -0,0 +1,49 @@ +SUMMARY = "Central RMC Database" +DESCRIPTION = "Generate a centralized RMC database for RMC feature. \ +Fingerprints and data for all boards supported are specified by variable \ +RMC_BOARD_DATA_DIRS which is a list of top directories that contains \ +subdirectories for boards. Developers can add their top directories by appending \ +them to this variable in a rmc-db.bbappend.Refer to rmc-db bbclass for more \ +information." + +LICENSE = "MIT" + +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +S = "${WORKDIR}" + +inherit rmc-db + +RMC_BOARD_DATA_DIRS ?= "${THISDIR}/boards/" +RMC_DB_DIR = "${WORKDIR}/db" + +# Let sstate be aware of change in any added board directories +do_generate_rmc_db[file-checksums] = "${@get_rmc_top_dirs_list(d)}" + +# derived from get_lic_checksum_file_list(d) in base.bbclass in OE +def get_rmc_top_dirs_list(d): + dirlist = [] + dirs = d.getVar("RMC_BOARD_DATA_DIRS", True) or '' + topdirs = dirs.split() + for each in topdirs: + dirlist.append(each + ":" + str(os.path.exists(each))) + return " ".join(dirlist) + +do_generate_rmc_db () { + rmc_generate_db "${RMC_BOARD_DATA_DIRS}" "${RMC_DB_DIR}"/rmc.db +} + +addtask generate_rmc_db after do_compile + +inherit deploy + +do_deploy () { + if [ -f ${RMC_DB_DIR}/rmc.db ]; then + install -m 0400 ${RMC_DB_DIR}/rmc.db ${DEPLOYDIR} + else + rm -f ${DEPLOYDIR}/rmc.db + echo "Warning: no RMC central database found, skip deployment." + fi +} + +addtask deploy after do_generate_rmc_db diff --git a/recipes-bsp/rmc/rmc-efi.bb b/recipes-bsp/rmc/rmc-efi.bb new file mode 100644 index 0000000..2a1c9a9 --- /dev/null +++ b/recipes-bsp/rmc/rmc-efi.bb @@ -0,0 +1,40 @@ +SUMMARY = "RMC (Runtime Machine Configuration) EFI library" + +DESCRIPTION = "The RMC EFI library adds RMC support to existing EFI bootloaders" + +LICENSE = "MIT" + +LIC_FILES_CHKSUM = "file://COPYING;md5=ade413c694d3aaefc9554b24a8814ee8" + +SRC_URI = "git://git.yoctoproject.org/rmc" + +SRCREV = "027ac76f642dcab1a9f237a00f03a3a714bd04b9" + +S = "${WORKDIR}/git" + +COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux*" + +TARGET_CFLAGS +="-Wl,--hash-style=both" + +EXTRA_OEMAKE = "RMC_INSTALL_PREFIX=${D}/${prefix} \ + RMC_INSTALL_LIB_PATH=${D}${libdir} \ + RMC_INSTALL_HEADER_PATH=${D}${includedir}/rmc" + +SECURITY_CFLAGS_remove_class-target = "-fstack-protector-strong" +SECURITY_CFLAGS_append_class-target = " -fno-stack-protector" + +python () { + ccargs = d.getVar('TUNE_CCARGS').split() + if '-mx32' in ccargs: + ccargs.remove('-mx32') + ccargs.append('-m64') + d.setVar('TUNE_CCARGS', ' '.join(ccargs)) +} + +do_compile() { + oe_runmake -f Makefile.efi +} + +do_install() { + oe_runmake -f Makefile.efi install +} diff --git a/recipes-bsp/rmc/rmc.bb b/recipes-bsp/rmc/rmc.bb new file mode 100644 index 0000000..8797644 --- /dev/null +++ b/recipes-bsp/rmc/rmc.bb @@ -0,0 +1,46 @@ +SUMMARY = "RMC (Runtime Machine Configuration)" + +DESCRIPTION = "RMC project provides a tool and libraries to identify types \ +of hardware boards and access any file-based data specific to the board's \ +type at runtime in a centralized way. Software (clients) can have a generic \ +logic to query board-specific data from RMC without knowing the type of board. \ +This make it possible to have a generic software work running on boards which \ +require any quirks or customizations at a board or product level. \ +" + +LICENSE = "MIT" + +LIC_FILES_CHKSUM = "file://COPYING;md5=ade413c694d3aaefc9554b24a8814ee8" + +SRC_URI = "git://git.yoctoproject.org/rmc" + +SRCREV = "027ac76f642dcab1a9f237a00f03a3a714bd04b9" + +S = "${WORKDIR}/git" + +COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux*" + +TARGET_CFLAGS +="-Wl,--hash-style=both" + +EXTRA_OEMAKE = "RMC_INSTALL_PREFIX=${D}/${prefix} \ + RMC_INSTALL_BIN_PATH=${D}${bindir} \ + RMC_INSTALL_LIB_PATH=${D}${libdir} \ + RMC_INSTALL_HEADER_PATH=${D}${includedir}/rmc" + +SECURITY_CFLAGS_remove_class-target = "-fstack-protector-strong" +SECURITY_CFLAGS_append_class-target = " -fno-stack-protector" + +do_compile_class-target() { + oe_runmake +} + +do_install() { + oe_runmake install +} + +do_install_class-native() { + install -d ${D}${STAGING_BINDIR_NATIVE} + install -m 0755 ${S}/src/rmc ${D}${STAGING_BINDIR_NATIVE} +} + +BBCLASSEXTEND = "native" diff --git a/recipes-bsp/systemd-boot/systemd-boot/0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch b/recipes-bsp/systemd-boot/systemd-boot/0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch new file mode 100644 index 0000000..8d0b614 --- /dev/null +++ b/recipes-bsp/systemd-boot/systemd-boot/0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch @@ -0,0 +1,31 @@ +From 58669ad764767afea4de53f8a97357773b1855ef Mon Sep 17 00:00:00 2001 +From: Saul Wold +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 + +Upstream-Status: Inappropriate [machine specific workaround] +Signed-off-by: Saul Wold +--- + src/boot/efi/boot.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c +index 3dcd9a5..3c6ed8c 100644 +--- a/src/boot/efi/boot.c ++++ b/src/boot/efi/boot.c +@@ -649,7 +649,7 @@ static BOOLEAN menu_run(Config *config, ConfigEntry **chosen_entry, CHAR16 *load + } + + /* timeout disabled, wait for next key */ +- wait = TRUE; ++ wait = FALSE; + continue; + } + +-- +2.7.4 + diff --git a/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch b/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch new file mode 100644 index 0000000..2f248e2 --- /dev/null +++ b/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch @@ -0,0 +1,39 @@ +From fe1c2fdfe81f2ac2b41fe8543ba07f1911770d26 Mon Sep 17 00:00:00 2001 +From: Jianxun Zhang +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 +--- + Makefile.am | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 305099ab6..9fb6f9b7b 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -2802,7 +2802,7 @@ $(top_builddir)/src/boot/efi/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(t + + $(systemd_boot_solib): $(systemd_boot_objects) + $(AM_V_CCLD)$(LD) $(efi_ldflags) $(systemd_boot_objects) \ +- -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \ ++ -o $@ -lefi -lgnuefi -lrmcefi $(shell $(CC) -print-libgcc-file-name); \ + nm -D -u $@ | grep ' U ' && exit 1 || : + + $(systemd_boot): $(systemd_boot_solib) +@@ -2852,7 +2852,7 @@ $(top_builddir)/src/boot/efi/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(t + + $(stub_solib): $(stub_objects) + $(AM_V_CCLD)$(LD) $(efi_ldflags) $(stub_objects) \ +- -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \ ++ -o $@ -lefi -lgnuefi -lrmcefi $(shell $(CC) -print-libgcc-file-name); \ + nm -D -u $@ | grep ' U ' && exit 1 || : + + $(stub): $(stub_solib) +-- +2.11.0 + diff --git a/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-stub-check-LoadOptions-contains-data.patch b/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-stub-check-LoadOptions-contains-data.patch new file mode 100644 index 0000000..69acc8f --- /dev/null +++ b/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-stub-check-LoadOptions-contains-data.patch @@ -0,0 +1,42 @@ +From 87cd5a5e0f06ceb7f9dbdcc4029e0c279a38e6ad Mon Sep 17 00:00:00 2001 +From: Mikko Ylinen +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 +--- + src/boot/efi/stub.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c +index 7c1ffb1bc..b7d5d3cda 100644 +--- a/src/boot/efi/stub.c ++++ b/src/boot/efi/stub.c +@@ -87,7 +87,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { + cmdline_len = szs[0]; + + /* if we are not in secure boot mode, accept a custom command line and replace the built-in one */ +- if (!secure && loaded_image->LoadOptionsSize > 0) { ++ if (!secure && loaded_image->LoadOptionsSize > 0 && *(CHAR16 *)loaded_image->LoadOptions != 0) { + CHAR16 *options; + CHAR8 *line; + UINTN i; +-- +2.11.0 + diff --git a/recipes-bsp/systemd-boot/systemd-boot/0002-sd-boot-Load-board-specific-boot-entries-from-RMC-da.patch b/recipes-bsp/systemd-boot/systemd-boot/0002-sd-boot-Load-board-specific-boot-entries-from-RMC-da.patch new file mode 100644 index 0000000..e88012c --- /dev/null +++ b/recipes-bsp/systemd-boot/systemd-boot/0002-sd-boot-Load-board-specific-boot-entries-from-RMC-da.patch @@ -0,0 +1,250 @@ +From a3c4fc8c2847fe289a617bcba1d905f580f0e18d Mon Sep 17 00:00:00 2001 +From: Jianxun Zhang +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 +--- + 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 + #include ++#include + + #include "console.h" + #include "disk.h" +@@ -33,6 +34,9 @@ static const char __attribute__((used)) magic[] = "#### LoaderInfo: systemd-boot + + static const EFI_GUID global_guid = EFI_GLOBAL_VARIABLE; + ++static CHAR8* rmc_db; ++static rmc_fingerprint_t *rmc_fp; ++ + enum loader_type { + LOADER_UNDEFINED, + LOADER_EFI, +@@ -1702,6 +1706,136 @@ static VOID config_free(Config *config) { + FreePool(config->entry_oneshot); + } + ++/* Derived from line_get_key_value(), we could consolidate two functions later */ ++static CHAR8 *get_line(CHAR8 *content, UINT64 *pos) { ++ CHAR8 *line; ++ UINT64 linelen; ++ ++skip: ++ line = content + *pos; ++ if (*line == '\0') ++ return NULL; ++ ++ linelen = 0; ++ while (line[linelen] && !strchra((CHAR8 *)"\n\r", line[linelen])) ++ linelen++; ++ ++ /* move pos to next line */ ++ *pos += linelen; ++ if (content[*pos]) ++ (*pos)++; ++ ++ /* empty line */ ++ if (linelen == 0) ++ goto skip; ++ ++ /* terminate line */ ++ line[linelen] = '\0'; ++ ++ /* remove leading whitespace */ ++ while (strchra((CHAR8 *)" \t", *line)) { ++ line++; ++ linelen--; ++ } ++ ++ /* remove trailing whitespace */ ++ while (linelen > 0 && strchra((CHAR8 *)" \t", line[linelen-1])) ++ linelen--; ++ line[linelen] = '\0'; ++ ++ if (*line == '#') ++ goto skip; ++ ++ return line; ++} ++ ++/* load rmc database file from ESP and try to get fingerprint. These ++ * are essential information indicating we could query rmc data for ++ * this board at least ++ * return 0 if both database file and fingerprint can be obtained, otherwise ++ * non-zero value is returned. ++ * ++ * Note: db and fp hold valid values only when this function returns 0. ++ * Caller is responsible to free allocated memory pointed by *db and *fp when ++ * this function returns 0. ++ */ ++ ++static UINTN rmc_initialize(EFI_FILE *root_dir, EFI_SYSTEM_TABLE *sys_table, CHAR8 **db, rmc_fingerprint_t **fp) { ++ UINTN len; ++ UINTN ret = 1; ++ ++ if (!db || !fp) ++ return ret; ++ ++ *db = NULL; ++ *fp = NULL; ++ ++ /* load rmc database */ ++ len = file_read(root_dir, L"\\rmc.db", 0, 0, db); ++ ++ if (len <= 0) ++ goto done; ++ ++ *fp = AllocateZeroPool(sizeof(rmc_fingerprint_t)); ++ /* call rmc to get fingerprint. We will use single-action rmc APIs to query multiple files. ++ * This should bring a better performance than calling double-action rmc API every time. ++ */ ++ if (rmc_get_fingerprint(sys_table, *fp)) ++ goto done; ++ ++ ret = 0; ++done: ++ if (ret) { ++ FreePool(*db); ++ FreePool(*fp); ++ } ++ ++ return ret; ++} ++ ++/* load RMC entries ++ * return TRUE when at least one entry is loaded, otherwise, return FALSE ++ */ ++static BOOLEAN config_load_rmc_entries(Config *config, EFI_HANDLE *device, CHAR16 *loaded_image_path, CHAR8 *db, rmc_fingerprint_t *fp) { ++ CHAR8 *boot_entry = NULL; ++ CHAR8 *boot_config = NULL; ++ rmc_file_t rp; ++ CHAR8 *line; ++ UINT64 pos = 0; ++ BOOLEAN ret = FALSE; ++ ++ if (!db || !fp) ++ return ret; ++ ++ /* query boot entry config file */ ++ if (rmc_query_file_by_fp(fp, db, "BOOTENTRY.CONFIG", &rp)) ++ return ret; ++ ++ /* file blob read from rmc db is not necessarily null-terminated, and we ++ * should keep mem where rmc db lives from change during parsing ++ */ ++ boot_config = AllocatePool(rp.blob_len * sizeof(CHAR8) + 1); ++ CopyMem(boot_config, rp.blob, rp.blob_len); ++ boot_config[rp.blob_len] = '\0'; ++ /* parse boot entry config */ ++ while ((line = get_line(boot_config, &pos))) { ++ if (rmc_query_file_by_fp(fp, db, (char *)line, &rp)) ++ continue; ++ if (rp.blob_len > 0) { ++ boot_entry = AllocatePool(rp.blob_len * sizeof(CHAR8) + 1); ++ CopyMem(boot_entry, rp.blob, rp.blob_len); ++ boot_entry[rp.blob_len] = '\0'; ++ config_entry_add_from_file(config, device, ++ stra_to_str(line), boot_entry, ++ loaded_image_path); ++ /* tell caller success when a RMC entry is loaded */ ++ ret = TRUE; ++ } ++ } ++ ++ return ret; ++} ++ + EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { + CHAR16 *s; + CHAR8 *b; +@@ -1714,6 +1848,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { + UINT64 init_usec; + BOOLEAN menu = FALSE; + CHAR16 uuid[37]; ++ BOOLEAN rmc_entry = FALSE; + + InitializeLib(image, sys_table); + init_usec = time_usec(); +@@ -1745,6 +1880,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { + return EFI_LOAD_ERROR; + } + ++ /* Initialize rmc before loading any config */ ++ rmc_initialize(root_dir, sys_table, &rmc_db, &rmc_fp); + + /* the filesystem path to this image, to prevent adding ourselves to the menu */ + loaded_image_path = DevicePathToStr(loaded_image->FilePath); +@@ -1753,11 +1890,15 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { + ZeroMem(&config, sizeof(Config)); + config_load_defaults(&config, root_dir); + ++ if (rmc_db && rmc_fp) ++ rmc_entry = config_load_rmc_entries(&config, loaded_image->DeviceHandle, loaded_image_path, rmc_db, rmc_fp); ++ + /* scan /EFI/Linux/ directory */ + config_entry_add_linux(&config, loaded_image, root_dir); + +- /* scan /loader/entries/\*.conf files */ +- config_load_entries(&config, loaded_image->DeviceHandle, root_dir, loaded_image_path); ++ /* scan /loader/entries/\*.conf files only when no RMC entry is loaded */ ++ if (rmc_entry == FALSE) ++ config_load_entries(&config, loaded_image->DeviceHandle, root_dir, loaded_image_path); + + /* sort entries after version number */ + config_sort_entries(&config); +@@ -1851,6 +1992,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { + out: + FreePool(loaded_image_path); + config_free(&config); ++ FreePool(rmc_db); ++ FreePool(rmc_fp); + uefi_call_wrapper(root_dir->Close, 1, root_dir); + uefi_call_wrapper(BS->CloseProtocol, 4, image, &LoadedImageProtocol, image, NULL); + return err; +-- +2.7.4 + diff --git a/recipes-bsp/systemd-boot/systemd-boot/0003-sd-boot-Support-global-kernel-command-line-fragment.patch b/recipes-bsp/systemd-boot/systemd-boot/0003-sd-boot-Support-global-kernel-command-line-fragment.patch new file mode 100644 index 0000000..a4b6355 --- /dev/null +++ b/recipes-bsp/systemd-boot/systemd-boot/0003-sd-boot-Support-global-kernel-command-line-fragment.patch @@ -0,0 +1,66 @@ +From 1e33f99e13a70c19c1f63f6ef1c5522a09adece6 Mon Sep 17 00:00:00 2001 +From: Jianxun Zhang +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 +--- + src/boot/efi/boot.c | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c +index d1b029b..8dffc48 100644 +--- a/src/boot/efi/boot.c ++++ b/src/boot/efi/boot.c +@@ -846,6 +846,40 @@ static VOID config_add_entry(Config *config, ConfigEntry *entry) { + config->entries = ReallocatePool(config->entries, + sizeof(VOID *) * config->entry_count, sizeof(VOID *) * i); + } ++ ++ /* rmc: a linux entry could be added from .conf file or an embedded linux image ++ * we put appending global command line here to cover both of two cases. ++ */ ++ if (entry->type == LOADER_LINUX && rmc_db && rmc_fp) { ++ rmc_file_t rmc_kp; ++ ++ if (!rmc_query_file_by_fp(rmc_fp, rmc_db, "KBOOTPARAM", &rmc_kp)) { ++ CHAR8 *cmdline; ++ CHAR16 *s; ++ CHAR16 *t; ++ CHAR16 *p; ++ ++ cmdline = AllocatePool(rmc_kp.blob_len * sizeof(CHAR8) + 1); ++ CopyMem(cmdline, rmc_kp.blob, rmc_kp.blob_len); ++ cmdline[rmc_kp.blob_len] = '\0'; ++ p = stra_to_str(cmdline); ++ t = p; ++ ++ while (*t) { ++ if (*t == '\n') ++ *t = '\0'; ++ t++; ++ } ++ ++ s = PoolPrint(L"%s %s", entry->options, p); ++ FreePool(entry->options); ++ FreePool(p); ++ FreePool(cmdline); ++ ++ entry->options = s; ++ } ++ } ++ + config->entries[config->entry_count++] = entry; + } + +-- +2.7.4 + diff --git a/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch b/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch new file mode 100644 index 0000000..7508269 --- /dev/null +++ b/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch @@ -0,0 +1,81 @@ +From 4cb9c65ea9c0eba3ba04d036dccd4a5ab3d2547b Mon Sep 17 00:00:00 2001 +From: Mikko Ylinen +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 +--- + 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 + #include ++#include + + #include "disk.h" + #include "graphics.h" +@@ -48,6 +49,9 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { + UINTN cmdline_len; + CHAR16 uuid[37]; + EFI_STATUS err; ++ INTN len; ++ CHAR8 *rmc_db = NULL; ++ rmc_file_t rmc_file; + + InitializeLib(image, sys_table); + +@@ -112,6 +116,35 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { + #endif + } + ++ len = file_read(root_dir, L"\\rmc.db", 0, 0, &rmc_db); ++ if (len <= 0) ++ rmc_db = NULL; ++ ++ /* If the board has a fragment in rmc database, append it to the cmdline */ ++ if (rmc_db && !rmc_gimme_file(sys_table, rmc_db, "KBOOTPARAM", &rmc_file)) { ++ CHAR8 *line; ++ UINTN i = 0; ++ UINTN j; ++ ++ line = AllocatePool(rmc_file.blob_len + cmdline_len + 2); ++ ++ while (i < cmdline_len && cmdline[i] != '\0') { ++ line[i] = cmdline[i]; ++ i++; ++ } ++ ++ line[i++] = ' '; ++ ++ for (j=0; j < rmc_file.blob_len; j++) ++ line[i+j] = rmc_file.blob[j]; ++ line[i+j] = '\0'; ++ ++ cmdline = line; ++ cmdline_len = i + j; ++ ++ FreePool(rmc_db); ++ } ++ + /* export the device path this image is started from */ + if (disk_get_part_uuid(loaded_image->DeviceHandle, uuid) == EFI_SUCCESS) + efivar_set(L"LoaderDevicePartUUID", uuid, FALSE); +-- +2.11.0 + diff --git a/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc b/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc new file mode 100644 index 0000000..1172d53 --- /dev/null +++ b/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc @@ -0,0 +1,12 @@ +DEPENDS_append_intel-x86-common = " rmc rmc-efi" + +EXTRA_OEMAKE_append_intel-x86-common = ' EFI_LDFLAGS="-L${STAGING_DIR_HOST}/usr/lib" EFI_CFLAGS="-I${STAGING_INCDIR}/rmc -DRMC_EFI"' + +SRC_URI_append_intel-x86-common = " \ + file://0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch \ + file://0002-sd-boot-Load-board-specific-boot-entries-from-RMC-da.patch \ + file://0003-sd-boot-Support-global-kernel-command-line-fragment.patch \ + file://0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch \ + file://0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch \ + file://0001-sd-boot-stub-check-LoadOptions-contains-data.patch \ + " diff --git a/recipes-bsp/systemd-boot/systemd-boot/systemd-boot.inc b/recipes-bsp/systemd-boot/systemd-boot/systemd-boot.inc new file mode 100644 index 0000000..fcce6ce --- /dev/null +++ b/recipes-bsp/systemd-boot/systemd-boot/systemd-boot.inc @@ -0,0 +1,7 @@ +EXTRA_OEMAKE_append_intel-x86-common = ' EFI_LDFLAGS="-L${STAGING_DIR_HOST}/usr/lib" ' + +SRC_URI_append_intel-x86-common = " \ + file://0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch \ + file://0001-sd-boot-stub-check-LoadOptions-contains-data.patch \ + " + diff --git a/recipes-bsp/systemd-boot/systemd-boot_%.bbappend b/recipes-bsp/systemd-boot/systemd-boot_%.bbappend new file mode 100644 index 0000000..557c049 --- /dev/null +++ b/recipes-bsp/systemd-boot/systemd-boot_%.bbappend @@ -0,0 +1,23 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/systemd-boot:" + +# Pin systemd revision down for systemd-boot recipe. +# Patches could not be applied cleanly when systemd in OE is updated, +# though we don't expect a lot of changes could happen in bootloader. +# RMC is designed to support a large number of types of boards, so we +# should do explicit update with validation to prevent regression even +# resolving conflicts for a new tip could be done in a short time. + +# Revision: systemd v232 in OE +SRCREV_intel-x86-common = "a1e2ef7ec912902d8142e7cb5830cbfb47dba86c" + +include systemd-boot/${EFI_PROVIDER}.inc + +PACKAGE_ARCH_intel-x86-common = "${INTEL_COMMON_PACKAGE_ARCH}" + +do_compile_append_intel-x86-common() { + oe_runmake linux${SYSTEMD_BOOT_EFI_ARCH}.efi.stub +} + +do_deploy_append_intel-x86-common() { + install ${B}/linux*.efi.stub ${DEPLOYDIR} +} diff --git a/recipes-bsp/thermald/thermald_1.6.bb b/recipes-bsp/thermald/thermald_1.6.bb new file mode 100644 index 0000000..e6cbb62 --- /dev/null +++ b/recipes-bsp/thermald/thermald_1.6.bb @@ -0,0 +1,33 @@ +SUMMARY = "Linux thermal daemon" + +DESCRIPTION = "Thermal Daemon is a Linux daemon used to prevent the \ +overheating of platforms. This daemon monitors temperature and applies \ +compensation using available cooling methods." + +HOMEPAGE = "https://github.com/01org/thermal_daemon" + +DEPENDS = "dbus dbus-glib dbus-glib-native libxml2 glib-2.0 glib-2.0-native" +DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd','',d)}" +DEPENDS_append_libc-musl = " argp-standalone" +DEPENDS_append_toolchain-clang = " openmp" +LICENSE = "GPL-2.0" +LIC_FILES_CHKSUM = "file://COPYING;md5=ea8831610e926e2e469075b52bf08848" + +SRC_URI = "git://github.com/intel/thermal_daemon/" +SRCREV = "5f1be4d9d6f3b27d2c9884f833ca05cdcb4428e0" +S = "${WORKDIR}/git" + +inherit pkgconfig autotools systemd + +FILES_${PN} += "${datadir}/dbus-1/system-services/*.service" + +SYSTEMD_SERVICE_${PN} = "thermald.service" + +COMPATIBLE_HOST = '(i.86|x86_64).*-linux' + +CONFFILES_${PN} = " \ + ${sysconfdir}/thermald/thermal-conf.xml \ + ${sysconfdir}/thermald/thermal-cpu-cdev-order.xml \ + " + +UPSTREAM_CHECK_URI = "https://github.com/01org/thermal_daemon/releases" diff --git a/recipes-core/images/core-image-minimal-initramfs.bbappend b/recipes-core/images/core-image-minimal-initramfs.bbappend new file mode 100644 index 0000000..4ddca37 --- /dev/null +++ b/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/recipes-core/images/core-image-tiny.bb b/recipes-core/images/core-image-tiny.bb new file mode 100644 index 0000000..ed39fd7 --- /dev/null +++ b/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/recipes-core/initrdscripts/files/intel-x86-common/init-install-efi.sh b/recipes-core/initrdscripts/files/intel-x86-common/init-install-efi.sh new file mode 100644 index 0000000..a7a2ad4 --- /dev/null +++ b/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/recipes-core/initrdscripts/initramfs-live-install-efi_%.bbappend b/recipes-core/initrdscripts/initramfs-live-install-efi_%.bbappend new file mode 100644 index 0000000..0b3a1d3 --- /dev/null +++ b/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/recipes-core/microcode/intel-microcode_20171117.bb b/recipes-core/microcode/intel-microcode_20171117.bb new file mode 100644 index 0000000..3b5be13 --- /dev/null +++ b/recipes-core/microcode/intel-microcode_20171117.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;endline=33;md5=e5199e4965078af6c7dee6aa7c5d8404" + +SRC_URI = "https://downloadmirror.intel.com/27337/eng/microcode-${PV}.tgz" +SRC_URI[md5sum] = "b294245d1f7f6c20f01edba53185f258" +SRC_URI[sha256sum] = "93bd1da9fa58ece0016702e657f708b7e496e56da637a3fe9a6d21f1d6f524dc" + +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/recipes-core/microcode/iucode-tool/0001-Makefile.am-Add-arg-parse-library-for-MUSL-support.patch b/recipes-core/microcode/iucode-tool/0001-Makefile.am-Add-arg-parse-library-for-MUSL-support.patch new file mode 100644 index 0000000..ca97d2a --- /dev/null +++ b/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 +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 +--- + 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/recipes-core/microcode/iucode-tool_2.1.2.bb b/recipes-core/microcode/iucode-tool_2.1.2.bb new file mode 100644 index 0000000..e1fb56f --- /dev/null +++ b/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/recipes-core/ovmf/files/0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch b/recipes-core/ovmf/files/0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch new file mode 100644 index 0000000..62db063 --- /dev/null +++ b/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 +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 +--- + 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/recipes-core/ovmf/ovmf-shell-image-enrollkeys.bb b/recipes-core/ovmf/ovmf-shell-image-enrollkeys.bb new file mode 100644 index 0000000..b20f6e5 --- /dev/null +++ b/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/recipes-core/ovmf/ovmf_%.bbappend b/recipes-core/ovmf/ovmf_%.bbappend new file mode 100644 index 0000000..bbf5fa3 --- /dev/null +++ b/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/recipes-graphics/intel-gpu-tools/intel-gpu-tools_1.19.bb b/recipes-graphics/intel-gpu-tools/intel-gpu-tools_1.19.bb new file mode 100644 index 0000000..de9ed60 --- /dev/null +++ b/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/recipes-graphics/xorg-driver/xf86-video-ast_1.1.5.bb b/recipes-graphics/xorg-driver/xf86-video-ast_1.1.5.bb new file mode 100644 index 0000000..090efd6 --- /dev/null +++ b/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/recipes-graphics/xorg-driver/xf86-video-mga/checkfile.patch b/recipes-graphics/xorg-driver/xf86-video-mga/checkfile.patch new file mode 100644 index 0000000..ceae6df --- /dev/null +++ b/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 + +From c9014a8f3c9b691b5aa7b1f3ec66cf7c84b8211b Mon Sep 17 00:00:00 2001 +From: Ross Burton +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 +--- + 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/recipes-graphics/xorg-driver/xf86-video-mga_1.6.5.bb b/recipes-graphics/xorg-driver/xf86-video-mga_1.6.5.bb new file mode 100644 index 0000000..d30936b --- /dev/null +++ b/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/recipes-kernel/cryptodev/cryptodev-module/0001-zc-Force-4.10-get_user_pages_remote-API.patch b/recipes-kernel/cryptodev/cryptodev-module/0001-zc-Force-4.10-get_user_pages_remote-API.patch new file mode 100644 index 0000000..353126f --- /dev/null +++ b/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 +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 +--- + 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/recipes-kernel/cryptodev/cryptodev-module_%.bbappend b/recipes-kernel/cryptodev/cryptodev-module_%.bbappend new file mode 100644 index 0000000..c59ddb2 --- /dev/null +++ b/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/recipes-kernel/intel-ethernet/ixgbe.bb b/recipes-kernel/intel-ethernet/ixgbe.bb new file mode 100644 index 0000000..181158d --- /dev/null +++ b/recipes-kernel/intel-ethernet/ixgbe.bb @@ -0,0 +1,45 @@ +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 \ + file://0001-ixgbe-src-Makefile-change-make-install-to-make.patch \ + file://0001-ixgbe-skip-host-depmod.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/recipes-kernel/intel-ethernet/ixgbe/0001-ixgbe-skip-host-depmod.patch b/recipes-kernel/intel-ethernet/ixgbe/0001-ixgbe-skip-host-depmod.patch new file mode 100644 index 0000000..e53f86e --- /dev/null +++ b/recipes-kernel/intel-ethernet/ixgbe/0001-ixgbe-skip-host-depmod.patch @@ -0,0 +1,31 @@ +From e32eab62e3f79ddd40946ca698d9e650bd7d9b2d Mon Sep 17 00:00:00 2001 +From: sweeaun +Date: Sat, 7 Oct 2017 20:49:36 -0700 +Subject: [PATCH] ixgbe: skip host depmod + +Upstream-Status: Inappropriate [Cross-Compile] + +Depmod during do_install is irrelevant when cross-compiling. +Remove the depmod steps during do_install. + +Signed-off-by: sweeaun +--- + Makefile | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/Makefile b/Makefile +index fa92f81..b39283a 100644 +--- a/Makefile ++++ b/Makefile +@@ -141,8 +141,6 @@ modules_install: default manfile + @install -D -m 644 ${DRIVER}.${MANSECTION}.gz ${INSTALL_MOD_PATH}${MANDIR}/man${MANSECTION}/${DRIVER}.${MANSECTION}.gz + @echo "Installing modules..." + @+$(call devkernelbuild,modules_install) +- @echo "Running depmod..." +- @$(call cmd_depmod) + + uninstall: + rm -f ${INSTALL_MOD_PATH}/lib/modules/${KVER}/${INSTALL_MOD_DIR}/${DRIVER}.ko; +-- +2.7.4 + diff --git a/recipes-kernel/intel-ethernet/ixgbe/0001-ixgbe-src-Makefile-change-make-install-to-make.patch b/recipes-kernel/intel-ethernet/ixgbe/0001-ixgbe-src-Makefile-change-make-install-to-make.patch new file mode 100644 index 0000000..88f5335 --- /dev/null +++ b/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" +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/recipes-kernel/intel-ethernet/ixgbevf.bb b/recipes-kernel/intel-ethernet/ixgbevf.bb new file mode 100644 index 0000000..6a9636e --- /dev/null +++ b/recipes-kernel/intel-ethernet/ixgbevf.bb @@ -0,0 +1,46 @@ +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 \ + file://0001-ixgbevf-src-Makefile-change-make-install-to-make.patch \ + file://0002-ixgbevf_common.patch \ + file://0001-ixgbevf-skip-host-depmod.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/recipes-kernel/intel-ethernet/ixgbevf/0001-ixgbevf-skip-host-depmod.patch b/recipes-kernel/intel-ethernet/ixgbevf/0001-ixgbevf-skip-host-depmod.patch new file mode 100644 index 0000000..656a897 --- /dev/null +++ b/recipes-kernel/intel-ethernet/ixgbevf/0001-ixgbevf-skip-host-depmod.patch @@ -0,0 +1,31 @@ +From 9677d09f5c3984997ac8e7d90b5d4b11fb9ce277 Mon Sep 17 00:00:00 2001 +From: sweeaun +Date: Sat, 7 Oct 2017 20:56:35 -0700 +Subject: [PATCH] ixgbevf: skip host depmod + +Upstream-Status: Inappropriate [Cross-Compile] + +Depmod during do_install is irrelevant when cross-compiling. +Remove the depmod steps during do_install. + +Signed-off-by: sweeaun +--- + Makefile | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 91df705..1dcf350 100644 +--- a/Makefile ++++ b/Makefile +@@ -104,8 +104,6 @@ modules_install: default manfile + @install -D -m 644 ${DRIVER}.${MANSECTION}.gz ${INSTALL_MOD_PATH}${MANDIR}/man${MANSECTION}/${DRIVER}.${MANSECTION}.gz + @echo "Installing modules..." + @+$(call kernelbuild,modules_install) +- @echo "Running depmod..." +- @$(call cmd_depmod) + + uninstall: + rm -f ${INSTALL_MOD_PATH}/lib/modules/${KVER}/${INSTALL_MOD_DIR}/${DRIVER}.ko; +-- +2.7.4 + diff --git a/recipes-kernel/intel-ethernet/ixgbevf/0001-ixgbevf-src-Makefile-change-make-install-to-make.patch b/recipes-kernel/intel-ethernet/ixgbevf/0001-ixgbevf-src-Makefile-change-make-install-to-make.patch new file mode 100644 index 0000000..8234f58 --- /dev/null +++ b/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" +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/recipes-kernel/intel-ethernet/ixgbevf/0002-ixgbevf_common.patch b/recipes-kernel/intel-ethernet/ixgbevf/0002-ixgbevf_common.patch new file mode 100644 index 0000000..d442e24 --- /dev/null +++ b/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" +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/recipes-kernel/iwlwifi/backport-iwlwifi/0001-Makefile.real-skip-host-install-scripts.patch b/recipes-kernel/iwlwifi/backport-iwlwifi/0001-Makefile.real-skip-host-install-scripts.patch new file mode 100644 index 0000000..1d4137b --- /dev/null +++ b/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 +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 +--- + 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/recipes-kernel/iwlwifi/backport-iwlwifi/0001-hrtimer-fix-version-numbers-because-production-kerne.patch b/recipes-kernel/iwlwifi/backport-iwlwifi/0001-hrtimer-fix-version-numbers-because-production-kerne.patch new file mode 100644 index 0000000..4fdc36f --- /dev/null +++ b/recipes-kernel/iwlwifi/backport-iwlwifi/0001-hrtimer-fix-version-numbers-because-production-kerne.patch @@ -0,0 +1,87 @@ +From ecb29b78ce946c802058be0c46a0d20432f412e5 Mon Sep 17 00:00:00 2001 +From: Saul Wold +Date: Thu, 28 Sep 2017 10:51:15 -0700 +Subject: [PATCH] hrtimer: fix version numbers because production kernel has + update + +Decrease the version check because the OTC production kernel which is +4.9 includes the HRTimer code that this is using. + +Upstream-Status: [Backport] It's been backported into the older kernel +Signed-off-by: Saul Wold +--- + backport-include/linux/hrtimer.h | 2 +- + drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 2 +- + drivers/net/wireless/intel/iwlwifi/pcie/tx.c | 2 +- + drivers/net/wireless/intel/iwlwifi/trans_slave/shared.c | 2 +- + net/mac80211/tx.c | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/backport-include/linux/hrtimer.h b/backport-include/linux/hrtimer.h +index bdcf106e1..ae128852d 100644 +--- a/backport-include/linux/hrtimer.h ++++ b/backport-include/linux/hrtimer.h +@@ -4,7 +4,7 @@ + #include_next + #include + +-#if LINUX_VERSION_IS_LESS(4,10,0) ++#if LINUX_VERSION_IS_LESS(4,9,0) + static inline void backport_hrtimer_start(struct hrtimer *timer, s64 time, + const enum hrtimer_mode mode) + { +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +index cf1f95a01..e6f1ff294 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +@@ -1310,7 +1310,7 @@ static void iwl_mvm_tx_lat_add_ts_ack(struct sk_buff *skb) + s64 ts_1 = ktime_to_ns(skb->tstamp) >> 32; + s64 diff = temp - ts_1; + +-#if LINUX_VERSION_IS_LESS(4,10,0) ++#if LINUX_VERSION_IS_LESS(4,9,0) + skb->tstamp.tv64 += diff; + #else + skb->tstamp += diff; +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c +index df81bce25..ad664bacd 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c +@@ -1955,7 +1955,7 @@ static void iwl_trans_pci_tx_lat_add_ts_write(struct sk_buff *skb) + s64 ts_1 = ktime_to_ns(skb->tstamp) >> 32; + s64 diff = temp - ts_1; + +-#if LINUX_VERSION_IS_LESS(4,10,0) ++#if LINUX_VERSION_IS_LESS(4,9,0) + skb->tstamp.tv64 += diff << 16; + #else + skb->tstamp += diff << 16; +diff --git a/drivers/net/wireless/intel/iwlwifi/trans_slave/shared.c b/drivers/net/wireless/intel/iwlwifi/trans_slave/shared.c +index e4d45bcf7..cdd0ba9a2 100644 +--- a/drivers/net/wireless/intel/iwlwifi/trans_slave/shared.c ++++ b/drivers/net/wireless/intel/iwlwifi/trans_slave/shared.c +@@ -796,7 +796,7 @@ void iwl_slv_tx_lat_add_ts_write(struct iwl_trans_slv *trans_slv, + + ts_1 = ktime_to_ns(data_entry->skb->tstamp) >> 32; + diff = temp - ts_1; +-#if LINUX_VERSION_IS_LESS(4,10,0) ++#if LINUX_VERSION_IS_LESS(4,9,0) + data_entry->skb->tstamp.tv64 += diff << 16; + #else + data_entry->skb->tstamp += diff << 16; +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index 94a348688..0f226c413 100644 +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -2278,7 +2278,7 @@ static void ieee80211_tx_latency_start_msrmnt(struct ieee80211_local *local, + if (!tx_latency && !tx_consec && !tx_thrshld) + return; + temp = ktime_to_ms(ktime_get()); +-#if LINUX_VERSION_IS_LESS(4,10,0) ++#if LINUX_VERSION_IS_LESS(4,9,0) + skb->tstamp.tv64 += temp << 32; + #else + skb->tstamp += temp << 32; +-- +2.13.5 + diff --git a/recipes-kernel/iwlwifi/backport-iwlwifi/iwlwifi.conf b/recipes-kernel/iwlwifi/backport-iwlwifi/iwlwifi.conf new file mode 100644 index 0000000..a0e5f6f --- /dev/null +++ b/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/recipes-kernel/iwlwifi/backport-iwlwifi_git.bb b/recipes-kernel/iwlwifi/backport-iwlwifi_git.bb new file mode 100644 index 0000000..d391045 --- /dev/null +++ b/recipes-kernel/iwlwifi/backport-iwlwifi_git.bb @@ -0,0 +1,56 @@ +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 + +# 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 +# +# When updating this recipe, ensure that the proper firmware is included from +# either the linux-firmware or iwlwifi-firmware repos. + +PV = "30" +SRCREV = "b31221a99488021300e7f89d2ecf9bdd2bc52dd2" + +# Add a patch for Intel's Production Kernel as it's got a backport of HRTimers +PK_PATCH = "${@bb.utils.contains('PREFERRED_PROVIDER_virtual/kernel','linux-intel','file://0001-hrtimer-fix-version-numbers-because-production-kerne.patch','',d)}" + +SRC_URI = " \ + git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/backport-iwlwifi;branch=release/LinuxCore${PV} \ + file://0001-Makefile.real-skip-host-install-scripts.patch \ + ${PK_PATCH} \ + file://iwlwifi.conf \ + " + +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/recipes-kernel/linux/linux-intel-rt_4.9.bb b/recipes-kernel/linux/linux-intel-rt_4.9.bb new file mode 100644 index 0000000..8fb184b --- /dev/null +++ b/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 ?= "3074f3308abdc15cbd2be92e5e5a7c0f31cfad84" +SRCREV_meta ?= "f4e37e151102d89c4d0e110c88eb3b3c36bdeaa4" + +LINUX_KERNEL_TYPE = "preempt-rt" diff --git a/recipes-kernel/linux/linux-intel.inc b/recipes-kernel/linux/linux-intel.inc new file mode 100644 index 0000000..057779a --- /dev/null +++ b/recipes-kernel/linux/linux-intel.inc @@ -0,0 +1,40 @@ +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.61" +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 ?= "(intel-corei7-64|intel-core2-32|intel-quark)" +COMPATIBLE_MACHINE_intel-x86-common = "${MACHINE}" + +KMACHINE_core2-32-intel-common = "intel-core2-32" +KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +KMACHINE_corei7-64-intel-common = "intel-corei7-64" +KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" + +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)}" diff --git a/recipes-kernel/linux/linux-intel/disable_skylake_sound.cfg b/recipes-kernel/linux/linux-intel/disable_skylake_sound.cfg new file mode 100644 index 0000000..f7d7322 --- /dev/null +++ b/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/recipes-kernel/linux/linux-intel_4.9.bb b/recipes-kernel/linux/linux-intel_4.9.bb new file mode 100644 index 0000000..dfaf34d --- /dev/null +++ b/recipes-kernel/linux/linux-intel_4.9.bb @@ -0,0 +1,13 @@ + +require linux-intel.inc + +KBRANCH = "base" +SRCREV_machine ?= "c2e99163add32c914514460fb67140409e287476" +SRCREV_meta ?= "f4e37e151102d89c4d0e110c88eb3b3c36bdeaa4" + +# 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/recipes-kernel/linux/linux-yocto-dev.bbappend b/recipes-kernel/linux/linux-yocto-dev.bbappend new file mode 100644 index 0000000..ee33ecc --- /dev/null +++ b/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/recipes-kernel/linux/linux-yocto-rt_4.10.bbappend b/recipes-kernel/linux/linux-yocto-rt_4.10.bbappend new file mode 100644 index 0000000..17569a1 --- /dev/null +++ b/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/recipes-kernel/linux/linux-yocto-rt_4.12.bbappend b/recipes-kernel/linux/linux-yocto-rt_4.12.bbappend new file mode 100644 index 0000000..17569a1 --- /dev/null +++ b/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/recipes-kernel/linux/linux-yocto-rt_4.4.bbappend b/recipes-kernel/linux/linux-yocto-rt_4.4.bbappend new file mode 100644 index 0000000..c18f4a1 --- /dev/null +++ b/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/recipes-kernel/linux/linux-yocto-rt_4.9.bbappend b/recipes-kernel/linux/linux-yocto-rt_4.9.bbappend new file mode 100644 index 0000000..9d2e3c0 --- /dev/null +++ b/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/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend b/recipes-kernel/linux/linux-yocto-tiny_4.10.bbappend new file mode 100644 index 0000000..b8d3d81 --- /dev/null +++ b/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/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend b/recipes-kernel/linux/linux-yocto-tiny_4.12.bbappend new file mode 100644 index 0000000..b8d3d81 --- /dev/null +++ b/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/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend b/recipes-kernel/linux/linux-yocto-tiny_4.4.bbappend new file mode 100644 index 0000000..54430e2 --- /dev/null +++ b/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/recipes-kernel/linux/linux-yocto-tiny_4.9.bbappend b/recipes-kernel/linux/linux-yocto-tiny_4.9.bbappend new file mode 100644 index 0000000..9ecdb95 --- /dev/null +++ b/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/recipes-kernel/linux/linux-yocto_%.bbappend b/recipes-kernel/linux/linux-yocto_%.bbappend new file mode 100644 index 0000000..7c29be1 --- /dev/null +++ b/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/recipes-kernel/linux/linux-yocto_4.10.bbappend b/recipes-kernel/linux/linux-yocto_4.10.bbappend new file mode 100644 index 0000000..2050463 --- /dev/null +++ b/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/recipes-kernel/linux/linux-yocto_4.12.bbappend b/recipes-kernel/linux/linux-yocto_4.12.bbappend new file mode 100644 index 0000000..2050463 --- /dev/null +++ b/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/recipes-kernel/linux/linux-yocto_4.4.bbappend b/recipes-kernel/linux/linux-yocto_4.4.bbappend new file mode 100644 index 0000000..3b02a93 --- /dev/null +++ b/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/recipes-kernel/linux/linux-yocto_4.9.bbappend b/recipes-kernel/linux/linux-yocto_4.9.bbappend new file mode 100644 index 0000000..a09fe1a --- /dev/null +++ b/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/recipes-kernel/lttng/lttng-modules/0002-lttng-modules-PKT-4.9-yocto-build-failed.patch b/recipes-kernel/lttng/lttng-modules/0002-lttng-modules-PKT-4.9-yocto-build-failed.patch new file mode 100644 index 0000000..32b49b8 --- /dev/null +++ b/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 +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 +--- + 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/recipes-kernel/lttng/lttng-modules_%.bbappend b/recipes-kernel/lttng/lttng-modules_%.bbappend new file mode 100644 index 0000000..dc1c4a7 --- /dev/null +++ b/recipes-kernel/lttng/lttng-modules_%.bbappend @@ -0,0 +1,7 @@ +FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:" + + +LTTNG_PATCH = "${@bb.utils.contains_any('PREFERRED_PROVIDER_virtual/kernel','linux-intel linux-intel-rt','file://0002-lttng-modules-PKT-4.9-yocto-build-failed.patch','',d)}" + +SRC_URI_append_intel-x86-common = " ${LTTNG_PATCH}" + diff --git a/recipes-multimedia/libva/libva-intel-driver_1.8.3.bb b/recipes-multimedia/libva/libva-intel-driver_1.8.3.bb new file mode 100644 index 0000000..72451c0 --- /dev/null +++ b/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\d+\.\d+(\.\d+)*)" diff --git a/recipes-multimedia/libva/va-intel.bb b/recipes-multimedia/libva/va-intel.bb new file mode 100644 index 0000000..88539e2 --- /dev/null +++ b/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/recipes-multimedia/libyami/libyami-utils/0001-Fix-build-with-clang.patch b/recipes-multimedia/libyami/libyami-utils/0001-Fix-build-with-clang.patch new file mode 100644 index 0000000..a4a4029 --- /dev/null +++ b/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 +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 +--- +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/recipes-multimedia/libyami/libyami-utils_1.2.0.bb b/recipes-multimedia/libyami/libyami-utils_1.2.0.bb new file mode 100644 index 0000000..62d62d5 --- /dev/null +++ b/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\d+(\.\d+)+)" diff --git a/recipes-multimedia/libyami/libyami/0001-bitWriter.cpp-Delete-unused-CACHEBYTES.patch b/recipes-multimedia/libyami/libyami/0001-bitWriter.cpp-Delete-unused-CACHEBYTES.patch new file mode 100644 index 0000000..a96c9b8 --- /dev/null +++ b/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 +Date: Fri, 11 Aug 2017 17:15:45 -0700 +Subject: [PATCH 1/9] bitWriter.cpp: Delete unused CACHEBYTES + +Signed-off-by: Khem Raj +--- +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/recipes-multimedia/libyami/libyami/0002-typecast-index-from-size_t-to-int.patch b/recipes-multimedia/libyami/libyami/0002-typecast-index-from-size_t-to-int.patch new file mode 100644 index 0000000..a216566 --- /dev/null +++ b/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 +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 +--- +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/recipes-multimedia/libyami/libyami/0003-Add-Wno-invalid-offsetof-to-compiler-commandline.patch b/recipes-multimedia/libyami/libyami/0003-Add-Wno-invalid-offsetof-to-compiler-commandline.patch new file mode 100644 index 0000000..1728960 --- /dev/null +++ b/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 +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 +--- +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/recipes-multimedia/libyami/libyami/0004-Typecast-POWER32SUB2-to-uint8_t.patch b/recipes-multimedia/libyami/libyami/0004-Typecast-POWER32SUB2-to-uint8_t.patch new file mode 100644 index 0000000..27eca39 --- /dev/null +++ b/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 +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 +--- +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/recipes-multimedia/libyami/libyami/0005-move-c-definitions-out-of-extern-C-block.patch b/recipes-multimedia/libyami/libyami/0005-move-c-definitions-out-of-extern-C-block.patch new file mode 100644 index 0000000..e77e85f --- /dev/null +++ b/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 +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 +--- +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 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 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 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 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 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 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 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 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 getVideoPostProcessMimeTypes() + { + return VaapiPostProcessFactory::keys(); + } +- +-} // extern "C" +-- +2.14.1 + diff --git a/recipes-multimedia/libyami/libyami/0006-Avoid-namespace-conflicts-by-adding-explicit-using-n.patch b/recipes-multimedia/libyami/libyami/0006-Avoid-namespace-conflicts-by-adding-explicit-using-n.patch new file mode 100644 index 0000000..c9c7452 --- /dev/null +++ b/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 +Date: Fri, 11 Aug 2017 18:38:05 -0700 +Subject: [PATCH 6/9] Avoid namespace conflicts by adding explicit using + + +Signed-off-by: Khem Raj +--- +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 PicturePtr; + typedef std::vector 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/recipes-multimedia/libyami/libyami/0007-Delete-unused-variables.patch b/recipes-multimedia/libyami/libyami/0007-Delete-unused-variables.patch new file mode 100644 index 0000000..b80774c --- /dev/null +++ b/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 +Date: Fri, 11 Aug 2017 18:39:58 -0700 +Subject: [PATCH 7/9] Delete unused variables + +Signed-off-by: Khem Raj +--- +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/recipes-multimedia/libyami/libyami/0008-NalUnit-is-declared-in-different-namespace.patch b/recipes-multimedia/libyami/libyami/0008-NalUnit-is-declared-in-different-namespace.patch new file mode 100644 index 0000000..18b98be --- /dev/null +++ b/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 +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 +--- +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/recipes-multimedia/libyami/libyami/0009-Fix-clang-warnings.patch b/recipes-multimedia/libyami/libyami/0009-Fix-clang-warnings.patch new file mode 100644 index 0000000..08ef455 --- /dev/null +++ b/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 +Date: Fri, 11 Aug 2017 18:53:06 -0700 +Subject: [PATCH 9/9] Fix clang warnings + +Signed-off-by: Khem Raj +--- +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/recipes-multimedia/libyami/libyami_1.2.0.bb b/recipes-multimedia/libyami/libyami_1.2.0.bb new file mode 100644 index 0000000..1d1d02f --- /dev/null +++ b/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\d+(\.\d+)+)" diff --git a/recipes-rt/images/core-image-rt-sdk.bb b/recipes-rt/images/core-image-rt-sdk.bb new file mode 100644 index 0000000..6b43a87 --- /dev/null +++ b/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/recipes-rt/images/core-image-rt.bb b/recipes-rt/images/core-image-rt.bb new file mode 100644 index 0000000..4db0a57 --- /dev/null +++ b/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/recipes-selftest/images/files/incorrect.crt b/recipes-selftest/images/files/incorrect.crt new file mode 100644 index 0000000..3a2411a --- /dev/null +++ b/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/recipes-selftest/images/files/incorrect.key b/recipes-selftest/images/files/incorrect.key new file mode 100644 index 0000000..d05475b --- /dev/null +++ b/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/recipes-selftest/images/files/refkit-db.crt b/recipes-selftest/images/files/refkit-db.crt new file mode 100644 index 0000000..22ad6a8 --- /dev/null +++ b/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/recipes-selftest/images/files/refkit-db.key b/recipes-selftest/images/files/refkit-db.key new file mode 100644 index 0000000..4b54587 --- /dev/null +++ b/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/recipes-selftest/images/secureboot-selftest-image-signed.bb b/recipes-selftest/images/secureboot-selftest-image-signed.bb new file mode 100644 index 0000000..3ce11f3 --- /dev/null +++ b/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/recipes-selftest/images/secureboot-selftest-image-unsigned.bb b/recipes-selftest/images/secureboot-selftest-image-unsigned.bb new file mode 100644 index 0000000..e03e7b4 --- /dev/null +++ b/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/recipes-support/sbsigntool/sbsigntool-native_git.bb b/recipes-support/sbsigntool/sbsigntool-native_git.bb new file mode 100644 index 0000000..430a6a7 --- /dev/null +++ b/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)}' \ + " diff --git a/wic/core-image-tiny.wks.in b/wic/core-image-tiny.wks.in new file mode 100644 index 0000000..b0decae --- /dev/null +++ b/wic/core-image-tiny.wks.in @@ -0,0 +1,14 @@ +# short-description: Create an EFI disk image with systemd-boot and corei7-64/core2-32 +# long-description: Creates a partitioned EFI disk image that the user +# can directly dd to boot media. The selected bootloader is systemd-boot. +# This disk image is meant to be used by corei7-64/core2-32 and core-image-tiny-initramfs + +part /boot --source bootimg-efi --sourceparams="loader=systemd-boot,initrd=core-image-tiny-initramfs-${MACHINE}.cpio.gz" --ondisk sda --label msdos --active --align 1024 + +bootloader --ptable gpt --timeout=5 --append="init=/bin/busybox sh init console=ttyS0,115200 console=tty0 rw LABEL=boot debugshell=5" + +# Some devices require different console parameters, the console parameter can be given repeatedly, input is taken +# only from the last listed console, for example on the Minnowboard MAX, the previously listed setting would show +# a login prompt on its video output and not on the serial terminal. +# +# See http://www.tldp.org/HOWTO/Remote-Serial-Console-HOWTO/configure-kernel.html diff --git a/wic/galileodisk-sd.wks b/wic/galileodisk-sd.wks new file mode 100644 index 0000000..225778d --- /dev/null +++ b/wic/galileodisk-sd.wks @@ -0,0 +1,9 @@ +# short-description: Create a Galileo Gen 1/2 disk image (SD card) +# long-description: Creates a partitioned EFI disk image for Intel Galileo Gen 1/2 +# boards that the user can directly dd to an SD card and boot. + +part /boot --source bootimg-efi --sourceparams="loader=systemd-boot" --ondisk mmcblk0 --label msdos --active --align 1024 + +part / --source rootfs --ondisk mmcblk0 --fstype=ext3 --label platform --align 1024 --use-uuid + +bootloader --timeout=1 --append="rootwait console=ttyS1,115200n8 earlycon=uart8250,mmio32,0x9000b000,115200n8 reboot=efi,warm apic=debug rw LABEL=boot debugshell=5" diff --git a/wic/galileodisk-usb.wks b/wic/galileodisk-usb.wks new file mode 100644 index 0000000..b561fa0 --- /dev/null +++ b/wic/galileodisk-usb.wks @@ -0,0 +1,9 @@ +# short-description: Create a Galileo Gen 1/2 disk image (USB storage) +# long-description: Creates a partitioned EFI disk image for Intel Galileo Gen 1/2 +# that the user can directly dd to USB storage media and boot. + +part /boot --source bootimg-efi --sourceparams="loader=systemd-boot" --ondisk sda --label msdos --active --align 1024 + +part / --source rootfs --ondisk sda --fstype=ext3 --label platform --align 1024 --use-uuid + +bootloader --timeout=1 --append="rootwait console=ttyS1,115200n8 earlycon=uart8250,mmio32,0x9000b000,115200n8 reboot=efi,warm apic=debug rw LABEL=boot debugshell=5" diff --git a/wic/generic-bootdisk.wks.in b/wic/generic-bootdisk.wks.in new file mode 100644 index 0000000..31c708b --- /dev/null +++ b/wic/generic-bootdisk.wks.in @@ -0,0 +1,6 @@ +# based off of refkit's refkit-directdisk.wks.in kickstart template +# uses the image's boot directory to populate a vfat boot partition, +# which works with EFI. +bootloader --ptable gpt +part /boot --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/boot --fstype=vfat --label msdos --active --align 1024 --use-uuid +part / --source rootfs --fstype=ext4 --label root --align 1024 --uuid ${DISK_SIGNATURE_UUID} diff --git a/wic/mktinygalileodisk.wks b/wic/mktinygalileodisk.wks new file mode 100644 index 0000000..52f1e12 --- /dev/null +++ b/wic/mktinygalileodisk.wks @@ -0,0 +1,7 @@ +# short-description: Create an Galileo Gen 1/2 disk image +# long-description: Creates a partitioned EFI disk image for Intel Galileo Gen 1/2, +# that the user can directly dd to boot media. + +part /boot --source bootimg-efi --sourceparams="loader=systemd-boot,initrd=core-image-tiny-initramfs-intel-quark.cpio.gz" --ondisk mmcblk0 --label msdos --active --align 1024 + +bootloader --timeout=0 --append="console=ttyS1,115200n8 earlycon=uart8250,mmio32,0x9000b000,115200n8 reboot=efi,warm apic=debug rw LABEL=boot debugshell=5"