From 56257e6f69ea999ac6fea263aec005209ca34f52 Mon Sep 17 00:00:00 2001 From: Alessandro Pignotti Date: Sat, 5 Oct 2024 19:11:05 +0200 Subject: [PATCH] Initialize the CheerpX engine --- src/App.svelte | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/App.svelte b/src/App.svelte index c348442..cb46614 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -61,6 +61,31 @@ default: throw new Error("Unrecognized device type"); } + var overlayDevice = await CheerpX.OverlayDevice.create(blockDevice, await CheerpX.IDBDevice.create("block1")); + var webDevice = await CheerpX.WebDevice.create(""); + var dataDevice = await CheerpX.DataDevice.create(); + var mountPoints = [ + // The root filesystem, as an Ext2 image + {type:"ext2", dev:overlayDevice, path:"/"}, + // Access to files on the Web server, relative to the current page + {type:"dir", dev:webDevice, path:"/web"}, + // Access to read-only data coming from JavaScript + {type:"dir", dev:dataDevice, path:"/data"}, + // Automatically created device files + {type:"devs", path:"/dev"}, + // The Linux 'proc' filesystem which provides information about running processes + {type:"proc", path:"/proc"} + ]; + var cx = null; + try + { + cx = await CheerpX.Linux.create({mounts: mountPoints}); + } + catch(e) + { + // TODO: Print error message on console + throw e; + } } onMount(initTerminal);