From 558e0f9d7c8e82e7b60db71282b9541dfa604295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A8=D0=B0?= =?UTF-8?q?=D0=BD=D0=B3=D0=B8=D0=BD?= Date: Fri, 24 Jun 2022 16:30:27 +0800 Subject: [PATCH] Improve Debian build info (#696) --- examples/debian.html | 26 ++++++++++++++++++++++++++ tools/docker/debian/Readme.md | 19 ++++++++++++++++++- tools/docker/debian/build-container.sh | 16 +++++++++------- 3 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 examples/debian.html diff --git a/examples/debian.html b/examples/debian.html new file mode 100644 index 00000000..877550d2 --- /dev/null +++ b/examples/debian.html @@ -0,0 +1,26 @@ + +Debian + + + + + +
+
+ +
diff --git a/tools/docker/debian/Readme.md b/tools/docker/debian/Readme.md index d79c5079..eaaa2ce7 100644 --- a/tools/docker/debian/Readme.md +++ b/tools/docker/debian/Readme.md @@ -2,7 +2,24 @@ 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 -Go to `debug.html?profile=debian` to start the generated container. +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. diff --git a/tools/docker/debian/build-container.sh b/tools/docker/debian/build-container.sh index fd4ff4b5..5355f2b0 100755 --- a/tools/docker/debian/build-container.sh +++ b/tools/docker/debian/build-container.sh @@ -1,22 +1,24 @@ #!/usr/bin/env bash set -veu -OUT_ROOTFS_TAR=$(dirname "$0")/../../../images/debian-9p-rootfs.tar -OUT_ROOTFS_FLAT=$(dirname "$0")/../../../images/debian-9p-rootfs-flat -OUT_FSJSON=$(dirname "$0")/../../../images/debian-base-fs.json +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 -docker build . --rm --tag "$IMAGE_NAME" +mkdir -p "$IMAGES" +docker build . --platform linux/386 --rm --tag "$IMAGE_NAME" docker rm "$CONTAINER_NAME" || true -docker create -t -i --name "$CONTAINER_NAME" "$IMAGE_NAME" bash +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" +"$(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" +"$(dirname "$0")"/../../../tools/copy-to-sha256.py "$OUT_ROOTFS_TAR" "$OUT_ROOTFS_FLAT" echo "$OUT_ROOTFS_TAR", "$OUT_ROOTFS_FLAT" and "$OUT_FSJSON" created.