@@ -21,7 +21,7 @@ targets += helloworld.o
endif
obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
-obj-y += efi_bootmgr.o
+obj-y += efi_helper.o efi_bootmgr.o
obj-y += efi_boottime.o
obj-y += efi_console.o
obj-y += efi_device_path.o
@@ -11,6 +11,7 @@
#include <charset.h>
#include <log.h>
#include <malloc.h>
+#include <efi_helper.h>
#include <efi_loader.h>
#include <efi_load_initrd.h>
#include <efi_variable.h>
@@ -166,38 +167,6 @@ unsigned long efi_serialize_load_option(struct efi_load_option *lo, u8 **data)
return size;
}
-/**
- * get_var() - get UEFI variable
- *
- * It is the caller's duty to free the returned buffer.
- *
- * @name: name of variable
- * @vendor: vendor GUID of variable
- * @size: size of allocated buffer
- * Return: buffer with variable data or NULL
- */
-static void *get_var(u16 *name, const efi_guid_t *vendor,
- efi_uintn_t *size)
-{
- efi_status_t ret;
- void *buf = NULL;
-
- *size = 0;
- ret = efi_get_variable_int(name, vendor, NULL, size, buf, NULL);
- if (ret == EFI_BUFFER_TOO_SMALL) {
- buf = malloc(*size);
- ret = efi_get_variable_int(name, vendor, NULL, size, buf, NULL);
- }
-
- if (ret != EFI_SUCCESS) {
- free(buf);
- *size = 0;
- return NULL;
- }
-
- return buf;
-}
-
/**
* try_load_entry() - try to load image for boot option
*
A few patches before we introduced a file which includes the get_var() function defined in the efi bootmanager. So let's replace it here and use the common function as much as we can. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> --- lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_bootmgr.c | 33 +-------------------------------- 2 files changed, 2 insertions(+), 33 deletions(-) -- 2.30.0.rc2