Home /Modules/operating-system/SLDriverSet.sleela

SLDriverSet.sleela

lib/operating-system/SLDriverSet.sleela · 100 line(s) · sleela

<< lib/operating-system/SLDriverSet.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines SLDriverSet โ€” the device-driver layer of an OS being
     constructed: the drivers the kernel loads to abstract real hardware
     (storage controllers, network interfaces, display/GPU, input, USB, audio).
     It records each driver's name and binding model โ€” built into the kernel
     image, or loaded as a module after boot โ€” so the kernel-config and
     initramfs steps know which drivers must be present before the root
     filesystem can be mounted.
   
   In the firmware -> boot -> kernel -> userspace -> desktop model, drivers hang
   off the kernel node: storage and bus drivers in particular must be available
   early (built-in or in the initramfs) for the kernel to reach the rootfs.
   
   Family: operating-system. Pure design model; no native bridge calls. >>
#sleela 2.5
material;
class SLDriverSet {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
     or catalog can read and (where appropriate) override this record.
     Values are faithful to the subject's real origin where publicly known. >>
  String metaVersion = "1.0.0";
  int metaId = 10890;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-16";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-10";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 9;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }
  < newline-separated "name binding" lines (binding: builtin|module) >
  String drivers;
  int count;
  int builtinCount;
  int configured;

  void configure() { drivers = ""; count = 0; builtinCount = 0; configured = 1; }

  void add(String name, String binding) {
    String line = name + " " + binding;
    if (drivers == "") { drivers = line; } else { drivers = drivers + "\n" + line; }
    count = count + 1;
    if (binding == "builtin") { builtinCount = builtinCount + 1; }
  }
  < A driver that must be present before the rootfs mounts -> built-in. >
  void builtin(String name) { add(name, "builtin"); }
  < A driver loaded on demand after boot -> module. >
  void module(String name) { add(name, "module"); }

  < Seed the baseline driver set for a shape. Storage/bus/input are built in; >
  < GPU/audio/extra network are modules. >
  void forShape(SLOSShape shape) {
    configure();
    builtin("storage-ahci");
    builtin("storage-nvme");
    builtin("bus-pci");
    builtin("input-hid");
    module("net-ethernet");
    module("net-wifi");
    module("gpu-display");
    module("usb-xhci");
    module("audio");
  }

  String driverManifest() { return drivers; }
  int driverCount()       { return count; }
  int builtinDriverCount(){ return builtinCount; }
  < The kernel can reach a rootfs only if at least one storage driver is built in. >
  boolean canReachRootfs() { return builtinCount > 0; }
}