]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
efi: Enable CMOS on x86 EFI platforms
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 15 Mar 2024 19:35:07 +0000 (22:35 +0300)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 11 Apr 2024 13:48:25 +0000 (15:48 +0200)
The CMOS actually exists on most EFI platforms and in some cases is used to
store useful data that makes it justifiable for GRUB to read/write it.

As for date and time keep using EFI API and not CMOS one.

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/Makefile.core.def
grub-core/commands/i386/cmostest.c
include/grub/x86_64/cmos.h [new file with mode: 0644]

index 1571421d7e84e6ef4279941ff2c5bba1ceedcefb..007ff628e911e65d24ce31db3521d8c66b7d1250 100644 (file)
@@ -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 = {
index 9f6b56a2f0c9babb7b914859553bae8212fab1a8..1f0c5341d4c76130c0f25d8cff345e33dddeb7f0 100644 (file)
@@ -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 (file)
index 0000000..03722f8
--- /dev/null
@@ -0,0 +1 @@
+#include <grub/i386/cmos.h>