[PATCH 2/2] efi_loader: create boot options without file path
Heinrich Schuchardt
xypron.glpk at gmx.de
Sat Jun 11 07:22:08 CEST 2022
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 at 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
More information about the U-Boot
mailing list