Tuesday | 03 DEC 2024
[ previous ]
[ next ]

Notes on using v86 and Debian

Title:
Date: 2022-09-10
Tags:  

A mindblowing project of getting x86 running in the browser.

http://copy.sh/v86/

https://github.com/copy/v86

I got v86 working with Debian. I didn't want to actually build the project and the instructions seem to imply that you didn't need to, you could just use various build artifacts but they didn't actually seem to link them or make it clear how to do it.

These will be the barebones instructions. This requires some set up as you need to create the html directory that you will be serving v86 out of. This script will also require input during the build-state.js command as it puts you inside the debian image.

#!/usr/bin/env bash

HTML_DIR=/usr/share/nginx/html/v86

cd ~/bp
git clone https://github.com/copy/v86.git

mkdir v86/build
curl https://copy.sh/v86/build/libv86.js -o v86/build/libv86.js
curl https://copy.sh/v86/build/v86.wasm -o v86/build/v86.wasm

cd ~/bp/v86/tools/docker/debian
sudo ./build-container.sh

sudo chown -R nivethan:nivethan ~/bp/v86/images
./build-state.js

cp ~/bp/v86/images/debian-state-base.bin "$HTML_DIR"
cp -R ~/bp/v86/images/debian-9p-rootfs-flat "$HTML_DIR"

cp ~/bp/v86/build/libv86.js "$HTML_DIR"
cp ~/bp/v86/build/v86.wasm "$HTML_DIR"
cp ~/bp/v86/examples/debian.html "$HTML_DIR"

The core of it is that you populate the build directory with the 2 files from the main website. This way I was able to focus on just getting the debian image working. The next step is to install scarletdme into it so that it can act as multivalue repl.

Once you have this done, you can edit the debian.html file to remove the relative paths and change them to absolute paths. Then you can navigate to debian.html in the browser and you should see your brand spanking new debian installation running in the browser.