Initial commit from meta-intel 2f1bcac3fb3b42602f689fb4a1092aa5f4cf0c8a

This commit is contained in:
Saul Wold 2017-09-26 08:25:37 -07:00
commit a98b71ccad
246 changed files with 16473 additions and 0 deletions

43
CHANGELOG Normal file
View File

@ -0,0 +1,43 @@
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.
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"

17
COPYING.MIT Normal file
View File

@ -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.

5
LICENSE Normal file
View File

@ -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.

36
MAINTAINERS Normal file
View File

@ -0,0 +1,36 @@
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 <address@domain>
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)
-----------------------------------
COMMON
M: Saul Wold <sgw@linux.intel.com>
F: common/
TLK
M: Saul Wold <sgw@linux.intel.com>
F: meta-tlk/

481
README Normal file
View File

@ -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-<TUNE>-<BITS>, 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 += "<local path>/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 #<bug-id>].
- 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.

17
README.sources Normal file
View File

@ -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

17
classes/rmc-boot.bbclass Normal file
View File

@ -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
}

92
classes/rmc-db.bbclass Normal file
View File

@ -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
}

View File

@ -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
}
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"
# 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"

50
classes/uefi-sign.bbclass Normal file
View File

@ -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 \
"

30
common/custom-licenses/BSD_LMS Executable file
View File

@ -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.

View File

@ -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.

View File

@ -0,0 +1,20 @@
Add a missing debug ifdef causing compilation problems.
Upstream-Status: Submitted
Signed-off-by: Tom Zanussi <tom.zanussi (a] intel.com>
Index: lms-7.1.20/src/tools/ATNetworkTool.cpp
===================================================================
--- lms-7.1.20.orig/src/tools/ATNetworkTool.cpp 2012-04-30 23:24:56.693879920 -0500
+++ lms-7.1.20/src/tools/ATNetworkTool.cpp 2012-04-30 23:25:32.363473948 -0500
@@ -302,7 +302,9 @@
close(s);
return -1;
}
+#ifdef LMS_NET_DEBUG
printf("successfully binded local\n");
+#endif
}
if (bind(s, addr, addrlen) == -1) {

View File

@ -0,0 +1,18 @@
Add a missing include causing compilation (missing declaration) problems.
Upstream-Status: Submitted
Signed-off-by: Tom Zanussi <tom.zanussi (a] intel.com>
Index: lms-7.1.20/src/tools/ATVersion.cpp
===================================================================
--- lms-7.1.20.orig/src/tools/ATVersion.cpp 2012-05-29 20:34:34.061997035 -0500
+++ lms-7.1.20/src/tools/ATVersion.cpp 2012-05-29 20:35:22.671412948 -0500
@@ -40,6 +40,7 @@
#include <cerrno>
#include <fstream>
#include <dirent.h>
+#include <unistd.h>
#define AT_VERSION_ARGUMENT "--version"
#define AT_VERSION_MAXSIZE 40

View File

@ -0,0 +1,28 @@
From 518a3a277c89a3d6b0a9d3ee552cfa33a1dbd5c6 Mon Sep 17 00:00:00 2001
From: Jussi Kukkonen <jussi.kukkonen@intel.com>
Date: Mon, 23 Jan 2017 20:45:08 +0200
Subject: [PATCH 1/2] Include sys/select.h for fd_set()
This is needed at least on musl.
Upstream-Status: Pending
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
src/mei/MEILinux.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mei/MEILinux.cpp b/src/mei/MEILinux.cpp
index 1e9d28f..631270e 100755
--- a/src/mei/MEILinux.cpp
+++ b/src/mei/MEILinux.cpp
@@ -37,6 +37,7 @@
#include <cerrno>
#include <fcntl.h>
#include <sys/ioctl.h>
+#include <sys/select.h>
#include <unistd.h>
#include <stdint.h>
#include <aio.h>
--
2.1.4

View File

@ -0,0 +1,31 @@
From 8d737ba9745bef223c3d3b96899f11c26102ea04 Mon Sep 17 00:00:00 2001
From: Saul Wold <sgw@linux.intel.com>
Date: Mon, 16 May 2016 09:01:05 -0700
Subject: [PATCH] Protocol.cpp: Add whitespace for gcc6 compile error
When moving from C++-3 -> C++11 additiona white space is required between
User-defined literals.
Upstream-Status: Pending
Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
src/Protocol.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Protocol.cpp b/src/Protocol.cpp
index 1c21a0f..3a4a9bb 100755
--- a/src/Protocol.cpp
+++ b/src/Protocol.cpp
@@ -1428,7 +1428,7 @@ int Protocol::_handleFQDNChange(const char *fqdn)
char host[FQDN_MAX_SIZE + 1];
#define LMS_MAX_LINE_LEN 1023
char line[LMS_MAX_LINE_LEN + 1];
-#define LMS_LINE_SIG_FIRST_WORDS(a) "# LMS GENERATED "a" "
+#define LMS_LINE_SIG_FIRST_WORDS(a) "# LMS GENERATED " a " "
#define LMS_LINE_SIG_LAST_WORD "LINE"
#define LMS_LINE_SIG_LAST_WORD_LEN 4
#define LMS_LINE_SIG(a) LMS_LINE_SIG_FIRST_WORDS(a) LMS_LINE_SIG_LAST_WORD
--
2.5.0

View File

@ -0,0 +1,31 @@
From 0adc925ca9e005f93d77f373ccda2a6c6cc3ff2f Mon Sep 17 00:00:00 2001
From: Jussi Kukkonen <jussi.kukkonen@intel.com>
Date: Mon, 23 Jan 2017 20:46:50 +0200
Subject: [PATCH 2/2] Use proper netinet/in.h API
in6addr is only guaranteed to contain this member:
uint8_t s6_addr[16]
Use that instead of the glibc implementation detail __in6_u.
Upstream-Status: Pending
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
src/tools/ATNetworkTool.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tools/ATNetworkTool.cpp b/src/tools/ATNetworkTool.cpp
index 66e27df..0789c79 100755
--- a/src/tools/ATNetworkTool.cpp
+++ b/src/tools/ATNetworkTool.cpp
@@ -207,7 +207,7 @@ int ATNetworkTool::GetSockPeerIP(int sock, ATAddressList & peerAddresses, int &e
if(sa->sa_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&addr)) //if(IN6_IS_ADDR_V4COMPAT(&addr))
{
struct in_addr demapped_addr;
- memcpy(&demapped_addr.s_addr, &addr.__in6_u.__u6_addr8[12], 4);
+ memcpy(&demapped_addr.s_addr, &addr.s6_addr[12], 4);
struct sockaddr_in sa_in;
sa_in.sin_family = AF_INET;
--
2.1.4

View File

@ -0,0 +1,91 @@
Fix device file referance to /dev/mei0, remove select post write.
LMS uses /dev/mei character device which is absent on current kernel versions causing LMS fail to initialize. LMS sends messages to MEI with a post select timeout. Select timeout causes SendMessage to fail causing LMS to not to communicate properly with MEI.
Adding /dev/mei0 device file reference to check first and then /dev/mei sucessfully initializes LMS. Rely on write return length and remove select with timeout to fix communication with MEI.
Upstream-Status: Pending
Signed-off-by: Anand Vastrad <anand.vastrad@intel.com>
---
src/mei/MEILinux.cpp | 43 +++++++------------------------------------
1 file changed, 7 insertions(+), 36 deletions(-)
diff --git a/src/mei/MEILinux.cpp b/src/mei/MEILinux.cpp
index 1e9d28f..6d23f54 100755
--- a/src/mei/MEILinux.cpp
+++ b/src/mei/MEILinux.cpp
@@ -94,13 +94,17 @@ bool MEILinux::Init(unsigned char reqProtocolVersion)
Deinit();
}
- _fd = open("/dev/mei", O_RDWR);
+ _fd = open("/dev/mei0", O_RDWR);
if (_fd == -1 ) {
if (_verbose) {
- fprintf(stderr, "Error: Cannot establish a handle to the MEI driver\n");
+ fprintf(stderr, "Warning: Cannot establish a handle to the MEI driver mei0, retrying with mei \n");
+ }
+ _fd = open("/dev/mei", O_RDWR);
+ if (_fd == -1 ) {
+ fprintf(stderr, "Error: Cannot establish a handle to the MEI driver mei\n");
+ return false;
}
- return false;
}
_initialized = true;
@@ -181,13 +185,7 @@ int MEILinux::ReceiveMessage(unsigned char *buffer, int len, unsigned long timeo
int MEILinux::SendMessage(const unsigned char *buffer, int len, unsigned long timeout)
{
int rv = 0;
- int return_length =0;
int error = 0;
- fd_set set;
- struct timeval tv;
-
- tv.tv_sec = timeout / 1000;
- tv.tv_usec =(timeout % 1000) * 1000000;
if (_verbose) {
fprintf(stdout, "call write length = %d\n", len);
@@ -198,35 +196,8 @@ int MEILinux::SendMessage(const unsigned char *buffer, int len, unsigned long ti
if (_verbose) {
fprintf(stderr,"write failed with status %d %d\n", rv, error);
}
- goto out;
- }
-
- return_length = rv;
-
- FD_ZERO(&set);
- FD_SET(_fd, &set);
- rv = select(_fd+1 ,&set, NULL, NULL, &tv);
- if (rv > 0 && FD_ISSET(_fd, &set)) {
- if (_verbose) {
- fprintf(stderr, "write success\n");
- }
}
- else if (rv == 0) {
- if (_verbose) {
- fprintf(stderr, "write failed on timeout with status\n");
- }
- goto out;
- }
- else { //rv<0
- if (_verbose) {
- fprintf(stderr, "write failed on select with status %d\n", rv);
- }
- goto out;
- }
-
- rv = return_length;
-out:
if (rv < 0) {
Deinit();
}
--
2.7.4

File diff suppressed because it is too large Load Diff

View File

@ -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} || :
}

View File

@ -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} || :
}

View File

@ -0,0 +1,33 @@
From 7c171c1813651a3a02ad2cda361b42ebc7ce324d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 12 Aug 2017 10:34:19 -0700
Subject: [PATCH 1/2] Disable address-of-packed-member warning
Clang complains so make it happy
loaders/bzimage/bzimage.c:346:55: error: taking address of packed member 'base' of class or structure 'dt_addr_t' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
err = emalloc(gdt.limit, 8, (EFI_PHYSICAL_ADDRESS *)&gdt.base);
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index a955e34..ff1b79b 100644
--- a/Makefile
+++ b/Makefile
@@ -61,7 +61,7 @@ ifeq ($(ARCH),ia32)
endif
endif
ifeq ($(ARCH),x86_64)
- CFLAGS += -mno-red-zone
+ CFLAGS += -mno-red-zone -Wno-address-of-packed-member
endif
LDFLAGS=-T $(LDSCRIPT) -Bsymbolic -shared -nostdlib -znocombreloc \
--
2.14.1

View File

@ -0,0 +1,33 @@
From 49053e4ff0f3550d019cdad8a93677c18fc69791 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 12 Aug 2017 10:35:09 -0700
Subject: [PATCH 2/2] initialize char pointers
Clang complains about using them without initializing
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending
entry.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/entry.c b/entry.c
index 0aa6cdd..23ba51e 100644
--- a/entry.c
+++ b/entry.c
@@ -402,9 +402,9 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *_table)
WCHAR *error_buf;
EFI_STATUS err;
EFI_LOADED_IMAGE *info;
- CHAR16 *name, *options;
+ CHAR16 *name = NULL, *options;
UINT32 options_size;
- char *cmdline;
+ char *cmdline = NULL;
InitializeLib(image, _table);
sys_table = _table;
--
2.14.1

View File

@ -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))
}

View File

@ -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

View File

@ -0,0 +1 @@
FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:"

View File

@ -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; }

View File

@ -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

View File

@ -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"

View File

@ -0,0 +1,3 @@
boot.conf
install.conf

View File

@ -0,0 +1,4 @@
title Galileo Gen 2 boot
linux /vmlinuz
initrd /initrd
options LABEL=boot rootwait console=ttyS1,115200

Binary file not shown.

View File

@ -0,0 +1,4 @@
title Galileo Gen 2 install
linux /vmlinuz
initrd /initrd
options LABEL=install-efi rootwait console=ttyS1,115200

View File

@ -0,0 +1 @@
console=ttyS0,115200

View File

@ -0,0 +1,2 @@
boot.conf
install.conf

View File

@ -0,0 +1,2 @@
efi_entry_dir:root:disk:770:/boot/loader/entries/
boot.conf:root:disk:770:/boot/loader/entries/rmcboot.conf

View File

@ -0,0 +1,2 @@
# There is no tty device on this board.
sed -i '/start_getty.\+ttyS.*/d' /tgt_root/etc/inittab

View File

@ -0,0 +1,4 @@
title NUC5i5RYB boot
linux /vmlinuz
initrd /initrd
options LABEL=boot rootwait

View File

@ -0,0 +1,4 @@
title NUC5i5RYB install
linux /vmlinuz
initrd /initrd
options LABEL=install-efi rootwait

Binary file not shown.

View File

@ -0,0 +1,2 @@
boot.conf
install.conf

Binary file not shown.

View File

@ -0,0 +1,4 @@
title T100T(32bit) boot
linux /vmlinuz
initrd /initrd
options LABEL=boot loglevel=8

View File

@ -0,0 +1,4 @@
title T100T(32bit) install
linux /vmlinuz
initrd /initrd
options LABEL=install-efi

View File

@ -0,0 +1,2 @@
boot.conf
install.conf

View File

@ -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

View File

@ -0,0 +1 @@
video=efifb maxcpus=4 reboot=efi kmemleak=off console=tty0 console=ttyS2,115200

View File

@ -0,0 +1,2 @@
# Joule uses only S2 for serial, so remove S0
sed -i '/start_getty.\+ttyS0/d' /tgt_root/etc/inittab

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,4 @@
title Joule / Broxton-m
linux /vmlinuz
initrd /initrd
options LABEL=boot

View File

@ -0,0 +1,4 @@
title Joule / Broxton-m Install
linux /vmlinuz
initrd /initrd
options LABEL=install-efi rootwait

Binary file not shown.

View File

@ -0,0 +1,2 @@
boot.conf
install.conf

View File

@ -0,0 +1,4 @@
title Minnow Max boot
linux /vmlinuz
initrd /initrd
options LABEL=boot console=ttyS0,115200n8

View File

@ -0,0 +1,4 @@
title Minnow Max install
linux /vmlinuz
initrd /initrd
options LABEL=install-efi console=ttyS0,115200n8

Binary file not shown.

View File

@ -0,0 +1,2 @@
boot.conf
install.conf

View File

@ -0,0 +1,4 @@
title Minnow Max B3 boot
linux /vmlinuz
initrd /initrd
options LABEL=boot console=ttyS0,115200n8

View File

@ -0,0 +1,4 @@
title Minnow Max B3 install
linux /vmlinuz
initrd /initrd
options LABEL=install-efi console=ttyS0,115200n8

View File

@ -0,0 +1,2 @@
boot.conf
install.conf

View File

@ -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

View File

@ -0,0 +1 @@
console=ttyS1,115200 console=tty1

View File

@ -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

View File

@ -0,0 +1,4 @@
title Mohon Peak boot
linux /vmlinuz
initrd /initrd
options LABEL=boot

View File

@ -0,0 +1,4 @@
title Mohon Peak Install
linux /vmlinuz
initrd /initrd
options LABEL=install-efi rootwait

Binary file not shown.

View File

@ -0,0 +1,2 @@
boot.conf
install.conf

View File

@ -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

View File

@ -0,0 +1 @@
i915.preliminary_hw_support=1

View File

@ -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

View File

@ -0,0 +1,4 @@
title NUC Gen6 boot
linux /vmlinuz
initrd /initrd
options LABEL=boot

View File

@ -0,0 +1,4 @@
title NUC Gen6 install
linux /vmlinuz
initrd /initrd
options LABEL=install-efi

View File

@ -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"

Binary file not shown.

View File

@ -0,0 +1 @@
console=ttyS0,115200

Binary file not shown.

View File

@ -0,0 +1 @@
console=ttyS0,115200

Binary file not shown.

View File

@ -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

View File

@ -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
}

View File

@ -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"

View File

@ -0,0 +1,31 @@
From 58669ad764767afea4de53f8a97357773b1855ef Mon Sep 17 00:00:00 2001
From: Saul Wold <sgw@linux.intel.com>
Date: Tue, 25 Oct 2016 12:54:08 -0700
Subject: [PATCH] efi/boot.c: workaround for Joule BIOS hang
This patch should be removed when the BIOS is fixed
Authored-by: Steve Sakoman <steve@sakoman.com>
Upstream-Status: Inappropriate [machine specific workaround]
Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
src/boot/efi/boot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c
index 3dcd9a5..3c6ed8c 100644
--- a/src/boot/efi/boot.c
+++ b/src/boot/efi/boot.c
@@ -649,7 +649,7 @@ static BOOLEAN menu_run(Config *config, ConfigEntry **chosen_entry, CHAR16 *load
}
/* timeout disabled, wait for next key */
- wait = TRUE;
+ wait = FALSE;
continue;
}
--
2.7.4

View File

@ -0,0 +1,39 @@
From fe1c2fdfe81f2ac2b41fe8543ba07f1911770d26 Mon Sep 17 00:00:00 2001
From: Jianxun Zhang <jianxun.zhang@linux.intel.com>
Date: Sat, 21 May 2016 18:52:07 -0700
Subject: [PATCH] sd-boot: Link RMC library into bootloader and stub
Add RMC library into bootloader binary and stub.
Upstream-Status: Pending
Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
---
Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 305099ab6..9fb6f9b7b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2802,7 +2802,7 @@ $(top_builddir)/src/boot/efi/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(t
$(systemd_boot_solib): $(systemd_boot_objects)
$(AM_V_CCLD)$(LD) $(efi_ldflags) $(systemd_boot_objects) \
- -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \
+ -o $@ -lefi -lgnuefi -lrmcefi $(shell $(CC) -print-libgcc-file-name); \
nm -D -u $@ | grep ' U ' && exit 1 || :
$(systemd_boot): $(systemd_boot_solib)
@@ -2852,7 +2852,7 @@ $(top_builddir)/src/boot/efi/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(t
$(stub_solib): $(stub_objects)
$(AM_V_CCLD)$(LD) $(efi_ldflags) $(stub_objects) \
- -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \
+ -o $@ -lefi -lgnuefi -lrmcefi $(shell $(CC) -print-libgcc-file-name); \
nm -D -u $@ | grep ' U ' && exit 1 || :
$(stub): $(stub_solib)
--
2.11.0

View File

@ -0,0 +1,42 @@
From 87cd5a5e0f06ceb7f9dbdcc4029e0c279a38e6ad Mon Sep 17 00:00:00 2001
From: Mikko Ylinen <mikko.ylinen@linux.intel.com>
Date: Mon, 27 Feb 2017 10:04:03 +0200
Subject: [PATCH] sd-boot: stub: check LoadOptions contains data
With some UEFI shells LoadOptionsSize is reported being > 0
but the corresponding LoadOptions does not contain any data
(the first element has value 0).
When that happens, the stub feature that allows .cmdline to be
replaced by what's in LoadOptions ends up copying nothing/random
data to the kernel cmdline resulting in different kinds of boot
problems.
To fix this, add a check to see if LoadOptions contains data
before replacing the .cmdline.
Upstream-Status: Accepted [https://github.com/systemd/systemd/pull/5467]
Fixes [YOCTO #11078].
Signed-off-by: Mikko Ylinen <mikko.ylinen@linux.intel.com>
---
src/boot/efi/stub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c
index 7c1ffb1bc..b7d5d3cda 100644
--- a/src/boot/efi/stub.c
+++ b/src/boot/efi/stub.c
@@ -87,7 +87,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
cmdline_len = szs[0];
/* if we are not in secure boot mode, accept a custom command line and replace the built-in one */
- if (!secure && loaded_image->LoadOptionsSize > 0) {
+ if (!secure && loaded_image->LoadOptionsSize > 0 && *(CHAR16 *)loaded_image->LoadOptions != 0) {
CHAR16 *options;
CHAR8 *line;
UINTN i;
--
2.11.0

View File

@ -0,0 +1,250 @@
From a3c4fc8c2847fe289a617bcba1d905f580f0e18d Mon Sep 17 00:00:00 2001
From: Jianxun Zhang <jianxun.zhang@linux.intel.com>
Date: Wed, 1 Jun 2016 16:32:22 -0700
Subject: [PATCH 2/3] sd-boot: Load board-specific boot entries from RMC
database
RMC provides a centralized database file on ESP. The DB contains
fingerprints and any file blobs associated to physical boards.
Callers can fetch board-specific data with fingerprint info
collected from board at runtime if there is any record matched
board's fingerprint.
To let bootloader know which file blob in RMC should be queried,
a special config file BOOTENTRY.CONFIG is defined as:
boot.conf
install.conf
Bootloader calls RMC APIs and other functions to perform these
tasks before it shows boot menu to user:
(1) Load RMC database file from ESP
(2) Collect fingerprint data from board
(3) Query BOOTENTRY.CONFIG from RMC DB with fingerprint
(4) Parse BOOTENTRY.CONFIG to know names of boot entry files
(5) Query boot entry files one by one from RMC DB, and add
them into sd-boot config data.
The final effect is that bootloader will show board-specific
boot entries in boot menu to user. User then can choose one
of them to boot system with the selected configuration.
If any of these steps fails, bootloader simply skips loading
RMC configs or any entry file not successfully fetched from
RMC DB. Once any entry is loaded successfully from RMC DB,
bootloader skips loading any boot entries from ESP.
Upstream-Status: Pending
Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
---
src/boot/efi/boot.c | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 145 insertions(+), 2 deletions(-)
diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c
index 30c1ead..d1b029b 100644
--- a/src/boot/efi/boot.c
+++ b/src/boot/efi/boot.c
@@ -15,6 +15,7 @@
#include <efi.h>
#include <efilib.h>
+#include <rmc_api.h>
#include "console.h"
#include "disk.h"
@@ -33,6 +34,9 @@ static const char __attribute__((used)) magic[] = "#### LoaderInfo: systemd-boot
static const EFI_GUID global_guid = EFI_GLOBAL_VARIABLE;
+static CHAR8* rmc_db;
+static rmc_fingerprint_t *rmc_fp;
+
enum loader_type {
LOADER_UNDEFINED,
LOADER_EFI,
@@ -1702,6 +1706,136 @@ static VOID config_free(Config *config) {
FreePool(config->entry_oneshot);
}
+/* Derived from line_get_key_value(), we could consolidate two functions later */
+static CHAR8 *get_line(CHAR8 *content, UINT64 *pos) {
+ CHAR8 *line;
+ UINT64 linelen;
+
+skip:
+ line = content + *pos;
+ if (*line == '\0')
+ return NULL;
+
+ linelen = 0;
+ while (line[linelen] && !strchra((CHAR8 *)"\n\r", line[linelen]))
+ linelen++;
+
+ /* move pos to next line */
+ *pos += linelen;
+ if (content[*pos])
+ (*pos)++;
+
+ /* empty line */
+ if (linelen == 0)
+ goto skip;
+
+ /* terminate line */
+ line[linelen] = '\0';
+
+ /* remove leading whitespace */
+ while (strchra((CHAR8 *)" \t", *line)) {
+ line++;
+ linelen--;
+ }
+
+ /* remove trailing whitespace */
+ while (linelen > 0 && strchra((CHAR8 *)" \t", line[linelen-1]))
+ linelen--;
+ line[linelen] = '\0';
+
+ if (*line == '#')
+ goto skip;
+
+ return line;
+}
+
+/* load rmc database file from ESP and try to get fingerprint. These
+ * are essential information indicating we could query rmc data for
+ * this board at least
+ * return 0 if both database file and fingerprint can be obtained, otherwise
+ * non-zero value is returned.
+ *
+ * Note: db and fp hold valid values only when this function returns 0.
+ * Caller is responsible to free allocated memory pointed by *db and *fp when
+ * this function returns 0.
+ */
+
+static UINTN rmc_initialize(EFI_FILE *root_dir, EFI_SYSTEM_TABLE *sys_table, CHAR8 **db, rmc_fingerprint_t **fp) {
+ UINTN len;
+ UINTN ret = 1;
+
+ if (!db || !fp)
+ return ret;
+
+ *db = NULL;
+ *fp = NULL;
+
+ /* load rmc database */
+ len = file_read(root_dir, L"\\rmc.db", 0, 0, db);
+
+ if (len <= 0)
+ goto done;
+
+ *fp = AllocateZeroPool(sizeof(rmc_fingerprint_t));
+ /* call rmc to get fingerprint. We will use single-action rmc APIs to query multiple files.
+ * This should bring a better performance than calling double-action rmc API every time.
+ */
+ if (rmc_get_fingerprint(sys_table, *fp))
+ goto done;
+
+ ret = 0;
+done:
+ if (ret) {
+ FreePool(*db);
+ FreePool(*fp);
+ }
+
+ return ret;
+}
+
+/* load RMC entries
+ * return TRUE when at least one entry is loaded, otherwise, return FALSE
+ */
+static BOOLEAN config_load_rmc_entries(Config *config, EFI_HANDLE *device, CHAR16 *loaded_image_path, CHAR8 *db, rmc_fingerprint_t *fp) {
+ CHAR8 *boot_entry = NULL;
+ CHAR8 *boot_config = NULL;
+ rmc_file_t rp;
+ CHAR8 *line;
+ UINT64 pos = 0;
+ BOOLEAN ret = FALSE;
+
+ if (!db || !fp)
+ return ret;
+
+ /* query boot entry config file */
+ if (rmc_query_file_by_fp(fp, db, "BOOTENTRY.CONFIG", &rp))
+ return ret;
+
+ /* file blob read from rmc db is not necessarily null-terminated, and we
+ * should keep mem where rmc db lives from change during parsing
+ */
+ boot_config = AllocatePool(rp.blob_len * sizeof(CHAR8) + 1);
+ CopyMem(boot_config, rp.blob, rp.blob_len);
+ boot_config[rp.blob_len] = '\0';
+ /* parse boot entry config */
+ while ((line = get_line(boot_config, &pos))) {
+ if (rmc_query_file_by_fp(fp, db, (char *)line, &rp))
+ continue;
+ if (rp.blob_len > 0) {
+ boot_entry = AllocatePool(rp.blob_len * sizeof(CHAR8) + 1);
+ CopyMem(boot_entry, rp.blob, rp.blob_len);
+ boot_entry[rp.blob_len] = '\0';
+ config_entry_add_from_file(config, device,
+ stra_to_str(line), boot_entry,
+ loaded_image_path);
+ /* tell caller success when a RMC entry is loaded */
+ ret = TRUE;
+ }
+ }
+
+ return ret;
+}
+
EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
CHAR16 *s;
CHAR8 *b;
@@ -1714,6 +1848,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
UINT64 init_usec;
BOOLEAN menu = FALSE;
CHAR16 uuid[37];
+ BOOLEAN rmc_entry = FALSE;
InitializeLib(image, sys_table);
init_usec = time_usec();
@@ -1745,6 +1880,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
return EFI_LOAD_ERROR;
}
+ /* Initialize rmc before loading any config */
+ rmc_initialize(root_dir, sys_table, &rmc_db, &rmc_fp);
/* the filesystem path to this image, to prevent adding ourselves to the menu */
loaded_image_path = DevicePathToStr(loaded_image->FilePath);
@@ -1753,11 +1890,15 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
ZeroMem(&config, sizeof(Config));
config_load_defaults(&config, root_dir);
+ if (rmc_db && rmc_fp)
+ rmc_entry = config_load_rmc_entries(&config, loaded_image->DeviceHandle, loaded_image_path, rmc_db, rmc_fp);
+
/* scan /EFI/Linux/ directory */
config_entry_add_linux(&config, loaded_image, root_dir);
- /* scan /loader/entries/\*.conf files */
- config_load_entries(&config, loaded_image->DeviceHandle, root_dir, loaded_image_path);
+ /* scan /loader/entries/\*.conf files only when no RMC entry is loaded */
+ if (rmc_entry == FALSE)
+ config_load_entries(&config, loaded_image->DeviceHandle, root_dir, loaded_image_path);
/* sort entries after version number */
config_sort_entries(&config);
@@ -1851,6 +1992,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
out:
FreePool(loaded_image_path);
config_free(&config);
+ FreePool(rmc_db);
+ FreePool(rmc_fp);
uefi_call_wrapper(root_dir->Close, 1, root_dir);
uefi_call_wrapper(BS->CloseProtocol, 4, image, &LoadedImageProtocol, image, NULL);
return err;
--
2.7.4

View File

@ -0,0 +1,66 @@
From 1e33f99e13a70c19c1f63f6ef1c5522a09adece6 Mon Sep 17 00:00:00 2001
From: Jianxun Zhang <jianxun.zhang@linux.intel.com>
Date: Mon, 20 Jun 2016 13:08:20 -0700
Subject: [PATCH 3/3] sd-boot: Support global kernel command line fragment
Query file blob KBOOTPARAM from RMC. If it exists, we append
it to the new linux boot entry's cmdline. A boot entry could
be read from a .conf file on ESP, RMC database, or embedded
linux image. content in KBOOTPARAM is effective in all of
these cases.
Upstream-Status: Pending
Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
---
src/boot/efi/boot.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c
index d1b029b..8dffc48 100644
--- a/src/boot/efi/boot.c
+++ b/src/boot/efi/boot.c
@@ -846,6 +846,40 @@ static VOID config_add_entry(Config *config, ConfigEntry *entry) {
config->entries = ReallocatePool(config->entries,
sizeof(VOID *) * config->entry_count, sizeof(VOID *) * i);
}
+
+ /* rmc: a linux entry could be added from .conf file or an embedded linux image
+ * we put appending global command line here to cover both of two cases.
+ */
+ if (entry->type == LOADER_LINUX && rmc_db && rmc_fp) {
+ rmc_file_t rmc_kp;
+
+ if (!rmc_query_file_by_fp(rmc_fp, rmc_db, "KBOOTPARAM", &rmc_kp)) {
+ CHAR8 *cmdline;
+ CHAR16 *s;
+ CHAR16 *t;
+ CHAR16 *p;
+
+ cmdline = AllocatePool(rmc_kp.blob_len * sizeof(CHAR8) + 1);
+ CopyMem(cmdline, rmc_kp.blob, rmc_kp.blob_len);
+ cmdline[rmc_kp.blob_len] = '\0';
+ p = stra_to_str(cmdline);
+ t = p;
+
+ while (*t) {
+ if (*t == '\n')
+ *t = '\0';
+ t++;
+ }
+
+ s = PoolPrint(L"%s %s", entry->options, p);
+ FreePool(entry->options);
+ FreePool(p);
+ FreePool(cmdline);
+
+ entry->options = s;
+ }
+ }
+
config->entries[config->entry_count++] = entry;
}
--
2.7.4

View File

@ -0,0 +1,81 @@
From 4cb9c65ea9c0eba3ba04d036dccd4a5ab3d2547b Mon Sep 17 00:00:00 2001
From: Mikko Ylinen <mikko.ylinen@intel.com>
Date: Fri, 27 Jan 2017 13:31:45 +0200
Subject: [PATCH] sd-boot: support global kernel command line in EFI stub
This change integrates rmc into EFI stub and supports a
global fragment (RMC KBOOTPARAM) that is appended to the
cmdline at boot.
The fragment is board-specific and read from the database.
Implements [YOCTO #10924].
Upstream-status: Pending
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
---
src/boot/efi/stub.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c
index 1e250f34f..f3865199f 100644
--- a/src/boot/efi/stub.c
+++ b/src/boot/efi/stub.c
@@ -13,6 +13,7 @@
#include <efi.h>
#include <efilib.h>
+#include <rmc_api.h>
#include "disk.h"
#include "graphics.h"
@@ -48,6 +49,9 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
UINTN cmdline_len;
CHAR16 uuid[37];
EFI_STATUS err;
+ INTN len;
+ CHAR8 *rmc_db = NULL;
+ rmc_file_t rmc_file;
InitializeLib(image, sys_table);
@@ -112,6 +116,35 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
#endif
}
+ len = file_read(root_dir, L"\\rmc.db", 0, 0, &rmc_db);
+ if (len <= 0)
+ rmc_db = NULL;
+
+ /* If the board has a fragment in rmc database, append it to the cmdline */
+ if (rmc_db && !rmc_gimme_file(sys_table, rmc_db, "KBOOTPARAM", &rmc_file)) {
+ CHAR8 *line;
+ UINTN i = 0;
+ UINTN j;
+
+ line = AllocatePool(rmc_file.blob_len + cmdline_len + 2);
+
+ while (i < cmdline_len && cmdline[i] != '\0') {
+ line[i] = cmdline[i];
+ i++;
+ }
+
+ line[i++] = ' ';
+
+ for (j=0; j < rmc_file.blob_len; j++)
+ line[i+j] = rmc_file.blob[j];
+ line[i+j] = '\0';
+
+ cmdline = line;
+ cmdline_len = i + j;
+
+ FreePool(rmc_db);
+ }
+
/* export the device path this image is started from */
if (disk_get_part_uuid(loaded_image->DeviceHandle, uuid) == EFI_SUCCESS)
efivar_set(L"LoaderDevicePartUUID", uuid, FALSE);
--
2.11.0

View File

@ -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 \
"

View File

@ -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 \
"

View File

@ -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}
}

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -0,0 +1,2 @@
FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/files:"
PACKAGE_ARCH_intel-x86-common = "${INTEL_COMMON_PACKAGE_ARCH}"

View File

@ -0,0 +1,66 @@
SUMMARY = "Intel Processor Microcode Datafile for Linux"
HOMEPAGE = "http://www.intel.com/"
DESCRIPTION = "The microcode data file contains the latest microcode\
definitions for all Intel processors. Intel releases microcode updates\
to correct processor behavior as documented in the respective processor\
specification updates. While the regular approach to getting this microcode\
update is via a BIOS upgrade, Intel realizes that this can be an\
administrative hassle. The Linux operating system and VMware ESX\
products have a mechanism to update the microcode after booting.\
For example, this file will be used by the operating system mechanism\
if the file is placed in the /etc/firmware directory of the Linux system."
LICENSE = "Intel-Microcode-License"
LIC_FILES_CHKSUM = "file://microcode.dat;md5=e5b1dc41901d2de706d4bccee94bbadc"
SRC_URI = "https://downloadmirror.intel.com/26925/eng/microcode-${PV}.tgz"
SRC_URI[md5sum] = "fe4bcb12e4600629a81fb65208c34248"
SRC_URI[sha256sum] = "4fd44769bf52a7ac11e90651a307aa6e56ca6e1a814e50d750ba8207973bee93"
DEPENDS = "iucode-tool-native"
S = "${WORKDIR}"
COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
PACKAGE_ARCH = "${MACHINE_ARCH}"
inherit deploy
# Use any of the iucode_tool parameters to filter specific microcodes from the data file
# For further information, check the iucode-tool's manpage : http://manned.org/iucode-tool
UCODE_FILTER_PARAMETERS ?= ""
do_compile() {
mkdir -p ${WORKDIR}/ucode/kernel/x86/microcode
${STAGING_DIR_NATIVE}${sbindir_native}/iucode_tool \
${UCODE_FILTER_PARAMETERS} \
--overwrite \
--write-to=${WORKDIR}/microcode_${PV}.bin \
${WORKDIR}/microcode.dat
${STAGING_DIR_NATIVE}${sbindir_native}/iucode_tool \
${UCODE_FILTER_PARAMETERS} \
--overwrite \
--write-earlyfw=${WORKDIR}/microcode_${PV}.cpio \
${WORKDIR}/microcode.dat
}
do_install() {
install -d ${D}${base_libdir}/firmware/intel-ucode/
install ${WORKDIR}/microcode_${PV}.bin ${D}${base_libdir}/firmware/intel-ucode/
cd ${D}${base_libdir}/firmware/intel-ucode/
ln -sf microcode_${PV}.bin microcode.bin
}
do_deploy() {
install -d ${DEPLOYDIR}
install ${S}/microcode_${PV}.cpio ${DEPLOYDIR}/
cd ${DEPLOYDIR}
rm -f microcode.cpio
ln -sf microcode_${PV}.cpio microcode.cpio
}
addtask deploy before do_build after do_compile
PACKAGES = "${PN}"
FILES_${PN} = "${base_libdir}"

View File

@ -0,0 +1,29 @@
From 5f6826b3a59dedf508d5a6122362d69a4813e8e6 Mon Sep 17 00:00:00 2001
From: Saul Wold <sgw@linux.intel.com>
Date: Fri, 3 Feb 2017 16:08:51 -0800
Subject: [PATCH] Makefile.am: Add arg-parse library for MUSL support
iucode-tool needs argp-standalone when used with MUSL, so add this
patch to the Makefile to link with argp
Upstream-Status: Pending
Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile.am b/Makefile.am
index 415a241..764fb61 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,6 +5,7 @@
sbin_PROGRAMS = iucode_tool
man_MANS = iucode_tool.8
+iucode_tool_LDADD = -largp
iucode_tool_SOURCES = intel_microcode.h intel_microcode.c iucode_tool.c
EXTRA_DIST = autogen.sh CONTRIBUTING
--
2.7.4

Some files were not shown because too many files have changed in this diff Show More