summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLans Zhang <jia.zhang@windriver.com>2017-07-13 10:26:43 +0800
committerLans Zhang <jia.zhang@windriver.com>2017-07-13 10:26:43 +0800
commit3af3588ab2e2cf279294d58411d2f4226814080f (patch)
treec6a911c2919128056cd590dea9f46a5dcb2892f3
parentc071ce2d077d404ab58e22d0056652eca40a8f3e (diff)
downloadmeta-secure-core-3af3588ab2e2cf279294d58411d2f4226814080f.tar.gz
grub-efi: carry forward mok2verify to grub-2.02
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
-rw-r--r--meta-efi-secure-boot/recipes-bsp/grub/grub-efi/mok2verify-support-to-verify-non-PE-file-with-PKCS-7.patch226
-rw-r--r--meta-efi-secure-boot/recipes-bsp/grub/grub-efi_2.02.bbappend6
2 files changed, 156 insertions, 76 deletions
diff --git a/meta-efi-secure-boot/recipes-bsp/grub/grub-efi/mok2verify-support-to-verify-non-PE-file-with-PKCS-7.patch b/meta-efi-secure-boot/recipes-bsp/grub/grub-efi/mok2verify-support-to-verify-non-PE-file-with-PKCS-7.patch
index b5a0a52..a10b77f 100644
--- a/meta-efi-secure-boot/recipes-bsp/grub/grub-efi/mok2verify-support-to-verify-non-PE-file-with-PKCS-7.patch
+++ b/meta-efi-secure-boot/recipes-bsp/grub/grub-efi/mok2verify-support-to-verify-non-PE-file-with-PKCS-7.patch
@@ -1,6 +1,6 @@
1From 46873e2c5514bf6460a2f0f39ad8f8feb8f18f68 Mon Sep 17 00:00:00 2001 1From 00fd7457c9d907800587e93f87fc5b6de68ba49e Mon Sep 17 00:00:00 2001
2From: Lans Zhang <jia.zhang@windriver.com> 2From: Lans Zhang <jia.zhang@windriver.com>
3Date: Thu, 16 Mar 2017 14:49:41 +0800 3Date: Wed, 12 Jul 2017 16:02:13 +0800
4Subject: [PATCH] mok2verify: support to verify non-PE file with PKCS#7 4Subject: [PATCH] mok2verify: support to verify non-PE file with PKCS#7
5 signature 5 signature
6 6
@@ -27,22 +27,23 @@ Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
27--- 27---
28 grub-core/Makefile.core.def | 6 ++ 28 grub-core/Makefile.core.def | 6 ++
29 grub-core/commands/boot.c | 14 +++- 29 grub-core/commands/boot.c | 14 +++-
30 grub-core/gfxmenu/gui_label.c | 39 ++++++++-- 30 grub-core/gfxmenu/gui_label.c | 39 +++++++--
31 grub-core/lib/efi/mok2verify.c | 172 +++++++++++++++++++++++++++++++++++++++++ 31 grub-core/lib/efi/mok2verify.c | 182 +++++++++++++++++++++++++++++++++++++++++
32 grub-core/loader/i386/linux.c | 80 +++++++++++++++++++ 32 grub-core/loader/i386/linux.c | 60 ++++++++++++++
33 grub-core/normal/main.c | 55 ++++++++++++- 33 grub-core/loader/linux.c | 27 +++++-
34 grub-core/normal/menu.c | 29 +++++-- 34 grub-core/normal/main.c | 62 +++++++++++++-
35 grub-core/normal/menu_text.c | 32 ++++++-- 35 grub-core/normal/menu.c | 31 +++++--
36 include/grub/efi/mok2verify.h | 48 ++++++++++++ 36 grub-core/normal/menu_text.c | 33 ++++++--
37 9 files changed, 447 insertions(+), 28 deletions(-) 37 include/grub/efi/mok2verify.h | 48 +++++++++++
38 10 files changed, 472 insertions(+), 30 deletions(-)
38 create mode 100644 grub-core/lib/efi/mok2verify.c 39 create mode 100644 grub-core/lib/efi/mok2verify.c
39 create mode 100644 include/grub/efi/mok2verify.h 40 create mode 100644 include/grub/efi/mok2verify.h
40 41
41diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def 42diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
42index e9e1483..8e72251 100644 43index a82c1f3..76b3c7d 100644
43--- a/grub-core/Makefile.core.def 44--- a/grub-core/Makefile.core.def
44+++ b/grub-core/Makefile.core.def 45+++ b/grub-core/Makefile.core.def
45@@ -1434,6 +1434,12 @@ module = { 46@@ -1754,6 +1754,12 @@ module = {
46 }; 47 };
47 48
48 module = { 49 module = {
@@ -56,7 +57,7 @@ index e9e1483..8e72251 100644
56 common = mmap/mmap.c; 57 common = mmap/mmap.c;
57 x86 = mmap/i386/uppermem.c; 58 x86 = mmap/i386/uppermem.c;
58diff --git a/grub-core/commands/boot.c b/grub-core/commands/boot.c 59diff --git a/grub-core/commands/boot.c b/grub-core/commands/boot.c
59index 91ec87d..5cddbb6 100644 60index bbca81e..3f44a7e 100644
60--- a/grub-core/commands/boot.c 61--- a/grub-core/commands/boot.c
61+++ b/grub-core/commands/boot.c 62+++ b/grub-core/commands/boot.c
62@@ -24,6 +24,9 @@ 63@@ -24,6 +24,9 @@
@@ -82,26 +83,26 @@ index 91ec87d..5cddbb6 100644
82+ N_("you need to load the authenticated boot components")); 83+ N_("you need to load the authenticated boot components"));
83+#endif 84+#endif
84+ return grub_error (GRUB_ERR_NO_KERNEL, 85+ return grub_error (GRUB_ERR_NO_KERNEL,
85+ N_("you need to load the kernel first")); 86+ N_("you need to load the kernel first"));
86+ } 87+ }
87 88
88 if (grub_loader_flags & GRUB_LOADER_FLAG_NORETURN) 89 grub_machine_fini (grub_loader_flags);
89 grub_machine_fini (); 90
90diff --git a/grub-core/gfxmenu/gui_label.c b/grub-core/gfxmenu/gui_label.c 91diff --git a/grub-core/gfxmenu/gui_label.c b/grub-core/gfxmenu/gui_label.c
91index 637578f..84bf7d4 100644 92index a4c8178..da49c9e 100644
92--- a/grub-core/gfxmenu/gui_label.c 93--- a/grub-core/gfxmenu/gui_label.c
93+++ b/grub-core/gfxmenu/gui_label.c 94+++ b/grub-core/gfxmenu/gui_label.c
94@@ -23,6 +23,9 @@ 95@@ -24,6 +24,9 @@
95 #include <grub/font.h>
96 #include <grub/gui_string_util.h> 96 #include <grub/gui_string_util.h>
97 #include <grub/i18n.h> 97 #include <grub/i18n.h>
98 #include <grub/color.h>
98+#ifdef GRUB_MACHINE_EFI 99+#ifdef GRUB_MACHINE_EFI
99+#include <grub/efi/mok2verify.h> 100+#include <grub/efi/mok2verify.h>
100+#endif 101+#endif
101 102
102 static const char *align_options[] = 103 static const char *align_options[] =
103 { 104 {
104@@ -180,15 +183,37 @@ label_set_property (void *vself, const char *name, const char *value) 105@@ -183,15 +186,37 @@ label_set_property (void *vself, const char *name, const char *value)
105 else 106 else
106 { 107 {
107 if (grub_strcmp (value, "@KEYMAP_LONG@") == 0) 108 if (grub_strcmp (value, "@KEYMAP_LONG@") == 0)
@@ -148,10 +149,10 @@ index 637578f..84bf7d4 100644
148 self->text = grub_xasprintf (value, self->value); 149 self->text = grub_xasprintf (value, self->value);
149diff --git a/grub-core/lib/efi/mok2verify.c b/grub-core/lib/efi/mok2verify.c 150diff --git a/grub-core/lib/efi/mok2verify.c b/grub-core/lib/efi/mok2verify.c
150new file mode 100644 151new file mode 100644
151index 0000000..2e48ef9 152index 0000000..3865661
152--- /dev/null 153--- /dev/null
153+++ b/grub-core/lib/efi/mok2verify.c 154+++ b/grub-core/lib/efi/mok2verify.c
154@@ -0,0 +1,172 @@ 155@@ -0,0 +1,182 @@
155+/* mok2verify.c - MOK2 Verify Protocol support 156+/* mok2verify.c - MOK2 Verify Protocol support
156+ * 157+ *
157+ * BSD 2-clause "Simplified" License 158+ * BSD 2-clause "Simplified" License
@@ -195,10 +196,8 @@ index 0000000..2e48ef9
195+ 196+
196+GRUB_MOD_LICENSE ("GPLv2+"); 197+GRUB_MOD_LICENSE ("GPLv2+");
197+ 198+
198+#define EFI_MOK2_VERIFY_PROTOCOL_GUID \ 199+#define EFI_MOK2_VERIFY_PROTOCOL_GUID \
199+ { 0x4eda73ad, 0x07aa, 0x4b7a, \ 200+ { 0x4eda73ad, 0x07aa, 0x4b7a, { 0xa1, 0x91, 0xd4, 0xd4, 0x10, 0xfb, 0x8c, 0xb4 }}
200+ { 0xa1, 0x91, 0xd4, 0xd4, 0x10, 0xfb, 0x8c, 0xb4 } \
201+ }
202+ 201+
203+typedef struct efi_mok2_verify_protocol efi_mok2_verify_protocol_t; 202+typedef struct efi_mok2_verify_protocol efi_mok2_verify_protocol_t;
204+ 203+
@@ -229,19 +228,27 @@ index 0000000..2e48ef9
229+int 228+int
230+grub_is_secured (void) 229+grub_is_secured (void)
231+{ 230+{
232+ grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID; 231+ grub_efi_guid_t global_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
233+ void *efi_var; 232+ void *var;
234+ grub_size_t efi_var_size = 0; 233+ grub_size_t var_size = 0;
235+ int secured = 0; 234+ int secured = 0;
236+ 235+
237+ efi_var = grub_efi_get_variable ("SecureBoot", &global, &efi_var_size); 236+ var = grub_efi_get_variable ("SecureBoot", &global_guid, &var_size);
238+ if (!efi_var) 237+ if (!var)
239+ return grub_error (GRUB_ERR_READ_ERROR, N_("cannot read variable")); 238+ return grub_error (GRUB_ERR_READ_ERROR, N_("cannot read variable"));
240+ 239+
241+ if (efi_var_size == 1 && *(grub_uint8_t *) efi_var == 1) 240+ if (var_size != 1 || *(grub_uint8_t *) var != 1)
241+ goto out;
242+
243+ grub_free (var);
244+
245+ var = grub_efi_get_variable ("MokSBState", &grub_efi_mok2_verify_protoco_guid,
246+ &var_size);
247+ if (!var || (var_size == 1 && *(grub_uint8_t *) var == 0))
242+ secured = 1; 248+ secured = 1;
243+ 249+
244+ grub_free (efi_var); 250+out:
251+ grub_free (var);
245+ 252+
246+ return secured; 253+ return secured;
247+} 254+}
@@ -258,6 +265,8 @@ index 0000000..2e48ef9
258+ return ! grub_is_unlockable () && grub_is_secured (); 265+ return ! grub_is_unlockable () && grub_is_secured ();
259+} 266+}
260+ 267+
268+#pragma GCC diagnostic ignored "-Wvla"
269+
261+grub_err_t 270+grub_err_t
262+grub_verify_file (const char *path) 271+grub_verify_file (const char *path)
263+{ 272+{
@@ -324,21 +333,23 @@ index 0000000..2e48ef9
324+ 333+
325+ return GRUB_ERR_NONE; 334+ return GRUB_ERR_NONE;
326+} 335+}
336+
337+#pragma GCC diagnostic error "-Wvla"
327diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c 338diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
328index e2425c8..5a12444 100644 339index 083f941..486e420 100644
329--- a/grub-core/loader/i386/linux.c 340--- a/grub-core/loader/i386/linux.c
330+++ b/grub-core/loader/i386/linux.c 341+++ b/grub-core/loader/i386/linux.c
331@@ -34,6 +34,9 @@ 342@@ -35,6 +35,9 @@
332 #include <grub/i386/relocator.h>
333 #include <grub/i18n.h> 343 #include <grub/i18n.h>
334 #include <grub/lib/cmdline.h> 344 #include <grub/lib/cmdline.h>
345 #include <grub/linux.h>
335+#ifdef GRUB_MACHINE_EFI 346+#ifdef GRUB_MACHINE_EFI
336+#include <grub/efi/mok2verify.h> 347+#include <grub/efi/mok2verify.h>
337+#endif 348+#endif
338 349
339 GRUB_MOD_LICENSE ("GPLv3+"); 350 GRUB_MOD_LICENSE ("GPLv3+");
340 351
341@@ -664,6 +667,55 @@ grub_linux_unload (void) 352@@ -673,6 +676,55 @@ grub_linux_unload (void)
342 return GRUB_ERR_NONE; 353 return GRUB_ERR_NONE;
343 } 354 }
344 355
@@ -394,7 +405,7 @@ index e2425c8..5a12444 100644
394 static grub_err_t 405 static grub_err_t
395 grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), 406 grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
396 int argc, char *argv[]) 407 int argc, char *argv[])
397@@ -687,6 +739,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), 408@@ -695,6 +747,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
398 goto fail; 409 goto fail;
399 } 410 }
400 411
@@ -404,9 +415,43 @@ index e2425c8..5a12444 100644
404 file = grub_file_open (argv[0]); 415 file = grub_file_open (argv[0]);
405 if (! file) 416 if (! file)
406 goto fail; 417 goto fail;
407@@ -1132,6 +1187,26 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), 418@@ -1132,6 +1187,11 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
408 argv[i]); 419 fail:
409 goto fail; 420 grub_initrd_close (&initrd_ctx);
421
422+#ifdef GRUB_MACHINE_EFI
423+ /* An unauthenticated initrd always causes a complete boot failure. */
424+ if (grub_is_secured () == 1 && grub_errno != GRUB_ERR_NONE)
425+ grub_loader_unset();
426+#endif
427 return grub_errno;
428 }
429
430diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c
431index be6fa0f..edc6d24 100644
432--- a/grub-core/loader/linux.c
433+++ b/grub-core/loader/linux.c
434@@ -4,6 +4,9 @@
435 #include <grub/misc.h>
436 #include <grub/file.h>
437 #include <grub/mm.h>
438+#ifdef GRUB_MACHINE_EFI
439+#include <grub/efi/mok2verify.h>
440+#endif
441
442 struct newc_head
443 {
444@@ -253,6 +256,7 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
445 int newc = 0;
446 struct dir *root = 0;
447 grub_ssize_t cursize = 0;
448+ grub_err_t err;
449
450 for (i = 0; i < initrd_ctx->nfiles; i++)
451 {
452@@ -288,6 +292,25 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
453 grub_initrd_close (initrd_ctx);
454 return grub_errno;
410 } 455 }
411+ 456+
412+#ifdef GRUB_MACHINE_EFI 457+#ifdef GRUB_MACHINE_EFI
@@ -427,40 +472,55 @@ index e2425c8..5a12444 100644
427+ goto fail; 472+ goto fail;
428+ } 473+ }
429+#endif 474+#endif
430+
431 ptr += cursize; 475 ptr += cursize;
432 grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4)); 476 }
477 if (newc)
478@@ -296,7 +319,9 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
433 ptr += ALIGN_UP_OVERHEAD (cursize, 4); 479 ptr += ALIGN_UP_OVERHEAD (cursize, 4);
434@@ -1149,6 +1224,11 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), 480 ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1, 0, 0);
435 grub_file_close (files[i]); 481 }
436 grub_free (files); 482+
437 483+fail:
438+#ifdef GRUB_MACHINE_EFI 484 free_dir (root);
439+ /* An unauthenticated initrd always causes a complete boot failure. */ 485 root = 0;
440+ if (grub_is_secured () == 1 && grub_errno != GRUB_ERR_NONE) 486- return GRUB_ERR_NONE;
441+ grub_loader_unset(); 487+ return err;
442+#endif
443 return grub_errno;
444 } 488 }
445
446diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c 489diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
447index 13473ec..f11ce2a 100644 490index 78a70a8..1058c97 100644
448--- a/grub-core/normal/main.c 491--- a/grub-core/normal/main.c
449+++ b/grub-core/normal/main.c 492+++ b/grub-core/normal/main.c
450@@ -32,6 +32,9 @@ 493@@ -33,6 +33,9 @@
451 #include <grub/i18n.h>
452 #include <grub/charset.h> 494 #include <grub/charset.h>
453 #include <grub/script_sh.h> 495 #include <grub/script_sh.h>
496 #include <grub/bufio.h>
454+#ifdef GRUB_MACHINE_EFI 497+#ifdef GRUB_MACHINE_EFI
455+#include <grub/efi/mok2verify.h> 498+#include <grub/efi/mok2verify.h>
456+#endif 499+#endif
457 500
458 GRUB_MOD_LICENSE ("GPLv3+"); 501 GRUB_MOD_LICENSE ("GPLv3+");
459 502
460@@ -233,6 +236,16 @@ grub_normal_init_page (struct grub_term_output *term) 503@@ -195,6 +198,8 @@ read_config_file (const char *config)
504 return newmenu;
505 }
506
507+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
508+
509 /* Initialize the screen. */
510 void
511 grub_normal_init_page (struct grub_term_output *term,
512@@ -202,13 +207,24 @@ grub_normal_init_page (struct grub_term_output *term,
513 {
514 grub_ssize_t msg_len;
515 int posx;
516+ const char *msg = _("GNU GRUB version %s");
517 char *msg_formatted;
518 grub_uint32_t *unicode_msg;
519 grub_uint32_t *last_position;
461 520
462 grub_term_cls (term); 521 grub_term_cls (term);
463 522
523- msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION);
464+#ifdef GRUB_MACHINE_EFI 524+#ifdef GRUB_MACHINE_EFI
465+ if (grub_is_secured () == 1) 525+ if (grub_is_secured () == 1)
466+ { 526+ {
@@ -471,10 +531,20 @@ index 13473ec..f11ce2a 100644
471+ } 531+ }
472+#endif 532+#endif
473+ 533+
474 msg_formatted = grub_xasprintf (msg, PACKAGE_VERSION); 534+ msg_formatted = grub_xasprintf (msg, PACKAGE_VERSION);
475 if (!msg_formatted) 535 if (!msg_formatted)
476 return; 536 return;
477@@ -294,6 +307,24 @@ grub_normal_execute (const char *config, int nested, int batch) 537
538@@ -233,6 +249,8 @@ grub_normal_init_page (struct grub_term_output *term,
539 grub_free (unicode_msg);
540 }
541
542+#pragma GCC diagnostic error "-Wformat-nonliteral"
543+
544 static void
545 read_lists (const char *val)
546 {
547@@ -273,6 +291,24 @@ grub_normal_execute (const char *config, int nested, int batch)
478 548
479 if (config) 549 if (config)
480 { 550 {
@@ -499,19 +569,19 @@ index 13473ec..f11ce2a 100644
499 menu = read_config_file (config); 569 menu = read_config_file (config);
500 570
501 /* Ignore any error. */ 571 /* Ignore any error. */
502@@ -317,7 +348,10 @@ grub_enter_normal_mode (const char *config) 572@@ -302,7 +338,10 @@ grub_enter_normal_mode (const char *config)
503 {
504 nested_level++; 573 nested_level++;
505 grub_normal_execute (config, 0, 0); 574 grub_normal_execute (config, 0, 0);
506- grub_cmdline_run (0); 575 grub_boot_time ("Entering shell");
576- grub_cmdline_run (0, 1);
507+#ifdef GRUB_MACHINE_EFI 577+#ifdef GRUB_MACHINE_EFI
508+ if (grub_is_locked () == 0) 578+ if (grub_is_locked () == 0)
509+#endif 579+#endif
510+ grub_cmdline_run (0); 580+ grub_cmdline_run (0, 1);
511 nested_level--; 581 nested_level--;
512 if (grub_normal_exit_level) 582 if (grub_normal_exit_level)
513 grub_normal_exit_level--; 583 grub_normal_exit_level--;
514@@ -352,6 +386,18 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), 584@@ -338,6 +377,18 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
515 grub_enter_normal_mode (argv[0]); 585 grub_enter_normal_mode (argv[0]);
516 586
517 quit: 587 quit:
@@ -530,7 +600,7 @@ index 13473ec..f11ce2a 100644
530 return 0; 600 return 0;
531 } 601 }
532 602
533@@ -527,8 +573,11 @@ GRUB_MOD_INIT(normal) 603@@ -525,8 +576,11 @@ GRUB_MOD_INIT(normal)
534 /* Register a command "normal" for the rescue mode. */ 604 /* Register a command "normal" for the rescue mode. */
535 grub_register_command ("normal", grub_cmd_normal, 605 grub_register_command ("normal", grub_cmd_normal,
536 0, N_("Enter normal mode.")); 606 0, N_("Enter normal mode."));
@@ -545,7 +615,7 @@ index 13473ec..f11ce2a 100644
545 /* Reload terminal colors when these variables are written to. */ 615 /* Reload terminal colors when these variables are written to. */
546 grub_register_variable_hook ("color_normal", NULL, grub_env_write_color_normal); 616 grub_register_variable_hook ("color_normal", NULL, grub_env_write_color_normal);
547diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c 617diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
548index 7e0a158..5ed9670 100644 618index 719e2fb..0665abc 100644
549--- a/grub-core/normal/menu.c 619--- a/grub-core/normal/menu.c
550+++ b/grub-core/normal/menu.c 620+++ b/grub-core/normal/menu.c
551@@ -32,6 +32,9 @@ 621@@ -32,6 +32,9 @@
@@ -558,21 +628,22 @@ index 7e0a158..5ed9670 100644
558 628
559 /* Time to delay after displaying an error message about a default/fallback 629 /* Time to delay after displaying an error message about a default/fallback
560 entry failing to boot. */ 630 entry failing to boot. */
561@@ -633,18 +636,28 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) 631@@ -772,18 +775,30 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
562 break; 632 break;
563 633
564 case 'c': 634 case 'c':
565- menu_fini (); 635- menu_fini ();
566- grub_cmdline_run (1); 636- grub_cmdline_run (1, 0);
567- goto refresh; 637- goto refresh;
568+#ifdef GRUB_MACHINE_EFI 638+#ifdef GRUB_MACHINE_EFI
569+ if (grub_is_locked () == 0) 639+ if (grub_is_locked () == 0)
570+#endif 640+#endif
571+ { 641+ {
572+ menu_fini (); 642+ menu_fini ();
573+ grub_cmdline_run (1); 643+ grub_cmdline_run (1, 0);
574+ goto refresh; 644+ goto refresh;
575+ } 645+ }
646+ break;
576 647
577 case 'e': 648 case 'e':
578- menu_fini (); 649- menu_fini ();
@@ -592,11 +663,12 @@ index 7e0a158..5ed9670 100644
592+ goto refresh; 663+ goto refresh;
593 } 664 }
594- goto refresh; 665- goto refresh;
666+ break;
595 667
596 default: 668 default:
597 { 669 {
598diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c 670diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
599index 1687c28..6e4fbfb 100644 671index e22bb91..28c675f 100644
600--- a/grub-core/normal/menu_text.c 672--- a/grub-core/normal/menu_text.c
601+++ b/grub-core/normal/menu_text.c 673+++ b/grub-core/normal/menu_text.c
602@@ -27,6 +27,9 @@ 674@@ -27,6 +27,9 @@
@@ -609,7 +681,15 @@ index 1687c28..6e4fbfb 100644
609 681
610 static grub_uint8_t grub_color_menu_normal; 682 static grub_uint8_t grub_color_menu_normal;
611 static grub_uint8_t grub_color_menu_highlight; 683 static grub_uint8_t grub_color_menu_highlight;
612@@ -179,19 +182,32 @@ command-line or ESC to discard edits and return to the GRUB menu."), 684@@ -165,6 +168,7 @@ command-line or ESC to discard edits and return to the GRUB menu."),
685 }
686 else
687 {
688+ const char *msg;
689 char *msg_translated;
690
691 msg_translated = grub_xasprintf (_("Use the %C and %C keys to select which "
692@@ -180,19 +184,32 @@ command-line or ESC to discard edits and return to the GRUB menu."),
613 693
614 if (nested) 694 if (nested)
615 { 695 {
@@ -705,5 +785,5 @@ index 0000000..98ef2d4
705+ 785+
706+#endif /* ! GRUB_EFI_MOK2_VERIFY_HEADER */ 786+#endif /* ! GRUB_EFI_MOK2_VERIFY_HEADER */
707-- 787--
7082.7.4 7882.7.5
709 789
diff --git a/meta-efi-secure-boot/recipes-bsp/grub/grub-efi_2.02.bbappend b/meta-efi-secure-boot/recipes-bsp/grub/grub-efi_2.02.bbappend
index 338c5d9..6a86f96 100644
--- a/meta-efi-secure-boot/recipes-bsp/grub/grub-efi_2.02.bbappend
+++ b/meta-efi-secure-boot/recipes-bsp/grub/grub-efi_2.02.bbappend
@@ -17,7 +17,7 @@ SRC_URI += "\
17 file://chainloader-Actually-find-the-relocations-correctly-.patch \ 17 file://chainloader-Actually-find-the-relocations-correctly-.patch \
18 file://efi-chainloader-implemented-for-32-bit.patch \ 18 file://efi-chainloader-implemented-for-32-bit.patch \
19 file://Grub-get-and-set-efi-variables.patch \ 19 file://Grub-get-and-set-efi-variables.patch \
20 file://mok2verify-support-to-verify-non-PE-file-with-PKCS-7.patch;apply=0 \ 20 file://mok2verify-support-to-verify-non-PE-file-with-PKCS-7.patch \
21 file://grub-efi.cfg \ 21 file://grub-efi.cfg \
22 file://boot-menu.inc \ 22 file://boot-menu.inc \
23 ${EXTRA_SRC_URI} \ 23 ${EXTRA_SRC_URI} \
@@ -25,8 +25,8 @@ SRC_URI += "\
25 25
26EFI_BOOT_PATH = "/boot/efi/EFI/BOOT" 26EFI_BOOT_PATH = "/boot/efi/EFI/BOOT"
27 27
28# TODO: re-add mok2verify when refreshed 28GRUB_BUILDIN_append += " chain ${@'efivar mok2verify password_pbkdf2' \
29GRUB_BUILDIN_append += " chain ${@'efivar password_pbkdf2' if d.getVar('UEFI_SB', True) == '1' else ''}" 29 if d.getVar('UEFI_SB', True) == '1' else ''}"
30 30
31# For efi_call_foo and efi_shim_exit 31# For efi_call_foo and efi_shim_exit
32CFLAGS_append = " -fno-toplevel-reorder" 32CFLAGS_append = " -fno-toplevel-reorder"