[PATCH v1 15/30] lib/efi: Add new routines to access efi variables

Samuel Mendoza-Jonas sam at mendozajonas.com
Wed Aug 1 16:54:09 AEST 2018


On Tue, 2018-07-24 at 22:15 +0000, Geoff Levand wrote:
> From: Ge Song <ge.song at hxt-semitech.com>
> 
> Provide methods to load/store petitboot's configuration on efi-based
> platforms. A test case is also provided.
> 
> Signed-off-by: Ge Song <ge.song at hxt-semitech.com>
> [Cleanup file comments, make efivarfs_path static.]
> Signed-off-by: Geoff Levand <geoff at infradead.org>
> ---
>  lib/Makefile.am        |   4 +-
>  lib/efi/efivar.c       | 191 +++++++++++++++++++++++++++++++++++++++++++++++++
>  lib/efi/efivar.h       |  46 ++++++++++++
>  test/lib/test-efivar.c | 127 ++++++++++++++++++++++++++++++++
>  4 files changed, 367 insertions(+), 1 deletion(-)
>  create mode 100644 lib/efi/efivar.c
>  create mode 100644 lib/efi/efivar.h
>  create mode 100644 test/lib/test-efivar.c

Hi Geoff,

The new efivar test isn't added to test/lib/Makefile so it doesn't run.
I added it in but it looks like it might have gone a bit stale, eg:

../configure --enable-platform-powerpc --enable-platform-arm64
...
make && make check
...
  CC       test/lib/test-efivar.o
../test/lib/test-efivar.c: In function ‘main’:
../test/lib/test-efivar.c:100:47: error: passing argument 3 of ‘efi_set_variable’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  rc = efi_set_variable(ctx, test_efivar_guid, test_varname,
                                               ^~~~~~~~~~~~
In file included from ../test/lib/test-efivar.c:32:
../lib/efi/efivar.h:50:26: note: expected ‘const struct efi_data *’ but argument is of type ‘const char *’
   const struct efi_data *efi_data);
   ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
../test/lib/test-efivar.c:100:7: error: too many arguments to function ‘efi_set_variable’
  rc = efi_set_variable(ctx, test_efivar_guid, test_varname,
       ^~~~~~~~~~~~~~~~
In file included from ../test/lib/test-efivar.c:32:
../lib/efi/efivar.h:49:5: note: declared here
 int efi_set_variable(const char *guidstr, const char *name,
     ^~~~~~~~~~~~~~~~
../test/lib/test-efivar.c:104:5: error: passing argument 4 of ‘efi_get_variable’ from incompatible pointer type [-Werror=incompatible-pointer-types]
     &data, &size, &attr);
     ^~~~~
In file included from ../test/lib/test-efivar.c:32:
../lib/efi/efivar.h:48:21: note: expected ‘struct efi_data **’ but argument is of type ‘uint8_t **’ {aka ‘unsigned char **’}
   struct efi_data **efi_data);
   ~~~~~~~~~~~~~~~~~~^~~~~~~~
../test/lib/test-efivar.c:103:7: error: too many arguments to function ‘efi_get_variable’
  rc = efi_get_variable(ctx, test_efivar_guid, test_varname,
       ^~~~~~~~~~~~~~~~
In file included from ../test/lib/test-efivar.c:32:
../lib/efi/efivar.h:47:5: note: declared here
 int efi_get_variable(void *ctx, const char *guidstr, const char *name,
     ^~~~~~~~~~~~~~~~
../test/lib/test-efivar.c:113:7: error: too many arguments to function ‘efi_del_variable’
  rc = efi_del_variable(ctx, test_efivar_guid, test_varname);
       ^~~~~~~~~~~~~~~~
In file included from ../test/lib/test-efivar.c:32:
../lib/efi/efivar.h:51:5: note: declared here
 int efi_del_variable(const char *guidstr, const char *name);
     ^~~~~~~~~~~~~~~~
../test/lib/test-efivar.c:116:5: error: passing argument 4 of ‘efi_get_variable’ from incompatible pointer type [-Werror=incompatible-pointer-types]
     &data, &size, &attr);
     ^~~~~
In file included from ../test/lib/test-efivar.c:32:
../lib/efi/efivar.h:48:21: note: expected ‘struct efi_data **’ but argument is of type ‘uint8_t **’ {aka ‘unsigned char **’}
   struct efi_data **efi_data);
   ~~~~~~~~~~~~~~~~~~^~~~~~~~
../test/lib/test-efivar.c:115:7: error: too many arguments to function ‘efi_get_variable’
  rc = efi_get_variable(ctx, test_efivar_guid, test_varname,
       ^~~~~~~~~~~~~~~~
In file included from ../test/lib/test-efivar.c:32:
../lib/efi/efivar.h:47:5: note: declared here
 int efi_get_variable(void *ctx, const char *guidstr, const char *name,
     ^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [Makefile:3930: test/lib/test-efivar.o] Error 1
make[3]: Leaving directory '/home/sam/source/petitboot/out'
make[2]: *** [Makefile:6215: check-am] Error 2
make[2]: Leaving directory '/home/sam/source/petitboot/out'
make[1]: *** [Makefile:5134: check-recursive] Error 1
make[1]: Leaving directory '/home/sam/source/petitboot/out'
make: *** [Makefile:6219: check] Error 2





More information about the Petitboot mailing list