diff --git a/buildroot-v86/.config.busybox b/buildroot-v86/.config.busybox index 56c6524..d104550 100644 --- a/buildroot-v86/.config.busybox +++ b/buildroot-v86/.config.busybox @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Busybox version: 1.33.0 -# Wed Oct 2 12:49:15 2024 +# Mon Oct 14 15:09:24 2024 # CONFIG_HAVE_DOT_CONFIG=y @@ -1129,41 +1129,41 @@ CONFIG_ASH_GETOPTS=y CONFIG_ASH_CMDCMD=y # CONFIG_CTTYHACK is not set # CONFIG_HUSH is not set -CONFIG_SHELL_HUSH=y -CONFIG_HUSH_BASH_COMPAT=y -CONFIG_HUSH_BRACE_EXPANSION=y -CONFIG_HUSH_LINENO_VAR=y +# CONFIG_SHELL_HUSH is not set +# CONFIG_HUSH_BASH_COMPAT is not set +# CONFIG_HUSH_BRACE_EXPANSION is not set +# CONFIG_HUSH_LINENO_VAR is not set # CONFIG_HUSH_BASH_SOURCE_CURDIR is not set -CONFIG_HUSH_INTERACTIVE=y -CONFIG_HUSH_SAVEHISTORY=y -CONFIG_HUSH_JOB=y -CONFIG_HUSH_TICK=y -CONFIG_HUSH_IF=y -CONFIG_HUSH_LOOPS=y -CONFIG_HUSH_CASE=y -CONFIG_HUSH_FUNCTIONS=y -CONFIG_HUSH_LOCAL=y -CONFIG_HUSH_RANDOM_SUPPORT=y -CONFIG_HUSH_MODE_X=y -CONFIG_HUSH_ECHO=y -CONFIG_HUSH_PRINTF=y -CONFIG_HUSH_TEST=y -CONFIG_HUSH_HELP=y -CONFIG_HUSH_EXPORT=y -CONFIG_HUSH_EXPORT_N=y -CONFIG_HUSH_READONLY=y -CONFIG_HUSH_KILL=y -CONFIG_HUSH_WAIT=y -CONFIG_HUSH_COMMAND=y -CONFIG_HUSH_TRAP=y -CONFIG_HUSH_TYPE=y -CONFIG_HUSH_TIMES=y -CONFIG_HUSH_READ=y -CONFIG_HUSH_SET=y -CONFIG_HUSH_UNSET=y -CONFIG_HUSH_ULIMIT=y -CONFIG_HUSH_UMASK=y -CONFIG_HUSH_GETOPTS=y +# CONFIG_HUSH_INTERACTIVE is not set +# CONFIG_HUSH_SAVEHISTORY is not set +# CONFIG_HUSH_JOB is not set +# CONFIG_HUSH_TICK is not set +# CONFIG_HUSH_IF is not set +# CONFIG_HUSH_LOOPS is not set +# CONFIG_HUSH_CASE is not set +# CONFIG_HUSH_FUNCTIONS is not set +# CONFIG_HUSH_LOCAL is not set +# CONFIG_HUSH_RANDOM_SUPPORT is not set +# CONFIG_HUSH_MODE_X is not set +# CONFIG_HUSH_ECHO is not set +# CONFIG_HUSH_PRINTF is not set +# CONFIG_HUSH_TEST is not set +# CONFIG_HUSH_HELP is not set +# CONFIG_HUSH_EXPORT is not set +# CONFIG_HUSH_EXPORT_N is not set +# CONFIG_HUSH_READONLY is not set +# CONFIG_HUSH_KILL is not set +# CONFIG_HUSH_WAIT is not set +# CONFIG_HUSH_COMMAND is not set +# CONFIG_HUSH_TRAP is not set +# CONFIG_HUSH_TYPE is not set +# CONFIG_HUSH_TIMES is not set +# CONFIG_HUSH_READ is not set +# CONFIG_HUSH_SET is not set +# CONFIG_HUSH_UNSET is not set +# CONFIG_HUSH_ULIMIT is not set +# CONFIG_HUSH_UMASK is not set +# CONFIG_HUSH_GETOPTS is not set # CONFIG_HUSH_MEMLEAK is not set # @@ -1194,6 +1194,6 @@ CONFIG_FEATURE_REMOTE_LOG=y # CONFIG_FEATURE_SYSLOGD_CFG is not set # CONFIG_FEATURE_SYSLOGD_PRECISE_TIMESTAMPS is not set CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256 -CONFIG_FEATURE_IPC_SYSLOG=y -CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16 +# CONFIG_FEATURE_IPC_SYSLOG is not set +CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0 # CONFIG_FEATURE_KMSG_SYSLOG is not set diff --git a/buildroot-v86/board/v86/rootfs_overlay/etc/profile.js b/buildroot-v86/board/v86/rootfs_overlay/etc/profile.js index 19b71b8..73a8f6b 100644 --- a/buildroot-v86/board/v86/rootfs_overlay/etc/profile.js +++ b/buildroot-v86/board/v86/rootfs_overlay/etc/profile.js @@ -3,7 +3,7 @@ // do once (remember /etc/profile gets sources multiple times!) if( !window['/etc/profile.js'] ){ - const isoterminal = document.querySelector('[isoterminal]').components.isoterminal.isoterminal + const isoterminal = document.querySelector('[isoterminal]').components.isoterminal.term const scene = document.querySelector('a-scene') diff --git a/buildroot-v86/board/v86/rootfs_overlay/etc/profile.xrsh b/buildroot-v86/board/v86/rootfs_overlay/etc/profile.xrsh index bb5f8d0..d496dd9 100644 --- a/buildroot-v86/board/v86/rootfs_overlay/etc/profile.xrsh +++ b/buildroot-v86/board/v86/rootfs_overlay/etc/profile.xrsh @@ -38,22 +38,14 @@ test -d /dev/browser || { # listen for shell cmds passed to v86 from browser # (via isoterminal.exec(...)) stty raw < /dev/ttyS1 - #cat /dev/ttyS1 | xargs -I{} /bin/sh -c 'logger "isoterminal.exec({})"; {}' mkfifo /var/run/ttyS1 - echo "source /etc/profile" >> /var/run/ttyS1 cat /dev/ttyS1 > /var/run/ttyS1 & /bin/sh < /var/run/ttyS1 } setup_listen_homedir(){ sleep 4 # wait for inode of /mnt/root to become live (due to move_root_to_9pfs) - infinite inotifyd echo /mnt/root | awk ' - - # listen for writes to rootdir and send them to DOM - /^[we] \/mnt\/root index\.html/ { system("cat "$2"/"$3" | grep -vE \"^#!\" > /dev/browser/html") } - /^[we] \/mnt\/root index\.js/ { system("cat "$2"/"$3" | grep -vE \"^#!\" > /dev/browser/js") } - - ' + /mnt/root/bin/watchfs & } move_root_to_9pfs @@ -62,5 +54,5 @@ test -d /dev/browser || { setup_network setup_overlayfs setup_incoming_cmds & - setup_listen_homedir & + setup_listen_homedir } diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/.profile b/buildroot-v86/board/v86/rootfs_overlay/root/.profile index 2fce740..9c13f65 100644 --- a/buildroot-v86/board/v86/rootfs_overlay/root/.profile +++ b/buildroot-v86/board/v86/rootfs_overlay/root/.profile @@ -4,9 +4,9 @@ alias exitVR='js "document.querySelector(\"a-scene\").enterVR()"' alias exitAR='js "document.querySelector(\"a-scene\").enterAR()"' # (new)user friendlyness -alias vi='echo "HINT: type :q (and press enter) to quit\n[press a key]";read;vi'; -alias mg='echo "HINT: type Ctrl+c Ctrl-x to quit\n[press a key]";read;me'; -alias nano='echo "HINT: type Ctrl+x to quit\n[press a key]" ;read;nano'; +alias vi='echo -e "HINT: type :q (and press enter) to quit\n[press a key]";read;vi'; +alias mg='echo -e "HINT: type Ctrl+c Ctrl-x to quit\n[press a key]";read;mg'; +alias nano='echo -e "HINT: type Ctrl+x to quit\n[press a key]" ;read;nano'; # start index.js test -f index.js && chmod +x index.js && ./index.js | grep -v undefined diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/bin/codemirror b/buildroot-v86/board/v86/rootfs_overlay/root/bin/codemirror index 1b09e59..e9194ab 100755 --- a/buildroot-v86/board/v86/rootfs_overlay/root/bin/codemirror +++ b/buildroot-v86/board/v86/rootfs_overlay/root/bin/codemirror @@ -1,24 +1,25 @@ #!/bin/js -(async function(){ +if( args[1] == undefined ) return "usage: codemirror " - await AFRAME.utils.require({ +AFRAME.utils.require({ codemirrorjs: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.1/codemirror.js", codemirrorcss: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/codemirror.css", cmtheme: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/theme/shadowfox.css" +}) +.then( () => AFRAME.utils.require({ + cmxml: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/xml/xml.js", + cmjavascript: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/javascript/javascript.js", + cmcss: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/css/css.js", + highlight: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/htmlmixed/htmlmixed.js", + codemirrorAF: "com/codemirror.js" }) - - await AFRAME.utils.require({ - cmxml: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/xml/xml.js", - cmjavascript: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/javascript/javascript.js", - cmcss: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/css/css.js", - highlight: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/htmlmixed/htmlmixed.js", - codemirrorAF: "com/codemirror.js" - }) - - document.querySelector("a-entity#root").innerHTML += `` - -})() +) +.then( () => { + let el = document.createElement("a-entity") + el.setAttribute("codemirror", `file: ${args[1]}`) + document.querySelector("a-scene").appendChild(el) +}) return "" // empty stdout(put) diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/bin/save b/buildroot-v86/board/v86/rootfs_overlay/root/bin/save index b344390..45888ac 100755 --- a/buildroot-v86/board/v86/rootfs_overlay/root/bin/save +++ b/buildroot-v86/board/v86/rootfs_overlay/root/bin/save @@ -2,7 +2,7 @@ source /etc/profile.sh javascript=' - const isoterminal = document.querySelector("[isoterminal]").components.isoterminal.isoterminal + const isoterminal = document.querySelector("[isoterminal]").components.isoterminal.term isoterminal.save() return "[OK] xrsh state saved\n" ' diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/bin/watchfs b/buildroot-v86/board/v86/rootfs_overlay/root/bin/watchfs new file mode 100755 index 0000000..f2ee5ef --- /dev/null +++ b/buildroot-v86/board/v86/rootfs_overlay/root/bin/watchfs @@ -0,0 +1,9 @@ +#!/bin/sh + +infinite inotifyd echo /mnt/root | awk ' + + # listen for writes to rootdir and send them to DOM + /^[ce] \/mnt\/root index\.html/ { system("cat "$2"/"$3" | grep -vE \"^#!\" > /dev/browser/html") } + /^[ce] \/mnt\/root index\.js/ { system("cat "$2"/"$3" | grep -vE \"^#!\" > /dev/browser/js") } + +' diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/hook.d/wakeup/reload.sh b/buildroot-v86/board/v86/rootfs_overlay/root/hook.d/wakeup/reload.sh new file mode 100755 index 0000000..611192f --- /dev/null +++ b/buildroot-v86/board/v86/rootfs_overlay/root/hook.d/wakeup/reload.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# intialize global funcs +/root/index.js &> /dev/null + +# initialize scene +/root/index.html &> /dev/null + diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/index.html b/buildroot-v86/board/v86/rootfs_overlay/root/index.html index e92552b..d3d1591 100755 --- a/buildroot-v86/board/v86/rootfs_overlay/root/index.html +++ b/buildroot-v86/board/v86/rootfs_overlay/root/index.html @@ -3,3 +3,11 @@ + + + + + + diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/index.js b/buildroot-v86/board/v86/rootfs_overlay/root/index.js index 4bbd223..5f59346 100755 --- a/buildroot-v86/board/v86/rootfs_overlay/root/index.js +++ b/buildroot-v86/board/v86/rootfs_overlay/root/index.js @@ -1,2 +1,17 @@ #!/bin/js console.log("/root/index.js: hello world") + +function doTHREE(){ + const scene = AFRAME.scenes[0] + const object = new THREE.Mesh( + new THREE.BoxGeometry(1, 1, 1), + new THREE.MeshBasicMaterial({ color: 0xff0000 }) + ); + object.position.set(0.3, 1.4, -0.4) + object.scale.set(0.2,0.2,0.2) + scene.add(object); +} + +//doTHREE() + +// for [higherlevel] AFRAME markup see ~/index.html diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/manual.md b/buildroot-v86/board/v86/rootfs_overlay/root/manual.md index e1d0494..05deb4d 100644 --- a/buildroot-v86/board/v86/rootfs_overlay/root/manual.md +++ b/buildroot-v86/board/v86/rootfs_overlay/root/manual.md @@ -69,7 +69,7 @@ The following files are loaded during boot (via `/etc/profile`) # Calling terminal from javascript ```javascript -const term = document.querySelector('[isoterminal]').components.isoterminal.isoterminal +const term = document.querySelector('[isoterminal]').components.isoterminal.term term.exec("ls -la") ``` diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/redbean-3.0.0.com b/buildroot-v86/board/v86/rootfs_overlay/root/redbean-3.0.0.com deleted file mode 100755 index 7cb7c76..0000000 Binary files a/buildroot-v86/board/v86/rootfs_overlay/root/redbean-3.0.0.com and /dev/null differ diff --git a/dist/v86-linux.iso b/dist/v86-linux.iso index 4c51883..296bee3 100644 Binary files a/dist/v86-linux.iso and b/dist/v86-linux.iso differ diff --git a/edit.sh b/edit.sh index 64106c2..3092bd3 100755 --- a/edit.sh +++ b/edit.sh @@ -8,7 +8,7 @@ make menuconfig test -d output/busybox-1.33.0 || mkdir -p output/busybox-1.33.0 cp /buildroot-v86/.config.busybox output/busybox-1.33.0/.config make busybox-menuconfig -cp output/busybox-1.33.0/.config /buildroot-v86/.config.busybox +cp output/build/busybox-1.33.0/.config /buildroot-v86/.config.busybox make linux-menuconfig make savedefconfig