All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] efi_loader: allow booting from short dev only DP
@ 2022-06-11  5:22 Heinrich Schuchardt
  2022-06-11  5:22 ` [PATCH 1/2] " Heinrich Schuchardt
  2022-06-11  5:22 ` [PATCH 2/2] efi_loader: create boot options without file path Heinrich Schuchardt
  0 siblings, 2 replies; 4+ messages in thread
From: Heinrich Schuchardt @ 2022-06-11  5:22 UTC (permalink / raw)
  To: u-boot; +Cc: Masahisa Kojima, AKASHI Takahiro, Heinrich Schuchardt

Allow creating boot options without file path, e.g.

    efidebug boot add -b 0001 'short dev only' host 0:1 ''
    efidebug boot add -B 0001 'long dev only' host 0:1 ''

Allow booting from a short form device-path without file path, e.g.

    /HD(1,GPT,5ef79931-a1aa-4c70-9d67-611e8f69eafd,0x800,0x1000)

Heinrich Schuchardt (2):
  efi_loader: allow booting from short dev only DP
  efi_loader: create boot options without file path

 lib/efi_loader/efi_bootmgr.c     |  9 ++++-----
 lib/efi_loader/efi_device_path.c | 14 ++++++++------
 2 files changed, 12 insertions(+), 11 deletions(-)

--
2.36.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] efi_loader: allow booting from short dev only DP
  2022-06-11  5:22 [PATCH 0/2] efi_loader: allow booting from short dev only DP Heinrich Schuchardt
@ 2022-06-11  5:22 ` Heinrich Schuchardt
  2022-06-11  5:22 ` [PATCH 2/2] efi_loader: create boot options without file path Heinrich Schuchardt
  1 sibling, 0 replies; 4+ messages in thread
From: Heinrich Schuchardt @ 2022-06-11  5:22 UTC (permalink / raw)
  To: u-boot; +Cc: Masahisa Kojima, AKASHI Takahiro, Heinrich Schuchardt

Allow booting from a short form device-path without file path, e.g.

    /HD(1,GPT,5ef79931-a1aa-4c70-9d67-611e8f69eafd,0x800,0x1000)

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 lib/efi_loader/efi_bootmgr.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index 93f6590530..9b65f34035 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -44,7 +44,7 @@ static const struct efi_runtime_services *rs;
 static
 struct efi_device_path *expand_media_path(struct efi_device_path *device_path)
 {
-	struct efi_device_path *dp, *full_path;
+	struct efi_device_path *dp, *rem, *full_path;
 	efi_handle_t handle;
 	efi_status_t ret;

@@ -57,11 +57,10 @@ struct efi_device_path *expand_media_path(struct efi_device_path *device_path)
 	 * booting from removable media.
 	 */
 	dp = device_path;
-	ret = EFI_CALL(efi_locate_device_path(
-				&efi_simple_file_system_protocol_guid,
-				&dp, &handle));
+	handle = efi_dp_find_obj(dp, &efi_simple_file_system_protocol_guid,
+				 &rem);
 	if (ret == EFI_SUCCESS) {
-		if (dp->type == DEVICE_PATH_TYPE_END) {
+		if (rem->type == DEVICE_PATH_TYPE_END) {
 			dp = efi_dp_from_file(NULL, 0,
 					      "/EFI/BOOT/" BOOTEFI_NAME);
 			full_path = efi_dp_append(device_path, dp);
--
2.36.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] efi_loader: create boot options without file path
  2022-06-11  5:22 [PATCH 0/2] efi_loader: allow booting from short dev only DP Heinrich Schuchardt
  2022-06-11  5:22 ` [PATCH 1/2] " Heinrich Schuchardt
@ 2022-06-11  5:22 ` Heinrich Schuchardt
  2022-06-12  1:21   ` AKASHI Takahiro
  1 sibling, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2022-06-11  5:22 UTC (permalink / raw)
  To: u-boot; +Cc: Masahisa Kojima, AKASHI Takahiro, Heinrich Schuchardt

Allow creating boot options without file path, e.g.

    efidebug boot add -b 0001 'short dev only' host 0:1 ''
    efidebug boot add -B 0002 'long dev only' host 0:1 ''

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 lib/efi_loader/efi_device_path.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 50a988c561..c511abcd5e 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -1002,12 +1002,14 @@ struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part,
 		buf = dp_part_fill(buf, desc, part);

 	/* add file-path: */
-	fp = buf;
-	fp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
-	fp->dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH;
-	fp->dp.length = (u16)fpsize;
-	path_to_uefi(fp->str, path);
-	buf += fpsize;
+	if (*path) {
+		fp = buf;
+		fp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
+		fp->dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH;
+		fp->dp.length = (u16)fpsize;
+		path_to_uefi(fp->str, path);
+		buf += fpsize;
+	}

 	*((struct efi_device_path *)buf) = END;

--
2.36.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] efi_loader: create boot options without file path
  2022-06-11  5:22 ` [PATCH 2/2] efi_loader: create boot options without file path Heinrich Schuchardt
@ 2022-06-12  1:21   ` AKASHI Takahiro
  0 siblings, 0 replies; 4+ messages in thread
From: AKASHI Takahiro @ 2022-06-12  1:21 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: u-boot, Masahisa Kojima

On Sat, Jun 11, 2022 at 05:22:08AM +0000, Heinrich Schuchardt wrote:
> Allow creating boot options without file path, e.g.
> 
>     efidebug boot add -b 0001 'short dev only' host 0:1 ''
>     efidebug boot add -B 0002 'long dev only' host 0:1 ''

So the "subject" is a bit misleading.
Your intension is to expand "efidebug", not uefi functionality.

> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  lib/efi_loader/efi_device_path.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
> index 50a988c561..c511abcd5e 100644
> --- a/lib/efi_loader/efi_device_path.c
> +++ b/lib/efi_loader/efi_device_path.c
> @@ -1002,12 +1002,14 @@ struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part,
>  		buf = dp_part_fill(buf, desc, part);
> 
>  	/* add file-path: */
> -	fp = buf;
> -	fp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
> -	fp->dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH;
> -	fp->dp.length = (u16)fpsize;
> -	path_to_uefi(fp->str, path);
> -	buf += fpsize;
> +	if (*path) {
> +		fp = buf;
> +		fp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
> +		fp->dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH;
> +		fp->dp.length = (u16)fpsize;
> +		path_to_uefi(fp->str, path);
> +		buf += fpsize;
> +	}

Please update the function description, too.
With your change, the current is no more enough.

-Takahiro Akashi


>  	*((struct efi_device_path *)buf) = END;
> 
> --
> 2.36.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-12  1:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-11  5:22 [PATCH 0/2] efi_loader: allow booting from short dev only DP Heinrich Schuchardt
2022-06-11  5:22 ` [PATCH 1/2] " Heinrich Schuchardt
2022-06-11  5:22 ` [PATCH 2/2] efi_loader: create boot options without file path Heinrich Schuchardt
2022-06-12  1:21   ` AKASHI Takahiro

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.