feat: add systemd Nix rootfs

This commit is contained in:
blazblue547-afk committed 2026-06-17 12:55:11 -04:00
1 parent 9e86817361
commit 1c3099dbac
38 files changed
+735 -1190

No files matched your search

+43 -28
View File
@@ -2,15 +2,17 @@
## Goal
ForgeOS ARM64 is the AArch64 flavor of ForgeOS. It targets 64-bit ARM systems
with UEFI firmware and keeps the ForgeOS image builder, boot layout, kernel
configuration style, default user setup, and Nix integration.
ForgeOS ARM64 targets 64-bit ARM systems with UEFI firmware. The target image
boots systemd as PID 1 and uses Nix as the core package manager.
The original x86_64 ForgeOS source-built userspace path depends on native host
runtime libraries for PAM, systemd, D-Bus, and BusyBox. This ARM64 flavor uses a
Debian `arm64` rootfs bootstrap instead, which gives the architecture flavor a
real ARM64 userspace while the source-built cross-sysroot work remains future
work.
The current stack is:
- Linux kernel source from kernel.org
- systemd source from the upstream systemd project
- BusyBox source from busybox.net for static rescue and early-boot tools
- official Nix `aarch64-linux` binary tarball for the Nix store bootstrap
- ForgeOS shell scripts, identity files, unit files, boot configuration, and
image layout from this repository
## Boot Model
@@ -22,22 +24,33 @@ work.
`EFI/BOOT/FORGEOS.EFI`.
5. UEFI firmware executes GRUB from `EFI/BOOT/BOOTAA64.EFI`.
6. GRUB starts the kernel with `root=PARTLABEL=root`.
7. systemd starts from the ARM64 rootfs and launches console login on `tty1` and
serial login on `ttyAMA0`.
7. The kernel mounts the ext4 root partition and executes `/sbin/init`.
8. `/sbin/init` points to `/usr/lib/systemd/systemd`.
9. systemd reaches `multi-user.target`, starts console login units, networkd,
resolved, timesyncd, the Nix bootstrap service, and nix-daemon.
The image also includes `rootfs.cpio.gz` on the EFI partition. The GRUB
initramfs entries can use `/init` and `/sbin/forgeos-switch-root` to locate and
switch to the real ext4 root partition before executing systemd.
## Root Filesystem Model
The default rootfs is assembled in `staging/rootfs` from:
- Debian `trixie` ARM64 packages
- ForgeOS identity, user, network, and systemd defaults
- a systemd `DESTDIR` install tree
- a statically linked ARM64 BusyBox utility tree
- generated `/etc/passwd`, `/etc/shadow`, `/etc/group`, `/etc/fstab`,
`/etc/systemd/*`, network, hostname, profile, and OS identity files
- ForgeOS helper scripts from `overlay/rootfs`
- the official Nix ARM64 store closure plus registration metadata
- kernel modules from the ARM64 kernel build
- the official Nix `aarch64-linux` binary tarball staged into `/nix/store`
- the ARM64 kernel image copied to `/boot`
The default package set is intentionally console-focused. It includes systemd,
D-Bus, sudo, locales, CA certificates, kmod, iproute2, ping, procps, resolved,
and timesyncd. The optional `DESKTOP=gnome` flavor uses the same ARM64 kernel and
image flow with a larger Debian GNOME rootfs.
systemd units are enabled by creating `.wants` symlinks in
`/etc/systemd/system`, matching systemd's normal enablement model. Nix follows a
multi-user daemon layout: `nixbld` users are generated in `/etc/passwd`,
`/etc/nix/nix.conf` declares `build-users-group = nixbld`, and
`nix-daemon.socket`/`nix-daemon.service` are enabled under systemd.
## QEMU Model
@@ -47,21 +60,23 @@ The run scripts use `qemu-system-aarch64` with:
- `-cpu max`
- PL011 serial console through `ttyAMA0`
- AAVMF firmware for UEFI image boots
- virtio block, network, rng, and GPU devices where appropriate
- virtio block, network, and rng devices
## Known Gaps
- Source-built ARM64 systemd/PAM/D-Bus userspace.
- Board-specific kernel profiles beyond QEMU `virt`.
- Microsoft/shim-signed Secure Boot chain.
- Declarative NixOS-style system rebuilds and rollback management.
- In-OS guided installer and update system.
- The Nix payload is currently the official binary tarball rather than a
source-built Nix closure.
- The systemd build depends on an ARM64 sysroot for target development and
runtime libraries.
- No desktop environment or graphical login.
- No board-specific kernel profiles beyond QEMU `virt`.
- No Microsoft/shim-signed Secure Boot chain.
- No in-OS guided installer or update system.
## Suggested Next Steps
1. Add a cross-built ARM64 sysroot for source-built systemd, PAM, D-Bus, and
BusyBox.
2. Add hardware profiles for common ARM64 laptops, SBCs, and servers.
3. Add CI that builds `make kernel`, `make rootfs`, and `make image` on an
1. Add a first-class ARM64 sysroot recipe for systemd dependencies.
2. Add a source-built Nix recipe or a reproducible closure generator.
3. Add hardware profiles for common ARM64 laptops, SBCs, and servers.
4. Add CI that builds `make kernel`, `make rootfs`, and `make image` on an
x86_64 host with the AArch64 cross toolchain.
4. Add an ARM64 Secure Boot/shim story for real hardware deployment.