Home /Modules/operating-system/SLBootloaderSpec.sleela

SLBootloaderSpec.sleela

lib/operating-system/SLBootloaderSpec.sleela · 99 line(s) · sleela

<< lib/operating-system/SLBootloaderSpec.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines SLBootloaderSpec — the firmware/boot layer of an OS being
     constructed. It records how the target OS is handed control by firmware and
     reaches its kernel: the firmware interface (UEFI or legacy BIOS), the boot
     loader used (GRUB for Linux shapes, BOOTMGR for Windows shapes, boot.efi
     for macOS shapes), whether Secure Boot is required, and the EFI System
     Partition layout. It also carries the initramfs/initrd decision for shapes
     that stage an early userspace before the root filesystem is mounted.
   
   In the firmware -> boot -> kernel -> userspace -> desktop model, this is the
   node between firmware and kernel. The ISO builder writes the ESP, installs
   the loader, and points it at the kernel the SLKernelSpec names.
   
   Family: operating-system. Pure design model; no native bridge calls. >>
#sleela 2.5
material;
class SLBootloaderSpec {
  < ---- 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 = 10870;
  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; }
  < "UEFI" or "BIOS" >
  String firmware;
  < "GRUB" / "BOOTMGR" / "boot.efi" / "systemd-boot" >
  String loader;
  < 1 require Secure Boot >
  int secureBoot;
  < 1 stage an initramfs/initrd early userspace >
  int useInitramfs;
  < EFI System Partition volume label >
  String espLabel;
  < menu timeout, as a string ("5") >
  String timeout;
  int configured;

  void configure(String fw, String bootLoader) {
    firmware = fw; loader = bootLoader; secureBoot = 1; useInitramfs = 1;
    espLabel = "ESP"; timeout = "5"; configured = 1;
  }

  < Default boot style for a shape (UEFI everywhere on modern hardware). >
  void forShape(SLOSShape shape) {
    if (shape.isWindows()) { configure("UEFI", "BOOTMGR"); useInitramfs = 0; return; }
    if (shape.isMac())     { configure("UEFI", "boot.efi"); useInitramfs = 0; return; }
    < Linux: GRUB + initramfs >
    configure("UEFI", "GRUB");
  }

  void requireSecureBoot(boolean on) { if (on) { secureBoot = 1; } else { secureBoot = 0; } }
  void setTimeout(String seconds) { timeout = seconds; }
  String menuTimeout() { return timeout; }

  boolean isUefi() { return firmware == "UEFI"; }
  String loaderName() { return loader; }
  String firmwareName() { return firmware; }
  boolean stagesInitramfs() { return useInitramfs == 1; }

  < A boot layer is complete when it names a firmware and a loader. >
  boolean isComplete() { return configured == 1 && loader != "" && firmware != ""; }
}