Skip to content

blocklessnetwork/v86-wasi

Repository files navigation

Blockless WASI-v86 Extension

Blockless WASI-v86 Extension is an emulated v86 machine inside the Blockless Runtime Environment.

How to Run with release binary file

1. Running without network.

$ curl -s https://raw.githubusercontent.com/blocklessnetwork/v86-wasi/main/download.sh|bash

2. Running with network.

$ curl -s https://raw.githubusercontent.com/blocklessnetwork/v86-wasi/main/download.sh|sudo bash

start the network interface.

Use follow command start the network interface in the web terminal.

# /etc/init.d/network start

Use the following command to verify whether the interface has started.

# ifconfig
# ping 192.168.0.1

start the telnetd service.

Use follow command start the telnetd service in the web terminal.

# /etc/init.d/telnetd start

After starting the telnetd service, please use the following command on the host to login to the VM

$ telnet 192.168.0.2

Use follow command stop the telnetd service in the web terminal.

# /etc/init.d/telnetd stop

start the ftpd service.

Use follow command start the ftpd service in the web terminal.

# /etc/init.d/ftpd start

After starting the ftpd service, please use the following command on the host to login to the VM

$ ftp 192.168.0.2

Use follow command stop the ftpd service in the web terminal.

# /etc/init.d/ftpd stop

How to build test applet with golang.

Build the applet in host.

$ export GOOS=linux
$ export GOARCH=386
$ go build svr_applet.go

How to build.

1. Build wasm

install wasm-unknown-unknown target

$ rustup target add wasm32-unknown-unknown

use the follow command to generate the wasm file.

$ make release

2. Modify the config file.

The follow is the configure file

{
  "cdrom": "arch/blockless.iso",
  "bios_file": "arch/seabios.bin",
  "vga_bios_file": "arch/vgabios.bin",
  "wasm_file": "target/v86.wasm",
  "memory_size": 134217728,
  "vga_memory_size": 8388608,
  "cmdline": ["tsc=reliable mitigations=off random.trust_cpu=on"],
  "logger": {
    "log_file": "debug.log",
    "log_module": ["E", "BIOS", "NET"]
  },
  "tun": {
    "address": "192.168.0.1",
    "netmask": "255.255.255.0",
    "ether_address": "00:22:15:fe:ae:ba"
  },
  "muiltiboot_order": ["bin", "cdrom"]
}

3. Run the test linux

use the following command to run the linux with the configure file.

$ cargo run --release ./boot.json

After run the VM, you can open the "term.html" file for control the VM.

DIY the linux iso

If you wanna DIY the linux by yourself, please see the document "https://github.com/blocklessnetwork/build-blockless-linux"

V86 Lib compilation

cargo build --release

This will generate a libv86_lib.dylib file for your machine arch (which can be packaged in the car format to be run in the runtime)