ForgeOS is a custom `x86_64` operating system project that defaults to a CLI-only source-built userspace instead of an existing Linux distribution tree. It uses the Linux kernel as the kernel layer, systemd as PID 1, BusyBox as a compact shell/rescue utility set, a custom root filesystem overlay, and direct UEFI boot through the kernel EFI stub. An optional GNOME desktop image flavor is available through a Debian package bootstrap.
That dependency script is for Debian/Ubuntu hosts and installs only the packages needed for the console rootfs plus direct QEMU boot path. The build path then builds the kernel, Linux-PAM, systemd, D-Bus, BusyBox rescue tools, and a compressed initramfs, then boots it directly in QEMU over serial.
The default console accounts are `forge` and `root`; both use the password `forge`. Console logins go through BusyBox `login`, Linux-PAM, and `pam_systemd.so`, so `systemd-logind` tracks real per-user sessions.
Nix is staged into the normal ForgeOS rootfs as the core package manager. On first boot, `forgeos-nix-bootstrap.service` registers the initial `/nix/store` closure, creates the default Nix profile, and starts `nix-daemon`. Log in as `forge` and install packages with the modern profile command:
This keeps the regular ForgeOS rootfs path and stages Openbox, tint2, PCManFM, Xorg, fonts, icons, and a terminal into it. The serial login prompt remains on `ttyS0`; `tty1` starts the desktop session.
This keeps the normal ForgeOS rootfs path and stages Emacs, Git, ripgrep, GNU find, fd, CA certificates, and the Doom Emacs Git checkout. On first shell login, ForgeOS seeds the user's `~/.config/emacs` and `~/.config/doom` from the staged Doom checkout and adds the Doom `bin` directory to `PATH`. Log in as `forge`, then run `doom sync` to fetch and compile the per-user Doom package set, followed by `doom doctor` if you want a dependency check.
To build a GNOME desktop image, install `mmdebstrap` on the host and use the GNOME targets:
```bash
cd /home/joe/forgeos
make gnome-image
make run-gnome
```
The GNOME image uses ForgeOS's kernel and boot image flow with a Debian `trixie` GNOME userspace. The default desktop account is `forge` with password `forge`, and GDM autologin is enabled by default. Override `GNOME_USER`, `GNOME_USER_PASSWORD`, `GNOME_AUTOLOGIN=0`, `GNOME_SUITE`, `GNOME_MIRROR`, or `IMAGE_SIZE_MIB` when building if needed.
To list candidate installation disks:
```bash
cd /home/joe/forgeos
make list-disks
```
To install ForgeOS to a real disk from a Linux host:
- The root filesystem is not copied from a distro. It is assembled from upstream systemd, upstream D-Bus, upstream Linux-PAM, upstream BusyBox rescue tools, copied runtime library dependencies for systemd, D-Bus, PAM, and BusyBox, and the files in `overlay/rootfs/`.
- The default removable-media boot path uses GRUB at `EFI/BOOT/BOOTX64.EFI` and keeps the kernel EFI stub at `EFI/BOOT/FORGEOS.EFI`.
- The built-in kernel command line targets `PARTLABEL=root` and keeps Intel graphics modesetting enabled, with a couple of laptop display workarounds for newer firmware.
- For default direct QEMU testing, `scripts/run-qemu.sh direct` uses the generated `rootfs.cpio.gz`.
- The host-side installer expands the root partition to fill larger target disks.
- systemd is installed as `/sbin/init`. BusyBox remains available for `/bin/sh`, PAM-backed `/bin/login`, early switch-root support, and emergency command-line tools.
- Nix `2.34.0` is staged from the official `x86_64-linux` binary tarball and configured in multi-user daemon mode with `/nix`, `nixbld` build users, `cache.nixos.org`, and `nix-command`/`flakes` enabled. Override `NIX_VERSION` or `NIX_SYSTEM` if you intentionally want a different upstream tarball.
-`systemd-logind` is included in the source-built systemd layer, owns `org.freedesktop.login1` on the system bus, and provides `loginctl` plus the logind varlink socket. `pam_systemd.so` registers console logins as logind sessions.
- DHCP networking is handled by `systemd-networkd`; DNS is handled by `systemd-resolved`, with `/etc/resolv.conf` linked to `/run/systemd/resolve/resolv.conf`.
-`ENABLE_DESKTOP=1` adds an Openbox/tint2/PCManFM desktop layer to the normal ForgeOS rootfs by extracting a minimal Debian package payload while preserving the source-built systemd and D-Bus daemons.
-`ENABLE_DOOM_EMACS=1` adds a Doom Emacs layer to the normal ForgeOS rootfs by extracting the needed Debian runtime packages and staging the upstream Doom Emacs Git checkout under `/usr/share/doom-emacs`.
-`DESKTOP=gnome` switches rootfs assembly to a Debian package bootstrap because GNOME depends on a large desktop stack that ForgeOS does not source-build yet.
Set `BOOTLOADER=stub` when building an image to use the direct kernel EFI-stub fallback path instead of GRUB.
## Secure Boot Signing
ForgeOS can build a Secure Boot-compatible fallback loader by signing the kernel EFI stub before it is copied to `EFI/BOOT/BOOTX64.EFI`.
Generate a local signing keypair:
```bash
cd /home/joe/forgeos
make secure-boot-keys
```
Build a signed disk image:
```bash
cd /home/joe/forgeos
SECURE_BOOT=1\
SECURE_BOOT_KEY=out/secure-boot/ForgeOS.key \
SECURE_BOOT_CERT=out/secure-boot/ForgeOS.crt \
make image
```
The host needs `sbsign` for signed builds. Enroll `out/secure-boot/ForgeOS.cer` in the target firmware Secure Boot database, or import it through a trusted shim/MOK flow, before booting the image with Secure Boot enabled. The generated private key should stay private; anyone with it can sign EFI binaries trusted by machines where the certificate is enrolled.
Linux-PAM, systemd, and D-Bus are built with Meson/Ninja and staged dynamically. BusyBox is also built dynamically so its `login` applet can load PAM modules. The build copies the ELF runtime library closure from the native build host into the root filesystem, so cross-building the userspace is not supported yet.