[PATCH 11/11] fs: qemu_fw_cfg: support populating environment via QEMU fw_cfg
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Mar 17 04:36:48 PDT 2025
Hi Sascha,
On 3/17/25 08:44, Sascha Hauer wrote:
> Hi Ahmad,
>
> On Thu, Mar 13, 2025 at 11:17:28AM +0100, Ahmad Fatoum wrote:
>> diff --git a/fs/qemu_fw_cfg.c b/fs/qemu_fw_cfg.c
>> index 7f7350e67e64..ef2a1008ee5d 100644
>> --- a/fs/qemu_fw_cfg.c
>> +++ b/fs/qemu_fw_cfg.c
>> @@ -13,6 +13,7 @@
>> #include <errno.h>
>> #include <linux/stat.h>
>> #include <xfuncs.h>
>> +#include <envfs.h>
>> #include <fcntl.h>
>> #include <linux/qemu_fw_cfg.h>
>> #include <wchar.h>
>> @@ -363,7 +364,13 @@ static int fw_cfg_fs_probe(struct device *dev)
>> */
>> fsdev->cdev = cdev_by_name(devpath_to_name(fsdev->backingstore));
>>
>> - return fw_cfg_fs_parse(sb);
>> + ret = fw_cfg_fs_parse(sb);
>> + if (ret)
>> + goto free_data;
>> +
>> + defaultenv_append_runtime_directory("/mnt/fw_cfg/by_name/opt/org.barebox.env");
>
> I see the variables show up in /mnt/fw_cfg/by_name/opt/org.barebox.env/,
> but not in the environment.
>
> I wonder how this is supposed to work. The fw_cfg fs is mounted when I
> first access /mnt/fw_cfg on the barebox command line, but at that time
> defaultenv_append_runtime_directory() has no effect anymore as
> defaultenv_load() is executed during startup.
I had the ramfb driver enabled and that mounted the FS for me...
> Should defaultenv_append_runtime_directory() be called in
> qemu_fw_cfg_fs_init() instead?
Possibly. I will check for v2.
Thanks for your feedback and testing,
Ahmad
>
> Sascha
>
More information about the barebox
mailing list