Rejoice! As a new feature has landed in the smol kernel ๐ŸŽ‰
I've added pv(4) glue for the qemufwcfg(4) driver which allows to pass data / files from the host to the guest via a mountable virtual drive wiki.osdev.org/QEMU_fw_cfg (as always, 3rd party websites explain the feature better than QEMU's own documentation), example with smolBSD:
```
$ ./startnb.sh -i images/base-amd64.img -x '-fw_cfg opt/org.smolbsd.hosts,file=/etc/hosts'
[...]
# mount_qemufwcfg /mnt
# head -1 /mnt/opt/org.smolbsd.hosts
127.0.0.1 localhost
```
Code: github.com/NetBSD/src/compare/
The feature is already available in smolBSD's kernel for amd64 and i386.

Following on this, smolBSD has now a convenient feature that allows the host to pass variables and files to the guest:

$ ./startnb.sh -i images/base-amd64.img -k kernels/netbsd-SMOL -e FOO=BAR -E hosts=/etc/hosts
โžก๏ธ using QEMU version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.11)
โžก๏ธ using kernel kernels/netbsd-SMOL
โžก๏ธ using console: viocon
โžก๏ธ using disk image images/base-amd64.img
โžก๏ธ no service name, using UUID (4l7s40nI)
[ 1.0000000] NetBSD 11.0_BETA (MICROVM) Notice: this software is protected by copyright
[ 1.0000000] Detecting hardware... (QBOOT 000000000000)
[ 1.0069433] done.
[ 1.0085220] kernel boot time: 15ms
Created tmpfs /dev (1835008 byte, 3552 inodes)
add net default: gateway 10.0.2.2
/dev/ld0a on / type ffs (noatime, read-only, local)
# echo $FOO
BAR
# head -1 /var/qemufwcfg/opt/org.smolbsd.file.hosts
127.0.0.1 localhost

0

If you have a fediverse account, you can quote this note from your own instance. Search https://mastodon.bsd.cafe/users/imil/statuses/115870435870635817 on your instance and quote it. (Note that quoting is not supported in Mastodon.)