summaryrefslogtreecommitdiffstats
path: root/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch')
-rw-r--r--recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch81
1 files changed, 81 insertions, 0 deletions
diff --git a/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch b/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch
new file mode 100644
index 0000000..7508269
--- /dev/null
+++ b/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch
@@ -0,0 +1,81 @@
1From 4cb9c65ea9c0eba3ba04d036dccd4a5ab3d2547b Mon Sep 17 00:00:00 2001
2From: Mikko Ylinen <mikko.ylinen@intel.com>
3Date: Fri, 27 Jan 2017 13:31:45 +0200
4Subject: [PATCH] sd-boot: support global kernel command line in EFI stub
5
6This change integrates rmc into EFI stub and supports a
7global fragment (RMC KBOOTPARAM) that is appended to the
8cmdline at boot.
9
10The fragment is board-specific and read from the database.
11
12Implements [YOCTO #10924].
13
14Upstream-status: Pending
15
16Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
17---
18 src/boot/efi/stub.c | 33 +++++++++++++++++++++++++++++++++
19 1 file changed, 33 insertions(+)
20
21diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c
22index 1e250f34f..f3865199f 100644
23--- a/src/boot/efi/stub.c
24+++ b/src/boot/efi/stub.c
25@@ -13,6 +13,7 @@
26
27 #include <efi.h>
28 #include <efilib.h>
29+#include <rmc_api.h>
30
31 #include "disk.h"
32 #include "graphics.h"
33@@ -48,6 +49,9 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
34 UINTN cmdline_len;
35 CHAR16 uuid[37];
36 EFI_STATUS err;
37+ INTN len;
38+ CHAR8 *rmc_db = NULL;
39+ rmc_file_t rmc_file;
40
41 InitializeLib(image, sys_table);
42
43@@ -112,6 +116,35 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
44 #endif
45 }
46
47+ len = file_read(root_dir, L"\\rmc.db", 0, 0, &rmc_db);
48+ if (len <= 0)
49+ rmc_db = NULL;
50+
51+ /* If the board has a fragment in rmc database, append it to the cmdline */
52+ if (rmc_db && !rmc_gimme_file(sys_table, rmc_db, "KBOOTPARAM", &rmc_file)) {
53+ CHAR8 *line;
54+ UINTN i = 0;
55+ UINTN j;
56+
57+ line = AllocatePool(rmc_file.blob_len + cmdline_len + 2);
58+
59+ while (i < cmdline_len && cmdline[i] != '\0') {
60+ line[i] = cmdline[i];
61+ i++;
62+ }
63+
64+ line[i++] = ' ';
65+
66+ for (j=0; j < rmc_file.blob_len; j++)
67+ line[i+j] = rmc_file.blob[j];
68+ line[i+j] = '\0';
69+
70+ cmdline = line;
71+ cmdline_len = i + j;
72+
73+ FreePool(rmc_db);
74+ }
75+
76 /* export the device path this image is started from */
77 if (disk_get_part_uuid(loaded_image->DeviceHandle, uuid) == EFI_SUCCESS)
78 efivar_set(L"LoaderDevicePartUUID", uuid, FALSE);
79--
802.11.0
81