mirror of
git://git.yoctoproject.org/meta-intel.git
synced 2025-07-19 12:59:03 +02:00
rmc: integration update
This is a whole package of rmc work in meta-intel to reflect some major changes in the upstream project: In rmc.bb recipe, EFI_ARCH, path of EFI header files, and dependency on gnu-efi are removed with the updated revision. In systemd-boot, patches to integrate with rmc are re-worked mainly because of new APIs. Size of patches are smaller than the previous implementation. Notice we still use multiple APIs instead of calling an one-step interface multiple times, to get some potential runtime performance benefit. (rmc tool in user space is changed to use single API in the upstream project.) Fixes [YOCTO #10086] Fixes [YOCTO #10671] Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
This commit is contained in:
parent
5bd26ee16c
commit
58e5069ee3
|
@ -14,33 +14,23 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=838c366f69b72c5df05c96dff79b35f2"
|
|||
|
||||
SRC_URI = "git://git.yoctoproject.org/rmc"
|
||||
|
||||
SRCREV = "2e38d056f86c0457f3a5ca7ef848545bbb190e47"
|
||||
SRCREV = "4799cb89b543712390d863a6fc50a58881590fa2"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
DEPENDS_class-target = "gnu-efi"
|
||||
|
||||
COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux*"
|
||||
|
||||
EXTRA_OEMAKE='RMC_CFLAGS="-Wl,--hash-style=both"'
|
||||
|
||||
# from gnu-efi, we should align arch-mapping with it.
|
||||
def rmc_efi_arch(d):
|
||||
import re
|
||||
arch = d.getVar("TARGET_ARCH", True)
|
||||
if re.match("i[3456789]86", arch):
|
||||
return "ia32"
|
||||
return arch
|
||||
TARGET_CFLAGS +="-Wl,--hash-style=both"
|
||||
|
||||
SECURITY_CFLAGS_remove_class-target = "-fstack-protector-strong"
|
||||
do_compile_class-target() {
|
||||
oe_runmake
|
||||
oe_runmake RMC_EFI_HEADER_PREFIX=${STAGING_INCDIR}/efi RMC_EFI_ARCH="${@rmc_efi_arch(d)}" -f Makefile.efi
|
||||
oe_runmake -f Makefile.efi
|
||||
}
|
||||
|
||||
do_install() {
|
||||
oe_runmake RMC_EFI_ARCH="${@rmc_efi_arch(d)}" RMC_INSTALL_PREFIX=${D}/usr install
|
||||
oe_runmake RMC_EFI_ARCH="${@rmc_efi_arch(d)}" RMC_INSTALL_PREFIX=${D}/usr -f Makefile.efi install
|
||||
oe_runmake RMC_INSTALL_PREFIX=${D}/usr install
|
||||
oe_runmake RMC_INSTALL_PREFIX=${D}/usr -f Makefile.efi install
|
||||
}
|
||||
|
||||
do_install_class-native() {
|
||||
|
|
|
@ -2,7 +2,7 @@ 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/efi -DRMC_EFI"'
|
||||
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,
|
||||
|
@ -15,7 +15,7 @@ EXTRA_OEMAKE_append_intel-x86-common = ' EFI_LDFLAGS="-L${STAGING_DIR_HOST}/usr/
|
|||
SRCREV_intel-x86-common = "3a74d4fc90cb322a4784a3515bef7118c8f8c5ba"
|
||||
|
||||
SRC_URI_append_intel-x86-common = " \
|
||||
file://0001-sd-boot-Link-RMC-libraries-into-bootloader.patch \
|
||||
file://0001-sd-boot-Link-RMC-library-into-bootloader.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://0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch \
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
From b7775f24928fca01600cac1077ff3f215aa6362d Mon Sep 17 00:00:00 2001
|
||||
From 1ccd031ce97501f8ee63f39e8794437d568115dc Mon Sep 17 00:00:00 2001
|
||||
From: Jianxun Zhang <jianxun.zhang@linux.intel.com>
|
||||
Date: Sat, 21 May 2016 18:52:07 -0700
|
||||
Subject: [PATCH 1/3] sd-boot: Link RMC libraries into bootloader
|
||||
Subject: [PATCH 1/3] sd-boot: Link RMC library into bootloader
|
||||
|
||||
Add two RMC libraries into bootloader binary. EFI stub is not changed
|
||||
Add RMC library into bootloader binary. EFI stub is not changed
|
||||
until we really need rmc in stub.
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
@ -14,7 +14,7 @@ Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
|
|||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 305099a..ff21ebd 100644
|
||||
index 305099a..df176a5 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -2802,7 +2802,7 @@ $(top_builddir)/src/boot/efi/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(t
|
||||
|
@ -22,7 +22,7 @@ index 305099a..ff21ebd 100644
|
|||
$(systemd_boot_solib): $(systemd_boot_objects)
|
||||
$(AM_V_CCLD)$(LD) $(efi_ldflags) $(systemd_boot_objects) \
|
||||
- -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \
|
||||
+ -o $@ -lefi -lgnuefi -lrmclefi -lrsmpefi $(shell $(CC) -print-libgcc-file-name); \
|
||||
+ -o $@ -lefi -lgnuefi -lrmcefi $(shell $(CC) -print-libgcc-file-name); \
|
||||
nm -D -u $@ | grep ' U ' && exit 1 || :
|
||||
|
||||
$(systemd_boot): $(systemd_boot_solib)
|
|
@ -1,4 +1,4 @@
|
|||
From f714cdc84b791d84099f7461c4f223677456720f Mon Sep 17 00:00:00 2001
|
||||
From a3c4fc8c2847fe289a617bcba1d905f580f0e18d Mon Sep 17 00:00:00 2001
|
||||
From: Jianxun Zhang <jianxun.zhang@linux.intel.com>
|
||||
Date: Wed, 1 Jun 2016 16:32:22 -0700
|
||||
Subject: [PATCH 2/3] sd-boot: Load board-specific boot entries from RMC
|
||||
|
@ -39,23 +39,22 @@ Upstream-Status: Pending
|
|||
|
||||
Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
|
||||
---
|
||||
src/boot/efi/boot.c | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 158 insertions(+), 2 deletions(-)
|
||||
src/boot/efi/boot.c | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 145 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c
|
||||
index 30c1ead..43b0793 100644
|
||||
index 30c1ead..d1b029b 100644
|
||||
--- a/src/boot/efi/boot.c
|
||||
+++ b/src/boot/efi/boot.c
|
||||
@@ -15,6 +15,8 @@
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
+#include <rmcl.h>
|
||||
+#include <rsmp.h>
|
||||
+#include <rmc_api.h>
|
||||
|
||||
#include "console.h"
|
||||
#include "disk.h"
|
||||
@@ -33,6 +35,9 @@ static const char __attribute__((used)) magic[] = "#### LoaderInfo: systemd-boot
|
||||
@@ -33,6 +34,9 @@ static const char __attribute__((used)) magic[] = "#### LoaderInfo: systemd-boot
|
||||
|
||||
static const EFI_GUID global_guid = EFI_GLOBAL_VARIABLE;
|
||||
|
||||
|
@ -65,7 +64,7 @@ index 30c1ead..43b0793 100644
|
|||
enum loader_type {
|
||||
LOADER_UNDEFINED,
|
||||
LOADER_EFI,
|
||||
@@ -1702,6 +1707,148 @@ static VOID config_free(Config *config) {
|
||||
@@ -1702,6 +1706,136 @@ static VOID config_free(Config *config) {
|
||||
FreePool(config->entry_oneshot);
|
||||
}
|
||||
|
||||
|
@ -123,13 +122,8 @@ index 30c1ead..43b0793 100644
|
|||
+ * this function returns 0.
|
||||
+ */
|
||||
+
|
||||
+static UINTN rmc_initialize(EFI_FILE *root_dir, CHAR8 **db, rmc_fingerprint_t **fp) {
|
||||
+static UINTN rmc_initialize(EFI_FILE *root_dir, EFI_SYSTEM_TABLE *sys_table, CHAR8 **db, rmc_fingerprint_t **fp) {
|
||||
+ UINTN len;
|
||||
+ EFI_GUID smbios_guid = SMBIOS_TABLE_GUID;
|
||||
+ EFI_GUID smbios3_guid = SMBIOS3_TABLE_GUID;
|
||||
+ VOID *smbios_entry = NULL;
|
||||
+ UINT64 smbios_struct_addr = 0;
|
||||
+ UINT16 smbios_struct_len = 0;
|
||||
+ UINTN ret = 1;
|
||||
+
|
||||
+ if (!db || !fp)
|
||||
|
@ -144,18 +138,11 @@ index 30c1ead..43b0793 100644
|
|||
+ if (len <= 0)
|
||||
+ goto done;
|
||||
+
|
||||
+ /* locate smbios entry table, try both 32 and 64 bit */
|
||||
+ if (LibGetSystemConfigurationTable(&smbios3_guid, &smbios_entry) != EFI_SUCCESS
|
||||
+ && LibGetSystemConfigurationTable(&smbios_guid, &smbios_entry) != EFI_SUCCESS)
|
||||
+ goto done;
|
||||
+
|
||||
+ /* call rsmp to get fp */
|
||||
+ if (rsmp_get_smbios_strcut(smbios_entry, &smbios_struct_addr, &smbios_struct_len))
|
||||
+ goto done;
|
||||
+
|
||||
+ *fp = AllocateZeroPool(sizeof(rmc_fingerprint_t));
|
||||
+
|
||||
+ if (rsmp_get_fingerprint_from_smbios_struct((BYTE *) smbios_struct_addr, *fp))
|
||||
+ /* call rmc to get fingerprint. We will use single-action rmc APIs to query multiple files.
|
||||
+ * This should bring a better performance than calling double-action rmc API every time.
|
||||
+ */
|
||||
+ if (rmc_get_fingerprint(sys_table, *fp))
|
||||
+ goto done;
|
||||
+
|
||||
+ ret = 0;
|
||||
|
@ -174,7 +161,7 @@ index 30c1ead..43b0793 100644
|
|||
+static BOOLEAN config_load_rmc_entries(Config *config, EFI_HANDLE *device, CHAR16 *loaded_image_path, CHAR8 *db, rmc_fingerprint_t *fp) {
|
||||
+ CHAR8 *boot_entry = NULL;
|
||||
+ CHAR8 *boot_config = NULL;
|
||||
+ rmc_policy_file_t rp;
|
||||
+ rmc_file_t rp;
|
||||
+ CHAR8 *line;
|
||||
+ UINT64 pos = 0;
|
||||
+ BOOLEAN ret = FALSE;
|
||||
|
@ -183,7 +170,7 @@ index 30c1ead..43b0793 100644
|
|||
+ return ret;
|
||||
+
|
||||
+ /* query boot entry config file */
|
||||
+ if (query_policy_from_db(fp, db, RMC_POLICY_BLOB, "BOOTENTRY.CONFIG", &rp))
|
||||
+ if (rmc_query_file_by_fp(fp, db, "BOOTENTRY.CONFIG", &rp))
|
||||
+ return ret;
|
||||
+
|
||||
+ /* file blob read from rmc db is not necessarily null-terminated, and we
|
||||
|
@ -194,7 +181,7 @@ index 30c1ead..43b0793 100644
|
|||
+ boot_config[rp.blob_len] = '\0';
|
||||
+ /* parse boot entry config */
|
||||
+ while ((line = get_line(boot_config, &pos))) {
|
||||
+ if (query_policy_from_db(fp, db, RMC_POLICY_BLOB, (char *)line, &rp))
|
||||
+ if (rmc_query_file_by_fp(fp, db, (char *)line, &rp))
|
||||
+ continue;
|
||||
+ if (rp.blob_len > 0) {
|
||||
+ boot_entry = AllocatePool(rp.blob_len * sizeof(CHAR8) + 1);
|
||||
|
@ -214,7 +201,7 @@ index 30c1ead..43b0793 100644
|
|||
EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
CHAR16 *s;
|
||||
CHAR8 *b;
|
||||
@@ -1714,6 +1861,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
@@ -1714,6 +1848,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
UINT64 init_usec;
|
||||
BOOLEAN menu = FALSE;
|
||||
CHAR16 uuid[37];
|
||||
|
@ -222,16 +209,16 @@ index 30c1ead..43b0793 100644
|
|||
|
||||
InitializeLib(image, sys_table);
|
||||
init_usec = time_usec();
|
||||
@@ -1745,6 +1893,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
@@ -1745,6 +1880,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
+ /* Initialize rmc before loading any config */
|
||||
+ rmc_initialize(root_dir, &rmc_db, &rmc_fp);
|
||||
+ rmc_initialize(root_dir, sys_table, &rmc_db, &rmc_fp);
|
||||
|
||||
/* the filesystem path to this image, to prevent adding ourselves to the menu */
|
||||
loaded_image_path = DevicePathToStr(loaded_image->FilePath);
|
||||
@@ -1753,11 +1903,15 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
@@ -1753,11 +1890,15 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
ZeroMem(&config, sizeof(Config));
|
||||
config_load_defaults(&config, root_dir);
|
||||
|
||||
|
@ -249,7 +236,7 @@ index 30c1ead..43b0793 100644
|
|||
|
||||
/* sort entries after version number */
|
||||
config_sort_entries(&config);
|
||||
@@ -1851,6 +2005,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
@@ -1851,6 +1992,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
|
||||
out:
|
||||
FreePool(loaded_image_path);
|
||||
config_free(&config);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From a38be4fe8ffed142abbba92f7ad91a8f7b8f1ace Mon Sep 17 00:00:00 2001
|
||||
From 1e33f99e13a70c19c1f63f6ef1c5522a09adece6 Mon Sep 17 00:00:00 2001
|
||||
From: Jianxun Zhang <jianxun.zhang@linux.intel.com>
|
||||
Date: Mon, 20 Jun 2016 13:08:20 -0700
|
||||
Subject: [PATCH 3/3] sd-boot: Support global kernel command line fragment
|
||||
|
@ -17,10 +17,10 @@ Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
|
|||
1 file changed, 34 insertions(+)
|
||||
|
||||
diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c
|
||||
index 43b0793..3dcd9a5 100644
|
||||
index d1b029b..8dffc48 100644
|
||||
--- a/src/boot/efi/boot.c
|
||||
+++ b/src/boot/efi/boot.c
|
||||
@@ -847,6 +847,40 @@ static VOID config_add_entry(Config *config, ConfigEntry *entry) {
|
||||
@@ -846,6 +846,40 @@ static VOID config_add_entry(Config *config, ConfigEntry *entry) {
|
||||
config->entries = ReallocatePool(config->entries,
|
||||
sizeof(VOID *) * config->entry_count, sizeof(VOID *) * i);
|
||||
}
|
||||
|
@ -29,9 +29,9 @@ index 43b0793..3dcd9a5 100644
|
|||
+ * we put appending global command line here to cover both of two cases.
|
||||
+ */
|
||||
+ if (entry->type == LOADER_LINUX && rmc_db && rmc_fp) {
|
||||
+ rmc_policy_file_t rmc_kp;
|
||||
+ rmc_file_t rmc_kp;
|
||||
+
|
||||
+ if (!query_policy_from_db(rmc_fp, rmc_db, RMC_POLICY_BLOB, "KBOOTPARAM", &rmc_kp)) {
|
||||
+ if (!rmc_query_file_by_fp(rmc_fp, rmc_db, "KBOOTPARAM", &rmc_kp)) {
|
||||
+ CHAR8 *cmdline;
|
||||
+ CHAR16 *s;
|
||||
+ CHAR16 *t;
|
||||
|
|
Loading…
Reference in New Issue
Block a user