diff --git a/src/emulator/README.md b/src/emulator/README.md new file mode 100644 index 000000000..9a349e86b --- /dev/null +++ b/src/emulator/README.md @@ -0,0 +1,10 @@ +# Puter Emulator + +To run locally: +1. Build the image in `image/`: + - `./build-epoxy.sh` or provide a musl+i686 epoxy in `assets/` + - `./build.sh` +2. Build the v86 frontend: `npm run start-webpack` +3. Build and run a local epoxy in `submodules/epoxy-tls/server/` or some other wisp server for the guest networking +4. Run Puter and log in as admin, then open the `puter-linux` app via URL +5. Optionally open the Terminal app if you want to test out the v86 integration diff --git a/src/emulator/image/Dockerfile b/src/emulator/image/Dockerfile index 1d79cc563..ae13d0cb0 100644 --- a/src/emulator/image/Dockerfile +++ b/src/emulator/image/Dockerfile @@ -15,7 +15,6 @@ RUN apk add --update \ passwd -d root && \ chsh -s /bin/bash -RUN apk add neofetch # programming language tools RUN apk add --no-cache \ nodejs npm \ diff --git a/src/emulator/image/build-epoxy.sh b/src/emulator/image/build-epoxy.sh new file mode 100755 index 000000000..0addf9a9e --- /dev/null +++ b/src/emulator/image/build-epoxy.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +if ! which cross >/dev/null 2>&1; then + echo "install https://github.com/cross-rs/cross to build epoxy with the simple script" + exit 1 +fi + +cd ../../../submodules/epoxy-tls/server/ || exit 1 +# -lgcc is needed for __ffsdi2 +RUSTFLAGS="-Clink-args=-lgcc" cross build --release --target i686-unknown-linux-musl --features twisp +cp ../target/i686-unknown-linux-musl/release/epoxy-server ../../../src/emulator/image/assets/ diff --git a/src/emulator/src/main.js b/src/emulator/src/main.js index 170ac2d8f..bb334caa4 100644 --- a/src/emulator/src/main.js +++ b/src/emulator/src/main.js @@ -202,6 +202,10 @@ const bench_20ms = async (ctx) => { window.onload = async function() { + try { + await puter.fs.mkdir(puter.appDataPath) + } catch {} + const modules = {}; modules.bench = (await WebAssembly.instantiateStreaming( fetch('./static/bench.wasm'))).instance.exports; @@ -213,7 +217,9 @@ window.onload = async function() } catch (e) {} if ( ! emu_config ) { + console.log("writing emu config") await puter.fs.write('config.json', JSON.stringify({})); + console.log("writing emu config1") emu_config = {}; }