* [PATCH 1/1] efi_loader: avoid multiple local copies of lf2_initrd_guid
@ 2021-10-15 0:36 Heinrich Schuchardt
2021-10-15 7:33 ` Ilias Apalodimas
0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2021-10-15 0:36 UTC (permalink / raw)
To: u-boot
Cc: AKASHI Takahiro, Ilias Apalodimas, Alexander Graf, Heinrich Schuchardt
Create the GUID as a global variable.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
cmd/efidebug.c | 3 +--
include/efi_load_initrd.h | 1 +
lib/efi_loader/efi_helper.c | 5 +++++
lib/efi_loader/efi_load_initrd.c | 3 +--
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 33a5135ee1..a977ca9c72 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -1144,7 +1144,6 @@ static void show_efi_boot_opt_data(u16 *varname16, void *data, size_t *size)
struct efi_device_path *initrd_path = NULL;
struct efi_load_option lo;
efi_status_t ret;
- const efi_guid_t lf2_initrd_guid = EFI_INITRD_MEDIA_GUID;
ret = efi_deserialize_load_option(&lo, data, size);
if (ret != EFI_SUCCESS) {
@@ -1165,7 +1164,7 @@ static void show_efi_boot_opt_data(u16 *varname16, void *data, size_t *size)
printf(" file_path: %pD\n", lo.file_path);
- initrd_path = efi_dp_from_lo(&lo, &lf2_initrd_guid);
+ initrd_path = efi_dp_from_lo(&lo, &efi_lf2_initrd_guid);
if (initrd_path) {
printf(" initrd_path: %pD\n", initrd_path);
efi_free_pool(initrd_path);
diff --git a/include/efi_load_initrd.h b/include/efi_load_initrd.h
index 478ae807c6..be5d5a7acb 100644
--- a/include/efi_load_initrd.h
+++ b/include/efi_load_initrd.h
@@ -16,6 +16,7 @@
#define EFI_INITRD_MEDIA_GUID \
EFI_GUID(0x5568e427, 0x68fc, 0x4f3d, \
0xac, 0x74, 0xca, 0x55, 0x52, 0x31, 0xcc, 0x68)
+extern const efi_guid_t efi_lf2_initrd_guid;
struct efi_initrd_dp {
struct efi_device_path_vendor vendor;
diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
index 89833de222..485384b7ee 100644
--- a/lib/efi_loader/efi_helper.c
+++ b/lib/efi_loader/efi_helper.c
@@ -13,6 +13,11 @@
#include <efi_loader.h>
#include <efi_variable.h>
+#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI_LOAD_FILE2_INITRD)
+/* GUID used by Linux to identify the LoadFile2 protocol with the initrd */
+const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID;
+#endif
+
/**
* efi_create_current_boot_var() - Return Boot#### name were #### is replaced by
* the value of BootCurrent
diff --git a/lib/efi_loader/efi_load_initrd.c b/lib/efi_loader/efi_load_initrd.c
index e2a8063023..c5e6652e66 100644
--- a/lib/efi_loader/efi_load_initrd.c
+++ b/lib/efi_loader/efi_load_initrd.c
@@ -52,7 +52,6 @@ static efi_handle_t efi_initrd_handle;
*/
static efi_status_t get_initrd_fp(struct efi_device_path **initrd_fp)
{
- const efi_guid_t lf2_initrd_guid = EFI_INITRD_MEDIA_GUID;
struct efi_device_path *dp = NULL;
/*
@@ -65,7 +64,7 @@ static efi_status_t get_initrd_fp(struct efi_device_path **initrd_fp)
* We can then use this specific return value and not install the
* protocol, while allowing the boot to continue
*/
- dp = efi_get_dp_from_boot(lf2_initrd_guid);
+ dp = efi_get_dp_from_boot(efi_lf2_initrd_guid);
if (!dp)
return EFI_INVALID_PARAMETER;
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] efi_loader: avoid multiple local copies of lf2_initrd_guid
2021-10-15 0:36 [PATCH 1/1] efi_loader: avoid multiple local copies of lf2_initrd_guid Heinrich Schuchardt
@ 2021-10-15 7:33 ` Ilias Apalodimas
0 siblings, 0 replies; 2+ messages in thread
From: Ilias Apalodimas @ 2021-10-15 7:33 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: u-boot, AKASHI Takahiro, Alexander Graf
On Fri, Oct 15, 2021 at 02:36:36AM +0200, Heinrich Schuchardt wrote:
> Create the GUID as a global variable.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> cmd/efidebug.c | 3 +--
> include/efi_load_initrd.h | 1 +
> lib/efi_loader/efi_helper.c | 5 +++++
> lib/efi_loader/efi_load_initrd.c | 3 +--
> 4 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/cmd/efidebug.c b/cmd/efidebug.c
> index 33a5135ee1..a977ca9c72 100644
> --- a/cmd/efidebug.c
> +++ b/cmd/efidebug.c
> @@ -1144,7 +1144,6 @@ static void show_efi_boot_opt_data(u16 *varname16, void *data, size_t *size)
> struct efi_device_path *initrd_path = NULL;
> struct efi_load_option lo;
> efi_status_t ret;
> - const efi_guid_t lf2_initrd_guid = EFI_INITRD_MEDIA_GUID;
>
> ret = efi_deserialize_load_option(&lo, data, size);
> if (ret != EFI_SUCCESS) {
> @@ -1165,7 +1164,7 @@ static void show_efi_boot_opt_data(u16 *varname16, void *data, size_t *size)
>
> printf(" file_path: %pD\n", lo.file_path);
>
> - initrd_path = efi_dp_from_lo(&lo, &lf2_initrd_guid);
> + initrd_path = efi_dp_from_lo(&lo, &efi_lf2_initrd_guid);
> if (initrd_path) {
> printf(" initrd_path: %pD\n", initrd_path);
> efi_free_pool(initrd_path);
> diff --git a/include/efi_load_initrd.h b/include/efi_load_initrd.h
> index 478ae807c6..be5d5a7acb 100644
> --- a/include/efi_load_initrd.h
> +++ b/include/efi_load_initrd.h
> @@ -16,6 +16,7 @@
> #define EFI_INITRD_MEDIA_GUID \
> EFI_GUID(0x5568e427, 0x68fc, 0x4f3d, \
> 0xac, 0x74, 0xca, 0x55, 0x52, 0x31, 0xcc, 0x68)
> +extern const efi_guid_t efi_lf2_initrd_guid;
>
> struct efi_initrd_dp {
> struct efi_device_path_vendor vendor;
> diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
> index 89833de222..485384b7ee 100644
> --- a/lib/efi_loader/efi_helper.c
> +++ b/lib/efi_loader/efi_helper.c
> @@ -13,6 +13,11 @@
> #include <efi_loader.h>
> #include <efi_variable.h>
>
> +#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI_LOAD_FILE2_INITRD)
> +/* GUID used by Linux to identify the LoadFile2 protocol with the initrd */
> +const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID;
> +#endif
> +
> /**
> * efi_create_current_boot_var() - Return Boot#### name were #### is replaced by
> * the value of BootCurrent
> diff --git a/lib/efi_loader/efi_load_initrd.c b/lib/efi_loader/efi_load_initrd.c
> index e2a8063023..c5e6652e66 100644
> --- a/lib/efi_loader/efi_load_initrd.c
> +++ b/lib/efi_loader/efi_load_initrd.c
> @@ -52,7 +52,6 @@ static efi_handle_t efi_initrd_handle;
> */
> static efi_status_t get_initrd_fp(struct efi_device_path **initrd_fp)
> {
> - const efi_guid_t lf2_initrd_guid = EFI_INITRD_MEDIA_GUID;
> struct efi_device_path *dp = NULL;
>
> /*
> @@ -65,7 +64,7 @@ static efi_status_t get_initrd_fp(struct efi_device_path **initrd_fp)
> * We can then use this specific return value and not install the
> * protocol, while allowing the boot to continue
> */
> - dp = efi_get_dp_from_boot(lf2_initrd_guid);
> + dp = efi_get_dp_from_boot(efi_lf2_initrd_guid);
> if (!dp)
> return EFI_INVALID_PARAMETER;
>
> --
> 2.30.2
>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-15 7:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15 0:36 [PATCH 1/1] efi_loader: avoid multiple local copies of lf2_initrd_guid Heinrich Schuchardt
2021-10-15 7:33 ` Ilias Apalodimas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.