From a41b280333119712a8c52553bf582b0d74a2daed Mon Sep 17 00:00:00 2001 From: alexkar598 <25136265+alexkar598@users.noreply.github.com> Date: Fri, 21 Jun 2024 23:54:48 -0400 Subject: [PATCH] Updates buildroot + switches from ISOs to directly booting a bzImage and a initramfs + makes the kernel even leaner --- .gitignore | 2 ++ src/environments/environment.development.ts | 2 +- src/environments/environment.ts | 2 +- src/utils/literalConstants.ts | 2 +- src/vm/emulator.service.ts | 4 ++-- src/vm/emulator.worker.ts | 16 +++++++++------- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 677dbb0..60800c9 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,5 @@ testem.log Thumbs.db public/lib/rootfs.iso +public/lib/*.cpio* +public/lib/bzImage diff --git a/src/environments/environment.development.ts b/src/environments/environment.development.ts index e7111d2..9d56da8 100644 --- a/src/environments/environment.development.ts +++ b/src/environments/environment.development.ts @@ -1,3 +1,3 @@ export const environment = { - isoUrl: './lib/rootfs.iso', + vmSourceUrl: './lib/', }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 4667f0e..015fc0d 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1,3 +1,3 @@ export const environment = { - isoUrl: 'https://spacestation13.github.io/dm-playground-linux/rootfs.iso9660', + vmSourceUrl: 'https://spacestation13.github.io/dm-playground-linux/', }; diff --git a/src/utils/literalConstants.ts b/src/utils/literalConstants.ts index cbcf1e2..c225df7 100644 --- a/src/utils/literalConstants.ts +++ b/src/utils/literalConstants.ts @@ -1 +1 @@ -export const isoUrlSearchParameter = 'isoUrl'; +export const vmRemoteUrlSearchParameter = 'vmRemoteUrl'; diff --git a/src/vm/emulator.service.ts b/src/vm/emulator.service.ts index 79d9a7f..00e032e 100644 --- a/src/vm/emulator.service.ts +++ b/src/vm/emulator.service.ts @@ -1,7 +1,7 @@ import { EventEmitter, Injectable, Output } from '@angular/core'; import type { WorkerMsgWithoutCID, WorkerResponseMsg } from './emulator.worker'; import { environment } from '../environments/environment'; -import { isoUrlSearchParameter } from '../utils/literalConstants'; +import { vmRemoteUrlSearchParameter } from '../utils/literalConstants'; const encoder = new TextEncoder(); @@ -27,7 +27,7 @@ export class EmulatorService { new (url: URL): Worker; } const Worker = function (url: URL) { - url.searchParams.set(isoUrlSearchParameter, environment.isoUrl); + url.searchParams.set(vmRemoteUrlSearchParameter, environment.vmSourceUrl); return new window.Worker(url); } as unknown as FakeWorker; this.worker = new Worker(new URL('./emulator.worker', import.meta.url)); diff --git a/src/vm/emulator.worker.ts b/src/vm/emulator.worker.ts index 1292d99..06d0ccf 100644 --- a/src/vm/emulator.worker.ts +++ b/src/vm/emulator.worker.ts @@ -1,6 +1,5 @@ /// - -import { isoUrlSearchParameter } from '../utils/literalConstants'; +import { vmRemoteUrlSearchParameter } from '../utils/literalConstants'; importScripts('./lib/libv86.js'); @@ -130,17 +129,20 @@ const emulator = new V86({ vga_bios: { url: 'https://raw.githubusercontent.com/copy/v86/master/bios/vgabios.bin', }, - cdrom: { - url: parameters.get(isoUrlSearchParameter), - }, + cdrom: null, hda: null, hdb: null, fda: null, fdb: null, initial_state: null, multiboot: null, - bzimage: null, - initrd: null, + bzimage: { + url: parameters.get(vmRemoteUrlSearchParameter) + 'bzImage', + }, + initrd: { + url: parameters.get(vmRemoteUrlSearchParameter) + 'rootfs.cpio.lz4', + async: true, + }, //9p filesystem, { basefs: string, baseurl: string } or {} filesystem: {}, //Loads bzimage and initrd from 9p filesystem