PATCH: added GRUB command to get and set (U)EFI firmware variables
Hello everyone,
This patch adds two GRUB two commands to allow the user to get and set the values of (U)EFI firmware variables. When dealing with (U)EFI firmware with GRUB I decided this would be a useful tool to have for both developers and end-users.
The first command, setefivariable, takes two parameters: the name of the variable to set and its value. The second, getefivariable, also takes two parameters: the name of the variable to retrieve and the name of the GRUB environment variable in which you want to store the result. This can then be checked using GRUB's built in 'if' statement and scripting capability to allow unique booting capabilities based on whether, for example, secure boot is enabled or the (U)EFI firmware is in setup mode.
Have a look and let me know what you think! The patch follows.
-- SevenBits
(quoted diff) +0 -0
b/grub-orig/grub-core/Makefile.core.def
index 177d6d6..5cd84b1 100644
grub-orig/grub-core/Makefile.core.def renamed from grub/grub-core/Makefile.core.def +0 -7
@@ -1004,13 +1004,6 @@ module = { }; module = { - name = setvariable; - common = commands/efi/setvariable.c; - enable = i386_efi; - enable = x86_64_efi; -}; - -module = { name = pcidump; common = commands/pcidump.c; enable = pci;
(quoted diff) +0 -0
b/grub/grub-core/commands/efi/setvariable.c
deleted file mode 100644
index b0d0967..0000000
grub/grub-core/commands/efi/setvariable.c deleted +0 -37
@@ -1,96 +0,0 @@ -/* setvariable.c - get and set efi firmware variables */ -/* -* GRUB -- GRand Unified Bootloader -* Copyright (C) 2013 Free Software Foundation, Inc. -* -* GRUB is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GRUB is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GRUB. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <grub/env.h> -#include <grub/dl.h> -#include <grub/misc.h> -#include <grub/file.h> -#include <grub/efi/efi.h> -#include <grub/pci.h> -#include <grub/command.h> -#include <grub/i18n.h> - -GRUB_MOD_LICENSE ("GPLv3+" ); - -static grub_err_t -grub_cmd_setefivariable (grub_command_t cmd __attribute__ ((unused)), -int argc,char *argv[]) -{ -grub_efi_guid_t global =GRUB_EFI_GLOBAL_VARIABLE_GUID ; -if (argc ==0 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable name
expected"));
- else if (argc == 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable name
value expected"));
-
- grub_err_t status;
- grub_size_t arg_size = (grub_strlen(argv[1]) + 1) * sizeof(char);
-
- status = grub_efi_set_variable (argv[0], &global, argv[1], arg_size);
- if (status != GRUB_ERR_NONE)
- {- grub_printf ("couldn't set efi variable");
- return status;
- }
- return 0;
-}
-
-static grub_err_t
-grub_cmd_getefivariable (grub_command_t cmd __attribute__ ((unused)),
- int argc, char *argv[])
-{
- grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
- if (argc == 0)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable name
expected"));
- else if (argc == 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable name
value expected"));
-
- grub_size_t var_size;
- grub_err_t status;
- char *value = (char*)grub_efi_get_variable (argv[0], &global,
&var_size);
- status = grub_env_set (argv[1], value);
- if (status != GRUB_ERR_NONE)
- {- grub_printf ("couldn't set environment variable");
- return status;
- }
- return 0;
-}
-
-static grub_command_t cmd_setefivariable, cmd_getefivariable; -
-GRUB_MOD_INIT(loadbios)
-{
- cmd_setefivariable = grub_register_command ("setefivariable", grub_cmd_setefivariable,
- N_("NAME VALUE"),
- N_("Set an EFI firmware variable "
- "which can be stored and retrieved "
- "from between sessions."));
-
- cmd_getefivariable = grub_register_command ("getefivariable", grub_cmd_getefivariable,
- N_("NAME ENV_VARIABLE"),
- N_("Gets an EFI firmware variable "
- "and stores it as a GRUB environment "
- "variable named ENV_VARIABLE."));
-}
-
-GRUB_MOD_FINI(loadbios)
-{
- grub_unregister_command (cmd_setefivariable);
- grub_unregister_command (cmd_getefivariable);
-}
please resend as proper and not as reverse patch. Anotjer issie that can be seen from description alone is that you don't allow to specify vendor uuid. it would be needed and slso it needs readable aliases for known types
Quoted 154 lines · SevenBits
Hello everyone,
This patch adds two GRUB two commands to allow the user to get and set the values of (U)EFI firmware variables. When dealing with (U)EFI firmware with GRUB I decided this would be a useful tool to have for both developers and end-users.
The first command, setefivariable, takes two parameters: the name of the variable to set and its value. The second, getefivariable, also takes two parameters: the name of the variable to retrieve and the name of the GRUB environment variable in which you want to store the result. This can then be checked using GRUB's built in 'if' statement and scripting capability to allow unique booting capabilities based on whether, for example, secure boot is enabled or the (U)EFI firmware is in setup mode.
Have a look and let me know what you think! The patch follows.
-- SevenBits
grub-orig/grub-core/Makefile.core.def renamed from grub/grub-core/Makefile.core.def +0
-7@@ -1004,13 +1004,6 @@ module = { }; module = { - name = setvariable; - common = commands/efi/setvariable.c; - enable = i386_efi; - enable = x86_64_efi; -}; - -module = { name = pcidump; common = commands/pcidump.c; enable = pci;grub/grub-core/commands/efi/setvariable.c deleted +0
-37@@ -1,96 +0,0 @@ -/* setvariable.c - get and set efi firmware variables */ -/* -* GRUB -- GRand Unified Bootloader -* Copyright (C) 2013 Free Software Foundation, Inc. -* -* GRUB is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GRUB is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GRUB. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <grub/env.h> -#include <grub/dl.h> -#include <grub/misc.h> -#include <grub/file.h> -#include <grub/efi/efi.h> -#include <grub/pci.h> -#include <grub/command.h> -#include <grub/i18n.h> - -GRUB_MOD_LICENSE ("GPLv3+" ); - -static grub_err_t -grub_cmd_setefivariable (grub_command_t cmd __attribute__ ((unused)), -int argc,char *argv[]) -{ -grub_efi_guid_t global =GRUB_EFI_GLOBAL_VARIABLE_GUID ; -if (argc ==0 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable nameexpected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-2-else if (argc ==1 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable namevalue expected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-20- -grub_err_t status; -grub_size_t arg_size = (grub_strlen (argv[1 ]) +1 ) *sizeof (char ); - - status =grub_efi_set_variable (argv[0 ], &global, argv[1 ], arg_size); -if (status !=GRUB_ERR_NONE ) - { -grub_printf ("couldn't set efi variable" ); -return status; - } -return 0 ; -} - -static grub_err_t -grub_cmd_getefivariable (grub_command_t cmd __attribute__ ((unused)), -int argc,char *argv[]) -{ -grub_efi_guid_t global =GRUB_EFI_GLOBAL_VARIABLE_GUID ; -if (argc ==0 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable nameexpected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-2-else if (argc ==1 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable namevalue expected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-4- -grub_size_t var_size; -grub_err_t status; - char *value = (char*)grub_efi_get_variable (argv[0], &global,
&var_size);grub/grub-core/commands/efi/setvariable.c deleted +0
-14- status =grub_env_set (argv[1 ], value); -if (status !=GRUB_ERR_NONE ) - { -grub_printf ("couldn't set environment variable" ); -return status; - } -return 0 ; -} - -static grub_command_t cmd_setefivariable, cmd_getefivariable; - -GRUB_MOD_INIT (loadbios) -{ - cmd_setefivariable = grub_register_command ("setefivariable",
grub_cmd_setefivariable,grub/grub-core/commands/efi/setvariable.c deleted +0
-6-N_ ("NAME VALUE" ), -N_ ("Set an EFI firmware variable " -"which can be stored and retrieved " - "from between sessions.")); - - cmd_getefivariable = grub_register_command ("getefivariable",
grub_cmd_getefivariable,grub/grub-core/commands/efi/setvariable.c deleted +0
-11-N_ ("NAME ENV_VARIABLE" ), -N_ ("Gets an EFI firmware variable " -"and stores it as a GRUB environment " - "variable named ENV_VARIABLE.")); -} - -GRUB_MOD_FINI (loadbios) -{ -grub_unregister_command (cmd_setefivariable); -grub_unregister_command (cmd_getefivariable); -}_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Thanks for your quick reply.
I just have a couple of questions. How do you prefer I allow the user to specify the vendor UUID? By typing it in via the keyboard? And secondly, by saying it needs "readable aliases for known types" do you mean that there should be a function to set an integer, one to set a boolean, etc?
Regarding the patch format, I'll tidy that up and send a proper one.
- -- SevenBits
Quoted 2 lines · Vladimir 'phcoder' Serbinenko
please resend as proper and not as reverse patch. Anotjer issie that can be seen from description alone is that you don't allow to specify vendor
uuid.
Quoted 86 lines
it would be needed and slso it needs readable aliases for known types
Quoted 83 lines · SevenBits
Hello everyone,
This patch adds two GRUB two commands to allow the user to get and set the values of (U)EFI firmware variables. When dealing with (U)EFI firmware with GRUB I decided this would be a useful tool to have for both developers and end-users.
The first command, setefivariable, takes two parameters: the name of the variable to set and its value. The second, getefivariable, also takes two parameters: the name of the variable to retrieve and the name of the GRUB environment variable in which you want to store the result. This can then be checked using GRUB's built in 'if' statement and scripting capability to allow unique booting capabilities based on whether, for example, secure boot is enabled or the (U)EFI firmware is in setup mode.
Have a look and let me know what you think! The patch follows.
-- SevenBits
grub-orig/grub-core/Makefile.core.def renamed from grub/grub-core/Makefile.core.def +0
-7@@ -1004,13 +1004,6 @@ module = { }; module = { - name = setvariable; - common = commands/efi/setvariable.c; - enable = i386_efi; - enable = x86_64_efi; -}; - -module = { name = pcidump; common = commands/pcidump.c; enable = pci;grub/grub-core/commands/efi/setvariable.c deleted +0
-37@@ -1,96 +0,0 @@ -/* setvariable.c - get and set efi firmware variables */ -/* -* GRUB -- GRand Unified Bootloader -* Copyright (C) 2013 Free Software Foundation, Inc. -* -* GRUB is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GRUB is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GRUB. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <grub/env.h> -#include <grub/dl.h> -#include <grub/misc.h> -#include <grub/file.h> -#include <grub/efi/efi.h> -#include <grub/pci.h> -#include <grub/command.h> -#include <grub/i18n.h> - -GRUB_MOD_LICENSE ("GPLv3+" ); - -static grub_err_t -grub_cmd_setefivariable (grub_command_t cmd __attribute__ ((unused)), -int argc,char *argv[]) -{ -grub_efi_guid_t global =GRUB_EFI_GLOBAL_VARIABLE_GUID ; -if (argc ==0 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable nameexpected"));
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c deleted +0
-2-else if (argc ==1 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable namevalue expected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-5- -grub_err_t status; -grub_size_t arg_size = (grub_strlen (argv[1 ]) +1 ) *sizeof (char ); - - status = grub_efi_set_variable (argv[0], &global, argv[1],
arg_size);
Quoted 58 lines
Quoted 58 lines
grub/grub-core/commands/efi/setvariable.c deleted +0
-15-if (status !=GRUB_ERR_NONE ) - { -grub_printf ("couldn't set efi variable" ); -return status; - } -return 0 ; -} - -static grub_err_t -grub_cmd_getefivariable (grub_command_t cmd __attribute__ ((unused)), -int argc,char *argv[]) -{ -grub_efi_guid_t global =GRUB_EFI_GLOBAL_VARIABLE_GUID ; -if (argc ==0 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable nameexpected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-2-else if (argc ==1 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable namevalue expected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-4- -grub_size_t var_size; -grub_err_t status; - char *value = (char*)grub_efi_get_variable (argv[0], &global,
&var_size);grub/grub-core/commands/efi/setvariable.c deleted +0
-14- status =grub_env_set (argv[1 ], value); -if (status !=GRUB_ERR_NONE ) - { -grub_printf ("couldn't set environment variable" ); -return status; - } -return 0 ; -} - -static grub_command_t cmd_setefivariable, cmd_getefivariable; - -GRUB_MOD_INIT (loadbios) -{ - cmd_setefivariable = grub_register_command ("setefivariable",
grub_cmd_setefivariable,grub/grub-core/commands/efi/setvariable.c deleted +0
-6-N_ ("NAME VALUE" ), -N_ ("Set an EFI firmware variable " -"which can be stored and retrieved " - "from between sessions.")); - - cmd_getefivariable = grub_register_command ("getefivariable",
grub_cmd_getefivariable,grub/grub-core/commands/efi/setvariable.c deleted +0
-11-N_ ("NAME ENV_VARIABLE" ), -N_ ("Gets an EFI firmware variable " -"and stores it as a GRUB environment " - "variable named ENV_VARIABLE.")); -} - -GRUB_MOD_FINI (loadbios) -{ -grub_unregister_command (cmd_setefivariable); -grub_unregister_command (cmd_getefivariable); -}
Quoted 12 lines
Quoted 5 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJSk8knAAoJEFbRvtGxmFPETq0H/jbN5WRHRImN93zuXaAhLBqf cwyRPAJFdyIIGGRrqqRS/KMITDO2eVSsiEwbCQxPAfqGFhFq64hOYJxTlJRBNoUf bM4g34e26x0rH338EFFnFe/8KZSV9dMf/dByKCh1yXLa9F74CYC211tAuwCcG1lr cm+k71B7wvBn9szPgrXkcvqDbnAJ2arDgabzkqUGIPYpdMYdeCHVzM5uFMAaqLPA VPAdZSfhbvZgaA41XIsSx6YjMf2PQPNqDKg/Vn3BuzxpD+OnuxVCdwGkX5+rdnCr ejG+pJLqYK2qymcJEkMW1mnYyMOjV5Layp+3P69BBUf+Xc53Z9Du8cDM2Inz4oA= =voXE
-----END PGP SIGNATURE-----
Quoted 8 lines · SevenBits
Thanks for your quick reply.
I just have a couple of questions. How do you prefer I allow the user to specify the vendor UUID? By typing it in via the keyboard? And secondly, by saying it needs "readable aliases for known types" do you mean that there should be a function to set an integer, one to set a boolean, etc?
I meant for UUIDs. E.g. one alias "efi" for shared space, "apple" for apple and so on.
But type of variable is also an issue and there should be at least following available:
hex - transform all in hex
utf16 - decode utf16 into utf8
Probably more, didn't really look into issue
Quoted 182 lines
Regarding the patch format, I'll tidy that up and send a proper one.
-- SevenBits
Quoted 2 lines · Vladimir 'phcoder' Serbinenko
please resend as proper and not as reverse patch. Anotjer issie that can be seen from description alone is that you don't allow to specify vendor
uuid.
Quoted 86 lines
it would be needed and slso it needs readable aliases for known types
Quoted 83 lines · SevenBits
Hello everyone,
This patch adds two GRUB two commands to allow the user to get and set the values of (U)EFI firmware variables. When dealing with (U)EFI firmware with GRUB I decided this would be a useful tool to have for both developers and end-users.
The first command, setefivariable, takes two parameters: the name of the variable to set and its value. The second, getefivariable, also takes two parameters: the name of the variable to retrieve and the name of the GRUB environment variable in which you want to store the result. This can then be checked using GRUB's built in 'if' statement and scripting capability to allow unique booting capabilities based on whether, for example, secure boot is enabled or the (U)EFI firmware is in setup mode.
Have a look and let me know what you think! The patch follows.
-- SevenBits
grub-orig/grub-core/Makefile.core.def renamed from grub/grub-core/Makefile.core.def +0
-7@@ -1004,13 +1004,6 @@ module = { }; module = { - name = setvariable; - common = commands/efi/setvariable.c; - enable = i386_efi; - enable = x86_64_efi; -}; - -module = { name = pcidump; common = commands/pcidump.c; enable = pci;grub/grub-core/commands/efi/setvariable.c deleted +0
-37@@ -1,96 +0,0 @@ -/* setvariable.c - get and set efi firmware variables */ -/* -* GRUB -- GRand Unified Bootloader -* Copyright (C) 2013 Free Software Foundation, Inc. -* -* GRUB is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GRUB is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GRUB. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <grub/env.h> -#include <grub/dl.h> -#include <grub/misc.h> -#include <grub/file.h> -#include <grub/efi/efi.h> -#include <grub/pci.h> -#include <grub/command.h> -#include <grub/i18n.h> - -GRUB_MOD_LICENSE ("GPLv3+" ); - -static grub_err_t -grub_cmd_setefivariable (grub_command_t cmd __attribute__ ((unused)), -int argc,char *argv[]) -{ -grub_efi_guid_t global =GRUB_EFI_GLOBAL_VARIABLE_GUID ; -if (argc ==0 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable nameexpected"));
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c deleted +0
-2-else if (argc ==1 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable namevalue expected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-5- -grub_err_t status; -grub_size_t arg_size = (grub_strlen (argv[1 ]) +1 ) *sizeof (char ); - - status = grub_efi_set_variable (argv[0], &global, argv[1],
arg_size);Quoted 58 lines
Quoted 58 lines
grub/grub-core/commands/efi/setvariable.c deleted +0
-15-if (status !=GRUB_ERR_NONE ) - { -grub_printf ("couldn't set efi variable" ); -return status; - } -return 0 ; -} - -static grub_err_t -grub_cmd_getefivariable (grub_command_t cmd __attribute__ ((unused)), -int argc,char *argv[]) -{ -grub_efi_guid_t global =GRUB_EFI_GLOBAL_VARIABLE_GUID ; -if (argc ==0 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable nameexpected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-2-else if (argc ==1 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable namevalue expected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-4- -grub_size_t var_size; -grub_err_t status; - char *value = (char*)grub_efi_get_variable (argv[0], &global,
&var_size);grub/grub-core/commands/efi/setvariable.c deleted +0
-14- status =grub_env_set (argv[1 ], value); -if (status !=GRUB_ERR_NONE ) - { -grub_printf ("couldn't set environment variable" ); -return status; - } -return 0 ; -} - -static grub_command_t cmd_setefivariable, cmd_getefivariable; - -GRUB_MOD_INIT (loadbios) -{ - cmd_setefivariable = grub_register_command ("setefivariable",
grub_cmd_setefivariable,grub/grub-core/commands/efi/setvariable.c deleted +0
-6-N_ ("NAME VALUE" ), -N_ ("Set an EFI firmware variable " -"which can be stored and retrieved " - "from between sessions.")); - - cmd_getefivariable = grub_register_command ("getefivariable",
grub_cmd_getefivariable,grub/grub-core/commands/efi/setvariable.c deleted +0
-11-N_ ("NAME ENV_VARIABLE" ), -N_ ("Gets an EFI firmware variable " -"and stores it as a GRUB environment " - "variable named ENV_VARIABLE.")); -} - -GRUB_MOD_FINI (loadbios) -{ -grub_unregister_command (cmd_setefivariable); -grub_unregister_command (cmd_getefivariable); -}Quoted 12 lines
Quoted 5 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 11 lines · Vladimir '?-coder/phcoder' Serbinenko
Quoted 8 lines · SevenBits
Thanks for your quick reply.
I just have a couple of questions. How do you prefer I allow the user to specify the vendor UUID? By typing it in via the keyboard? And secondly, by saying it needs "readable aliases for known types" do you mean that there should be a function to set an integer, one to set a boolean, etc?
I meant for UUIDs. E.g. one alias "efi" for shared space, "apple" for apple and so on.
So other than a generic variable UUID and Apple, are there others that you think might be necessary? I can try and put in some common ones but manufacturers may not disclose what their specific UUIDs are.
Quoted 6 lines
But type of variable is also an issue and there should be at least following available:
hex - transform all in hex
utf16 - decode utf16 into utf8
Probably more, didn't really look into issue
I see, okay, I'll add some in.
Quoted 7 lines
Quoted 7 lines
Regarding the patch format, I'll tidy that up and send a proper one.
-- SevenBits
Quoted 1 line · Vladimir 'phcoder' Serbinenko
please resend as proper and not as reverse patch. Anotjer issie that
can be
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
seen from description alone is that you don't allow to specify vendor
uuid.
Quoted 2 lines
it would be needed and slso it needs readable aliases for known types On Nov 25, 2013 10:35 PM, "SevenBits" <[email protected]> wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hello everyone,
This patch adds two GRUB two commands to allow the user to get and set the values of (U)EFI firmware variables. When dealing with (U)EFI firmware with GRUB I decided this would be a useful tool to have for both developers and end-users.
The first command, setefivariable, takes two parameters: the name
of the
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
variable to set and its value. The second, getefivariable, also takes two parameters: the name of the variable to retrieve and the name
of the
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
GRUB environment variable in which you want to store the result. This can then be checked using GRUB's built in 'if' statement and scripting capability to allow unique booting capabilities based on whether, for example, secure boot is enabled or the (U)EFI firmware is in setup
mode.
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Have a look and let me know what you think! The patch follows.
-- SevenBits
grub-orig/grub-core/Makefile.core.def renamed from grub/grub-core/Makefile.core.def +0
-7@@ -1004,13 +1004,6 @@ module = { }; module = { - name = setvariable; - common = commands/efi/setvariable.c; - enable = i386_efi; - enable = x86_64_efi; -}; - -module = { name = pcidump; common = commands/pcidump.c; enable = pci;grub/grub-core/commands/efi/setvariable.c deleted +0
-0
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c line 7
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c deleted +0
-7@@ -1,96 +0,0 @@ -/* setvariable.c - get and set efi firmware variables */ -/* -* GRUB -- GRand Unified Bootloader -* Copyright (C) 2013 Free Software Foundation, Inc. -* -* GRUB is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as
published by
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
grub/grub-core/commands/efi/setvariable.c deleted +0
-22-* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GRUB is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GRUB. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <grub/env.h> -#include <grub/dl.h> -#include <grub/misc.h> -#include <grub/file.h> -#include <grub/efi/efi.h> -#include <grub/pci.h> -#include <grub/command.h> -#include <grub/i18n.h> - -GRUB_MOD_LICENSE ("GPLv3+" );
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c deleted +0
-8- -static grub_err_t -grub_cmd_setefivariable (grub_command_t cmd __attribute__ ((unused)), -int argc,char *argv[]) -{ -grub_efi_guid_t global =GRUB_EFI_GLOBAL_VARIABLE_GUID ; -if (argc ==0 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable
name
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
grub/grub-core/commands/efi/setvariable.c
Quoted 3 lines
expected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-2-else if (argc ==1 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable
name
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
grub/grub-core/commands/efi/setvariable.c
Quoted 6 lines
value expected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-5- -grub_err_t status; -grub_size_t arg_size = (grub_strlen (argv[1 ]) +1 ) *sizeof (char ); - - status = grub_efi_set_variable (argv[0], &global, argv[1],
arg_size);
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
grub/grub-core/commands/efi/setvariable.c deleted +0
-7-if (status !=GRUB_ERR_NONE ) - { -grub_printf ("couldn't set efi variable" ); -return status; - } -return 0 ; -}Quoted 8 lines
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c deleted +0
-8- -static grub_err_t -grub_cmd_getefivariable (grub_command_t cmd __attribute__ ((unused)), -int argc,char *argv[]) -{ -grub_efi_guid_t global =GRUB_EFI_GLOBAL_VARIABLE_GUID ; -if (argc ==0 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable
name
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
grub/grub-core/commands/efi/setvariable.c
Quoted 3 lines
expected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-2-else if (argc ==1 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variable
name
Quoted 65 lines
Quoted 56 lines
Quoted 40 lines
Quoted 40 lines
value expected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-4- -grub_size_t var_size; -grub_err_t status; - char *value = (char*)grub_efi_get_variable (argv[0], &global,
&var_size);grub/grub-core/commands/efi/setvariable.c deleted +0
-14- status =grub_env_set (argv[1 ], value); -if (status !=GRUB_ERR_NONE ) - { -grub_printf ("couldn't set environment variable" ); -return status; - } -return 0 ; -} - -static grub_command_t cmd_setefivariable, cmd_getefivariable; - -GRUB_MOD_INIT (loadbios) -{ - cmd_setefivariable = grub_register_command ("setefivariable",
grub_cmd_setefivariable,grub/grub-core/commands/efi/setvariable.c deleted +0
-6-N_ ("NAME VALUE" ), -N_ ("Set an EFI firmware variable " -"which can be stored and retrieved " - "from between sessions.")); - - cmd_getefivariable = grub_register_command ("getefivariable",
grub_cmd_getefivariable,grub/grub-core/commands/efi/setvariable.c deleted +0
-11-N_ ("NAME ENV_VARIABLE" ), -N_ ("Gets an EFI firmware variable " -"and stores it as a GRUB environment " - "variable named ENV_VARIABLE.")); -} - -GRUB_MOD_FINI (loadbios) -{ -grub_unregister_command (cmd_setefivariable); -grub_unregister_command (cmd_getefivariable); -}Quoted 12 lines
Quoted 5 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-develQuoted 5 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 4 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJSk88fAAoJEFbRvtGxmFPEo6sH+QH8Ui0uRIkjAPrpiYtq6WNS T4tsxK8n4wv5dtROlWZTJpuLhtynKP1m4LjSguO8XTMtRhgqFiyfcA1cJOQ/5XbP qEK1MoRivAme/Ia88l+AlGqSXqBTu5zmG+TfuMrVl/DFXKIwes6S5/mxeXftV+B7 gMq1LAZJ2oGiy1lSRdS37Tzg0VChVJJvFHIEu5AUAisLvOLKB054M82T3vmxQD6s N3z2RTxho98JxqjF+4tGMtbAI0mebD+v9ik2H3vs4Tsd+86Ie1/nSWPGJ0mdfN96 812p4xCBPx3vFkcfo1cReqNIl2aDVY+F55vWoh1Nc2fKHh1PW7/RB9Bo+FWbb48= =fQuY
-----END PGP SIGNATURE-----
Quoted 11 lines · SevenBits
Quoted 9 lines · Vladimir '?-coder/phcoder' Serbinenko
Quoted 8 lines · SevenBits
Thanks for your quick reply.
I just have a couple of questions. How do you prefer I allow the user to specify the vendor UUID? By typing it in via the keyboard? And secondly, by saying it needs "readable aliases for known types" do you mean that there should be a function to set an integer, one to set a boolean, etc?
Quoted 6 lines
Quoted 2 lines
I meant for UUIDs. E.g. one alias "efi" for shared space, "apple" for apple and so on.
So other than a generic variable UUID and Apple, are there others that you think might be necessary? I can try and put in some common ones but manufacturers may not disclose what their specific UUIDs are.
I'd include a command to list variables (interactively). We would pretty quickly collect most common UUIDs this way.
Quoted 215 lines
Quoted 5 lines
But type of variable is also an issue and there should be at least following available:
hex - transform all in hex
utf16 - decode utf16 into utf8
Probably more, didn't really look into issueI see, okay, I'll add some in.
Quoted 6 lines
Quoted 6 lines
Regarding the patch format, I'll tidy that up and send a proper one.
-- SevenBits
Quoted 1 line · Vladimir 'phcoder' Serbinenko
please resend as proper and not as reverse patch. Anotjer issie that
can be
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
seen from description alone is that you don't allow to specify vendor
uuid.
Quoted 2 lines
it would be needed and slso it needs readable aliases for known types On Nov 25, 2013 10:35 PM, "SevenBits" <[email protected]> wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hello everyone,
This patch adds two GRUB two commands to allow the user to get and set the values of (U)EFI firmware variables. When dealing with (U)EFI firmware with GRUB I decided this would be a useful tool to have for both developers and end-users.
The first command, setefivariable, takes two parameters: the name
of the
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
variable to set and its value. The second, getefivariable, also takes two parameters: the name of the variable to retrieve and the name
of the
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
GRUB environment variable in which you want to store the result. This can then be checked using GRUB's built in 'if' statement and scripting capability to allow unique booting capabilities based on whether, for example, secure boot is enabled or the (U)EFI firmware is in setup
mode.
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Have a look and let me know what you think! The patch follows.
-- SevenBits
grub-orig/grub-core/Makefile.core.def renamed from grub/grub-core/Makefile.core.def +0
-7@@ -1004,13 +1004,6 @@ module = { }; module = { - name = setvariable; - common = commands/efi/setvariable.c; - enable = i386_efi; - enable = x86_64_efi; -}; - -module = { name = pcidump; common = commands/pcidump.c; enable = pci;grub/grub-core/commands/efi/setvariable.c deleted +0
-0Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c line 7
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c deleted +0
-7@@ -1,96 +0,0 @@ -/* setvariable.c - get and set efi firmware variables */ -/* -* GRUB -- GRand Unified Bootloader -* Copyright (C) 2013 Free Software Foundation, Inc. -* -* GRUB is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
grub/grub-core/commands/efi/setvariable.c deleted +0
-22-* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GRUB is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GRUB. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <grub/env.h> -#include <grub/dl.h> -#include <grub/misc.h> -#include <grub/file.h> -#include <grub/efi/efi.h> -#include <grub/pci.h> -#include <grub/command.h> -#include <grub/i18n.h> - -GRUB_MOD_LICENSE ("GPLv3+" );Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c deleted +0
-8- -static grub_err_t -grub_cmd_setefivariable (grub_command_t cmd __attribute__ ((unused)), -int argc,char *argv[]) -{ -grub_efi_guid_t global =GRUB_EFI_GLOBAL_VARIABLE_GUID ; -if (argc ==0 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variablename
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
grub/grub-core/commands/efi/setvariable.c
Quoted 3 lines
expected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-2-else if (argc ==1 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variablename
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
grub/grub-core/commands/efi/setvariable.c
Quoted 6 lines
value expected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-5- -grub_err_t status; -grub_size_t arg_size = (grub_strlen (argv[1 ]) +1 ) *sizeof (char ); - - status = grub_efi_set_variable (argv[0], &global, argv[1],
arg_size);Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
grub/grub-core/commands/efi/setvariable.c deleted +0
-7-if (status !=GRUB_ERR_NONE ) - { -grub_printf ("couldn't set efi variable" ); -return status; - } -return 0 ; -}Quoted 8 lines
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c
Quoted 8 lines
grub/grub-core/commands/efi/setvariable.c deleted +0
-8- -static grub_err_t -grub_cmd_getefivariable (grub_command_t cmd __attribute__ ((unused)), -int argc,char *argv[]) -{ -grub_efi_guid_t global =GRUB_EFI_GLOBAL_VARIABLE_GUID ; -if (argc ==0 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variablename
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
grub/grub-core/commands/efi/setvariable.c
Quoted 3 lines
expected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-2-else if (argc ==1 ) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("efi variablename
Quoted 65 lines
Quoted 56 lines
Quoted 40 lines
Quoted 40 lines
value expected"));
grub/grub-core/commands/efi/setvariable.c deleted +0
-4- -grub_size_t var_size; -grub_err_t status; - char *value = (char*)grub_efi_get_variable (argv[0], &global,
&var_size);grub/grub-core/commands/efi/setvariable.c deleted +0
-14- status =grub_env_set (argv[1 ], value); -if (status !=GRUB_ERR_NONE ) - { -grub_printf ("couldn't set environment variable" ); -return status; - } -return 0 ; -} - -static grub_command_t cmd_setefivariable, cmd_getefivariable; - -GRUB_MOD_INIT (loadbios) -{ - cmd_setefivariable = grub_register_command ("setefivariable",
grub_cmd_setefivariable,grub/grub-core/commands/efi/setvariable.c deleted +0
-6-N_ ("NAME VALUE" ), -N_ ("Set an EFI firmware variable " -"which can be stored and retrieved " - "from between sessions.")); - - cmd_getefivariable = grub_register_command ("getefivariable",
grub_cmd_getefivariable,grub/grub-core/commands/efi/setvariable.c deleted +0
-11-N_ ("NAME ENV_VARIABLE" ), -N_ ("Gets an EFI firmware variable " -"and stores it as a GRUB environment " - "variable named ENV_VARIABLE.")); -} - -GRUB_MOD_FINI (loadbios) -{ -grub_unregister_command (cmd_setefivariable); -grub_unregister_command (cmd_getefivariable); -}Quoted 12 lines
Quoted 5 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-develQuoted 5 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-develQuoted 4 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 16 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 15 lines · SevenBits
Quoted 12 lines · Vladimir '?-coder/phcoder' Serbinenko
Quoted 9 lines · SevenBits
Thanks for your quick reply.
I just have a couple of questions. How do you prefer I allow the user to specify the vendor UUID? By typing it in via the keyboard? And secondly, by saying it needs "readable aliases for known types" do you mean that there should be a function to set an integer, one to set a boolean, etc?
I meant for UUIDs. E.g. one alias "efi" for shared space, "apple" for apple and so on.
Quoted 7 lines
Quoted 5 lines
So other than a generic variable UUID and Apple, are there others that you think might be necessary? I can try and put in some common ones but manufacturers may not disclose what their specific UUIDs are.
I'd include a command to list variables (interactively). We would pretty quickly collect most common UUIDs this way.
So, I've got a command written to print out the system's firmware variables. Trouble is I'm not sure what the best way would be to print or otherwise display the UUIDs gathered so that we can collect them.
Seeing as how I have an Apple computer as my only (U)EFI-enabled machine I won't have a large sample set to use anyway... unless of course you'd want to take the patch before it's feature complete so it could get the rounds and gather common UUIDs.
Perhaps someone who has been with GRUB for awhile could advise me on what the best course of action is in situations like this.
Quoted 177 lines
Quoted 169 lines
Quoted 4 lines
But type of variable is also an issue and there should be at least following available: hex - transform all in hex utf16 - decode utf16 into utf8 Probably more, didn't really look into issue
I see, okay, I'll add some in.
Quoted 8 lines
Quoted 8 lines
Regarding the patch format, I'll tidy that up and send a proper one.
-- SevenBits
Quoted 2 lines · Vladimir 'phcoder' Serbinenko
please resend as proper and not as reverse patch. Anotjer issie that
can be
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
seen from description alone is that you don't allow to specify vendor
uuid.
Quoted 6 lines
it would be needed and slso it needs readable aliases for known types On Nov 25, 2013 10:35 PM, "SevenBits"
Quoted 2 lines · <[email protected]> wrote:
Hello everyone,
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
This patch adds two GRUB two commands to allow the user to get and set the values of (U)EFI firmware variables. When dealing with (U)EFI firmware with GRUB I decided this would be a useful tool to have for both developers and end-users.
The first command, setefivariable, takes two parameters:
the nameof the
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
variable to set and its value. The second, getefivariable, also takes two parameters: the name of the variable to retrieve and the name
of the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
GRUB environment variable in which you want to store the result. This can then be checked using GRUB's built in 'if' statement and scripting capability to allow unique booting capabilities based on whether, for example, secure boot is enabled or the (U)EFI firmware is in setup
mode.
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Have a look and let me know what you think! The patch follows.
-- SevenBits
(quoted diff) +0
-0b/grub-orig/grub-core/Makefile.core.def index 177d6d6..5cd84b1 100644 --- a/grub/grub-core/Makefile.core.def +++ b/grub-orig/grub-core/Makefile.core.def @@ -1004,13 +1004,6 @@ module = { };
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
module = { - name = setvariable; - common =
commands/efi/setvariable.c; - enable =i386_efi; - enable =x86_64_efi; -}; - -module = { name = pcidump; common =commands/pcidump.c; enable = pci; diff --gita/grub/grub-core/commands/efi/setvariable.cb/grub/grub-core/commands/efi/setvariable.cdeleted fileQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
mode 100644 index b0d0967..0000000 ---
a/grub/grub-core/commands/efi/setvariable.c+++/dev/null@@ -1,96 +0,0 @@ -/*setvariable.c- get and set efi firmware variables */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2013 Free Software Foundation, Inc. - * - * GRUB is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License aspublished by
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
- * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version.
- * - * GRUB is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GRUB. If not, see
<http://www.gnu.org/licenses/>. - */ - -#include <grub/env.h> -#include <grub/dl.h> -#include <grub/misc.h> -#include <grub/file.h> -#include <grub/efi/efi.h> -#include <grub/pci.h> -#includeQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
<
grub/command.h> -#include <grub/i18n.h> -(quoted diff) +0
-2-GRUB_MOD_LICENSE ("GPLv3+"); - -static grub_err_t -grub_cmd_setefivariable (grub_command_t cmd
__attribute__((unused)), - int argc, char
*argv[]) -{ -grub_efi_guid_tglobal =GRUB_EFI_GLOBAL_VARIABLE_GUID; - if (argc == 0) -
returngrub_error(GRUB_ERR_BAD_ARGUMENT, N_("efi variablename
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
expected")); - else if (argc == 1) - return
grub_error(GRUB_ERR_BAD_ARGUMENT, N_("efi variablename
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
value expected")); - -
grub_err_tstatus; -grub_size_targ_size= (grub_strlen(argv[1])+ 1) *
sizeof(char); - - status =grub_efi_set_variable
(argv[0], &global, argv[1],
arg_size);Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
- if (status !=
GRUB_ERR_NONE) - { -grub_printf("couldn't set efi variable"); -
return status; - } - return 0; -} - -staticgrub_err_t-grub_cmd_getefivariable (grub_command_tcmd__attribute__((unused)), - int argc,
char *argv[]) -{ -grub_efi_guid_tglobal =GRUB_EFI_GLOBAL_VARIABLE_GUID; - if (argc == 0) -
returngrub_error(GRUB_ERR_BAD_ARGUMENT, N_("efi variablename
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
expected")); - else if (argc == 1) - return
grub_error(GRUB_ERR_BAD_ARGUMENT, N_("efi variablename
Quoted 47 lines
Quoted 39 lines
Quoted 25 lines
Quoted 25 lines
value expected")); - -
grub_size_tvar_size; -grub_err_tstatus; - char *value =
(char*)grub_efi_get_variable (argv[0], &global,&var_size); - status =grub_env_set(argv[1], value);
- if (status !=GRUB_ERR_NONE) - { -grub_printf("couldn't set environment variable"); -
return status; - } - return 0; -} - -staticgrub_command_tcmd_setefivariable,cmd_getefivariable; - -GRUB_MOD_INIT(loadbios) -{ -cmd_setefivariable=grub_register_command("setefivariable",grub_cmd_setefivariable, - N_("NAME
VALUE"), - N_("Set an EFI firmware
variable " - "which can be
stored and retrieved " - "from
between sessions.")); - -cmd_getefivariable=grub_register_command("getefivariable",grub_cmd_getefivariable, - N_("NAMEENV_VARIABLE"), - N_("Gets an EFI
firmware variable " - "and
stores it as a GRUB environment " -
"variable namedENV_VARIABLE.")); -} - -GRUB_MOD_FINI(loadbios) -{ -grub_unregister_command(cmd_setefivariable); -grub_unregister_command(cmd_getefivariable); -}Quoted 10 lines
Quoted 4 lines
_______________________________________________
Grub-devel mailing list [email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel_______________________________________________ Grub-devel mailing list [email protected]
https://lists.gnu.org/mailman/listinfo/grub-develQuoted 4 lines
_______________________________________________ Grub-devel mailing list [email protected]
https://lists.gnu.org/mailman/listinfo/grub-develQuoted 3 lines
_______________________________________________ Grub-devel mailing list [email protected]
https://lists.gnu.org/mailman/listinfo/grub-develQuoted 4 lines
_______________________________________________ Grub-devel mailing list [email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 4 lines
_______________________________________________ Grub-devel mailing list [email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJSlj2ZAAoJEFbRvtGxmFPEwKMH/2ZaeqmlH+0QPaWj0cGMyAuV 45z4GLWjFyUnXxFPMnk2aZzSo4WDJJapfJQOazB4rXmu/CpqtnyGNuCRFZitCs70 lw64HpKkAbBhVdQmMY1o0O2uC74WRP7XuGoYai7vMaHAA3VBqMlk2EHfB1FBgHae LQf8NMyvzjvBFHmMf79axn4zZKXQJ7bBjqDP2eO7OuEjp/SKMXxOd55S9O+hzw7d uy3HKAayWLYC9F/66Wm4oj8hScXc14Si8vW+pwUic9nmTPSXo6gMyDbjPwZYuXaQ 8zNA1ZjikyNY3Nc22MsmqXr0sHPws9xenUdJDXhWcIk9l/LHXKBRBbycMd9RcvY= =W2Lz
-----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
В Wed, 27 Nov 2013 13:44:41 -0500
SevenBits <[email protected]> пишет:
Quoted 25 lines
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 21 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 20 lines · SevenBits
Quoted 4 lines · Vladimir '?-coder/phcoder' Serbinenko
Quoted 3 lines · SevenBits
Thanks for your quick reply.
Quoted 8 lines
Quoted 6 lines
I just have a couple of questions. How do you prefer I allow the user to specify the vendor UUID? By typing it in via the keyboard? And secondly, by saying it needs "readable aliases for known types" do you mean that there should be a function to set an integer, one to set a boolean, etc?
I meant for UUIDs. E.g. one alias "efi" for shared space, "apple" for apple and so on.
So other than a generic variable UUID and Apple, are there others that you think might be necessary? I can try and put in some common ones but manufacturers may not disclose what their specific UUIDs are.
Quoted 7 lines
Quoted 2 lines
I'd include a command to list variables (interactively). We would pretty quickly collect most common UUIDs this way.
So, I've got a command written to print out the system's firmware variables. Trouble is I'm not sure what the best way would be to print or otherwise display the UUIDs gathered so that we can collect them.
I think it is rather premature at this point. What is needed first is sane framework for handling EFI variables, which means - handling GUID, options (during set or as filter in listing variables) and conversion of arbitrary binary data from/to external printable representation.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
But type of variable is also an issue and there should be at least following available: hex - transform all in hex utf16 - decode utf16 into utf8 Probably more, didn't really look into issue
I see, okay, I'll add some in.
Yes, please. Adding aliases for GUID can always come later and is not really that important.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
iEYEARECAAYFAlKWQLAACgkQR6LMutpd94yMZgCg0vV8YWsgWPSDK+Zco9nZVfqI EbAAoKCo88yPOpD0IlDn/EiXZ1hnT7RY
=XUV+
-----END PGP SIGNATURE-----
Quoted 31 lines · Andrey Borzenkov
В Wed, 27 Nov 2013 13:44:41 -0500
SevenBits <[email protected]> пишет:Quoted 27 lines
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 23 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 13 lines · SevenBits
Quoted 10 lines · Vladimir '?-coder/phcoder' Serbinenko
Quoted 9 lines · SevenBits
Thanks for your quick reply.
I just have a couple of questions. How do you prefer I allow the user to specify the vendor UUID? By typing it in via the keyboard? And secondly, by saying it needs "readable aliases for known types" do you mean that there should be a function to set an integer, one to set a boolean, etc?
Quoted 7 lines
Quoted 2 lines
I meant for UUIDs. E.g. one alias "efi" for shared space, "apple" for apple and so on.
So other than a generic variable UUID and Apple, are there others that you think might be necessary? I can try and put in some common ones but manufacturers may not disclose what their specific UUIDs are.
I'd include a command to list variables (interactively). We would pretty quickly collect most common UUIDs this way.
Quoted 6 lines
Quoted 3 lines
So, I've got a command written to print out the system's firmware variables. Trouble is I'm not sure what the best way would be to print or otherwise display the UUIDs gathered so that we can collect them.
I think it is rather premature at this point.
Agreed. I wasn't clear enough that I meant that in the first implementation we need to put just few UUIDs we already know about as aliases and expand them with the time.
Quoted 21 lines
What is needed first is
sane framework for handling EFI variables, which means - handling GUID, options (during set or as filter in listing variables) and conversion of arbitrary binary data from/to external printable representation.Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
But type of variable is also an issue and there should be at least following available: hex - transform all in hex utf16 - decode utf16 into utf8 Probably more, didn't really look into issue
I see, okay, I'll add some in.
Yes, please. Adding aliases for GUID can always come later and is not really that important.
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 37 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 36 lines · Andrey Borzenkov
В Wed, 27 Nov 2013 13:44:41 -0500
SevenBits <[email protected] <javascript:;>> пишет:Quoted 31 lines
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 16 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 15 lines · SevenBits
Quoted 12 lines · Vladimir '?-coder/phcoder' Serbinenko
Quoted 9 lines · SevenBits
Thanks for your quick reply.
I just have a couple of questions. How do you prefer I allow the user to specify the vendor UUID? By typing it in via the keyboard? And secondly, by saying it needs "readable aliases for known types" do you mean that there should be a function to set an integer, one to set a boolean, etc?
I meant for UUIDs. E.g. one alias "efi" for shared space, "apple" for apple and so on.
Quoted 7 lines
Quoted 5 lines
So other than a generic variable UUID and Apple, are there others that you think might be necessary? I can try and put in some common ones but manufacturers may not disclose what their specific UUIDs are.
I'd include a command to list variables (interactively). We would pretty quickly collect most common UUIDs this way.
So, I've got a command written to print out the system's firmware variables. Trouble is I'm not sure what the best way would be to print or otherwise display the UUIDs gathered so that we can collect them.
Quoted 4 lines
Quoted 1 line
I think it is rather premature at this point.
Agreed. I wasn't clear enough that I meant that in the first implementation we need to put just few UUIDs we already know about as aliases and expand them with the time.
Okay, sounds okay to me. I'll be occupied because of the holidays here in the United States but I can get on it as soon as I can.
Quoted 4 lines
Quoted 4 lines
What is needed first is
sane framework for handling EFI variables, which means - handling GUID, options (during set or as filter in listing variables) and conversion of arbitrary binary data from/to external printable representation.
I think I get what you mean. I'll focus on this area then.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
But type of variable is also an issue and there should be at least following available: hex - transform all in hex utf16 - decode utf16 into utf8 Probably more, didn't really look into issue
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
I see, okay, I'll add some in.
Yes, please. Adding aliases for GUID can always come later and is not really that important.
Alright. Any specific ideas of where I should put the code? In with the other UEFI handling stuff or in the code for the module I'm writing?
Quoted 8 lines
Quoted 5 lines
_______________________________________________
Grub-devel mailing list
[email protected] <javascript:;>
https://lists.gnu.org/mailman/listinfo/grub-devel