luv-live-image: Create second partition for test results

Create a second partition to export the results of the LuvOS test
manager.

The idea behind using a different partition for the results is to avoid
any corruption on the boot partition.

The size of the partition is determined according to the following
assupmtions:

 - 500 test cases
 - 100 lines of raw results per test case
 -  20 lines of persed results per test case
 -  80 characters per line

Under such assumptions, 4.5MB of data space are required. As most USB
sticks have much greater capacity, the partition size is doubled to 8MB
to err on the safe side.

TODO: An arbitrary UUID is used for the results partitions. This UUID
must match with the UUID used by the test manager init script to mount
the partition. Thus, it is necessary to obtain the UUID by either
parsing such init script or modifying the UUID in the script

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
luv-test-manager: Save results to non-volatile media

Add functionality to save the test results to non-volatile media.  The
non-volatile media is expected to be a disk identified by its UUID. The
disk is mounted using the UUID to avoid writing inadvertently writing to
any other disk present in the system.

Clearly, this implementation requires the presence of a disk with the
UUID specified by the script. Thus, it is required to utilize such UUID
when creating the filesystem.

Also, disks in some systems take a while to be ready for mount and may
not be ready when the LUV test manager runs. Thus, a delay of 5 seconds
is introduced in order to increase the likelihood of finding the
intended disk.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
recipes-bsp: add gnu-efi recipe

gnu-efi is required by gummiboot.
Imported from meta-intel, PR dropped, no new version available.

(From OE-Core rev: fdb65c569db2b55023f9d1d72959e4e7d187a1d8)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
recipes-bsp: Add gummiboot recipe

gummiboot is a simple UEFI boot manager.

Recipe imported from meta-intel with these changes:
 - drop PR and update configure options
 - upgraded to latest version

A couple of notes:
 - If you wish you can install the gummiboot package on the target and
use 'gummiboot install' to add the payload to the ESP (see gummiboot --help,
just make sure the ESP partition has the boot flag on as gummiboot won't accept it
otherwise). However the point of this recipe is to be used by bootimg.bbclass and
generate images with gummiboot instead of grub-efi.
 - You need a kernel which has CONFIG_EFI_STUB=y at least
 - The default linux-yocto kernel config does not enable that, easiest way
to enable is to build with KERNEL_FEATURES_append = " cfg/efi-ext" in local.conf

(From OE-Core rev: 8f95d0598c31fff76e2a58fecb6c96197121a044)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
bootimg/grub-efi.bbclass: allow using a different class for EFI images

Abstract away some names so one can select using EFI_PROVIDER a different
class than grub-efi for populating live images, basically allowing the use
of a different bootloader than grub-efi.

(From OE-Core rev: 14e5de3b8f4d5902d0ac683ff45fb878e88b40ef)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
classes: Add gummiboot class

Adds a gummiboot class similar to grub-efi class and makes the necessary
changes so it can be used for live/hddimg images as well.

One can set EFI_PROVIDER = "gummiboot" in local.conf to use gummiboot instead of grub-efi.
Gummiboot requires some kernel options that are not enabled by default, so one has to build
with KERNEL_FEATURES_append = " cfg/efi-ext".

The install scripts have been updated too, keeping the old behaviour around,
but accounting for the new boot loader config files (if they exist).
It can be argued that the installer and bootimg are a bit wierd and not necessarily correct,
but I wanted to have the exact same behviour with gummiboot.
With the default EFI_PROVIDER = "grub-efi" nothing changes, everthing should be just as before.

I've tested live boot, install and normal boot on:
    - FRI2
    - genericx86-64 on NUC
with:
  EFI_PROVIDER = "gummiboot"
  KERNEL_FEATURES_append = " cfg/efi-ext"
in local.conf.

(From OE-Core rev: b457e40fc69cc6503dc566f16495f03606e5333b)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
recipes-bsp: Add efilinux recipe

efilinux is a minimal reference UEFI bootloader. It doesn't include
graphics or a complex configuration syntax, just the bear minimum
necessary to boot a Linux kernel.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
iasl: New recipe for ACPICA toolchain

Import iasl recipe from the meta-virtualization layer.

This recipe is required for ovmf, which is currently relying on the
host's installed iasl package.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
ovmf: Add iasl as a native dependency

Now that we've got a recipe for iasl add it as an explicit dependency
for ovmf. Previously the host system was required to have the iasl
package installed, which isn't very clean as our build should be
completely self-contained and not using the host's packages.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
generate-manifest-2.7.py: Add importlib

importlib isn't currently included in any of the python packages, so
create a new one for recipes that require it.

Cc: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
chipsec: Add recipe for CHIPSEC v1.1.0

CHIPSEC is a platform security assessment framework for analyzing the
security of PC platforms. It includes a number of tests and also
provides forensic capabilities for firmware.

Of particular use are the UEFI secure boot variable tests and BIOS flash
write-protect tests.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
chipsec: Enable luv test automatic execution

Integrate chipsec into the test manager infrastructure and add a parser
to capture test results and write them to stdout in the luv-test-manager
compatible format.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
luv-test: Add auto-generated test files to FILES_${PN}

Instead of managing our own luv package just add the auto-generated
files to FILES_${PN} to avoid QA warnings.

In the future we could do our own luv package, but let's keep thing
simple for now.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
core-image-efi-initramfs: Add chipsec test

Include the chipsec test suite in this image.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
bootimg.bbclass: Add parameter to specify HDDIMG volume ID

Users and children of the bootimg class may need to specify at build
time the volume ID of the HDDIMG vfat partition. An example of this
may be when at runtime the partition is uniquely identified by
the volume ID.

The HDDIMG_ID is expected to be provided externally. If the variable
is not set, mkdosfs will use the default volume-id.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
luv-live-image: Set the volume-id for the boot vfat partition

In order to uniquely identify the partition at runtime, specify
a known volume-id.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
luv-live-image: Append kernel parameter for handling crashes

Add the crashkernel parameter to indicate the kernel to reserve memory
for the kernel and initrd images that will be used in the event of a
crash.

TODO: Define different size of memory for different amounts of available
memory in the system. Also, explain why we are using 256M and not other

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
linux-yocto-efi-test: Enable kernel debug info

In order to provide more useful information in case of a kernel crash,
compile the kernel with debug info.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
initscritpts: Add a crash handler

LuvOS is used to validate UEFI firmware implementations. Such implemen-
tations may be at different levels of maturity. Thus, they could pose
stability threats to the Linx kernel. It could also be possibly that
the kernel itself may have an undiscovered bug.

The crash handler aims to handle such situations in a gracefully manner.
During a regular boot, at runlevel 5, the handler uses kexec to prepare
the system for an eventual crash so that the system can be rebooted to
a usable state. In such recovery boot, memory dumps can be made to perform
analyses on what caused the crash.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>