grub4dos icon indicating copy to clipboard operation
grub4dos copied to clipboard

grub4efi - request uefi drivers list utility

Open steve6375 opened this issue 2 years ago • 15 comments

Would it be possible to list UEFI drivers that are currently loaded? Specifically, it would be nice to be able check if the UEFI BIOS already contains an NTFS driver and so can access NTFS partitions as well as FAT partitions. P.S. Does grub4efi add drivers and so would affect this list, or does grub4efi use its own code to access filesystems?

steve6375 avatar Aug 19 '21 07:08 steve6375

Would it be possible to list UEFI drivers that are currently loaded? Specifically, it would be nice to be able check if the UEFI BIOS already contains an NTFS driver and so can access NTFS partitions as well as FAT partitions.

Yes it's possible. But I won't have time for the next few months.

P.S. Does grub4efi add drivers and so would affect this list, or does grub4efi use its own code to access filesystems?

G4E is NOT a UEFI driver. A "UEFI application" cannot be a "UEFI driver". "UEFI driver" is a special type of executable that has a different entry point and is loaded in a different way to a normal "UEFI application".

does grub4efi use its own code to access filesystems?

Yes. G4E and GRUB2 uses Block I/O Protocol to read and write to disk, while rEFInd uses Simple Filesystem Protocol to access files, so these drivers can be used for rEFInd/Shell, but not for G4E/GRUB2.

a1ive avatar Aug 19 '21 11:08 a1ive

可以使用uuid,vol,map --status函数获得有关驱动器的信息。 具体还想知道什么?

yaya2007 avatar Aug 19 '21 13:08 yaya2007

I want to know if the UEFI environment contains an NTFS (and exFAT) driver. All UEFI BIOSes support FAT, but some UEFI BIOSes also have extra filesystem drivers such as NTFS or exFAT. When you directly boot to an OS on an NTFS volume (or VHD on NTFS), it will need to use the UEFI drivers to access the files on the NTFS filesystem If the UEFI BIOS does not include any NTFS diver, then we could load an NTFS UEFI driver using the grub4efi load command. However, if the UEFI BIOS already has an NTFS driver, it would be safer to not load another NTFS driver as it is not needed.

The UEFI Shell 'drivers' command lists drivers, but we need the same command in grub4efi so we can determine if an NTFS driver is already present or not.

steve6375 avatar Aug 19 '21 13:08 steve6375

可以使用uuid,vol,map --status函数获得有关驱动器的信息。 具体还想知道什么?

不是 ”驱动器”。 他是想列出所有 UEFI 驱动,或者查找包含指定名字的 UEFI 驱动是否存在。

a1ive avatar Aug 19 '21 13:08 a1ive

嗷,明白了。搞笑了。

yaya2007 avatar Aug 19 '21 13:08 yaya2007

嗷,明白了。搞笑了。

比如他想判断uefi固件是否支持从exfat分区启动,就要列出所有已安装的驱动,查找驱动名字里面有没有带"exfat"的。 可以参考 https://github.com/a1ive/grub/blob/259a9e8ce51a0fb81f3f656024ab6ec78401507a/grub-core/map/efi/vdisk.c#L73

a1ive avatar Aug 19 '21 13:08 a1ive

是不是你想要的. BOOTX64.rar.txt

yaya2007 avatar Aug 21 '21 08:08 yaya2007

Thanks! great work! :-) Just a few small issues:

  1. Help not displaying properly image

  2. Redirect to file formatting image

This makes it difficult to parse maybe better as single column (e.g. uefidriver --list) for example, how would you get just the full name of an NTFS driver from the list by parsing? Why do you use comma . and not period . ???

  1. line feed after command? image

  2. name and help description 'uefidriver' 'get uefi driver' is not good description - better as 'uefidrivers - list uefi drivers' shell equivalent command is 'drivers' not 'driver'

Query: If I add a driver using 'load' it does not appear in list. Is this expected? If so, maybe uefidrivers help should say 'list inbuilt BIOS UEFI drivers' ?

image

steve6375 avatar Aug 21 '21 09:08 steve6375

@yaya2007 你列出的是 COMPONENT_NAME2_PROTOCOL 还是 COMPONENT_NAME_PROTOCOL ?

a1ive avatar Aug 21 '21 09:08 a1ive

是name2

yaya2007 avatar Aug 21 '21 09:08 yaya2007

Shell (grubfm shell) loads same driver and shows it in list image image

steve6375 avatar Aug 21 '21 09:08 steve6375

是name2

我好像误导你了,应该用 EfiDriverBindingProtocol https://github.com/tianocore/edk2/blob/0ecdcb6142037dd1cdd08660a2349960bcf0270a/MdePkg/Include/Protocol/DriverBinding.h 枚举 DriverBindingProtocol,再从每个 handle 上打开 ComponentName2Protocol,再获取名称

a1ive avatar Aug 21 '21 09:08 a1ive

在我的惠普笔记本上,无论是是 COMPONENT_NAME2_PROTOCOL 还是 COMPONENT_NAME_PROTOCOL,都不支持。不知道EfiDriverBindingProtocol 是否会普遍支持(如果仍然要打开ComponentName2Protocol,估计够呛)。 使用 COMPONENT_NAME2_PROTOCOL 或者 COMPONENT_NAME_PROTOCOL,返回的列表信息已经可以判断 UEFI 是否支持 NTFS 或者 exFAT 启动,继而加载相关缺失的驱动。

上一版本是为了充分利用屏幕,一行显示2项内容。但是保存到内存,丢失排版信息,所以显示混乱。 这一版是一行显示一项内容。

如果觉得使用EfiDriverBindingProtocol比较妥当,那就等a1ive有时间再打补丁,我不想费神了。 BOOTX64.rar.txt

yaya2007 avatar Aug 22 '21 02:08 yaya2007

好吧,等我有时间了再改一下。

a1ive avatar Aug 22 '21 03:08 a1ive

thanks. I prefer uefidrivers as the command rather than uefidriver

steve6375 avatar Aug 22 '21 06:08 steve6375