[U-Boot] [PATCH] efi_loader: disk: install file system protocol to a whole disk
Heinrich Schuchardt
xypron.glpk at gmx.de
Thu Aug 22 10:52:41 UTC 2019
On 8/22/19 11:11 AM, Mark Kettenis wrote:
>> From: AKASHI Takahiro <takahiro.akashi at linaro.org>
>> Date: Thu, 22 Aug 2019 17:06:25 +0900
>>
>> Currently, a whole disk without any partitions is not associated
>> with EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. So even if it houses FAT
>> file system, there is a chance that we may not be able to access
>> it, particularly, when accesses are to be attempted after searching
>> that protocol against a device handle.
>>
>> With this patch, EFI_SIMPLE_FILE_SYSTEM_PROTOCOL is installed
>> to such a disk if part_get_info() shows there is not partition
>> table installed on it.
>
> Do other UEFI implementations support this?
What use cases exist that come without partition table?
You can create an MBR with partition table that is a valid start of a
file system.
So you should first check if a partition table exists. Only if none
exists you can test for a possible file system.
Best regards
Heinrich
>
>> Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
>> ---
>> lib/efi_loader/efi_disk.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
>> index 7a6b06821a47..548fe667e6f8 100644
>> --- a/lib/efi_loader/efi_disk.c
>> +++ b/lib/efi_loader/efi_disk.c
>> @@ -239,6 +239,7 @@ static efi_status_t efi_disk_add_dev(
>> struct efi_disk_obj **disk)
>> {
>> struct efi_disk_obj *diskobj;
>> + disk_partition_t info;
>> efi_status_t ret;
>>
>> /* Don't add empty devices */
>> @@ -270,7 +271,8 @@ static efi_status_t efi_disk_add_dev(
>> diskobj->dp);
>> if (ret != EFI_SUCCESS)
>> return ret;
>> - if (part >= 1) {
>> + /* partitions or whole disk without partitions */
>> + if (part >= 1 || part_get_info(desc, part, &info)) {
>> diskobj->volume = efi_simple_file_system(desc, part,
>> diskobj->dp);
>> ret = efi_add_protocol(&diskobj->header,
>> --
>> 2.21.0
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> https://lists.denx.de/listinfo/u-boot
>
More information about the U-Boot
mailing list