grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: "Vladimir 'phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: [PATCH] Enable cmos on x86 EFI
Date: Fri, 15 Mar 2024 22:35:07 +0300	[thread overview]
Message-ID: <CAEaD8JOE7S8sWk_wiXvaFQzNjXa4PnVUy9rGZD9GhcCAfn0T3Q@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]

CMOS actually exists on most EFI platforms and in some cases used to
store useful data that makes it useful for GRUB to read/write it

As for datetime keep using EFI API and not CMOS

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>

-- 
Regards
Vladimir 'phcoder' Serbinenko

[-- Attachment #2: 0001-Enable-cmos-on-x86-EFI.patch --]
[-- Type: application/octet-stream, Size: 2392 bytes --]

From b0d033319b60b9e00547124067f1f15348db6951 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sat, 16 Sep 2023 14:30:08 +0200
Subject: [PATCH] Enable cmos on x86 EFI

CMOS actually exists on most EFI platforms and in some cases used to
store useful data that makes it useful for GRUB to read/write it

As for datetime keep using EFI API and not CMOS

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 grub-core/Makefile.core.def        | 4 ++++
 grub-core/commands/i386/cmostest.c | 6 +++---
 include/grub/x86_64/cmos.h         | 1 +
 3 files changed, 8 insertions(+), 3 deletions(-)
 create mode 100644 include/grub/x86_64/cmos.h

diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 1571421d7..007ff628e 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -714,12 +714,16 @@ module = {
   name = cmostest;
   common = commands/i386/cmostest.c;
   enable = cmos;
+  enable = i386_efi;
+  enable = x86_64_efi;
 };
 
 module = {
   name = cmosdump;
   common = commands/i386/cmosdump.c;
   enable = cmos;
+  enable = i386_efi;
+  enable = x86_64_efi;
 };
 
 module = {
diff --git a/grub-core/commands/i386/cmostest.c b/grub-core/commands/i386/cmostest.c
index 9f6b56a2f..1f0c5341d 100644
--- a/grub-core/commands/i386/cmostest.c
+++ b/grub-core/commands/i386/cmostest.c
@@ -104,13 +104,13 @@ static grub_command_t cmd, cmd_clean, cmd_set;
 \f
 GRUB_MOD_INIT(cmostest)
 {
-  cmd = grub_register_command ("cmostest", grub_cmd_cmostest,
+  cmd = grub_register_command_lockdown ("cmostest", grub_cmd_cmostest,
 			       N_("BYTE:BIT"),
 			       N_("Test bit at BYTE:BIT in CMOS."));
-  cmd_clean = grub_register_command ("cmosclean", grub_cmd_cmosclean,
+  cmd_clean = grub_register_command_lockdown ("cmosclean", grub_cmd_cmosclean,
 				     N_("BYTE:BIT"),
 				     N_("Clear bit at BYTE:BIT in CMOS."));
-  cmd_set = grub_register_command ("cmosset", grub_cmd_cmosset,
+  cmd_set = grub_register_command_lockdown ("cmosset", grub_cmd_cmosset,
 				   N_("BYTE:BIT"),
 				   /* TRANSLATORS: A bit may be either set (1) or clear (0).  */
 				   N_("Set bit at BYTE:BIT in CMOS."));
diff --git a/include/grub/x86_64/cmos.h b/include/grub/x86_64/cmos.h
new file mode 100644
index 000000000..03722f805
--- /dev/null
+++ b/include/grub/x86_64/cmos.h
@@ -0,0 +1 @@
+#include <grub/i386/cmos.h>
-- 
2.39.2


[-- Attachment #3: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

             reply	other threads:[~2024-03-15 19:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-15 19:35 Vladimir 'phcoder' Serbinenko [this message]
2024-04-10 11:20 ` [PATCH] Enable cmos on x86 EFI Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEaD8JOE7S8sWk_wiXvaFQzNjXa4PnVUy9rGZD9GhcCAfn0T3Q@mail.gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).