From 75efa40f2a5c1effef15683a0e643df38cc43157 Mon Sep 17 00:00:00 2001 From: Lisa Milne Date: Thu, 14 Dec 2023 14:18:46 +1000 Subject: [PATCH] bios version bump, and documentation update --- clite/bios.js | 2 +- readme-internals.txt | 99 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 1 deletion(-) diff --git a/clite/bios.js b/clite/bios.js index d4531ff..58a6fe1 100644 --- a/clite/bios.js +++ b/clite/bios.js @@ -1,7 +1,7 @@ (function() { var bios = { data:{ - version:'0.1', + version:'0.1.1', id:'BIOS', bootable:'clite/core.js', entry:null diff --git a/readme-internals.txt b/readme-internals.txt index 62a7e98..8fa5614 100644 --- a/readme-internals.txt +++ b/readme-internals.txt @@ -83,6 +83,105 @@ The Logger: system initialisation and shutdown, as well as writing them to the system log at /var/logs + +The Boot Process: + 1. Once the page has loaded, bios.init() is called. + bios.video is initialised, setting up the window to work as an + 80x25 text console. + bios.input is initialised, setting up hidden elements for capturing + keyboard input, as well as for uploading files. + 2. The bios exposes a function to the global context, then loads in a + bootable file as recorded in bios.data.bootable. + 3. core.js is loaded in, and passes clite.init to the function exposed by + the bios. + 4. The bios calls clite.init(bios) passing its own object as an argument. + 5. CLIte begins initialising subsystems: + 6. The console is initialised, giving CLIte access to video and keyboard. + 7. The VFS is initialised, bringing up the filesystem and standard io + calls. The core filesystem directories are created: + / + /bin + /dev + /etc + /lib + /proc + /tmp + /usr + /usr/clite + /usr/clite/web + /usr/home + /usr/share + /usr/share/docs + /usr/share/site + /usr/src + /usr/src/libs + /var + As well as the system log file: + /var/logs + 8. The TTY is initialised, extending the console to a multibuffered + system with escape code handling. /dev/tty0 is created. + 9. The system logger changes state to write to the tty and the log file. + Previous log data is written to the log file. +10. The root filesystem is 'mounted' by loading data/filesys.txt and + storing it in /dev/wfs, this is then read in and server-side + files are mapped to the filesystem, and marked as unloaded + remote data. +11. The default config files are created in /etc: + /etc/env environment variables + /etc/passwd user accounts + /etc/group system groups + /etc/greeting that big CLIte text that's printed on shell login + /etc/shrc init file for the shell (prints the above and so on) +12. The default device files are initialised in /dev: + /dev/local provides an interface for upload from and + downloading to the users computer. + /dev/null the null device + /dev/random read from this for a random number + /dev/initctl for accessing and changing the system runlevel + /dev/console mapped to the system console + /dev/tty special device that is always a process' + controlling tty + /dev/time for reading time in milliseconds since epoch +13. Commands and programs are loaded into /bin: + Exposes an api for programs to load into with. + Reads in files from the array in clite.includes.prog: + 13a: loads the file into the browser. + 13b: file content is stored in clite.commands.data as a + function, which is then called. + 13c: each program in the file calls clite.commands.load + passing its name and executable code as arguments. + The executable code is stored in /bin/ and + given executable permission, the code is also + converted to source with .toString() and stored + in /usr/src/.js + The program loading code is deleted. +14. Libraries are loaded into /lib: + Exposes an api for libraries to load into with. + Reads in files from the array in clite.includes.libs: + 14a: loads the file into the browser. + 14b: file content is stored in clite.libs.data as a + function, which is then called. + 14c: each library in the file calls clite.libs.load + passing its file name, header name, and executable + code as arguments. + The executable code is stored in /lib/.so + The code is also converted to source with + .toString() and stored in /usr/src/libs/.js + The file and header names are stored in + clite.libs.index for use later by the dynamic + linker. +15. The Process Manager is initialised, allowing for programs to be run. +16. The system is switched to runlevel 3, ending kernel initialisation, + and ready for user-level programs to be run. +17. The guest user account's home directory is created at /usr/home/guest, + shell dot files added, and /usr/share/site is symlinked to + /usr/home/guest/web +18. PID 1 is forked. At present this new process simply sets its uid and + gid to 1 (guest) then executes /bin/sh. At which point the shell + starts up, runs its rc files, and presents a command prompt to + the user. + + The Lifecycle of a Process: 1. fork() is called with the environment and io data passed to it.