Emscripten + QEMU (--to-js): VirtFS completely inaccessible
In arg-module the following options are defined:
"-virtfs", "local,path=/,mount_tag=wasi0,security_model=passthrough,id=wasi0",
"-virtfs", "local,path=/pack,mount_tag=wasi1,security_model=passthrough,id=wasi1",
However, attempting to mount these per the example in qemu-wasm always results in "permission denied" both on Alpine and Debian (riscv64).
I dug into the code a bit and was able to mount a file via the info command, but I was unable to mount any directories.
m:myfile.txt (located in root of emscripten. i.e. /myfile.txt)
@ed6767 Sorry for the slow reply. Could you ensure creating the directory on the emscripten fs and write the directory path to the info file? For example, the following change for the sample html file mounts the /testdir directory on the emscripten fs to /testdir in the container.
// "/pack/info" file needs to be provided to the filesystem to start
// the container. Refer to /cmd/init/main.go for the detail of info file.
let info = "t:" + Math.round(new Date() / 1000) + "\n";
+ info += 'm: /testdir\n';
+ Module['preRun'].push((mod) => {
+ mod.FS.mkdir('/testdir');
+ mod.FS.writeFile('/testdir/myfile.txt', 'foo');
+ });
Module['preRun'].push((mod) => {
mod.FS.mkdir('/pack');
mod.FS.writeFile('/pack/info', info);