Skip to contentSkip to conversation

cmd: fat: fatload: pass device path for efi payload

PATCH New Mian Yousaf Kaukab 2 participants 2 messages May 31, 2019 – Jun 15, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd: fat: fatload: pass device path for efi payload

fatload command can be used to load the EFI payload since EFI system partition is always a FAT partition. Call into EFI code from do_fat_fsload() to set the device path from which the last binary was loaded. An EFI application like grub2 can’t find its configuration file without the device path set.

load command (do_load_wrapper()) already calls efi_set_bootdev(). There is no need to move the call to do_load() as EFI system partition is always a FAT partition.

---
 cmd/fat.c | 5 +++++
 1 file changed, 5 insertions(+)
cmd/fat.c +5 -0
index 4b9a7eaab0..04e2055275 100644
@@ -17,6 +17,7 @@
 #include <part.h>
 #include <fat.h>
 #include <fs.h>
+#include <efi_loader.h>
 
 int do_fat_size(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
@@ -33,6 +34,10 @@ U_BOOT_CMD(
 
 int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
+#ifdef CONFIG_CMD_BOOTEFI
+	efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "",
+			(argc > 4) ? argv[4] : "");
+#endif
 	return do_load(cmdtp, flag, argc, argv, FS_TYPE_FAT);
 }
 
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 cmd: fat: fatload: pass device path for efi payload

Quoted 9 lines · Mian Yousaf Kaukab

fatload command can be used to load the EFI payload since EFI system partition is always a FAT partition. Call into EFI code from do_fat_fsload() to set the device path from which the last binary was loaded. An EFI application like grub2 can’t find its configuration file without the device path set.

load command (do_load_wrapper()) already calls efi_set_bootdev(). There is no need to move the call to do_load() as EFI system partition is always a FAT partition.

Thanks for reporting the issue.

U-Boot has no restriction to EFI/FAT partitions when starting EFI applications though of cause EFI/FAT is the normal way to do it.

Quoted 19 lines
---
  cmd/fat.c | 5 +++++
  1 file changed, 5 insertions(+)
cmd/fat.c +1 -0
index 4b9a7eaab0..04e2055275 100644
@@ -17,6 +17,7 @@
  #include <part.h>
  #include <fat.h>
  #include <fs.h>
+#include <efi_loader.h>
 
  int do_fat_size(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  {

cmd/fat.c U_BOOT_CMD( · line 40

Quoted 7 lines
cmd/fat.c +4 -0
@@ -33,6 +34,10 @@ U_BOOT_CMD(
 
  int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  {
+#ifdef CONFIG_CMD_BOOTEFI
+	efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "",
+			(argc > 4) ? argv[4] : "");
+#endif

We have the same already in cmd/fs.c for the 'load' command. I think we should move it from cmd/fs.c to do_load(). Then we cover all file systems.

Could you, please, update the patch accordingly and resend it to me.

Best regards

Heinrich

Quoted 4 lines
cmd/fat.c +0 -0
  	return do_load(cmdtp, flag, argc, argv, FS_TYPE_FAT);
  }