[PATCH 11/11] fs: qemu_fw_cfg: support populating environment via QEMU fw_cfg

Sascha Hauer s.hauer at pengutronix.de
Mon Mar 17 00:44:37 PDT 2025


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.

Should defaultenv_append_runtime_directory() be called in
qemu_fw_cfg_fs_init() instead?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list