diff options
author | Mikko Ylinen <mikko.ylinen@intel.com> | 2017-01-27 15:36:00 +0200 |
---|---|---|
committer | California Sullivan <california.l.sullivan@intel.com> | 2017-02-02 12:58:46 -0800 |
commit | 7fba4baa0ec6e5e02b1bd6da55dec2746a56b381 (patch) | |
tree | e90a5870dbb14e35568838987f6c89d3a63c0746 /common | |
parent | a020ceb2aedcabd9e0dcdf77ac0e9e58dbc7e551 (diff) | |
download | meta-intel-7fba4baa0ec6e5e02b1bd6da55dec2746a56b381.tar.gz |
systemd-boot: use RMC database in EFI stub
systemd-boot's EFI stub can be built in an EFI executable
with the kernel, cmdline, and initrd.
This commit enables the EFI stub code to use the RMC database
and appends the board specific cmdline (KBOOTPARAM) to the
built-in cmdline.
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch (renamed from common/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-Link-RMC-library-into-bootloader.patch) | 24 | ||||
-rw-r--r-- | common/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch | 81 | ||||
-rw-r--r-- | common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend | 3 |
3 files changed, 99 insertions, 9 deletions
diff --git a/common/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-Link-RMC-library-into-bootloader.patch b/common/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch index 626efce8..2f248e21 100644 --- a/common/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-Link-RMC-library-into-bootloader.patch +++ b/common/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch | |||
@@ -1,20 +1,19 @@ | |||
1 | From 1ccd031ce97501f8ee63f39e8794437d568115dc Mon Sep 17 00:00:00 2001 | 1 | From fe1c2fdfe81f2ac2b41fe8543ba07f1911770d26 Mon Sep 17 00:00:00 2001 |
2 | From: Jianxun Zhang <jianxun.zhang@linux.intel.com> | 2 | From: Jianxun Zhang <jianxun.zhang@linux.intel.com> |
3 | Date: Sat, 21 May 2016 18:52:07 -0700 | 3 | Date: Sat, 21 May 2016 18:52:07 -0700 |
4 | Subject: [PATCH 1/3] sd-boot: Link RMC library into bootloader | 4 | Subject: [PATCH] sd-boot: Link RMC library into bootloader and stub |
5 | 5 | ||
6 | Add RMC library into bootloader binary. EFI stub is not changed | 6 | Add RMC library into bootloader binary and stub. |
7 | until we really need rmc in stub. | ||
8 | 7 | ||
9 | Upstream-Status: Pending | 8 | Upstream-Status: Pending |
10 | 9 | ||
11 | Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com> | 10 | Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com> |
12 | --- | 11 | --- |
13 | Makefile.am | 2 +- | 12 | Makefile.am | 4 ++-- |
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | 13 | 1 file changed, 2 insertions(+), 2 deletions(-) |
15 | 14 | ||
16 | diff --git a/Makefile.am b/Makefile.am | 15 | diff --git a/Makefile.am b/Makefile.am |
17 | index 305099a..df176a5 100644 | 16 | index 305099ab6..9fb6f9b7b 100644 |
18 | --- a/Makefile.am | 17 | --- a/Makefile.am |
19 | +++ b/Makefile.am | 18 | +++ b/Makefile.am |
20 | @@ -2802,7 +2802,7 @@ $(top_builddir)/src/boot/efi/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(t | 19 | @@ -2802,7 +2802,7 @@ $(top_builddir)/src/boot/efi/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(t |
@@ -26,6 +25,15 @@ index 305099a..df176a5 100644 | |||
26 | nm -D -u $@ | grep ' U ' && exit 1 || : | 25 | nm -D -u $@ | grep ' U ' && exit 1 || : |
27 | 26 | ||
28 | $(systemd_boot): $(systemd_boot_solib) | 27 | $(systemd_boot): $(systemd_boot_solib) |
28 | @@ -2852,7 +2852,7 @@ $(top_builddir)/src/boot/efi/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(t | ||
29 | |||
30 | $(stub_solib): $(stub_objects) | ||
31 | $(AM_V_CCLD)$(LD) $(efi_ldflags) $(stub_objects) \ | ||
32 | - -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \ | ||
33 | + -o $@ -lefi -lgnuefi -lrmcefi $(shell $(CC) -print-libgcc-file-name); \ | ||
34 | nm -D -u $@ | grep ' U ' && exit 1 || : | ||
35 | |||
36 | $(stub): $(stub_solib) | ||
29 | -- | 37 | -- |
30 | 2.7.4 | 38 | 2.11.0 |
31 | 39 | ||
diff --git a/common/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch b/common/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch new file mode 100644 index 00000000..75082693 --- /dev/null +++ b/common/recipes-bsp/systemd-boot/systemd-boot/0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch | |||
@@ -0,0 +1,81 @@ | |||
1 | From 4cb9c65ea9c0eba3ba04d036dccd4a5ab3d2547b Mon Sep 17 00:00:00 2001 | ||
2 | From: Mikko Ylinen <mikko.ylinen@intel.com> | ||
3 | Date: Fri, 27 Jan 2017 13:31:45 +0200 | ||
4 | Subject: [PATCH] sd-boot: support global kernel command line in EFI stub | ||
5 | |||
6 | This change integrates rmc into EFI stub and supports a | ||
7 | global fragment (RMC KBOOTPARAM) that is appended to the | ||
8 | cmdline at boot. | ||
9 | |||
10 | The fragment is board-specific and read from the database. | ||
11 | |||
12 | Implements [YOCTO #10924]. | ||
13 | |||
14 | Upstream-status: Pending | ||
15 | |||
16 | Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com> | ||
17 | --- | ||
18 | src/boot/efi/stub.c | 33 +++++++++++++++++++++++++++++++++ | ||
19 | 1 file changed, 33 insertions(+) | ||
20 | |||
21 | diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c | ||
22 | index 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 | -- | ||
80 | 2.11.0 | ||
81 | |||
diff --git a/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend b/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend index 12c1e5ab..0db67b13 100644 --- a/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend +++ b/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend | |||
@@ -15,9 +15,10 @@ EXTRA_OEMAKE_append_intel-x86-common = ' EFI_LDFLAGS="-L${STAGING_DIR_HOST}/usr/ | |||
15 | SRCREV_intel-x86-common = "a1e2ef7ec912902d8142e7cb5830cbfb47dba86c" | 15 | SRCREV_intel-x86-common = "a1e2ef7ec912902d8142e7cb5830cbfb47dba86c" |
16 | 16 | ||
17 | SRC_URI_append_intel-x86-common = " \ | 17 | SRC_URI_append_intel-x86-common = " \ |
18 | file://0001-sd-boot-Link-RMC-library-into-bootloader.patch \ | 18 | file://0001-sd-boot-Link-RMC-library-into-bootloader-and-stub.patch \ |
19 | file://0002-sd-boot-Load-board-specific-boot-entries-from-RMC-da.patch \ | 19 | file://0002-sd-boot-Load-board-specific-boot-entries-from-RMC-da.patch \ |
20 | file://0003-sd-boot-Support-global-kernel-command-line-fragment.patch \ | 20 | file://0003-sd-boot-Support-global-kernel-command-line-fragment.patch \ |
21 | file://0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch \ | ||
21 | file://0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch \ | 22 | file://0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch \ |
22 | " | 23 | " |
23 | 24 | ||