Hi Pierrick, > I've been able to build qemu-system-x86_64 for wasm. > > When running it, I could not get any output following instructions on > https://github.com/ktock/qemu-wasm-sample/tcgdev64. > Anyway, I could run this using emrun, even though output is limited to > javascript console, and not the graphical console printed on webpage. > > Am I missing something obvious here?
By default, Emscripten's runtime sends output to the JavaScript console, so the example repo (qemu-wasm-sample) relies on xterm-pty[1] to setup a terminal UI on the page. If you compiled QEMU using the emsdk-wasm-cross.docker environment (instead of the additional Dockerfile provided in the qemu-wasm-sample repo) please make sure that xterm-pty is linked to the final QEMU build. A simplest way to do this is to add an extra -l flag to emcc to link with xterm-pty, using an envvar. npm install [email protected] cp ./node_modules/xterm-pty/emscripten-pty.js ./libemscripten-pty.js export EMCC_CFLAGS="-L $(pwd) -lemscripten-pty.js -Wno-unused-command-line-argument" emconfigure ./configure --cpu=wasm64 --static --disable-tools \ --target-list=x86_64-softmmu emmake make -j$(nproc) [1] https://github.com/mame/xterm-pty > As well, I tested this setup (edk2 + linux): > $ git clone https://github.com/pbo-linaro/qemu-linux-stack > $ cd qemu-linux-stack > $ git checkout x86_64 > $ ./build.sh > $ rm out/host.ext4 # too big for file_packager, does not handle sparse > > # copy needed bios files (.bin, .rom) from qemu/pc-bios > $ /usr/share/emscripten/tools/file_packager.py \ > qemu-system-x86_64.data --preload out \ > kvmvapic.bin vgabios-stdvga.bin efi-e1000.rom > load.js > > When booting with: > Module['arguments'] = [ > '-m', '1G', > '--nographic', > '-bios', 'out/OVMF.fd', > '-kernel', 'out/bzImage', > '-append', 'console=ttyS0', > ]; > > Boot fails with: > ASSERT_EFI_ERROR (Status = Device Error) > > While it boots linux with native qemu. Do we have any restriction on > WASM build that could create this, out of a bug in tcg backend? Thank you for pointing this out, I'm working on investigating this issue. Regards, Kohei
