mirror of
https://github.com/copy/v86.git
synced 2026-10-12 02:12:23 +00:00
remove debian image build scripts
The alpine scripts are much simpler, don't need root and alpine runs better in v86
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
<!doctype html>
|
||||
<title>Debian</title>
|
||||
|
||||
<script src="../build/libv86.js"></script>
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
var emulator = new V86({
|
||||
wasm_path: "../build/v86.wasm",
|
||||
memory_size: 512 * 1024 * 1024,
|
||||
vga_memory_size: 8 * 1024 * 1024,
|
||||
screen_container: document.getElementById("screen_container"),
|
||||
initial_state: { url: "../images/debian-state-base.bin" },
|
||||
filesystem: { baseurl: "../images/debian-9p-rootfs-flat/" },
|
||||
autostart: true,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- A minimal structure for the ScreenAdapter defined in browser/screen.js -->
|
||||
<div id="screen_container">
|
||||
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
|
||||
<canvas style="display: none"></canvas>
|
||||
</div>
|
||||
@@ -1,69 +0,0 @@
|
||||
FROM i386/debian:buster
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
RUN apt update && \
|
||||
apt --yes --no-install-recommends install \
|
||||
linux-image-686 grub2 systemd \
|
||||
libterm-readline-perl-perl \
|
||||
gcc make libc6-dev \
|
||||
unzip bzip2 xz-utils \
|
||||
fluxbox \
|
||||
xserver-xorg-input-kbd xserver-xorg-input-mouse xserver-xorg-input-evdev \
|
||||
xserver-xorg-video-fbdev xserver-xorg-video-vesa \
|
||||
xserver-xorg x11-xserver-utils xinit dbus-x11 \
|
||||
libgdk-pixbuf2.0 libpango-1.0 libpangocairo-1.0 libgtk2.0-bin \
|
||||
libc-l10n locales \
|
||||
fonts-noto fonts-droid-fallback \
|
||||
strace file xterm vim apt-file \
|
||||
dhcpcd5 \
|
||||
wget curl \
|
||||
net-tools netcat \
|
||||
wmctrl xdotool \
|
||||
mesa-utils libgl1-mesa-dri \
|
||||
&& \
|
||||
touch /root/.Xdefaults && \
|
||||
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
|
||||
locale-gen && \
|
||||
echo 'LANG="en_US.UTF-8"' > /etc/default/locale && \
|
||||
chsh -s /bin/bash && \
|
||||
echo "root:root" | chpasswd && \
|
||||
mkdir -p /etc/systemd/system/[email protected]/ && \
|
||||
systemctl enable [email protected] && \
|
||||
rm /lib/systemd/system/getty.target.wants/getty-static.service && \
|
||||
rm /etc/motd /etc/issue && \
|
||||
systemctl disable systemd-timesyncd.service && \
|
||||
systemctl disable apt-daily.timer && \
|
||||
systemctl disable apt-daily-upgrade.timer && \
|
||||
systemctl disable dhcpcd.service && \
|
||||
echo "tmpfs /tmp tmpfs nodev,nosuid 0 0" >> /etc/fstab && \
|
||||
cd /root/ && \
|
||||
wget http://www.math.utah.edu/~mayer/linux/nbench-byte-2.2.3.tar.gz && \
|
||||
tar xfv nbench-byte-2.2.3.tar.gz && \
|
||||
rm nbench-byte-2.2.3.tar.gz && \
|
||||
mv nbench-byte-2.2.3 bench && \
|
||||
cd bench && \
|
||||
make
|
||||
|
||||
COPY getty-noclear.conf getty-override.conf /etc/systemd/system/[email protected]/
|
||||
COPY getty-autologin-serial.conf /etc/systemd/system/[email protected]/
|
||||
|
||||
COPY logind.conf /etc/systemd/logind.conf
|
||||
|
||||
#COPY xinitrc /root/.xinitrc
|
||||
COPY xorg.conf /etc/X11/
|
||||
COPY networking.sh /root/
|
||||
|
||||
COPY boot-9p /etc/initramfs-tools/scripts/boot-9p
|
||||
|
||||
# this needs to be commented out in order to boot from hdd
|
||||
RUN printf '%s\n' 9p 9pnet 9pnet_virtio virtio virtio_ring virtio_pci | tee -a /etc/initramfs-tools/modules && \
|
||||
echo 'BOOT=boot-9p' | tee -a /etc/initramfs-tools/initramfs.conf && \
|
||||
update-initramfs -u
|
||||
|
||||
RUN apt-get --yes clean && \
|
||||
rm -r /var/lib/apt/lists/* && \
|
||||
rm -r /usr/share/doc/* && \
|
||||
rm -r /usr/share/man/* && \
|
||||
rm -r /usr/share/locale/?? && \
|
||||
rm /var/log/*.log /var/log/lastlog /var/log/wtmp /var/log/apt/*.log /var/log/apt/*.xz
|
||||
@@ -1,25 +0,0 @@
|
||||
You can build a Linux image for use with v86:
|
||||
|
||||
1. Run `./build-container.sh` to build the Docker container and v86 images (requires dockerd)
|
||||
2. Run `./build-state.js` to build a state image in order to skip the boot process
|
||||
3. Optionally, compress the `debian-state-base.bin` file using zstd (v86 automatically detects the zstd magic and decompresses on the fly)
|
||||
4. Run a webserver serving repo root and go to `examples/debian.html` in a browser
|
||||
|
||||
If you want to see more info you can run it in a debug mode, to do so add a new profile in the `src/browser/main.js` file to the `oses` variable like so:
|
||||
|
||||
```js
|
||||
var oses = [
|
||||
{
|
||||
id: "debian",
|
||||
name: "Debian",
|
||||
memory_size: 512 * 1024 * 1024,
|
||||
vga_memory_size: 8 * 1024 * 1024,
|
||||
state: { url: host + "debian-state-base.bin" },
|
||||
filesystem: { baseurl: host + "debian-9p-rootfs-flat/" }
|
||||
},
|
||||
...
|
||||
```
|
||||
|
||||
Save it and go to `debug.html?profile=debian` to start the generated container.
|
||||
|
||||
You can modify the `Dockerfile` to customize the generated Linux image.
|
||||
@@ -1,33 +0,0 @@
|
||||
# 9p filesystem mounting -*- shell-script -*-
|
||||
|
||||
mountroot()
|
||||
{
|
||||
wait_for_udev 10
|
||||
|
||||
if [ ${readonly} = y ]; then
|
||||
roflag="-o ro"
|
||||
else
|
||||
roflag="-o rw"
|
||||
fi
|
||||
|
||||
#echo "Running: mount -t 9p -o cache=mmap ${ROOT} ${rootmnt}"
|
||||
#mount -t 9p -o cache=mmap ${ROOT} ${rootmnt}
|
||||
echo "Running: mount -t 9p -o cache=fscache ${ROOT} ${rootmnt}"
|
||||
mount -t 9p -o cache=fscache ${ROOT} ${rootmnt}
|
||||
echo "mount finished with code $?"
|
||||
}
|
||||
|
||||
mount_top()
|
||||
{
|
||||
echo top
|
||||
}
|
||||
|
||||
mount_premount()
|
||||
{
|
||||
echo premount
|
||||
}
|
||||
|
||||
mount_bottom()
|
||||
{
|
||||
echo bottom
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -veu
|
||||
|
||||
IMAGES="$(dirname "$0")"/../../../images
|
||||
OUT_ROOTFS_TAR="$IMAGES"/debian-9p-rootfs.tar
|
||||
OUT_ROOTFS_FLAT="$IMAGES"/debian-9p-rootfs-flat
|
||||
OUT_FSJSON="$IMAGES"/debian-base-fs.json
|
||||
CONTAINER_NAME=debian-full
|
||||
IMAGE_NAME=i386/debian-full
|
||||
|
||||
mkdir -p "$IMAGES"
|
||||
docker build . --platform linux/386 --rm --tag "$IMAGE_NAME"
|
||||
docker rm "$CONTAINER_NAME" || true
|
||||
docker create --platform linux/386 -t -i --name "$CONTAINER_NAME" "$IMAGE_NAME" bash
|
||||
|
||||
docker export "$CONTAINER_NAME" > "$OUT_ROOTFS_TAR"
|
||||
|
||||
"$(dirname "$0")"/../../../tools/fs2json.py --out "$OUT_FSJSON" "$OUT_ROOTFS_TAR"
|
||||
|
||||
# Note: Not deleting old files here
|
||||
mkdir -p "$OUT_ROOTFS_FLAT"
|
||||
"$(dirname "$0")"/../../../tools/copy-to-sha256.py "$OUT_ROOTFS_TAR" "$OUT_ROOTFS_FLAT"
|
||||
|
||||
echo "$OUT_ROOTFS_TAR", "$OUT_ROOTFS_FLAT" and "$OUT_FSJSON" created.
|
||||
@@ -1,93 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
|
||||
// TODO:
|
||||
// - Timeout
|
||||
|
||||
console.log("Don't forget to run `make all` before running this script");
|
||||
|
||||
var fs = require("fs");
|
||||
var V86 = require("./../../../build/libv86.js").V86;
|
||||
|
||||
const V86_ROOT = path.join(__dirname, "../../..");
|
||||
|
||||
var OUTPUT_FILE = path.join(V86_ROOT, "images/debian-state-base.bin");
|
||||
|
||||
process.stdin.setRawMode(true);
|
||||
process.stdin.resume();
|
||||
process.stdin.setEncoding("utf8");
|
||||
process.stdin.on("data", handle_key);
|
||||
|
||||
var emulator = new V86({
|
||||
bios: { url: path.join(V86_ROOT, "/bios/seabios.bin") },
|
||||
vga_bios: { url: path.join(V86_ROOT, "/bios/vgabios.bin") },
|
||||
autostart: true,
|
||||
memory_size: 512 * 1024 * 1024,
|
||||
vga_memory_size: 8 * 1024 * 1024,
|
||||
network_relay_url: "<UNUSED>",
|
||||
bzimage_initrd_from_filesystem: true,
|
||||
cmdline: "rw init=/bin/systemd root=host9p console=ttyS0 spectre_v2=off pti=off",
|
||||
filesystem: {
|
||||
basefs: {
|
||||
url: path.join(V86_ROOT, "/images/debian-base-fs.json"),
|
||||
},
|
||||
baseurl: path.join(V86_ROOT, "/images/debian-9p-rootfs-flat/"),
|
||||
},
|
||||
screen_dummy: true,
|
||||
});
|
||||
|
||||
console.log("Now booting, please stand by ...");
|
||||
|
||||
var boot_start = Date.now();
|
||||
var serial_text = "";
|
||||
let booted = false;
|
||||
|
||||
emulator.add_listener("serial0-output-byte", function(byte)
|
||||
{
|
||||
var c = String.fromCharCode(byte);
|
||||
process.stdout.write(c);
|
||||
|
||||
serial_text += c;
|
||||
|
||||
if(!booted && serial_text.endsWith("root@localhost:~# "))
|
||||
{
|
||||
console.error("\nBooted in %d", (Date.now() - boot_start) / 1000);
|
||||
booted = true;
|
||||
|
||||
// sync and drop caches: Makes it safer to change the filesystem as fewer files are rendered
|
||||
emulator.serial0_send("sync;echo 3 >/proc/sys/vm/drop_caches\n");
|
||||
|
||||
setTimeout(async function ()
|
||||
{
|
||||
const s = await emulator.save_state();
|
||||
|
||||
fs.writeFile(OUTPUT_FILE, new Uint8Array(s), function(e)
|
||||
{
|
||||
if(e) throw e;
|
||||
console.error("Saved as " + OUTPUT_FILE);
|
||||
stop();
|
||||
});
|
||||
}, 10 * 1000);
|
||||
}
|
||||
});
|
||||
|
||||
function handle_key(c)
|
||||
{
|
||||
if(c === "\u0003")
|
||||
{
|
||||
// ctrl c
|
||||
stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
emulator.serial0_send(c);
|
||||
}
|
||||
}
|
||||
|
||||
function stop()
|
||||
{
|
||||
emulator.stop();
|
||||
process.stdin.pause();
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=-/sbin/agetty --autologin root --noissue --noclear -s %I 115200,38400,9600 vt102
|
||||
@@ -1,2 +0,0 @@
|
||||
[Service]
|
||||
TTYVTDisallocate=no
|
||||
@@ -1,3 +0,0 @@
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=-/sbin/agetty --autologin root --noissue --noclear %I 38400 $TERM
|
||||
@@ -1,37 +0,0 @@
|
||||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Entries in this file show the compile time defaults.
|
||||
# You can change settings by editing this file.
|
||||
# Defaults can be restored by simply deleting this file.
|
||||
#
|
||||
# See logind.conf(5) for details.
|
||||
|
||||
[Login]
|
||||
NAutoVTs=0
|
||||
ReserveVT=0
|
||||
#KillUserProcesses=no
|
||||
#KillOnlyUsers=
|
||||
#KillExcludeUsers=root
|
||||
#InhibitDelayMaxSec=5
|
||||
#HandlePowerKey=poweroff
|
||||
#HandleSuspendKey=suspend
|
||||
#HandleHibernateKey=hibernate
|
||||
#HandleLidSwitch=suspend
|
||||
#HandleLidSwitchDocked=ignore
|
||||
#PowerKeyIgnoreInhibited=no
|
||||
#SuspendKeyIgnoreInhibited=no
|
||||
#HibernateKeyIgnoreInhibited=no
|
||||
#LidSwitchIgnoreInhibited=yes
|
||||
#HoldoffTimeoutSec=30s
|
||||
#IdleAction=ignore
|
||||
#IdleActionSec=30min
|
||||
#RuntimeDirectorySize=10%
|
||||
#RemoveIPC=yes
|
||||
#InhibitorsMax=8192
|
||||
#SessionsMax=8192
|
||||
#UserTasksMax=33%
|
||||
@@ -1,4 +0,0 @@
|
||||
rmmod ne2k-pci && modprobe ne2k-pci
|
||||
ifconfig enp0s5 192.168.1.5 netmask 255.255.255.0 up
|
||||
route add default gw 192.168.1.1
|
||||
echo "nameserver 8.8.8.8" > /etc/resolv.conf
|
||||
@@ -1,67 +0,0 @@
|
||||
Section "ServerLayout"
|
||||
Identifier "X.org Configured"
|
||||
Screen 0 "Screen0" 0 0
|
||||
InputDevice "Mouse0" "CorePointer"
|
||||
InputDevice "Keyboard0" "CoreKeyboard"
|
||||
EndSection
|
||||
|
||||
Section "Files"
|
||||
ModulePath "/usr/lib/xorg/modules"
|
||||
FontPath "/usr/share/fonts/misc/"
|
||||
FontPath "/usr/share/fonts/TTF/"
|
||||
#FontPath "/usr/share/fonts/OTF/"
|
||||
#FontPath "/usr/share/fonts/Type1/"
|
||||
FontPath "/usr/share/fonts/100dpi/"
|
||||
FontPath "/usr/share/fonts/75dpi/"
|
||||
EndSection
|
||||
|
||||
Section "Module"
|
||||
Load "glx"
|
||||
EndSection
|
||||
|
||||
Section "InputDevice"
|
||||
Identifier "Keyboard0"
|
||||
Driver "kbd"
|
||||
EndSection
|
||||
|
||||
Section "InputDevice"
|
||||
Identifier "Mouse0"
|
||||
Driver "mouse"
|
||||
Option "Protocol" "auto"
|
||||
Option "Device" "/dev/input/mice"
|
||||
Option "ZAxisMapping" "4 5 6 7"
|
||||
EndSection
|
||||
|
||||
Section "Monitor"
|
||||
Identifier "Monitor0"
|
||||
VendorName "Monitor Vendor"
|
||||
ModelName "Monitor Model"
|
||||
EndSection
|
||||
|
||||
Section "Device"
|
||||
### Available Driver options are:-
|
||||
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
|
||||
### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
|
||||
### <percent>: "<f>%"
|
||||
### [arg]: arg optional
|
||||
#Option "ShadowFB" # [<bool>]
|
||||
#Option "Rotate" # <str>
|
||||
#Option "fbdev" # <str>
|
||||
#Option "debug" # [<bool>]
|
||||
Identifier "Card0"
|
||||
Driver "fbdev"
|
||||
#BusID "PCI:0:2:0"
|
||||
Driver "vesa"
|
||||
EndSection
|
||||
|
||||
Section "Screen"
|
||||
Identifier "Screen0"
|
||||
Device "Card0"
|
||||
Monitor "Monitor0"
|
||||
SubSectionSub "Display"
|
||||
#Viewport 0 0
|
||||
Depth 24
|
||||
Modes "1280x1024"
|
||||
EndSubSection
|
||||
EndSection
|
||||
|
||||
Reference in New Issue
Block a user