4 ms·
I did this for an internal project - the system controller of an embedded system. The main CPU booted into a Lua shell, had a VFS implementation so it could re
by spacedcowboy 4y ago
I did this for an internal project - the system controller of an embedded system.
The main CPU booted into a Lua shell, had a VFS implementation so it could read "files" from disk (areas on the flash chip) and had the same io interface to "/tmp" (which was RAM). It looked in /boot to find 00-<whatever>, 01-<whatever> etc. and executed those Lua scripts in numerical order at boot, and it provided stdio redirection over a PCIe link (via thunderbolt, actually) to the host.
Once the boot process was finished, all the peripherals were booted, and the state was quiescent, it fell back into an interactive Lua shell (using the stdio redirection). I could (on the host) run an application that made it look as though I was "logged in".
Since we exposed all the peripherals as Lua classes, and we could interactively call methods on those classes, it was really easy to reconfigure the thing on-the-fly, reset a peripheral with different values, or tune things in the actual working environment. A fair amount of initial work, but it really paid off over the lifetime of the project.
Basically I wrote a very simple OS :) Lots of fun was had.