diff options
author | Jianxun Zhang <jianxun.zhang@linux.intel.com> | 2016-08-03 11:04:14 -0700 |
---|---|---|
committer | Tom Zanussi <tom.zanussi@linux.intel.com> | 2016-08-03 17:36:45 -0500 |
commit | 7d3305235702a7c730ea9af9db6b00156e664194 (patch) | |
tree | e2c758a0af21ba62e39f92e7517371dea264fc33 /common/recipes-bsp/systemd-boot/systemd-boot/0003-sd-boot-Support-global-kernel-command-line-fragment.patch | |
parent | 8fe13a12c26022843a31e0909f34843f78bdacf6 (diff) | |
download | meta-intel-7d3305235702a7c730ea9af9db6b00156e664194.tar.gz |
systemd-boot: Load board-specific entry and kernel cmdline
Invoke RMC APIs in this bootloader to query board-specific data
from RMC database(DB) file on ESP. Data can be boot entries or a
global kernel boot command line fragment specific to a type of
board supported in RMC DB.
Bootloader queries a file blob named BOOTENTRY.CONFIG from RMC
DB first. In success, bootloader parses BOOTENTRY.CONFIG to get
name of each boot entry file associated to the type of running
board, and then tries to load the entry into internal config data
structure. Once any entry is loaded from RMC DB, bootloader skips
loading conf files on ESP.
BOOTENTRY.CONFIG has a very simple format - every line is a boot
entry file's name. For example, to specify two boot entries in it:
boot.conf
install.conf
Bootloader also seeks another file named KBOOTPARAM in RMC dB.
when it can obtain this file associated to the type of running
board, it appends what in file to the end of kernel command
line before it boots up kernel. The appending is effective on
every boot entry, so it is called "global" cmdline fragment.
When Bootloader doesn't get config, an entry or cmdline fragment
for the type of board, it simply moves to the next step.
Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
Reviewed-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Diffstat (limited to 'common/recipes-bsp/systemd-boot/systemd-boot/0003-sd-boot-Support-global-kernel-command-line-fragment.patch')
-rw-r--r-- | common/recipes-bsp/systemd-boot/systemd-boot/0003-sd-boot-Support-global-kernel-command-line-fragment.patch | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/common/recipes-bsp/systemd-boot/systemd-boot/0003-sd-boot-Support-global-kernel-command-line-fragment.patch b/common/recipes-bsp/systemd-boot/systemd-boot/0003-sd-boot-Support-global-kernel-command-line-fragment.patch new file mode 100644 index 00000000..6d077f19 --- /dev/null +++ b/common/recipes-bsp/systemd-boot/systemd-boot/0003-sd-boot-Support-global-kernel-command-line-fragment.patch | |||
@@ -0,0 +1,66 @@ | |||
1 | From a38be4fe8ffed142abbba92f7ad91a8f7b8f1ace Mon Sep 17 00:00:00 2001 | ||
2 | From: Jianxun Zhang <jianxun.zhang@linux.intel.com> | ||
3 | Date: Mon, 20 Jun 2016 13:08:20 -0700 | ||
4 | Subject: [PATCH 3/3] sd-boot: Support global kernel command line fragment | ||
5 | |||
6 | Query file blob KBOOTPARAM from RMC. If it exists, we append | ||
7 | it to the new linux boot entry's cmdline. A boot entry could | ||
8 | be read from a .conf file on ESP, RMC database, or embedded | ||
9 | linux image. content in KBOOTPARAM is effective in all of | ||
10 | these cases. | ||
11 | |||
12 | Upstream-Status: Pending | ||
13 | |||
14 | Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com> | ||
15 | --- | ||
16 | src/boot/efi/boot.c | 34 ++++++++++++++++++++++++++++++++++ | ||
17 | 1 file changed, 34 insertions(+) | ||
18 | |||
19 | diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c | ||
20 | index 43b0793..3dcd9a5 100644 | ||
21 | --- a/src/boot/efi/boot.c | ||
22 | +++ b/src/boot/efi/boot.c | ||
23 | @@ -847,6 +847,40 @@ static VOID config_add_entry(Config *config, ConfigEntry *entry) { | ||
24 | config->entries = ReallocatePool(config->entries, | ||
25 | sizeof(VOID *) * config->entry_count, sizeof(VOID *) * i); | ||
26 | } | ||
27 | + | ||
28 | + /* rmc: a linux entry could be added from .conf file or an embedded linux image | ||
29 | + * we put appending global command line here to cover both of two cases. | ||
30 | + */ | ||
31 | + if (entry->type == LOADER_LINUX && rmc_db && rmc_fp) { | ||
32 | + rmc_policy_file_t rmc_kp; | ||
33 | + | ||
34 | + if (!query_policy_from_db(rmc_fp, rmc_db, RMC_POLICY_BLOB, "KBOOTPARAM", &rmc_kp)) { | ||
35 | + CHAR8 *cmdline; | ||
36 | + CHAR16 *s; | ||
37 | + CHAR16 *t; | ||
38 | + CHAR16 *p; | ||
39 | + | ||
40 | + cmdline = AllocatePool(rmc_kp.blob_len * sizeof(CHAR8) + 1); | ||
41 | + CopyMem(cmdline, rmc_kp.blob, rmc_kp.blob_len); | ||
42 | + cmdline[rmc_kp.blob_len] = '\0'; | ||
43 | + p = stra_to_str(cmdline); | ||
44 | + t = p; | ||
45 | + | ||
46 | + while (*t) { | ||
47 | + if (*t == '\n') | ||
48 | + *t = '\0'; | ||
49 | + t++; | ||
50 | + } | ||
51 | + | ||
52 | + s = PoolPrint(L"%s %s", entry->options, p); | ||
53 | + FreePool(entry->options); | ||
54 | + FreePool(p); | ||
55 | + FreePool(cmdline); | ||
56 | + | ||
57 | + entry->options = s; | ||
58 | + } | ||
59 | + } | ||
60 | + | ||
61 | config->entries[config->entry_count++] = entry; | ||
62 | } | ||
63 | |||
64 | -- | ||
65 | 2.7.4 | ||
66 | |||