[PATCH] efi_loader: Add absolute path to EFI_VAR_FILE_NAME

Heinrich Schuchardt xypron.glpk at gmx.de
Wed Mar 20 14:05:55 CET 2024


On 20.03.24 12:53, Ilias Apalodimas wrote:
> Hi Patrice,
>
> On Wed, 20 Mar 2024 at 12:31, Patrice Chotard
> <patrice.chotard at foss.st.com> wrote:
>>
>> If the ESP partition is formatted in ext4, we got the following error :
>>
>> STM32MP>  setenv -e -nv -bs -rt -v OsIndications =0x0000000000000004
>> GUID: 8be4df61-93ca-11d2-aa0d-00e098032b8c (EFI_GLOBAL_VARIABLE_GUID)
>> Attributes: 0x7
>> Value:
>>      00000000: 04 00 00 00 00 00 00 00                          ........
>> File System is consistent
>> Please supply Absolute path
>
> This error message comes from ext4_common.c and it's ext4 specific. Do
> you have any idea why this exists?
> What happens to other filesystems? IOW does this change the behavior
> of the existing code if it tries to write a file in FAT?

When reading a file with the ext4 driver leading '/' are ignored by
removing them in ext4fs_find_file1(). It is really inconsistent that
when writing a leading '/' is required.

We can simply remove the check in ext4fs_get_parent_inode_num(). I found
no issues when saving to an ext4 file system with the check removed.

I will send a patch.

Best regards

Heinrich

>
> Thanks
> /Ilias
>
>> ** Error ext4fs_write() **
>> ** Unable to write file ubootefi.var **
>> Failed to persist EFI variables
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard at foss.st.com>
>> ---
>>
>>   include/efi_variable.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/efi_variable.h b/include/efi_variable.h
>> index 805e6c5f1e0..8d507460b20 100644
>> --- a/include/efi_variable.h
>> +++ b/include/efi_variable.h
>> @@ -92,7 +92,7 @@ efi_status_t efi_query_variable_info_int(u32 attributes,
>>                                           u64 *remaining_variable_storage_size,
>>                                           u64 *maximum_variable_size);
>>
>> -#define EFI_VAR_FILE_NAME "ubootefi.var"
>> +#define EFI_VAR_FILE_NAME "/ubootefi.var"
>>
>>   #define EFI_VAR_BUF_SIZE CONFIG_EFI_VAR_BUF_SIZE
>>
>> --
>> 2.25.1
>>



More information about the U-Boot mailing list