summaryrefslogtreecommitdiff
path: root/tools/efivar.py
AgeCommit message (Collapse)AuthorFilesLines
2021-01-13tools: efivar.py unused variableHeinrich Schuchardt1-1/+1
Unused variables should be called '_'. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
2021-01-13tools: efivar.py should check GUID when deletingHeinrich Schuchardt1-1/+1
When deleting a variable we must check that the GUID provided by the user matches the GUID of the variable. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
2021-01-13tools: efivar.py: incorrect indentationHeinrich Schuchardt1-15/+15
According to https://pep8.org/#indentation we should use 4 spaces per indentation level. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
2021-01-13tools: efivar.py without argumentsHeinrich Schuchardt1-1/+4
When tools: efivar.py is called without arguments an error occurs: Traceback (most recent call last): File "tools/efivar.py", line 380, in <module> main() File "tools/efivar.py", line 360, in main args.func(args) AttributeError: 'Namespace' object has no attribute 'func' Show the online help if the arguments do not specify a function. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
2020-12-20tools: add a simple script to generate EFI variablesPaulo Alcantara1-0/+380
This script generates EFI variables for U-Boot variable store format. A few examples: - Generating secure boot keys $ openssl req -x509 -sha256 -newkey rsa:2048 -subj /CN=TEST_PK/ \ -keyout PK.key -out PK.crt -nodes -days 365 $ efisiglist -a -c PK.crt -o foo.esl $ tools/efivar.py set -i ubootefi.var -n db -d foo.esl -t file $ tools/efivar.py set -i ubootefi.var -n kek -d foo.esl -t file $ tools/efivar.py set -i ubootefi.var -n pk -d foo.esl -t file - Printing out variables $ tools/efivar.py set -i ubootefi.var -n var1 -d foo -t str $ tools/efivar.py set -i ubootefi.var -n var2 -d bar -t str $ tools/efivar.py print -i ubootefi.var var1: 8be4df61-93ca-11d2-aa0d-00e098032b8c EFI_GLOBAL_VARIABLE_GUID NV|BS|RT, DataSize = 0x3 0000000000: 66 6F 6F foo var2: 8be4df61-93ca-11d2-aa0d-00e098032b8c EFI_GLOBAL_VARIABLE_GUID NV|BS|RT, DataSize = 0x3 0000000000: 62 61 72 bar - Removing variables $ tools/efivar.py del -i ubootefi.var -n var1 $ tools/efivar.py set -i ubootefi.var -n var1 -a nv,bs -d foo -t str $ tools/efivar.py print -i ubootefi.var -n var1 var1: 8be4df61-93ca-11d2-aa0d-00e098032b8c EFI_GLOBAL_VARIABLE_GUID NV|BS, DataSize = 0x3 0000000000: 66 6F 6F foo $ tools/efivar.py del -i ubootefi.var -n var1 err: attributes don't match $ tools/efivar.py del -i ubootefi.var -n var1 -a nv,bs $ tools/efivar.py print -i ubootefi.var -n var1 err: variable not found Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Correct examples in commit message. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>