[meta-intel] [PATCH] rmc: split rmc.bb and rmc-efi.bb into separate recipes

2017-07-06 Thread Todor Minchev
X32 builds require that the bootloader is built as x86_64 binary.
This patch splits the build definitions of the RMC userspace application
and the RMC EFI library into separate recipes and builds an x86_64 EFI library
when DEFAULTTUNE is x32.

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 common/recipes-bsp/rmc/rmc-efi.bb  | 39 ++
 common/recipes-bsp/rmc/rmc.bb  |  3 +-
 .../systemd-boot/systemd-boot/rmc-boot.inc |  2 +-
 3 files changed, 41 insertions(+), 3 deletions(-)
 create mode 100644 common/recipes-bsp/rmc/rmc-efi.bb

diff --git a/common/recipes-bsp/rmc/rmc-efi.bb 
b/common/recipes-bsp/rmc/rmc-efi.bb
new file mode 100644
index 000..ea09619
--- /dev/null
+++ b/common/recipes-bsp/rmc/rmc-efi.bb
@@ -0,0 +1,39 @@
+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"
+
+python () {
+   ccargs = d.getVar('TUNE_CCARGS').split()
+   if '-mx32' in ccargs:
+   ccargs.remove('-mx32')
+   ccargs.append('-m64')
+   d.setVar('TUNE_CCARGS', ' '.join(ccargs))
+}
+
+do_compile() {
+   oe_runmake -f Makefile.efi
+}
+
+do_install() {
+   oe_runmake -f Makefile.efi install
+}
diff --git a/common/recipes-bsp/rmc/rmc.bb b/common/recipes-bsp/rmc/rmc.bb
index 93fdd3a..fb0d173 100644
--- a/common/recipes-bsp/rmc/rmc.bb
+++ b/common/recipes-bsp/rmc/rmc.bb
@@ -28,14 +28,13 @@ EXTRA_OEMAKE = "RMC_INSTALL_PREFIX=${D}/${prefix} \
 RMC_INSTALL_HEADER_PATH=${D}${includedir}/rmc"
 
 SECURITY_CFLAGS_remove_class-target = "-fstack-protector-strong"
+
 do_compile_class-target() {
oe_runmake
-   oe_runmake -f Makefile.efi
 }
 
 do_install() {
oe_runmake install
-   oe_runmake -f Makefile.efi install
 }
 
 do_install_class-native() {
diff --git a/common/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc 
b/common/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc
index db75eb6..1172d53 100644
--- a/common/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc
+++ b/common/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc
@@ -1,4 +1,4 @@
-DEPENDS_append_intel-x86-common = " rmc"
+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"'
 
-- 
2.13.2

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH] rmc: add install.conf for platforms without internal storage

2017-07-05 Thread Todor Minchev
The bootloader menu provides only boot entries for platforms that do not
have internal storage. This commit adds install entries for such platforms.
For the install option to work, the user has to attach alternative
persistent storage in addition to the media from which the image is
installed.

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 common/recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG| 1 +
 common/recipes-bsp/rmc/boards/Galileo2/install.conf| 4 
 common/recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG   | 1 +
 common/recipes-bsp/rmc/boards/minnowmax/install.conf   | 4 
 common/recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG | 1 +
 common/recipes-bsp/rmc/boards/minnowmaxB3/install.conf | 4 
 6 files changed, 15 insertions(+)
 create mode 100644 common/recipes-bsp/rmc/boards/Galileo2/install.conf
 create mode 100644 common/recipes-bsp/rmc/boards/minnowmax/install.conf
 create mode 100644 common/recipes-bsp/rmc/boards/minnowmaxB3/install.conf

diff --git a/common/recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG 
b/common/recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG
index 06c5a74..dd1b911 100644
--- a/common/recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG
+++ b/common/recipes-bsp/rmc/boards/Galileo2/BOOTENTRY.CONFIG
@@ -1,2 +1,3 @@
 boot.conf
+install.conf
 
diff --git a/common/recipes-bsp/rmc/boards/Galileo2/install.conf 
b/common/recipes-bsp/rmc/boards/Galileo2/install.conf
new file mode 100644
index 000..688c2a8
--- /dev/null
+++ b/common/recipes-bsp/rmc/boards/Galileo2/install.conf
@@ -0,0 +1,4 @@
+title Galileo Gen 2 install
+linux /vmlinuz
+initrd /initrd
+options LABEL=install-efi rootwait console=ttyS1,115200
diff --git a/common/recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG 
b/common/recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG
index cb01ced..b2fabe8 100644
--- a/common/recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG
+++ b/common/recipes-bsp/rmc/boards/minnowmax/BOOTENTRY.CONFIG
@@ -1 +1,2 @@
 boot.conf
+install.conf
diff --git a/common/recipes-bsp/rmc/boards/minnowmax/install.conf 
b/common/recipes-bsp/rmc/boards/minnowmax/install.conf
new file mode 100644
index 000..1a493ae
--- /dev/null
+++ b/common/recipes-bsp/rmc/boards/minnowmax/install.conf
@@ -0,0 +1,4 @@
+title Minnow Max install
+linux /vmlinuz
+initrd /initrd
+options LABEL=install-efi console=ttyS0,115200n8
diff --git a/common/recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG 
b/common/recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG
index cb01ced..b2fabe8 100644
--- a/common/recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG
+++ b/common/recipes-bsp/rmc/boards/minnowmaxB3/BOOTENTRY.CONFIG
@@ -1 +1,2 @@
 boot.conf
+install.conf
diff --git a/common/recipes-bsp/rmc/boards/minnowmaxB3/install.conf 
b/common/recipes-bsp/rmc/boards/minnowmaxB3/install.conf
new file mode 100644
index 000..cf500d6
--- /dev/null
+++ b/common/recipes-bsp/rmc/boards/minnowmaxB3/install.conf
@@ -0,0 +1,4 @@
+title Minnow Max B3 install
+linux /vmlinuz
+initrd /initrd
+options LABEL=install-efi console=ttyS0,115200n8
-- 
2.13.2

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH] systemd-boot: disable RMC for systemd-boot EFI_PROVIDER

2017-06-23 Thread Todor Minchev
Previously the RMC library was always linked into systemd-boot. Non
rmc-boot EFI_PROVIDERs will not build the rmc.db and userspace tool and
therefore linking the library into these bootloaders is redundant.
This change disables RMC completely when the EFI_PROVIDER is not rmc-boot.

The default EFI_PROVIDER in meta-intel is rmc-boot. To use systemd-boot
without RMC, set EFI_PROVIDER to systemd-boot in your conf/local.conf.

Example:

EFI_PROVIDER = "systemd-boot"

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 common/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc   | 12 
 .../recipes-bsp/systemd-boot/systemd-boot/systemd-boot.inc  |  7 +++
 common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend | 13 +
 3 files changed, 20 insertions(+), 12 deletions(-)
 create mode 100644 common/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc
 create mode 100644 
common/recipes-bsp/systemd-boot/systemd-boot/systemd-boot.inc

diff --git a/common/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc 
b/common/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc
new file mode 100644
index 000..db75eb6
--- /dev/null
+++ b/common/recipes-bsp/systemd-boot/systemd-boot/rmc-boot.inc
@@ -0,0 +1,12 @@
+DEPENDS_append_intel-x86-common = " rmc"
+
+EXTRA_OEMAKE_append_intel-x86-common = ' 
EFI_LDFLAGS="-L${STAGING_DIR_HOST}/usr/lib" EFI_CFLAGS="-I${STAGING_INCDIR}/rmc 
-DRMC_EFI"'
+
+SRC_URI_append_intel-x86-common = " \
+
file://0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch \
+
file://0002-sd-boot-Load-board-specific-boot-entries-from-RMC-da.patch \
+
file://0003-sd-boot-Support-global-kernel-command-line-fragment.patch \
+
file://0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch
 \
+file://0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch \
+file://0001-sd-boot-stub-check-LoadOptions-contains-data.patch \
+"
diff --git a/common/recipes-bsp/systemd-boot/systemd-boot/systemd-boot.inc 
b/common/recipes-bsp/systemd-boot/systemd-boot/systemd-boot.inc
new file mode 100644
index 000..fcce6ce
--- /dev/null
+++ b/common/recipes-bsp/systemd-boot/systemd-boot/systemd-boot.inc
@@ -0,0 +1,7 @@
+EXTRA_OEMAKE_append_intel-x86-common = ' 
EFI_LDFLAGS="-L${STAGING_DIR_HOST}/usr/lib" '
+
+SRC_URI_append_intel-x86-common = " \
+file://0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch \
+file://0001-sd-boot-stub-check-LoadOptions-contains-data.patch \
+"
+
diff --git a/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend 
b/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend
index 98eaf45..c574041 100644
--- a/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend
+++ b/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend
@@ -1,9 +1,5 @@
-DEPENDS_append_intel-x86-common = " rmc"
-
 FILESEXTRAPATHS_prepend := "${THISDIR}/systemd-boot:"
 
-EXTRA_OEMAKE_append_intel-x86-common = ' 
EFI_LDFLAGS="-L${STAGING_DIR_HOST}/usr/lib" EFI_CFLAGS="-I${STAGING_INCDIR}/rmc 
-DRMC_EFI"'
-
 # 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.
@@ -14,13 +10,6 @@ EXTRA_OEMAKE_append_intel-x86-common = ' 
EFI_LDFLAGS="-L${STAGING_DIR_HOST}/usr/
 # Revision: systemd v232 in OE
 SRCREV_intel-x86-common = "a1e2ef7ec912902d8142e7cb5830cbfb47dba86c"
 
-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 \
-"
+include systemd-boot/${EFI_PROVIDER}.inc
 
 PACKAGE_ARCH_intel-x86-common = "${INTEL_COMMON_PACKAGE_ARCH}"
-- 
2.13.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH 2/3] rmc: add fingerprint for generic Broxton-M (rev. 1F1)

2017-06-07 Thread Todor Minchev
Finger 0 type   : 0x01
Finger 0 offset : 0x05
Finger 0 name:  : product_name
Finger 0 value  : 570x DVT1

Finger 1 type   : 0x02
Finger 1 offset : 0x05
Finger 1 name:  : product_name
Finger 1 value  : SDS

Finger 2 type   : 0x04
Finger 2 offset : 0x10
Finger 2 name:  : version
Finger 2 value  : U3E1

Finger 3 type   : 0x7f
Finger 3 offset : 0x00
Finger 3 name:  : reserved
Finger 3 value  :

Finger 4 type   : 0x7f
Finger 4 offset : 0x00
Finger 4 name:  : reserved
Finger 4 value  :

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 common/recipes-bsp/rmc/boards/broxton-m/bm-1F1.fp | Bin 0 -> 83 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100755 common/recipes-bsp/rmc/boards/broxton-m/bm-1F1.fp

diff --git a/common/recipes-bsp/rmc/boards/broxton-m/bm-1F1.fp 
b/common/recipes-bsp/rmc/boards/broxton-m/bm-1F1.fp
new file mode 100755
index 
..1a1502808ab5d7cd0d9acc344bd95a43134e447f
GIT binary patch
literal 83
zcmZQ%Ehx%QDNQbk~2s8DbT3o`-131(msC`&!WThttps://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH 3/3] rmc: add support for Broxton-M based Joule board (rev. 1F1)

2017-06-07 Thread Todor Minchev
Finger 0 type   : 0x01
Finger 0 offset : 0x05
Finger 0 name:  : product_name
Finger 0 value  : 570x DVT2

Finger 1 type   : 0x02
Finger 1 offset : 0x05
Finger 1 name:  : product_name
Finger 1 value  : SDS

Finger 2 type   : 0x04
Finger 2 offset : 0x10
Finger 2 name:  : version
Finger 2 value  : Intel(R) Atom(TM) Processor T5700 @ 1.70GHz

Finger 3 type   : 0x7f
Finger 3 offset : 0x00
Finger 3 name:  : reserved
Finger 3 value  :

Finger 4 type   : 0x7f
Finger 4 offset : 0x00
Finger 4 name:  : reserved
Finger 4 value  :

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 common/recipes-bsp/rmc/boards/broxton-m/joule-1F1.fp | Bin 0 -> 122 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 common/recipes-bsp/rmc/boards/broxton-m/joule-1F1.fp

diff --git a/common/recipes-bsp/rmc/boards/broxton-m/joule-1F1.fp 
b/common/recipes-bsp/rmc/boards/broxton-m/joule-1F1.fp
new file mode 100644
index 
..d757614f68c9cfe7df73af85349733fb846c1498
GIT binary patch
literal 122
zcmZQ%Ehx%QDNQbk~2s8DbT3o&9~LX`-131(msC`@XRYo+b
zRB$ZG&(#R=)l>*5%1=%$F3vAf2mzX5px~fjsAq2A?oq{1<FoLW?tn!1_0~n
BB-a1{

literal 0
HcmV?d1

-- 
2.13.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH 1/3] rmc-db: allow multiple fingerprint per board directory

2017-06-07 Thread Todor Minchev
Different firmware revisions often result in different fingerprints for
the same hardware platform. This change allows multiple fingerprints to
be stored in the same board directory to avoid having to duplicate the
data for each record.

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 classes/rmc-db.bbclass | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/classes/rmc-db.bbclass b/classes/rmc-db.bbclass
index 0fb4c27..72594d6 100644
--- a/classes/rmc-db.bbclass
+++ b/classes/rmc-db.bbclass
@@ -60,7 +60,6 @@ rmc_generate_db () {
# For all board dirs in a topdir:
CUR_BOARD_DIRS=$(find ${topdir}/* -type d)
for board_dir in ${CUR_BOARD_DIRS}; do
-   # FIXME: we shall fail when having more than one .fp 
file
CUR_FINGERPRINT=$(find ${board_dir}/ -name "*.fp")
 
# disallow a board directory without any fingerprint 
file in it.
@@ -77,12 +76,13 @@ rmc_generate_db () {
continue
fi
 
-   CUR_TAG=$(echo "${board_dir}"|sed  's/\//-/g')
-   CUR_RECORD=${RMC_DB_DIR}/rmc${CUR_TAG}.rec
-
-   rmc -R -f ${CUR_FINGERPRINT} -b ${CUR_FILES} -o 
${CUR_RECORD}
-
-   RMC_RECORDS="${RMC_RECORDS} ${CUR_RECORD}"
+   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
 
-- 
2.13.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH 2/2] rmc: add support for Broxton-M based Joule board (rev. 1F1)

2017-06-06 Thread Todor Minchev
This fingerprint corresponds to the following firmware data:

Finger 0 type   : 0x01
Finger 0 offset : 0x05
Finger 0 name:  : product_name
Finger 0 value  : 570x DVT2

Finger 1 type   : 0x02
Finger 1 offset : 0x05
Finger 1 name:  : product_name
Finger 1 value  : SDS

Finger 2 type   : 0x04
Finger 2 offset : 0x10
Finger 2 name:  : version
Finger 2 value  : Intel(R) Atom(TM) Processor T5700 @ 1.70GHz

Finger 3 type   : 0x7f
Finger 3 offset : 0x00
Finger 3 name:  : reserved
Finger 3 value  :

Finger 4 type   : 0x7f
Finger 4 offset : 0x00
Finger 4 name:  : reserved
Finger 4 value  :

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 common/recipes-bsp/rmc/boards/joule/BOOTENTRY.CONFIG |   2 ++
 common/recipes-bsp/rmc/boards/joule/INSTALLER.CONFIG |   3 +++
 common/recipes-bsp/rmc/boards/joule/KBOOTPARAM   |   1 +
 common/recipes-bsp/rmc/boards/joule/POSTINSTALL.sh   |   2 ++
 common/recipes-bsp/rmc/boards/joule/boot.conf|   4 
 common/recipes-bsp/rmc/boards/joule/install.conf |   4 
 common/recipes-bsp/rmc/boards/joule/joule.fp | Bin 0 -> 122 bytes
 7 files changed, 16 insertions(+)
 create mode 100644 common/recipes-bsp/rmc/boards/joule/BOOTENTRY.CONFIG
 create mode 100644 common/recipes-bsp/rmc/boards/joule/INSTALLER.CONFIG
 create mode 100644 common/recipes-bsp/rmc/boards/joule/KBOOTPARAM
 create mode 100644 common/recipes-bsp/rmc/boards/joule/POSTINSTALL.sh
 create mode 100644 common/recipes-bsp/rmc/boards/joule/boot.conf
 create mode 100644 common/recipes-bsp/rmc/boards/joule/install.conf
 create mode 100644 common/recipes-bsp/rmc/boards/joule/joule.fp

diff --git a/common/recipes-bsp/rmc/boards/joule/BOOTENTRY.CONFIG 
b/common/recipes-bsp/rmc/boards/joule/BOOTENTRY.CONFIG
new file mode 100644
index 000..b2fabe8
--- /dev/null
+++ b/common/recipes-bsp/rmc/boards/joule/BOOTENTRY.CONFIG
@@ -0,0 +1,2 @@
+boot.conf
+install.conf
diff --git a/common/recipes-bsp/rmc/boards/joule/INSTALLER.CONFIG 
b/common/recipes-bsp/rmc/boards/joule/INSTALLER.CONFIG
new file mode 100644
index 000..ecd2060
--- /dev/null
+++ b/common/recipes-bsp/rmc/boards/joule/INSTALLER.CONFIG
@@ -0,0 +1,3 @@
+# Keep rmc Joule boot.conf instead of meta-intel default
+efi_entry_dir:root:disk:770:/boot/loader/entries/
+boot.conf:root:disk:770:/boot/loader/entries/boot.conf
diff --git a/common/recipes-bsp/rmc/boards/joule/KBOOTPARAM 
b/common/recipes-bsp/rmc/boards/joule/KBOOTPARAM
new file mode 100644
index 000..08be5df
--- /dev/null
+++ b/common/recipes-bsp/rmc/boards/joule/KBOOTPARAM
@@ -0,0 +1 @@
+video=efifb maxcpus=4 reboot=efi kmemleak=off console=tty0 console=ttyS2,115200
diff --git a/common/recipes-bsp/rmc/boards/joule/POSTINSTALL.sh 
b/common/recipes-bsp/rmc/boards/joule/POSTINSTALL.sh
new file mode 100644
index 000..30bbd28
--- /dev/null
+++ b/common/recipes-bsp/rmc/boards/joule/POSTINSTALL.sh
@@ -0,0 +1,2 @@
+# Joule uses only S2 for serial, so remove S0
+sed -i '/start_getty.\+ttyS0/d' /tgt_root/etc/inittab
diff --git a/common/recipes-bsp/rmc/boards/joule/boot.conf 
b/common/recipes-bsp/rmc/boards/joule/boot.conf
new file mode 100644
index 000..72f183d
--- /dev/null
+++ b/common/recipes-bsp/rmc/boards/joule/boot.conf
@@ -0,0 +1,4 @@
+title Joule
+linux /vmlinuz
+initrd /initrd
+options LABEL=boot
diff --git a/common/recipes-bsp/rmc/boards/joule/install.conf 
b/common/recipes-bsp/rmc/boards/joule/install.conf
new file mode 100644
index 000..8126369
--- /dev/null
+++ b/common/recipes-bsp/rmc/boards/joule/install.conf
@@ -0,0 +1,4 @@
+title Joule Install
+linux /vmlinuz
+initrd /initrd
+options LABEL=install-efi rootwait
diff --git a/common/recipes-bsp/rmc/boards/joule/joule.fp 
b/common/recipes-bsp/rmc/boards/joule/joule.fp
new file mode 100644
index 
..d757614f68c9cfe7df73af85349733fb846c1498
GIT binary patch
literal 122
zcmZQ%Ehx%QDNQbk~2s8DbT3o&9~LX`-131(msC`@XRYo+b
zRB$ZG&(#R=)l>*5%1=%$F3vAf2mzX5px~fjsAq2A?oq{1<FoLW?tn!1_0~n
BB-a1{

literal 0
HcmV?d1

-- 
2.13.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH 1/2] rmc: upgrade fingerprint for generic Broxton-M (rev. 1F1)

2017-06-06 Thread Todor Minchev
This fingerprint update corresponds to the following firmware data:

Finger 0 type   : 0x01
Finger 0 offset : 0x05
Finger 0 name:  : product_name
Finger 0 value  : 570x DVT1

Finger 1 type   : 0x02
Finger 1 offset : 0x05
Finger 1 name:  : product_name
Finger 1 value  : SDS

Finger 2 type   : 0x04
Finger 2 offset : 0x10
Finger 2 name:  : version
Finger 2 value  : U3E1

Finger 3 type   : 0x7f
Finger 3 offset : 0x00
Finger 3 name:  : reserved
Finger 3 value  :

Finger 4 type   : 0x7f
Finger 4 offset : 0x00
Finger 4 name:  : reserved
Finger 4 value  :

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 common/recipes-bsp/rmc/boards/broxton-m/INSTALLER.CONFIG |   2 +-
 common/recipes-bsp/rmc/boards/broxton-m/bm.fp| Bin 83 -> 83 bytes
 common/recipes-bsp/rmc/boards/broxton-m/boot.conf|   2 +-
 common/recipes-bsp/rmc/boards/broxton-m/install.conf |   2 +-
 4 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/recipes-bsp/rmc/boards/broxton-m/INSTALLER.CONFIG 
b/common/recipes-bsp/rmc/boards/broxton-m/INSTALLER.CONFIG
index ecd2060..d000f0c 100644
--- a/common/recipes-bsp/rmc/boards/broxton-m/INSTALLER.CONFIG
+++ b/common/recipes-bsp/rmc/boards/broxton-m/INSTALLER.CONFIG
@@ -1,3 +1,3 @@
-# Keep rmc Joule boot.conf instead of meta-intel default
+# Keep rmc boot.conf instead of meta-intel default
 efi_entry_dir:root:disk:770:/boot/loader/entries/
 boot.conf:root:disk:770:/boot/loader/entries/boot.conf
diff --git a/common/recipes-bsp/rmc/boards/broxton-m/bm.fp 
b/common/recipes-bsp/rmc/boards/broxton-m/bm.fp
index 
135a7a5dceb99124a5de183edd9c7d071656351b..1a1502808ab5d7cd0d9acc344bd95a43134e447f
 100755
GIT binary patch
delta 30
lcmWFzmSAKpD9TSMO)iPgOUzAWFf})*P;dzgF`Ou24FHVl2>k#6

delta 30
lcmWFzmSAKpD9TSMO)iPgOUzAWa4O2LD9O)L@SP}O4FHx-3IhND

diff --git a/common/recipes-bsp/rmc/boards/broxton-m/boot.conf 
b/common/recipes-bsp/rmc/boards/broxton-m/boot.conf
index caa00c5..efb4fe5 100644
--- a/common/recipes-bsp/rmc/boards/broxton-m/boot.conf
+++ b/common/recipes-bsp/rmc/boards/broxton-m/boot.conf
@@ -1,4 +1,4 @@
-title Joule / Broxton-m
+title Broxton-m
 linux /vmlinuz
 initrd /initrd
 options LABEL=boot
diff --git a/common/recipes-bsp/rmc/boards/broxton-m/install.conf 
b/common/recipes-bsp/rmc/boards/broxton-m/install.conf
index 9cdd86b..d2a64b4 100644
--- a/common/recipes-bsp/rmc/boards/broxton-m/install.conf
+++ b/common/recipes-bsp/rmc/boards/broxton-m/install.conf
@@ -1,4 +1,4 @@
-title Joule / Broxton-m Install
+title Broxton-m Install
 linux /vmlinuz
 initrd /initrd
 options LABEL=install-efi rootwait
-- 
2.13.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH 2/2] rmc: update SRCREV for rmc recipe

2017-03-30 Thread Todor Minchev
This SRCREV fixes rmc build failure under musl

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 common/recipes-bsp/rmc/rmc.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/recipes-bsp/rmc/rmc.bb b/common/recipes-bsp/rmc/rmc.bb
index 48aa5cc..93fdd3a 100644
--- a/common/recipes-bsp/rmc/rmc.bb
+++ b/common/recipes-bsp/rmc/rmc.bb
@@ -14,7 +14,7 @@ LIC_FILES_CHKSUM = 
"file://COPYING;md5=ade413c694d3aaefc9554b24a8814ee8"
 
 SRC_URI = "git://git.yoctoproject.org/rmc"
 
-SRCREV = "d28eaec425f05511f0d9cd82b3623e95980ff2f6"
+SRCREV = "027ac76f642dcab1a9f237a00f03a3a714bd04b9"
 
 S = "${WORKDIR}/git"
 
-- 
2.12.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH 1/2] rmc: update license file checksum

2017-03-30 Thread Todor Minchev
Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 common/recipes-bsp/rmc/rmc.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/recipes-bsp/rmc/rmc.bb b/common/recipes-bsp/rmc/rmc.bb
index b4eb0ef..48aa5cc 100644
--- a/common/recipes-bsp/rmc/rmc.bb
+++ b/common/recipes-bsp/rmc/rmc.bb
@@ -10,7 +10,7 @@ require any quirks or customizations at a board or product 
level. \
 
 LICENSE = "MIT"
 
-LIC_FILES_CHKSUM = "file://COPYING;md5=838c366f69b72c5df05c96dff79b35f2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=ade413c694d3aaefc9554b24a8814ee8"
 
 SRC_URI = "git://git.yoctoproject.org/rmc"
 
-- 
2.12.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH 1/1][rmc] rmc: fix undefined PATH_MAX under musl

2017-03-30 Thread Todor Minchev
musl requires limits.h for PATH_MAX

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 src/lib/api.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/lib/api.c b/src/lib/api.c
index 5be804a..c407420 100644
--- a/src/lib/api.c
+++ b/src/lib/api.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
--
2.12.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH 2/2][rmc] rmc: fix copyright notices

2017-03-24 Thread Todor Minchev
Attribute copyright to Intel and add MIT license headers

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 COPYING   |  2 ++
 Makefile  |  3 ++-
 Makefile.efi  |  3 ++-
 inc/rmc_api.h | 26 --
 inc/rmc_types.h   | 24 ++--
 inc/rmc_util.h| 25 +
 inc/rmcl.h| 26 +-
 inc/rsmp.h| 27 ++-
 src/lib/api.c | 26 --
 src/lib/common/rmcl.c | 26 --
 src/lib/common/rsmp.c | 26 --
 src/lib/efi_api.c | 25 +++--
 src/lib/rmc_efi.h | 26 +-
 src/rmc.c | 29 +++--
 14 files changed, 275 insertions(+), 19 deletions(-)

diff --git a/COPYING b/COPYING
index 89de354..a4aa6e2 100644
--- a/COPYING
+++ b/COPYING
@@ -1,3 +1,5 @@
+Copyright (c) 2016 - 2017 Intel Corporation
+
 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
diff --git a/Makefile b/Makefile
index fdd936f..1c509e5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
-# Copyright (C) 2016 Jianxun Zhang <jianxun.zh...@intel.com>
+# Copyright (c) 2016 - 2017 Intel Corporation.
+# Author: Jianxun Zhang <jianxun.zh...@intel.com>
 
 TOPDIR = $(shell if [ -z "$$PWD" ]; then pwd; else echo "$$PWD"; fi)
 
diff --git a/Makefile.efi b/Makefile.efi
index 66081d7..4f69dfe 100644
--- a/Makefile.efi
+++ b/Makefile.efi
@@ -1,4 +1,5 @@
-# Copyright (C) 2016 Jianxun Zhang <jianxun.zh...@intel.com>
+# Copyright (c) 2016 - 2017 Intel Corporation.
+# Author: Jianxun Zhang <jianxun.zh...@intel.com>
 
 TOPDIR = $(shell if [ -z "$$PWD" ]; then pwd; else echo "$$PWD"; fi)
 
diff --git a/inc/rmc_api.h b/inc/rmc_api.h
index 2f8c978..04cd88d 100644
--- a/inc/rmc_api.h
+++ b/inc/rmc_api.h
@@ -1,8 +1,30 @@
-/* Copyright (C) 2016 Jianxun Zhang <jianxun.zh...@intel.com>
+/*
+ * Copyright (c) 2016 - 2017 Intel Corporation.
+ *
+ * Author: Jianxun Zhang <jianxun.zh...@intel.com>
+ *
+ * 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:
  *
- * header file of RMC APIs for clients to call at run time
+ * 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.
  */
 
+/* header file of RMC APIs for clients to call at run time */
+
 #ifndef INC_RMC_API_H_
 #define INC_RMC_API_H_
 
diff --git a/inc/rmc_types.h b/inc/rmc_types.h
index 28bea84..370c400 100644
--- a/inc/rmc_types.h
+++ b/inc/rmc_types.h
@@ -1,6 +1,26 @@
-/* Copyright (C) 2016 Jianxun Zhang <jianxun.zh...@intel.com>
+/*
+ * Copyright (c) 2016 - 2017 Intel Corporation.
  *
- * rmc_types.h
+ * Author: Jianxun Zhang <jianxun.zh...@intel.com>
+ *
+ * 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 CONTRA

[meta-intel] [PATCH 1/2][rmc] README: update maintainers

2017-03-24 Thread Todor Minchev
Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 README | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/README b/README
index efd82f0..03c738f 100644
--- a/README
+++ b/README
@@ -115,5 +115,6 @@ integrated with RMC (e.g. a Yocto BSP).
 shall be always for good changes passed code review, internal test and system
 test.
 
-Maintainer:
+Maintainers:
+todor.minc...@linux.intel.com
 jianxun.zh...@linux.intel.com
-- 
2.12.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH 1/1][yocto][rmc] rmc: update SRCREV for rmc recipe

2017-03-17 Thread Todor Minchev
This SRCREV adds fingerprint and database extraction functionality to RMC

Extract database:
rmc -E -d rmc.db -o output/directory/

Extract fingerprint:
rmc -E -f fingerprint_file

https://bugzilla.yoctoproject.org/show_bug.cgi?id=10092

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 common/recipes-bsp/rmc/rmc.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/recipes-bsp/rmc/rmc.bb b/common/recipes-bsp/rmc/rmc.bb
index f5c648d..b4eb0ef 100644
--- a/common/recipes-bsp/rmc/rmc.bb
+++ b/common/recipes-bsp/rmc/rmc.bb
@@ -14,7 +14,7 @@ LIC_FILES_CHKSUM = 
"file://COPYING;md5=838c366f69b72c5df05c96dff79b35f2"

 SRC_URI = "git://git.yoctoproject.org/rmc"

-SRCREV = "4799cb89b543712390d863a6fc50a58881590fa2"
+SRCREV = "d28eaec425f05511f0d9cd82b3623e95980ff2f6"

 S = "${WORKDIR}/git"

--
2.12.0

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH v3 5/5] rmc: add database extraction functionality

2017-02-14 Thread Todor Minchev
The contents of an existing database file can be extracted with the -E option.
By default the top level of the directory tree is rmc_db_dump, an alternative
path can be specified with the -o option. The file blobs corresponding
to a given record will be saved in a separate sub-directory. The sub-directory
name for each record is the hex representation of the signature corresponding to
the fingerprint for that record.

Example:
./src/rmc -E -d rmc.db -o output/directory/

Successfully extracted rmc.db

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 inc/rmc_api.h |   9 
 inc/rmcl.h|   7 +++
 src/lib/api.c | 126 +-
 src/lib/common/rmcl.c |  17 ++-
 src/rmc.c |  30 
 5 files changed, 177 insertions(+), 12 deletions(-)

diff --git a/inc/rmc_api.h b/inc/rmc_api.h
index a484389..2f8c978 100644
--- a/inc/rmc_api.h
+++ b/inc/rmc_api.h
@@ -109,6 +109,15 @@ extern int read_file(const char *pathname, char **data, 
rmc_size_t* len);
  */
 int write_file(const char *pathname, void *data, rmc_size_t len, int append);
 
+/* extract the contents of a database file and store the files corresponding to
+ * each record in a separate directory. The name of each directory is the 
signature
+ * of the fingerpring for that record with all non-alphanumeric characters 
stripped
+ * (in) db_pathname: The path and file name of a RMC database file generated 
by RMC tool
+ * (in) output_path: A directory path to extract the database to
+ * return: 0 on success, non-zero on failure.
+ */
+int dump_db(char *db_pathname, char *output_path) ;
+
 #else
 /* 2 - API for UEFI context */
 
diff --git a/inc/rmcl.h b/inc/rmcl.h
index 5bbad42..471ebfe 100644
--- a/inc/rmcl.h
+++ b/inc/rmcl.h
@@ -164,4 +164,11 @@ extern int rmcl_generate_db(rmc_record_file_t 
*record_files, rmc_uint8_t **rmc_d
  */
 extern int query_policy_from_db(rmc_fingerprint_t *fingerprint, rmc_uint8_t 
*rmc_db, rmc_uint8_t type, char *blob_name, rmc_file_t *policy);
 
+/*
+ * Check if db_blob has a valid rmc database signature
+ *
+ * return 0 if db_blob has a valid signature or non-zero otherwise
+ */
+int is_rmcdb(rmc_uint8_t *db_blob);
+
 #endif /* INC_RMCL_H_ */
diff --git a/src/lib/api.c b/src/lib/api.c
index 0adb390..a3b378c 100644
--- a/src/lib/api.c
+++ b/src/lib/api.c
@@ -3,6 +3,7 @@
  * RMC API implementation for Linux user space
  */
 
+#define _GNU_SOURCE
 #include 
 #include 
 #include 
@@ -10,12 +11,15 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
 
-#define EFI_SYSTAB_PATH "/sys/firmware/efi/systab"
-#define SYSTAB_LEN 4096 /* assume 4kb is enough...*/
+#define EFI_SYSTAB_PATH  "/sys/firmware/efi/systab"
+#define SYSTAB_LEN   4096 /* assume 4kb is enough...*/
+#define DB_DUMP_DIR  "./rmc_db_dump"  /* directory to store db data dump */
 
 int read_file(const char *pathname, char **data, rmc_size_t* len) {
 int fd = -1;
@@ -325,3 +329,121 @@ int rmc_gimme_file(char* db_pathname, char *file_name, 
rmc_file_t *file) {
 
 return ret;
 }
+
+static char *str2hex(const char *in) {
+int i , len = strlen(in);
+char *out = calloc(2*len+1, sizeof(char));
+for (i = 0; i < len; i++) {
+sprintf([2*i], "%x", in[i]);
+}
+out[2*len+1] = '\0';
+return out;
+}
+
+static int mkpath(const char *dir) {
+char tmp[PATH_MAX], *path = NULL;
+size_t len;
+
+snprintf(tmp, sizeof(tmp),"%s",dir);
+len = strlen(tmp);
+
+/* mark end of path */
+if(tmp[len - 1] == '/')
+tmp[len - 1] = 0;
+
+for(path = tmp + 1; *path; path++) {
+if(*path == '/') {
+/* mark end of directory chunk */
+*path = 0;
+/* try to create this portion of the path. Failing here is valid
+ * if the directory already exists. */
+mkdir(tmp, S_IRWXU);
+/* restore directory separator */
+*path = '/';
+}
+}
+return mkdir(tmp, S_IRWXU);
+}
+
+int dump_db(char *db_pathname, char *output_path) {
+rmc_meta_header_t meta_header;
+rmc_db_header_t *db_header = NULL;
+rmc_record_header_t record_header;
+rmc_uint64_t record_idx = 0;   /* offset of each reacord in db*/
+rmc_uint64_t meta_idx = 0; /* offset of each meta in a record */
+rmc_uint64_t file_idx = 0; /* offset of file in a meta */
+rmc_file_t file;
+char *out_dir = NULL, *out_name = NULL, *tmp_dir_name = NULL;
+rmc_size_t db_len = 0;
+rmc_uint8_t *rmc_db = NULL;
+DIR *tmp_dir = NULL;
+
+if (read_file(db_pathname, (char **)_db, _len)) {
+fprintf(stderr, "Failed to read database file\n\n");
+return 1;
+}
+
+db_header = (rmc_db_header_t *)rmc_db;
+
+/* sanity check of db */
+if (is_rmcdb(rmc_db))
+return 1;
+
+/* query the meta. idx: sta

[meta-intel] [PATCH v3 4/5] rmc: remove unnecessary return variable

2017-02-14 Thread Todor Minchev
Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 src/rmc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/rmc.c b/src/rmc.c
index 54710c7..9a63069 100644
--- a/src/rmc.c
+++ b/src/rmc.c
@@ -218,7 +218,6 @@ read_fp_done:
 static rmc_file_t *read_policy_file(char *pathname, int type) {
 rmc_file_t *tmp = NULL;
 rmc_size_t policy_len = 0;
-int ret;
 char *path_token;
 
 if ((tmp = calloc(1, sizeof(rmc_file_t))) == NULL) {
@@ -230,8 +229,7 @@ static rmc_file_t *read_policy_file(char *pathname, int 
type) {
 tmp->next = NULL;
 
 if (type == RMC_GENERIC_FILE) {
-ret = read_file(pathname, (char **)>blob, _len);
-if (ret) {
+if (read_file(pathname, (char **)>blob, _len)) {
 fprintf(stderr, "Failed to read file %s\n\n", pathname);
 free(tmp);
 return NULL;
-- 
2.11.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH v3 3/5] rmc: enable reading the contents of an existing fingerprint file

2017-02-14 Thread Todor Minchev
The contents of an existing fingerprint file can be read and output on
the command line with the following options:

rmc -E -f input_fingerprint_file

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 src/rmc.c | 97 +--
 1 file changed, 64 insertions(+), 33 deletions(-)

diff --git a/src/rmc.c b/src/rmc.c
index 062dd36..54710c7 100644
--- a/src/rmc.c
+++ b/src/rmc.c
@@ -14,43 +14,47 @@
 #include 
 
 #define USAGE "RMC (Runtime Machine configuration) Tool\n" \
-"NOTE: Most of usages require root permission (sudo)\n" \
+"NOTE: Most of usages require root permission (sudo)\n\n" \
 "rmc -F [-o output_fingerprint]\n" \
 "rmc -R [-f ] -b  [-o output_record]\n" \
 "rmc -D  [-o output_database]\n" \
-   "rmc -B  -d  -o output_file\n" \
-   "\n" \
-   "-F: generate board rmc fingerprint of board\n" \
-   "-R: generate board rmc record of board with its fingerprint and file 
blobs.\n" \
-"-f: fingerprint file to be packed in record, rmc will create a 
fingerprint for board and use it internally to\n" \
-"generate record if -f is missed.\n" \
-"-b: files to be packed in record\n" \
-   "-G: generate rmc database file with records specified in record file 
list\n" \
-   "-B: get a flie blob with specified name associated to the board rmc is 
running on\n" \
-   "-d: database file to be queried\n" \
-   "-o: path and name of output file of a specific command\n" \
-   "\n" \
-"Examples (Steps in an order to add board support into rmc):\n" \
-"generate board fingerprint:\n" \
-"rmc -F\n\n" \
-"generate a rmc record for the board with two file blobs, output to:\n" \
-"a specified file:\n" \
-"rmc -R -f fingerprint -b file_1 file_2 -o my_board.record\n\n" \
-"generate a rmc database file with records from 3 different boards:\n" \
-"rmc -D board1_record board2_record board3_record\n\n" \
-"query a file blob named audio.conf associated to the board rmc is running 
on in database my_rmc.db and output\n" \
-"to /tmp/new_audio.conf:\n" \
-"rmc -B audio.conf -d my_rmc.db -o /tmp/new_audio.conf\n\n"
+"rmc -B  -d  -o output_file\n\n" \
+  "-F: manage fingerprint file\n" \
+"\t-o output_file: store RMC fingerprint of current board in 
output_file\n" \
+  "-R: generate board rmc record of board with its fingerprint and file 
blobs.\n" \
+"\t-f intput_file : input fingerprint file to be packed in record\n\n" \
+"\tNOTE: RMC will create a fingerprint for the board and use it to\n" \
+"\tgenerate record if an input fingerprint file is not provided.\n\n" \
+"\t-b: files to be packed in record\n\n" \
+  "-G: generate rmc database file with records specified in record file 
list\n\n" \
+  "-B: get a file blob with specified name associated to the board rmc is\n" \
+  "running on\n" \
+"\t-d: database file to be queried\n" \
+"\t-o: path and name of output file of a specific command\n\n" \
+  "-E: Extract data from fingerprint file and print it to terminal\n" \
+"\t-f: fingerprint file to extract\n\n" \
+"Examples (Steps in an order to add board support into rmc):\n\n" \
+"1. Generate board fingerprint:\n" \
+"\trmc -F\n\n" \
+"2. Generate a rmc record for the board with two file blobs and save it\n" 
\
+"to a specified file:\n" \
+"\trmc -R -f fingerprint -b file_1 file_2 -o my_board.record\n\n" \
+"3. Generate a rmc database file with records from 3 different boards:\n" \
+"\trmc -D board1_record board2_record board3_record\n\n" \
+"4. Query a file blob named audio.conf associated to the board rmc is\n" \
+"running on in database my_rmc.db and output to /tmp/new_audio.conf:\n" \
+"\trmc -B audio.conf -d my_rmc.db -o /tmp/new_audio.conf\n\n"
 
 
 #define RMC_OPT_CAP_F   (1 << 0)
 #define RMC_OPT_CAP_R   (1 << 1)
 #define RMC_OPT_CAP_D   (1 << 2)
 #define RMC_OPT_CAP_B   (1 << 3)
-#define RMC_OPT_F   (1 << 4)
-#define RMC_OPT_O   (1 << 5)
-#define RMC_OPT_B   (1 << 6)
-#define RMC_OPT_D   (1 << 7)
+#define RMC_OPT_CAP_E   (1 << 4)
+#define RMC_OPT_F   (1 << 5)
+#define RMC_OPT_O   (1 << 6)
+#define RMC_OPT_B   (1 << 7)
+#define RMC_OPT_D   (1 << 8)
 
 static void usage () {
 fprintf(stdout, USAGE);
@@ -78,7 +82,7

[meta-intel] [PATCH v3 2/5] Makefile: add debug target

2017-02-14 Thread Todor Minchev
A debug version of the rmc binary can be built by using the debug
Makefile target. This will include debug symbols and will disable
compiler optimizations.

Example:

make debug

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index c58047a..fdd936f 100644
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,8 @@ ALL_OBJS := $(RMC_TOOL_OBJ) $(RMC_LIB_OBJ)
 RMC_CFLAGS := -Wall -I$(TOPDIR)/inc
 
 all: rmc
+debug: RMC_CFLAGS += -DDEBUG -g -O0
+debug: rmc
 
 $(ALL_OBJS): %.o: %.c
$(CC) -c $(CFLAGS) $(RMC_CFLAGS) $< -o $@
-- 
2.11.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH v3 1/5] Makefile: disable silent mode in Makefiles

2017-02-14 Thread Todor Minchev
By default make will output the commands that are executed for each
target. Silent mode can be enabled with the '-s' option.

Example:
make -s

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 Makefile | 21 +++--
 Makefile.efi | 10 +-
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
index 9ade775..c58047a 100644
--- a/Makefile
+++ b/Makefile
@@ -25,23 +25,24 @@ RMC_CFLAGS := -Wall -I$(TOPDIR)/inc
 all: rmc
 
 $(ALL_OBJS): %.o: %.c
-   @$(CC) -c $(CFLAGS) $(RMC_CFLAGS) $< -o $@
+   $(CC) -c $(CFLAGS) $(RMC_CFLAGS) $< -o $@
 
 librmc: $(RMC_LIB_OBJ)
-   @$(AR) rcs src/lib/$@.a $^
+   $(AR) rcs src/lib/$@.a $^
 
 rmc: $(RMC_TOOL_OBJ) librmc
-   @$(CC) $(CFLAGS) $(RMC_CFLAGS) -Lsrc/lib/ -lrmc $(RMC_TOOL_OBJ) 
src/lib/librmc.a -o src/$@
+   $(CC) $(CFLAGS) $(RMC_CFLAGS) -Lsrc/lib/ -lrmc $(RMC_TOOL_OBJ) \
+  src/lib/librmc.a -o src/$@
 
 clean:
-   @rm -f $(ALL_OBJS) src/rmc src/lib/librmc.a
+   rm -f $(ALL_OBJS) src/rmc src/lib/librmc.a
 
 .PHONY: clean rmc librmc
 
 install:
-   @mkdir -p $(RMC_INSTALL_BIN_PATH)
-   @install -m 755 src/rmc $(RMC_INSTALL_BIN_PATH)
-   @mkdir -p $(RMC_INSTALL_LIB_PATH)
-   @install -m 644 src/lib/librmc.a $(RMC_INSTALL_LIB_PATH)
-   @mkdir -p $(RMC_INSTALL_HEADER_PATH)
-   @install -m 644 $(RMC_INSTALL_HEADERS) $(RMC_INSTALL_HEADER_PATH)
+   mkdir -p $(RMC_INSTALL_BIN_PATH)
+   install -m 755 src/rmc $(RMC_INSTALL_BIN_PATH)
+   mkdir -p $(RMC_INSTALL_LIB_PATH)
+   install -m 644 src/lib/librmc.a $(RMC_INSTALL_LIB_PATH)
+   mkdir -p $(RMC_INSTALL_HEADER_PATH)
+   install -m 644 $(RMC_INSTALL_HEADERS) $(RMC_INSTALL_HEADER_PATH)
diff --git a/Makefile.efi b/Makefile.efi
index 3bd417d..66081d7 100644
--- a/Makefile.efi
+++ b/Makefile.efi
@@ -18,16 +18,16 @@ RMC_CFLAGS := -DRMC_EFI -Wall -I$(TOPDIR)/inc -fpic 
-nostdinc -nostdlib  -fno-bu
 all: librmcefi
 
 $(RMC_LIB_OBJ): %.efi.o: %.c
-   @$(CC) -c $(CFLAGS) $(RMC_CFLAGS) $< -o $@
+   $(CC) -c $(CFLAGS) $(RMC_CFLAGS) $< -o $@
 
 librmcefi: $(RMC_LIB_OBJ)
-   @$(AR) rcs src/lib/$@.a $^
+   $(AR) rcs src/lib/$@.a $^
 
 clean:
-   @rm -f $(RMC_LIB_OBJ) src/lib/librmcefi.a
+   rm -f $(RMC_LIB_OBJ) src/lib/librmcefi.a
 
 .PHONY: clean librmcefi
 
 install:
-   @mkdir -p $(RMC_INSTALL_LIB_PATH)
-   @install -m 644 $(RMC_INSTALL_LIBS) $(RMC_INSTALL_LIB_PATH)
+   mkdir -p $(RMC_INSTALL_LIB_PATH)
+   install -m 644 $(RMC_INSTALL_LIBS) $(RMC_INSTALL_LIB_PATH)
-- 
2.11.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


Re: [meta-intel] [PATCH v2 5/5] rmc: add database extraction functionality

2017-02-14 Thread Todor Minchev
On Fri, 2017-02-10 at 11:52 -0800, Jianxun Zhang wrote:
> Todor,
> Appreciate the V2 series. I have only one real concern on using system() in 
> this patch and the whole series. The other comments are more for corner cases 
> which have less impact.
> 
> I could miss some of your feedbacks in V1 threads. Sorry for not to point out 
> things earlier before the V2.
> 
> Thanks
> 
> > On Feb 9, 2017, at 11:17 AM, Todor Minchev <todor.minc...@linux.intel.com> 
> > wrote:
> > 
> > The contents of an existing database file can be extracted with the -E 
> > option.
> > By default the top level of the directory tree is rmc_db_dump, an 
> > alternative
> > path can be specified with the -o option. The file blobs corresponding
> > to a given record will be saved in a separate sub-directory. The 
> > sub-directory
> > name of each record is the signature corresponding to the fingerprint for 
> > that
> > record with all non-alphanumeric characters stripped.
> > 
> > Example:
> > ./src/rmc -E -d rmc.db -o output/directory/
> > 
> > Successfully extracted rmc.db
> > 
> > Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
> > ---
> > inc/rmc_api.h |   9 +
> > inc/rmcl.h|   7 
> > src/lib/api.c | 106 
> > +-
> > src/lib/common/rmcl.c |  17 +++-
> > src/rmc.c |  30 +-
> > 5 files changed, 157 insertions(+), 12 deletions(-)
> > 
> > diff --git a/inc/rmc_api.h b/inc/rmc_api.h
> > index a484389..2f8c978 100644
> > --- a/inc/rmc_api.h
> > +++ b/inc/rmc_api.h
> > @@ -109,6 +109,15 @@ extern int read_file(const char *pathname, char 
> > **data, rmc_size_t* len);
> >  */
> > int write_file(const char *pathname, void *data, rmc_size_t len, int 
> > append);
> > 
> > +/* extract the contents of a database file and store the files 
> > corresponding to
> > + * each record in a separate directory. The name of each directory is the 
> > signature
> > + * of the fingerpring for that record with all non-alphanumeric characters 
> > stripped
> > + * (in) db_pathname: The path and file name of a RMC database file 
> > generated by RMC tool
> > + * (in) output_path: A directory path to extract the database to
> > + * return: 0 on success, non-zero on failure.
> > + */
> > +int dump_db(char *db_pathname, char *output_path) ;
> > +
> > #else
> > /* 2 - API for UEFI context */
> > 
> > diff --git a/inc/rmcl.h b/inc/rmcl.h
> > index 5bbad42..471ebfe 100644
> > --- a/inc/rmcl.h
> > +++ b/inc/rmcl.h
> > @@ -164,4 +164,11 @@ extern int rmcl_generate_db(rmc_record_file_t 
> > *record_files, rmc_uint8_t **rmc_d
> >  */
> > extern int query_policy_from_db(rmc_fingerprint_t *fingerprint, rmc_uint8_t 
> > *rmc_db, rmc_uint8_t type, char *blob_name, rmc_file_t *policy);
> > 
> > +/*
> > + * Check if db_blob has a valid rmc database signature
> > + *
> > + * return 0 if db_blob has a valid signature or non-zero otherwise
> > + */
> > +int is_rmcdb(rmc_uint8_t *db_blob);
> > +
> > #endif /* INC_RMCL_H_ */
> > diff --git a/src/lib/api.c b/src/lib/api.c
> > index 0adb390..56746a4 100644
> > --- a/src/lib/api.c
> > +++ b/src/lib/api.c
> > @@ -3,6 +3,7 @@
> >  * RMC API implementation for Linux user space
> >  */
> > 
> > +#define _GNU_SOURCE
> > #include 
> > #include 
> > #include 
> > @@ -10,12 +11,15 @@
> > #include 
> > #include 
> > #include 
> > +#include 
> > +#include 
> > 
> > #include 
> > #include 
> > 
> > -#define EFI_SYSTAB_PATH "/sys/firmware/efi/systab"
> > -#define SYSTAB_LEN 4096 /* assume 4kb is enough...*/
> > +#define EFI_SYSTAB_PATH  "/sys/firmware/efi/systab"
> > +#define SYSTAB_LEN   4096 /* assume 4kb is enough...*/
> > +#define DB_DUMP_DIR  "./rmc_db_dump"  /* directory to store db data 
> > dump */
> > 
> > int read_file(const char *pathname, char **data, rmc_size_t* len) {
> > int fd = -1;
> > @@ -325,3 +329,101 @@ int rmc_gimme_file(char* db_pathname, char 
> > *file_name, rmc_file_t *file) {
> > 
> > return ret;
> > }
> > +
> > +void remove_non_alphanum(char *in) {
> > +char c;
> > +unsigned long i = 0, j = 0;
> > +
> > +while ((c = in[i++]) != '\0'){
> > +if (isalnum(c))
> &

[meta-intel] [PATCH v2 5/5] rmc: add database extraction functionality

2017-02-09 Thread Todor Minchev
The contents of an existing database file can be extracted with the -E option.
By default the top level of the directory tree is rmc_db_dump, an alternative
path can be specified with the -o option. The file blobs corresponding
to a given record will be saved in a separate sub-directory. The sub-directory
name of each record is the signature corresponding to the fingerprint for that
record with all non-alphanumeric characters stripped.

Example:
./src/rmc -E -d rmc.db -o output/directory/

Successfully extracted rmc.db

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 inc/rmc_api.h |   9 +
 inc/rmcl.h|   7 
 src/lib/api.c | 106 +-
 src/lib/common/rmcl.c |  17 +++-
 src/rmc.c |  30 +-
 5 files changed, 157 insertions(+), 12 deletions(-)

diff --git a/inc/rmc_api.h b/inc/rmc_api.h
index a484389..2f8c978 100644
--- a/inc/rmc_api.h
+++ b/inc/rmc_api.h
@@ -109,6 +109,15 @@ extern int read_file(const char *pathname, char **data, 
rmc_size_t* len);
  */
 int write_file(const char *pathname, void *data, rmc_size_t len, int append);
 
+/* extract the contents of a database file and store the files corresponding to
+ * each record in a separate directory. The name of each directory is the 
signature
+ * of the fingerpring for that record with all non-alphanumeric characters 
stripped
+ * (in) db_pathname: The path and file name of a RMC database file generated 
by RMC tool
+ * (in) output_path: A directory path to extract the database to
+ * return: 0 on success, non-zero on failure.
+ */
+int dump_db(char *db_pathname, char *output_path) ;
+
 #else
 /* 2 - API for UEFI context */
 
diff --git a/inc/rmcl.h b/inc/rmcl.h
index 5bbad42..471ebfe 100644
--- a/inc/rmcl.h
+++ b/inc/rmcl.h
@@ -164,4 +164,11 @@ extern int rmcl_generate_db(rmc_record_file_t 
*record_files, rmc_uint8_t **rmc_d
  */
 extern int query_policy_from_db(rmc_fingerprint_t *fingerprint, rmc_uint8_t 
*rmc_db, rmc_uint8_t type, char *blob_name, rmc_file_t *policy);
 
+/*
+ * Check if db_blob has a valid rmc database signature
+ *
+ * return 0 if db_blob has a valid signature or non-zero otherwise
+ */
+int is_rmcdb(rmc_uint8_t *db_blob);
+
 #endif /* INC_RMCL_H_ */
diff --git a/src/lib/api.c b/src/lib/api.c
index 0adb390..56746a4 100644
--- a/src/lib/api.c
+++ b/src/lib/api.c
@@ -3,6 +3,7 @@
  * RMC API implementation for Linux user space
  */
 
+#define _GNU_SOURCE
 #include 
 #include 
 #include 
@@ -10,12 +11,15 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
 
-#define EFI_SYSTAB_PATH "/sys/firmware/efi/systab"
-#define SYSTAB_LEN 4096 /* assume 4kb is enough...*/
+#define EFI_SYSTAB_PATH  "/sys/firmware/efi/systab"
+#define SYSTAB_LEN   4096 /* assume 4kb is enough...*/
+#define DB_DUMP_DIR  "./rmc_db_dump"  /* directory to store db data dump */
 
 int read_file(const char *pathname, char **data, rmc_size_t* len) {
 int fd = -1;
@@ -325,3 +329,101 @@ int rmc_gimme_file(char* db_pathname, char *file_name, 
rmc_file_t *file) {
 
 return ret;
 }
+
+void remove_non_alphanum(char *in) {
+char c;
+unsigned long i = 0, j = 0;
+
+while ((c = in[i++]) != '\0'){
+if (isalnum(c))
+in[j++] = c;
+}
+in[j] = '\0';
+}
+
+int dump_db(char *db_pathname, char *output_path) {
+rmc_meta_header_t meta_header;
+rmc_db_header_t *db_header = NULL;
+rmc_record_header_t record_header;
+rmc_uint64_t record_idx = 0;   /* offset of each reacord in db*/
+rmc_uint64_t meta_idx = 0; /* offset of each meta in a record */
+rmc_uint64_t file_idx = 0; /* offset of file in a meta */
+rmc_file_t file;
+char *out_dir = NULL, *out_name = NULL, *cmd = NULL, *tmp_dir_name = NULL;
+rmc_size_t db_len = 0;
+rmc_uint8_t *rmc_db = NULL;
+DIR *tmp_dir = NULL;
+
+if (read_file(db_pathname, (char **)_db, _len)) {
+fprintf(stderr, "Failed to read database file\n\n");
+return 1;
+}
+
+db_header = (rmc_db_header_t *)rmc_db;
+
+/* sanity check of db */
+if (is_rmcdb(rmc_db))
+return 1;
+
+/* query the meta. idx: start of record */
+record_idx = sizeof(rmc_db_header_t);
+while (record_idx < db_header->length) {
+memcpy(_header, rmc_db + record_idx,
+sizeof(rmc_record_header_t));
+
+/* directory name is fingerprint signature with stripped special 
chars*/
+asprintf(_dir_name, "%s", record_header.signature.raw);
+remove_non_alphanum(tmp_dir_name);
+if(output_path)
+asprintf(_dir, "%s/%s/", output_path, tmp_dir_name);
+else
+asprintf(_dir, "%s/%s/", DB_DUMP_DIR, tmp_dir_name);
+if ((tmp_dir = opendir(out_dir))) {
+/* Directory exists */
+close

[meta-intel] [PATCH v2 4/5] rmc: remove unnecessary return variable

2017-02-09 Thread Todor Minchev
Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 src/rmc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/rmc.c b/src/rmc.c
index f3a2a5e..b5c7847 100644
--- a/src/rmc.c
+++ b/src/rmc.c
@@ -218,7 +218,6 @@ read_fp_done:
 static rmc_file_t *read_policy_file(char *pathname, int type) {
 rmc_file_t *tmp = NULL;
 rmc_size_t policy_len = 0;
-int ret;
 char *path_token;
 
 if ((tmp = calloc(1, sizeof(rmc_file_t))) == NULL) {
@@ -230,8 +229,7 @@ static rmc_file_t *read_policy_file(char *pathname, int 
type) {
 tmp->next = NULL;
 
 if (type == RMC_GENERIC_FILE) {
-ret = read_file(pathname, (char **)>blob, _len);
-if (ret) {
+if (read_file(pathname, (char **)>blob, _len)) {
 fprintf(stderr, "Failed to read file %s\n\n", pathname);
 free(tmp);
 return NULL;
-- 
2.11.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH v2 3/5] rmc: Enable reading the contents of an existing fingerprint file

2017-02-09 Thread Todor Minchev
The contents of an existing fingerprint file can be read and output on
the command line with the following options:

rmc -E -f input_fingerprint_file

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 src/rmc.c | 98 ++-
 1 file changed, 65 insertions(+), 33 deletions(-)

diff --git a/src/rmc.c b/src/rmc.c
index 062dd36..f3a2a5e 100644
--- a/src/rmc.c
+++ b/src/rmc.c
@@ -14,43 +14,47 @@
 #include 
 
 #define USAGE "RMC (Runtime Machine configuration) Tool\n" \
-"NOTE: Most of usages require root permission (sudo)\n" \
+"NOTE: Most of usages require root permission (sudo)\n\n" \
 "rmc -F [-o output_fingerprint]\n" \
 "rmc -R [-f ] -b  [-o output_record]\n" \
 "rmc -D  [-o output_database]\n" \
-   "rmc -B  -d  -o output_file\n" \
-   "\n" \
-   "-F: generate board rmc fingerprint of board\n" \
-   "-R: generate board rmc record of board with its fingerprint and file 
blobs.\n" \
-"-f: fingerprint file to be packed in record, rmc will create a 
fingerprint for board and use it internally to\n" \
-"generate record if -f is missed.\n" \
-"-b: files to be packed in record\n" \
-   "-G: generate rmc database file with records specified in record file 
list\n" \
-   "-B: get a flie blob with specified name associated to the board rmc is 
running on\n" \
-   "-d: database file to be queried\n" \
-   "-o: path and name of output file of a specific command\n" \
-   "\n" \
-"Examples (Steps in an order to add board support into rmc):\n" \
-"generate board fingerprint:\n" \
-"rmc -F\n\n" \
-"generate a rmc record for the board with two file blobs, output to:\n" \
-"a specified file:\n" \
-"rmc -R -f fingerprint -b file_1 file_2 -o my_board.record\n\n" \
-"generate a rmc database file with records from 3 different boards:\n" \
-"rmc -D board1_record board2_record board3_record\n\n" \
-"query a file blob named audio.conf associated to the board rmc is running 
on in database my_rmc.db and output\n" \
-"to /tmp/new_audio.conf:\n" \
-"rmc -B audio.conf -d my_rmc.db -o /tmp/new_audio.conf\n\n"
+"rmc -B  -d  -o output_file\n\n" \
+  "-F: manage fingerprint file\n" \
+"\t-o output_file: store RMC fingerprint of current board in 
output_file\n" \
+  "-R: generate board rmc record of board with its fingerprint and file 
blobs.\n" \
+"\t-f intput_file : input fingerprint file to be packed in record\n\n" \
+"\tNOTE: RMC will create a fingerprint for the board and use it to\n" \
+"\tgenerate record if an input fingerprint file is not provided.\n\n" \
+"\t-b: files to be packed in record\n\n" \
+  "-G: generate rmc database file with records specified in record file 
list\n\n" \
+  "-B: get a file blob with specified name associated to the board rmc is\n" \
+  "running on\n" \
+"\t-d: database file to be queried\n" \
+"\t-o: path and name of output file of a specific command\n\n" \
+  "-E: Extract data from fingerprint file and print it to terminal\n" \
+"\t-f: fingerprint file to extract\n\n" \
+"Examples (Steps in an order to add board support into rmc):\n\n" \
+"1. Generate board fingerprint:\n" \
+"\trmc -F\n\n" \
+"2. Generate a rmc record for the board with two file blobs and save it\n" 
\
+"to a specified file:\n" \
+"\trmc -R -f fingerprint -b file_1 file_2 -o my_board.record\n\n" \
+"3. Generate a rmc database file with records from 3 different boards:\n" \
+"\trmc -D board1_record board2_record board3_record\n\n" \
+"4. Query a file blob named audio.conf associated to the board rmc is\n" \
+"running on in database my_rmc.db and output to /tmp/new_audio.conf:\n" \
+"\trmc -B audio.conf -d my_rmc.db -o /tmp/new_audio.conf\n\n"
 
 
 #define RMC_OPT_CAP_F   (1 << 0)
 #define RMC_OPT_CAP_R   (1 << 1)
 #define RMC_OPT_CAP_D   (1 << 2)
 #define RMC_OPT_CAP_B   (1 << 3)
-#define RMC_OPT_F   (1 << 4)
-#define RMC_OPT_O   (1 << 5)
-#define RMC_OPT_B   (1 << 6)
-#define RMC_OPT_D   (1 << 7)
+#define RMC_OPT_CAP_E   (1 << 4)
+#define RMC_OPT_F   (1 << 5)
+#define RMC_OPT_O   (1 << 6)
+#define RMC_OPT_B   (1 << 7)
+#define RMC_OPT_D   (1 << 8)
 
 static void usage () {
 fprintf(stdout, USAGE);
@@ -78,7 +82,7

[meta-intel] [PATCH v2 2/5] Makefile: add debug target

2017-02-09 Thread Todor Minchev
A debug version of the rmc binary can be built by using the debug
Makefile target. This will include debug symbols and will disable
compiler optimizations.

Example:

make debug

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index c58047a..fdd936f 100644
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,8 @@ ALL_OBJS := $(RMC_TOOL_OBJ) $(RMC_LIB_OBJ)
 RMC_CFLAGS := -Wall -I$(TOPDIR)/inc
 
 all: rmc
+debug: RMC_CFLAGS += -DDEBUG -g -O0
+debug: rmc
 
 $(ALL_OBJS): %.o: %.c
$(CC) -c $(CFLAGS) $(RMC_CFLAGS) $< -o $@
-- 
2.11.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH v2 1/5] Makefile: disable silent mode in Makefiles

2017-02-09 Thread Todor Minchev
By default make will output the commands that are executed for each
target. Silent mode can be enabled with the '-s' option.

Example:
make -s

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 Makefile | 21 +++--
 Makefile.efi | 10 +-
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
index 9ade775..c58047a 100644
--- a/Makefile
+++ b/Makefile
@@ -25,23 +25,24 @@ RMC_CFLAGS := -Wall -I$(TOPDIR)/inc
 all: rmc
 
 $(ALL_OBJS): %.o: %.c
-   @$(CC) -c $(CFLAGS) $(RMC_CFLAGS) $< -o $@
+   $(CC) -c $(CFLAGS) $(RMC_CFLAGS) $< -o $@
 
 librmc: $(RMC_LIB_OBJ)
-   @$(AR) rcs src/lib/$@.a $^
+   $(AR) rcs src/lib/$@.a $^
 
 rmc: $(RMC_TOOL_OBJ) librmc
-   @$(CC) $(CFLAGS) $(RMC_CFLAGS) -Lsrc/lib/ -lrmc $(RMC_TOOL_OBJ) 
src/lib/librmc.a -o src/$@
+   $(CC) $(CFLAGS) $(RMC_CFLAGS) -Lsrc/lib/ -lrmc $(RMC_TOOL_OBJ) \
+  src/lib/librmc.a -o src/$@
 
 clean:
-   @rm -f $(ALL_OBJS) src/rmc src/lib/librmc.a
+   rm -f $(ALL_OBJS) src/rmc src/lib/librmc.a
 
 .PHONY: clean rmc librmc
 
 install:
-   @mkdir -p $(RMC_INSTALL_BIN_PATH)
-   @install -m 755 src/rmc $(RMC_INSTALL_BIN_PATH)
-   @mkdir -p $(RMC_INSTALL_LIB_PATH)
-   @install -m 644 src/lib/librmc.a $(RMC_INSTALL_LIB_PATH)
-   @mkdir -p $(RMC_INSTALL_HEADER_PATH)
-   @install -m 644 $(RMC_INSTALL_HEADERS) $(RMC_INSTALL_HEADER_PATH)
+   mkdir -p $(RMC_INSTALL_BIN_PATH)
+   install -m 755 src/rmc $(RMC_INSTALL_BIN_PATH)
+   mkdir -p $(RMC_INSTALL_LIB_PATH)
+   install -m 644 src/lib/librmc.a $(RMC_INSTALL_LIB_PATH)
+   mkdir -p $(RMC_INSTALL_HEADER_PATH)
+   install -m 644 $(RMC_INSTALL_HEADERS) $(RMC_INSTALL_HEADER_PATH)
diff --git a/Makefile.efi b/Makefile.efi
index 3bd417d..66081d7 100644
--- a/Makefile.efi
+++ b/Makefile.efi
@@ -18,16 +18,16 @@ RMC_CFLAGS := -DRMC_EFI -Wall -I$(TOPDIR)/inc -fpic 
-nostdinc -nostdlib  -fno-bu
 all: librmcefi
 
 $(RMC_LIB_OBJ): %.efi.o: %.c
-   @$(CC) -c $(CFLAGS) $(RMC_CFLAGS) $< -o $@
+   $(CC) -c $(CFLAGS) $(RMC_CFLAGS) $< -o $@
 
 librmcefi: $(RMC_LIB_OBJ)
-   @$(AR) rcs src/lib/$@.a $^
+   $(AR) rcs src/lib/$@.a $^
 
 clean:
-   @rm -f $(RMC_LIB_OBJ) src/lib/librmcefi.a
+   rm -f $(RMC_LIB_OBJ) src/lib/librmcefi.a
 
 .PHONY: clean librmcefi
 
 install:
-   @mkdir -p $(RMC_INSTALL_LIB_PATH)
-   @install -m 644 $(RMC_INSTALL_LIBS) $(RMC_INSTALL_LIB_PATH)
+   mkdir -p $(RMC_INSTALL_LIB_PATH)
+   install -m 644 $(RMC_INSTALL_LIBS) $(RMC_INSTALL_LIB_PATH)
-- 
2.11.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH v2 0/5] [yocto][rmc] Add fingerprint quering and database extraction functionality to RMC

2017-02-09 Thread Todor Minchev
This is V2 of the patchset. It addresses all feedback received in V1.

Changes from previous version:

* remove default silent mode from Makefile
* extract fingerprint with -E instead of -F
* add is_rmcdb(db_blob) for database validation
* add -o option to specify an output directory to extract the database to
* remove non-alphanumeric characters from fingerprint signatures before
  using the signatures as directory names

Todor Minchev (5):
  Makefile: disable silent mode in Makefiles
  Makefile: add debug target
  rmc: Enable reading the contents of an existing fingerprint file
  rmc: remove unnecessary return variable
  rmc: add database extraction functionality

 Makefile  |  23 ++
 Makefile.efi  |  10 ++--
 inc/rmc_api.h |   9 
 inc/rmcl.h|   7 +++
 src/lib/api.c | 106 +-
 src/lib/common/rmcl.c |  17 ++-
 src/rmc.c | 124 +-
 7 files changed, 237 insertions(+), 59 deletions(-)

-- 
2.11.1

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


Re: [meta-intel] [PATCH 3/3] rmc: add database extraction functionality

2017-02-06 Thread Todor Minchev
On Mon, 2017-02-06 at 13:09 -0800, Jianxun Zhang wrote:
> Todor,
> Nice change overall. I haven’t run any test and just share multiple (11) 
> inline comments for this patch.

A patchset incorporating these comments is in progress.

> This should be the last one in the series. Please let me know if I missed any 
> other RMC patches for review.
> 
> I plan to run rmc internal test once we have an updated patch set. We could 
> need to add a new test case for the dumping feature in the future.
> 
> You can refer to the README in rmc project for the pipeline of merging.
> 
> Thanks!
> 
> > On Feb 2, 2017, at 2:37 PM, Todor Minchev <todor.minc...@linux.intel.com> 
> > wrote:
> > 
> > The contents of an existing database file can be extracted in the
> > current working directory with the -E option. The top level of the
> > directory tree is rmc_db_dump and all files corresponding to
> > a given record will be saved in a separate sub-directory. The sub-directory
> > name of each record is the signature corresponding to the fingerprint for
> > that record.
> > 
> > Example:
> > ./src/rmc -E -d rmc.db
> > 
> > Successfully extracted rmc.db
> > 
> > Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
> > ---
> > inc/rmc_api.h |  9 ++
> > src/lib/api.c | 85 
> > +--
> > src/lib/common/rmcl.c |  3 +-
> > src/rmc.c | 44 +++---
> > 4 files changed, 126 insertions(+), 15 deletions(-)
> > 
> > diff --git a/inc/rmc_api.h b/inc/rmc_api.h
> > index a484389..ce26220 100644
> > --- a/inc/rmc_api.h
> > +++ b/inc/rmc_api.h
> > @@ -74,6 +74,15 @@ extern int rmc_query_file_by_fp(rmc_fingerprint_t *fp, 
> > char *db_pathname, char *
> >  */
> > extern int rmc_gimme_file(char* db_pathname, char *file_name, rmc_file_t 
> > *file);
> > 
> > +
> > +/* extract the contents of a database file and store the files 
> > corresponding to
> > + * each record in a separate directory. The name of each directory is the 
> > signature
> > + * of the fingerpring for that record
> > + * (in) db_pathname: The path and file name of a RMC database file 
> > generated by RMC tool
> > + * return: 0 on success, non-zero on failure.
> > + */
> > +int dump_db(char *db_pathname) ;
> > +
> Please move this into section 1.3, somewhere after next line. It doesn’t 
> belong to section 1.2 “double-action API”

Will do.

> 
> > /* 1.3 - Helper APIs */
> > 
> > /* Free allocated data referred in a fingerprint
> > diff --git a/src/lib/api.c b/src/lib/api.c
> > index 0adb390..aca8d99 100644
> > --- a/src/lib/api.c
> > +++ b/src/lib/api.c
> > @@ -3,6 +3,7 @@
> >  * RMC API implementation for Linux user space
> >  */
> > 
> > +#define _GNU_SOURCE
> > #include 
> > #include 
> > #include 
> > @@ -14,8 +15,11 @@
> > #include 
> > #include 
> > 
> > -#define EFI_SYSTAB_PATH "/sys/firmware/efi/systab"
> > -#define SYSTAB_LEN 4096 /* assume 4kb is enough...*/
> > +#define EFI_SYSTAB_PATH  "/sys/firmware/efi/systab"
> > +#define SYSTAB_LEN   4096 /* assume 4kb is enough...*/
> > +#define DB_DUMP_DIR  "./rmc_db_dump"  /* directory to store db data 
> > dump */
> > +
> > +extern const rmc_uint8_t rmc_db_signature[RMC_DB_SIG_LEN];
> We could have a new small helper API like is_rmcdb(db_blob) in RMCL to hold 
> checker logic at line 357 in this file, so that we can get rid of this line 
> and make the checker reusable. (So far I feel the checker should work in both 
> EFI and Linux contexts.)
> 
> We could even update checker API without bothering its callers in the future. 
> Let me know if it makes sense...

Makes sense

> > 
> > int read_file(const char *pathname, char **data, rmc_size_t* len) {
> > int fd = -1;
> > @@ -325,3 +329,80 @@ int rmc_gimme_file(char* db_pathname, char *file_name, 
> > rmc_file_t *file) {
> > 
> > return ret;
> > }
> > +
> > +/*
> > + * Dump contents of database file
> > + * (in) rmc_db - input database file to extract
> rmc_db VS db_pathname. I think we can remove the comment here, it is already 
> in the header file.
> > + */

OK

> > +int dump_db(char *db_pathname) {
> > +rmc_meta_header_t meta_header;
> > +rmc_db_header_t *db_header = NULL;
> > +rmc_record_header_t record_header;
> > +rmc_uint64_t record_idx = 0;   /* offse

[meta-intel] [PATCH 3/3] rmc: add database extraction functionality

2017-02-02 Thread Todor Minchev
The contents of an existing database file can be extracted in the
current working directory with the -E option. The top level of the
directory tree is rmc_db_dump and all files corresponding to
a given record will be saved in a separate sub-directory. The sub-directory
name of each record is the signature corresponding to the fingerprint for
that record.

Example:
./src/rmc -E -d rmc.db

Successfully extracted rmc.db

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 inc/rmc_api.h |  9 ++
 src/lib/api.c | 85 +--
 src/lib/common/rmcl.c |  3 +-
 src/rmc.c | 44 +++---
 4 files changed, 126 insertions(+), 15 deletions(-)

diff --git a/inc/rmc_api.h b/inc/rmc_api.h
index a484389..ce26220 100644
--- a/inc/rmc_api.h
+++ b/inc/rmc_api.h
@@ -74,6 +74,15 @@ extern int rmc_query_file_by_fp(rmc_fingerprint_t *fp, char 
*db_pathname, char *
  */
 extern int rmc_gimme_file(char* db_pathname, char *file_name, rmc_file_t 
*file);
 
+
+/* extract the contents of a database file and store the files corresponding to
+ * each record in a separate directory. The name of each directory is the 
signature
+ * of the fingerpring for that record
+ * (in) db_pathname: The path and file name of a RMC database file generated 
by RMC tool
+ * return: 0 on success, non-zero on failure.
+ */
+int dump_db(char *db_pathname) ;
+
 /* 1.3 - Helper APIs */
 
 /* Free allocated data referred in a fingerprint
diff --git a/src/lib/api.c b/src/lib/api.c
index 0adb390..aca8d99 100644
--- a/src/lib/api.c
+++ b/src/lib/api.c
@@ -3,6 +3,7 @@
  * RMC API implementation for Linux user space
  */
 
+#define _GNU_SOURCE
 #include 
 #include 
 #include 
@@ -14,8 +15,11 @@
 #include 
 #include 
 
-#define EFI_SYSTAB_PATH "/sys/firmware/efi/systab"
-#define SYSTAB_LEN 4096 /* assume 4kb is enough...*/
+#define EFI_SYSTAB_PATH  "/sys/firmware/efi/systab"
+#define SYSTAB_LEN   4096 /* assume 4kb is enough...*/
+#define DB_DUMP_DIR  "./rmc_db_dump"  /* directory to store db data dump */
+
+extern const rmc_uint8_t rmc_db_signature[RMC_DB_SIG_LEN];
 
 int read_file(const char *pathname, char **data, rmc_size_t* len) {
 int fd = -1;
@@ -325,3 +329,80 @@ int rmc_gimme_file(char* db_pathname, char *file_name, 
rmc_file_t *file) {
 
 return ret;
 }
+
+/*
+ * Dump contents of database file
+ * (in) rmc_db - input database file to extract
+ */
+int dump_db(char *db_pathname) {
+rmc_meta_header_t meta_header;
+rmc_db_header_t *db_header = NULL;
+rmc_record_header_t record_header;
+rmc_uint64_t record_idx = 0;   /* offset of each reacord in db*/
+rmc_uint64_t meta_idx = 0; /* offset of each meta in a record */
+rmc_uint64_t file_idx = 0; /* offset of file in a meta */
+rmc_file_t file;
+char *out_dir = NULL, *out_name = NULL;
+rmc_size_t db_len = 0;
+rmc_uint8_t *rmc_db = NULL;
+struct stat s = {0};
+
+if (read_file(db_pathname, (char **)_db, _len)) {
+fprintf(stderr, "Failed to read database file\n\n");
+return 1;
+}
+
+db_header = (rmc_db_header_t *)rmc_db;
+
+/* sanity check of db */
+if (strncmp((const char *)db_header->signature,
+(const char *)rmc_db_signature, RMC_DB_SIG_LEN))
+return 1;
+
+/* create the top level directory */
+if (stat(DB_DUMP_DIR, ) == -1) {
+if(mkdir(DB_DUMP_DIR, 0755)) {
+fprintf(stderr, "Failed to create %s directory\n\n", out_name);
+}
+}
+
+/* query the meta. idx: start of record */
+record_idx = sizeof(rmc_db_header_t);
+while (record_idx < db_header->length) {
+memcpy(_header, rmc_db + record_idx,
+sizeof(rmc_record_header_t));
+
+/* directory name is fingerprint signature */
+asprintf(_dir, "%s/%s/", DB_DUMP_DIR, record_header.signature.raw);
+if (stat(out_dir, ) == -1) {
+if(mkdir(out_dir, 0755)) {
+fprintf(stderr, "Failed to create %s directory\n\n", out_name);
+}
+}
+
+/* find meta */
+for (meta_idx = record_idx + sizeof(rmc_record_header_t);
+meta_idx < record_idx + record_header.length;) {
+memcpy(_header, rmc_db + meta_idx, sizeof(rmc_meta_header_t));
+file_idx = meta_idx + sizeof(rmc_meta_header_t);
+rmc_ssize_t name_len = strlen((char *)_db[file_idx]) + 1;
+file.blob = _db[file_idx + name_len];
+file.blob_len = meta_header.length - sizeof(rmc_meta_header_t) -
+name_len;
+file.next = NULL;
+file.type = RMC_GENERIC_FILE;
+asprintf(_name, "%s%s", out_dir, (char *)_db[file_idx]);
+/* write file to dump directory */
+if (write_file((const char *)out_name, file.blob, f

[meta-intel] [PATCH 2/3] rmc: Enable reading the contents of an existing fingerprint file

2017-02-02 Thread Todor Minchev
The contents of an existing fingerprint file can be read and output on
the command line with the following options:

./rmc -F -i input_fingerprint_file

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 src/rmc.c | 121 +++---
 1 file changed, 76 insertions(+), 45 deletions(-)

diff --git a/src/rmc.c b/src/rmc.c
index 062dd36..a051ccf 100644
--- a/src/rmc.c
+++ b/src/rmc.c
@@ -14,33 +14,35 @@
 #include 
 
 #define USAGE "RMC (Runtime Machine configuration) Tool\n" \
-"NOTE: Most of usages require root permission (sudo)\n" \
-"rmc -F [-o output_fingerprint]\n" \
+"NOTE: Most of usages require root permission (sudo)\n\n" \
+"rmc -F [-o output_fingerprint] | -i input_fingerprint\n" \
 "rmc -R [-f ] -b  [-o output_record]\n" \
 "rmc -D  [-o output_database]\n" \
-   "rmc -B  -d  -o output_file\n" \
-   "\n" \
-   "-F: generate board rmc fingerprint of board\n" \
-   "-R: generate board rmc record of board with its fingerprint and file 
blobs.\n" \
-"-f: fingerprint file to be packed in record, rmc will create a 
fingerprint for board and use it internally to\n" \
-"generate record if -f is missed.\n" \
-"-b: files to be packed in record\n" \
-   "-G: generate rmc database file with records specified in record file 
list\n" \
-   "-B: get a flie blob with specified name associated to the board rmc is 
running on\n" \
-   "-d: database file to be queried\n" \
-   "-o: path and name of output file of a specific command\n" \
-   "\n" \
-"Examples (Steps in an order to add board support into rmc):\n" \
-"generate board fingerprint:\n" \
-"rmc -F\n\n" \
-"generate a rmc record for the board with two file blobs, output to:\n" \
-"a specified file:\n" \
-"rmc -R -f fingerprint -b file_1 file_2 -o my_board.record\n\n" \
-"generate a rmc database file with records from 3 different boards:\n" \
-"rmc -D board1_record board2_record board3_record\n\n" \
-"query a file blob named audio.conf associated to the board rmc is running 
on in database my_rmc.db and output\n" \
-"to /tmp/new_audio.conf:\n" \
-"rmc -B audio.conf -d my_rmc.db -o /tmp/new_audio.conf\n\n"
+"rmc -B  -d  -o output_file\n\n" \
+  "-F: manage fingerprint file\n" \
+"\t-o output_file: store RMC fingerprint of current board in 
output_file\n" \
+"\t-i input_file: print RMC fingerprint stored in input_file\n\n" \
+  "-R: generate board rmc record of board with its fingerprint and file 
blobs.\n" \
+"\t-f intput_file : input fingerprint file to be packed in record\n\n" \
+"\tNOTE: RMC will create a fingerprint for the board and use it to\n" \
+"\tgenerate record if an input fingerprint file is not provided.\n\n" \
+"\t-b: files to be packed in record\n\n" \
+  "-G: generate rmc database file with records specified in record file 
list\n\n" \
+  "-B: get a file blob with specified name associated to the board rmc is\n" \
+  "running on\n" \
+"\t-d: database file to be queried\n" \
+"\t-o: path and name of output file of a specific command\n\n" \
+"Examples (Steps in an order to add board support into rmc):\n\n" \
+"1. Generate board fingerprint:\n" \
+"\t./rmc -F\n\n" \
+"2. Generate a rmc record for the board with two file blobs and save it\n" 
\
+"to a specified file:\n" \
+"\t./rmc -R -f fingerprint -b file_1 file_2 -o my_board.record\n\n" \
+"3. Generate a rmc database file with records from 3 different boards:\n" \
+"\t./rmc -D board1_record board2_record board3_record\n\n" \
+"4. Query a file blob named audio.conf associated to the board rmc is\n" \
+"running on in database my_rmc.db and output to /tmp/new_audio.conf:\n" \
+"\t./rmc -B audio.conf -d my_rmc.db -o /tmp/new_audio.conf\n\n"
 
 
 #define RMC_OPT_CAP_F   (1 << 0)
@@ -51,6 +53,7 @@
 #define RMC_OPT_O   (1 << 5)
 #define RMC_OPT_B   (1 << 6)
 #define RMC_OPT_D   (1 << 7)
+#define RMC_OPT_I   (1 << 8)
 
 static void usage () {
 fprintf(stdout, USAGE);
@@ -78,7 +81,7 @@ static void dump_fingerprint(rmc_fingerprint_t *fp) {
 static int write_fingerprint_file(const char* pathname, rmc_fingerprint_t *fp) 
{
 int i;
 int first = 0;
-
+/* TODO - do we need to open/close file multiple times to write each field 
*/
 for (i = 0;

[meta-intel] [PATCH 1/3] Makefile: add verbosity and debug options to Makefile

2017-02-02 Thread Todor Minchev
By default Makefile verbosity is disabled (V=0). Verbosity can be enabled by
setting the V environment variable to any value not equal to 0 (e.g V=1)

Example:
make clean V=1; make V=1

A debug version of the rmc binary can be built by using the debug
Makefile target. This will include debug symbols and will disable compiler
optimizations when compiling rmc.

Example:

make debug

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 Makefile | 31 +--
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 9ade775..d85d8e9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,12 @@
 # Copyright (C) 2016 Jianxun Zhang <jianxun.zh...@intel.com>
 
+V ?= 0
+ifeq ($(V),0)
+  VERBOSITY = @
+else
+  VERBOSITY =
+endif
+
 TOPDIR = $(shell if [ -z "$$PWD" ]; then pwd; else echo "$$PWD"; fi)
 
 RMC_TOOL_SRC := $(wildcard src/*.c)
@@ -20,28 +27,32 @@ RMC_INSTALL_HEADER_PATH := 
$(RMC_INSTALL_PREFIX)/include/rmc/
 
 ALL_OBJS := $(RMC_TOOL_OBJ) $(RMC_LIB_OBJ)
 
+
 RMC_CFLAGS := -Wall -I$(TOPDIR)/inc
 
 all: rmc
+debug: RMC_CFLAGS += -DDEBUG -g -O0
+debug: rmc
 
 $(ALL_OBJS): %.o: %.c
-   @$(CC) -c $(CFLAGS) $(RMC_CFLAGS) $< -o $@
+   $(VERBOSITY)$(CC) -c $(CFLAGS) $(RMC_CFLAGS) $< -o $@
 
 librmc: $(RMC_LIB_OBJ)
-   @$(AR) rcs src/lib/$@.a $^
+   $(VERBOSITY)$(AR) rcs src/lib/$@.a $^
 
 rmc: $(RMC_TOOL_OBJ) librmc
-   @$(CC) $(CFLAGS) $(RMC_CFLAGS) -Lsrc/lib/ -lrmc $(RMC_TOOL_OBJ) 
src/lib/librmc.a -o src/$@
+   $(VERBOSITY)$(CC) $(CFLAGS) $(RMC_CFLAGS) -Lsrc/lib/ -lrmc 
$(RMC_TOOL_OBJ) \
+  src/lib/librmc.a -o src/$@
 
 clean:
-   @rm -f $(ALL_OBJS) src/rmc src/lib/librmc.a
+   $(VERBOSITY)rm -f $(ALL_OBJS) src/rmc src/lib/librmc.a
 
 .PHONY: clean rmc librmc
 
 install:
-   @mkdir -p $(RMC_INSTALL_BIN_PATH)
-   @install -m 755 src/rmc $(RMC_INSTALL_BIN_PATH)
-   @mkdir -p $(RMC_INSTALL_LIB_PATH)
-   @install -m 644 src/lib/librmc.a $(RMC_INSTALL_LIB_PATH)
-   @mkdir -p $(RMC_INSTALL_HEADER_PATH)
-   @install -m 644 $(RMC_INSTALL_HEADERS) $(RMC_INSTALL_HEADER_PATH)
+   $(VERBOSITY)mkdir -p $(RMC_INSTALL_BIN_PATH)
+   $(VERBOSITY)install -m 755 src/rmc $(RMC_INSTALL_BIN_PATH)
+   $(VERBOSITY)mkdir -p $(RMC_INSTALL_LIB_PATH)
+   $(VERBOSITY)install -m 644 src/lib/librmc.a $(RMC_INSTALL_LIB_PATH)
+   $(VERBOSITY)mkdir -p $(RMC_INSTALL_HEADER_PATH)
+   $(VERBOSITY)install -m 644 $(RMC_INSTALL_HEADERS) 
$(RMC_INSTALL_HEADER_PATH)
-- 
2.11.0

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [PATCH 0/3] [yocto][rmc] Add fingerprint quering and database extraction functionality to RMC

2017-02-02 Thread Todor Minchev
This patchset adds database extraction and fingerprint quering
functionality to RMC

Example:

Output fingerprint contents to terminal:

./rmc -F -i rmc.fingerprint

Extract RMC database:

./rmc -E -d rmc.db

https://bugzilla.yoctoproject.org/show_bug.cgi?id=10092

Todor Minchev (3):
  Makefile: add verbosity and debug options to Makefile
  rmc: Enable reading the contents of an existing fingerprint file
  rmc: add database extraction functionality

 Makefile  |  31 ++
 inc/rmc_api.h |   9 +++
 src/lib/api.c |  85 ++-
 src/lib/common/rmcl.c |   3 +-
 src/rmc.c | 157 +-
 5 files changed, 219 insertions(+), 66 deletions(-)

-- 
2.11.0

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


Re: [meta-intel] [yocto] [meta-inte][rmc][PATCH v2 1/1] rmc: add support for alternative EFI bootloaders

2016-12-15 Thread Todor Minchev
On Thu, 2016-12-15 at 10:09 -0800, Cal Sullivan wrote:
> 
> On 12/13/2016 04:50 PM, Todor Minchev wrote:
> > 
> > On Tue, 2016-12-13 at 16:22 -0800, Jianxun Zhang wrote:
> > > 
> > > > 
> > > > On Dec 13, 2016, at 2:56 PM, Todor Minchev <todor.minchev@linux
> > > > .intel.com> wrote:
> > > > 
> > > > RMC was previously configured to work only with the systemd-
> > > > boot EFI
> > > > bootloader. With this commit we can specify alternative
> > > > bootloaders by
> > > > setting the RMC_BOOTLOADER variable in local.conf. If
> > > > RMC_BOOTLOADER is
> > > > not set systemd-boot will be used by default.
> > > > 
> > > > Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
> > > > ---
> > > > Remove references to grub-efi and gummiboot from V1.
> > > > 
> > > > classes/{rmc-systemd-boot.bbclass => rmc-boot.bbclass} |  5
> > > > +++--
> > > > conf/machine/include/meta-intel.inc|  2 +-
> > > > documentation/rmc/README   | 16
> > > > +---
> > > > 3 files changed, 17 insertions(+), 6 deletions(-)
> > > > rename classes/{rmc-systemd-boot.bbclass => rmc-boot.bbclass}
> > > > (73%)
> > > > 
> > > > diff --git a/classes/rmc-systemd-boot.bbclass b/classes/rmc-
> > > > boot.bbclass
> > > > similarity index 73%
> > > > rename from classes/rmc-systemd-boot.bbclass
> > > > rename to classes/rmc-boot.bbclass
> > > > index ad2cf10..a1f2093 100644
> > > > --- a/classes/rmc-systemd-boot.bbclass
> > > > +++ b/classes/rmc-boot.bbclass
> > > > @@ -1,9 +1,10 @@
> > > > -# rmc-systemd-boot bbclass
> > > > +# rmc-boot bbclass
> > > > # Deploy central RMC database file to ESP
> > > > 
> > > > IMAGE_INSTALL_append = " rmc"
> > > > +RMC_BOOTLOADER ?= "systemd-boot”
> > > Maybe this is what we could have now without bothering OE. It is
> > > better than the corrent code at the cost of another variable to
> > > user. I hope in the future we could get rid of  the dependency to
> > > EFI_PROVIDER (e.g. bz10084).
> > > 
> > > Also refer to my comment for the document change at the below.
> > > > 
> > > > -inherit systemd-boot
> > > > +inherit ${RMC_BOOTLOADER}
> > > > 
> > > > do_bootimg[depends] += "${MLPREFIX}rmc-db:do_deploy"
> > > > 
> > > > diff --git a/conf/machine/include/meta-intel.inc
> > > > b/conf/machine/include/meta-intel.inc
> > > > index c7555ce..fd0a792 100644
> > > > --- a/conf/machine/include/meta-intel.inc
> > > > +++ b/conf/machine/include/meta-intel.inc
> > > > @@ -32,7 +32,7 @@ MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append = "${
> > > > @bb.utils.contains('MACHINE_FEATURE
> > > > # merge the microcode data in the final initrd image.
> > > > INITRD_LIVE_prepend = "${@bb.utils.contains('MACHINE_FEATURES',
> > > > 'intel-ucode', '${DEPLOY_DIR_IMAGE}/microcode.cpio ', '', d)}"
> > > > 
> > > > -EFI_PROVIDER ?= "rmc-systemd-boot"
> > > > +EFI_PROVIDER ?= "rmc-boot"
> > > > 
> > > > # Add general MACHINEOVERRIDE for meta-intel
> > > > MACHINEOVERRIDES =. "intel-x86-common:"
> > > > diff --git a/documentation/rmc/README
> > > > b/documentation/rmc/README
> > > > index 2427ffd..dbee6b6 100644
> > > > --- a/documentation/rmc/README
> > > > +++ b/documentation/rmc/README
> > > > @@ -165,14 +165,24 @@ steps still can override results from
> > > > this hook for boot entries and KBOOTPARAM.
> > > > 
> > > > Enable RMC Feature
> > > > -
> > > > ---
> > > > -To Enable RMC feature in build, add the below lines in a conf
> > > > file:
> > > > +To enable the RMC feature please add the following variables
> > > > to your local.conf.
> > > > +
> > > > DISTRO_FEATURES_append = " rmc"
> > > > -EFI_PROVIDER = "rmc-systemd-boot"
> > > > +EFI_PROVIDER = "rmc-boot"
> > > > +
> > > > +The default EFI bootloader used with RMC is syste

Re: [meta-intel] [yocto] [meta-inte][rmc][PATCH v2 1/1] rmc: add support for alternative EFI bootloaders

2016-12-15 Thread Todor Minchev
On Tue, 2016-12-13 at 17:50 -0800, Cal Sullivan wrote:
> I like where this is heading but does RMC function with bootloaders 
> besides systemd-boot yet?
> A quick boot test with this patch and RMC_BOOTLOADER = "grub-efi" seems 
> to give me vanilla grub-efi.

At the moment RMC works end-to-end only with systemd-boot. This patch
resolves bug 10212 which blocks the changes required for RMC support in
grub-efi (bug 10126).

https://bugzilla.yoctoproject.org/show_bug.cgi?id=10212

https://bugzilla.yoctoproject.org/show_bug.cgi?id=10226

Todor

> Thanks,
> Cal
> 
> On 12/13/2016 04:50 PM, Todor Minchev wrote:
> > On Tue, 2016-12-13 at 16:22 -0800, Jianxun Zhang wrote:
> >>> On Dec 13, 2016, at 2:56 PM, Todor Minchev 
> >>> <todor.minc...@linux.intel.com> wrote:
> >>>
> >>> RMC was previously configured to work only with the systemd-boot EFI
> >>> bootloader. With this commit we can specify alternative bootloaders by
> >>> setting the RMC_BOOTLOADER variable in local.conf. If RMC_BOOTLOADER is
> >>> not set systemd-boot will be used by default.
> >>>
> >>> Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
> >>> ---
> >>> Remove references to grub-efi and gummiboot from V1.
> >>>
> >>> classes/{rmc-systemd-boot.bbclass => rmc-boot.bbclass} |  5 +++--
> >>> conf/machine/include/meta-intel.inc|  2 +-
> >>> documentation/rmc/README   | 16 
> >>> +---
> >>> 3 files changed, 17 insertions(+), 6 deletions(-)
> >>> rename classes/{rmc-systemd-boot.bbclass => rmc-boot.bbclass} (73%)
> >>>
> >>> diff --git a/classes/rmc-systemd-boot.bbclass b/classes/rmc-boot.bbclass
> >>> similarity index 73%
> >>> rename from classes/rmc-systemd-boot.bbclass
> >>> rename to classes/rmc-boot.bbclass
> >>> index ad2cf10..a1f2093 100644
> >>> --- a/classes/rmc-systemd-boot.bbclass
> >>> +++ b/classes/rmc-boot.bbclass
> >>> @@ -1,9 +1,10 @@
> >>> -# rmc-systemd-boot bbclass
> >>> +# rmc-boot bbclass
> >>> # Deploy central RMC database file to ESP
> >>>
> >>> IMAGE_INSTALL_append = " rmc"
> >>> +RMC_BOOTLOADER ?= "systemd-boot”
> >> Maybe this is what we could have now without bothering OE. It is better 
> >> than the corrent code at the cost of another variable to user. I hope in 
> >> the future we could get rid of  the dependency to EFI_PROVIDER (e.g. 
> >> bz10084).
> >>
> >> Also refer to my comment for the document change at the below.
> >>> -inherit systemd-boot
> >>> +inherit ${RMC_BOOTLOADER}
> >>>
> >>> do_bootimg[depends] += "${MLPREFIX}rmc-db:do_deploy"
> >>>
> >>> diff --git a/conf/machine/include/meta-intel.inc 
> >>> b/conf/machine/include/meta-intel.inc
> >>> index c7555ce..fd0a792 100644
> >>> --- a/conf/machine/include/meta-intel.inc
> >>> +++ b/conf/machine/include/meta-intel.inc
> >>> @@ -32,7 +32,7 @@ MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append = 
> >>> "${@bb.utils.contains('MACHINE_FEATURE
> >>> # merge the microcode data in the final initrd image.
> >>> INITRD_LIVE_prepend = "${@bb.utils.contains('MACHINE_FEATURES', 
> >>> 'intel-ucode', '${DEPLOY_DIR_IMAGE}/microcode.cpio ', '', d)}"
> >>>
> >>> -EFI_PROVIDER ?= "rmc-systemd-boot"
> >>> +EFI_PROVIDER ?= "rmc-boot"
> >>>
> >>> # Add general MACHINEOVERRIDE for meta-intel
> >>> MACHINEOVERRIDES =. "intel-x86-common:"
> >>> diff --git a/documentation/rmc/README b/documentation/rmc/README
> >>> index 2427ffd..dbee6b6 100644
> >>> --- a/documentation/rmc/README
> >>> +++ b/documentation/rmc/README
> >>> @@ -165,14 +165,24 @@ steps still can override results from this hook for 
> >>> boot entries and KBOOTPARAM.
> >>>
> >>> Enable RMC Feature
> >>> 
> >>> -To Enable RMC feature in build, add the below lines in a conf file:
> >>> +To enable the RMC feature please add the following variables to your 
> >>> local.conf.
> >>> +
> >>> DISTRO_FEATURES_append = " rmc"
> >>> -EFI_PROVIDER = "rmc-systemd-boot&q

Re: [meta-intel] [yocto][meta-inte][rmc][PATCH v2 1/1] rmc: add support for alternative EFI bootloaders

2016-12-15 Thread Todor Minchev
On Tue, 2016-12-13 at 16:22 -0800, Jianxun Zhang wrote:
> > On Dec 13, 2016, at 2:56 PM, Todor Minchev <todor.minc...@linux.intel.com> 
> > wrote:
> > 
> > RMC was previously configured to work only with the systemd-boot EFI
> > bootloader. With this commit we can specify alternative bootloaders by
> > setting the RMC_BOOTLOADER variable in local.conf. If RMC_BOOTLOADER is
> > not set systemd-boot will be used by default.
> > 
> > Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
> > ---
> > Remove references to grub-efi and gummiboot from V1.
> > 
> > classes/{rmc-systemd-boot.bbclass => rmc-boot.bbclass} |  5 +++--
> > conf/machine/include/meta-intel.inc|  2 +-
> > documentation/rmc/README   | 16 +---
> > 3 files changed, 17 insertions(+), 6 deletions(-)
> > rename classes/{rmc-systemd-boot.bbclass => rmc-boot.bbclass} (73%)
> > 
> > diff --git a/classes/rmc-systemd-boot.bbclass b/classes/rmc-boot.bbclass
> > similarity index 73%
> > rename from classes/rmc-systemd-boot.bbclass
> > rename to classes/rmc-boot.bbclass
> > index ad2cf10..a1f2093 100644
> > --- a/classes/rmc-systemd-boot.bbclass
> > +++ b/classes/rmc-boot.bbclass
> > @@ -1,9 +1,10 @@
> > -# rmc-systemd-boot bbclass
> > +# rmc-boot bbclass
> > # Deploy central RMC database file to ESP
> > 
> > IMAGE_INSTALL_append = " rmc"
> > +RMC_BOOTLOADER ?= "systemd-boot”
> Maybe this is what we could have now without bothering OE. It is better than 
> the corrent code at the cost of another variable to user. I hope in the 
> future we could get rid of  the dependency to EFI_PROVIDER (e.g. bz10084).
> 
> Also refer to my comment for the document change at the below.
> > 
> > -inherit systemd-boot
> > +inherit ${RMC_BOOTLOADER}
> > 
> > do_bootimg[depends] += "${MLPREFIX}rmc-db:do_deploy"
> > 
> > diff --git a/conf/machine/include/meta-intel.inc 
> > b/conf/machine/include/meta-intel.inc
> > index c7555ce..fd0a792 100644
> > --- a/conf/machine/include/meta-intel.inc
> > +++ b/conf/machine/include/meta-intel.inc
> > @@ -32,7 +32,7 @@ MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append = 
> > "${@bb.utils.contains('MACHINE_FEATURE
> > # merge the microcode data in the final initrd image.
> > INITRD_LIVE_prepend = "${@bb.utils.contains('MACHINE_FEATURES', 
> > 'intel-ucode', '${DEPLOY_DIR_IMAGE}/microcode.cpio ', '', d)}"
> > 
> > -EFI_PROVIDER ?= "rmc-systemd-boot"
> > +EFI_PROVIDER ?= "rmc-boot"
> > 
> > # Add general MACHINEOVERRIDE for meta-intel
> > MACHINEOVERRIDES =. "intel-x86-common:"
> > diff --git a/documentation/rmc/README b/documentation/rmc/README
> > index 2427ffd..dbee6b6 100644
> > --- a/documentation/rmc/README
> > +++ b/documentation/rmc/README
> > @@ -165,14 +165,24 @@ steps still can override results from this hook for 
> > boot entries and KBOOTPARAM.
> > 
> > Enable RMC Feature
> > 
> > -To Enable RMC feature in build, add the below lines in a conf file:
> > +To enable the RMC feature please add the following variables to your 
> > local.conf.
> > +
> > DISTRO_FEATURES_append = " rmc"
> > -EFI_PROVIDER = "rmc-systemd-boot"
> > +EFI_PROVIDER = "rmc-boot"
> > +
> > +The default EFI bootloader used with RMC is systemd-boot. To change the 
> > default
> > +bootloader please overwrite the RMC_BOOTLOADER variable in your local.conf
> > 
> > Note:
> > Image could be still bootable if you only have either of two lines, but RMC
> > feature won't be fully functional.
> > 
> > +To install only the RMC client with the systemd-boot bootloader without
> > +including a default RMC database file, add the following lines to your
> > +local.conf:
> > +
> > +EFI_PROVIDER = "systemd-boot"
> > +IMAGE_INSTALL_append = " rmc”
> I think this use case could confuse for user without much benefit. And 
> actually they still can set EFI_PROVIDER to any available efi bootloaders to 
> get this effect as long as it is not “rmc-boot”, right?
> Maybe we should just say “you won’t get rmc database deployed if you set 
> EFI_PROVIDER to any values not rmc-boot."
Yes, this can be another way to phrase this.

> > 
> > Examples
> > @@ -190,7 +200,7 @@ EXAMPLE 1: Support a new board type:
> > (1) enable the feature and do a build to get a live-boot image by adding 
> > these
> > lines in conf/local.conf:
> > DISTRO_FEATURES_append = " rmc"
> > -EFI_PROVIDER = "rmc-systemd-boot"
> > +EFI_PROVIDER = "rmc-boot"
> > 
> > (2) flash the image to a USB stick and boot it on your board
> > 
> > -- 
> > 2.11.0
> > 
> 


-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [yocto][meta-inte][rmc][PATCH v2 1/1] rmc: add support for alternative EFI bootloaders

2016-12-15 Thread Todor Minchev
RMC was previously configured to work only with the systemd-boot EFI
bootloader. With this commit we can specify alternative bootloaders by
setting the RMC_BOOTLOADER variable in local.conf. If RMC_BOOTLOADER is
not set systemd-boot will be used by default.

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
Remove references to grub-efi and gummiboot from V1.

 classes/{rmc-systemd-boot.bbclass => rmc-boot.bbclass} |  5 +++--
 conf/machine/include/meta-intel.inc|  2 +-
 documentation/rmc/README   | 16 +---
 3 files changed, 17 insertions(+), 6 deletions(-)
 rename classes/{rmc-systemd-boot.bbclass => rmc-boot.bbclass} (73%)

diff --git a/classes/rmc-systemd-boot.bbclass b/classes/rmc-boot.bbclass
similarity index 73%
rename from classes/rmc-systemd-boot.bbclass
rename to classes/rmc-boot.bbclass
index ad2cf10..a1f2093 100644
--- a/classes/rmc-systemd-boot.bbclass
+++ b/classes/rmc-boot.bbclass
@@ -1,9 +1,10 @@
-# rmc-systemd-boot bbclass
+# rmc-boot bbclass
 # Deploy central RMC database file to ESP
 
 IMAGE_INSTALL_append = " rmc"
+RMC_BOOTLOADER ?= "systemd-boot"
 
-inherit systemd-boot
+inherit ${RMC_BOOTLOADER}
 
 do_bootimg[depends] += "${MLPREFIX}rmc-db:do_deploy"
 
diff --git a/conf/machine/include/meta-intel.inc 
b/conf/machine/include/meta-intel.inc
index c7555ce..fd0a792 100644
--- a/conf/machine/include/meta-intel.inc
+++ b/conf/machine/include/meta-intel.inc
@@ -32,7 +32,7 @@ MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append = 
"${@bb.utils.contains('MACHINE_FEATURE
 # merge the microcode data in the final initrd image.
 INITRD_LIVE_prepend = "${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', 
'${DEPLOY_DIR_IMAGE}/microcode.cpio ', '', d)}"
 
-EFI_PROVIDER ?= "rmc-systemd-boot"
+EFI_PROVIDER ?= "rmc-boot"
 
 # Add general MACHINEOVERRIDE for meta-intel
 MACHINEOVERRIDES =. "intel-x86-common:"
diff --git a/documentation/rmc/README b/documentation/rmc/README
index 2427ffd..dbee6b6 100644
--- a/documentation/rmc/README
+++ b/documentation/rmc/README
@@ -165,14 +165,24 @@ steps still can override results from this hook for boot 
entries and KBOOTPARAM.
 
 Enable RMC Feature
 

-To Enable RMC feature in build, add the below lines in a conf file:
+To enable the RMC feature please add the following variables to your 
local.conf.
+
 DISTRO_FEATURES_append = " rmc"
-EFI_PROVIDER = "rmc-systemd-boot"
+EFI_PROVIDER = "rmc-boot"
+
+The default EFI bootloader used with RMC is systemd-boot. To change the default
+bootloader please overwrite the RMC_BOOTLOADER variable in your local.conf
 
 Note:
 Image could be still bootable if you only have either of two lines, but RMC
 feature won't be fully functional.
 
+To install only the RMC client with the systemd-boot bootloader without
+including a default RMC database file, add the following lines to your
+local.conf:
+
+EFI_PROVIDER = "systemd-boot"
+IMAGE_INSTALL_append = " rmc"
 
 
 Examples
@@ -190,7 +200,7 @@ EXAMPLE 1: Support a new board type:
 (1) enable the feature and do a build to get a live-boot image by adding these
 lines in conf/local.conf:
 DISTRO_FEATURES_append = " rmc"
-EFI_PROVIDER = "rmc-systemd-boot"
+EFI_PROVIDER = "rmc-boot"
 
 (2) flash the image to a USB stick and boot it on your board
 
-- 
2.11.0

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [yocto][meta-inte][rmc][PATCH 1/1] rmc: add support for alternative EFI bootloaders

2016-12-15 Thread Todor Minchev
RMC was previously configured to work only with the systemd-boot EFI
bootloader. With this commit we can specify alternative bootloaders by
setting the RMC_BOOTLOADER variable in local.conf. If RMC_BOOTLOADER is
not set systemd-boot will be used by default.

Example for grub-efi:

RMC_BOOTLOADER = "grub-efi"

Signed-off-by: Todor Minchev <todor.minc...@linux.intel.com>
---
 .../{rmc-systemd-boot.bbclass => rmc-boot.bbclass} |  5 +++--
 conf/machine/include/meta-intel.inc|  2 +-
 documentation/rmc/README   | 26 +++---
 3 files changed, 27 insertions(+), 6 deletions(-)
 rename classes/{rmc-systemd-boot.bbclass => rmc-boot.bbclass} (73%)

diff --git a/classes/rmc-systemd-boot.bbclass b/classes/rmc-boot.bbclass
similarity index 73%
rename from classes/rmc-systemd-boot.bbclass
rename to classes/rmc-boot.bbclass
index ad2cf10..a1f2093 100644
--- a/classes/rmc-systemd-boot.bbclass
+++ b/classes/rmc-boot.bbclass
@@ -1,9 +1,10 @@
-# rmc-systemd-boot bbclass
+# rmc-boot bbclass
 # Deploy central RMC database file to ESP
 
 IMAGE_INSTALL_append = " rmc"
+RMC_BOOTLOADER ?= "systemd-boot"
 
-inherit systemd-boot
+inherit ${RMC_BOOTLOADER}
 
 do_bootimg[depends] += "${MLPREFIX}rmc-db:do_deploy"
 
diff --git a/conf/machine/include/meta-intel.inc 
b/conf/machine/include/meta-intel.inc
index c7555ce..fd0a792 100644
--- a/conf/machine/include/meta-intel.inc
+++ b/conf/machine/include/meta-intel.inc
@@ -32,7 +32,7 @@ MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append = 
"${@bb.utils.contains('MACHINE_FEATURE
 # merge the microcode data in the final initrd image.
 INITRD_LIVE_prepend = "${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', 
'${DEPLOY_DIR_IMAGE}/microcode.cpio ', '', d)}"
 
-EFI_PROVIDER ?= "rmc-systemd-boot"
+EFI_PROVIDER ?= "rmc-boot"
 
 # Add general MACHINEOVERRIDE for meta-intel
 MACHINEOVERRIDES =. "intel-x86-common:"
diff --git a/documentation/rmc/README b/documentation/rmc/README
index 2427ffd..7dde8a4 100644
--- a/documentation/rmc/README
+++ b/documentation/rmc/README
@@ -165,14 +165,34 @@ steps still can override results from this hook for boot 
entries and KBOOTPARAM.
 
 Enable RMC Feature
 

-To Enable RMC feature in build, add the below lines in a conf file:
+To enable the RMC feature please add the following variables to your 
local.conf.
+
 DISTRO_FEATURES_append = " rmc"
-EFI_PROVIDER = "rmc-systemd-boot"
+EFI_PROVIDER = "rmc-boot"
+
+The default EFI bootloader used with RMC is systemd-boot. To change the default
+bootloader please overwrite the RMC_BOOTLOADER variable in your local.conf
+
+For example
+
+to use grub-efi:
+RMC_BOOTLOADER = "grub-efi"
+
+OR
+
+to use gummiboot:
+RMC_BOOTLOADER = "gummiboot"
 
 Note:
 Image could be still bootable if you only have either of two lines, but RMC
 feature won't be fully functional.
 
+To install only the RMC client with the systemd-boot bootloader without
+including a default RMC database file, add the following lines to your
+local.conf:
+
+EFI_PROVIDER = "systemd-boot"
+IMAGE_INSTALL_append = " rmc"
 
 
 Examples
@@ -190,7 +210,7 @@ EXAMPLE 1: Support a new board type:
 (1) enable the feature and do a build to get a live-boot image by adding these
 lines in conf/local.conf:
 DISTRO_FEATURES_append = " rmc"
-EFI_PROVIDER = "rmc-systemd-boot"
+EFI_PROVIDER = "rmc-boot"
 
 (2) flash the image to a USB stick and boot it on your board
 
-- 
2.11.0

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel